aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.php66
-rw-r--r--shaarli.css24
2 files changed, 69 insertions, 21 deletions
diff --git a/index.php b/index.php
index f182ad29..801108b8 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
1<?php 1<?php
2// Shaarli 0.0.26 beta - Shaare your links... 2// Shaarli 0.0.27 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.26 beta'); 56define('shaarli_version','0.0.27 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'])
@@ -738,6 +738,32 @@ function renderPage()
738 exit; 738 exit;
739 } 739 }
740 740
741 // -------- Picture wall
742 if (startswith($_SERVER["QUERY_STRING"],'do=picwall'))
743 {
744 // Optionnaly filter the results:
745 $linksToDisplay=array();
746 if (!empty($_GET['searchterm'])) $linksToDisplay = $LINKSDB->filterFulltext($_GET['searchterm']);
747 elseif (!empty($_GET['searchtags'])) $linksToDisplay = $LINKSDB->filterTags(trim($_GET['searchtags']));
748 else $linksToDisplay = $LINKSDB;
749 $body='';
750 foreach($linksToDisplay as $link)
751 {
752 $thumb=thumbnail($link['url']);
753 if ($thumb!='')
754 {
755 $url=htmlspecialchars($link['url'],ENT_QUOTES);
756 $body.='<div class="picwall_pictureframe">'.$thumb.'<a href="'.$url.'"><span class="info">'.htmlspecialchars($link['title']).'</span></a></div>';
757
758 }
759 }
760 $body = '<center><div id="picwall_container">'.$body.'<hr style="width:0;height:0;clear:both;"></div></center>';
761 $data = array('pageheader'=>'<br>&nbsp;','body'=>$body,'onload'=>'');
762 templatePage($data);
763 exit;
764
765 }
766
741 // -------- Tag cloud 767 // -------- Tag cloud
742 if (startswith($_SERVER["QUERY_STRING"],'do=tagcloud')) 768 if (startswith($_SERVER["QUERY_STRING"],'do=tagcloud'))
743 { 769 {
@@ -1344,7 +1370,7 @@ function templateLinkList()
1344 foreach(explode(' ',$link['tags']) as $tag) { $tags.='<span class="linktag" title="Add tag"><a href="?addtag='.htmlspecialchars($tag).'">'.htmlspecialchars($tag).'</a></span> '; } 1370 foreach(explode(' ',$link['tags']) as $tag) { $tags.='<span class="linktag" title="Add tag"><a href="?addtag='.htmlspecialchars($tag).'">'.htmlspecialchars($tag).'</a></span> '; }
1345 $tags='<div class="linktaglist">'.$tags.'</div>'; 1371 $tags='<div class="linktaglist">'.$tags.'</div>';
1346 } 1372 }
1347 $linklist.='<li '.$classprivate.'>'.thumbnail($link['url']); 1373 $linklist.='<li '.$classprivate.'><div class="thumbnail">'.thumbnail($link['url']).'</div>';
1348 $linklist.='<div class="linkcontainer"><span class="linktitle"><a href="'.$redir.htmlspecialchars($link['url']).'">'.htmlspecialchars($title).'</a></span>'.$actions.'<br>'; 1374 $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>'; 1375 if ($description!='') $linklist.='<div class="linkdescription">'.nl2br($description).'</div><br>';
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>'; 1376 if (!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()) $linklist.='<span class="linkdate" title="Permalink"><a href="?'.smallHash($link['linkdate']).'">'.htmlspecialchars(linkdate2locale($link['linkdate'])).' - permalink</a> - </span>';
@@ -1383,26 +1409,26 @@ function thumbnail($url)
1383 if ($domain=='youtube.com' || $domain=='www.youtube.com') 1409 if ($domain=='youtube.com' || $domain=='www.youtube.com')
1384 { 1410 {
1385 parse_str(parse_url($url,PHP_URL_QUERY), $params); // Extract video ID and get thumbnail 1411 parse_str(parse_url($url,PHP_URL_QUERY), $params); // Extract video ID and get thumbnail
1386 if (!empty($params['v'])) return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="http://img.youtube.com/vi/'.htmlspecialchars($params['v']).'/default.jpg" width="120" height="90"></a></div>'; 1412 if (!empty($params['v'])) return '<a href="'.htmlspecialchars($url).'"><img src="http://img.youtube.com/vi/'.htmlspecialchars($params['v']).'/default.jpg" width="120" height="90"></a>';
1387 } 1413 }
1388 if ($domain=='imgur.com') 1414 if ($domain=='imgur.com')
1389 { 1415 {
1390 $path = parse_url($url,PHP_URL_PATH); 1416 $path = parse_url($url,PHP_URL_PATH);
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>'; 1417 if (strpos($path,'/r/')==0) return '<a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com/'.htmlspecialchars(basename($path)).'s.jpg" width="90" height="90"></a>';
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>'; 1418 if (strpos($path,'/gallery/')==0) return '<a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com'.htmlspecialchars(substr($path,8)).'s.jpg" width="90" height="90"></a>';
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>'; 1419 if (substr_count($path,'/')==1) return '<a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com/'.htmlspecialchars(substr($path,1)).'s.jpg" width="90" height="90"></a>';
1394 } 1420 }
1395 if ($domain=='i.imgur.com') 1421 if ($domain=='i.imgur.com')
1396 { 1422 {
1397 $pi = pathinfo(parse_url($url,PHP_URL_PATH)); 1423 $pi = pathinfo(parse_url($url,PHP_URL_PATH));
1398 if (!empty($pi['filename'])) return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com/'.htmlspecialchars($pi['filename']).'s.jpg" width="90" height="90"></a></div>'; 1424 if (!empty($pi['filename'])) return '<a href="'.htmlspecialchars($url).'"><img src="http://i.imgur.com/'.htmlspecialchars($pi['filename']).'s.jpg" width="90" height="90"></a>';
1399 } 1425 }
1400 if ($domain=='dailymotion.com' || $domain=='www.dailymotion.com') 1426 if ($domain=='dailymotion.com' || $domain=='www.dailymotion.com')
1401 { 1427 {
1402 if (strpos($url,'dailymotion.com/video/')) 1428 if (strpos($url,'dailymotion.com/video/'))
1403 { 1429 {
1404 $thumburl=str_replace('dailymotion.com/video/','dailymotion.com/thumbnail/video/',$url); 1430 $thumburl=str_replace('dailymotion.com/video/','dailymotion.com/thumbnail/video/',$url);
1405 return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="'.htmlspecialchars($thumburl).'" width="120" style="height:auto;"></a></div>'; 1431 return '<a href="'.htmlspecialchars($url).'"><img src="'.htmlspecialchars($thumburl).'" width="120" style="height:auto;"></a>';
1406 } 1432 }
1407 } 1433 }
1408 if (endsWith($domain,'.imageshack.us')) 1434 if (endsWith($domain,'.imageshack.us'))
@@ -1411,7 +1437,7 @@ function thumbnail($url)
1411 if ($ext=='jpg' || $ext=='jpeg' || $ext=='png' || $ext=='gif') 1437 if ($ext=='jpg' || $ext=='jpeg' || $ext=='png' || $ext=='gif')
1412 { 1438 {
1413 $thumburl = substr($url,0,strlen($url)-strlen($ext)).'th.'.$ext; 1439 $thumburl = substr($url,0,strlen($url)-strlen($ext)).'th.'.$ext;
1414 return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="'.htmlspecialchars($thumburl).'" width="120" style="height:auto;"></a></div>'; 1440 return '<a href="'.htmlspecialchars($url).'"><img src="'.htmlspecialchars($thumburl).'" width="120" style="height:auto;"></a>';
1415 } 1441 }
1416 } 1442 }
1417 1443
@@ -1425,7 +1451,7 @@ function thumbnail($url)
1425 if ($domain=='flickr.com' || endsWith($domain,'.flickr.com') || $domain=='vimeo.com') 1451 if ($domain=='flickr.com' || endsWith($domain,'.flickr.com') || $domain=='vimeo.com')
1426 { 1452 {
1427 $sign = hash_hmac('sha256', $url, $GLOBALS['salt']); // We use the salt to sign data (it's random, secret, and specific to each installation) 1453 $sign = hash_hmac('sha256', $url, $GLOBALS['salt']); // We use the salt to sign data (it's random, secret, and specific to each installation)
1428 return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="?do=genthumbnail&hmac='.htmlspecialchars($sign).'&url='.urlencode($url).'" width="120" style="height:auto;"></a></div>'; 1454 return '<a href="'.htmlspecialchars($url).'"><img src="?do=genthumbnail&hmac='.htmlspecialchars($sign).'&url='.urlencode($url).'" width="120" style="height:auto;"></a>';
1429 } 1455 }
1430 1456
1431 // For all other, we try to make a thumbnail of links ending with .jpg/jpeg/png/gif 1457 // For all other, we try to make a thumbnail of links ending with .jpg/jpeg/png/gif
@@ -1435,7 +1461,7 @@ function thumbnail($url)
1435 if ($ext=='jpg' || $ext=='jpeg' || $ext=='png' || $ext=='gif') 1461 if ($ext=='jpg' || $ext=='jpeg' || $ext=='png' || $ext=='gif')
1436 { 1462 {
1437 $sign = hash_hmac('sha256', $url, $GLOBALS['salt']); // We use the salt to sign data (it's random, secret, and specific to each installation) 1463 $sign = hash_hmac('sha256', $url, $GLOBALS['salt']); // We use the salt to sign data (it's random, secret, and specific to each installation)
1438 return '<div class="thumbnail"><a href="'.htmlspecialchars($url).'"><img src="?do=genthumbnail&hmac='.htmlspecialchars($sign).'&url='.urlencode($url).'" width="120" style="height:auto;"></a></div>'; 1464 return '<a href="'.htmlspecialchars($url).'"><img src="?do=genthumbnail&hmac='.htmlspecialchars($sign).'&url='.urlencode($url).'" width="120" style="height:auto;"></a>';
1439 } 1465 }
1440 return ''; // No thumbnail. 1466 return ''; // No thumbnail.
1441 1467
@@ -1487,10 +1513,10 @@ $(document).ready(function()
1487JS; 1513JS;
1488 } 1514 }
1489 $feedurl=htmlspecialchars(serverUrl().$_SERVER['SCRIPT_NAME']); 1515 $feedurl=htmlspecialchars(serverUrl().$_SERVER['SCRIPT_NAME']);
1490 $feedsearch=''; 1516 $searchcrits=''; // Search criteria
1491 if (!empty($_GET['searchtags'])) $feedsearch.='&searchtags='.$_GET['searchtags']; 1517 if (!empty($_GET['searchtags'])) $searchcrits.='&searchtags='.$_GET['searchtags'];
1492 elseif (!empty($_GET['searchterm'])) $feedsearch.='&searchterm='.$_GET['searchterm']; 1518 elseif (!empty($_GET['searchterm'])) $searchcrits.='&searchterm='.$_GET['searchterm'];
1493 $filtered_feed= ($feedsearch=='' ? '' : 'Filtered '); 1519 $filtered_feed= ($searchcrits=='' ? '' : 'Filtered ');
1494 $version=shaarli_version; 1520 $version=shaarli_version;
1495 1521
1496 $title = htmlspecialchars( $GLOBALS['title'] ); 1522 $title = htmlspecialchars( $GLOBALS['title'] );
@@ -1499,15 +1525,15 @@ JS;
1499<html> 1525<html>
1500<head> 1526<head>
1501<title>{$pagetitle}</title> 1527<title>{$pagetitle}</title>
1502<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$feedsearch}" title="{$filtered_feed}RSS Feed" /> 1528<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}" title="{$filtered_feed}RSS Feed" />
1503<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$feedsearch}" title="{$filtered_feed}ATOM Feed" /> 1529<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}" title="{$filtered_feed}ATOM Feed" />
1504<link type="text/css" rel="stylesheet" href="shaarli.css?version={$version}" /> 1530<link type="text/css" rel="stylesheet" href="shaarli.css?version={$version}" />
1505{$jsincludes} 1531{$jsincludes}
1506</head> 1532</head>
1507<body {$data['onload']}>{$newversion} 1533<body {$data['onload']}>{$newversion}
1508<div id="pageheader"><div style="float:right; font-style:italic; color:#bbb; text-align:right; padding:0 5 0 0;">Shaare your links...<br>{$linkcount} links</div> 1534<div id="pageheader"><div style="float:right; font-style:italic; color:#bbb; text-align:right; padding:0 5 0 0;">Shaare your links...<br>{$linkcount} links</div>
1509 <span id="shaarli_title"><a href="?">{$title}</a></span> - <a href="?">Home</a>&nbsp;{$menu}&nbsp;<a href="{$feedurl}?do=rss{$feedsearch}" style="padding-left:30px;">RSS Feed</a> <a href="{$feedurl}?do=atom{$feedsearch}" style="padding-left:10px;">ATOM Feed</a> 1535 <span id="shaarli_title"><a href="?">{$title}</a></span> - <a href="?">Home</a>&nbsp;{$menu}&nbsp;<a href="{$feedurl}?do=rss{$searchcrits}" style="padding-left:30px;">RSS Feed</a> <a href="{$feedurl}?do=atom{$searchcrits}" style="padding-left:10px;">ATOM Feed</a>
1510&nbsp;&nbsp; <a href="?do=tagcloud">Tag cloud</a> 1536&nbsp;&nbsp; <a href="?do=tagcloud">Tag cloud</a>&nbsp;&nbsp; <a href="?do=picwall{$searchcrits}">Picture wall</a>
1511{$data['pageheader']} 1537{$data['pageheader']}
1512</div> 1538</div>
1513{$data['body']} 1539{$data['body']}
diff --git a/shaarli.css b/shaarli.css
index 320c7a43..e511e0eb 100644
--- a/shaarli.css
+++ b/shaarli.css
@@ -68,7 +68,7 @@ border-bottom:1px solid #aaa; border-right:1px solid #aaa; border-radius: 0.3em;
68.linkshort a { text-decoration: none; color:#393964; } 68.linkshort a { text-decoration: none; color:#393964; }
69.linkshort a:hover { text-decoration: underline; } 69.linkshort a:hover { text-decoration: underline; }
70.buttoneditform { display:inline; } 70.buttoneditform { display:inline; }
71#footer { font-size:8pt; text-align:center; border-top:1px solid #ddd; color: #888; } 71#footer { font-size:8pt; text-align:center; border-top:1px solid #ddd; color: #888; clear:both; }
72#newversion { background-color: #FFFFA0; color:#000; position:absolute; top:0;right:0; padding:2 7 2 7; font-size:9pt;} 72#newversion { background-color: #FFFFA0; color:#000; position:absolute; top:0;right:0; padding:2 7 2 7; font-size:9pt;}
73#cloudtag { padding-left:10%; padding-right:10%; } 73#cloudtag { padding-left:10%; padding-right:10%; }
74#cloudtag a { color:black; text-decoration:none; } 74#cloudtag a { color:black; text-decoration:none; }
@@ -80,6 +80,28 @@ border-bottom:1px solid #aaa; border-right:1px solid #aaa; border-radius: 0.3em;
80.linkcontainer { position: static; margin-left:130px; } 80.linkcontainer { position: static; margin-left:130px; }
81*/ 81*/
82 82
83/* --- Picture wall CSS --- */
84#picwall_container { color:#fff; background-color:#000; }
85.picwall_pictureframe { z-index:5; position:relative; display:table-cell; vertical-align:middle;width:90px; height:90px; overflow:hidden; text-align:center; float:left; }
86.picwall_pictureframe img { max-width: 100%;height: auto; } /* Adapt the width of the image */
87.picwall_pictureframe a {text-decoration:none;}
88
89/* CSS to show title when hovering an image - no javascript required. */
90.picwall_pictureframe span.info {display: none;}
91.picwall_pictureframe:hover span.info {
92 display:block;
93 position:absolute;
94 top:0; left:0; width:90px;
95 font-weight:bold;
96 font-size:8pt;
97 color:#fff;
98 text-align: left;
99 background-color: transparent;
100 background-color: rgba(0, 0, 0, 0.4); /* FF3+, Saf3+, Opera 10.10+, Chrome, IE9 */
101 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#66000000,endColorstr=#66000000); /* IE6–IE9 */
102text-shadow:2px 2px 1px #000000;
103}
104
83/* Minimal customisation for jQuery widgets */ 105/* Minimal customisation for jQuery widgets */
84.ui-autocomplete { background-color:#fff; padding-left:5px;} 106.ui-autocomplete { background-color:#fff; padding-left:5px;}
85.ui-state-hover { background-color: #604dff; color:#fff; } 107.ui-state-hover { background-color: #604dff; color:#fff; }