]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #768 from ArthurHoaro/feature/get-public-links
authorArthurHoaro <arthur@hoa.ro>
Tue, 17 Jan 2017 08:55:25 +0000 (09:55 +0100)
committerGitHub <noreply@github.com>
Tue, 17 Jan 2017 08:55:25 +0000 (09:55 +0100)
Update LinkFilter to be able to filter only public links

index.php
tpl/default/css/shaarli.css
tpl/default/editlink.html

index 4f07a013420c93dfc4decd8219dce61bdea8a7e9..b62149f647f469556d1f1a5c99120e22a9702aac 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1208,7 +1208,7 @@ function renderPage($conf, $pluginManager, $LINKSDB)
                 $LINKSDB[$key]=$value;
             }
             $LINKSDB->save($conf->get('resource.page_cache'));
-            echo '<script>alert("Tag was removed from '.count($linksToAlter).' links.");document.location=\'?\';</script>';
+            echo '<script>alert("Tag was removed from '.count($linksToAlter).' links.");document.location=\'?do=changetag\';</script>';
             exit;
         }
 
@@ -1349,31 +1349,15 @@ function renderPage($conf, $pluginManager, $LINKSDB)
 
         // If we are called from the bookmarklet, we must close the popup:
         if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo '<script>self.close();</script>'; exit; }
-        // Pick where we're going to redirect
-        // =============================================================
-        // Basically, we can't redirect to where we were previously if it was a permalink
-        // or an edit_link, because it would 404.
-        // Cases:
-        //    - /             : nothing in $_GET, redirect to self
-        //    - /?page        : redirect to self
-        //    - /?searchterm  : redirect to self (there might be other links)
-        //    - /?searchtags  : redirect to self
-        //    - /permalink    : redirect to / (the link does not exist anymore)
-        //    - /?edit_link   : redirect to / (the link does not exist anymore)
-        // PHP treats the permalink as a $_GET variable, so we need to check if every condition for self
-        // redirect is not satisfied, and only then redirect to /
-        $location = "?";
-        // Self redirection
-        if (count($_GET) == 0
-            || isset($_GET['page'])
-            || isset($_GET['searchterm'])
-            || isset($_GET['searchtags'])
-        ) {
-            if (isset($_POST['returnurl'])) {
-                $location = $_POST['returnurl']; // Handle redirects given by the form
-            } else if (isset($_SERVER['HTTP_REFERER'])) {
-                $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('delete_link'));
-            }
+
+        $location = '?';
+        if (isset($_SERVER['HTTP_REFERER'])) {
+            // Don't redirect to where we were previously if it was a permalink or an edit_link, because it would 404.
+            $location = generateLocation(
+                    $_SERVER['HTTP_REFERER'],
+                    $_SERVER['HTTP_HOST'],
+                    ['delete_link', 'edit_link', $link['shorturl']]
+            );
         }
 
         header('Location: ' . $location); // After deleting the link, redirect to appropriate location
index 6d73af3ea115ca027bd9173d6428921deb068c8c..7ca567e7549f5b3c729673a38c8e8455bfd6ddf9 100644 (file)
@@ -55,7 +55,7 @@ strong {
     cursor: pointer;
     height: 24px;
     padding: 0 5px;
-    margin: 5px 5px 0 0;
+    margin: 0 5px 0 0;
     color: #606060;
     border-style: outset;
     border-width: 1px;
index a2d9b78f96a61bcecf9d293892dcccefab70637f..f855dfb186739aaf79ec085710e21b08558799ea 100644 (file)
@@ -35,7 +35,7 @@
             &nbsp;<label for="lf_private"><i>Private</i></label><br>
             {else}
             <input type="checkbox"  name="lf_private" id="lf_private">
-            &nbsp;<label for="lf_private"><i>Private</i></label><br>
+            &nbsp;<label for="lf_private"><i>Private</i></label><br><br>
             {/if}
             <input type="submit" value="Save" name="save_edit" class="bigbutton">
             <input type="submit" value="Cancel" name="cancel_edit" class="bigbutton">