]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #6092 from JonnyTischbein/issue_drop_item_return_non-frio
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 7 Nov 2018 01:16:28 +0000 (20:16 -0500)
committerGitHub <noreply@github.com>
Wed, 7 Nov 2018 01:16:28 +0000 (20:16 -0500)
Fix return url when dropping post loaded by update_* in non-frio

include/items.php
mod/update_contact.php [new file with mode: 0644]
mod/update_contacts.php [deleted file]
view/js/main.js

index f28f8f57189ba321a12633c54d563f18e83226f6..9929f535f02a7ea0a2c0a81f69e058b2c239ee91 100644 (file)
@@ -410,6 +410,10 @@ function drop_item($id, $return = '')
                Item::deleteForUser(['id' => $item['id']], local_user());
 
                $return_url = hex2bin($return);
+
+               // removes update_* from return_url to ignore Ajax refresh
+               $return_url = str_replace("update_", "", $return_url);
+
                if (empty($return_url) || strpos($return_url, 'display') !== false) {
                        $a->internalRedirect('network');
                        //NOTREACHED
diff --git a/mod/update_contact.php b/mod/update_contact.php
new file mode 100644 (file)
index 0000000..361234f
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+// See update_profile.php for documentation
+
+use Friendica\App;
+use Friendica\Core\L10n;
+use Friendica\Core\PConfig;
+use Friendica\Module\Contact;
+
+function update_contact_content(App $a)
+{
+       header("Content-type: text/html");
+       echo "<!DOCTYPE html><html><body>\r\n";
+       echo "<section>";
+
+       if ($_GET["force"] == 1) {
+               $text = Contact::content($a, true);
+       } else {
+               $text = '';
+       }
+
+       if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
+               $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
+               $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
+               $text = preg_replace($pattern, $replace, $text);
+               $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
+               $text = preg_replace($pattern, $replace, $text);
+               $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
+               $text = preg_replace($pattern, $replace, $text);
+               $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
+               $text = preg_replace($pattern, $replace, $text);
+       }
+
+       echo str_replace("\t", "       ", $text);
+       echo "</section>";
+       echo "</body></html>\r\n";
+       killme();
+}
diff --git a/mod/update_contacts.php b/mod/update_contacts.php
deleted file mode 100644 (file)
index 1144ed1..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-// See update_profile.php for documentation
-
-use Friendica\App;
-use Friendica\Core\L10n;
-use Friendica\Core\PConfig;
-use Friendica\Module\Contact;
-
-function update_contacts_content(App $a)
-{
-       header("Content-type: text/html");
-       echo "<!DOCTYPE html><html><body>\r\n";
-       echo "<section>";
-
-       if ($_GET["force"] == 1) {
-               $text = Contact::content($a, true);
-       } else {
-               $text = '';
-       }
-
-       if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
-               $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
-               $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
-               $text = preg_replace($pattern, $replace, $text);
-               $pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
-               $text = preg_replace($pattern, $replace, $text);
-               $pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
-               $text = preg_replace($pattern, $replace, $text);
-               $pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
-               $text = preg_replace($pattern, $replace, $text);
-       }
-
-       echo str_replace("\t", "       ", $text);
-       echo "</section>";
-       echo "</body></html>\r\n";
-       killme();
-}
index 384b35523083d31b163e6c965f927e9e433ad5d1..95e7b1542edf4b38b7c585dfdfe73f020b0b2b8b 100644 (file)
@@ -390,7 +390,7 @@ function NavUpdate() {
                                $('nav').trigger('nav-update', data.result);
 
                                // start live update
-                               ['network', 'profile', 'community', 'notes', 'display', 'contacts'].forEach(function (src) {
+                               ['network', 'profile', 'community', 'notes', 'display', 'contact'].forEach(function (src) {
                                        if ($('#live-' + src).length) {
                                                liveUpdate(src);
                                        }