X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=d3e105f90997352e2c4291b1e409dfb58b07c113;hb=c4bbb010643c265131f9b0c1aba76f3b12561c06;hp=04288ace5676fc5b98c202c05256bb2b3c73d381;hpb=3057373a250648a081107eb3eab530b628a576f1;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 04288ace..d3e105f9 100644 --- a/index.php +++ b/index.php @@ -566,7 +566,7 @@ function getHTTP($url,$timeout=30) { try { - $options = array('http'=>array('method'=>'GET','timeout' => $timeout)); // Force network timeout + $options = array('http'=>array('method'=>'GET','timeout' => $timeout, 'user_agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0')); // Force network timeout $context = stream_context_create($options); $data=file_get_contents($url,false,$context,-1, 4000000); // We download at most 4 Mb from source. if (!$data) { return array('HTTP Error',array(),''); } @@ -1696,7 +1696,11 @@ function importFile() { $attr=$m[1]; $value=$m[2]; if ($attr=='HREF') $link['url']=html_entity_decode($value,ENT_QUOTES,'UTF-8'); - elseif ($attr=='ADD_DATE') $raw_add_date=intval($value); + elseif ($attr=='ADD_DATE') + { + $raw_add_date=intval($value); + if ($raw_add_date>30000000000) $raw_add_date/=1000; //If larger than year 2920, then was likely stored in milliseconds instead of seconds + } elseif ($attr=='PRIVATE') $link['private']=($value=='0'?0:1); elseif ($attr=='TAGS') $link['tags']=html_entity_decode(str_replace(',',' ',$value),ENT_QUOTES,'UTF-8'); }