]> git.mxchange.org Git - friendica.git/blobdiff - include/onepoll.php
Changed documentation
[friendica.git] / include / onepoll.php
index 43c4495b6c4294cdfdc1d6a210859d59a130936b..cf5a1f576a9b45238d2a1986d7fb98dab06a9c46 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
 
 require_once('include/follow.php');
 
@@ -133,7 +133,7 @@ function onepoll_run(&$argv, &$argc){
 
        logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
 
-       $last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
+       $last_update = (($contact['last-update'] <= NULL_DATE)
                ? datetime_convert('UTC','UTC','now - 7 days', ATOM_TIME)
                : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME)
        );
@@ -170,7 +170,7 @@ function onepoll_run(&$argv, &$argc){
                // But this may be our first communication, so set the writable flag if it isn't set already.
 
                if (! intval($contact['writable'])) {
-                       q("update contact set writable = 1 where id = %d", intval($contact['id']));
+                       q("UPDATE `contact` SET `writable` = 1 WHERE `id` = %d", intval($contact['id']));
                }
 
                $url = $contact['poll'] . '?dfrn_id=' . $idtosend
@@ -239,7 +239,7 @@ function onepoll_run(&$argv, &$argc){
                                intval($contact['id'])
                        );
                        mark_for_death($contact);
-               } elseif ($contact['term-date'] != '0000-00-00 00:00:00') {
+               } elseif ($contact['term-date'] > NULL_DATE) {
                        logger("poller: $url back from the dead - removing mark for death");
                        unmark_for_death($contact);
                }
@@ -437,16 +437,18 @@ function onepoll_run(&$argv, &$argc){
                                                if ($raw_refs) {
                                                        $refs_arr = explode(' ', $raw_refs);
                                                        if (count($refs_arr)) {
-                                                               for($x = 0; $x < count($refs_arr); $x ++)
+                                                               for ($x = 0; $x < count($refs_arr); $x ++) {
                                                                        $refs_arr[$x] = "'" . msgid2iri(str_replace(array('<','>',' '),array('','',''),dbesc($refs_arr[$x]))) . "'";
+                                                               }
                                                        }
                                                        $qstr = implode(',',$refs_arr);
                                                        $r = q("SELECT `uri` , `parent-uri` FROM `item` USE INDEX (`uid_uri`) WHERE `uri` IN ($qstr) AND `uid` = %d LIMIT 1",
                                                                intval($importer_uid)
                                                        );
-                                                       if (dbm::is_result($r))
+                                                       if (dbm::is_result($r)) {
                                                                $datarray['parent-uri'] = $r[0]['parent-uri'];  // Set the parent as the top-level item
-       //                                                      $datarray['parent-uri'] = $r[0]['uri'];
+                                                               //$datarray['parent-uri'] = $r[0]['uri'];
+                                                       }
                                                }
 
                                                // Decoding the header
@@ -611,14 +613,17 @@ function onepoll_run(&$argv, &$argc){
                consume_feed($xml,$importer,$contact,$hub,1,2);
 
                $hubmode = 'subscribe';
-               if ($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly'])
+               if ($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) {
                        $hubmode = 'unsubscribe';
+               }
 
-               if (($contact['network'] === NETWORK_OSTATUS ||  $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify']))
+               if (($contact['network'] === NETWORK_OSTATUS ||  $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify'])) {
                        $hub_update = true;
+               }
 
-               if ($force)
+               if ($force) {
                        $hub_update = true;
+               }
 
                logger("Contact ".$contact['id']." returned hub: ".$hub." Network: ".$contact['network']." Relation: ".$contact['rel']." Update: ".$hub_update);