diff options
author | Alexandre Alapetite <alexandre@alapetite.fr> | 2013-09-21 18:15:41 +0200 |
---|---|---|
committer | Alexandre Alapetite <alexandre@alapetite.fr> | 2013-09-21 18:15:41 +0200 |
commit | fc93ae1d1a661ff33d1f1ed1100ae09277a77456 (patch) | |
tree | d72a4c1057023075c689023ac58093b9afd169cb /index.php | |
parent | 002ef0e5c8ed2bab38e205a5d54617780f25c3a9 (diff) | |
download | Shaarli-fc93ae1d1a661ff33d1f1ed1100ae09277a77456.tar.gz Shaarli-fc93ae1d1a661ff33d1f1ed1100ae09277a77456.tar.zst Shaarli-fc93ae1d1a661ff33d1f1ed1100ae09277a77456.zip |
Import NETSCAPE-Bookmark compatible milliseconds
NETSCAPE-Bookmark sometimes contains dates as milliseconds instead of
seconds.
For instance, this is the case of the files gererated for Google +1s by
Google Takeout.
This patch make these files compatible.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1695,7 +1695,11 @@ function importFile() | |||
1695 | { | 1695 | { |
1696 | $attr=$m[1]; $value=$m[2]; | 1696 | $attr=$m[1]; $value=$m[2]; |
1697 | if ($attr=='HREF') $link['url']=html_entity_decode($value,ENT_QUOTES,'UTF-8'); | 1697 | if ($attr=='HREF') $link['url']=html_entity_decode($value,ENT_QUOTES,'UTF-8'); |
1698 | elseif ($attr=='ADD_DATE') $raw_add_date=intval($value); | 1698 | elseif ($attr=='ADD_DATE') |
1699 | { | ||
1700 | $raw_add_date=intval($value); | ||
1701 | if ($raw_add_date>30000000000) $raw_add_date/=1000; //If larger than year 2920, then was likely stored in milliseconds instead of seconds | ||
1702 | } | ||
1699 | elseif ($attr=='PRIVATE') $link['private']=($value=='0'?0:1); | 1703 | elseif ($attr=='PRIVATE') $link['private']=($value=='0'?0:1); |
1700 | elseif ($attr=='TAGS') $link['tags']=html_entity_decode(str_replace(',',' ',$value),ENT_QUOTES,'UTF-8'); | 1704 | elseif ($attr=='TAGS') $link['tags']=html_entity_decode(str_replace(',',' ',$value),ENT_QUOTES,'UTF-8'); |
1701 | } | 1705 | } |