Fixed parser errors (opps) + changed # -> // Please do so also as # for comments...
authorRoland Haeder <roland@mxchange.org>
Fri, 23 Dec 2016 19:09:10 +0000 (20:09 +0100)
committerRoland Haeder <roland@mxchange.org>
Fri, 23 Dec 2016 19:09:10 +0000 (20:09 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
include/plugin.php
library/spam/b8/storage/storage_frndc.php
mod/admin.php
mod/profile.php

index 8cb2783..83f6f1a 100644 (file)
@@ -478,7 +478,7 @@ function service_class_allows($uid,$property,$usage = false) {
                }
        }
 
-       if (! x($service_class)) [
+       if (! x($service_class)) {
                // everything is allowed
                return true;
        }
index 62909d4..e01e652 100644 (file)
@@ -123,15 +123,17 @@ class b8_storage_frndc extends b8_storage_base
        function __destruct()
        {
 
-               if($this->_connection === NULL)
+               if ($this->_connection === NULL) {
                        return;
+               }
 
-               # Commit any changes before closing
+               // Commit any changes before closing
                $this->_commit();
 
-               # Just close the connection if no link-resource was passed and b8 created it's own connection
-               if($this->config['connection'] === NULL)
+               // Just close the connection if no link-resource was passed and b8 created it's own connection
+               if ($this->config['connection'] === NULL) {
                        mysql_close($this->_connection);
+               }
 
                $this->connected = FALSE;
 
@@ -163,9 +165,8 @@ class b8_storage_frndc extends b8_storage_base
        protected function _get_query($tokens, $uid)
        {
 
-               # Construct the query ...
-
-               if(count($tokens) > 0) {
+               // Construct the query ...
+               if (count($tokens) > 0) {
 
                        $where = array();
 
@@ -175,42 +176,42 @@ class b8_storage_frndc extends b8_storage_base
                        }
 
                        $where = 'term IN ("' . implode('", "', $where) . '")';
-               }
-
-               else {
+               } else {
                        $token = dbesc($token);
                        $where = 'term = "' . $token . '"';
                }
 
-               # ... and fetch the data
+               // ... and fetch the data
 
-               $result = q('
-                       SELECT * FROM spam WHERE ' . $where . ' AND uid = ' . $uid );
+               $result = q('SELECT * FROM `spam` WHERE ' . $where . ' AND `uid` = ' . $uid );
 
 
                $returned_tokens = array();
-               if(count($result)) {
-                       foreach($result as $rr)
+               if (dbm::is_result($result)) {
+                       foreach ($result as $rr) {
                                $returned_tokens[] = $rr['term'];
+                       }
                }
                $to_create = array();
 
-               if(count($tokens) > 0) {
+               if (count($tokens) > 0) {
                        foreach($tokens as $token)
                                if(! in_array($token,$returned_tokens))
                                        $to_create[] = str_tolower($token); 
                }
-               if(count($to_create)) {
+               if (count($to_create)) {
                        $sql = '';
-                       foreach($to_create as $term) {
-                               if(strlen($sql))
+                       foreach ($to_create as $term) {
+                               if (strlen($sql)) {
                                        $sql .= ',';
-                               $sql .= sprintf("(term,datetime,uid) values('%s','%s',%d)",
-                                       dbesc(str_tolower($term))
+                               }
+                               $sql .= sprintf("(`term`,`datetime`,`uid`) VALUES('%s','%s',%d)",
+                                       dbesc(str_tolower($term)),
                                        dbesc(datetime_convert()),
                                        intval($uid)
                                );
-                       q("insert into spam " . $sql);
+                       }
+                       q("INSERT INTO `spam` " . $sql);
                }
 
                return $result;
@@ -225,7 +226,6 @@ class b8_storage_frndc extends b8_storage_base
         * @param string $count
         * @return void
         */
-
        protected function _put($token, $count, $uid) {
                $token = dbesc($token);
                $count = dbesc($count);
@@ -241,7 +241,6 @@ class b8_storage_frndc extends b8_storage_base
         * @param string $count
         * @return void
         */
-
        protected function _update($token, $count, $uid)
        {
                $token = dbesc($token);
@@ -257,7 +256,6 @@ class b8_storage_frndc extends b8_storage_base
         * @param string $token
         * @return void
         */
-
        protected function _del($token, $uid)
        {
                $token = dbesc($token);
@@ -272,7 +270,6 @@ class b8_storage_frndc extends b8_storage_base
         * @access protected
         * @return void
         */
-
        protected function _commit($uid)
        {
 
@@ -314,5 +311,3 @@ class b8_storage_frndc extends b8_storage_base
        }
 
 }
-
-?>
\ No newline at end of file
index e1ccf67..100a125 100644 (file)
@@ -1854,9 +1854,9 @@ function admin_page_logs_post(App &$a) {
        if (x($_POST,"page_logs")) {
                check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
 
-               $logfile   = (x($_POST,'logfile'))    ? notags(trim($_POST['logfile'])) : '');
-               $debugging = ((x($_POST,'debugging')) ? true                                    : false);
-               $loglevel  = ((x($_POST,'loglevel'))  ? intval(trim($_POST['loglevel']))        : 0);
+               $logfile   = ((x($_POST,'logfile'))    ? notags(trim($_POST['logfile'])) : '');
+               $debugging = ((x($_POST,'debugging')) ? true : false);
+               $loglevel  = ((x($_POST,'loglevel'))  ? intval(trim($_POST['loglevel'])) : 0);
 
                set_config('system','logfile', $logfile);
                set_config('system','debugging',  $debugging);
index 8519f7e..3253975 100644 (file)
@@ -41,14 +41,15 @@ function profile_init(App &$a) {
        if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
                $a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
        }
-       if(x($a->profile,'openidserver'))
+       if (x($a->profile,'openidserver')) {
                $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
-       if(x($a->profile,'openid')) {
+       }
+       if (x($a->profile,'openid')) {
                $delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'https://' . $a->profile['openid']);
                $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
        }
        // site block
-       if((! $blocked) && (! $userblock)) {
+       if ((! $blocked) && (! $userblock)) {
                $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
                $keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
                if(strlen($keywords))
@@ -81,6 +82,7 @@ function profile_content(&$a, $update = 0) {
                                        $datequery2 = escape_tags($a->argv[$x]);
                                } else {
                                        $datequery = escape_tags($a->argv[$x]);
+                               }
                        } else {
                                $category = $a->argv[$x];
                        }