]> git.mxchange.org Git - friendica.git/blobdiff - include/delivery.php
Merge pull request #3868 from rabuzarus/20171104_-_use_best_link_url_for_events
[friendica.git] / include / delivery.php
index 098e423d170d9d6efb8dd7e3903fb6e6cc307e36..cddc9cb004006eb15d17c3bc0241734de6e1315a 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\System;
 use Friendica\Core\Config;
 
 require_once 'include/queue_fn.php';
@@ -91,7 +92,7 @@ function delivery_run(&$argv, &$argc){
                        $uid = $item_id;
                } else {
                        // find ancestors
-                       $r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1",
+                       $r = q("SELECT * FROM `item` WHERE `id` = %d AND visible = 1 AND moderated = 0 LIMIT 1",
                                intval($item_id)
                        );
 
@@ -105,7 +106,7 @@ function delivery_run(&$argv, &$argc){
                        $updated = $r[0]['edited'];
 
                        $items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
-                               FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d and visible = 1 and moderated = 0 ORDER BY `id` ASC",
+                               FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d AND visible = 1 AND moderated = 0 ORDER BY `id` ASC",
                                intval($parent_id)
                        );
 
@@ -299,7 +300,7 @@ function delivery_run(&$argv, &$argc){
 
                                // perform local delivery if we are on the same site
 
-                               if (link_compare($basepath,App::get_baseurl())) {
+                               if (link_compare($basepath,System::baseUrl())) {
 
                                        $nickname = basename($contact['url']);
                                        if ($contact['issued-id']) {
@@ -339,7 +340,7 @@ function delivery_run(&$argv, &$argc){
 
                                                // If we are setup as a soapbox we aren't accepting top level posts from this person
 
-                                               if (($x[0]['page-flags'] == PAGE_SOAPBOX) AND $top_level) {
+                                               if (($x[0]['page-flags'] == PAGE_SOAPBOX) && $top_level) {
                                                        break;
                                                }
                                                logger('mod-delivery: local delivery');
@@ -453,7 +454,7 @@ function delivery_run(&$argv, &$argc){
                                                $headers .= "References: <".iri2msgid($it["parent-uri"]).">";
 
                                                // If Threading is enabled, write down the correct parent
-                                               if (($it["thr-parent"] != "") and ($it["thr-parent"] != $it["parent-uri"]))
+                                               if (($it["thr-parent"] != "") && ($it["thr-parent"] != $it["parent-uri"]))
                                                        $headers .= " <".iri2msgid($it["thr-parent"]).">";
                                                $headers .= "\n";
 
@@ -462,14 +463,14 @@ function delivery_run(&$argv, &$argc){
                                                                dbesc($it['parent-uri']),
                                                                intval($uid));
 
-                                                       if (dbm::is_result($r) AND ($r[0]['title'] != '')) {
+                                                       if (dbm::is_result($r) && ($r[0]['title'] != '')) {
                                                                $subject = $r[0]['title'];
                                                        } else {
                                                                $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
                                                                        dbesc($it['parent-uri']),
                                                                        intval($uid));
 
-                                                               if (dbm::is_result($r) AND ($r[0]['title'] != ''))
+                                                               if (dbm::is_result($r) && ($r[0]['title'] != ''))
                                                                        $subject = $r[0]['title'];
                                                        }
                                                }
@@ -507,6 +508,9 @@ function delivery_run(&$argv, &$argc){
                                        logger('diaspora retract: '.$loc);
                                        Diaspora::send_retraction($target_item,$owner,$contact,$public_message);
                                        break;
+                               } elseif ($relocate) {
+                                       Diaspora::sendAccountMigration($owner, $contact, $uid);
+                                       break;
                                } elseif ($followup) {
                                        // send comments and likes to owner to relay
                                        logger('diaspora followup: '.$loc);