]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Version 0.0.38 beta: legacy
authorSeb Sauvage <sebsauvage@sebsauvage.net>
Mon, 6 Feb 2012 16:35:44 +0000 (17:35 +0100)
committerEmilien Klein <emilien@klein.st>
Mon, 6 Feb 2012 16:35:44 +0000 (17:35 +0100)
- Corrected: Corrected the tag encoding (there was a bug when selecting a second tag which contains accented characters).
- Changed: The “Daily” page now automatically skips empty days.
- Added: Automatic creation of the tmp directory with proper rights (for RainTPL).
- Added: When you click the key to see only private links, it turns yellow.

images/private_16x16_active.png [new file with mode: 0644]
index.php
tpl/daily.html
tpl/linklist.paging.html

diff --git a/images/private_16x16_active.png b/images/private_16x16_active.png
new file mode 100644 (file)
index 0000000..dd43baf
Binary files /dev/null and b/images/private_16x16_active.png differ
index 936d6129b16c4f1f6e01d3ee1207c00b238a82c9..2611e04e89e3099e3647a6391ad0580e3a7f1fd9 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
 <?php
-// Shaarli 0.0.37 beta - Shaare your links...
+// Shaarli 0.0.38 beta - Shaare your links...
 // The personal, minimalist, super-fast, no-database delicious clone. By sebsauvage.net
 // http://sebsauvage.net/wiki/doku.php?id=php:shaarli
 // 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
 ini_set('memory_limit', '128M');  // Try to set max upload file size and read (May not work on some hosts).
 ini_set('post_max_size', '16M');
 ini_set('upload_max_filesize', '16M');
+define('shaarli_version','0.0.38 beta');
 define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code.
 define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code.
 checkphpversion();
@@ -58,8 +59,8 @@ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 header("Cache-Control: no-store, no-cache, must-revalidate");
 header("Cache-Control: post-check=0, pre-check=0", false);
 header("Pragma: no-cache");
-define('shaarli_version','0.0.37 beta');
 if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); }
+if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } // For RainTPL temporary files.
 if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
 if ($GLOBALS['config']['ENABLE_LOCALCACHE'])
 {
@@ -531,6 +532,7 @@ class pageBuilder
         $this->tpl->assign('version',shaarli_version);
         $this->tpl->assign('scripturl',indexUrl());
         $this->tpl->assign('pagetitle','Shaarli');
+        $this->tpl->assign('privateonly',!empty($_SESSION['privateonly'])); // Show only private links ?
         if (!empty($GLOBALS['title'])) $this->tpl->assign('pagetitle',$GLOBALS['title']);
         if (!empty($GLOBALS['pagetitle'])) $this->tpl->assign('pagetitle',$GLOBALS['pagetitle']);
         $this->tpl->assign('shaarlititle',empty($GLOBALS['title']) ? 'Shaarli': $GLOBALS['title'] );
@@ -746,6 +748,20 @@ class linkdb implements Iterator, Countable, ArrayAccess
         arsort($tags); // Sort tags by usage (most used tag first)
         return $tags;
     }
+    
+    // Returns the list of days containing articles (oldest first)
+    // Output: An array containing days (in format YYYYMMDD).
+    public function days()
+    {
+        $linkdays=array();
+        foreach(array_keys($this->links) as $day)
+        {
+            $linkdays[substr($day,0,8)]=0;
+        }
+        $linkdays=array_keys($linkdays);
+        sort($linkdays);
+        return $linkdays;
+    }
 }
 
 // ------------------------------------------------------------------------------------------
@@ -998,7 +1014,7 @@ function renderPage()
         // Get previous URL (http_referer) and add the tag to the searchtags parameters in query.
         if (empty($_SERVER['HTTP_REFERER'])) { header('Location: ?searchtags='.urlencode($_GET['addtag'])); exit; } // In case browser does not send HTTP_REFERER
         parse_str(parse_url($_SERVER['HTTP_REFERER'],PHP_URL_QUERY), $params);
-        $params['searchtags'] = (empty($params['searchtags']) ?  trim($_GET['addtag']) : trim($params['searchtags']).' '.urlencode(trim($_GET['addtag'])));
+        $params['searchtags'] = (empty($params['searchtags']) ?  trim($_GET['addtag']) : trim($params['searchtags']).' '.trim($_GET['addtag']));
         unset($params['page']); // We also remove page (keeping the same page has no sense, since the results are different)
         header('Location: ?'.http_build_query($params));
         exit;
@@ -1049,10 +1065,18 @@ function renderPage()
     { 
         $day=Date('Ymd',strtotime('-1 day')); // Yesterday, in format YYYYMMDD.
         if (isset($_GET['day'])) $day=$_GET['day'];
-
-        $previousday = Date('Ymd',strtotime('-1 day',strtotime($day))); 
-        $nextday = Date('Ymd',strtotime('+1 day',strtotime($day))); 
         
+        $days = $LINKSDB->days();
+        $i = array_search($day,$days);
+        if ($i==false) { $i=count($days)-1; $day=$days[$i]; }
+        $previousday=''; 
+        $nextday=''; 
+        if ($i!==false)
+        {
+            if ($i>1) $previousday=$days[$i-1];
+            if ($i<count($days)-1) $nextday=$days[$i+1];
+        }
+
         $linksToDisplay=$LINKSDB->filterDay($day);
         // We pre-format some fields for proper output.
         foreach($linksToDisplay as $key=>$link)
index bdaf20327f2b4496e18dc8bdc020fe933d0c1325..4bc8568be27c14b871e42b39acb89083870af53a 100644 (file)
@@ -6,11 +6,13 @@
 <div class="daily">
     <div class="dailyAbout">
       All links of one day<br>in a single page.<br>
-      <a href="?do=daily&day={$previousday}"><b>&lt;</b>Previous day</a> - 
-      <a href="?do=daily&day={$nextday}">Next day<b>&gt;</b></a><br><br>
+         {if="$previousday"} <a href="?do=daily&day={$previousday}"><b>&lt;</b>Previous day</a>{else}<b>&lt;</b>Previous day{/if}
+         - 
+         {if="$nextday"}<a href="?do=daily&day={$nextday}">Next day<b>&gt;</b></a>{else}Next day<b>&gt;</b>{/if}
+      <br><br>
          <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>
     </div>
-    <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>
+    <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>
     <div class="dailyDate"><span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span> {$day} <span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span></div>
     <div style="clear:both;"></div>
     
index b1f9871f5907c26106bcc146d58f704a9253c82a..b0c119d98e4eddf72e49b9464d91837bd50cbc51 100644 (file)
@@ -1,7 +1,13 @@
 <div class="paging">
 {if="isLoggedIn()"}
     <div id="paging_privatelinks">
-        <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>
+        <a href="?privateonly">
+               {if="$privateonly"}
+               <img src="images/private_16x16_active.png#" width="16" height="16" title="Click to see all links" alt="Click to see all links">
+               {else}
+               <img src="images/private_16x16.png#" width="16" height="16" title="Click to see only private links" alt="Click to see only private links">
+               {/if}
+               </a>
     </div>
 {/if}
     <div id="paging_linksperpage">