Completed
Push — master ( 7c5656...a50592 )
by Michael
01:55
created
view.blogs.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 
31 31
 if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
32
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
32
+    include XOOPS_ROOT_PATH.'/include/notification_update.php';
33 33
     exit();
34 34
 }
35 35
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 }
67 67
 */
68 68
 
69
-$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_BLOGS');
69
+$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_BLOGS');
70 70
 $xoopsOption['template_main']   = PlanetUtility::planetGetTemplate('blogs');
71
-require_once XOOPS_ROOT_PATH . '/header.php';
72
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
71
+require_once XOOPS_ROOT_PATH.'/header.php';
72
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
73 73
 
74 74
 // Following part will not be executed after cache
75 75
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 $criteria    = new CriteriaCompo();
82 82
 $blog_prefix = '';
83 83
 /* Specific category */
84
-if ($category_id > 0) {
84
+if ($category_id>0) {
85 85
     $category_obj = $categoryHandler->get($category_id);
86 86
     $criteria->add(new Criteria('bc.cat_id', $category_id));
87 87
     $uid           = 0;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 }
93 93
 
94 94
 /* User bookmarks(favorites) */
95
-if ($uid > 0) {
95
+if ($uid>0) {
96 96
     $criteria->add(new Criteria('bm.bm_uid', $uid));
97 97
     $category_id     = 0;
98 98
     $blog_id         = 0;
@@ -106,25 +106,25 @@  discard block
 block discarded – undo
106 106
     $blog_prefix     = 'b.';
107 107
 }
108 108
 
109
-$criteria->add(new Criteria($blog_prefix . 'blog_status', 0, '>'));
109
+$criteria->add(new Criteria($blog_prefix.'blog_status', 0, '>'));
110 110
 
111 111
 /* Sort */
112 112
 $order = 'DESC';
113 113
 $sort  = empty($sort) ? 'default' : $sort;
114 114
 switch ($sort) {
115 115
     case 'marks':
116
-        $sortby = $blog_prefix . 'blog_marks';
116
+        $sortby = $blog_prefix.'blog_marks';
117 117
         break;
118 118
     case 'rating':
119
-        $sortby = $blog_prefix . 'blog_rating';
119
+        $sortby = $blog_prefix.'blog_rating';
120 120
         break;
121 121
     case 'time':
122
-        $sortby = $blog_prefix . 'blog_time';
122
+        $sortby = $blog_prefix.'blog_time';
123 123
         break;
124 124
     case 'default':
125 125
     default:
126 126
         $sort   = 'default';
127
-        $sortby = $blog_prefix . 'blog_id';
127
+        $sortby = $blog_prefix.'blog_id';
128 128
         break;
129 129
 }
130 130
 $criteria->setSort($sortby);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 $criteria->setStart($start);
133 133
 $criteria->setLimit($limit);
134 134
 
135
-$tags = empty($list) ? '' : [$blog_prefix . 'blog_title', $blog_prefix . 'blog_time'];
135
+$tags = empty($list) ? '' : [$blog_prefix.'blog_title', $blog_prefix.'blog_time'];
136 136
 switch ($query_type) {
137 137
     case 'category':
138 138
         $blogs_obj  = $blogHandler->getByCategory($criteria, $tags);
@@ -172,31 +172,31 @@  discard block
 block discarded – undo
172 172
 }
173 173
 unset($blogs_obj);
174 174
 
175
-if ($count_blog > $limit) {
176
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
175
+if ($count_blog>$limit) {
176
+    include XOOPS_ROOT_PATH.'/class/pagenav.php';
177 177
     $start_link = [];
178 178
     if ($sort) {
179
-        $start_link[] = 'sort=' . $sort;
179
+        $start_link[] = 'sort='.$sort;
180 180
     }
181 181
     if ($category_id) {
182
-        $start_link[] = 'category=' . $category_id;
182
+        $start_link[] = 'category='.$category_id;
183 183
     }
184 184
     if ($list) {
185
-        $start_link[] = 'list=' . $list;
185
+        $start_link[] = 'list='.$list;
186 186
     }
187 187
     $nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link));
188 188
     $pagenav = $nav->renderNav(4);
189
-} else {
189
+}else {
190 190
     $pagenav = '';
191 191
 }
192 192
 
193 193
 $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']);
194
-$xoopsTpl->assign('link_home', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" . planet_constant('MD_HOME') . "\" target=\"_self\">" . planet_constant('MD_HOME') . '</a>');
194
+$xoopsTpl->assign('link_home', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/index.php\" title=\"".planet_constant('MD_HOME')."\" target=\"_self\">".planet_constant('MD_HOME').'</a>');
195 195
 
196 196
 if ($category_id || $uid) {
197
-    $xoopsTpl->assign('link_index', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/view.blogs.php\" title=\"" . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>');
197
+    $xoopsTpl->assign('link_index', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/view.blogs.php\" title=\"".planet_constant('MD_INDEX')."\" target=\"_self\">".planet_constant('MD_INDEX').'</a>');
198 198
 
199
-    $link_articles = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" . planet_constant('MD_ARTICLES') . "\">" . planet_constant('MD_ARTICLES') . '</a>';
199
+    $link_articles = "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.(empty($category_id) ? '' : '/c'.$category_id).(empty($uid) ? '' : '/u'.$uid)."\" title=\"".planet_constant('MD_ARTICLES')."\">".planet_constant('MD_ARTICLES').'</a>';
200 200
     $xoopsTpl->assign('link_articles', $link_articles);
201 201
 }
202 202
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                . '/modules/'
206 206
                . $GLOBALS['moddirname']
207 207
                . '/view.blogs.php'
208
-               . (empty($category_id) ? '' : '/c' . $category_id)
209
-               . (empty($uid) ? '' : '/u' . $uid)
208
+               . (empty($category_id) ? '' : '/c'.$category_id)
209
+               . (empty($uid) ? '' : '/u'.$uid)
210 210
                . (empty($list) ? '/l1' : '')
211 211
                . "\" title=\""
212 212
                . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 $xoopsTpl->assign('link_switch', $link_switch);
217 217
 
218 218
 if (empty($uid) && is_object($xoopsUser)) {
219
-    $xoopsTpl->assign('link_bookmark', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>');
219
+    $xoopsTpl->assign('link_bookmark', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.URL_DELIMITER.'u'.$xoopsUser->getVar('uid')."\" title=\"".planet_constant('MD_BOOKMARKS')."\" target=\"_self\">".planet_constant('MD_BOOKMARKS').'</a>');
220 220
 }
221 221
 
222 222
 if ($xoopsModuleConfig['newblog_submit'] == 1 || is_object($xoopsUser)) {
223
-    $xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
223
+    $xoopsTpl->assign('link_submit', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/action.blog.php\" title=\""._SUBMIT."\" target=\"_blank\">"._SUBMIT.'</a>');
224 224
 }
225 225
 
226
-$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS'));
226
+$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name').'::'.planet_constant('MD_BLOGS'));
227 227
 $xoopsTpl->assign('category', @$category_data);
228 228
 $xoopsTpl->assign('user', @$user_data);
229 229
 $xoopsTpl->assign('blogs', $blogs);
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
     $xoopsTpl->assign('canrate', 1);
238 238
 }
239 239
 
240
-$sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER;
240
+$sort_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.URL_DELIMITER;
241 241
 $vars      = [];
242 242
 if (!empty($category_id)) {
243
-    $vars[] = 'c' . $category_id;
243
+    $vars[] = 'c'.$category_id;
244 244
 }
245 245
 if (!empty($uid)) {
246
-    $vars[] = 'u' . $uid;
246
+    $vars[] = 'u'.$uid;
247 247
 }
248 248
 if (!empty($list)) {
249 249
     $vars[] = 'li';
250 250
 }
251 251
 if (!empty($vars)) {
252
-    $sort_link .= implode('/', $vars) . '/';
252
+    $sort_link .= implode('/', $vars).'/';
253 253
 }
254 254
 $sortlinks   = [];
255 255
 $valid_sorts = [
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
     if ($val == $sort) {
263 263
         continue;
264 264
     }
265
-    $sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>';
265
+    $sortlinks[] = "<a href=\"".$sort_link.$val."\">".$name.'</a>';
266 266
 }
267 267
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
268 268
 
269
-require_once __DIR__ . '/footer.php';
269
+require_once __DIR__.'/footer.php';
Please login to merge, or discard this patch.
search.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -27,35 +27,35 @@  discard block
 block discarded – undo
27 27
 use Xmf\Request;
28 28
 
29 29
 $xoopsOption['pagetype'] = 'search';
30
-include __DIR__ . '/header.php';
30
+include __DIR__.'/header.php';
31 31
 $xoopsModule->loadLanguage('main');
32 32
 $configHandler     = xoops_getHandler('config');
33 33
 $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
34 34
 if (empty($xoopsConfigSearch['enable_search'])) {
35
-    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
35
+    redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php', 2, planet_constant('MD_NOACCESS'));
36 36
 }
37 37
 
38 38
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
39 39
 $xoopsOption['template_main']                             = PlanetUtility::planetGetTemplate('search');
40
-include XOOPS_ROOT_PATH . '/header.php';
41
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
40
+include XOOPS_ROOT_PATH.'/header.php';
41
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
42 42
 
43
-require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/search.inc.php';
43
+require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/search.inc.php';
44 44
 $limit = $xoopsModuleConfig['articles_perpage'];
45 45
 
46 46
 $queries  = [];
47
-$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST');//isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
48
-$start    = Request::getInt('start', 0, 'GET');//isset($_GET['start']) ? $_GET['start'] : 0;
47
+$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST'); //isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
48
+$start    = Request::getInt('start', 0, 'GET'); //isset($_GET['start']) ? $_GET['start'] : 0;
49 49
 $category = Request::getInt('category', Request::getInt('category', 0, 'GET'), 'POST'); //(int)(isset($_POST['category']) ? $_POST['category'] : (isset($_GET['category']) ? $_GET['category'] : null));
50
-$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51
-$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
50
+$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST'); //(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51
+$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST'); //(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
52 52
 $searchin = Request::getArray(
53 53
     'searchin',
54 54
     0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
55 55
                               'POST'
56 56
 ); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array());
57
-$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58
-$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
57
+$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST'); //isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58
+$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST'); //isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
59 59
 
60 60
 $andor  = in_array(strtoupper($andor), ['OR', 'AND', 'EXACT']) ? strtoupper($andor) : 'OR';
61 61
 $sortby = in_array(strtolower($sortby), [
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
         $temp_queries    = preg_split("/[\s,]+/", $query);
84 84
         foreach ($temp_queries as $q) {
85 85
             $q = trim($q);
86
-            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
86
+            if (strlen($q)>=$xoopsConfigSearch['keyword_min']) {
87 87
                 $queries[] = $myts->addSlashes($q);
88
-            } else {
88
+            }else {
89 89
                 $ignored_queries[] = $myts->addSlashes($q);
90 90
             }
91 91
         }
92 92
         if (count($queries) == 0) {
93
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
93
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
94 94
         }
95
-    } else {
96
-        if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
97
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
95
+    }else {
96
+        if (strlen($query)<$xoopsConfigSearch['keyword_min']) {
97
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98 98
         }
99 99
         $queries = [$myts->addSlashes($query)];
100 100
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     if (!empty($time)) {
109 109
         $extra = '';
110
-    } else {
110
+    }else {
111 111
         $extra = '';
112 112
     }
113 113
 
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $xoopsTpl->assign('results', $results);
123 123
 
124
-        if (count($next_search) > 0) {
124
+        if (count($next_search)>0) {
125 125
             $items = [];
126 126
             foreach ($next_search as $para => $val) {
127 127
                 if (!empty($val)) {
128 128
                     $items[] = "$para=$val";
129 129
                 }
130 130
             }
131
-            if (count($items) > 0) {
131
+            if (count($items)>0) {
132 132
                 $paras = implode('&', $items);
133 133
             }
134 134
             unset($next_search);
135 135
             unset($items);
136 136
         }
137
-        $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
137
+        $search_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php?'.$paras;
138 138
 
139 139
         /*
140 140
          $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra);
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
       if (false != $has_next)
147 147
       */
148 148
         if (count($results)) {
149
-            $next            = $start + $limit;
149
+            $next            = $start+$limit;
150 150
             $queries         = implode(',', $queries);
151
-            $search_url_next = $search_url . "&start=$next";
152
-            $search_next     = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>';
151
+            $search_url_next = $search_url."&start=$next";
152
+            $search_next     = "<a href=\"".htmlspecialchars($search_url_next)."\">"._SR_NEXT.'</a>';
153 153
             $xoopsTpl->assign('search_next', $search_next);
154 154
         }
155
-        if ($start > 0) {
156
-            $prev            = $start - $limit;
157
-            $search_url_prev = $search_url . "&start=$prev";
158
-            $search_prev     = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>';
155
+        if ($start>0) {
156
+            $prev            = $start-$limit;
157
+            $search_url_prev = $search_url."&start=$prev";
158
+            $search_prev     = "<a href=\"".htmlspecialchars($search_url_prev)."\">"._SR_PREVIOUS.'</a>';
159 159
             $xoopsTpl->assign('search_prev', $search_prev);
160 160
         }
161 161
     }
162 162
 
163 163
     unset($results);
164
-    $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
164
+    $search_info = _SR_KEYWORDS.': '.$myts->htmlSpecialChars($term);
165 165
     $xoopsTpl->assign('search_info', $search_info);
166 166
 }
167 167
 
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 if ('OR' === $andor) {
172 172
     $type_select .= " selected=\"selected\"";
173 173
 }
174
-$type_select .= '>' . _SR_ANY . '</option>';
174
+$type_select .= '>'._SR_ANY.'</option>';
175 175
 $type_select .= "<option value=\"AND\"";
176 176
 if ('AND' === $andor) {
177 177
     $type_select .= " selected=\"selected\"";
178 178
 }
179
-$type_select .= '>' . _SR_ALL . '</option>';
179
+$type_select .= '>'._SR_ALL.'</option>';
180 180
 $type_select .= "<option value=\"EXACT\"";
181 181
 if ('exact' === $andor) {
182 182
     $type_select .= " selected=\"selected\"";
183 183
 }
184
-$type_select .= '>' . _SR_EXACT . '</option>';
184
+$type_select .= '>'._SR_EXACT.'</option>';
185 185
 $type_select .= '</select>';
186 186
 
187 187
 /* scope */
@@ -190,32 +190,32 @@  discard block
 block discarded – undo
190 190
 if (in_array('title', $searchin)) {
191 191
     $searchin_select .= ' checked';
192 192
 }
193
-$searchin_select .= '>' . planet_constant('MD_TITLE') . '&nbsp;&nbsp;';
193
+$searchin_select .= '>'.planet_constant('MD_TITLE').'&nbsp;&nbsp;';
194 194
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\"";
195 195
 if (in_array('text', $searchin)) {
196 196
     $searchin_select .= ' checked';
197 197
 }
198
-$searchin_select .= '>' . planet_constant('MD_BODY') . '&nbsp;&nbsp;||&nbsp;&nbsp;';
198
+$searchin_select .= '>'.planet_constant('MD_BODY').'&nbsp;&nbsp;||&nbsp;&nbsp;';
199 199
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\"";
200 200
 if (in_array('blog', $searchin)) {
201 201
     $searchin_select .= ' checked';
202 202
 }
203
-$searchin_select .= '>' . planet_constant('MD_BLOG') . '&nbsp;&nbsp;';
203
+$searchin_select .= '>'.planet_constant('MD_BLOG').'&nbsp;&nbsp;';
204 204
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\"";
205 205
 if (in_array('feed', $searchin)) {
206 206
     $searchin_select .= ' checked';
207 207
 }
208
-$searchin_select .= '>' . planet_constant('MD_FEED') . '&nbsp;&nbsp;';
208
+$searchin_select .= '>'.planet_constant('MD_FEED').'&nbsp;&nbsp;';
209 209
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\"";
210 210
 if (in_array('desc', $searchin)) {
211 211
     $searchin_select .= ' checked';
212 212
 }
213
-$searchin_select .= '>' . planet_constant('MD_DESC') . '&nbsp;&nbsp;';
213
+$searchin_select .= '>'.planet_constant('MD_DESC').'&nbsp;&nbsp;';
214 214
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\"";
215 215
 if (empty($searchin)) {
216 216
     $searchin_select .= ' checked';
217 217
 }
218
-$searchin_select .= '>' . _ALL . '&nbsp;&nbsp;';
218
+$searchin_select .= '>'._ALL.'&nbsp;&nbsp;';
219 219
 
220 220
 /* sortby */
221 221
 $sortby_select = "<select name=\"sortby\">";
@@ -223,28 +223,28 @@  discard block
 block discarded – undo
223 223
 if (empty($sortby)) {
224 224
     $sortby_select .= " selected=\"selected\"";
225 225
 }
226
-$sortby_select .= '>' . _NONE . '</option>';
226
+$sortby_select .= '>'._NONE.'</option>';
227 227
 $sortby_select .= "<option value=\"a.art_time\"";
228 228
 if ('a.art_time' === $sortby) {
229 229
     $sortby_select .= " selected=\"selected\"";
230 230
 }
231
-$sortby_select .= '>' . planet_constant('MD_TIME') . '</option>';
231
+$sortby_select .= '>'.planet_constant('MD_TIME').'</option>';
232 232
 $sortby_select .= "<option value=\"a.art_title\"";
233 233
 if ('a.art_title' === $sortby) {
234 234
     $sortby_select .= " selected=\"selected\"";
235 235
 }
236
-$sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>';
236
+$sortby_select .= '>'.planet_constant('MD_TITLE').'</option>';
237 237
 $sortby_select .= "<option value=\"\">&nbsp;&nbsp;----&nbsp;&nbsp;</option>";
238 238
 $sortby_select .= "<option value=\"a.blog_title\"";
239 239
 if ('a.blog_title' === $sortby) {
240 240
     $sortby_select .= " selected=\"selected\"";
241 241
 }
242
-$sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>';
242
+$sortby_select .= '>'.planet_constant('MD_BLOG').'</option>';
243 243
 $sortby_select .= "<option value=\"a.blog_time\"";
244 244
 if ('b.blog_time' === $sortby) {
245 245
     $sortby_select .= " selected=\"selected\"";
246 246
 }
247
-$sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>';
247
+$sortby_select .= '>'.planet_constant('MD_UPDATE').'</option>';
248 248
 $sortby_select .= '</select>';
249 249
 
250 250
 $xoopsTpl->assign('type_select', $type_select);
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 $xoopsTpl->assign('blog', $blog);
259 259
 $xoopsTpl->assign('uid', $uid);
260 260
 
261
-if ($xoopsConfigSearch['keyword_min'] > 0) {
261
+if ($xoopsConfigSearch['keyword_min']>0) {
262 262
     $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
263 263
 }
264 264
 
265
-include XOOPS_ROOT_PATH . '/footer.php';
265
+include XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
class/category.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
  */
31 31
 
32 32
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
33
-require_once __DIR__ . '/../include/vars.php';
33
+require_once __DIR__.'/../include/vars.php';
34 34
 //mod_loadFunctions('', $GLOBALS['moddirname']);
35 35
 
36 36
 /**
Please login to merge, or discard this patch.
class/xmlpc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
29
-require_once __DIR__ . '/../include/vars.php';
29
+require_once __DIR__.'/../include/vars.php';
30 30
 //mod_loadFunctions('', $GLOBALS['moddirname']);
31 31
 
32 32
 if (!class_exists('Xmlrpc_client')) {
Please login to merge, or discard this patch.
class/xml.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
29
-require_once __DIR__ . '/../include/vars.php';
29
+require_once __DIR__.'/../include/vars.php';
30 30
 //mod_loadFunctions('', $GLOBALS['moddirname']);
31 31
 
32 32
 /*** GENERAL USAGE *********************************************************
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
  */
65 65
 
66 66
 // your local timezone, set to "" to disable or for GMT
67
-$server_TZ = abs((int)($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0));
68
-$prefix    = ($GLOBALS['xoopsConfig']['server_TZ'] < 0) ? '-' : '+';
69
-$TIME_ZONE = $prefix . date('H:i', $server_TZ);
67
+$server_TZ = abs((int) ($GLOBALS['xoopsConfig']['server_TZ']*3600.0));
68
+$prefix    = ($GLOBALS['xoopsConfig']['server_TZ']<0) ? '-' : '+';
69
+$TIME_ZONE = $prefix.date('H:i', $server_TZ);
70 70
 define('TIME_ZONE', $TIME_ZONE);
71 71
 // Version string.
72 72
 define('FEEDCREATOR_VERSION', 'ARTICLE @ XOOPS powered by FeedCreator');
73 73
 
74
-require_once __DIR__ . '/feedcreator.class.php';
74
+require_once __DIR__.'/feedcreator.class.php';
75 75
 
76 76
 /**
77 77
  * Description
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
          */
96 96
         public function __construct($version)
97 97
         {
98
-            $this->filename = XOOPS_CACHE_PATH . '/feed.xml';
98
+            $this->filename = XOOPS_CACHE_PATH.'/feed.xml';
99 99
             $this->version  = $version;
100 100
         }
101 101
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 foreach (array_keys($val) as $key) {
123 123
                     $val[$key] = $this->convert_encoding($val[$key]);
124 124
                 }
125
-            } else {
125
+            }else {
126 126
                 $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET);
127 127
             }
128 128
 
Please login to merge, or discard this patch.
class/class-IXR.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             }
37 37
         }
38 38
         if ($type === 'array') {
39
-            for ($i = 0, $j = count($this->data); $i < $j; ++$i) {
39
+            for ($i = 0, $j = count($this->data); $i<$j; ++$i) {
40 40
                 $this->data[$i] = new IXR_Value($this->data[$i]);
41 41
             }
42 42
         }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         /* We have an array - is it an array or a struct ? */
76 76
         if ($this->isStruct($this->data)) {
77 77
             return 'struct';
78
-        } else {
78
+        }else {
79 79
             return 'array';
80 80
         }
81 81
     }
@@ -88,31 +88,31 @@  discard block
 block discarded – undo
88 88
         /* Return XML for this value */
89 89
         switch ($this->type) {
90 90
             case 'boolean':
91
-                return '<boolean>' . ($this->data ? '1' : '0') . '</boolean>';
91
+                return '<boolean>'.($this->data ? '1' : '0').'</boolean>';
92 92
                 break;
93 93
             case 'int':
94
-                return '<int>' . $this->data . '</int>';
94
+                return '<int>'.$this->data.'</int>';
95 95
                 break;
96 96
             case 'double':
97
-                return '<double>' . $this->data . '</double>';
97
+                return '<double>'.$this->data.'</double>';
98 98
                 break;
99 99
             case 'string':
100
-                return '<string>' . htmlspecialchars($this->data) . '</string>';
100
+                return '<string>'.htmlspecialchars($this->data).'</string>';
101 101
                 break;
102 102
             case 'array':
103
-                $return = '<array><data>' . "\n";
103
+                $return = '<array><data>'."\n";
104 104
                 foreach ($this->data as $item) {
105
-                    $return .= '  <value>' . $item->getXml() . "</value>\n";
105
+                    $return .= '  <value>'.$item->getXml()."</value>\n";
106 106
                 }
107 107
                 $return .= '</data></array>';
108 108
 
109 109
                 return $return;
110 110
                 break;
111 111
             case 'struct':
112
-                $return = '<struct>' . "\n";
112
+                $return = '<struct>'."\n";
113 113
                 foreach ($this->data as $name => $value) {
114 114
                     $return .= "  <member><name>$name</name><value>";
115
-                    $return .= $value->getXml() . "</value></member>\n";
115
+                    $return .= $value->getXml()."</value></member>\n";
116 116
                 }
117 117
                 $return .= '</struct>';
118 118
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         /* Nasty function to check if an array is a struct or not */
137 137
         $expected = 0;
138 138
         foreach ($array as $key => $value) {
139
-            if ((string)$key != (string)$expected) {
139
+            if ((string) $key != (string) $expected) {
140 140
                 return true;
141 141
             }
142 142
             ++$expected;
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 class IXR_Message
153 153
 {
154 154
     public $message;
155
-    public $messageType;  // methodCall / methodResponse / fault
155
+    public $messageType; // methodCall / methodResponse / fault
156 156
     public $faultCode;
157 157
     public $faultString;
158 158
     public $methodName;
159 159
     public $params;
160 160
     // Current variable stacks
161
-    public $_arraystructs      = [];   // The stack used to keep track of the current array/struct
161
+    public $_arraystructs      = []; // The stack used to keep track of the current array/struct
162 162
     public $_arraystructstypes = []; // Stack keeping track of if things are structs or array
163
-    public $_currentStructName = [];  // A stack as well
163
+    public $_currentStructName = []; // A stack as well
164 164
     public $_param;
165 165
     public $_value;
166 166
     public $_currentTag;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     public function parse()
184 184
     {
185 185
         // first remove the XML declaration
186
-        $this->message = preg_replace('/<\?xml(.*)?\?' . '>/', '', $this->message);
186
+        $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
187 187
         if (trim($this->message) == '') {
188 188
             return false;
189 189
         }
@@ -256,17 +256,17 @@  discard block
 block discarded – undo
256 256
         switch ($tag) {
257 257
             case 'int':
258 258
             case 'i4':
259
-                $value                     = (int)trim($this->_currentTagContents);
259
+                $value                     = (int) trim($this->_currentTagContents);
260 260
                 $this->_currentTagContents = '';
261 261
                 $valueFlag                 = true;
262 262
                 break;
263 263
             case 'double':
264
-                $value                     = (double)trim($this->_currentTagContents);
264
+                $value                     = (double) trim($this->_currentTagContents);
265 265
                 $this->_currentTagContents = '';
266 266
                 $valueFlag                 = true;
267 267
                 break;
268 268
             case 'string':
269
-                $value                     = (string)trim($this->_currentTagContents);
269
+                $value                     = (string) trim($this->_currentTagContents);
270 270
                 $this->_currentTagContents = '';
271 271
                 $valueFlag                 = true;
272 272
                 break;
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
             case 'value':
280 280
                 // "If no type is indicated, the type is string."
281 281
                 if (trim($this->_currentTagContents) != '') {
282
-                    $value                     = (string)$this->_currentTagContents;
282
+                    $value                     = (string) $this->_currentTagContents;
283 283
                     $this->_currentTagContents = '';
284 284
                     $valueFlag                 = true;
285 285
                 }
286 286
                 break;
287 287
             case 'boolean':
288
-                $value                     = (boolean)trim($this->_currentTagContents);
288
+                $value                     = (boolean) trim($this->_currentTagContents);
289 289
                 $this->_currentTagContents = '';
290 290
                 $valueFlag                 = true;
291 291
                 break;
@@ -319,16 +319,16 @@  discard block
 block discarded – undo
319 319
                 $value = trim($value);
320 320
             }
321 321
             */
322
-            if (count($this->_arraystructs) > 0) {
322
+            if (count($this->_arraystructs)>0) {
323 323
                 // Add value to struct or array
324
-                if ($this->_arraystructstypes[count($this->_arraystructstypes) - 1] === 'struct') {
324
+                if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] === 'struct') {
325 325
                     // Add to struct
326
-                    $this->_arraystructs[count($this->_arraystructs) - 1][$this->_currentStructName[count($this->_currentStructName) - 1]] = $value;
327
-                } else {
326
+                    $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value;
327
+                }else {
328 328
                     // Add to array
329
-                    $this->_arraystructs[count($this->_arraystructs) - 1][] = $value;
329
+                    $this->_arraystructs[count($this->_arraystructs)-1][] = $value;
330 330
                 }
331
-            } else {
331
+            }else {
332 332
                 // Just add as a paramater
333 333
                 $this->params[] = $value;
334 334
             }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
     public function call($methodname, $args)
414 414
     {
415 415
         if (!$this->hasMethod($methodname)) {
416
-            return new IXR_Error(-32601, 'server error. requested method ' . $methodname . ' does not exist.');
416
+            return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.');
417 417
         }
418 418
         $method = $this->callbacks[$methodname];
419 419
         // Perform the callback and send the response
@@ -426,18 +426,18 @@  discard block
 block discarded – undo
426 426
             // It's a class method - check it exists
427 427
             $method = substr($method, 5);
428 428
             if (!method_exists($this, $method)) {
429
-                return new IXR_Error(-32601, 'server error. requested class method "' . $method . '" does not exist.');
429
+                return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.');
430 430
             }
431 431
             // Call the method
432 432
             $result = $this->$method($args);
433
-        } else {
433
+        }else {
434 434
             // It's a function - does it exist?
435 435
             if (is_array($method)) {
436 436
                 if (!method_exists($method[0], $method[1])) {
437
-                    return new IXR_Error(-32601, 'server error. requested object method "' . $method[1] . '" does not exist.');
437
+                    return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.');
438 438
                 }
439 439
             } elseif (!function_exists($method)) {
440
-                return new IXR_Error(-32601, 'server error. requested function "' . $method . '" does not exist.');
440
+                return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.');
441 441
             }
442 442
             // Call the function
443 443
             $result = call_user_func($method, $args);
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
      */
465 465
     public function output($xml)
466 466
     {
467
-        $xml    = '<?xml version="1.0"?>' . "\n" . $xml;
467
+        $xml    = '<?xml version="1.0"?>'."\n".$xml;
468 468
         $length = strlen($xml);
469 469
         header('Connection: close');
470
-        header('Content-Length: ' . $length);
470
+        header('Content-Length: '.$length);
471 471
         header('Content-Type: text/xml');
472
-        header('Date: ' . date('r'));
472
+        header('Date: '.date('r'));
473 473
         echo $xml;
474 474
         exit;
475 475
     }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
             $params = $call['params'];
543 543
             if ($method === 'system.multicall') {
544 544
                 $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden');
545
-            } else {
545
+            }else {
546 546
                 $result = $this->call($method, $params);
547 547
             }
548 548
             if (is_a($result, 'IXR_Error')) {
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
                     'faultCode'   => $result->code,
551 551
                     'faultString' => $result->message
552 552
                 ];
553
-            } else {
553
+            }else {
554 554
                 $return[] = [$result];
555 555
             }
556 556
         }
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 EOD;
587 587
         foreach ($this->args as $arg) {
588 588
             $this->xml .= '<param><value>';
589
-            $v         = new IXR_Value($arg);
589
+            $v = new IXR_Value($arg);
590 590
             $this->xml .= $v->getXml();
591 591
             $this->xml .= "</value></param>\n";
592 592
         }
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
             if (!$this->path) {
648 648
                 $this->path = '/';
649 649
             }
650
-        } else {
650
+        }else {
651 651
             $this->server  = $server;
652 652
             $this->path    = $path;
653 653
             $this->port    = $port;
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
         $request .= $xml;
676 676
         // Now send the request
677 677
         if ($this->debug) {
678
-            echo '<pre>' . htmlspecialchars($request) . "\n</pre>\n\n";
678
+            echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n";
679 679
         }
680 680
         $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
681 681
         if (!$fp) {
@@ -702,11 +702,11 @@  discard block
 block discarded – undo
702 702
                 $gettingHeaders = false;
703 703
             }
704 704
             if (!$gettingHeaders) {
705
-                $contents .= trim($line) . "\n";
705
+                $contents .= trim($line)."\n";
706 706
             }
707 707
         }
708 708
         if ($this->debug) {
709
-            echo '<pre>' . htmlspecialchars($contents) . "\n</pre>\n\n";
709
+            echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n";
710 710
         }
711 711
         // Now parse what we've got back
712 712
         $this->message = new IXR_Message($contents);
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
         // $time can be a PHP timestamp or an ISO one
832 832
         if (is_numeric($time)) {
833 833
             $this->parseTimestamp($time);
834
-        } else {
834
+        }else {
835 835
             $this->parseIso($time);
836 836
         }
837 837
     }
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
      */
869 869
     public function getIso()
870 870
     {
871
-        return $this->year . $this->month . $this->day . 'T' . $this->hour . ':' . $this->minute . ':' . $this->second . $this->timezone;
871
+        return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
872 872
     }
873 873
 
874 874
     /**
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
      */
877 877
     public function getXml()
878 878
     {
879
-        return '<dateTime.iso8601>' . $this->getIso() . '</dateTime.iso8601>';
879
+        return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>';
880 880
     }
881 881
 
882 882
     /**
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
      */
910 910
     public function getXml()
911 911
     {
912
-        return '<base64>' . base64_encode($this->data) . '</base64>';
912
+        return '<base64>'.base64_encode($this->data).'</base64>';
913 913
     }
914 914
 }
915 915
 
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
         }
965 965
         // Over-rides default call method, adds signature check
966 966
         if (!$this->hasMethod($methodname)) {
967
-            return new IXR_Error(-32601, 'server error. requested method "' . $this->message->methodName . '" not specified.');
967
+            return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.');
968 968
         }
969 969
         $method     = $this->callbacks[$methodname];
970 970
         $signature  = $this->signatures[$methodname];
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
         // Check the argument types
978 978
         $ok         = true;
979 979
         $argsbackup = $args;
980
-        for ($i = 0, $j = count($args); $i < $j; ++$i) {
980
+        for ($i = 0, $j = count($args); $i<$j; ++$i) {
981 981
             $arg  = array_shift($args);
982 982
             $type = array_shift($signature);
983 983
             switch ($type) {
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
     public function methodSignature($method)
1028 1028
     {
1029 1029
         if (!$this->hasMethod($method)) {
1030
-            return new IXR_Error(-32601, 'server error. requested method "' . $method . '" not specified.');
1030
+            return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
1031 1031
         }
1032 1032
         // We should be returning an array of types
1033 1033
         $types  = $this->signatures[$method];
Please login to merge, or discard this patch.
class/rate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
29
-require_once __DIR__ . '/../include/vars.php';
29
+require_once __DIR__.'/../include/vars.php';
30 30
 //mod_loadFunctions('', $GLOBALS['moddirname']);
31 31
 
32 32
 if (!class_exists('Brate')):
Please login to merge, or discard this patch.
class/blog.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  */
31 31
 
32 32
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
33
-require_once __DIR__ . '/../include/vars.php';
33
+require_once __DIR__.'/../include/vars.php';
34 34
 //mod_loadFunctions('', $GLOBALS['moddirname']);
35 35
 
36 36
 /**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         {
134 134
             $ave = 3;
135 135
             if ($this->getVar('blog_rates')) {
136
-                $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals);
136
+                $ave = number_format($this->getVar('blog_rating')/$this->getVar('blog_rates'), $decimals);
137 137
             }
138 138
 
139 139
             return $ave;
Please login to merge, or discard this patch.
class/utility.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 if (!defined('planet_FUNCTIONS')):
39 39
     define('planet_FUNCTIONS', 1);
40 40
 
41
-    require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php';
42
-    require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
43
-    require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php';
41
+    require XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/vars.php';
42
+    require_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
43
+    require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.php';
44 44
 
45 45
     /**
46 46
      * Class PlanetUtility
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         */
76 76
         public static function planetParseArguments(&$args_numeric, &$args, &$args_string)
77 77
         {
78
-            $args_abb     = [
78
+            $args_abb = [
79 79
                 'a' => 'article',
80 80
                 'b' => 'blog',
81 81
                 'c' => 'category',
@@ -90,24 +90,24 @@  discard block
 block discarded – undo
90 90
             if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
91 91
                 $vars = preg_split("/[\/|&]/", $matches[1]);
92 92
                 $vars = array_map('trim', $vars);
93
-                if (count($vars) > 0) {
93
+                if (count($vars)>0) {
94 94
                     foreach ($vars as $var) {
95 95
                         if (is_numeric($var)) {
96 96
                             $args_numeric[] = $var;
97 97
                         } elseif (false === strpos($var, '=')) {
98 98
                             if (is_numeric(substr($var, 1))) {
99
-                                $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1);
100
-                            } else {
99
+                                $args[$args_abb[strtolower($var{0})]] = (int) substr($var, 1);
100
+                            }else {
101 101
                                 $args_string[] = urldecode($var);
102 102
                             }
103
-                        } else {
103
+                        }else {
104 104
                             parse_str($var, $args);
105 105
                         }
106 106
                     }
107 107
                 }
108 108
             }
109 109
 
110
-            return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true;
110
+            return (count($args)+count($args_numeric)+count($args_string) == 0) ? null : true;
111 111
         }
112 112
 
113 113
         /**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                 $pattern     = [$pattern];
131 131
                 $replacement = [$replacement];
132 132
             }
133
-            if (is_array($pattern) && count($pattern) > 0) {
133
+            if (is_array($pattern) && count($pattern)>0) {
134 134
                 $ii = 0;
135 135
                 foreach ($pattern as $pat) {
136 136
                     if (!in_array($pat, $patterns)) {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                 $pattern     = [$pattern];
167 167
                 $replacement = [$replacement];
168 168
             }
169
-            if (is_array($pattern) && count($pattern) > 0) {
169
+            if (is_array($pattern) && count($pattern)>0) {
170 170
                 $ii = 0;
171 171
                 foreach ($pattern as $pat) {
172 172
                     if (!in_array($pat, $patterns)) {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             if (!is_array($userid)) {
210 210
                 $userid = [$userid];
211 211
             }
212
-            $users =& mod_getUnameFromIds($userid, $usereal, $linked);
212
+            $users = & mod_getUnameFromIds($userid, $usereal, $linked);
213 213
 
214 214
             return $users;
215 215
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
             $myts       = MyTextSanitizer::getInstance();
227 227
             $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text);
228 228
             $links      = [];
229
-            if (count($link_array) > 0) {
229
+            if (count($link_array)>0) {
230 230
                 foreach ($link_array as $link) {
231 231
                     @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2));
232 232
                     if (empty($url)) {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
          */
247 247
         public static function planetGetTemplate($pagename)
248 248
         {
249
-            return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl';
249
+            return $GLOBALS['VAR_PREFIX'].'_'.$pagename.'.tpl';
250 250
         }
251 251
 
252 252
         /**
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             }
276 276
 
277 277
             @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern));
278
-            $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link'));
278
+            $trackback_url = preg_replace('#'.$pat.'#', $rep, $article_obj->getVar('art_link'));
279 279
 
280 280
             return static::planetTrackback($trackback_url, $article);
281 281
         }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
             $title         = $article->getVar('art_title');
293 293
             $excerpt       = $article->getVar('art_content');
294
-            $blog_name     = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name');
294
+            $blog_name     = $xoopsConfig['sitename'].'-'.$xoopsModule->getVar('name');
295 295
             $title         = xoops_utf8_encode($title);
296 296
             $excerpt       = xoops_utf8_encode($excerpt);
297 297
             $blog_name     = xoops_utf8_encode($blog_name);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
             $title1        = urlencode($title);
300 300
             $excerpt1      = urlencode($excerpt);
301 301
             $name1         = urlencode($blog_name);
302
-            $url           = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id'));
302
+            $url           = urlencode(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article->getVar('art_id'));
303 303
             $query_string  = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset";
304 304
             $trackback_url = parse_url($trackback_url);
305 305
 
306
-            $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
307
-            $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
308
-            $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n";
309
-            $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
310
-            $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION;
306
+            $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?'.$trackback_url['query'] : '')." HTTP/1.0\r\n";
307
+            $http_request .= 'Host: '.$trackback_url['host']."\r\n";
308
+            $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n";
309
+            $http_request .= 'Content-Length: '.strlen($query_string)."\r\n";
310
+            $http_request .= 'User-Agent: XOOPS Blogs/'.XOOPS_VERSION;
311 311
             $http_request .= "\r\n\r\n";
312 312
             $http_request .= $query_string;
313 313
             if ('' == $trackback_url['port']) {
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
             $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
317 317
             @fwrite($fs, $http_request);
318 318
             if ($xoopsModuleConfig['do_debug']) {
319
-                $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log';
319
+                $debug_file = XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'_trackback.log';
320 320
                 $fr         = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n";
321 321
                 $fr         .= "CHARSET:$charset\n";
322 322
                 $fr         .= "NAME:$blog_name\n";
323
-                $fr         .= 'TITLE:' . $title . "\n";
323
+                $fr         .= 'TITLE:'.$title."\n";
324 324
                 $fr         .= "EXCERPT:$excerpt\n\n";
325 325
                 while (!@feof($fs)) {
326 326
                     $fr .= @fgets($fs, 4096);
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
                 if ($fp = fopen($debug_file, 'a')) {
331 331
                     fwrite($fp, $fr);
332 332
                     fclose($fp);
333
-                } else {
333
+                }else {
334 334
                 }
335 335
             }
336 336
             @fclose($fs);
@@ -350,19 +350,19 @@  discard block
 block discarded – undo
350 350
                     PlanetUtility::planetGetPing($serv, $id);
351 351
                 }
352 352
             }
353
-            require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php';
353
+            require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class-IXR.php';
354 354
 
355 355
             // using a timeout of 3 seconds should be enough to cover slow servers
356 356
             $client            = new IXR_Client($server, false);
357 357
             $client->timeout   = 3;
358
-            $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION;
358
+            $client->useragent .= ' -- XOOPS Article/'.XOOPS_VERSION;
359 359
 
360 360
             // when set to true, this outputs debug messages by itself
361 361
             $client->debug = false;
362 362
 
363 363
             $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name'));
364
-            $home     = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/';
365
-            $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id;
364
+            $home     = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/';
365
+            $rss2_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php'.URL_DELIMITER.'rss2.0/'.$id;
366 366
 
367 367
             if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping
368 368
                 $client->query('weblogUpdates.ping', $blogname, $home);
@@ -378,16 +378,16 @@  discard block
 block discarded – undo
378 378
         {
379 379
             $charset       = 'utf-8';
380 380
             $error_message = xoops_utf8_encode($error_message);
381
-            header('Content-Type: text/xml; charset="' . $charset . '"');
381
+            header('Content-Type: text/xml; charset="'.$charset.'"');
382 382
             if ($error) {
383
-                echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
383
+                echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n";
384 384
                 echo "<response>\n";
385 385
                 echo "<error>1</error>\n";
386 386
                 echo "<message>$error_message</message>\n";
387 387
                 echo '</response>';
388 388
                 die();
389
-            } else {
390
-                echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n";
389
+            }else {
390
+                echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n";
391 391
                 echo "<response>\n";
392 392
                 echo "<error>0</error>\n";
393 393
                 echo '</response>';
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
             if (is_array($string)) {
408 408
                 $value = [];
409 409
                 foreach ($string as $key => $val) {
410
-                    $value[] = $key . '|' . $val;
410
+                    $value[] = $key.'|'.$val;
411 411
                 }
412 412
                 $string = implode(',', $value);
413 413
             }
414
-            setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/');
414
+            setcookie($GLOBALS['VAR_PREFIX'].$name, $string, (int) $expire, '/');
415 415
         }
416 416
 
417 417
         /**
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
          */
422 422
         public static function planetGetCookie($name, $isArray = false)
423 423
         {
424
-            $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null;
424
+            $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'].$name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'].$name] : null;
425 425
             if ($isArray) {
426 426
                 $_value = $value ? explode(',', $value) : [];
427 427
                 $value  = [];
428
-                if (count($_value) > 0) {
428
+                if (count($_value)>0) {
429 429
                     foreach ($_value as $string) {
430 430
                         $key         = substr($string, 0, strpos($string, '|'));
431
-                        $val         = substr($string, strpos($string, '|') + 1);
431
+                        $val         = substr($string, strpos($string, '|')+1);
432 432
                         $value[$key] = $val;
433 433
                     }
434 434
                 }
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
          */
488 488
         public static function planetFetchSnoopy($url)
489 489
         {
490
-            require_once XOOPS_ROOT_PATH . '/class/snoopy.php';
490
+            require_once XOOPS_ROOT_PATH.'/class/snoopy.php';
491 491
             $snoopy = new Snoopy;
492 492
             $data   = '';
493 493
             if (@$snoopy->fetch($url)) {
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
             if (!function_exists('curl_init')) {
507 507
                 return false;
508 508
             }
509
-            $ch = curl_init();    // initialize curl handle
509
+            $ch = curl_init(); // initialize curl handle
510 510
             curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
511 511
             curl_setopt($ch, CURLOPT_FAILONERROR, 1);
512
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
512
+            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
513 513
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
514 514
             curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s
515 515
             $data = curl_exec($ch); // run the whole process
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             if ($index === false) {
552 552
                 return false;
553 553
             }
554
-            $index = strlen($haystack) - strlen($needle) - $index;
554
+            $index = strlen($haystack)-strlen($needle)-$index;
555 555
 
556 556
             return $index;
557 557
         }
Please login to merge, or discard this patch.