diff options
-rw-r--r-- | images/private_16x16_active.png | bin | 0 -> 475 bytes | |||
-rw-r--r-- | index.php | 36 | ||||
-rw-r--r-- | tpl/daily.html | 8 | ||||
-rw-r--r-- | tpl/linklist.paging.html | 8 |
4 files changed, 42 insertions, 10 deletions
diff --git a/images/private_16x16_active.png b/images/private_16x16_active.png new file mode 100644 index 00000000..dd43baf2 --- /dev/null +++ b/images/private_16x16_active.png | |||
Binary files differ | |||
@@ -1,5 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | // Shaarli 0.0.37 beta - Shaare your links... | 2 | // Shaarli 0.0.38 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 |
@@ -30,6 +30,7 @@ ini_set('max_input_time','60'); // High execution time in case of problematic i | |||
30 | ini_set('memory_limit', '128M'); // Try to set max upload file size and read (May not work on some hosts). | 30 | ini_set('memory_limit', '128M'); // Try to set max upload file size and read (May not work on some hosts). |
31 | ini_set('post_max_size', '16M'); | 31 | ini_set('post_max_size', '16M'); |
32 | ini_set('upload_max_filesize', '16M'); | 32 | ini_set('upload_max_filesize', '16M'); |
33 | define('shaarli_version','0.0.38 beta'); | ||
33 | define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code. | 34 | define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code. |
34 | define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code. | 35 | define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code. |
35 | checkphpversion(); | 36 | checkphpversion(); |
@@ -58,8 +59,8 @@ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |||
58 | header("Cache-Control: no-store, no-cache, must-revalidate"); | 59 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
59 | header("Cache-Control: post-check=0, pre-check=0", false); | 60 | header("Cache-Control: post-check=0, pre-check=0", false); |
60 | header("Pragma: no-cache"); | 61 | header("Pragma: no-cache"); |
61 | define('shaarli_version','0.0.37 beta'); | ||
62 | if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); } | 62 | if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); } |
63 | if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } // For RainTPL temporary files. | ||
63 | if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. | 64 | if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. |
64 | if ($GLOBALS['config']['ENABLE_LOCALCACHE']) | 65 | if ($GLOBALS['config']['ENABLE_LOCALCACHE']) |
65 | { | 66 | { |
@@ -531,6 +532,7 @@ class pageBuilder | |||
531 | $this->tpl->assign('version',shaarli_version); | 532 | $this->tpl->assign('version',shaarli_version); |
532 | $this->tpl->assign('scripturl',indexUrl()); | 533 | $this->tpl->assign('scripturl',indexUrl()); |
533 | $this->tpl->assign('pagetitle','Shaarli'); | 534 | $this->tpl->assign('pagetitle','Shaarli'); |
535 | $this->tpl->assign('privateonly',!empty($_SESSION['privateonly'])); // Show only private links ? | ||
534 | if (!empty($GLOBALS['title'])) $this->tpl->assign('pagetitle',$GLOBALS['title']); | 536 | if (!empty($GLOBALS['title'])) $this->tpl->assign('pagetitle',$GLOBALS['title']); |
535 | if (!empty($GLOBALS['pagetitle'])) $this->tpl->assign('pagetitle',$GLOBALS['pagetitle']); | 537 | if (!empty($GLOBALS['pagetitle'])) $this->tpl->assign('pagetitle',$GLOBALS['pagetitle']); |
536 | $this->tpl->assign('shaarlititle',empty($GLOBALS['title']) ? 'Shaarli': $GLOBALS['title'] ); | 538 | $this->tpl->assign('shaarlititle',empty($GLOBALS['title']) ? 'Shaarli': $GLOBALS['title'] ); |
@@ -746,6 +748,20 @@ class linkdb implements Iterator, Countable, ArrayAccess | |||
746 | arsort($tags); // Sort tags by usage (most used tag first) | 748 | arsort($tags); // Sort tags by usage (most used tag first) |
747 | return $tags; | 749 | return $tags; |
748 | } | 750 | } |
751 | |||
752 | // Returns the list of days containing articles (oldest first) | ||
753 | // Output: An array containing days (in format YYYYMMDD). | ||
754 | public function days() | ||
755 | { | ||
756 | $linkdays=array(); | ||
757 | foreach(array_keys($this->links) as $day) | ||
758 | { | ||
759 | $linkdays[substr($day,0,8)]=0; | ||
760 | } | ||
761 | $linkdays=array_keys($linkdays); | ||
762 | sort($linkdays); | ||
763 | return $linkdays; | ||
764 | } | ||
749 | } | 765 | } |
750 | 766 | ||
751 | // ------------------------------------------------------------------------------------------ | 767 | // ------------------------------------------------------------------------------------------ |
@@ -998,7 +1014,7 @@ function renderPage() | |||
998 | // Get previous URL (http_referer) and add the tag to the searchtags parameters in query. | 1014 | // Get previous URL (http_referer) and add the tag to the searchtags parameters in query. |
999 | if (empty($_SERVER['HTTP_REFERER'])) { header('Location: ?searchtags='.urlencode($_GET['addtag'])); exit; } // In case browser does not send HTTP_REFERER | 1015 | if (empty($_SERVER['HTTP_REFERER'])) { header('Location: ?searchtags='.urlencode($_GET['addtag'])); exit; } // In case browser does not send HTTP_REFERER |
1000 | parse_str(parse_url($_SERVER['HTTP_REFERER'],PHP_URL_QUERY), $params); | 1016 | parse_str(parse_url($_SERVER['HTTP_REFERER'],PHP_URL_QUERY), $params); |
1001 | $params['searchtags'] = (empty($params['searchtags']) ? trim($_GET['addtag']) : trim($params['searchtags']).' '.urlencode(trim($_GET['addtag']))); | 1017 | $params['searchtags'] = (empty($params['searchtags']) ? trim($_GET['addtag']) : trim($params['searchtags']).' '.trim($_GET['addtag'])); |
1002 | unset($params['page']); // We also remove page (keeping the same page has no sense, since the results are different) | 1018 | unset($params['page']); // We also remove page (keeping the same page has no sense, since the results are different) |
1003 | header('Location: ?'.http_build_query($params)); | 1019 | header('Location: ?'.http_build_query($params)); |
1004 | exit; | 1020 | exit; |
@@ -1049,10 +1065,18 @@ function renderPage() | |||
1049 | { | 1065 | { |
1050 | $day=Date('Ymd',strtotime('-1 day')); // Yesterday, in format YYYYMMDD. | 1066 | $day=Date('Ymd',strtotime('-1 day')); // Yesterday, in format YYYYMMDD. |
1051 | if (isset($_GET['day'])) $day=$_GET['day']; | 1067 | if (isset($_GET['day'])) $day=$_GET['day']; |
1052 | |||
1053 | $previousday = Date('Ymd',strtotime('-1 day',strtotime($day))); | ||
1054 | $nextday = Date('Ymd',strtotime('+1 day',strtotime($day))); | ||
1055 | 1068 | ||
1069 | $days = $LINKSDB->days(); | ||
1070 | $i = array_search($day,$days); | ||
1071 | if ($i==false) { $i=count($days)-1; $day=$days[$i]; } | ||
1072 | $previousday=''; | ||
1073 | $nextday=''; | ||
1074 | if ($i!==false) | ||
1075 | { | ||
1076 | if ($i>1) $previousday=$days[$i-1]; | ||
1077 | if ($i<count($days)-1) $nextday=$days[$i+1]; | ||
1078 | } | ||
1079 | |||
1056 | $linksToDisplay=$LINKSDB->filterDay($day); | 1080 | $linksToDisplay=$LINKSDB->filterDay($day); |
1057 | // We pre-format some fields for proper output. | 1081 | // We pre-format some fields for proper output. |
1058 | foreach($linksToDisplay as $key=>$link) | 1082 | foreach($linksToDisplay as $key=>$link) |
diff --git a/tpl/daily.html b/tpl/daily.html index bdaf2032..4bc8568b 100644 --- a/tpl/daily.html +++ b/tpl/daily.html | |||
@@ -6,11 +6,13 @@ | |||
6 | <div class="daily"> | 6 | <div class="daily"> |
7 | <div class="dailyAbout"> | 7 | <div class="dailyAbout"> |
8 | All links of one day<br>in a single page.<br> | 8 | All links of one day<br>in a single page.<br> |
9 | <a href="?do=daily&day={$previousday}"><b><</b>Previous day</a> - | 9 | {if="$previousday"} <a href="?do=daily&day={$previousday}"><b><</b>Previous day</a>{else}<b><</b>Previous day{/if} |
10 | <a href="?do=daily&day={$nextday}">Next day<b>></b></a><br><br> | 10 | - |
11 | {if="$nextday"}<a href="?do=daily&day={$nextday}">Next day<b>></b></a>{else}Next day<b>></b>{/if} | ||
12 | <br><br> | ||
11 | <a href="?do=dailyrss" title="1 RSS entry per day"><img src="images/feed-icon-14x14.png#" width="14" height="14" style="position:relative;top:3px; margin-right:4px;">Daily RSS Feed</a> | 13 | <a href="?do=dailyrss" title="1 RSS entry per day"><img src="images/feed-icon-14x14.png#" width="14" height="14" style="position:relative;top:3px; margin-right:4px;">Daily RSS Feed</a> |
12 | </div> | 14 | </div> |
13 | <div class="dailyTitle"><img src="../images/floral_left.png" width="51" height="50" class="nomobile"> The Shaarli Daily <img src="../images/floral_right.png" width="51" height="50" class="nomobile"></div> | 15 | <div class="dailyTitle"><img src="../images/floral_left.png" width="51" height="50" class="nomobile"> The Daily Shaarli <img src="../images/floral_right.png" width="51" height="50" class="nomobile"></div> |
14 | <div class="dailyDate"><span class="nomobile">———————————</span> {$day} <span class="nomobile">———————————</span></div> | 16 | <div class="dailyDate"><span class="nomobile">———————————</span> {$day} <span class="nomobile">———————————</span></div> |
15 | <div style="clear:both;"></div> | 17 | <div style="clear:both;"></div> |
16 | 18 | ||
diff --git a/tpl/linklist.paging.html b/tpl/linklist.paging.html index b1f9871f..b0c119d9 100644 --- a/tpl/linklist.paging.html +++ b/tpl/linklist.paging.html | |||
@@ -1,7 +1,13 @@ | |||
1 | <div class="paging"> | 1 | <div class="paging"> |
2 | {if="isLoggedIn()"} | 2 | {if="isLoggedIn()"} |
3 | <div id="paging_privatelinks"> | 3 | <div id="paging_privatelinks"> |
4 | <a href="?privateonly"><img src="images/private_16x16.png#" width="16" height="16" title="See private links only (toggle)" alt="See private links only (toggle)"></a> | 4 | <a href="?privateonly"> |
5 | {if="$privateonly"} | ||
6 | <img src="images/private_16x16_active.png#" width="16" height="16" title="Click to see all links" alt="Click to see all links"> | ||
7 | {else} | ||
8 | <img src="images/private_16x16.png#" width="16" height="16" title="Click to see only private links" alt="Click to see only private links"> | ||
9 | {/if} | ||
10 | </a> | ||
5 | </div> | 11 | </div> |
6 | {/if} | 12 | {/if} |
7 | <div id="paging_linksperpage"> | 13 | <div id="paging_linksperpage"> |