aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.php17
-rw-r--r--tpl/configure.html17
-rw-r--r--tpl/includes.html2
-rw-r--r--tpl/linklist.html5
-rw-r--r--tpl/page.footer.html2
-rw-r--r--tpl/picwall.html6
6 files changed, 36 insertions, 13 deletions
diff --git a/index.php b/index.php
index f84ec17f..8a456357 100644
--- a/index.php
+++ b/index.php
@@ -96,6 +96,8 @@ require $GLOBALS['config']['CONFIG_FILE']; // Read login/password hash into $GL
96if (empty($GLOBALS['title'])) $GLOBALS['title']='Shared links on '.htmlspecialchars(indexUrl()); 96if (empty($GLOBALS['title'])) $GLOBALS['title']='Shared links on '.htmlspecialchars(indexUrl());
97if (empty($GLOBALS['timezone'])) $GLOBALS['timezone']=date_default_timezone_get(); 97if (empty($GLOBALS['timezone'])) $GLOBALS['timezone']=date_default_timezone_get();
98if (empty($GLOBALS['disablesessionprotection'])) $GLOBALS['disablesessionprotection']=false; 98if (empty($GLOBALS['disablesessionprotection'])) $GLOBALS['disablesessionprotection']=false;
99if (empty($GLOBALS['disablejquery'])) $GLOBALS['disablejquery']=false;
100// I really need to rewrite Shaarli with a proper configuation manager.
99 101
100autoLocale(); // Sniff browser language and set date format accordingly. 102autoLocale(); // Sniff browser language and set date format accordingly.
101header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper international characters handling. 103header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper international characters handling.
@@ -1350,6 +1352,7 @@ function renderPage()
1350 $GLOBALS['title']=$_POST['title']; 1352 $GLOBALS['title']=$_POST['title'];
1351 $GLOBALS['redirector']=$_POST['redirector']; 1353 $GLOBALS['redirector']=$_POST['redirector'];
1352 $GLOBALS['disablesessionprotection']=!empty($_POST['disablesessionprotection']); 1354 $GLOBALS['disablesessionprotection']=!empty($_POST['disablesessionprotection']);
1355 $GLOBALS['disablejquery']=!empty($_POST['disablejquery']);
1353 writeConfig(); 1356 writeConfig();
1354 echo '<script language="JavaScript">alert("Configuration was saved.");document.location=\'?do=tools\';</script>'; 1357 echo '<script language="JavaScript">alert("Configuration was saved.");document.location=\'?do=tools\';</script>';
1355 exit; 1358 exit;
@@ -1951,6 +1954,11 @@ function lazyThumbnail($url,$href=false)
1951 $html='<a href="'.htmlspecialchars($t['href']).'">'; 1954 $html='<a href="'.htmlspecialchars($t['href']).'">';
1952 1955
1953 // Lazy image (only loaded by javascript when in the viewport). 1956 // Lazy image (only loaded by javascript when in the viewport).
1957 if (!empty($GLOBALS['disablejquery'])) // (except if jQuery is disabled)
1958 $html.='<img class="lazyimage" src="'.htmlspecialchars($t['src']).'"';
1959 else
1960 $html.='<img class="lazyimage" src="#" data-original="'.htmlspecialchars($t['src']).'"';
1961
1954 $html.='<img class="lazyimage" src="#" data-original="'.htmlspecialchars($t['src']).'"'; 1962 $html.='<img class="lazyimage" src="#" data-original="'.htmlspecialchars($t['src']).'"';
1955 if (!empty($t['width'])) $html.=' width="'.htmlspecialchars($t['width']).'"'; 1963 if (!empty($t['width'])) $html.=' width="'.htmlspecialchars($t['width']).'"';
1956 if (!empty($t['height'])) $html.=' height="'.htmlspecialchars($t['height']).'"'; 1964 if (!empty($t['height'])) $html.=' height="'.htmlspecialchars($t['height']).'"';
@@ -1958,7 +1966,7 @@ function lazyThumbnail($url,$href=false)
1958 if (!empty($t['alt'])) $html.=' alt="'.htmlspecialchars($t['alt']).'"'; 1966 if (!empty($t['alt'])) $html.=' alt="'.htmlspecialchars($t['alt']).'"';
1959 $html.='>'; 1967 $html.='>';
1960 1968
1961 // No-javascript fallback: 1969 // No-javascript fallback.
1962 $html.='<noscript><img src="'.htmlspecialchars($t['src']).'"'; 1970 $html.='<noscript><img src="'.htmlspecialchars($t['src']).'"';
1963 if (!empty($t['width'])) $html.=' width="'.htmlspecialchars($t['width']).'"'; 1971 if (!empty($t['width'])) $html.=' width="'.htmlspecialchars($t['width']).'"';
1964 if (!empty($t['height'])) $html.=' height="'.htmlspecialchars($t['height']).'"'; 1972 if (!empty($t['height'])) $html.=' height="'.htmlspecialchars($t['height']).'"';
@@ -2065,8 +2073,8 @@ function templateTZform($ptz=false)
2065 foreach($continents as $continent) 2073 foreach($continents as $continent)
2066 $continents_html.='<option value="'.$continent.'"'.($pcontinent==$continent?'selected':'').'>'.$continent.'</option>'; 2074 $continents_html.='<option value="'.$continent.'"'.($pcontinent==$continent?'selected':'').'>'.$continent.'</option>';
2067 $cities_html = $cities[$pcontinent]; 2075 $cities_html = $cities[$pcontinent];
2068 $timezone_form = "Continent: <select name=\"continent\" id=\"continent\" onChange=\"onChangecontinent();\">${continents_html}</select><br /><br />"; 2076 $timezone_form = "Continent: <select name=\"continent\" id=\"continent\" onChange=\"onChangecontinent();\">${continents_html}</select>";
2069 $timezone_form .= "City: <select name=\"city\" id=\"city\">${cities[$pcontinent]}</select><br /><br />"; 2077 $timezone_form .= "&nbsp;&nbsp;&nbsp;&nbsp;City: <select name=\"city\" id=\"city\">${cities[$pcontinent]}</select><br />";
2070 $timezone_js = "<script language=\"JavaScript\">"; 2078 $timezone_js = "<script language=\"JavaScript\">";
2071 $timezone_js .= "function onChangecontinent(){document.getElementById(\"city\").innerHTML = citiescontinent[document.getElementById(\"continent\").value];}"; 2079 $timezone_js .= "function onChangecontinent(){document.getElementById(\"city\").innerHTML = citiescontinent[document.getElementById(\"continent\").value];}";
2072 $timezone_js .= "var citiescontinent = ".json_encode($cities).";" ; 2080 $timezone_js .= "var citiescontinent = ".json_encode($cities).";" ;
@@ -2137,12 +2145,11 @@ function processWS()
2137function writeConfig() 2145function writeConfig()
2138{ 2146{
2139 if (is_file($GLOBALS['config']['CONFIG_FILE']) && !isLoggedIn()) die('You are not authorized to alter config.'); // Only logged in user can alter config. 2147 if (is_file($GLOBALS['config']['CONFIG_FILE']) && !isLoggedIn()) die('You are not authorized to alter config.'); // Only logged in user can alter config.
2140 if (empty($GLOBALS['redirector'])) $GLOBALS['redirector']='';
2141 if (empty($GLOBALS['disablesessionprotection'])) $GLOBALS['disablesessionprotection']=false;
2142 $config='<?php $GLOBALS[\'login\']='.var_export($GLOBALS['login'],true).'; $GLOBALS[\'hash\']='.var_export($GLOBALS['hash'],true).'; $GLOBALS[\'salt\']='.var_export($GLOBALS['salt'],true).'; '; 2148 $config='<?php $GLOBALS[\'login\']='.var_export($GLOBALS['login'],true).'; $GLOBALS[\'hash\']='.var_export($GLOBALS['hash'],true).'; $GLOBALS[\'salt\']='.var_export($GLOBALS['salt'],true).'; ';
2143 $config .='$GLOBALS[\'timezone\']='.var_export($GLOBALS['timezone'],true).'; date_default_timezone_set('.var_export($GLOBALS['timezone'],true).'); $GLOBALS[\'title\']='.var_export($GLOBALS['title'],true).';'; 2149 $config .='$GLOBALS[\'timezone\']='.var_export($GLOBALS['timezone'],true).'; date_default_timezone_set('.var_export($GLOBALS['timezone'],true).'); $GLOBALS[\'title\']='.var_export($GLOBALS['title'],true).';';
2144 $config .= '$GLOBALS[\'redirector\']='.var_export($GLOBALS['redirector'],true).'; '; 2150 $config .= '$GLOBALS[\'redirector\']='.var_export($GLOBALS['redirector'],true).'; ';
2145 $config .= '$GLOBALS[\'disablesessionprotection\']='.var_export($GLOBALS['disablesessionprotection'],true).'; '; 2151 $config .= '$GLOBALS[\'disablesessionprotection\']='.var_export($GLOBALS['disablesessionprotection'],true).'; ';
2152 $config .= '$GLOBALS[\'disablejquery\']='.var_export($GLOBALS['disablejquery'],true).'; ';
2146 $config .= ' ?>'; 2153 $config .= ' ?>';
2147 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0) 2154 if (!file_put_contents($GLOBALS['config']['CONFIG_FILE'],$config) || strcmp(file_get_contents($GLOBALS['config']['CONFIG_FILE']),$config)!=0)
2148 { 2155 {
diff --git a/tpl/configure.html b/tpl/configure.html
index 00c41f28..1beba59c 100644
--- a/tpl/configure.html
+++ b/tpl/configure.html
@@ -8,10 +8,19 @@
8 <form method="POST" action="" name="configform" id="configform"> 8 <form method="POST" action="" name="configform" id="configform">
9 <input type="hidden" name="token" value="{$token}"> 9 <input type="hidden" name="token" value="{$token}">
10 <table border="0" cellpadding="20"> 10 <table border="0" cellpadding="20">
11 <tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}"></td></tr> 11
12 <tr><td valign="top"><b>Timezone:</b></td><td>{$timezone_form}</td></tr> 12 <tr><td><b>Page title:</b></td><td><input type="text" name="title" id="title" size="50" value="{$title}"></td></tr>
13 <tr><td valign="top"><b>Redirector</b></td><td><input type="text" name="redirector" id="redirector" size="50" value="{$redirector}"><br>(e.g. <i>http://anonym.to/?</i> will mask the HTTP_REFERER)</td></tr> 13
14 <tr> <td valign="top">Security:</td> <td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="!empty($GLOBALS['disablesessionprotection'])"}checked{/if}><label for="disablesessionprotection">&nbsp;Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr> 14 <tr><td valign="top"><b>Timezone:</b></td><td valign="top">{$timezone_form}</td></tr>
15
16 <tr><td valign="top"><b>Redirector</b></td><td><input type="text" name="redirector" id="redirector" size="50" value="{$redirector}"><br>(e.g. <i>http://anonym.to/?</i> will mask the HTTP_REFERER)</td></tr>
17
18 <tr><td valign="top"><b>Security:</b></td><td><input type="checkbox" name="disablesessionprotection" id="disablesessionprotection" {if="!empty($GLOBALS['disablesessionprotection'])"}checked{/if}><label for="disablesessionprotection">&nbsp;Disable session cookie hijacking protection (Check this if you get disconnected often or if your IP address changes often.)</label></td></tr>
19
20 <tr><td valign="top"><b>Features:</b></td><td>
21 <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 </tr>
23
15 <tr><td></td><td align="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr> 24 <tr><td></td><td align="right"><input type="submit" name="Save" value="Save config" class="bigbutton"></td></tr>
16 </table> 25 </table>
17 </form> 26 </form>
diff --git a/tpl/includes.html b/tpl/includes.html
index 5319f452..e0ad00d5 100644
--- a/tpl/includes.html
+++ b/tpl/includes.html
@@ -7,4 +7,4 @@
7<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" /> 7<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" />
8<link type="text/css" rel="stylesheet" href="inc/shaarli.css?version={$version|urlencode}#" /> 8<link type="text/css" rel="stylesheet" href="inc/shaarli.css?version={$version|urlencode}#" />
9{if condition="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css?version={$version}#" />{/if} 9{if condition="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="inc/user.css?version={$version}#" />{/if}
10<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script> 10{if="empty($GLOBALS['disablejquery'])"}<script src="inc/jquery.min.js#"></script><script src="inc/jquery-ui.min.js#"></script>{/if}
diff --git a/tpl/linklist.html b/tpl/linklist.html
index 45bd478f..3a703512 100644
--- a/tpl/linklist.html
+++ b/tpl/linklist.html
@@ -48,7 +48,8 @@
48 {else} 48 {else}
49 <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span> 49 <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
50 {/if} 50 {/if}
51 <div style="position:relative;display:inline;"><a href="http://invx.com/code/qrcode/?code={$scripturl|urlencode}%3F{$value.linkdate|smallHash}&width=200&height=200" onclick="return false;" class="qrcode"><img src="images/qrcode.png#" width="13" height="13" title="QR-Code"></a></div> - 51 <div style="position:relative;display:inline;"><a href="http://invx.com/code/qrcode/?code={$scripturl|urlencode}%3F{$value.linkdate|smallHash}&width=200&height=200"
52 {if="empty($GLOBALS['disablejquery'])"}onclick="return false;"{/if} class="qrcode"><img src="images/qrcode.png#" width="13" height="13" title="QR-Code"></a></div> -
52 <span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span><br> 53 <span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span><br>
53 {if="$value.tags"} 54 {if="$value.tags"}
54 <div class="linktaglist"> 55 <div class="linktaglist">
@@ -65,6 +66,7 @@
65</div> 66</div>
66 67
67 {include="page.footer"} 68 {include="page.footer"}
69{if="empty($GLOBALS['disablejquery'])"}
68<script> 70<script>
69$(document).ready(function() { 71$(document).ready(function() {
70 $('a.qrcode').click(function(){ 72 $('a.qrcode').click(function(){
@@ -75,5 +77,6 @@ $(document).ready(function() {
75}); 77});
76function hide_qrcode() { $('div.qrcode').remove(); } 78function hide_qrcode() { $('div.qrcode').remove(); }
77</script> 79</script>
80{/if}
78</body> 81</body>
79</html> \ No newline at end of file 82</html> \ No newline at end of file
diff --git a/tpl/page.footer.html b/tpl/page.footer.html
index 7fe15017..13b566ae 100644
--- a/tpl/page.footer.html
+++ b/tpl/page.footer.html
@@ -8,7 +8,7 @@
8<script language="JavaScript">function confirmDeleteLink() { var agree=confirm("Are you sure you want to delete this link ?"); if (agree) return true ; else return false ; }</script> 8<script language="JavaScript">function confirmDeleteLink() { var agree=confirm("Are you sure you want to delete this link ?"); if (agree) return true ; else return false ; }</script>
9{/if} 9{/if}
10 10
11{if="$GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()"} 11{if="($GLOBALS['config']['OPEN_SHAARLI'] || isLoggedIn()) && empty($GLOBALS['disablejquery'])"}
12<script language="JavaScript"> 12<script language="JavaScript">
13$(document).ready(function() 13$(document).ready(function()
14{ 14{
diff --git a/tpl/picwall.html b/tpl/picwall.html
index 2083a629..8f8e0a0e 100644
--- a/tpl/picwall.html
+++ b/tpl/picwall.html
@@ -1,7 +1,9 @@
1<!DOCTYPE html> 1<!DOCTYPE html>
2<html> 2<html>
3<head>{include="includes"} 3<head>{include="includes"}
4<script src="inc/jquery.lazyload.min.js#"></script> 4{if="empty($GLOBALS['disablejquery'])"}
5 <script src="inc/jquery.lazyload.min.js#"></script>
6{/if}
5</head> 7</head>
6<body> 8<body>
7<div id="pageheader">{include="page.header"}</div> 9<div id="pageheader">{include="page.header"}</div>
@@ -16,9 +18,11 @@
16</center> 18</center>
17{include="page.footer"} 19{include="page.footer"}
18</body> 20</body>
21{if="empty($GLOBALS['disablejquery'])"}
19<script> 22<script>
20$(document).ready(function() { 23$(document).ready(function() {
21 $("img.lazyimage").show().lazyload(); 24 $("img.lazyimage").show().lazyload();
22}); 25});
23</script> 26</script>
27{/if}
24</html> \ No newline at end of file 28</html> \ No newline at end of file