aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTeromene <teromene@teromene.fr>2016-11-29 11:06:31 +0000
committerTeromene <teromene@teromene.fr>2016-11-29 11:06:31 +0000
commitcaa382dd55c285306a3f48bb54678cf787d842e1 (patch)
tree88b2c30a41b965abc4beb64065b3e2eadb51eb0b
parent76fb679e38c6237fc2e39c12b829068c374b8372 (diff)
downloadShaarli-caa382dd55c285306a3f48bb54678cf787d842e1.tar.gz
Shaarli-caa382dd55c285306a3f48bb54678cf787d842e1.tar.zst
Shaarli-caa382dd55c285306a3f48bb54678cf787d842e1.zip
Disable Firefox Social in the tools section if the page is not loaded using HTTPS, as Firefox will deny the request.
-rw-r--r--index.php1
-rw-r--r--tpl/tools.html6
2 files changed, 6 insertions, 1 deletions
diff --git a/index.php b/index.php
index 84282b8d..5366cb0e 100644
--- a/index.php
+++ b/index.php
@@ -1078,6 +1078,7 @@ function renderPage($conf, $pluginManager)
1078 { 1078 {
1079 $data = array( 1079 $data = array(
1080 'pageabsaddr' => index_url($_SERVER), 1080 'pageabsaddr' => index_url($_SERVER),
1081 'sslenabled' => !empty($_SERVER['HTTPS'])
1081 ); 1082 );
1082 $pluginManager->executeHooks('render_tools', $data); 1083 $pluginManager->executeHooks('render_tools', $data);
1083 1084
diff --git a/tpl/tools.html b/tpl/tools.html
index 8e285f44..e06d239d 100644
--- a/tpl/tools.html
+++ b/tpl/tools.html
@@ -50,12 +50,15 @@
50 &nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Add Note" button anytime to start composing a private Note (text post) to your Shaarli. 50 &nbsp;&nbsp;&nbsp;&nbsp;Then click "✚Add Note" button anytime to start composing a private Note (text post) to your Shaarli.
51 </span> 51 </span>
52 </a><br><br> 52 </a><br><br>
53
54 {if="$sslenabled"}
53 <a class="smallbutton" onclick="activateFirefoxSocial(this)"> 55 <a class="smallbutton" onclick="activateFirefoxSocial(this)">
54 <b>✚Add to Firefox social</b> 56 <b>✚Add to Firefox social</b>
55 </a> 57 </a>
56 <a href="#"> 58 <a href="#">
57 <span>&#x21D0; Click on this button to add Shaarli to the "Share this page" button in Firefox.</span> 59 <span>&#x21D0; Click on this button to add Shaarli to the "Share this page" button in Firefox.</span>
58 </a><br><br> 60 </a><br><br>
61 {/if}
59 62
60 {loop="$tools_plugin"} 63 {loop="$tools_plugin"}
61 {$value} 64 {$value}
@@ -64,6 +67,7 @@
64 <div class="clear"></div> 67 <div class="clear"></div>
65 68
66 <script> 69 <script>
70 {if="$sslenabled"}
67 function activateFirefoxSocial(node) { 71 function activateFirefoxSocial(node) {
68 var loc = location.href; 72 var loc = location.href;
69 var baseURL = loc.substring(0, loc.lastIndexOf("/")); 73 var baseURL = loc.substring(0, loc.lastIndexOf("/"));
@@ -87,7 +91,7 @@
87 var activate = new CustomEvent("ActivateSocialFeature"); 91 var activate = new CustomEvent("ActivateSocialFeature");
88 node.dispatchEvent(activate); 92 node.dispatchEvent(activate);
89 } 93 }
90 94 {/if}
91 function alertBookmarklet() { 95 function alertBookmarklet() {
92 alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...'); 96 alert('Drag this link to your bookmarks toolbar, or right-click it and choose Bookmark This Link...');
93 return false; 97 return false;