]> git.mxchange.org Git - friendica.git/commitdiff
Fixed code structure
authorMichael Vogel <ike@pirati.ca>
Sun, 23 Oct 2016 22:12:45 +0000 (22:12 +0000)
committerMichael Vogel <ike@pirati.ca>
Sun, 23 Oct 2016 22:12:45 +0000 (22:12 +0000)
include/Core/Config.php
include/cron.php
include/dba.php
include/ostatus.php

index b56edb4c26f5fdc2176bf03ed68b4d94bdb33fc7..a5eca0570a56efc86f1ecf26ed4dae91f71e07df 100644 (file)
@@ -134,7 +134,7 @@ class Config {
                $a->config[$family][$key] = $value;
 
                // manage array value
-               $dbvalue = (is_array($value) ? serialize($value):$value);
+               $dbvalue = (is_array($value) ? serialize($value) : $value);
                $dbvalue = (is_bool($dbvalue) ? intval($dbvalue) : $dbvalue);
 
                if (is_null($stored)) {
index 07770a2eeec03f58fb0c2f2c047e221b4a513eb2..6dc34224f7e6ce21a4d681af567c4ae82dd5e18a 100644 (file)
@@ -69,15 +69,15 @@ function cron_run(&$argv, &$argc){
 
        // run queue delivery process in the background
 
-       proc_run(PRIORITY_NEGLIGIBLE,"include/queue.php");
+       proc_run(PRIORITY_NEGLIGIBLE, "include/queue.php");
 
        // run the process to discover global contacts in the background
 
-       proc_run(PRIORITY_LOW,"include/discover_poco.php");
+       proc_run(PRIORITY_LOW, "include/discover_poco.php");
 
        // run the process to update locally stored global contacts in the background
 
-       proc_run(PRIORITY_LOW,"include/discover_poco.php", "checkcontact");
+       proc_run(PRIORITY_LOW, "include/discover_poco.php", "checkcontact");
 
        // Expire and remove user entries
        cron_expire_and_remove_users();
@@ -120,19 +120,19 @@ function cron_run(&$argv, &$argc){
 
                update_contact_birthdays();
 
-               proc_run(PRIORITY_LOW,"include/discover_poco.php", "suggestions");
+               proc_run(PRIORITY_LOW, "include/discover_poco.php", "suggestions");
 
                set_config('system','last_expire_day',$d2);
 
-               proc_run(PRIORITY_LOW,'include/expire.php');
+               proc_run(PRIORITY_LOW, 'include/expire.php');
 
                if (get_config("system", "worker")) {
-                       proc_run(PRIORITY_LOW,'include/dbclean.php', 1);
-                       proc_run(PRIORITY_LOW,'include/dbclean.php', 2);
-                       proc_run(PRIORITY_LOW,'include/dbclean.php', 3);
-                       proc_run(PRIORITY_LOW,'include/dbclean.php', 4);
+                       proc_run(PRIORITY_LOW, 'include/dbclean.php', 1);
+                       proc_run(PRIORITY_LOW, 'include/dbclean.php', 2);
+                       proc_run(PRIORITY_LOW, 'include/dbclean.php', 3);
+                       proc_run(PRIORITY_LOW, 'include/dbclean.php', 4);
                } else {
-                       proc_run(PRIORITY_LOW,'include/dbclean.php');
+                       proc_run(PRIORITY_LOW, 'include/dbclean.php');
                }
        }
 
@@ -315,7 +315,7 @@ function cron_poll_contacts($argc, $argv) {
 
                        logger("Polling ".$contact["network"]." ".$contact["id"]." ".$contact["nick"]." ".$contact["name"]);
 
-                       proc_run(PRIORITY_MEDIUM,'include/onepoll.php',$contact['id']);
+                       proc_run(PRIORITY_MEDIUM, 'include/onepoll.php', $contact['id']);
 
                        if($interval)
                                @time_sleep_until(microtime(true) + (float) $interval);
index d97defa4c325be0f6490f6f90da5d0eaa4a0ec2c..17b8a0a12bffba10ea7569d7c4f66e490170cd7c 100644 (file)
@@ -34,7 +34,7 @@ class dba {
        public  $connected = false;
        public  $error = false;
 
-       function __construct($server,$user,$pass,$db,$install = false) {
+       function __construct($server, $user, $pass, $db, $install = false) {
                global $a;
 
                $stamp1 = microtime(true);
@@ -80,8 +80,9 @@ class dba {
                }
                if (!$this->connected) {
                        $this->db = null;
-                       if (!$install)
+                       if (!$install) {
                                system_unavailable();
+                       }
                }
 
                $a->save_timestamp($stamp1, "network");
@@ -114,8 +115,9 @@ class dba {
         * @return integer
         */
        public function num_rows() {
-               if (!$this->result)
+               if (!$this->result) {
                        return 0;
+               }
 
                if ($this->mysqli) {
                        $return = $this->result->num_rows;
@@ -128,8 +130,9 @@ class dba {
        public function q($sql, $onlyquery = false) {
                global $a;
 
-               if ((!$this->db) || (!$this->connected))
+               if (!$this->db || !$this->connected) {
                        return false;
+               }
 
                $this->error = '';
 
@@ -139,13 +142,13 @@ class dba {
                } else {
                        $connected = mysql_ping($this->db);
                }
-               $connstr = ($connected ? "Connected": "Disonnected");
+               $connstr = ($connected ? "Connected" : "Disonnected");
 
                $stamp1 = microtime(true);
 
                $orig_sql = $sql;
 
-               if (x($a->config,'system') && x($a->config['system'],'db_callstack')) {
+               if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
                        $sql = "/*".$a->callstack()." */ ".$sql;
                }
 
@@ -255,7 +258,7 @@ class dba {
        public function qfetch() {
                $x = false;
 
-               if ($this->result)
+               if ($this->result) {
                        if ($this->mysqli) {
                                if ($this->result->num_rows)
                                        $x = $this->result->fetch_array(MYSQLI_ASSOC);
@@ -263,17 +266,18 @@ class dba {
                                if (mysql_num_rows($this->result))
                                        $x = mysql_fetch_array($this->result, MYSQL_ASSOC);
                        }
-
+               }
                return($x);
        }
 
        public function qclose() {
-               if ($this->result)
+               if ($this->result) {
                        if ($this->mysqli) {
                                $this->result->free_result();
                        } else {
                                mysql_free_result($this->result);
                        }
+               }
        }
 
        public function dbg($dbg) {
index 83bc493e3912e0f614768c4d043bccf132b550f5..bcd8fd671302bffd4527ab1160d277d7095602ef 100644 (file)
@@ -810,7 +810,7 @@ class ostatus {
                                `item`.`verb`, `item`.`visible` FROM `term`
                                STRAIGHT_JOIN `item` AS `thritem` ON `thritem`.`parent` = `term`.`oid`
                                STRAIGHT_JOIN `item` ON `item`.`parent` = `thritem`.`parent`
-                               WHERE `term`.`uid` = %d AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`url` = '%s'))",
+                               WHERE `term`.`uid` = %d AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`url` = '%s'",
                                intval($uid), intval(TERM_OBJ_POST), intval(TERM_CONVERSATION), dbesc($conversation_url));
 
 /*             2016-10-23: The old query will be kept until we are sure that the query above is a good and fast replacement