aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSeb Sauvage <sebsauvage@sebsauvage.net>2011-11-18 15:24:26 +0100
committerEmilien Klein <emilien@klein.st>2011-11-18 15:24:26 +0100
commit751aaefec215e9e55d0fb4d5e4c25f398c3cc8d3 (patch)
treef36e9a7d40ee118629f85d3fecea91ca7417008e
parent76ec20af1637ea1858ae9f38e42018cc33232754 (diff)
downloadShaarli-751aaefec215e9e55d0fb4d5e4c25f398c3cc8d3.tar.gz
Shaarli-751aaefec215e9e55d0fb4d5e4c25f398c3cc8d3.tar.zst
Shaarli-751aaefec215e9e55d0fb4d5e4c25f398c3cc8d3.zip
Version 0.0.30 beta:
- Added: Now links also have a small delete button in list (after the edit button). - Corrected: Moved the call to PubSubHub.
-rw-r--r--index.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/index.php b/index.php
index 01dae52b..88be084b 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
1<?php 1<?php
2// Shaarli 0.0.29 beta - Shaare your links... 2// Shaarli 0.0.30 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
@@ -20,7 +20,7 @@ $GLOBALS['config']['HIDE_TIMESTAMPS'] = false; // If true, the moment when links
20$GLOBALS['config']['ENABLE_THUMBNAILS'] = true; // Enable thumbnails in links. 20$GLOBALS['config']['ENABLE_THUMBNAILS'] = true; // Enable thumbnails in links.
21$GLOBALS['config']['CACHEDIR'] = 'cache'; // Cache directory for thumbnails for SLOW services (like flickr) 21$GLOBALS['config']['CACHEDIR'] = 'cache'; // Cache directory for thumbnails for SLOW services (like flickr)
22$GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce webspace usage. 22$GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce webspace usage.
23$GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHub support. Put an empty string to disable, or put your hub url here to enable. 23$GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable.
24 // Note: You must have publisher.php in the same directory as Shaarli index.php 24 // Note: You must have publisher.php in the same directory as Shaarli index.php
25// ----------------------------------------------------------------------------------------------- 25// -----------------------------------------------------------------------------------------------
26// Program config (touch at your own risks !) 26// Program config (touch at your own risks !)
@@ -54,7 +54,7 @@ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
54header("Cache-Control: no-store, no-cache, must-revalidate"); 54header("Cache-Control: no-store, no-cache, must-revalidate");
55header("Cache-Control: post-check=0, pre-check=0", false); 55header("Cache-Control: post-check=0, pre-check=0", false);
56header("Pragma: no-cache"); 56header("Pragma: no-cache");
57define('shaarli_version','0.0.29 beta'); 57define('shaarli_version','0.0.30 beta');
58if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); } 58if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); }
59if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. 59if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
60if ($GLOBALS['config']['ENABLE_LOCALCACHE']) 60if ($GLOBALS['config']['ENABLE_LOCALCACHE'])
@@ -151,7 +151,7 @@ function autoLocale()
151} 151}
152 152
153// ------------------------------------------------------------------------------------------ 153// ------------------------------------------------------------------------------------------
154// PubSubHub protocol support (if enabled) [UNTESTED] 154// PubSubHubbub protocol support (if enabled) [UNTESTED]
155// (Source: http://aldarone.fr/les-flux-rss-shaarli-et-pubsubhubbub/ ) 155// (Source: http://aldarone.fr/les-flux-rss-shaarli-et-pubsubhubbub/ )
156if (!empty($GLOBALS['config']['PUBSUBHUB_URL'])) include './publisher.php'; 156if (!empty($GLOBALS['config']['PUBSUBHUB_URL'])) include './publisher.php';
157function pubsubhub() 157function pubsubhub()
@@ -1025,7 +1025,6 @@ HTML;
1025 $LINKSDB[$key]=$value; 1025 $LINKSDB[$key]=$value;
1026 } 1026 }
1027 $LINKSDB->savedb(); // save to disk 1027 $LINKSDB->savedb(); // save to disk
1028 pubsubhub();
1029 invalidateCaches(); 1028 invalidateCaches();
1030 echo '<script language="JavaScript">alert("Tag was removed from '.count($linksToAlter).' links.");document.location=\'?\';</script>'; 1029 echo '<script language="JavaScript">alert("Tag was removed from '.count($linksToAlter).' links.");document.location=\'?\';</script>';
1031 exit; 1030 exit;
@@ -1071,6 +1070,7 @@ HTML;
1071 if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title. 1070 if ($link['title']=='') $link['title']=$link['url']; // If title is empty, use the URL as title.
1072 $LINKSDB[$linkdate] = $link; 1071 $LINKSDB[$linkdate] = $link;
1073 $LINKSDB->savedb(); // save to disk 1072 $LINKSDB->savedb(); // save to disk
1073 pubsubhub();
1074 invalidateCaches(); 1074 invalidateCaches();
1075 1075
1076 // If we are called from the bookmarklet, we must close the popup: 1076 // If we are called from the bookmarklet, we must close the popup:
@@ -1406,6 +1406,7 @@ function templateLinkList()
1406 $i = ($page-1)*$_SESSION['LINKS_PER_PAGE']; // Start index. 1406 $i = ($page-1)*$_SESSION['LINKS_PER_PAGE']; // Start index.
1407 $end = $i+$_SESSION['LINKS_PER_PAGE']; 1407 $end = $i+$_SESSION['LINKS_PER_PAGE'];
1408 $redir = empty($GLOBALS['redirector']) ? '' : $GLOBALS['redirector']; // optional redirector URL 1408 $redir = empty($GLOBALS['redirector']) ? '' : $GLOBALS['redirector']; // optional redirector URL
1409 $token = ''; if (isLoggedIn()) $token=getToken();
1409 1410
1410 while ($i<$end && $i<count($keys)) 1411 while ($i<$end && $i<count($keys))
1411 { 1412 {
@@ -1414,7 +1415,12 @@ function templateLinkList()
1414 $title=$link['title']; 1415 $title=$link['title'];
1415 $classLi = $i%2!=0 ? '' : 'class="publicLinkHightLight"'; 1416 $classLi = $i%2!=0 ? '' : 'class="publicLinkHightLight"';
1416 $classprivate = ($link['private']==0 ? $classLi : 'class="private"'); 1417 $classprivate = ($link['private']==0 ? $classLi : 'class="private"');
1417 if (isLoggedIn()) $actions=' <form method="GET" class="buttoneditform"><input type="hidden" name="edit_link" value="'.$link['linkdate'].'"><input type="submit" value="Edit" class="smallbutton"></form>'; 1418 if (isLoggedIn())
1419 {
1420 $actions=' <form method="GET" class="buttoneditform"><input type="hidden" name="edit_link" value="'.$link['linkdate'].'"><input type="submit" value="Edit" class="smallbutton"></form>';
1421 $actions.=' <form method="POST" class="buttoneditform"><input type="hidden" name="lf_linkdate" value="'.$link['linkdate'].'">';
1422 $actions.='<input type="hidden" name="token" value="'.$token.'"><input type="submit" value="Delete" name="delete_link" class="smallbutton" onClick="return confirmDeleteLink();"></form>';
1423 }
1418 $tags=''; 1424 $tags='';
1419 if ($link['tags']!='') 1425 if ($link['tags']!='')
1420 { 1426 {