diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-05-10 23:31:41 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-05-10 23:31:41 +0200 |
commit | 5046bcb6ab324a6b52669b2b76a41665022f653a (patch) | |
tree | 84a2c144ef7d9eb0a585d2c8e1bfe63311f979a3 /index.php | |
parent | d95533778d86bb6c6de3b14a9da35e6d6e6428bd (diff) | |
download | Shaarli-5046bcb6ab324a6b52669b2b76a41665022f653a.tar.gz Shaarli-5046bcb6ab324a6b52669b2b76a41665022f653a.tar.zst Shaarli-5046bcb6ab324a6b52669b2b76a41665022f653a.zip |
Fix startsWith and endsWith case
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -690,7 +690,7 @@ class pageBuilder | |||
690 | // This RSS feed cannot be filtered. | 690 | // This RSS feed cannot be filtered. |
691 | function showDailyRSS() { | 691 | function showDailyRSS() { |
692 | // Cache system | 692 | // Cache system |
693 | $query = $_SERVER["QUERY_STRING"]; | 693 | $query = $_SERVER['QUERY_STRING']; |
694 | $cache = new CachedPage( | 694 | $cache = new CachedPage( |
695 | $GLOBALS['config']['PAGECACHE'], | 695 | $GLOBALS['config']['PAGECACHE'], |
696 | page_url($_SERVER), | 696 | page_url($_SERVER), |
@@ -948,7 +948,7 @@ function renderPage() | |||
948 | exit; | 948 | exit; |
949 | } | 949 | } |
950 | // -------- User wants to logout. | 950 | // -------- User wants to logout. |
951 | if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=logout')) | 951 | if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=logout')) |
952 | { | 952 | { |
953 | invalidateCaches($GLOBALS['config']['PAGECACHE']); | 953 | invalidateCaches($GLOBALS['config']['PAGECACHE']); |
954 | logout(); | 954 | logout(); |
@@ -1636,7 +1636,7 @@ function renderPage() | |||
1636 | } | 1636 | } |
1637 | 1637 | ||
1638 | // -------- User is uploading a file for import | 1638 | // -------- User is uploading a file for import |
1639 | if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=upload')) | 1639 | if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=upload')) |
1640 | { | 1640 | { |
1641 | // If file is too big, some form field may be missing. | 1641 | // If file is too big, some form field may be missing. |
1642 | if (!isset($_POST['token']) || (!isset($_FILES)) || (isset($_FILES['filetoupload']['size']) && $_FILES['filetoupload']['size']==0)) | 1642 | if (!isset($_POST['token']) || (!isset($_FILES)) || (isset($_FILES['filetoupload']['size']) && $_FILES['filetoupload']['size']==0)) |
@@ -1739,7 +1739,7 @@ function importFile($LINKSDB) | |||
1739 | { | 1739 | { |
1740 | $link = array('linkdate'=>'','title'=>'','url'=>'','description'=>'','tags'=>'','private'=>0); | 1740 | $link = array('linkdate'=>'','title'=>'','url'=>'','description'=>'','tags'=>'','private'=>0); |
1741 | $d = explode('<DD>',$html); | 1741 | $d = explode('<DD>',$html); |
1742 | if (startswith($d[0],'<A ')) | 1742 | if (startsWith($d[0], '<A ')) |
1743 | { | 1743 | { |
1744 | $link['description'] = (isset($d[1]) ? html_entity_decode(trim($d[1]),ENT_QUOTES,'UTF-8') : ''); // Get description (optional) | 1744 | $link['description'] = (isset($d[1]) ? html_entity_decode(trim($d[1]),ENT_QUOTES,'UTF-8') : ''); // Get description (optional) |
1745 | preg_match('!<A .*?>(.*?)</A>!i',$d[0],$matches); $link['title'] = (isset($matches[1]) ? trim($matches[1]) : ''); // Get title | 1745 | preg_match('!<A .*?>(.*?)</A>!i',$d[0],$matches); $link['title'] = (isset($matches[1]) ? trim($matches[1]) : ''); // Get title |
@@ -2210,7 +2210,7 @@ function genThumbnail() | |||
2210 | 2210 | ||
2211 | // Is this a link to an image, or to a flickr page ? | 2211 | // Is this a link to an image, or to a flickr page ? |
2212 | $imageurl=''; | 2212 | $imageurl=''; |
2213 | if (endswith(parse_url($url,PHP_URL_PATH),'.jpg')) | 2213 | if (endsWith(parse_url($url, PHP_URL_PATH), '.jpg')) |
2214 | { // This is a direct link to an image. e.g. http://farm1.staticflickr.com/5/5921913_ac83ed27bd_o.jpg | 2214 | { // This is a direct link to an image. e.g. http://farm1.staticflickr.com/5/5921913_ac83ed27bd_o.jpg |
2215 | preg_match('!(http://farm\d+\.staticflickr\.com/\d+/\d+_\w+_)\w.jpg!',$url,$matches); | 2215 | preg_match('!(http://farm\d+\.staticflickr\.com/\d+/\d+_\w+_)\w.jpg!',$url,$matches); |
2216 | if (!empty($matches[1])) $imageurl=$matches[1].'m.jpg'; | 2216 | if (!empty($matches[1])) $imageurl=$matches[1].'m.jpg'; |
@@ -2387,8 +2387,8 @@ function resizeImage($filepath) | |||
2387 | return true; | 2387 | return true; |
2388 | } | 2388 | } |
2389 | 2389 | ||
2390 | if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database. | 2390 | if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database. |
2391 | if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=dailyrss')) { showDailyRSS(); exit; } | 2391 | if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=dailyrss')) { showDailyRSS(); exit; } |
2392 | if (!isset($_SESSION['LINKS_PER_PAGE'])) $_SESSION['LINKS_PER_PAGE']=$GLOBALS['config']['LINKS_PER_PAGE']; | 2392 | if (!isset($_SESSION['LINKS_PER_PAGE'])) $_SESSION['LINKS_PER_PAGE']=$GLOBALS['config']['LINKS_PER_PAGE']; |
2393 | renderPage(); | 2393 | renderPage(); |
2394 | ?> | 2394 | ?> |