diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -566,7 +566,7 @@ function getHTTP($url,$timeout=30) | |||
566 | { | 566 | { |
567 | try | 567 | try |
568 | { | 568 | { |
569 | $options = array('http'=>array('method'=>'GET','timeout' => $timeout)); // Force network timeout | 569 | $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 |
570 | $context = stream_context_create($options); | 570 | $context = stream_context_create($options); |
571 | $data=file_get_contents($url,false,$context,-1, 4000000); // We download at most 4 Mb from source. | 571 | $data=file_get_contents($url,false,$context,-1, 4000000); // We download at most 4 Mb from source. |
572 | if (!$data) { return array('HTTP Error',array(),''); } | 572 | if (!$data) { return array('HTTP Error',array(),''); } |
@@ -1538,7 +1538,8 @@ function renderPage() | |||
1538 | $link_is_new = true; // This is a new link | 1538 | $link_is_new = true; // This is a new link |
1539 | $linkdate = strval(date('Ymd_His')); | 1539 | $linkdate = strval(date('Ymd_His')); |
1540 | $title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet). | 1540 | $title = (empty($_GET['title']) ? '' : $_GET['title'] ); // Get title if it was provided in URL (by the bookmarklet). |
1541 | $description=''; $tags=''; $private=0; | 1541 | $description = (empty($_GET['description']) ? '' : $_GET['description'] )."\n"; // Get description if it was provided in URL (by the bookmarklet). [Bronco added that] |
1542 | $tags=''; $private=0; | ||
1542 | if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url; | 1543 | if (($url!='') && parse_url($url,PHP_URL_SCHEME)=='') $url = 'http://'.$url; |
1543 | // If this is an HTTP link, we try go get the page to extact the title (otherwise we will to straight to the edit form.) | 1544 | // If this is an HTTP link, we try go get the page to extact the title (otherwise we will to straight to the edit form.) |
1544 | if (empty($title) && parse_url($url,PHP_URL_SCHEME)=='http') | 1545 | if (empty($title) && parse_url($url,PHP_URL_SCHEME)=='http') |
@@ -1695,7 +1696,11 @@ function importFile() | |||
1695 | { | 1696 | { |
1696 | $attr=$m[1]; $value=$m[2]; | 1697 | $attr=$m[1]; $value=$m[2]; |
1697 | if ($attr=='HREF') $link['url']=html_entity_decode($value,ENT_QUOTES,'UTF-8'); | 1698 | if ($attr=='HREF') $link['url']=html_entity_decode($value,ENT_QUOTES,'UTF-8'); |
1698 | elseif ($attr=='ADD_DATE') $raw_add_date=intval($value); | 1699 | elseif ($attr=='ADD_DATE') |
1700 | { | ||
1701 | $raw_add_date=intval($value); | ||
1702 | if ($raw_add_date>30000000000) $raw_add_date/=1000; //If larger than year 2920, then was likely stored in milliseconds instead of seconds | ||
1703 | } | ||
1699 | elseif ($attr=='PRIVATE') $link['private']=($value=='0'?0:1); | 1704 | 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'); | 1705 | elseif ($attr=='TAGS') $link['tags']=html_entity_decode(str_replace(',',' ',$value),ENT_QUOTES,'UTF-8'); |
1701 | } | 1706 | } |
@@ -2440,4 +2445,4 @@ if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=d | |||
2440 | if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'ws=')) { processWS(); exit; } // Webservices (for jQuery/jQueryUI) | 2445 | if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'ws=')) { processWS(); exit; } // Webservices (for jQuery/jQueryUI) |
2441 | if (!isset($_SESSION['LINKS_PER_PAGE'])) $_SESSION['LINKS_PER_PAGE']=$GLOBALS['config']['LINKS_PER_PAGE']; | 2446 | if (!isset($_SESSION['LINKS_PER_PAGE'])) $_SESSION['LINKS_PER_PAGE']=$GLOBALS['config']['LINKS_PER_PAGE']; |
2442 | renderPage(); | 2447 | renderPage(); |
2443 | ?> \ No newline at end of file | 2448 | ?> |