@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $moduleDirName = basename(dirname(__DIR__)); |
29 | 29 | |
30 | 30 | if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
31 | -} else { |
|
31 | +}else { |
|
32 | 32 | $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
33 | 33 | } |
34 | 34 | |
@@ -40,31 +40,31 @@ discard block |
||
40 | 40 | $adminmenu[] = [ |
41 | 41 | 'title' => _AM_MODULEADMIN_HOME, |
42 | 42 | 'link' => 'admin/index.php', |
43 | - 'icon' => $pathIcon32 . '/home.png', |
|
43 | + 'icon' => $pathIcon32.'/home.png', |
|
44 | 44 | ]; |
45 | 45 | |
46 | 46 | $adminmenu[] = [ |
47 | 47 | 'title' => planet_constant('MI_ADMENU_INDEX'), |
48 | 48 | 'link' => 'admin/main.php', |
49 | - 'icon' => $pathIcon32 . '/manage.png', |
|
49 | + 'icon' => $pathIcon32.'/manage.png', |
|
50 | 50 | ]; |
51 | 51 | |
52 | 52 | $adminmenu[] = [ |
53 | 53 | 'title' => planet_constant('MI_ADMENU_CATEGORY'), |
54 | 54 | 'link' => 'admin/admin.category.php', |
55 | - 'icon' => $pathIcon32 . '/category.png', |
|
55 | + 'icon' => $pathIcon32.'/category.png', |
|
56 | 56 | ]; |
57 | 57 | |
58 | 58 | $adminmenu[] = [ |
59 | 59 | 'title' => planet_constant('MI_ADMENU_BLOG'), |
60 | 60 | 'link' => 'admin/admin.blog.php', |
61 | - 'icon' => $pathIcon32 . '/translations.png', |
|
61 | + 'icon' => $pathIcon32.'/translations.png', |
|
62 | 62 | ]; |
63 | 63 | |
64 | 64 | $adminmenu[] = [ |
65 | 65 | 'title' => planet_constant('MI_ADMENU_ARTICLE'), |
66 | 66 | 'link' => 'admin/admin.article.php', |
67 | - 'icon' => $pathIcon32 . '/content.png', |
|
67 | + 'icon' => $pathIcon32.'/content.png', |
|
68 | 68 | ]; |
69 | 69 | |
70 | 70 | //$adminmenu[] = [ |
@@ -76,5 +76,5 @@ discard block |
||
76 | 76 | $adminmenu[] = [ |
77 | 77 | 'title' => _AM_MODULEADMIN_ABOUT, |
78 | 78 | 'link' => 'admin/about.php', |
79 | - 'icon' => $pathIcon32 . '/about.png', |
|
79 | + 'icon' => $pathIcon32.'/about.png', |
|
80 | 80 | ]; |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -require_once __DIR__ . '/admin_header.php'; |
|
30 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
29 | +require_once __DIR__.'/admin_header.php'; |
|
30 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
31 | 31 | |
32 | 32 | xoops_cp_header(); |
33 | 33 | $adminObject = \Xmf\Module\Admin::getInstance(); |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | * This is a tricky fix for incomplete solution of module cone |
40 | 40 | * it is expected to have a better solution in article 1.0 |
41 | 41 | */ |
42 | -require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
42 | +require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
43 | 43 | //planet_adminmenu(2); |
44 | 44 | |
45 | -$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
46 | -$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
47 | -$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
|
48 | -$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET');//(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0)); |
|
49 | -$start = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET');//(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0)); |
|
45 | +$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
46 | +$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
47 | +$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id; |
|
48 | +$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET'); //(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0)); |
|
49 | +$start = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET'); //(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0)); |
|
50 | 50 | |
51 | 51 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
52 | 52 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | if ($blog_id) { |
63 | 63 | $blog_obj = $blogHandler->get($blog_id); |
64 | - } else { |
|
64 | + }else { |
|
65 | 65 | if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) { |
66 | 66 | redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS')); |
67 | 67 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | unset($blog_obj); |
127 | 127 | } |
128 | 128 | $message = planet_constant('AM_DBUPDATED'); |
129 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
129 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
130 | 130 | |
131 | 131 | /* add a list of blogs to a category */ |
132 | 132 | // no break |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id); |
140 | 140 | } |
141 | 141 | $message = planet_constant('AM_DBUPDATED'); |
142 | - redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&start=' . $start, 2, $message); |
|
142 | + redirect_header('admin.blog.php?category='.Request::getArray('category_dest', [], 'POST').'&start='.$start, 2, $message); |
|
143 | 143 | |
144 | 144 | /* remove a list of blogs from a category */ |
145 | 145 | // no break |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $categoryHandler->removeBlogs($category_id, $blog_id); |
153 | 153 | } |
154 | 154 | $message = planet_constant('AM_DBUPDATED'); |
155 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
155 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
156 | 156 | |
157 | 157 | /* delete a single blog or a list blogs */ |
158 | 158 | // no break |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | unset($blog_obj); |
168 | 168 | } |
169 | 169 | $message = planet_constant('AM_DBUPDATED'); |
170 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
170 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
171 | 171 | |
172 | 172 | /* empty a single blog or a list blogs */ |
173 | 173 | // no break |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | $message = planet_constant('AM_DBUPDATED'); |
184 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
184 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
185 | 185 | |
186 | 186 | /* approve a single blog or a list blogs */ |
187 | 187 | // no break |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | if (!is_array($blog_id)) { |
190 | 190 | $blog_id = [$blog_id]; |
191 | 191 | } |
192 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
192 | + $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN'); |
|
193 | 193 | $blogHandler->updateAll('blog_status', 1, $criteria, true); |
194 | 194 | $message = planet_constant('AM_DBUPDATED'); |
195 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
195 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
196 | 196 | |
197 | 197 | /* mark a single blog or a list blogs as featured */ |
198 | 198 | // no break |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | if (!is_array($blog_id)) { |
201 | 201 | $blog_id = [$blog_id]; |
202 | 202 | } |
203 | - $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN'); |
|
203 | + $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN'); |
|
204 | 204 | $blogHandler->updateAll('blog_status', 2, $criteria, true); |
205 | 205 | $message = planet_constant('AM_DBUPDATED'); |
206 | - redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message); |
|
206 | + redirect_header('admin.blog.php?category='.$category_id.'&start='.$start, 2, $message); |
|
207 | 207 | |
208 | 208 | /* edit a single blog */ |
209 | 209 | // no break |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | if (!empty(Request::getString('fetch', '', 'POST'))) { |
212 | 212 | $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST')); |
213 | 213 | $blog_obj->setVar('blog_id', $blog_id); |
214 | - } else { |
|
214 | + }else { |
|
215 | 215 | $blog_obj = $blogHandler->get($blog_id); |
216 | 216 | } |
217 | 217 | $categories = Request::getArray('categories', [], 'POST'); |
218 | - if (empty($categories) && $blog_id > 0) { |
|
218 | + if (empty($categories) && $blog_id>0) { |
|
219 | 219 | $crit = new Criteria('bc.blog_id', $blog_id); |
220 | 220 | $categories = array_keys($categoryHandler->getByBlog($crit)); |
221 | 221 | } |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | $categories = [0 => _NONE]; |
224 | 224 | } |
225 | 225 | |
226 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
226 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>'; |
|
227 | 227 | echo '<br>'; |
228 | 228 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
229 | 229 | $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
230 | 230 | $blogs_obj = $blogHandler->getList($criteria); |
231 | - if (count($blogs_obj) > 0) { |
|
232 | - echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS'); |
|
231 | + if (count($blogs_obj)>0) { |
|
232 | + echo "<div class=\"errorMsg\">".planet_constant('AM_BLOGEXISTS'); |
|
233 | 233 | foreach (array_keys($blogs_obj) as $bid) { |
234 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
234 | + echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>'; |
|
235 | 235 | } |
236 | 236 | echo '</div>'; |
237 | 237 | } |
238 | 238 | unset($blogs_obj, $criteria); |
239 | 239 | } |
240 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
240 | + include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php'; |
|
241 | 241 | echo '</fieldset>'; |
242 | 242 | break; |
243 | 243 | |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | $opform->addElement($op_select); |
266 | 266 | $opform->display(); |
267 | 267 | |
268 | - if ($category_id > 0) { |
|
268 | + if ($category_id>0) { |
|
269 | 269 | $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>')); |
270 | 270 | $criteria->add(new Criteria('bc.cat_id', $category_id)); |
271 | 271 | $blog_count = $blogHandler->getCountByCategory($criteria); |
272 | 272 | $criteria->setStart($start); |
273 | 273 | $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
274 | 274 | $blog_objs = $blogHandler->getByCategory($criteria); |
275 | - } else { |
|
275 | + }else { |
|
276 | 276 | /* All active blogs */ |
277 | 277 | if (0 == $category_id) { |
278 | 278 | $criteria = new Criteria('1', 1); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $criteria->setStart($start); |
290 | 290 | $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
291 | 291 | /* Pending blogs */ |
292 | - } else { |
|
292 | + }else { |
|
293 | 293 | $criteria = new Criteria('blog_status', 0); |
294 | 294 | $criteria->setStart($start); |
295 | 295 | $criteria->setLimit($xoopsModuleConfig['list_perpage']); |
@@ -298,19 +298,19 @@ discard block |
||
298 | 298 | $blog_objs = $blogHandler->getAll($criteria); |
299 | 299 | } |
300 | 300 | |
301 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>'; |
|
301 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_LIST').'</legend>'; |
|
302 | 302 | echo "<br style=\"clear:both\">"; |
303 | 303 | |
304 | - echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
304 | + echo "<form name='list' id='list' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
305 | 305 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
306 | 306 | echo "<tr align='center'>"; |
307 | 307 | echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox' onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>"; |
308 | - echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>'; |
|
309 | - echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>'; |
|
310 | - echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>'; |
|
308 | + echo "<th class='bg3'>".planet_constant('AM_TITLE').'</td>'; |
|
309 | + echo "<th class='bg3' width='5%'>".planet_constant('AM_STATUS').'</td>'; |
|
310 | + echo "<th class='bg3' width='40%'>".planet_constant('AM_FEED').'</td>'; |
|
311 | 311 | // echo "<th class='bg3' width='5%'>" . _EDIT . "</td>"; |
312 | 312 | // echo "<th class='bg3' width='5%'>" . _DELETE . "</td>"; |
313 | - echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>'; |
|
313 | + echo "<th class='bg3' width='10%'>".planet_constant('AM_ACTIONS').'</td>'; |
|
314 | 314 | echo '</tr>'; |
315 | 315 | |
316 | 316 | $status = [ |
@@ -320,53 +320,53 @@ discard block |
||
320 | 320 | ]; |
321 | 321 | foreach (array_keys($blog_objs) as $bid) { |
322 | 322 | echo "<tr class='odd' align='left'>"; |
323 | - echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>"; |
|
324 | - echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>'; |
|
325 | - echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>'; |
|
326 | - echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>'; |
|
327 | - echo "<td align='center'><a href='admin.blog.php?op=edit&blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a> |
|
328 | - <a href='admin.blog.php?op=del&blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a> |
|
329 | - <a href='admin.blog.php?op=empty&blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>'; |
|
323 | + echo "<td align='center'><input name='blog[]' value='".$bid."' type='checkbox'></td>"; |
|
324 | + echo "<td><a href='".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."'>".$blog_objs[$bid]->getVar('blog_title').'</a></td>'; |
|
325 | + echo "<td align='center'>".$status[$blog_objs[$bid]->getVar('blog_status')].'</td>'; |
|
326 | + echo '<td>'.$blog_objs[$bid]->getVar('blog_feed').'</td>'; |
|
327 | + echo "<td align='center'><a href='admin.blog.php?op=edit&blog=".$bid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT." title='"._EDIT." </a> |
|
328 | + <a href='admin.blog.php?op=del&blog=" . $bid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT." title='"._DELETE." </a> |
|
329 | + <a href='admin.blog.php?op=empty&blog=" . $bid."' title='".planet_constant('MD_EMPTY_BLOG')."'><img src='".$pathIcon16."/empty.png '"." alt='"._EDIT." title='".planet_constant('MD_EMPTY_BLOG').'</a></td>'; |
|
330 | 330 | |
331 | 331 | echo '</tr>'; |
332 | 332 | } |
333 | 333 | echo "<tr class='even' align='center'>"; |
334 | 334 | echo "<td colspan='7'>"; |
335 | 335 | echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>"; |
336 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
337 | - echo "<option value='del'>" . _DELETE . '</option>'; |
|
338 | - echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>'; |
|
339 | - echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>'; |
|
340 | - if ($category_id > 0) { |
|
341 | - echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>'; |
|
336 | + echo "<option value=''>"._SELECT.'</option>'; |
|
337 | + echo "<option value='del'>"._DELETE.'</option>'; |
|
338 | + echo "<option value='empty'>".planet_constant('MD_EMPTY_BLOG').'</option>'; |
|
339 | + echo "<option value='register'>".planet_constant('AM_REGISTER').'</option>'; |
|
340 | + if ($category_id>0) { |
|
341 | + echo "<option value='remove'>".planet_constant('AM_REMOVE').'</option>'; |
|
342 | 342 | } |
343 | - echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>'; |
|
344 | - echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>'; |
|
345 | - echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>'; |
|
343 | + echo "<option value='approve'>".planet_constant('AM_APPROVE').'</option>'; |
|
344 | + echo "<option value='feature'>".planet_constant('AM_FEATURE').'</option>'; |
|
345 | + echo "<option value='update'>".planet_constant('AM_UPDATE').'</option>'; |
|
346 | 346 | |
347 | - echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>'; |
|
348 | - echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>'; |
|
347 | + echo "<option value='pending'>".planet_constant('AM_PENDING').'</option>'; |
|
348 | + echo "<option value='active'>".planet_constant('AM_ACTIVE').'</option>'; |
|
349 | 349 | |
350 | 350 | echo '</select>'; |
351 | 351 | echo "<div id='catdiv' style='visibility:hidden;display:inline;'>"; |
352 | 352 | echo "<select name='category_dest'>"; |
353 | - echo "<option value=''>" . _SELECT . '</option>'; |
|
353 | + echo "<option value=''>"._SELECT.'</option>'; |
|
354 | 354 | foreach ($categories as $cid => $name) { |
355 | - echo "<option value='" . $cid . "'>" . $name . '</option>'; |
|
355 | + echo "<option value='".$cid."'>".$name.'</option>'; |
|
356 | 356 | } |
357 | 357 | echo '</select>'; |
358 | 358 | echo '</div>'; |
359 | - echo "<input name='start' value='" . $start . "' type='hidden'>"; |
|
360 | - echo "<input name='category' value='" . $category_id . "' type='hidden'>"; |
|
361 | - echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>"; |
|
362 | - echo "<input name='' value='" . _CANCEL . "' type='reset'>"; |
|
359 | + echo "<input name='start' value='".$start."' type='hidden'>"; |
|
360 | + echo "<input name='category' value='".$category_id."' type='hidden'>"; |
|
361 | + echo "<input name='submit' value='"._SUBMIT."' type='submit'>"; |
|
362 | + echo "<input name='' value='"._CANCEL."' type='reset'>"; |
|
363 | 363 | echo '</td>'; |
364 | 364 | echo '</tr>'; |
365 | - if ($blog_count > $xoopsModuleConfig['list_perpage']) { |
|
366 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
367 | - $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id); |
|
365 | + if ($blog_count>$xoopsModuleConfig['list_perpage']) { |
|
366 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
367 | + $nav = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category='.$category_id); |
|
368 | 368 | $pagenav = $nav->renderNav(4); |
369 | - echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>'; |
|
369 | + echo "<tr align='right'><td colspan='6'>".$pagenav.'</td></tr>'; |
|
370 | 370 | } |
371 | 371 | echo '</table></form>'; |
372 | 372 | echo "</fieldset><br style='clear:both;'>"; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $button_tray->addElement($butt_cancel); |
393 | 393 | $form_add->addElement($button_tray); |
394 | 394 | |
395 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>'; |
|
395 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD.'</legend>'; |
|
396 | 396 | echo '<br>'; |
397 | 397 | $form->display(); |
398 | 398 | $form_add->display(); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
29 | 29 | |
30 | -include __DIR__ . '/vars.php'; |
|
30 | +include __DIR__.'/vars.php'; |
|
31 | 31 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
32 | 32 | |
33 | 33 | PlanetUtility::planetParseFunction(' |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
29 | 29 | |
30 | -include __DIR__ . '/vars.php'; |
|
30 | +include __DIR__.'/vars.php'; |
|
31 | 31 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
32 | 32 | |
33 | 33 | PlanetUtility::planetParseFunction(' |
@@ -38,9 +38,9 @@ discard block |
||
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 | * Function to display messages |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function planetParseArguments(&$args_numeric, &$args, &$args_string) |
71 | 71 | { |
72 | - $args_abb = [ |
|
72 | + $args_abb = [ |
|
73 | 73 | 'a' => 'article', |
74 | 74 | 'b' => 'blog', |
75 | 75 | 'c' => 'category', |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
85 | 85 | $vars = preg_split("/[\/|&]/", $matches[1]); |
86 | 86 | $vars = array_map('trim', $vars); |
87 | - if (count($vars) > 0) { |
|
87 | + if (count($vars)>0) { |
|
88 | 88 | foreach ($vars as $var) { |
89 | 89 | if (is_numeric($var)) { |
90 | 90 | $args_numeric[] = $var; |
91 | 91 | } elseif (false === strpos($var, '=')) { |
92 | 92 | if (is_numeric(substr($var, 1))) { |
93 | - $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1); |
|
94 | - } else { |
|
93 | + $args[$args_abb[strtolower($var{0})]] = (int) substr($var, 1); |
|
94 | + }else { |
|
95 | 95 | $args_string[] = urldecode($var); |
96 | 96 | } |
97 | - } else { |
|
97 | + }else { |
|
98 | 98 | parse_str($var, $args); |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - return (0 == count($args) + count($args_numeric) + count($args_string)) ? null : true; |
|
104 | + return (0 == count($args)+count($args_numeric)+count($args_string)) ? null : true; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $pattern = [$pattern]; |
125 | 125 | $replacement = [$replacement]; |
126 | 126 | } |
127 | - if (is_array($pattern) && count($pattern) > 0) { |
|
127 | + if (is_array($pattern) && count($pattern)>0) { |
|
128 | 128 | $ii = 0; |
129 | 129 | foreach ($pattern as $pat) { |
130 | 130 | if (!in_array($pat, $patterns)) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $pattern = [$pattern]; |
161 | 161 | $replacement = [$replacement]; |
162 | 162 | } |
163 | - if (is_array($pattern) && count($pattern) > 0) { |
|
163 | + if (is_array($pattern) && count($pattern)>0) { |
|
164 | 164 | $ii = 0; |
165 | 165 | foreach ($pattern as $pat) { |
166 | 166 | if (!in_array($pat, $patterns)) { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if (!is_array($userid)) { |
204 | 204 | $userid = [$userid]; |
205 | 205 | } |
206 | - $users =& mod_getUnameFromIds($userid, $usereal, $linked); |
|
206 | + $users = & mod_getUnameFromIds($userid, $usereal, $linked); |
|
207 | 207 | |
208 | 208 | return $users; |
209 | 209 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $myts = MyTextSanitizer::getInstance(); |
221 | 221 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
222 | 222 | $links = []; |
223 | - if (count($link_array) > 0) { |
|
223 | + if (count($link_array)>0) { |
|
224 | 224 | foreach ($link_array as $link) { |
225 | 225 | @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
226 | 226 | if (empty($url)) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function planetGetTemplate($pagename) |
242 | 242 | { |
243 | - return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl'; |
|
243 | + return $GLOBALS['VAR_PREFIX'].'_'.$pagename.'.tpl'; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern)); |
271 | - $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link')); |
|
271 | + $trackback_url = preg_replace('#'.$pat.'#', $rep, $article_obj->getVar('art_link')); |
|
272 | 272 | |
273 | 273 | return planetTrackback($trackback_url, $article); |
274 | 274 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $title = $article->getVar('art_title'); |
286 | 286 | $excerpt = $article->getVar('art_content'); |
287 | - $blog_name = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name'); |
|
287 | + $blog_name = $xoopsConfig['sitename'].'-'.$xoopsModule->getVar('name'); |
|
288 | 288 | $title = xoops_utf8_encode($title); |
289 | 289 | $excerpt = xoops_utf8_encode($excerpt); |
290 | 290 | $blog_name = xoops_utf8_encode($blog_name); |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | $title1 = urlencode($title); |
293 | 293 | $excerpt1 = urlencode($excerpt); |
294 | 294 | $name1 = urlencode($blog_name); |
295 | - $url = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id')); |
|
295 | + $url = urlencode(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article->getVar('art_id')); |
|
296 | 296 | $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
297 | 297 | $trackback_url = parse_url($trackback_url); |
298 | 298 | |
299 | - $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n"; |
|
300 | - $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n"; |
|
301 | - $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n"; |
|
302 | - $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; |
|
303 | - $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION; |
|
299 | + $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?'.$trackback_url['query'] : '')." HTTP/1.0\r\n"; |
|
300 | + $http_request .= 'Host: '.$trackback_url['host']."\r\n"; |
|
301 | + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n"; |
|
302 | + $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; |
|
303 | + $http_request .= 'User-Agent: XOOPS Blogs/'.XOOPS_VERSION; |
|
304 | 304 | $http_request .= "\r\n\r\n"; |
305 | 305 | $http_request .= $query_string; |
306 | 306 | if ('' == $trackback_url['port']) { |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
310 | 310 | @fwrite($fs, $http_request); |
311 | 311 | if ($xoopsModuleConfig['do_debug']) { |
312 | - $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log'; |
|
312 | + $debug_file = XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'_trackback.log'; |
|
313 | 313 | $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
314 | 314 | $fr .= "CHARSET:$charset\n"; |
315 | 315 | $fr .= "NAME:$blog_name\n"; |
316 | - $fr .= 'TITLE:' . $title . "\n"; |
|
316 | + $fr .= 'TITLE:'.$title."\n"; |
|
317 | 317 | $fr .= "EXCERPT:$excerpt\n\n"; |
318 | 318 | while (!@feof($fs)) { |
319 | 319 | $fr .= @fgets($fs, 4096); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if ($fp = fopen($debug_file, 'a')) { |
324 | 324 | fwrite($fp, $fr); |
325 | 325 | fclose($fp); |
326 | - } else { |
|
326 | + }else { |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | @fclose($fs); |
@@ -343,19 +343,19 @@ discard block |
||
343 | 343 | planetGetPing($serv, $id); |
344 | 344 | } |
345 | 345 | } |
346 | - require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php'; |
|
346 | + require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class-IXR.php'; |
|
347 | 347 | |
348 | 348 | // using a timeout of 3 seconds should be enough to cover slow servers |
349 | 349 | $client = new IXR_Client($server, false); |
350 | 350 | $client->timeout = 3; |
351 | - $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION; |
|
351 | + $client->useragent .= ' -- XOOPS Article/'.XOOPS_VERSION; |
|
352 | 352 | |
353 | 353 | // when set to true, this outputs debug messages by itself |
354 | 354 | $client->debug = false; |
355 | 355 | |
356 | 356 | $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name')); |
357 | - $home = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/'; |
|
358 | - $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id; |
|
357 | + $home = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'; |
|
358 | + $rss2_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php'.URL_DELIMITER.'rss2.0/'.$id; |
|
359 | 359 | |
360 | 360 | if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping |
361 | 361 | $client->query('weblogUpdates.ping', $blogname, $home); |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | { |
372 | 372 | $charset = 'utf-8'; |
373 | 373 | $error_message = xoops_utf8_encode($error_message); |
374 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
374 | + header('Content-Type: text/xml; charset="'.$charset.'"'); |
|
375 | 375 | if ($error) { |
376 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
376 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
377 | 377 | echo "<response>\n"; |
378 | 378 | echo "<error>1</error>\n"; |
379 | 379 | echo "<message>$error_message</message>\n"; |
380 | 380 | echo '</response>'; |
381 | 381 | die(); |
382 | - } else { |
|
383 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
382 | + }else { |
|
383 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
384 | 384 | echo "<response>\n"; |
385 | 385 | echo "<error>0</error>\n"; |
386 | 386 | echo '</response>'; |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | if (is_array($string)) { |
401 | 401 | $value = []; |
402 | 402 | foreach ($string as $key => $val) { |
403 | - $value[] = $key . '|' . $val; |
|
403 | + $value[] = $key.'|'.$val; |
|
404 | 404 | } |
405 | 405 | $string = implode(',', $value); |
406 | 406 | } |
407 | - setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/'); |
|
407 | + setcookie($GLOBALS['VAR_PREFIX'].$name, $string, (int) $expire, '/'); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /** |
@@ -414,14 +414,14 @@ discard block |
||
414 | 414 | */ |
415 | 415 | function planetGetCookie($name, $isArray = false) |
416 | 416 | { |
417 | - $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null; |
|
417 | + $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'].$name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'].$name] : null; |
|
418 | 418 | if ($isArray) { |
419 | 419 | $_value = $value ? explode(',', $value) : []; |
420 | 420 | $value = []; |
421 | - if (count($_value) > 0) { |
|
421 | + if (count($_value)>0) { |
|
422 | 422 | foreach ($_value as $string) { |
423 | 423 | $key = substr($string, 0, strpos($string, '|')); |
424 | - $val = substr($string, strpos($string, '|') + 1); |
|
424 | + $val = substr($string, strpos($string, '|')+1); |
|
425 | 425 | $value[$key] = $val; |
426 | 426 | } |
427 | 427 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | function planet_fetch_snoopy($url) |
481 | 481 | { |
482 | - require_once XOOPS_ROOT_PATH . '/class/snoopy.php'; |
|
482 | + require_once XOOPS_ROOT_PATH.'/class/snoopy.php'; |
|
483 | 483 | $snoopy = new Snoopy; |
484 | 484 | $data = ''; |
485 | 485 | if (@$snoopy->fetch($url)) { |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | if (!function_exists('curl_init')) { |
499 | 499 | return false; |
500 | 500 | } |
501 | - $ch = curl_init(); // initialize curl handle |
|
501 | + $ch = curl_init(); // initialize curl handle |
|
502 | 502 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
503 | 503 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
504 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
504 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects |
|
505 | 505 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
506 | 506 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
507 | 507 | $data = curl_exec($ch); // run the whole process |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | if (false === $index) { |
544 | 544 | return false; |
545 | 545 | } |
546 | - $index = strlen($haystack) - strlen($needle) - $index; |
|
546 | + $index = strlen($haystack)-strlen($needle)-$index; |
|
547 | 547 | |
548 | 548 | return $index; |
549 | 549 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
29 | 29 | |
30 | -include __DIR__ . '/vars.php'; |
|
30 | +include __DIR__.'/vars.php'; |
|
31 | 31 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
32 | 32 | |
33 | 33 | PlanetUtility::planetParseFunction(' |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | if ('array' === $type) { |
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 ('struct' === $this->_arraystructstypes[count($this->_arraystructstypes) - 1]) { |
|
324 | + if ('struct' === $this->_arraystructstypes[count($this->_arraystructstypes)-1]) { |
|
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 |
||
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 |
||
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 |
||
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 |
||
542 | 542 | $params = $call['params']; |
543 | 543 | if ('system.multicall' === $method) { |
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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]; |
@@ -30,7 +30,7 @@ |
||
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 | /** |
@@ -35,16 +35,16 @@ discard block |
||
35 | 35 | { |
36 | 36 | public $parser; |
37 | 37 | |
38 | - public $current_item = []; // item currently being parsed |
|
39 | - public $items = []; // collection of parsed items |
|
40 | - public $channel = []; // hash of channel fields |
|
38 | + public $current_item = []; // item currently being parsed |
|
39 | + public $items = []; // collection of parsed items |
|
40 | + public $channel = []; // hash of channel fields |
|
41 | 41 | public $textinput = []; |
42 | 42 | public $image = []; |
43 | 43 | public $feed_type; |
44 | 44 | public $feed_version; |
45 | - public $encoding = ''; // output encoding of parsed rss |
|
45 | + public $encoding = ''; // output encoding of parsed rss |
|
46 | 46 | |
47 | - public $_source_encoding = ''; // only set if we have to parse xml prolog |
|
47 | + public $_source_encoding = ''; // only set if we have to parse xml prolog |
|
48 | 48 | |
49 | 49 | public $ERROR = ''; |
50 | 50 | public $WARNING = ''; |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | # if PHP xml isn't compiled in, die |
102 | 102 | # |
103 | 103 | if (!function_exists('xml_parser_create')) { |
104 | - $this->error("Failed to load PHP's XML Extension. " . 'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
104 | + $this->error("Failed to load PHP's XML Extension. ".'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | list($parser, $source) = $this->create_parser($source, $output_encoding, $input_encoding, $detect_encoding); |
108 | 108 | |
109 | 109 | if (!is_resource($parser)) { |
110 | - $this->error("Failed to create an instance of PHP's XML parser. " . 'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
110 | + $this->error("Failed to create an instance of PHP's XML parser. ".'http://www.php.net/manual/en/ref.xml.php', E_USER_ERROR); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $this->parser = $parser; |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | elseif (ATOM == $this->feed_type && 'link' === $el) { |
218 | 218 | if (isset($attrs['rel']) && 'alternate' === $attrs['rel']) { |
219 | 219 | $link_el = 'link'; |
220 | - } else { |
|
221 | - $link_el = 'link_' . $attrs['rel']; |
|
220 | + }else { |
|
221 | + $link_el = 'link_'.$attrs['rel']; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | $this->append($link_el, $attrs['href']); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | { |
237 | 237 | if (ATOM == $this->feed_type && $this->incontent) { |
238 | 238 | $this->append_content($text); |
239 | - } else { |
|
239 | + }else { |
|
240 | 240 | $current_el = implode('_', array_reverse($this->stack)); |
241 | 241 | $this->append($current_el, $text); |
242 | 242 | } |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | // note: i don't think this is actually neccessary |
268 | 268 | if ($this->stack[0] == $el) { |
269 | 269 | $this->append_content("</$el>"); |
270 | - } else { |
|
270 | + }else { |
|
271 | 271 | $this->append_content("<$el>"); |
272 | 272 | } |
273 | 273 | |
274 | 274 | array_shift($this->stack); |
275 | - } else { |
|
275 | + }else { |
|
276 | 276 | array_shift($this->stack); |
277 | 277 | } |
278 | 278 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } elseif ($this->inimage) { |
325 | 325 | $this->concat($this->image[$this->current_namespace][$el], $text); |
326 | 326 | } |
327 | - } else { |
|
327 | + }else { |
|
328 | 328 | if ($this->initem) { |
329 | 329 | $this->concat($this->current_item[$el], $text); |
330 | 330 | } elseif ($this->intextinput) { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | // if atom populate rss fields |
343 | 343 | if ($this->is_atom()) { |
344 | 344 | $this->channel['description'] = $this->channel['tagline']; |
345 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
345 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
346 | 346 | $item = $this->items[$i]; |
347 | 347 | if (isset($item['summary'])) { |
348 | 348 | $item['description'] = $item['summary']; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $atom_date = isset($item['issued']) ? $item['issued'] : @$item['modified']; |
355 | 355 | if ($atom_date) { |
356 | 356 | $epoch = @parse_w3cdtf($atom_date); |
357 | - if ($epoch && $epoch > 0) { |
|
357 | + if ($epoch && $epoch>0) { |
|
358 | 358 | $item['date_timestamp'] = $epoch; |
359 | 359 | } |
360 | 360 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } |
364 | 364 | } elseif ($this->is_rss()) { |
365 | 365 | $this->channel['tagline'] = $this->channel['description']; |
366 | - for ($i = 0, $iMax = count($this->items); $i < $iMax; ++$i) { |
|
366 | + for ($i = 0, $iMax = count($this->items); $i<$iMax; ++$i) { |
|
367 | 367 | $item = $this->items[$i]; |
368 | 368 | if (isset($item['description'])) { |
369 | 369 | $item['summary'] = $item['description']; |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | |
375 | 375 | if ('1.0' === $this->is_rss() && isset($item['dc']['date'])) { |
376 | 376 | $epoch = @parse_w3cdtf($item['dc']['date']); |
377 | - if ($epoch && $epoch > 0) { |
|
377 | + if ($epoch && $epoch>0) { |
|
378 | 378 | $item['date_timestamp'] = $epoch; |
379 | 379 | } |
380 | 380 | } elseif (isset($item['pubdate'])) { |
381 | 381 | $epoch = @strtotime($item['pubdate']); |
382 | - if ($epoch > 0) { |
|
382 | + if ($epoch>0) { |
|
383 | 383 | $item['date_timestamp'] = $epoch; |
384 | 384 | } |
385 | 385 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | { |
397 | 397 | if (RSS == $this->feed_type) { |
398 | 398 | return $this->feed_version; |
399 | - } else { |
|
399 | + }else { |
|
400 | 400 | return false; |
401 | 401 | } |
402 | 402 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | { |
409 | 409 | if (ATOM == $this->feed_type) { |
410 | 410 | return $this->feed_version; |
411 | - } else { |
|
411 | + }else { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | { |
426 | 426 | if (5 == substr(PHP_VERSION, 0, 1)) { |
427 | 427 | $parser = $this->php5_create_parser($in_enc, $detect); |
428 | - } else { |
|
428 | + }else { |
|
429 | 429 | list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect); |
430 | 430 | } |
431 | 431 | if ($out_enc) { |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | // by default php5 does a fine job of detecting input encodings |
453 | 453 | if (!$detect && $in_enc) { |
454 | 454 | return xml_parser_create($in_enc); |
455 | - } else { |
|
455 | + }else { |
|
456 | 456 | return xml_parser_create(''); |
457 | 457 | } |
458 | 458 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) { |
486 | 486 | $in_enc = strtoupper($m[1]); |
487 | 487 | $this->source_encoding = $in_enc; |
488 | - } else { |
|
488 | + }else { |
|
489 | 489 | $in_enc = 'UTF-8'; |
490 | 490 | } |
491 | 491 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $enc = strtoupper($enc); |
536 | 536 | if (in_array($enc, $this->_KNOWN_ENCODINGS)) { |
537 | 537 | return $enc; |
538 | - } else { |
|
538 | + }else { |
|
539 | 539 | return false; |
540 | 540 | } |
541 | 541 | } |
@@ -552,14 +552,14 @@ discard block |
||
552 | 552 | } |
553 | 553 | if (MAGPIE_DEBUG) { |
554 | 554 | trigger_error($errormsg, $lvl); |
555 | - } else { |
|
555 | + }else { |
|
556 | 556 | error_log($errormsg, 0); |
557 | 557 | } |
558 | 558 | |
559 | 559 | $notices = E_USER_NOTICE | E_NOTICE; |
560 | 560 | if ($lvl & $notices) { |
561 | 561 | $this->WARNING = $errormsg; |
562 | - } else { |
|
562 | + }else { |
|
563 | 563 | $this->ERROR = $errormsg; |
564 | 564 | } |
565 | 565 | } |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | ]; |
596 | 596 | |
597 | 597 | # calc epoch for current date assuming GMT |
598 | - $epoch = gmmktime((int)$hours, (int)$minutes, (int)$seconds, (int)$month, (int)$day, (int)$year); |
|
598 | + $epoch = gmmktime((int) $hours, (int) $minutes, (int) $seconds, (int) $month, (int) $day, (int) $year); |
|
599 | 599 | |
600 | 600 | $offset = 0; |
601 | 601 | if ('Z' === $match[10]) { |
602 | 602 | # zulu time, aka GMT |
603 | - } else { |
|
603 | + }else { |
|
604 | 604 | list($tz_mod, $tz_hour, $tz_min) = [$match[8], $match[9], $match[10]]; |
605 | 605 | |
606 | 606 | # zero out the variables |
@@ -611,20 +611,20 @@ discard block |
||
611 | 611 | $tz_min = 0; |
612 | 612 | } |
613 | 613 | |
614 | - $offset_secs = (($tz_hour * 60) + $tz_min) * 60; |
|
614 | + $offset_secs = (($tz_hour*60)+$tz_min)*60; |
|
615 | 615 | |
616 | 616 | # is timezone ahead of GMT? then subtract offset |
617 | 617 | # |
618 | 618 | if ('+' == $tz_mod) { |
619 | - $offset_secs = $offset_secs * -1; |
|
619 | + $offset_secs = $offset_secs*-1; |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | $offset = $offset_secs; |
623 | 623 | } |
624 | - $epoch = $epoch + $offset; |
|
624 | + $epoch = $epoch+$offset; |
|
625 | 625 | |
626 | 626 | return $epoch; |
627 | - } else { |
|
627 | + }else { |
|
628 | 628 | return -1; |
629 | 629 | } |
630 | 630 | } |