aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorSeb Sauvage <sebsauvage@sebsauvage.net>2011-10-17 22:14:14 +0200
committerEmilien Klein <emilien@klein.st>2011-10-17 22:14:14 +0200
commit03cd3750fd26d2667ccdadb55fd4807be34e1d1c (patch)
treee99cb202e95ffa0bf47732b9dac2ae6c18f065ac /index.php
parent008d8b95ef7d7b5e8e79b633ecc6d0097e0b0e28 (diff)
downloadShaarli-03cd3750fd26d2667ccdadb55fd4807be34e1d1c.tar.gz
Shaarli-03cd3750fd26d2667ccdadb55fd4807be34e1d1c.tar.zst
Shaarli-03cd3750fd26d2667ccdadb55fd4807be34e1d1c.zip
Version 0.0.26 beta:
- Corrected: Removed extras space in description when URLs are converted to clickable links. - Changed: Made permalink more visible (smallHash). - Corrected: Thumbnail for subreddit imgur urls (/r/…) were corrected (thanks to Accent Grave).
Diffstat (limited to 'index.php')
-rw-r--r--index.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/index.php b/index.php
index ce6a51c4..f182ad29 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
1<?php 1<?php
2// Shaarli 0.0.25 beta - Shaare your links... 2// Shaarli 0.0.26 beta - Shaare your links...
3// The personal, minimalist, super-fast, no-database delicious clone. By sebsauvage.net 3// The personal, minimalist, super-fast, no-database delicious clone. By sebsauvage.net
4// http://sebsauvage.net/wiki/doku.php?id=php:shaarli 4// http://sebsauvage.net/wiki/doku.php?id=php:shaarli
5// Licence: http://www.opensource.org/licenses/zlib-license.php 5// Licence: http://www.opensource.org/licenses/zlib-license.php
@@ -53,7 +53,7 @@ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
53header("Cache-Control: no-store, no-cache, must-revalidate"); 53header("Cache-Control: no-store, no-cache, must-revalidate");
54header("Cache-Control: post-check=0, pre-check=0", false); 54header("Cache-Control: post-check=0, pre-check=0", false);
55header("Pragma: no-cache"); 55header("Pragma: no-cache");
56define('shaarli_version','0.0.25 beta'); 56define('shaarli_version','0.0.26 beta');
57if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); } 57if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); }
58if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. 58if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
59if ($GLOBALS['config']['ENABLE_LOCALCACHE']) 59if ($GLOBALS['config']['ENABLE_LOCALCACHE'])
@@ -134,7 +134,7 @@ function smallHash($text)
134function text2clickable($url) 134function text2clickable($url)
135{ 135{
136 $redir = empty($GLOBALS['redirector']) ? '' : $GLOBALS['redirector']; 136 $redir = empty($GLOBALS['redirector']) ? '' : $GLOBALS['redirector'];
137 return preg_replace('!((?:https?|ftp)://\S+[[:alnum:]]/?)!si','<a href="'.$redir.'$1" rel="nofollow">$1</a> ',$url); 137 return preg_replace('!((?:https?|ftp)://\S+[[:alnum:]]/?)!si','<a href="'.$redir.'$1" rel="nofollow">$1</a>',$url);
138} 138}
139// ------------------------------------------------------------------------------------------ 139// ------------------------------------------------------------------------------------------
140// Sniff browser language to display dates in the right format automatically. 140// Sniff browser language to display dates in the right format automatically.
@@ -1347,8 +1347,8 @@ function templateLinkList()
1347 $linklist.='<li '.$classprivate.'>'.thumbnail($link['url']); 1347 $linklist.='<li '.$classprivate.'>'.thumbnail($link['url']);
1348 $linklist.='<div class="linkcontainer"><span class="linktitle"><a href="'.$redir.htmlspecialchars($link['url']).'">'.htmlspecialchars($title).'</a></span>'.$actions.'<br>'; 1348 $linklist.='<div class="linkcontainer"><span class="linktitle"><a href="'.$redir.htmlspecialchars($link['url']).'">'.htmlspecialchars($title).'</a></span>'.$actions.'<br>';
1349 if ($description!='') $linklist.='<div class="linkdescription">'.nl2br($description).'</div><br>'; 1349 if ($description!='') $linklist.='<div class="linkdescription">'.nl2br($description).'</div><br>';
1350 if (!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()) $linklist.='<span class="linkdate" title="Short link here"><a href="?'.smallHash($link['linkdate']).'">'.htmlspecialchars(linkdate2locale($link['linkdate'])).' </a> - </span>'; 1350 if (!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()) $linklist.='<span class="linkdate" title="Permalink"><a href="?'.smallHash($link['linkdate']).'">'.htmlspecialchars(linkdate2locale($link['linkdate'])).' - permalink</a> - </span>';
1351 else $linklist.='<span class="linkdate" title="Short link here"><a href="?'.smallHash($link['linkdate']).'">link</a> - </span>'; 1351 else $linklist.='<span class="linkdate" title="Short link here"><a href="?'.smallHash($link['linkdate']).'">permalink</a> - </span>';
1352 $linklist.='<span class="linkurl" title="Short link">'.htmlspecialchars($link['url']).'</span><br>'.$tags."</div></li>\n"; 1352 $linklist.='<span class="linkurl" title="Short link">'.htmlspecialchars($link['url']).'</span><br>'.$tags."</div></li>\n";
1353 $i++; 1353 $i++;
1354 } 1354 }
@@ -1388,8 +1388,9 @@ function thumbnail($url)
1388 if ($domain=='imgur.com') 1388 if ($domain=='imgur.com')
1389 { 1389 {
1390 $path = parse_url($url,PHP_URL_PATH); 1390 $path = parse_url($url,PHP_URL_PATH);
1391 if (substr_count($path,'/')==1) return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com/'.htmlspecialchars(substr($path,1)).'s.jpg" width="90" height="90"></a></div>'; 1391 if (strpos($path,'/r/')==0) return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com/'.htmlspecialchars(basename($path)).'s.jpg" width="90" height="90"></a></div>';
1392 if (strpos($path,'/gallery/')==0) return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com'.htmlspecialchars(substr($path,8)).'s.jpg" width="90" height="90"></a></div>'; 1392 if (strpos($path,'/gallery/')==0) return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com'.htmlspecialchars(substr($path,8)).'s.jpg" width="90" height="90"></a></div>';
1393 if (substr_count($path,'/')==1) return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com/'.htmlspecialchars(substr($path,1)).'s.jpg" width="90" height="90"></a></div>';
1393 } 1394 }
1394 if ($domain=='i.imgur.com') 1395 if ($domain=='i.imgur.com')
1395 { 1396 {