From 7aa799a0ee5e43e2677d177cf70dcbfb62151e5d Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 23 Dec 2016 20:09:10 +0100 Subject: [PATCH] Fixed parser errors (opps) + changed # -> // Please do so also as # for comments is deprecated. Signed-off-by: Roland Haeder --- include/plugin.php | 2 +- library/spam/b8/storage/storage_frndc.php | 51 ++++++++++------------- mod/admin.php | 6 +-- mod/profile.php | 8 ++-- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/include/plugin.php b/include/plugin.php index 8cb2783eef..83f6f1ab95 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -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; } diff --git a/library/spam/b8/storage/storage_frndc.php b/library/spam/b8/storage/storage_frndc.php index 62909d4715..e01e652ae4 100644 --- a/library/spam/b8/storage/storage_frndc.php +++ b/library/spam/b8/storage/storage_frndc.php @@ -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 diff --git a/mod/admin.php b/mod/admin.php index e1ccf67caf..100a125335 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -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); diff --git a/mod/profile.php b/mod/profile.php index 8519f7e82e..32539758e2 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -41,14 +41,15 @@ function profile_init(App &$a) { if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) { $a->page['htmlhead'] .= ''; } - if(x($a->profile,'openidserver')) + if (x($a->profile,'openidserver')) { $a->page['htmlhead'] .= '' . "\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'] .= '' . "\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]; } -- 2.39.5