aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2015-02-07 19:50:27 +0100
committernodiscc <nodiscc@gmail.com>2015-02-07 19:50:27 +0100
commitaa69403cfff6734243f74a14251afd775bacc11a (patch)
tree03fb842729fefa0ab23faefb1b9830598ea2cc06
parent7d0a0d8a7adf11b5ed41248d35645fc350b85f55 (diff)
parented5b38ddd249c0e50eec7e06e74c9d1c2e864dab (diff)
downloadShaarli-aa69403cfff6734243f74a14251afd775bacc11a.tar.gz
Shaarli-aa69403cfff6734243f74a14251afd775bacc11a.tar.zst
Shaarli-aa69403cfff6734243f74a14251afd775bacc11a.zip
Merge pull request #63 from pikzen/permaoptions
New option ENABLE_RSS_PERMALINKS: choose whether the RSS item title link points directly to the link, or to the entry on Shaarli (permalink)
-rw-r--r--inc/shaarli.css4
-rw-r--r--index.php12
-rw-r--r--tpl/configure.html12
-rw-r--r--tpl/tools.html12
4 files changed, 27 insertions, 13 deletions
diff --git a/inc/shaarli.css b/inc/shaarli.css
index 325515ef..f6e580ba 100644
--- a/inc/shaarli.css
+++ b/inc/shaarli.css
@@ -1039,6 +1039,10 @@ div.dailyNoEntry {
1039 } 1039 }
1040} 1040}
1041 1041
1042#toolsdiv a.button-description {
1043 clear: none;
1044}
1045
1042/* Highlight search results */ 1046/* Highlight search results */
1043.highlight { 1047.highlight {
1044 background-color: #FFFF33; 1048 background-color: #FFFF33;
diff --git a/index.php b/index.php
index d48e388e..818fa680 100644
--- a/index.php
+++ b/index.php
@@ -11,7 +11,7 @@
11date_default_timezone_set('UTC'); 11date_default_timezone_set('UTC');
12 12
13// ----------------------------------------------------------------------------------------------- 13// -----------------------------------------------------------------------------------------------
14// Hardcoded parameter (These parameters can be overwritten by creating the file /config/options.php) 14// Hardcoded parameter (These parameters can be overwritten by creating the file /data/options.php)
15$GLOBALS['config']['DATADIR'] = 'data'; // Data subdirectory 15$GLOBALS['config']['DATADIR'] = 'data'; // Data subdirectory
16$GLOBALS['config']['CONFIG_FILE'] = $GLOBALS['config']['DATADIR'].'/config.php'; // Configuration file (user login/password) 16$GLOBALS['config']['CONFIG_FILE'] = $GLOBALS['config']['DATADIR'].'/config.php'; // Configuration file (user login/password)
17$GLOBALS['config']['DATASTORE'] = $GLOBALS['config']['DATADIR'].'/datastore.php'; // Data storage file. 17$GLOBALS['config']['DATASTORE'] = $GLOBALS['config']['DATADIR'].'/datastore.php'; // Data storage file.
@@ -33,6 +33,7 @@ $GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/las
33$GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours 33$GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours
34 // Note: You must have publisher.php in the same directory as Shaarli index.php 34 // Note: You must have publisher.php in the same directory as Shaarli index.php
35$GLOBALS['config']['ARCHIVE_ORG'] = false; // For each link, add a link to an archived version on archive.org 35$GLOBALS['config']['ARCHIVE_ORG'] = false; // For each link, add a link to an archived version on archive.org
36$GLOBALS['config']['ENABLE_RSS_PERMALINKS'] = true; // Enable RSS permalinks by default. This corresponds to the default behavior of shaarli before this was added as an option.
36// ----------------------------------------------------------------------------------------------- 37// -----------------------------------------------------------------------------------------------
37// You should not touch below (or at your own risks!) 38// You should not touch below (or at your own risks!)
38// Optional config file. 39// Optional config file.
@@ -894,7 +895,8 @@ function showRSS()
894 895
895 // $usepermalink : If true, use permalink instead of final link. 896 // $usepermalink : If true, use permalink instead of final link.
896 // User just has to add 'permalink' in URL parameters. e.g. http://mysite.com/shaarli/?do=rss&permalinks 897 // User just has to add 'permalink' in URL parameters. e.g. http://mysite.com/shaarli/?do=rss&permalinks
897 $usepermalinks = isset($_GET['permalinks']); 898 // Also enabled through a config option
899 $usepermalinks = isset($_GET['permalinks']) || !$GLOBALS['config']['ENABLE_RSS_PERMALINKS'];
898 900
899 // Cache system 901 // Cache system
900 $query = $_SERVER["QUERY_STRING"]; 902 $query = $_SERVER["QUERY_STRING"];
@@ -936,7 +938,7 @@ function showRSS()
936 $absurl = htmlspecialchars($link['url']); 938 $absurl = htmlspecialchars($link['url']);
937 if (startsWith($absurl,'?')) $absurl=$pageaddr.$absurl; // make permalink URL absolute 939 if (startsWith($absurl,'?')) $absurl=$pageaddr.$absurl; // make permalink URL absolute
938 if ($usepermalinks===true) 940 if ($usepermalinks===true)
939 echo '<item><title>'.htmlspecialchars($link['title']).'</title><guid isPermaLink="false">'.$guid.'</guid><link>'.$guid.'</link>'; 941 echo '<item><title>'.htmlspecialchars($link['title']).'</title><guid isPermaLink="true">'.$guid.'</guid><link>'.$guid.'</link>';
940 else 942 else
941 echo '<item><title>'.htmlspecialchars($link['title']).'</title><guid isPermaLink="false">'.$guid.'</guid><link>'.$absurl.'</link>'; 943 echo '<item><title>'.htmlspecialchars($link['title']).'</title><guid isPermaLink="false">'.$guid.'</guid><link>'.$absurl.'</link>';
942 if (!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()) echo '<pubDate>'.htmlspecialchars($rfc822date)."</pubDate>\n"; 944 if (!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()) echo '<pubDate>'.htmlspecialchars($rfc822date)."</pubDate>\n";
@@ -968,7 +970,7 @@ function showATOM()
968 970
969 // $usepermalink : If true, use permalink instead of final link. 971 // $usepermalink : If true, use permalink instead of final link.
970 // User just has to add 'permalink' in URL parameters. e.g. http://mysite.com/shaarli/?do=atom&permalinks 972 // User just has to add 'permalink' in URL parameters. e.g. http://mysite.com/shaarli/?do=atom&permalinks
971 $usepermalinks = isset($_GET['permalinks']); 973 $usepermalinks = isset($_GET['permalinks']) || !$GLOBALS['config']['ENABLE_RSS_PERMALINKS'];
972 974
973 // Cache system 975 // Cache system
974 $query = $_SERVER["QUERY_STRING"]; 976 $query = $_SERVER["QUERY_STRING"];
@@ -1423,6 +1425,7 @@ function renderPage()
1423 $GLOBALS['disablesessionprotection']=!empty($_POST['disablesessionprotection']); 1425 $GLOBALS['disablesessionprotection']=!empty($_POST['disablesessionprotection']);
1424 $GLOBALS['disablejquery']=!empty($_POST['disablejquery']); 1426 $GLOBALS['disablejquery']=!empty($_POST['disablejquery']);
1425 $GLOBALS['privateLinkByDefault']=!empty($_POST['privateLinkByDefault']); 1427 $GLOBALS['privateLinkByDefault']=!empty($_POST['privateLinkByDefault']);
1428 $GLOBALS['config']['ENABLE_RSS_PERMALINKS']= !empty($_POST['enableRssPermalinks']);
1426 writeConfig(); 1429 writeConfig();
1427 echo '<script>alert("Configuration was saved.");document.location=\'?do=tools\';</script>'; 1430 echo '<script>alert("Configuration was saved.");document.location=\'?do=tools\';</script>';
1428 exit; 1431 exit;
@@ -2290,6 +2293,7 @@ function writeConfig()
2290 $config .= '$GLOBALS[\'disablesessionprotection\']='.var_export($GLOBALS['disablesessionprotection'],true).'; '; 2293 $config .= '$GLOBALS[\'disablesessionprotection\']='.var_export($GLOBALS['disablesessionprotection'],true).'; ';
2291 $config .= '$GLOBALS[\'disablejquery\']='.var_export($GLOBALS['disablejquery'],true).'; '; 2294 $config .= '$GLOBALS[\'disablejquery\']='.var_export($GLOBALS['disablejquery'],true).'; ';
2292 $config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; '; 2295 $config .= '$GLOBALS[\'privateLinkByDefault\']='.var_export($GLOBALS['privateLinkByDefault'],true).'; ';
2296 $config .= '$GLOBALS[\'config\'][\'ENABLE_RSS_PERMALINKS\']='.var_export($GLOBALS['config']['ENABLE_RSS_PERMALINKS'], true).'; ';
2293 $config .= ' ?>'; 2297 $config .= ' ?>';
2294 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0) 2298 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0)
2295 { 2299 {
diff --git a/tpl/configure.html b/tpl/configure.html
index 89e48bd1..c096018b 100644
--- a/tpl/configure.html
+++ b/tpl/configure.html
@@ -21,8 +21,14 @@
21 <tr><td><b>Features:</b></td><td> 21 <tr><td><b>Features:</b></td><td>
22 <input type="checkbox" name="disablejquery" id="disablejquery" {if="!empty($GLOBALS['disablejquery'])"}checked{/if}><label for="disablejquery">&nbsp;Disable jQuery and all heavy JavaScript (for example: Autocomplete in tags. Useful for slow computers.)</label> 22 <input type="checkbox" name="disablejquery" id="disablejquery" {if="!empty($GLOBALS['disablejquery'])"}checked{/if}><label for="disablejquery">&nbsp;Disable jQuery and all heavy JavaScript (for example: Autocomplete in tags. Useful for slow computers.)</label>
23 </td></tr> 23 </td></tr>
24 <tr><td><b>New link:</b></td><td> 24 <tr><td valign="top"><b>New link:</b></td><td>
25 <input type="checkbox" name="privateLinkByDefault" id="privateLinkByDefault" {if="!empty($GLOBALS['privateLinkByDefault'])"}checked{/if}/><label for="privateLinkByDefault">&nbsp;All new link are private by default</label></td> 25 <input type="checkbox" name="privateLinkByDefault" id="privateLinkByDefault" {if="!empty($GLOBALS['privateLinkByDefault'])"}checked{/if}/><label for="privateLinkByDefault">&nbsp;All new links are private by default</label></td>
26 </tr>
27 <tr>
28 <td valign="top"><b>Enable RSS Permalinks</b></td>
29 <td>
30 <input type="checkbox" name="enableRssPermalinks" id="enableRssPermalinks" {if="!empty($GLOBALS['config']['ENABLE_RSS_PERMALINKS'])"}checked{/if}/><label for="enableRssPermalinks">&nbsp;Switches the RSS feed URLs between full URLs and shortlinks. Enabling it will show a permalink in the description, and the feed item will be linked to the absolute URL. Disabling it swaps this behaviour around (permalink in title and link in description). RSS Permalinks are currently <b>{if="$GLOBALS['config']['ENABLE_RSS_PERMALINKS']"}enabled{else}disabled{/if}</b></label>
31 </td>
26 </tr> 32 </tr>
27 <tr><td></td><td class="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr> 33 <tr><td></td><td class="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr>
28 </table> 34 </table>
@@ -30,4 +36,4 @@
30</div> 36</div>
31{include="page.footer"} 37{include="page.footer"}
32</body> 38</body>
33</html> \ No newline at end of file 39</html>
diff --git a/tpl/tools.html b/tpl/tools.html
index c2520fda..bf0539b1 100644
--- a/tpl/tools.html
+++ b/tpl/tools.html
@@ -6,12 +6,12 @@
6 {include="page.header"} 6 {include="page.header"}
7 <div id="toolsdiv"> 7 <div id="toolsdiv">
8 {if="!$GLOBALS['config']['OPEN_SHAARLI']"}<a href="?do=changepasswd"><b>Change password</b> <span>: Change your password.</span></a><br><br>{/if} 8 {if="!$GLOBALS['config']['OPEN_SHAARLI']"}<a href="?do=changepasswd"><b>Change password</b> <span>: Change your password.</span></a><br><br>{/if}
9 <a href="?do=configure"><b>Configure your Shaarli</b> <span>: Change Title, timezone...</span></a><br><br> 9 <a href="?do=configure"><b>Configure your Shaarli</b> <span>: Change Title, timezone...</span></a><br><br>
10 <a href="?do=changetag"><b>Rename/delete tags</b> <span>: Rename or delete a tag in all links</span></a><br><br> 10 <a href="?do=changetag"><b>Rename/delete tags</b> <span>: Rename or delete a tag in all links</span></a><br><br>
11 <a href="?do=import"><b>Import</b> <span>: Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)</span></a> <br><br> 11 <a href="?do=import"><b>Import</b> <span>: Import Netscape html bookmarks (as exported from Firefox, Chrome, Opera, delicious...)</span></a> <br><br>
12 <a href="?do=export"><b>Export</b> <span>: Export Netscape html bookmarks (which can be imported in Firefox, Chrome, Opera, delicious...)</span></a><br><br> 12 <a href="?do=export"><b>Export</b> <span>: Export Netscape html bookmarks (which can be imported in Firefox, Chrome, Opera, delicious...)</span></a><br><br>
13 <a class="smallbutton" onclick="alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');return false;" href="javascript:javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+'&amp;title='%20+%20encodeURIComponent(title)+'&amp;description='%20+%20encodeURIComponent(document.getSelection())+'&amp;source=bookmarklet','_blank','menubar=no,height=390,width=600,toolbar=no,scrollbars=no,status=no,dialog=1');})();"><b>✚Shaare link</b></a> <a href="#" style="clear:none;"><span>&#x21D0; Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br>&nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Shaare link" button in any page you want to share.</span></a><br><br> 13 <a class="smallbutton" onclick="alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');return false;" href="javascript:javascript:(function(){var%20url%20=%20location.href;var%20title%20=%20document.title%20||%20url;window.open('{$pageabsaddr}?post='%20+%20encodeURIComponent(url)+'&amp;title='%20+%20encodeURIComponent(title)+'&amp;description='%20+%20encodeURIComponent(document.getSelection())+'&amp;source=bookmarklet','_blank','menubar=no,height=390,width=600,toolbar=no,scrollbars=no,status=no,dialog=1');})();"><b>✚Shaare link</b></a> <a href="#" style="clear:none;"><span>&#x21D0; Drag this link to your bookmarks toolbar (or right-click it and choose Bookmark This Link....).<br>&nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Shaare link" button in any page you want to share.</span></a><br><br>
14 <div class="clear"></div> 14 <div class="clear"></div>
15 </div> 15 </div>
16</div> 16</div>
17{include="page.footer"} 17{include="page.footer"}