Completed
Push — master ( 10bab4...a0a78b )
by Michael
02:06
created
admin/menu.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,33 +35,33 @@  discard block
 block discarded – undo
35 35
 $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
36 36
 
37 37
 $adminmenu[] = [
38
-    'title' => planet_constant('MI_ADMENU_HOME'),
39
-    'link'  => 'admin/index.php',
40
-    'icon'  => $pathIcon32 . '/home.png',
38
+	'title' => planet_constant('MI_ADMENU_HOME'),
39
+	'link'  => 'admin/index.php',
40
+	'icon'  => $pathIcon32 . '/home.png',
41 41
 ];
42 42
 
43 43
 $adminmenu[] = [
44
-    'title' => planet_constant('MI_ADMENU_INDEX'),
45
-    'link'  => 'admin/main.php',
46
-    'icon'  => $pathIcon32 . '/manage.png',
44
+	'title' => planet_constant('MI_ADMENU_INDEX'),
45
+	'link'  => 'admin/main.php',
46
+	'icon'  => $pathIcon32 . '/manage.png',
47 47
 ];
48 48
 
49 49
 $adminmenu[] = [
50
-    'title' => planet_constant('MI_ADMENU_CATEGORY'),
51
-    'link'  => 'admin/admin.category.php',
52
-    'icon'  => $pathIcon32 . '/category.png',
50
+	'title' => planet_constant('MI_ADMENU_CATEGORY'),
51
+	'link'  => 'admin/admin.category.php',
52
+	'icon'  => $pathIcon32 . '/category.png',
53 53
 ];
54 54
 
55 55
 $adminmenu[] = [
56
-    'title' => planet_constant('MI_ADMENU_BLOG'),
57
-    'link'  => 'admin/admin.blog.php',
58
-    'icon'  => $pathIcon32 . '/translations.png',
56
+	'title' => planet_constant('MI_ADMENU_BLOG'),
57
+	'link'  => 'admin/admin.blog.php',
58
+	'icon'  => $pathIcon32 . '/translations.png',
59 59
 ];
60 60
 
61 61
 $adminmenu[] = [
62
-    'title' => planet_constant('MI_ADMENU_ARTICLE'),
63
-    'link'  => 'admin/admin.article.php',
64
-    'icon'  => $pathIcon32 . '/content.png',
62
+	'title' => planet_constant('MI_ADMENU_ARTICLE'),
63
+	'link'  => 'admin/admin.article.php',
64
+	'icon'  => $pathIcon32 . '/content.png',
65 65
 ];
66 66
 
67 67
 //$adminmenu[] = [
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 //];
72 72
 
73 73
 $adminmenu[] = [
74
-    'title' => planet_constant('MI_ADMENU_ABOUT'),
75
-    'link'  => 'admin/about.php',
76
-    'icon'  => $pathIcon32 . '/about.png',
74
+	'title' => planet_constant('MI_ADMENU_ABOUT'),
75
+	'link'  => 'admin/about.php',
76
+	'icon'  => $pathIcon32 . '/about.png',
77 77
 ];
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,31 +37,31 @@  discard block
 block discarded – undo
37 37
 $adminmenu[] = [
38 38
     'title' => planet_constant('MI_ADMENU_HOME'),
39 39
     'link'  => 'admin/index.php',
40
-    'icon'  => $pathIcon32 . '/home.png',
40
+    'icon'  => $pathIcon32.'/home.png',
41 41
 ];
42 42
 
43 43
 $adminmenu[] = [
44 44
     'title' => planet_constant('MI_ADMENU_INDEX'),
45 45
     'link'  => 'admin/main.php',
46
-    'icon'  => $pathIcon32 . '/manage.png',
46
+    'icon'  => $pathIcon32.'/manage.png',
47 47
 ];
48 48
 
49 49
 $adminmenu[] = [
50 50
     'title' => planet_constant('MI_ADMENU_CATEGORY'),
51 51
     'link'  => 'admin/admin.category.php',
52
-    'icon'  => $pathIcon32 . '/category.png',
52
+    'icon'  => $pathIcon32.'/category.png',
53 53
 ];
54 54
 
55 55
 $adminmenu[] = [
56 56
     'title' => planet_constant('MI_ADMENU_BLOG'),
57 57
     'link'  => 'admin/admin.blog.php',
58
-    'icon'  => $pathIcon32 . '/translations.png',
58
+    'icon'  => $pathIcon32.'/translations.png',
59 59
 ];
60 60
 
61 61
 $adminmenu[] = [
62 62
     'title' => planet_constant('MI_ADMENU_ARTICLE'),
63 63
     'link'  => 'admin/admin.article.php',
64
-    'icon'  => $pathIcon32 . '/content.png',
64
+    'icon'  => $pathIcon32.'/content.png',
65 65
 ];
66 66
 
67 67
 //$adminmenu[] = [
@@ -73,5 +73,5 @@  discard block
 block discarded – undo
73 73
 $adminmenu[] = [
74 74
     'title' => planet_constant('MI_ADMENU_ABOUT'),
75 75
     'link'  => 'admin/about.php',
76
-    'icon'  => $pathIcon32 . '/about.png',
76
+    'icon'  => $pathIcon32.'/about.png',
77 77
 ];
Please login to merge, or discard this patch.
admin/admin.blog.php 3 patches
Indentation   +341 added lines, -341 removed lines patch added patch discarded remove patch
@@ -55,353 +55,353 @@
 block discarded – undo
55 55
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
56 56
 
57 57
 if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) {
58
-    $op = 'edit';
58
+	$op = 'edit';
59 59
 }
60 60
 
61 61
 switch ($op) {
62
-    /* save a single blog */
63
-    case 'save':
64
-
65
-        if ($blog_id) {
66
-            $blog_obj = $blogHandler->get($blog_id);
67
-        } else {
68
-            if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
69
-                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
70
-            }
71
-            $blog_obj = $blogHandler->create();
72
-            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
73
-        }
74
-
75
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
76
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
77
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
78
-        $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
79
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
80
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
81
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
82
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
83
-        $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
84
-
85
-        if (!$blogHandler->insert($blog_obj)) {
86
-        } elseif (!empty(Request::getArray('categories', [], 'POST'))) {
87
-            $blog_id = $blog_obj->getVar('blog_id');
88
-            if (in_array(0, Request::getArray('categories', [], 'POST'))) {
89
-                $_POST['categories'] = [];
90
-            }
91
-            $blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
92
-        }
93
-        $message = planet_constant('AM_DBUPDATED');
94
-        redirect_header('admin.blog.php', 2, $message);
95
-
96
-    /* fetch and add a list of blogs to a category */
97
-    // no break
98
-    case 'add':
99
-        $links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
100
-        $blogs = [];
101
-        foreach ($links as $link) {
102
-            if ($blog_exist = $blogHandler->getCount(new \Criteria('blog_feed', $link['url']))) {
103
-                continue;
104
-            }
105
-            $blog_obj = $blogHandler->fetch($link['url']);
106
-            if (!empty($link['title'])) {
107
-                $blog_obj->setVar('blog_title', $link['title']);
108
-            }
109
-            $blogHandler->insert($blog_obj);
110
-            $blogs[] = $blog_obj->getVar('blog_id');
111
-            unset($blog_obj);
112
-        }
113
-        if (!empty(Request::getArray('categories', [], 'POST'))) {
114
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
115
-            foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
116
-                $categoryHandler->addBlogs($cat_id, $blogs);
117
-            }
118
-        }
119
-        $message = planet_constant('AM_DBUPDATED');
120
-        redirect_header('admin.blog.php', 2, $message);
121
-
122
-    /* update a list of blogs */
123
-    // no break
124
-    case 'update':
125
-        foreach ($blog_id as $bid) {
126
-            $blog_obj = $blogHandler->fetch($bid);
127
-            if (!$blogHandler->insert($blog_obj)) {
128
-            }
129
-            unset($blog_obj);
130
-        }
131
-        $message = planet_constant('AM_DBUPDATED');
132
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
133
-
134
-    /* add a list of blogs to a category */
135
-    // no break
136
-    case 'register':
137
-        if (!empty(Request::getArray('category_dest', [], 'POST'))) {
138
-            if (!is_array($blog_id)) {
139
-                $blog_id = [$blog_id];
140
-            }
141
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
142
-            $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
143
-        }
144
-        $message = planet_constant('AM_DBUPDATED');
145
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&start=' . $start, 2, $message);
146
-
147
-    /* remove a list of blogs from a category */
148
-    // no break
149
-    case 'remove':
150
-        if (!is_array($blog_id)) {
151
-            $blog_id = [$blog_id];
152
-        }
153
-        if (!empty($category_id)) {
154
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
155
-            $categoryHandler->removeBlogs($category_id, $blog_id);
156
-        }
157
-        $message = planet_constant('AM_DBUPDATED');
158
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
159
-
160
-    /* delete a single blog or a list blogs */
161
-    // no break
162
-    case 'del':
163
-        if (!is_array($blog_id)) {
164
-            $blog_id = [$blog_id];
165
-        }
166
-        foreach ($blog_id as $bid) {
167
-            $blog_obj = $blogHandler->get($bid);
168
-            if (!$blogHandler->delete($blog_obj, true)) {
169
-            }
170
-            unset($blog_obj);
171
-        }
172
-        $message = planet_constant('AM_DBUPDATED');
173
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
174
-
175
-    /* empty a single blog or a list blogs */
176
-    // no break
177
-    case 'empty':
178
-        if (!is_array($blog_id)) {
179
-            $blog_id = [$blog_id];
180
-        }
181
-        foreach ($blog_id as $bid) {
182
-            $blog_obj = $blogHandler->get($bid);
183
-            if (!$blogHandler->do_empty($blog_obj)) {
184
-            }
185
-        }
186
-        $message = planet_constant('AM_DBUPDATED');
187
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
188
-
189
-    /* approve a single blog or a list blogs */
190
-    // no break
191
-    case 'approve':
192
-        if (!is_array($blog_id)) {
193
-            $blog_id = [$blog_id];
194
-        }
195
-        $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
196
-        $blogHandler->updateAll('blog_status', 1, $criteria, true);
197
-        $message = planet_constant('AM_DBUPDATED');
198
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
199
-
200
-    /* mark a single blog or a list blogs as featured */
201
-    // no break
202
-    case 'feature':
203
-        if (!is_array($blog_id)) {
204
-            $blog_id = [$blog_id];
205
-        }
206
-        $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
207
-        $blogHandler->updateAll('blog_status', 2, $criteria, true);
208
-        $message = planet_constant('AM_DBUPDATED');
209
-        redirect_header('admin.blog.php?category=' . $category_id . '&start=' . $start, 2, $message);
210
-
211
-    /* edit a single blog */
212
-    // no break
213
-    case 'edit':
214
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
215
-            $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
216
-            $blog_obj->setVar('blog_id', $blog_id);
217
-        } else {
218
-            $blog_obj = $blogHandler->get($blog_id);
219
-        }
220
-        $categories = Request::getArray('categories', [], 'POST');
221
-        if (empty($categories) && $blog_id > 0) {
222
-            $crit       = new \Criteria('bc.blog_id', $blog_id);
223
-            $categories = array_keys($categoryHandler->getByBlog($crit));
224
-        }
225
-        if (empty($categories)) {
226
-            $categories = [0 => _NONE];
227
-        }
228
-
229
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
230
-        echo '<br>';
231
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
232
-            $criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
233
-            $blogs_obj = $blogHandler->getList($criteria);
234
-            if (count($blogs_obj) > 0) {
235
-                echo '<div class="errorMsg">' . planet_constant('AM_BLOGEXISTS');
236
-                foreach (array_keys($blogs_obj) as $bid) {
237
-                    echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
238
-                }
239
-                echo '</div>';
240
-            }
241
-            unset($blogs_obj, $criteria);
242
-        }
243
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
244
-        echo '</fieldset>';
245
-        break;
246
-
247
-    default:
248
-
249
-        $crit = new \Criteria('1', 1);
250
-        $crit->setSort('cat_order');
251
-        $crit->setOrder('ASC');
252
-        $categories = $categoryHandler->getList($crit);
253
-
254
-        // Display category option form
255
-        $opform    = new \XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
256
-        $op_select = new \XoopsFormSelect('', 'category', $category_id);
257
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
258
-        $options = [
259
-            '0'  => _ALL,
260
-            '-1' => planet_constant('MD_ACTIVE'),
261
-            '-2' => planet_constant('MD_FEATURED'),
262
-            '-3' => planet_constant('MD_PENDING')
263
-        ];
264
-        foreach (array_keys($categories) as $key) {
265
-            $options[$key] = $categories[$key];
266
-        }
267
-        $op_select->addOptionArray($options);
268
-        $opform->addElement($op_select);
269
-        $opform->display();
270
-
271
-        if ($category_id > 0) {
272
-            $criteria = new \CriteriaCompo(new \Criteria('b.blog_status', 0, '>'));
273
-            $criteria->add(new \Criteria('bc.cat_id', $category_id));
274
-            $blog_count = $blogHandler->getCountByCategory($criteria);
275
-            $criteria->setStart($start);
276
-            $criteria->setLimit($helper->getConfig('list_perpage'));
277
-            $blog_objs = $blogHandler->getByCategory($criteria);
278
-        } else {
279
-            /* All active blogs */
280
-            if (0 == $category_id) {
281
-                $criteria = new \Criteria('1', 1);
282
-                $criteria->setStart($start);
283
-                $criteria->setLimit($helper->getConfig('list_perpage'));
284
-            /* Active blogs */
285
-            } elseif (-1 == $category_id) {
286
-                $criteria = new \Criteria('blog_status', 1);
287
-                $criteria->setStart($start);
288
-                $criteria->setLimit($helper->getConfig('list_perpage'));
289
-            /* Featured blogs */
290
-            } elseif (-2 == $category_id) {
291
-                $criteria = new \Criteria('blog_status', 2);
292
-                $criteria->setStart($start);
293
-                $criteria->setLimit($helper->getConfig('list_perpage'));
294
-            /* Pending blogs */
295
-            } else {
296
-                $criteria = new \Criteria('blog_status', 0);
297
-                $criteria->setStart($start);
298
-                $criteria->setLimit($helper->getConfig('list_perpage'));
299
-            }
300
-            $blog_count = $blogHandler->getCount($criteria);
301
-            $blog_objs  = $blogHandler->getAll($criteria);
302
-        }
303
-
304
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
305
-        echo '<br style="clear:both">';
306
-
307
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
308
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
309
-        echo "<tr align='center'>";
310
-        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
311
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
312
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
313
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
314
-        //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
315
-        //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
316
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
317
-        echo '</tr>';
318
-
319
-        $status = [
320
-            '0' => planet_constant('MD_PENDING'),
321
-            '1' => planet_constant('MD_ACTIVE'),
322
-            '2' => planet_constant('MD_FEATURED')
323
-        ];
324
-        foreach (array_keys($blog_objs) as $bid) {
325
-            echo "<tr class='odd' align='left'>";
326
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
327
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
328
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
329
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
330
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
62
+	/* save a single blog */
63
+	case 'save':
64
+
65
+		if ($blog_id) {
66
+			$blog_obj = $blogHandler->get($blog_id);
67
+		} else {
68
+			if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
69
+				redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
70
+			}
71
+			$blog_obj = $blogHandler->create();
72
+			$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
73
+		}
74
+
75
+		$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
76
+		$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
77
+		$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
78
+		$blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
79
+		$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
80
+		$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
81
+		$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
82
+		$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
83
+		$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
84
+
85
+		if (!$blogHandler->insert($blog_obj)) {
86
+		} elseif (!empty(Request::getArray('categories', [], 'POST'))) {
87
+			$blog_id = $blog_obj->getVar('blog_id');
88
+			if (in_array(0, Request::getArray('categories', [], 'POST'))) {
89
+				$_POST['categories'] = [];
90
+			}
91
+			$blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
92
+		}
93
+		$message = planet_constant('AM_DBUPDATED');
94
+		redirect_header('admin.blog.php', 2, $message);
95
+
96
+	/* fetch and add a list of blogs to a category */
97
+	// no break
98
+	case 'add':
99
+		$links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
100
+		$blogs = [];
101
+		foreach ($links as $link) {
102
+			if ($blog_exist = $blogHandler->getCount(new \Criteria('blog_feed', $link['url']))) {
103
+				continue;
104
+			}
105
+			$blog_obj = $blogHandler->fetch($link['url']);
106
+			if (!empty($link['title'])) {
107
+				$blog_obj->setVar('blog_title', $link['title']);
108
+			}
109
+			$blogHandler->insert($blog_obj);
110
+			$blogs[] = $blog_obj->getVar('blog_id');
111
+			unset($blog_obj);
112
+		}
113
+		if (!empty(Request::getArray('categories', [], 'POST'))) {
114
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
115
+			foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
116
+				$categoryHandler->addBlogs($cat_id, $blogs);
117
+			}
118
+		}
119
+		$message = planet_constant('AM_DBUPDATED');
120
+		redirect_header('admin.blog.php', 2, $message);
121
+
122
+	/* update a list of blogs */
123
+	// no break
124
+	case 'update':
125
+		foreach ($blog_id as $bid) {
126
+			$blog_obj = $blogHandler->fetch($bid);
127
+			if (!$blogHandler->insert($blog_obj)) {
128
+			}
129
+			unset($blog_obj);
130
+		}
131
+		$message = planet_constant('AM_DBUPDATED');
132
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
133
+
134
+	/* add a list of blogs to a category */
135
+	// no break
136
+	case 'register':
137
+		if (!empty(Request::getArray('category_dest', [], 'POST'))) {
138
+			if (!is_array($blog_id)) {
139
+				$blog_id = [$blog_id];
140
+			}
141
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
142
+			$categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
143
+		}
144
+		$message = planet_constant('AM_DBUPDATED');
145
+		redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
146
+
147
+	/* remove a list of blogs from a category */
148
+	// no break
149
+	case 'remove':
150
+		if (!is_array($blog_id)) {
151
+			$blog_id = [$blog_id];
152
+		}
153
+		if (!empty($category_id)) {
154
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
155
+			$categoryHandler->removeBlogs($category_id, $blog_id);
156
+		}
157
+		$message = planet_constant('AM_DBUPDATED');
158
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
159
+
160
+	/* delete a single blog or a list blogs */
161
+	// no break
162
+	case 'del':
163
+		if (!is_array($blog_id)) {
164
+			$blog_id = [$blog_id];
165
+		}
166
+		foreach ($blog_id as $bid) {
167
+			$blog_obj = $blogHandler->get($bid);
168
+			if (!$blogHandler->delete($blog_obj, true)) {
169
+			}
170
+			unset($blog_obj);
171
+		}
172
+		$message = planet_constant('AM_DBUPDATED');
173
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
174
+
175
+	/* empty a single blog or a list blogs */
176
+	// no break
177
+	case 'empty':
178
+		if (!is_array($blog_id)) {
179
+			$blog_id = [$blog_id];
180
+		}
181
+		foreach ($blog_id as $bid) {
182
+			$blog_obj = $blogHandler->get($bid);
183
+			if (!$blogHandler->do_empty($blog_obj)) {
184
+			}
185
+		}
186
+		$message = planet_constant('AM_DBUPDATED');
187
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
188
+
189
+	/* approve a single blog or a list blogs */
190
+	// no break
191
+	case 'approve':
192
+		if (!is_array($blog_id)) {
193
+			$blog_id = [$blog_id];
194
+		}
195
+		$criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
196
+		$blogHandler->updateAll('blog_status', 1, $criteria, true);
197
+		$message = planet_constant('AM_DBUPDATED');
198
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
199
+
200
+	/* mark a single blog or a list blogs as featured */
201
+	// no break
202
+	case 'feature':
203
+		if (!is_array($blog_id)) {
204
+			$blog_id = [$blog_id];
205
+		}
206
+		$criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
207
+		$blogHandler->updateAll('blog_status', 2, $criteria, true);
208
+		$message = planet_constant('AM_DBUPDATED');
209
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
210
+
211
+	/* edit a single blog */
212
+	// no break
213
+	case 'edit':
214
+		if (!empty(Request::getString('fetch', '', 'POST'))) {
215
+			$blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
216
+			$blog_obj->setVar('blog_id', $blog_id);
217
+		} else {
218
+			$blog_obj = $blogHandler->get($blog_id);
219
+		}
220
+		$categories = Request::getArray('categories', [], 'POST');
221
+		if (empty($categories) && $blog_id > 0) {
222
+			$crit       = new \Criteria('bc.blog_id', $blog_id);
223
+			$categories = array_keys($categoryHandler->getByBlog($crit));
224
+		}
225
+		if (empty($categories)) {
226
+			$categories = [0 => _NONE];
227
+		}
228
+
229
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
230
+		echo '<br>';
231
+		if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
232
+			$criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
233
+			$blogs_obj = $blogHandler->getList($criteria);
234
+			if (count($blogs_obj) > 0) {
235
+				echo '<div class="errorMsg">' . planet_constant('AM_BLOGEXISTS');
236
+				foreach (array_keys($blogs_obj) as $bid) {
237
+					echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
238
+				}
239
+				echo '</div>';
240
+			}
241
+			unset($blogs_obj, $criteria);
242
+		}
243
+		include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
244
+		echo '</fieldset>';
245
+		break;
246
+
247
+	default:
248
+
249
+		$crit = new \Criteria('1', 1);
250
+		$crit->setSort('cat_order');
251
+		$crit->setOrder('ASC');
252
+		$categories = $categoryHandler->getList($crit);
253
+
254
+		// Display category option form
255
+		$opform    = new \XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
256
+		$op_select = new \XoopsFormSelect('', 'category', $category_id);
257
+		$op_select->setExtra('onchange="document.forms.opform.submit()"');
258
+		$options = [
259
+			'0'  => _ALL,
260
+			'-1' => planet_constant('MD_ACTIVE'),
261
+			'-2' => planet_constant('MD_FEATURED'),
262
+			'-3' => planet_constant('MD_PENDING')
263
+		];
264
+		foreach (array_keys($categories) as $key) {
265
+			$options[$key] = $categories[$key];
266
+		}
267
+		$op_select->addOptionArray($options);
268
+		$opform->addElement($op_select);
269
+		$opform->display();
270
+
271
+		if ($category_id > 0) {
272
+			$criteria = new \CriteriaCompo(new \Criteria('b.blog_status', 0, '>'));
273
+			$criteria->add(new \Criteria('bc.cat_id', $category_id));
274
+			$blog_count = $blogHandler->getCountByCategory($criteria);
275
+			$criteria->setStart($start);
276
+			$criteria->setLimit($helper->getConfig('list_perpage'));
277
+			$blog_objs = $blogHandler->getByCategory($criteria);
278
+		} else {
279
+			/* All active blogs */
280
+			if (0 == $category_id) {
281
+				$criteria = new \Criteria('1', 1);
282
+				$criteria->setStart($start);
283
+				$criteria->setLimit($helper->getConfig('list_perpage'));
284
+			/* Active blogs */
285
+			} elseif (-1 == $category_id) {
286
+				$criteria = new \Criteria('blog_status', 1);
287
+				$criteria->setStart($start);
288
+				$criteria->setLimit($helper->getConfig('list_perpage'));
289
+			/* Featured blogs */
290
+			} elseif (-2 == $category_id) {
291
+				$criteria = new \Criteria('blog_status', 2);
292
+				$criteria->setStart($start);
293
+				$criteria->setLimit($helper->getConfig('list_perpage'));
294
+			/* Pending blogs */
295
+			} else {
296
+				$criteria = new \Criteria('blog_status', 0);
297
+				$criteria->setStart($start);
298
+				$criteria->setLimit($helper->getConfig('list_perpage'));
299
+			}
300
+			$blog_count = $blogHandler->getCount($criteria);
301
+			$blog_objs  = $blogHandler->getAll($criteria);
302
+		}
303
+
304
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
305
+		echo '<br style="clear:both">';
306
+
307
+		echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
308
+		echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
309
+		echo "<tr align='center'>";
310
+		echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
311
+		echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
312
+		echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
313
+		echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
314
+		//        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
315
+		//        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
316
+		echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
317
+		echo '</tr>';
318
+
319
+		$status = [
320
+			'0' => planet_constant('MD_PENDING'),
321
+			'1' => planet_constant('MD_ACTIVE'),
322
+			'2' => planet_constant('MD_FEATURED')
323
+		];
324
+		foreach (array_keys($blog_objs) as $bid) {
325
+			echo "<tr class='odd' align='left'>";
326
+			echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
327
+			echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
328
+			echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
329
+			echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
330
+			echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
331 331
                       <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
332 332
                       <a href='admin.blog.php?op=empty&amp;blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>';
333 333
 
334
-            echo '</tr>';
335
-        }
336
-        echo "<tr class='even' align='center'>";
337
-        echo "<td colspan='7'>";
338
-        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
339
-        echo "<option value=''>" . _SELECT . '</option>';
340
-        echo "<option value='del'>" . _DELETE . '</option>';
341
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
342
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
343
-        if ($category_id > 0) {
344
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
345
-        }
346
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
347
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
348
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
349
-
350
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
351
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
352
-
353
-        echo '</select>';
354
-        echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
355
-        echo "<select name='category_dest'>";
356
-        echo "<option value=''>" . _SELECT . '</option>';
357
-        foreach ($categories as $cid => $name) {
358
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
359
-        }
360
-        echo '</select>';
361
-        echo '</div>';
362
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
363
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
364
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
365
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
366
-        echo '</td>';
367
-        echo '</tr>';
368
-        if ($blog_count > $helper->getConfig('list_perpage')) {
369
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
370
-            $nav     = new \XoopsPageNav($blog_count, $helper->getConfig('list_perpage'), $start, 'start', 'category=' . $category_id);
371
-            $pagenav = $nav->renderNav(4);
372
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
373
-        }
374
-        echo '</table></form>';
375
-        echo "</fieldset><br style='clear:both;'>";
376
-
377
-        if (empty($start) && empty($category_id)) {
378
-            $form = new \XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
379
-            $form->addElement(new \XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
380
-            $form->addElement(new \XoopsFormHidden('op', 'edit'));
381
-            $button_tray = new \XoopsFormElementTray('', '');
382
-            $butt_save   = new \XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
383
-            $button_tray->addElement($butt_save);
384
-            $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
385
-            $button_tray->addElement($butt_cancel);
386
-            $form->addElement($button_tray);
387
-
388
-            $form_add = new \XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
389
-            $form_add->addElement(new \XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
390
-            $form_add->addElement(new \XoopsFormHidden('op', 'add'));
391
-            $button_tray = new \XoopsFormElementTray('', '');
392
-            $butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
393
-            $button_tray->addElement($butt_save);
394
-            $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
395
-            $button_tray->addElement($butt_cancel);
396
-            $form_add->addElement($button_tray);
397
-
398
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
399
-            echo '<br>';
400
-            $form->display();
401
-            $form_add->display();
402
-            echo '</fieldset>';
403
-        }
404
-        break;
334
+			echo '</tr>';
335
+		}
336
+		echo "<tr class='even' align='center'>";
337
+		echo "<td colspan='7'>";
338
+		echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
339
+		echo "<option value=''>" . _SELECT . '</option>';
340
+		echo "<option value='del'>" . _DELETE . '</option>';
341
+		echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
342
+		echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
343
+		if ($category_id > 0) {
344
+			echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
345
+		}
346
+		echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
347
+		echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
348
+		echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
349
+
350
+		echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
351
+		echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
352
+
353
+		echo '</select>';
354
+		echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
355
+		echo "<select name='category_dest'>";
356
+		echo "<option value=''>" . _SELECT . '</option>';
357
+		foreach ($categories as $cid => $name) {
358
+			echo "<option value='" . $cid . "'>" . $name . '</option>';
359
+		}
360
+		echo '</select>';
361
+		echo '</div>';
362
+		echo "<input name='start' value='" . $start . "' type='hidden'>";
363
+		echo "<input name='category' value='" . $category_id . "' type='hidden'>";
364
+		echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
365
+		echo "<input name='' value='" . _CANCEL . "' type='reset'>";
366
+		echo '</td>';
367
+		echo '</tr>';
368
+		if ($blog_count > $helper->getConfig('list_perpage')) {
369
+			include XOOPS_ROOT_PATH . '/class/pagenav.php';
370
+			$nav     = new \XoopsPageNav($blog_count, $helper->getConfig('list_perpage'), $start, 'start', 'category=' . $category_id);
371
+			$pagenav = $nav->renderNav(4);
372
+			echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
373
+		}
374
+		echo '</table></form>';
375
+		echo "</fieldset><br style='clear:both;'>";
376
+
377
+		if (empty($start) && empty($category_id)) {
378
+			$form = new \XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
379
+			$form->addElement(new \XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
380
+			$form->addElement(new \XoopsFormHidden('op', 'edit'));
381
+			$button_tray = new \XoopsFormElementTray('', '');
382
+			$butt_save   = new \XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
383
+			$button_tray->addElement($butt_save);
384
+			$butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
385
+			$button_tray->addElement($butt_cancel);
386
+			$form->addElement($button_tray);
387
+
388
+			$form_add = new \XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
389
+			$form_add->addElement(new \XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
390
+			$form_add->addElement(new \XoopsFormHidden('op', 'add'));
391
+			$button_tray = new \XoopsFormElementTray('', '');
392
+			$butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
393
+			$button_tray->addElement($butt_save);
394
+			$butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
395
+			$button_tray->addElement($butt_cancel);
396
+			$form_add->addElement($button_tray);
397
+
398
+			echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
399
+			echo '<br>';
400
+			$form->display();
401
+			$form_add->display();
402
+			echo '</fieldset>';
403
+		}
404
+		break;
405 405
 }
406 406
 
407 407
 xoops_cp_footer();
Please login to merge, or discard this patch.
Switch Indentation   +339 added lines, -339 removed lines patch added patch discarded remove patch
@@ -60,348 +60,348 @@
 block discarded – undo
60 60
 
61 61
 switch ($op) {
62 62
     /* save a single blog */
63
-    case 'save':
64
-
65
-        if ($blog_id) {
66
-            $blog_obj = $blogHandler->get($blog_id);
67
-        } else {
68
-            if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
69
-                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
70
-            }
71
-            $blog_obj = $blogHandler->create();
72
-            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
73
-        }
74
-
75
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
76
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
77
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
78
-        $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
79
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
80
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
81
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
82
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
83
-        $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
84
-
85
-        if (!$blogHandler->insert($blog_obj)) {
86
-        } elseif (!empty(Request::getArray('categories', [], 'POST'))) {
87
-            $blog_id = $blog_obj->getVar('blog_id');
88
-            if (in_array(0, Request::getArray('categories', [], 'POST'))) {
89
-                $_POST['categories'] = [];
90
-            }
91
-            $blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
92
-        }
93
-        $message = planet_constant('AM_DBUPDATED');
94
-        redirect_header('admin.blog.php', 2, $message);
95
-
96
-    /* fetch and add a list of blogs to a category */
97
-    // no break
98
-    case 'add':
99
-        $links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
100
-        $blogs = [];
101
-        foreach ($links as $link) {
102
-            if ($blog_exist = $blogHandler->getCount(new \Criteria('blog_feed', $link['url']))) {
103
-                continue;
104
-            }
105
-            $blog_obj = $blogHandler->fetch($link['url']);
106
-            if (!empty($link['title'])) {
107
-                $blog_obj->setVar('blog_title', $link['title']);
108
-            }
109
-            $blogHandler->insert($blog_obj);
110
-            $blogs[] = $blog_obj->getVar('blog_id');
111
-            unset($blog_obj);
112
-        }
113
-        if (!empty(Request::getArray('categories', [], 'POST'))) {
114
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
115
-            foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
116
-                $categoryHandler->addBlogs($cat_id, $blogs);
117
-            }
118
-        }
119
-        $message = planet_constant('AM_DBUPDATED');
120
-        redirect_header('admin.blog.php', 2, $message);
121
-
122
-    /* update a list of blogs */
123
-    // no break
124
-    case 'update':
125
-        foreach ($blog_id as $bid) {
126
-            $blog_obj = $blogHandler->fetch($bid);
127
-            if (!$blogHandler->insert($blog_obj)) {
128
-            }
129
-            unset($blog_obj);
130
-        }
131
-        $message = planet_constant('AM_DBUPDATED');
132
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
133
-
134
-    /* add a list of blogs to a category */
135
-    // no break
136
-    case 'register':
137
-        if (!empty(Request::getArray('category_dest', [], 'POST'))) {
138
-            if (!is_array($blog_id)) {
139
-                $blog_id = [$blog_id];
140
-            }
141
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
142
-            $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
143
-        }
144
-        $message = planet_constant('AM_DBUPDATED');
145
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
146
-
147
-    /* remove a list of blogs from a category */
148
-    // no break
149
-    case 'remove':
150
-        if (!is_array($blog_id)) {
151
-            $blog_id = [$blog_id];
152
-        }
153
-        if (!empty($category_id)) {
154
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
155
-            $categoryHandler->removeBlogs($category_id, $blog_id);
156
-        }
157
-        $message = planet_constant('AM_DBUPDATED');
158
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
159
-
160
-    /* delete a single blog or a list blogs */
161
-    // no break
162
-    case 'del':
163
-        if (!is_array($blog_id)) {
164
-            $blog_id = [$blog_id];
165
-        }
166
-        foreach ($blog_id as $bid) {
167
-            $blog_obj = $blogHandler->get($bid);
168
-            if (!$blogHandler->delete($blog_obj, true)) {
169
-            }
170
-            unset($blog_obj);
171
-        }
172
-        $message = planet_constant('AM_DBUPDATED');
173
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
174
-
175
-    /* empty a single blog or a list blogs */
176
-    // no break
177
-    case 'empty':
178
-        if (!is_array($blog_id)) {
179
-            $blog_id = [$blog_id];
180
-        }
181
-        foreach ($blog_id as $bid) {
182
-            $blog_obj = $blogHandler->get($bid);
183
-            if (!$blogHandler->do_empty($blog_obj)) {
184
-            }
185
-        }
186
-        $message = planet_constant('AM_DBUPDATED');
187
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
188
-
189
-    /* approve a single blog or a list blogs */
190
-    // no break
191
-    case 'approve':
192
-        if (!is_array($blog_id)) {
193
-            $blog_id = [$blog_id];
194
-        }
195
-        $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
196
-        $blogHandler->updateAll('blog_status', 1, $criteria, true);
197
-        $message = planet_constant('AM_DBUPDATED');
198
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
199
-
200
-    /* mark a single blog or a list blogs as featured */
201
-    // no break
202
-    case 'feature':
203
-        if (!is_array($blog_id)) {
204
-            $blog_id = [$blog_id];
205
-        }
206
-        $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
207
-        $blogHandler->updateAll('blog_status', 2, $criteria, true);
208
-        $message = planet_constant('AM_DBUPDATED');
209
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
210
-
211
-    /* edit a single blog */
212
-    // no break
213
-    case 'edit':
214
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
215
-            $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
216
-            $blog_obj->setVar('blog_id', $blog_id);
217
-        } else {
218
-            $blog_obj = $blogHandler->get($blog_id);
219
-        }
220
-        $categories = Request::getArray('categories', [], 'POST');
221
-        if (empty($categories) && $blog_id > 0) {
222
-            $crit       = new \Criteria('bc.blog_id', $blog_id);
223
-            $categories = array_keys($categoryHandler->getByBlog($crit));
224
-        }
225
-        if (empty($categories)) {
226
-            $categories = [0 => _NONE];
227
-        }
228
-
229
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
230
-        echo '<br>';
231
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
232
-            $criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
233
-            $blogs_obj = $blogHandler->getList($criteria);
234
-            if (count($blogs_obj) > 0) {
235
-                echo '<div class="errorMsg">' . planet_constant('AM_BLOGEXISTS');
236
-                foreach (array_keys($blogs_obj) as $bid) {
237
-                    echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
238
-                }
239
-                echo '</div>';
240
-            }
241
-            unset($blogs_obj, $criteria);
242
-        }
243
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
244
-        echo '</fieldset>';
245
-        break;
246
-
247
-    default:
248
-
249
-        $crit = new \Criteria('1', 1);
250
-        $crit->setSort('cat_order');
251
-        $crit->setOrder('ASC');
252
-        $categories = $categoryHandler->getList($crit);
253
-
254
-        // Display category option form
255
-        $opform    = new \XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
256
-        $op_select = new \XoopsFormSelect('', 'category', $category_id);
257
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
258
-        $options = [
259
-            '0'  => _ALL,
260
-            '-1' => planet_constant('MD_ACTIVE'),
261
-            '-2' => planet_constant('MD_FEATURED'),
262
-            '-3' => planet_constant('MD_PENDING')
263
-        ];
264
-        foreach (array_keys($categories) as $key) {
265
-            $options[$key] = $categories[$key];
266
-        }
267
-        $op_select->addOptionArray($options);
268
-        $opform->addElement($op_select);
269
-        $opform->display();
270
-
271
-        if ($category_id > 0) {
272
-            $criteria = new \CriteriaCompo(new \Criteria('b.blog_status', 0, '>'));
273
-            $criteria->add(new \Criteria('bc.cat_id', $category_id));
274
-            $blog_count = $blogHandler->getCountByCategory($criteria);
275
-            $criteria->setStart($start);
276
-            $criteria->setLimit($helper->getConfig('list_perpage'));
277
-            $blog_objs = $blogHandler->getByCategory($criteria);
278
-        } else {
279
-            /* All active blogs */
280
-            if (0 == $category_id) {
281
-                $criteria = new \Criteria('1', 1);
282
-                $criteria->setStart($start);
283
-                $criteria->setLimit($helper->getConfig('list_perpage'));
284
-            /* Active blogs */
285
-            } elseif (-1 == $category_id) {
286
-                $criteria = new \Criteria('blog_status', 1);
287
-                $criteria->setStart($start);
288
-                $criteria->setLimit($helper->getConfig('list_perpage'));
289
-            /* Featured blogs */
290
-            } elseif (-2 == $category_id) {
291
-                $criteria = new \Criteria('blog_status', 2);
292
-                $criteria->setStart($start);
293
-                $criteria->setLimit($helper->getConfig('list_perpage'));
294
-            /* Pending blogs */
295
-            } else {
296
-                $criteria = new \Criteria('blog_status', 0);
297
-                $criteria->setStart($start);
298
-                $criteria->setLimit($helper->getConfig('list_perpage'));
299
-            }
300
-            $blog_count = $blogHandler->getCount($criteria);
301
-            $blog_objs  = $blogHandler->getAll($criteria);
302
-        }
303
-
304
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
305
-        echo '<br style="clear:both">';
306
-
307
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
308
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
309
-        echo "<tr align='center'>";
310
-        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
311
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
312
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
313
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
314
-        //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
315
-        //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
316
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
317
-        echo '</tr>';
318
-
319
-        $status = [
320
-            '0' => planet_constant('MD_PENDING'),
321
-            '1' => planet_constant('MD_ACTIVE'),
322
-            '2' => planet_constant('MD_FEATURED')
323
-        ];
324
-        foreach (array_keys($blog_objs) as $bid) {
325
-            echo "<tr class='odd' align='left'>";
326
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
327
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
328
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
329
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
330
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
63
+    	case 'save':
64
+
65
+        	if ($blog_id) {
66
+            	$blog_obj = $blogHandler->get($blog_id);
67
+        	} else {
68
+            	if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
69
+                	redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
70
+            	}
71
+            	$blog_obj = $blogHandler->create();
72
+            	$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
73
+        	}
74
+
75
+        	$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
76
+        	$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
77
+        	$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
78
+        	$blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
79
+        	$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
80
+        	$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
81
+        	$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
82
+        	$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
83
+        	$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
84
+
85
+        	if (!$blogHandler->insert($blog_obj)) {
86
+        	} elseif (!empty(Request::getArray('categories', [], 'POST'))) {
87
+            	$blog_id = $blog_obj->getVar('blog_id');
88
+            	if (in_array(0, Request::getArray('categories', [], 'POST'))) {
89
+                	$_POST['categories'] = [];
90
+            	}
91
+            	$blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
92
+        	}
93
+        	$message = planet_constant('AM_DBUPDATED');
94
+        	redirect_header('admin.blog.php', 2, $message);
95
+
96
+    	/* fetch and add a list of blogs to a category */
97
+    	// no break
98
+    	case 'add':
99
+        	$links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
100
+        	$blogs = [];
101
+        	foreach ($links as $link) {
102
+            	if ($blog_exist = $blogHandler->getCount(new \Criteria('blog_feed', $link['url']))) {
103
+                	continue;
104
+            	}
105
+            	$blog_obj = $blogHandler->fetch($link['url']);
106
+            	if (!empty($link['title'])) {
107
+                	$blog_obj->setVar('blog_title', $link['title']);
108
+            	}
109
+            	$blogHandler->insert($blog_obj);
110
+            	$blogs[] = $blog_obj->getVar('blog_id');
111
+            	unset($blog_obj);
112
+        	}
113
+        	if (!empty(Request::getArray('categories', [], 'POST'))) {
114
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
115
+            	foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
116
+                	$categoryHandler->addBlogs($cat_id, $blogs);
117
+            	}
118
+        	}
119
+        	$message = planet_constant('AM_DBUPDATED');
120
+        	redirect_header('admin.blog.php', 2, $message);
121
+
122
+    	/* update a list of blogs */
123
+    	// no break
124
+    	case 'update':
125
+        	foreach ($blog_id as $bid) {
126
+            	$blog_obj = $blogHandler->fetch($bid);
127
+            	if (!$blogHandler->insert($blog_obj)) {
128
+            	}
129
+            	unset($blog_obj);
130
+        	}
131
+        	$message = planet_constant('AM_DBUPDATED');
132
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
133
+
134
+    	/* add a list of blogs to a category */
135
+    	// no break
136
+    	case 'register':
137
+        	if (!empty(Request::getArray('category_dest', [], 'POST'))) {
138
+            	if (!is_array($blog_id)) {
139
+                	$blog_id = [$blog_id];
140
+            	}
141
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
142
+            	$categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
143
+        	}
144
+        	$message = planet_constant('AM_DBUPDATED');
145
+        	redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
146
+
147
+    	/* remove a list of blogs from a category */
148
+    	// no break
149
+    	case 'remove':
150
+        	if (!is_array($blog_id)) {
151
+            	$blog_id = [$blog_id];
152
+        	}
153
+        	if (!empty($category_id)) {
154
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
155
+            	$categoryHandler->removeBlogs($category_id, $blog_id);
156
+        	}
157
+        	$message = planet_constant('AM_DBUPDATED');
158
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
159
+
160
+    	/* delete a single blog or a list blogs */
161
+    	// no break
162
+    	case 'del':
163
+        	if (!is_array($blog_id)) {
164
+            	$blog_id = [$blog_id];
165
+        	}
166
+        	foreach ($blog_id as $bid) {
167
+            	$blog_obj = $blogHandler->get($bid);
168
+            	if (!$blogHandler->delete($blog_obj, true)) {
169
+            	}
170
+            	unset($blog_obj);
171
+        	}
172
+        	$message = planet_constant('AM_DBUPDATED');
173
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
174
+
175
+    	/* empty a single blog or a list blogs */
176
+    	// no break
177
+    	case 'empty':
178
+        	if (!is_array($blog_id)) {
179
+            	$blog_id = [$blog_id];
180
+        	}
181
+        	foreach ($blog_id as $bid) {
182
+            	$blog_obj = $blogHandler->get($bid);
183
+            	if (!$blogHandler->do_empty($blog_obj)) {
184
+            	}
185
+        	}
186
+        	$message = planet_constant('AM_DBUPDATED');
187
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
188
+
189
+    	/* approve a single blog or a list blogs */
190
+    	// no break
191
+    	case 'approve':
192
+        	if (!is_array($blog_id)) {
193
+            	$blog_id = [$blog_id];
194
+        	}
195
+        	$criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
196
+        	$blogHandler->updateAll('blog_status', 1, $criteria, true);
197
+        	$message = planet_constant('AM_DBUPDATED');
198
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
199
+
200
+    	/* mark a single blog or a list blogs as featured */
201
+    	// no break
202
+    	case 'feature':
203
+        	if (!is_array($blog_id)) {
204
+            	$blog_id = [$blog_id];
205
+        	}
206
+        	$criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
207
+        	$blogHandler->updateAll('blog_status', 2, $criteria, true);
208
+        	$message = planet_constant('AM_DBUPDATED');
209
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
210
+
211
+    	/* edit a single blog */
212
+    	// no break
213
+    	case 'edit':
214
+        	if (!empty(Request::getString('fetch', '', 'POST'))) {
215
+            	$blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
216
+            	$blog_obj->setVar('blog_id', $blog_id);
217
+        	} else {
218
+            	$blog_obj = $blogHandler->get($blog_id);
219
+        	}
220
+        	$categories = Request::getArray('categories', [], 'POST');
221
+        	if (empty($categories) && $blog_id > 0) {
222
+            	$crit       = new \Criteria('bc.blog_id', $blog_id);
223
+            	$categories = array_keys($categoryHandler->getByBlog($crit));
224
+        	}
225
+        	if (empty($categories)) {
226
+            	$categories = [0 => _NONE];
227
+        	}
228
+
229
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
230
+        	echo '<br>';
231
+        	if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
232
+            	$criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
233
+            	$blogs_obj = $blogHandler->getList($criteria);
234
+            	if (count($blogs_obj) > 0) {
235
+                	echo '<div class="errorMsg">' . planet_constant('AM_BLOGEXISTS');
236
+                	foreach (array_keys($blogs_obj) as $bid) {
237
+                    	echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
238
+                	}
239
+                	echo '</div>';
240
+            	}
241
+            	unset($blogs_obj, $criteria);
242
+        	}
243
+        	include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
244
+        	echo '</fieldset>';
245
+        	break;
246
+
247
+    	default:
248
+
249
+        	$crit = new \Criteria('1', 1);
250
+        	$crit->setSort('cat_order');
251
+        	$crit->setOrder('ASC');
252
+        	$categories = $categoryHandler->getList($crit);
253
+
254
+        	// Display category option form
255
+        	$opform    = new \XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
256
+        	$op_select = new \XoopsFormSelect('', 'category', $category_id);
257
+        	$op_select->setExtra('onchange="document.forms.opform.submit()"');
258
+        	$options = [
259
+            	'0'  => _ALL,
260
+            	'-1' => planet_constant('MD_ACTIVE'),
261
+            	'-2' => planet_constant('MD_FEATURED'),
262
+            	'-3' => planet_constant('MD_PENDING')
263
+        	];
264
+        	foreach (array_keys($categories) as $key) {
265
+            	$options[$key] = $categories[$key];
266
+        	}
267
+        	$op_select->addOptionArray($options);
268
+        	$opform->addElement($op_select);
269
+        	$opform->display();
270
+
271
+        	if ($category_id > 0) {
272
+            	$criteria = new \CriteriaCompo(new \Criteria('b.blog_status', 0, '>'));
273
+            	$criteria->add(new \Criteria('bc.cat_id', $category_id));
274
+            	$blog_count = $blogHandler->getCountByCategory($criteria);
275
+            	$criteria->setStart($start);
276
+            	$criteria->setLimit($helper->getConfig('list_perpage'));
277
+            	$blog_objs = $blogHandler->getByCategory($criteria);
278
+        	} else {
279
+            	/* All active blogs */
280
+            	if (0 == $category_id) {
281
+                	$criteria = new \Criteria('1', 1);
282
+                	$criteria->setStart($start);
283
+                	$criteria->setLimit($helper->getConfig('list_perpage'));
284
+            	/* Active blogs */
285
+            	} elseif (-1 == $category_id) {
286
+                	$criteria = new \Criteria('blog_status', 1);
287
+                	$criteria->setStart($start);
288
+                	$criteria->setLimit($helper->getConfig('list_perpage'));
289
+            	/* Featured blogs */
290
+            	} elseif (-2 == $category_id) {
291
+                	$criteria = new \Criteria('blog_status', 2);
292
+                	$criteria->setStart($start);
293
+                	$criteria->setLimit($helper->getConfig('list_perpage'));
294
+            	/* Pending blogs */
295
+            	} else {
296
+                	$criteria = new \Criteria('blog_status', 0);
297
+                	$criteria->setStart($start);
298
+                	$criteria->setLimit($helper->getConfig('list_perpage'));
299
+            	}
300
+            	$blog_count = $blogHandler->getCount($criteria);
301
+            	$blog_objs  = $blogHandler->getAll($criteria);
302
+        	}
303
+
304
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
305
+        	echo '<br style="clear:both">';
306
+
307
+        	echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
308
+        	echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
309
+        	echo "<tr align='center'>";
310
+        	echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
311
+        	echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
312
+        	echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
313
+        	echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
314
+        	//        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
315
+        	//        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
316
+        	echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
317
+        	echo '</tr>';
318
+
319
+        	$status = [
320
+            	'0' => planet_constant('MD_PENDING'),
321
+            	'1' => planet_constant('MD_ACTIVE'),
322
+            	'2' => planet_constant('MD_FEATURED')
323
+        	];
324
+        	foreach (array_keys($blog_objs) as $bid) {
325
+            	echo "<tr class='odd' align='left'>";
326
+            	echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
327
+            	echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
328
+            	echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
329
+            	echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
330
+            	echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
331 331
                       <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
332 332
                       <a href='admin.blog.php?op=empty&amp;blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>';
333 333
 
334
-            echo '</tr>';
335
-        }
336
-        echo "<tr class='even' align='center'>";
337
-        echo "<td colspan='7'>";
338
-        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
339
-        echo "<option value=''>" . _SELECT . '</option>';
340
-        echo "<option value='del'>" . _DELETE . '</option>';
341
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
342
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
343
-        if ($category_id > 0) {
344
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
345
-        }
346
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
347
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
348
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
349
-
350
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
351
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
352
-
353
-        echo '</select>';
354
-        echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
355
-        echo "<select name='category_dest'>";
356
-        echo "<option value=''>" . _SELECT . '</option>';
357
-        foreach ($categories as $cid => $name) {
358
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
359
-        }
360
-        echo '</select>';
361
-        echo '</div>';
362
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
363
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
364
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
365
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
366
-        echo '</td>';
367
-        echo '</tr>';
368
-        if ($blog_count > $helper->getConfig('list_perpage')) {
369
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
370
-            $nav     = new \XoopsPageNav($blog_count, $helper->getConfig('list_perpage'), $start, 'start', 'category=' . $category_id);
371
-            $pagenav = $nav->renderNav(4);
372
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
373
-        }
374
-        echo '</table></form>';
375
-        echo "</fieldset><br style='clear:both;'>";
376
-
377
-        if (empty($start) && empty($category_id)) {
378
-            $form = new \XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
379
-            $form->addElement(new \XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
380
-            $form->addElement(new \XoopsFormHidden('op', 'edit'));
381
-            $button_tray = new \XoopsFormElementTray('', '');
382
-            $butt_save   = new \XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
383
-            $button_tray->addElement($butt_save);
384
-            $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
385
-            $button_tray->addElement($butt_cancel);
386
-            $form->addElement($button_tray);
387
-
388
-            $form_add = new \XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
389
-            $form_add->addElement(new \XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
390
-            $form_add->addElement(new \XoopsFormHidden('op', 'add'));
391
-            $button_tray = new \XoopsFormElementTray('', '');
392
-            $butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
393
-            $button_tray->addElement($butt_save);
394
-            $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
395
-            $button_tray->addElement($butt_cancel);
396
-            $form_add->addElement($button_tray);
397
-
398
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
399
-            echo '<br>';
400
-            $form->display();
401
-            $form_add->display();
402
-            echo '</fieldset>';
403
-        }
404
-        break;
334
+            	echo '</tr>';
335
+        	}
336
+        	echo "<tr class='even' align='center'>";
337
+        	echo "<td colspan='7'>";
338
+        	echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
339
+        	echo "<option value=''>" . _SELECT . '</option>';
340
+        	echo "<option value='del'>" . _DELETE . '</option>';
341
+        	echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
342
+        	echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
343
+        	if ($category_id > 0) {
344
+            	echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
345
+        	}
346
+        	echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
347
+        	echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
348
+        	echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
349
+
350
+        	echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
351
+        	echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
352
+
353
+        	echo '</select>';
354
+        	echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
355
+        	echo "<select name='category_dest'>";
356
+        	echo "<option value=''>" . _SELECT . '</option>';
357
+        	foreach ($categories as $cid => $name) {
358
+            	echo "<option value='" . $cid . "'>" . $name . '</option>';
359
+        	}
360
+        	echo '</select>';
361
+        	echo '</div>';
362
+        	echo "<input name='start' value='" . $start . "' type='hidden'>";
363
+        	echo "<input name='category' value='" . $category_id . "' type='hidden'>";
364
+        	echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
365
+        	echo "<input name='' value='" . _CANCEL . "' type='reset'>";
366
+        	echo '</td>';
367
+        	echo '</tr>';
368
+        	if ($blog_count > $helper->getConfig('list_perpage')) {
369
+            	include XOOPS_ROOT_PATH . '/class/pagenav.php';
370
+            	$nav     = new \XoopsPageNav($blog_count, $helper->getConfig('list_perpage'), $start, 'start', 'category=' . $category_id);
371
+            	$pagenav = $nav->renderNav(4);
372
+            	echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
373
+        	}
374
+        	echo '</table></form>';
375
+        	echo "</fieldset><br style='clear:both;'>";
376
+
377
+        	if (empty($start) && empty($category_id)) {
378
+            	$form = new \XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
379
+            	$form->addElement(new \XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
380
+            	$form->addElement(new \XoopsFormHidden('op', 'edit'));
381
+            	$button_tray = new \XoopsFormElementTray('', '');
382
+            	$butt_save   = new \XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
383
+            	$button_tray->addElement($butt_save);
384
+            	$butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
385
+            	$button_tray->addElement($butt_cancel);
386
+            	$form->addElement($button_tray);
387
+
388
+            	$form_add = new \XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
389
+            	$form_add->addElement(new \XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
390
+            	$form_add->addElement(new \XoopsFormHidden('op', 'add'));
391
+            	$button_tray = new \XoopsFormElementTray('', '');
392
+            	$butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
393
+            	$button_tray->addElement($butt_save);
394
+            	$butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
395
+            	$button_tray->addElement($butt_cancel);
396
+            	$form_add->addElement($button_tray);
397
+
398
+            	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
399
+            	echo '<br>';
400
+            	$form->display();
401
+            	$form_add->display();
402
+            	echo '</fieldset>';
403
+        	}
404
+        	break;
405 405
 }
406 406
 
407 407
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 /** @var Planet\Helper $helper */
30 30
 $helper = Planet\Helper::getInstance();
31 31
 
32
-require_once __DIR__ . '/admin_header.php';
33
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
32
+require_once __DIR__.'/admin_header.php';
33
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
34 34
 
35 35
 xoops_cp_header();
36 36
 $adminObject = \Xmf\Module\Admin::getInstance();
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
  * This is a tricky fix for incomplete solution of module cone
43 43
  * it is expected to have a better solution in article 1.0
44 44
  */
45
-require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
45
+require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
46 46
 //planet_adminmenu(2);
47 47
 
48
-$op          = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
49
-$blog_id     = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
50
-$blog_id     = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id;
51
-$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET');//(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0));
52
-$start       = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET');//(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0));
48
+$op          = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
49
+$blog_id     = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
50
+$blog_id     = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id;
51
+$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET'); //(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0));
52
+$start       = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET'); //(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0));
53 53
 
54 54
 $blogHandler     = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
55 55
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         if ($blog_id) {
66 66
             $blog_obj = $blogHandler->get($blog_id);
67
-        } else {
67
+        }else {
68 68
             if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
69 69
                 redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
70 70
             }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             unset($blog_obj);
130 130
         }
131 131
         $message = planet_constant('AM_DBUPDATED');
132
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
132
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
133 133
 
134 134
     /* add a list of blogs to a category */
135 135
     // no break
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
143 143
         }
144 144
         $message = planet_constant('AM_DBUPDATED');
145
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
145
+        redirect_header('admin.blog.php?category='.Request::getArray('category_dest', [], 'POST').'&amp;start='.$start, 2, $message);
146 146
 
147 147
     /* remove a list of blogs from a category */
148 148
     // no break
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $categoryHandler->removeBlogs($category_id, $blog_id);
156 156
         }
157 157
         $message = planet_constant('AM_DBUPDATED');
158
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
158
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
159 159
 
160 160
     /* delete a single blog or a list blogs */
161 161
     // no break
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             unset($blog_obj);
171 171
         }
172 172
         $message = planet_constant('AM_DBUPDATED');
173
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
173
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
174 174
 
175 175
     /* empty a single blog or a list blogs */
176 176
     // no break
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             }
185 185
         }
186 186
         $message = planet_constant('AM_DBUPDATED');
187
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
187
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
188 188
 
189 189
     /* approve a single blog or a list blogs */
190 190
     // no break
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
         if (!is_array($blog_id)) {
193 193
             $blog_id = [$blog_id];
194 194
         }
195
-        $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
195
+        $criteria = new \Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN');
196 196
         $blogHandler->updateAll('blog_status', 1, $criteria, true);
197 197
         $message = planet_constant('AM_DBUPDATED');
198
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
198
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
199 199
 
200 200
     /* mark a single blog or a list blogs as featured */
201 201
     // no break
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
         if (!is_array($blog_id)) {
204 204
             $blog_id = [$blog_id];
205 205
         }
206
-        $criteria = new \Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
206
+        $criteria = new \Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN');
207 207
         $blogHandler->updateAll('blog_status', 2, $criteria, true);
208 208
         $message = planet_constant('AM_DBUPDATED');
209
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
209
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
210 210
 
211 211
     /* edit a single blog */
212 212
     // no break
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
         if (!empty(Request::getString('fetch', '', 'POST'))) {
215 215
             $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
216 216
             $blog_obj->setVar('blog_id', $blog_id);
217
-        } else {
217
+        }else {
218 218
             $blog_obj = $blogHandler->get($blog_id);
219 219
         }
220 220
         $categories = Request::getArray('categories', [], 'POST');
221
-        if (empty($categories) && $blog_id > 0) {
221
+        if (empty($categories) && $blog_id>0) {
222 222
             $crit       = new \Criteria('bc.blog_id', $blog_id);
223 223
             $categories = array_keys($categoryHandler->getByBlog($crit));
224 224
         }
@@ -226,21 +226,21 @@  discard block
 block discarded – undo
226 226
             $categories = [0 => _NONE];
227 227
         }
228 228
 
229
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
229
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>';
230 230
         echo '<br>';
231 231
         if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
232 232
             $criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
233 233
             $blogs_obj = $blogHandler->getList($criteria);
234
-            if (count($blogs_obj) > 0) {
235
-                echo '<div class="errorMsg">' . planet_constant('AM_BLOGEXISTS');
234
+            if (count($blogs_obj)>0) {
235
+                echo '<div class="errorMsg">'.planet_constant('AM_BLOGEXISTS');
236 236
                 foreach (array_keys($blogs_obj) as $bid) {
237
-                    echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
237
+                    echo '<br><a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid.'" target="_blank">'.$blogs_obj[$bid].'</a>';
238 238
                 }
239 239
                 echo '</div>';
240 240
             }
241 241
             unset($blogs_obj, $criteria);
242 242
         }
243
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
243
+        include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php';
244 244
         echo '</fieldset>';
245 245
         break;
246 246
 
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
         $opform->addElement($op_select);
269 269
         $opform->display();
270 270
 
271
-        if ($category_id > 0) {
271
+        if ($category_id>0) {
272 272
             $criteria = new \CriteriaCompo(new \Criteria('b.blog_status', 0, '>'));
273 273
             $criteria->add(new \Criteria('bc.cat_id', $category_id));
274 274
             $blog_count = $blogHandler->getCountByCategory($criteria);
275 275
             $criteria->setStart($start);
276 276
             $criteria->setLimit($helper->getConfig('list_perpage'));
277 277
             $blog_objs = $blogHandler->getByCategory($criteria);
278
-        } else {
278
+        }else {
279 279
             /* All active blogs */
280 280
             if (0 == $category_id) {
281 281
                 $criteria = new \Criteria('1', 1);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                 $criteria->setStart($start);
293 293
                 $criteria->setLimit($helper->getConfig('list_perpage'));
294 294
             /* Pending blogs */
295
-            } else {
295
+            }else {
296 296
                 $criteria = new \Criteria('blog_status', 0);
297 297
                 $criteria->setStart($start);
298 298
                 $criteria->setLimit($helper->getConfig('list_perpage'));
@@ -301,19 +301,19 @@  discard block
 block discarded – undo
301 301
             $blog_objs  = $blogHandler->getAll($criteria);
302 302
         }
303 303
 
304
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
304
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_LIST').'</legend>';
305 305
         echo '<br style="clear:both">';
306 306
 
307
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
307
+        echo "<form name='list' id='list' method='post' action='".xoops_getenv('PHP_SELF')."'>";
308 308
         echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
309 309
         echo "<tr align='center'>";
310 310
         echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
311
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
312
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
313
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
+        echo "<th class='bg3'>".planet_constant('AM_TITLE').'</td>';
312
+        echo "<th class='bg3' width='5%'>".planet_constant('AM_STATUS').'</td>';
313
+        echo "<th class='bg3' width='40%'>".planet_constant('AM_FEED').'</td>';
314 314
         //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
315 315
         //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
316
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
316
+        echo "<th class='bg3' width='10%'>".planet_constant('AM_ACTIONS').'</td>';
317 317
         echo '</tr>';
318 318
 
319 319
         $status = [
@@ -323,53 +323,53 @@  discard block
 block discarded – undo
323 323
         ];
324 324
         foreach (array_keys($blog_objs) as $bid) {
325 325
             echo "<tr class='odd' align='left'>";
326
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
327
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
328
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
329
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
330
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
331
-                      <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
332
-                      <a href='admin.blog.php?op=empty&amp;blog=" . $bid . "' title='" . planet_constant('MD_EMPTY_BLOG') . "'><img src='" . $pathIcon16 . "/empty.png '" . " alt='" . _EDIT . " title='" . planet_constant('MD_EMPTY_BLOG') . '</a></td>';
326
+            echo "<td align='center'><input name='blog[]' value='".$bid."' type='checkbox'></td>";
327
+            echo "<td><a href='".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."'>".$blog_objs[$bid]->getVar('blog_title').'</a></td>';
328
+            echo "<td align='center'>".$status[$blog_objs[$bid]->getVar('blog_status')].'</td>';
329
+            echo '<td>'.$blog_objs[$bid]->getVar('blog_feed').'</td>';
330
+            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=".$bid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT." title='"._EDIT." </a>
331
+                      <a href='admin.blog.php?op=del&amp;blog=" . $bid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT." title='"._DELETE." </a>&nbsp;
332
+                      <a href='admin.blog.php?op=empty&amp;blog=" . $bid."' title='".planet_constant('MD_EMPTY_BLOG')."'><img src='".$pathIcon16."/empty.png '"." alt='"._EDIT." title='".planet_constant('MD_EMPTY_BLOG').'</a></td>';
333 333
 
334 334
             echo '</tr>';
335 335
         }
336 336
         echo "<tr class='even' align='center'>";
337 337
         echo "<td colspan='7'>";
338 338
         echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
339
-        echo "<option value=''>" . _SELECT . '</option>';
340
-        echo "<option value='del'>" . _DELETE . '</option>';
341
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
342
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
343
-        if ($category_id > 0) {
344
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
339
+        echo "<option value=''>"._SELECT.'</option>';
340
+        echo "<option value='del'>"._DELETE.'</option>';
341
+        echo "<option value='empty'>".planet_constant('MD_EMPTY_BLOG').'</option>';
342
+        echo "<option value='register'>".planet_constant('AM_REGISTER').'</option>';
343
+        if ($category_id>0) {
344
+            echo "<option value='remove'>".planet_constant('AM_REMOVE').'</option>';
345 345
         }
346
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
347
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
348
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
+        echo "<option value='approve'>".planet_constant('AM_APPROVE').'</option>';
347
+        echo "<option value='feature'>".planet_constant('AM_FEATURE').'</option>';
348
+        echo "<option value='update'>".planet_constant('AM_UPDATE').'</option>';
349 349
 
350
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
351
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
350
+        echo "<option value='pending'>".planet_constant('AM_PENDING').'</option>';
351
+        echo "<option value='active'>".planet_constant('AM_ACTIVE').'</option>';
352 352
 
353 353
         echo '</select>';
354 354
         echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
355 355
         echo "<select name='category_dest'>";
356
-        echo "<option value=''>" . _SELECT . '</option>';
356
+        echo "<option value=''>"._SELECT.'</option>';
357 357
         foreach ($categories as $cid => $name) {
358
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
358
+            echo "<option value='".$cid."'>".$name.'</option>';
359 359
         }
360 360
         echo '</select>';
361 361
         echo '</div>';
362
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
363
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
364
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
365
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
362
+        echo "<input name='start' value='".$start."' type='hidden'>";
363
+        echo "<input name='category' value='".$category_id."' type='hidden'>";
364
+        echo "<input name='submit' value='"._SUBMIT."' type='submit'>";
365
+        echo "<input name='' value='"._CANCEL."' type='reset'>";
366 366
         echo '</td>';
367 367
         echo '</tr>';
368
-        if ($blog_count > $helper->getConfig('list_perpage')) {
369
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
370
-            $nav     = new \XoopsPageNav($blog_count, $helper->getConfig('list_perpage'), $start, 'start', 'category=' . $category_id);
368
+        if ($blog_count>$helper->getConfig('list_perpage')) {
369
+            include XOOPS_ROOT_PATH.'/class/pagenav.php';
370
+            $nav     = new \XoopsPageNav($blog_count, $helper->getConfig('list_perpage'), $start, 'start', 'category='.$category_id);
371 371
             $pagenav = $nav->renderNav(4);
372
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
372
+            echo "<tr align='right'><td colspan='6'>".$pagenav.'</td></tr>';
373 373
         }
374 374
         echo '</table></form>';
375 375
         echo "</fieldset><br style='clear:both;'>";
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
             $button_tray->addElement($butt_cancel);
396 396
             $form_add->addElement($button_tray);
397 397
 
398
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
398
+            echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD.'</legend>';
399 399
             echo '<br>';
400 400
             $form->display();
401 401
             $form_add->display();
Please login to merge, or discard this patch.
admin/admin.category.php 2 patches
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -41,136 +41,136 @@
 block discarded – undo
41 41
 $blogHandler     = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
42 42
 
43 43
 switch ($op) {
44
-    case 'save':
45
-        if ($cat_id) {
46
-            $category_obj = $categoryHandler->get($cat_id);
47
-        } else {
48
-            $category_obj = $categoryHandler->create();
49
-        }
50
-
51
-        $category_obj->setVar('cat_title', $_POST['cat_title']);
52
-        $category_obj->setVar('cat_order', $_POST['cat_order']);
53
-
54
-        if (!$categoryHandler->insert($category_obj)) {
55
-            $message = planet_constant('AM_ERROR');
56
-        } else {
57
-            $message = planet_constant('AM_DBUPDATED');
58
-        }
59
-        redirect_header('admin.category.php', 2, $message);
60
-
61
-        // no break
62
-    case 'del':
63
-        if (!is_array($cat_id)) {
64
-            $cat_id = [$cat_id];
65
-        }
66
-        foreach ($cat_id as $cid) {
67
-            $category_obj = $categoryHandler->get($cid);
68
-            if (!$categoryHandler->delete($category_obj)) {
69
-            }
70
-        }
71
-        $message = planet_constant('AM_DBUPDATED');
72
-        redirect_header('admin.category.php', 2, $message);
73
-
74
-        // no break
75
-    case 'order':
76
-        $count = count($_POST['cat_order']);
77
-        for ($i = 0; $i < $count; ++$i) {
78
-            $category_obj = $categoryHandler->get($_POST['cat'][$i]);
79
-            $category_obj->setVar('cat_order', $_POST['cat_order'][$i]);
80
-            $categoryHandler->insert($category_obj, true);
81
-            unset($category_obj);
82
-        }
83
-        $message = planet_constant('AM_DBUPDATED');
84
-        redirect_header('admin.category.php', 2, $message);
85
-
86
-        // no break
87
-    case 'edit':
88
-        $category_obj = $categoryHandler->get($cat_id);
89
-        $form         = new \XoopsThemeForm(_EDIT, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
90
-        $form->addElement(new \XoopsFormText(planet_constant('AM_TITLE'), 'cat_title', 50, 80, $category_obj->getVar('cat_title', 'E')), true);
91
-        $form->addElement(new \XoopsFormText(planet_constant('AM_ORDER'), 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false);
92
-        $form->addElement(new \XoopsFormHidden('category', $cat_id));
93
-        $form->addElement(new \XoopsFormHidden('op', 'save'));
94
-
95
-        $button_tray = new \XoopsFormElementTray('', '');
96
-        $butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
97
-        $button_tray->addElement($butt_save);
98
-        $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
99
-        $button_tray->addElement($butt_cancel);
100
-        $form->addElement($button_tray);
101
-
102
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
103
-        echo '<br>';
104
-        $form->display();
105
-        echo '</fieldset>';
106
-        break;
107
-
108
-    default:
109
-        $crit = new \Criteria('1', 1);
110
-        $crit->setSort('cat_order');
111
-        $crit->setOrder('ASC');
112
-        $categories  = $categoryHandler->getList($crit);
113
-        $blog_counts = $blogHandler->getCountsByCategory();
114
-        foreach (array_keys($categories) as $cid) {
115
-            if (!empty($blog_counts[$cid])) {
116
-                $categories[$cid] .= ' (' . (int)$blog_counts[$cid] . ')';
117
-            }
118
-        }
119
-
120
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
121
-        echo '<br style="clear:both;">';
122
-
123
-        echo "<form name='list' method='post'>";
124
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
125
-        echo "<tr align='center'>";
126
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_ORDER') . '</td>';
127
-        echo "<th align='left' class='bg3' width='80%'>" . planet_constant('AM_TITLE') . '</td>';
128
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_BLOGCOUNT') . '</td>';
129
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_ACTIONS') . '</td>';
130
-        //        echo "<td class='bg3' width='5%'>" . _DELETE . "</td>";
131
-
132
-        echo '</tr>';
133
-
134
-        $ii = 0;
135
-        foreach (array_keys($categories) as $cid) {
136
-            echo "<tr class='odd' align='left'>";
137
-            echo "<td><input type='hidden' name='cat[]' value='" . $cid . "'>";
138
-            echo "<input type='text' name='cat_order[]' value='" . ($ii * 10) . "'></td>";
139
-            echo '<td>' . $categories[$cid] . '</td>';
140
-            echo "<td align='center'>" . @$blog_counts[$cid] . '</td>';
141
-
142
-            echo "<td align='center'><a href='admin.category.php?op=edit &amp;category='" . $cid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . "' title='" . _EDIT . "' </a>&nbsp;
44
+	case 'save':
45
+		if ($cat_id) {
46
+			$category_obj = $categoryHandler->get($cat_id);
47
+		} else {
48
+			$category_obj = $categoryHandler->create();
49
+		}
50
+
51
+		$category_obj->setVar('cat_title', $_POST['cat_title']);
52
+		$category_obj->setVar('cat_order', $_POST['cat_order']);
53
+
54
+		if (!$categoryHandler->insert($category_obj)) {
55
+			$message = planet_constant('AM_ERROR');
56
+		} else {
57
+			$message = planet_constant('AM_DBUPDATED');
58
+		}
59
+		redirect_header('admin.category.php', 2, $message);
60
+
61
+		// no break
62
+	case 'del':
63
+		if (!is_array($cat_id)) {
64
+			$cat_id = [$cat_id];
65
+		}
66
+		foreach ($cat_id as $cid) {
67
+			$category_obj = $categoryHandler->get($cid);
68
+			if (!$categoryHandler->delete($category_obj)) {
69
+			}
70
+		}
71
+		$message = planet_constant('AM_DBUPDATED');
72
+		redirect_header('admin.category.php', 2, $message);
73
+
74
+		// no break
75
+	case 'order':
76
+		$count = count($_POST['cat_order']);
77
+		for ($i = 0; $i < $count; ++$i) {
78
+			$category_obj = $categoryHandler->get($_POST['cat'][$i]);
79
+			$category_obj->setVar('cat_order', $_POST['cat_order'][$i]);
80
+			$categoryHandler->insert($category_obj, true);
81
+			unset($category_obj);
82
+		}
83
+		$message = planet_constant('AM_DBUPDATED');
84
+		redirect_header('admin.category.php', 2, $message);
85
+
86
+		// no break
87
+	case 'edit':
88
+		$category_obj = $categoryHandler->get($cat_id);
89
+		$form         = new \XoopsThemeForm(_EDIT, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
90
+		$form->addElement(new \XoopsFormText(planet_constant('AM_TITLE'), 'cat_title', 50, 80, $category_obj->getVar('cat_title', 'E')), true);
91
+		$form->addElement(new \XoopsFormText(planet_constant('AM_ORDER'), 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false);
92
+		$form->addElement(new \XoopsFormHidden('category', $cat_id));
93
+		$form->addElement(new \XoopsFormHidden('op', 'save'));
94
+
95
+		$button_tray = new \XoopsFormElementTray('', '');
96
+		$butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
97
+		$button_tray->addElement($butt_save);
98
+		$butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
99
+		$button_tray->addElement($butt_cancel);
100
+		$form->addElement($button_tray);
101
+
102
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
103
+		echo '<br>';
104
+		$form->display();
105
+		echo '</fieldset>';
106
+		break;
107
+
108
+	default:
109
+		$crit = new \Criteria('1', 1);
110
+		$crit->setSort('cat_order');
111
+		$crit->setOrder('ASC');
112
+		$categories  = $categoryHandler->getList($crit);
113
+		$blog_counts = $blogHandler->getCountsByCategory();
114
+		foreach (array_keys($categories) as $cid) {
115
+			if (!empty($blog_counts[$cid])) {
116
+				$categories[$cid] .= ' (' . (int)$blog_counts[$cid] . ')';
117
+			}
118
+		}
119
+
120
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
121
+		echo '<br style="clear:both;">';
122
+
123
+		echo "<form name='list' method='post'>";
124
+		echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
125
+		echo "<tr align='center'>";
126
+		echo "<th class='bg3' width='5%'>" . planet_constant('AM_ORDER') . '</td>';
127
+		echo "<th align='left' class='bg3' width='80%'>" . planet_constant('AM_TITLE') . '</td>';
128
+		echo "<th class='bg3' width='5%'>" . planet_constant('AM_BLOGCOUNT') . '</td>';
129
+		echo "<th class='bg3' width='5%'>" . planet_constant('AM_ACTIONS') . '</td>';
130
+		//        echo "<td class='bg3' width='5%'>" . _DELETE . "</td>";
131
+
132
+		echo '</tr>';
133
+
134
+		$ii = 0;
135
+		foreach (array_keys($categories) as $cid) {
136
+			echo "<tr class='odd' align='left'>";
137
+			echo "<td><input type='hidden' name='cat[]' value='" . $cid . "'>";
138
+			echo "<input type='text' name='cat_order[]' value='" . ($ii * 10) . "'></td>";
139
+			echo '<td>' . $categories[$cid] . '</td>';
140
+			echo "<td align='center'>" . @$blog_counts[$cid] . '</td>';
141
+
142
+			echo "<td align='center'><a href='admin.category.php?op=edit &amp;category='" . $cid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . "' title='" . _EDIT . "' </a>&nbsp;
143 143
                   <a href='admin.category.php?op=del &amp;category='" . $cid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . "' title='" . _DELETE . "' </a></td>";
144
-            echo '</tr>';
145
-            ++$ii;
146
-        }
147
-        echo "<tr class='even' align='center'>";
148
-        echo "<td colspan='5'>";
149
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
150
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
151
-        echo "<input name='op' value='order' type='hidden'>";
152
-        echo '</td>';
153
-        echo '</tr>';
154
-        echo '</table></form>';
155
-        echo "</fieldset><br style='clear:both;'>";
156
-
157
-        $form = new \XoopsThemeForm(_ADD, 'mod', xoops_getenv('PHP_SELF'), 'post', true);
158
-        $form->addElement(new \XoopsFormText(planet_constant('AM_TITLE'), 'cat_title', 50, 80), true);
159
-        $form->addElement(new \XoopsFormText(planet_constant('AM_ORDER'), 'cat_order', 5, 10), false);
160
-        $form->addElement(new \XoopsFormHidden('op', 'save'));
161
-
162
-        $button_tray = new \XoopsFormElementTray('', '');
163
-        $butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
164
-        $button_tray->addElement($butt_save);
165
-        $butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
166
-        $button_tray->addElement($butt_cancel);
167
-        $form->addElement($button_tray);
168
-
169
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
170
-        echo '<br>';
171
-        $form->display();
172
-        echo '</fieldset>';
173
-        break;
144
+			echo '</tr>';
145
+			++$ii;
146
+		}
147
+		echo "<tr class='even' align='center'>";
148
+		echo "<td colspan='5'>";
149
+		echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
150
+		echo "<input name='' value='" . _CANCEL . "' type='reset'>";
151
+		echo "<input name='op' value='order' type='hidden'>";
152
+		echo '</td>';
153
+		echo '</tr>';
154
+		echo '</table></form>';
155
+		echo "</fieldset><br style='clear:both;'>";
156
+
157
+		$form = new \XoopsThemeForm(_ADD, 'mod', xoops_getenv('PHP_SELF'), 'post', true);
158
+		$form->addElement(new \XoopsFormText(planet_constant('AM_TITLE'), 'cat_title', 50, 80), true);
159
+		$form->addElement(new \XoopsFormText(planet_constant('AM_ORDER'), 'cat_order', 5, 10), false);
160
+		$form->addElement(new \XoopsFormHidden('op', 'save'));
161
+
162
+		$button_tray = new \XoopsFormElementTray('', '');
163
+		$butt_save   = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
164
+		$button_tray->addElement($butt_save);
165
+		$butt_cancel = new \XoopsFormButton('', '', _CANCEL, 'reset');
166
+		$button_tray->addElement($butt_cancel);
167
+		$form->addElement($button_tray);
168
+
169
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
170
+		echo '<br>';
171
+		$form->display();
172
+		echo '</fieldset>';
173
+		break;
174 174
 }
175 175
 
176 176
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -24,18 +24,18 @@  discard block
 block discarded – undo
24 24
 // URL: https://xoops.org                         //
25 25
 // Project: Article Project                                                 //
26 26
 // ------------------------------------------------------------------------ //
27
-require_once __DIR__ . '/admin_header.php';
28
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
27
+require_once __DIR__.'/admin_header.php';
28
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
29 29
 
30 30
 xoops_cp_header();
31 31
 $adminObject = \Xmf\Module\Admin::getInstance();
32 32
 $adminObject->displayNavigation(basename(__FILE__));
33
-require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
33
+require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
34 34
 //planet_adminmenu(1);
35 35
 
36 36
 $op     = !empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
37 37
 $cat_id = !empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0);
38
-$cat_id = is_array($cat_id) ? array_map('intval', $cat_id) : (int)$cat_id;
38
+$cat_id = is_array($cat_id) ? array_map('intval', $cat_id) : (int) $cat_id;
39 39
 
40 40
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
41 41
 $blogHandler     = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     case 'save':
45 45
         if ($cat_id) {
46 46
             $category_obj = $categoryHandler->get($cat_id);
47
-        } else {
47
+        }else {
48 48
             $category_obj = $categoryHandler->create();
49 49
         }
50 50
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
         if (!$categoryHandler->insert($category_obj)) {
55 55
             $message = planet_constant('AM_ERROR');
56
-        } else {
56
+        }else {
57 57
             $message = planet_constant('AM_DBUPDATED');
58 58
         }
59 59
         redirect_header('admin.category.php', 2, $message);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         // no break
75 75
     case 'order':
76 76
         $count = count($_POST['cat_order']);
77
-        for ($i = 0; $i < $count; ++$i) {
77
+        for ($i = 0; $i<$count; ++$i) {
78 78
             $category_obj = $categoryHandler->get($_POST['cat'][$i]);
79 79
             $category_obj->setVar('cat_order', $_POST['cat_order'][$i]);
80 80
             $categoryHandler->insert($category_obj, true);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $button_tray->addElement($butt_cancel);
100 100
         $form->addElement($button_tray);
101 101
 
102
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
102
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>';
103 103
         echo '<br>';
104 104
         $form->display();
105 105
         echo '</fieldset>';
@@ -113,20 +113,20 @@  discard block
 block discarded – undo
113 113
         $blog_counts = $blogHandler->getCountsByCategory();
114 114
         foreach (array_keys($categories) as $cid) {
115 115
             if (!empty($blog_counts[$cid])) {
116
-                $categories[$cid] .= ' (' . (int)$blog_counts[$cid] . ')';
116
+                $categories[$cid] .= ' ('.(int) $blog_counts[$cid].')';
117 117
             }
118 118
         }
119 119
 
120
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
120
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_LIST').'</legend>';
121 121
         echo '<br style="clear:both;">';
122 122
 
123 123
         echo "<form name='list' method='post'>";
124 124
         echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
125 125
         echo "<tr align='center'>";
126
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_ORDER') . '</td>';
127
-        echo "<th align='left' class='bg3' width='80%'>" . planet_constant('AM_TITLE') . '</td>';
128
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_BLOGCOUNT') . '</td>';
129
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_ACTIONS') . '</td>';
126
+        echo "<th class='bg3' width='5%'>".planet_constant('AM_ORDER').'</td>';
127
+        echo "<th align='left' class='bg3' width='80%'>".planet_constant('AM_TITLE').'</td>';
128
+        echo "<th class='bg3' width='5%'>".planet_constant('AM_BLOGCOUNT').'</td>';
129
+        echo "<th class='bg3' width='5%'>".planet_constant('AM_ACTIONS').'</td>';
130 130
         //        echo "<td class='bg3' width='5%'>" . _DELETE . "</td>";
131 131
 
132 132
         echo '</tr>';
@@ -134,20 +134,20 @@  discard block
 block discarded – undo
134 134
         $ii = 0;
135 135
         foreach (array_keys($categories) as $cid) {
136 136
             echo "<tr class='odd' align='left'>";
137
-            echo "<td><input type='hidden' name='cat[]' value='" . $cid . "'>";
138
-            echo "<input type='text' name='cat_order[]' value='" . ($ii * 10) . "'></td>";
139
-            echo '<td>' . $categories[$cid] . '</td>';
140
-            echo "<td align='center'>" . @$blog_counts[$cid] . '</td>';
137
+            echo "<td><input type='hidden' name='cat[]' value='".$cid."'>";
138
+            echo "<input type='text' name='cat_order[]' value='".($ii*10)."'></td>";
139
+            echo '<td>'.$categories[$cid].'</td>';
140
+            echo "<td align='center'>".@$blog_counts[$cid].'</td>';
141 141
 
142
-            echo "<td align='center'><a href='admin.category.php?op=edit &amp;category='" . $cid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . "' title='" . _EDIT . "' </a>&nbsp;
143
-                  <a href='admin.category.php?op=del &amp;category='" . $cid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . "' title='" . _DELETE . "' </a></td>";
142
+            echo "<td align='center'><a href='admin.category.php?op=edit &amp;category='".$cid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT."' title='"._EDIT."' </a>&nbsp;
143
+                  <a href='admin.category.php?op=del &amp;category='" . $cid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT."' title='"._DELETE."' </a></td>";
144 144
             echo '</tr>';
145 145
             ++$ii;
146 146
         }
147 147
         echo "<tr class='even' align='center'>";
148 148
         echo "<td colspan='5'>";
149
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
150
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
149
+        echo "<input name='submit' value='"._SUBMIT."' type='submit'>";
150
+        echo "<input name='' value='"._CANCEL."' type='reset'>";
151 151
         echo "<input name='op' value='order' type='hidden'>";
152 152
         echo '</td>';
153 153
         echo '</tr>';
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $button_tray->addElement($butt_cancel);
167 167
         $form->addElement($button_tray);
168 168
 
169
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
169
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD.'</legend>';
170 170
         echo '<br>';
171 171
         $form->display();
172 172
         echo '</fieldset>';
Please login to merge, or discard this patch.
admin/admin_header.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@
 block discarded – undo
44 44
 $myts = \MyTextSanitizer::getInstance();
45 45
 
46 46
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
47
-    require_once $GLOBALS['xoops']->path('class/template.php');
48
-    $xoopsTpl = new \XoopsTpl();
47
+	require_once $GLOBALS['xoops']->path('class/template.php');
48
+	$xoopsTpl = new \XoopsTpl();
49 49
 }
50 50
 
51 51
 require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 use XoopsModules\Planet;
21 21
 
22 22
 $path = dirname(dirname(dirname(__DIR__)));
23
-require_once $path . '/mainfile.php';
24
-require_once $path . '/include/cp_functions.php';
25
-require_once $path . '/include/cp_header.php';
23
+require_once $path.'/mainfile.php';
24
+require_once $path.'/include/cp_functions.php';
25
+require_once $path.'/include/cp_header.php';
26 26
 // require_once __DIR__ . '/../class/Utility.php';
27 27
 
28 28
 // require_once __DIR__ . '/../class/Utility.php';
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
     $xoopsTpl = new \XoopsTpl();
49 49
 }
50 50
 
51
-require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
51
+require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
52 52
 //require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php';
53
-require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.admin.php';
53
+require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.admin.php';
54 54
 
55 55
 planet_define_url_delimiter();
Please login to merge, or discard this patch.
admin/admin.article.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 
47 47
 $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
48 48
 if (!empty($helper->getConfig('article_expire'))) {
49
-    $criteria = new \Criteria('art_time', time() - $helper->getConfig('article_expire') * 60 * 60 * 24, '<');
50
-    if (!empty($_GET['purge'])) {
51
-        $crit = new \CriteriaCompo($criteria);
52
-        $crit->add(new \Criteria('art_comments', 0));
53
-        $article_expires = $articleHandler->getObjects($criteria);
54
-        foreach ($article_expires as $id => $article_obj) {
55
-            $articleHandler->delete($article_obj);
56
-        }
57
-    }
58
-    $article_count_expire = $articleHandler->getCount($criteria);
49
+	$criteria = new \Criteria('art_time', time() - $helper->getConfig('article_expire') * 60 * 60 * 24, '<');
50
+	if (!empty($_GET['purge'])) {
51
+		$crit = new \CriteriaCompo($criteria);
52
+		$crit->add(new \Criteria('art_comments', 0));
53
+		$article_expires = $articleHandler->getObjects($criteria);
54
+		foreach ($article_expires as $id => $article_obj) {
55
+			$articleHandler->delete($article_obj);
56
+		}
57
+	}
58
+	$article_count_expire = $articleHandler->getCount($criteria);
59 59
 } else {
60
-    $article_count_expire = 0;
60
+	$article_count_expire = 0;
61 61
 }
62 62
 $article_count = $articleHandler->getCount();
63 63
 
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 echo '<br clear="all">' . planet_constant('AM_COUNT') . ': ' . $article_count;
67 67
 echo '<br clear="all">';
68 68
 if ($article_count_expire > 0) {
69
-    echo '<br clear="all"><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/admin/admin.article.php?purge=1" >' . planet_constant('AM_EXPIRED') . ': ' . $article_count_expire . '</a>';
70
-    echo '<br clear="all">';
69
+	echo '<br clear="all"><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/admin/admin.article.php?purge=1" >' . planet_constant('AM_EXPIRED') . ': ' . $article_count_expire . '</a>';
70
+	echo '<br clear="all">';
71 71
 }
72 72
 echo '</div>';
73 73
 echo '</fieldset><br clear="all">';
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 /** @var Planet\Helper $helper */
30 30
 $helper = Planet\Helper::getInstance();
31 31
 
32
-require_once __DIR__ . '/admin_header.php';
32
+require_once __DIR__.'/admin_header.php';
33 33
 
34 34
 xoops_cp_header();
35 35
 $adminObject = \Xmf\Module\Admin::getInstance();
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
  * This is a tricky fix for incomplete solution of module cone
42 42
  * it is expected to have a better solution in article 1.0
43 43
  */
44
-require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
44
+require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
45 45
 //planet_adminmenu(3);
46 46
 
47 47
 $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']);
48 48
 if (!empty($helper->getConfig('article_expire'))) {
49
-    $criteria = new \Criteria('art_time', time() - $helper->getConfig('article_expire') * 60 * 60 * 24, '<');
49
+    $criteria = new \Criteria('art_time', time()-$helper->getConfig('article_expire')*60*60*24, '<');
50 50
     if (!empty($_GET['purge'])) {
51 51
         $crit = new \CriteriaCompo($criteria);
52 52
         $crit->add(new \Criteria('art_comments', 0));
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
         }
57 57
     }
58 58
     $article_count_expire = $articleHandler->getCount($criteria);
59
-} else {
59
+}else {
60 60
     $article_count_expire = 0;
61 61
 }
62 62
 $article_count = $articleHandler->getCount();
63 63
 
64
-echo '<fieldset><legend style="font-weight: bold; color: #900;">' . planet_constant('AM_ARTICLES') . '</legend>';
64
+echo '<fieldset><legend style="font-weight: bold; color: #900;">'.planet_constant('AM_ARTICLES').'</legend>';
65 65
 echo '<div style="padding: 8px;">';
66
-echo '<br clear="all">' . planet_constant('AM_COUNT') . ': ' . $article_count;
66
+echo '<br clear="all">'.planet_constant('AM_COUNT').': '.$article_count;
67 67
 echo '<br clear="all">';
68
-if ($article_count_expire > 0) {
69
-    echo '<br clear="all"><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/admin/admin.article.php?purge=1" >' . planet_constant('AM_EXPIRED') . ': ' . $article_count_expire . '</a>';
68
+if ($article_count_expire>0) {
69
+    echo '<br clear="all"><a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/admin/admin.article.php?purge=1" >'.planet_constant('AM_EXPIRED').': '.$article_count_expire.'</a>';
70 70
     echo '<br clear="all">';
71 71
 }
72 72
 echo '</div>';
Please login to merge, or discard this patch.
admin/header.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
 // Project: Article Project                                                 //
26 26
 // ------------------------------------------------------------------------ //
27 27
 
28
-require_once __DIR__ . '/../../../include/cp_header.php';
29
-require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
28
+require_once __DIR__.'/../../../include/cp_header.php';
29
+require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
30 30
 //require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php';
31
-require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.admin.php';
31
+require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.admin.php';
32 32
 // require_once __DIR__ . '/../class/Utility.php';
33 33
 $moduleDirName = basename(dirname(__DIR__));
34 34
 // include the default language file for the admin interface
Please login to merge, or discard this patch.
admin/about.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
  * @author       XOOPS Development Team
18 18
  */
19 19
 
20
-require_once __DIR__ . '/admin_header.php';
20
+require_once __DIR__.'/admin_header.php';
21 21
 xoops_cp_header();
22 22
 
23 23
 $adminObject->displayNavigation(basename(__FILE__));
24 24
 $adminObject::setPaypal('[email protected]');
25 25
 $adminObject->displayAbout(false);
26 26
 
27
-require_once __DIR__ . '/admin_footer.php';
27
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
index.php 2 patches
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 $helper = Planet\Helper::getInstance();
31 31
 
32 32
 if (preg_match("/\/notification_update\.php/i", $_SERVER['REQUEST_URI'], $matches)) {
33
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
34
-    exit();
33
+	include XOOPS_ROOT_PATH . '/include/notification_update.php';
34
+	exit();
35 35
 }
36 36
 
37 37
 if ($REQUEST_URI_parsed = PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
38
-    $args['start'] = @$args_num[0];
39
-    $args['sort']  = @$args_str[0];
38
+	$args['start'] = @$args_num[0];
39
+	$args['sort']  = @$args_str[0];
40 40
 }
41 41
 
42 42
 /* Start */
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 
55 55
 // restore $_SERVER['REQUEST_URI']
56 56
 if (!empty($REQUEST_URI_parsed)) {
57
-    $args_REQUEST_URI = [];
58
-    $_args            = ['start', 'sort', 'uid', 'list'];
59
-    foreach ($_args as $arg) {
60
-        if (!empty(${$arg})) {
61
-            $args_REQUEST_URI[] = $arg . '=' . ${$arg};
62
-        }
63
-    }
64
-    if (!empty($blog_id)) {
65
-        $args_REQUEST_URI[] = 'blog=' . $blog_id;
66
-    }
67
-    if (!empty($category_id)) {
68
-        $args_REQUEST_URI[] = 'category=' . $category_id;
69
-    }
70
-    $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI));
57
+	$args_REQUEST_URI = [];
58
+	$_args            = ['start', 'sort', 'uid', 'list'];
59
+	foreach ($_args as $arg) {
60
+		if (!empty(${$arg})) {
61
+			$args_REQUEST_URI[] = $arg . '=' . ${$arg};
62
+		}
63
+	}
64
+	if (!empty($blog_id)) {
65
+		$args_REQUEST_URI[] = 'blog=' . $blog_id;
66
+	}
67
+	if (!empty($category_id)) {
68
+		$args_REQUEST_URI[] = 'category=' . $category_id;
69
+	}
70
+	$_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI));
71 71
 }
72 72
 
73 73
 $GLOBALS['xoopsOption']['template_main'] = PlanetUtility::planetGetTemplate('index');
@@ -92,73 +92,73 @@  discard block
 block discarded – undo
92 92
 $article_prefix = '';
93 93
 /* Specific category */
94 94
 if ($category_id > 0) {
95
-    $category_obj = $categoryHandler->get($category_id);
96
-    $criteria->add(new \Criteria('bc.cat_id', $category_id));
97
-    $uid            = 0;
98
-    $blog_id        = 0;
99
-    $category_data  = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
100
-    $query_type     = 'category';
101
-    $article_prefix = 'a.';
95
+	$category_obj = $categoryHandler->get($category_id);
96
+	$criteria->add(new \Criteria('bc.cat_id', $category_id));
97
+	$uid            = 0;
98
+	$blog_id        = 0;
99
+	$category_data  = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
100
+	$query_type     = 'category';
101
+	$article_prefix = 'a.';
102 102
 }
103 103
 /* Specific blog */
104 104
 if ($blog_id > 0) {
105
-    $blog_obj = $blogHandler->get($blog_id);
106
-    if ($blog_obj->getVar('blog_status')
107
-        || (is_object($xoopsUser)
108
-            && $xoopsUser->getVar('uid') == $blog_obj->getVar('blog_submitter'))) {
109
-        $criteria->add(new \Criteria('blog_id', $blog_id));
110
-        $category_id     = 0;
111
-        $uid             = 0;
112
-        $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
113
-        $blog_data       = [
114
-            'id'    => $blog_id,
115
-            'title' => $blog_obj->getVar('blog_title'),
116
-            'image' => $blog_obj->getImage(),
117
-            'title' => $blog_obj->getVar('blog_title'),
118
-            'feed'  => $blog_obj->getVar('blog_feed'),
119
-            'link'  => $blog_obj->getVar('blog_link'),
120
-            'desc'  => $blog_obj->getVar('blog_desc'),
121
-            'time'  => $blog_obj->getTime(),
122
-            'star'  => $blog_obj->getStar(),
123
-            'rates' => $blog_obj->getVar('blog_rates'),
124
-            'marks' => $blog_obj->getVar('blog_marks')
125
-        ];
126
-    }
127
-    $query_type     = 'blog';
128
-    $article_prefix = '';
105
+	$blog_obj = $blogHandler->get($blog_id);
106
+	if ($blog_obj->getVar('blog_status')
107
+		|| (is_object($xoopsUser)
108
+			&& $xoopsUser->getVar('uid') == $blog_obj->getVar('blog_submitter'))) {
109
+		$criteria->add(new \Criteria('blog_id', $blog_id));
110
+		$category_id     = 0;
111
+		$uid             = 0;
112
+		$bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
113
+		$blog_data       = [
114
+			'id'    => $blog_id,
115
+			'title' => $blog_obj->getVar('blog_title'),
116
+			'image' => $blog_obj->getImage(),
117
+			'title' => $blog_obj->getVar('blog_title'),
118
+			'feed'  => $blog_obj->getVar('blog_feed'),
119
+			'link'  => $blog_obj->getVar('blog_link'),
120
+			'desc'  => $blog_obj->getVar('blog_desc'),
121
+			'time'  => $blog_obj->getTime(),
122
+			'star'  => $blog_obj->getStar(),
123
+			'rates' => $blog_obj->getVar('blog_rates'),
124
+			'marks' => $blog_obj->getVar('blog_marks')
125
+		];
126
+	}
127
+	$query_type     = 'blog';
128
+	$article_prefix = '';
129 129
 }
130 130
 /* User bookmarks(favorites) */
131 131
 if ($uid > 0) {
132
-    $criteria->add(new \Criteria('bm.bm_uid', $uid));
133
-    $category_id     = 0;
134
-    $blog_id         = 0;
135
-    $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
136
-    $user_data       = [
137
-        'uid'   => $uid,
138
-        'name'  => XoopsUser::getUnameFromId($uid),
139
-        'marks' => $bookmarkHandler->getCount(new \Criteria('bm_uid', $uid))
140
-    ];
141
-    $query_type      = 'bookmark';
142
-    $article_prefix  = 'a.';
132
+	$criteria->add(new \Criteria('bm.bm_uid', $uid));
133
+	$category_id     = 0;
134
+	$blog_id         = 0;
135
+	$bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
136
+	$user_data       = [
137
+		'uid'   => $uid,
138
+		'name'  => XoopsUser::getUnameFromId($uid),
139
+		'marks' => $bookmarkHandler->getCount(new \Criteria('bm_uid', $uid))
140
+	];
141
+	$query_type      = 'bookmark';
142
+	$article_prefix  = 'a.';
143 143
 }
144 144
 
145 145
 /* Sort */
146 146
 $order = 'DESC';
147 147
 $sort  = empty($sort) ? 'time' : $sort;
148 148
 switch ($sort) {
149
-    case 'views':
150
-        $sortby = $article_prefix . 'art_views';
151
-        break;
152
-    case 'rating':
153
-        $sortby = $article_prefix . 'art_rating';
154
-        break;
155
-    case 'time':
156
-        $sortby = $article_prefix . 'art_time';
157
-        break;
158
-    case 'default':
159
-    default:
160
-        $sortby = '';
161
-        break;
149
+	case 'views':
150
+		$sortby = $article_prefix . 'art_views';
151
+		break;
152
+	case 'rating':
153
+		$sortby = $article_prefix . 'art_rating';
154
+		break;
155
+	case 'time':
156
+		$sortby = $article_prefix . 'art_time';
157
+		break;
158
+	case 'default':
159
+	default:
160
+		$sortby = '';
161
+		break;
162 162
 }
163 163
 $criteria->setSort($sortby);
164 164
 $criteria->setOrder($order);
@@ -166,120 +166,120 @@  discard block
 block discarded – undo
166 166
 $criteria->setLimit($limit);
167 167
 
168 168
 $tags = empty($list) ? '' : [
169
-    $article_prefix . 'art_title',
170
-    $article_prefix . 'blog_id',
171
-    $article_prefix . 'art_time'
169
+	$article_prefix . 'art_title',
170
+	$article_prefix . 'blog_id',
171
+	$article_prefix . 'art_time'
172 172
 ];
173 173
 switch ($query_type) {
174
-    case 'category':
175
-        $articles_obj  = $articleHandler->getByCategory($criteria, $tags);
176
-        $count_article = $articleHandler->getCountByCategory($criteria);
177
-        break;
178
-    case 'bookmark':
179
-        $articles_obj  = $articleHandler->getByBookmark($criteria, $tags);
180
-        $count_article = $articleHandler->getCountByBookmark($criteria);
181
-        break;
182
-    default:
183
-        $articles_obj  = $articleHandler->getAll($criteria, $tags);
184
-        $count_article = $articleHandler->getCount($criteria);
185
-        break;
174
+	case 'category':
175
+		$articles_obj  = $articleHandler->getByCategory($criteria, $tags);
176
+		$count_article = $articleHandler->getCountByCategory($criteria);
177
+		break;
178
+	case 'bookmark':
179
+		$articles_obj  = $articleHandler->getByBookmark($criteria, $tags);
180
+		$count_article = $articleHandler->getCountByBookmark($criteria);
181
+		break;
182
+	default:
183
+		$articles_obj  = $articleHandler->getAll($criteria, $tags);
184
+		$count_article = $articleHandler->getCount($criteria);
185
+		break;
186 186
 }
187 187
 
188 188
 if (!empty($blog_data)) {
189
-    $blogs[$blog_data['id']] = $blog_data['title'];
189
+	$blogs[$blog_data['id']] = $blog_data['title'];
190 190
 } else {
191
-    $blog_array = [];
192
-    foreach (array_keys($articles_obj) as $id) {
193
-        $blog_array[$articles_obj[$id]->getVar('blog_id')] = 1;
194
-    }
195
-    $criteria_blog = new \Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN');
196
-    $blogs         = $blogHandler->getList($criteria_blog);
191
+	$blog_array = [];
192
+	foreach (array_keys($articles_obj) as $id) {
193
+		$blog_array[$articles_obj[$id]->getVar('blog_id')] = 1;
194
+	}
195
+	$criteria_blog = new \Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN');
196
+	$blogs         = $blogHandler->getList($criteria_blog);
197 197
 }
198 198
 
199 199
 /* Objects to array */
200 200
 $articles = [];
201 201
 foreach (array_keys($articles_obj) as $id) {
202
-    $_article = [
203
-        'id'    => $id,
204
-        'title' => $articles_obj[$id]->getVar('art_title'),
205
-        'time'  => $articles_obj[$id]->getTime(),
206
-        'blog'  => [
207
-            'id'    => $articles_obj[$id]->getVar('blog_id'),
208
-            'title' => $blogs[$articles_obj[$id]->getVar('blog_id')]
209
-        ]
210
-    ];
211
-    if (empty($list)) {
212
-        $_article = array_merge($_article, [
213
-            'author'   => $articles_obj[$id]->getVar('art_author'),
214
-            'views'    => $articles_obj[$id]->getVar('art_views'),
215
-            'comments' => $articles_obj[$id]->getVar('art_comments'),
216
-            'star'     => $articles_obj[$id]->getStar(),
217
-            'rates'    => $articles_obj[$id]->getVar('art_rates')
218
-        ]);
219
-        if (!empty($helper->getConfig('display_summary'))) {
220
-            $_article['content'] = $articles_obj[$id]->getSummary();
221
-        } else {
222
-            $_article['content'] = $articles_obj[$id]->getVar('art_content');
223
-        }
224
-    }
225
-    $articles[] = $_article;
226
-    unset($_article);
202
+	$_article = [
203
+		'id'    => $id,
204
+		'title' => $articles_obj[$id]->getVar('art_title'),
205
+		'time'  => $articles_obj[$id]->getTime(),
206
+		'blog'  => [
207
+			'id'    => $articles_obj[$id]->getVar('blog_id'),
208
+			'title' => $blogs[$articles_obj[$id]->getVar('blog_id')]
209
+		]
210
+	];
211
+	if (empty($list)) {
212
+		$_article = array_merge($_article, [
213
+			'author'   => $articles_obj[$id]->getVar('art_author'),
214
+			'views'    => $articles_obj[$id]->getVar('art_views'),
215
+			'comments' => $articles_obj[$id]->getVar('art_comments'),
216
+			'star'     => $articles_obj[$id]->getStar(),
217
+			'rates'    => $articles_obj[$id]->getVar('art_rates')
218
+		]);
219
+		if (!empty($helper->getConfig('display_summary'))) {
220
+			$_article['content'] = $articles_obj[$id]->getSummary();
221
+		} else {
222
+			$_article['content'] = $articles_obj[$id]->getVar('art_content');
223
+		}
224
+	}
225
+	$articles[] = $_article;
226
+	unset($_article);
227 227
 }
228 228
 unset($articles_obj);
229 229
 
230 230
 if ($count_article > $limit) {
231
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
232
-    $start_link = [];
233
-    if ($sort) {
234
-        $start_link[] = 'sort=' . $sort;
235
-    }
236
-    if ($category_id) {
237
-        $start_link[] = 'category=' . $category_id;
238
-    }
239
-    if ($blog_id) {
240
-        $start_link[] = 'blog=' . $blog_id;
241
-    }
242
-    if ($list) {
243
-        $start_link[] = 'list=' . $list;
244
-    }
245
-    $nav     = new \XoopsPageNav($count_article, $limit, $start, 'start', implode('&amp;', $start_link));
246
-    $pagenav = $nav->renderNav(4);
231
+	include XOOPS_ROOT_PATH . '/class/pagenav.php';
232
+	$start_link = [];
233
+	if ($sort) {
234
+		$start_link[] = 'sort=' . $sort;
235
+	}
236
+	if ($category_id) {
237
+		$start_link[] = 'category=' . $category_id;
238
+	}
239
+	if ($blog_id) {
240
+		$start_link[] = 'blog=' . $blog_id;
241
+	}
242
+	if ($list) {
243
+		$start_link[] = 'list=' . $list;
244
+	}
245
+	$nav     = new \XoopsPageNav($count_article, $limit, $start, 'start', implode('&amp;', $start_link));
246
+	$pagenav = $nav->renderNav(4);
247 247
 } else {
248
-    $pagenav = '';
248
+	$pagenav = '';
249 249
 }
250 250
 
251 251
 $xoopsTpl->assign('xoops_module_header', $xoops_module_header);
252 252
 $xoopsTpl->assign('dirname', $GLOBALS['moddirname']);
253 253
 
254 254
 if ($category_id || $blog_id || $uid) {
255
-    $xoopsTpl->assign('link_index', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php" title="' . planet_constant('MD_INDEX') . '" target="_self">' . planet_constant('MD_INDEX') . '</a>');
255
+	$xoopsTpl->assign('link_index', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php" title="' . planet_constant('MD_INDEX') . '" target="_self">' . planet_constant('MD_INDEX') . '</a>');
256 256
 }
257 257
 
258 258
 $link_switch = '<a href="'
259
-               . XOOPS_URL
260
-               . '/modules/'
261
-               . $GLOBALS['moddirname']
262
-               . '/index.php'
263
-               . (empty($category_id) ? '' : '/c' . $category_id)
264
-               . (empty($uid) ? '' : '/u' . $uid)
265
-               . (empty($blog_id) ? '' : '/b' . $blog_id)
266
-               . (empty($list) ? '/l1' : '')
267
-               . '" title="'
268
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
269
-               . '">'
270
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
271
-               . '</a>';
259
+			   . XOOPS_URL
260
+			   . '/modules/'
261
+			   . $GLOBALS['moddirname']
262
+			   . '/index.php'
263
+			   . (empty($category_id) ? '' : '/c' . $category_id)
264
+			   . (empty($uid) ? '' : '/u' . $uid)
265
+			   . (empty($blog_id) ? '' : '/b' . $blog_id)
266
+			   . (empty($list) ? '/l1' : '')
267
+			   . '" title="'
268
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
269
+			   . '">'
270
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
271
+			   . '</a>';
272 272
 $xoopsTpl->assign('link_switch', $link_switch);
273 273
 
274 274
 $link_blogs = '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . '" title="' . planet_constant('MD_BLOGS') . '">' . planet_constant('MD_BLOGS') . '</a>';
275 275
 $xoopsTpl->assign('link_blogs', $link_blogs);
276 276
 
277 277
 if (empty($uid) && is_object($xoopsUser)) {
278
-    $xoopsTpl->assign('link_bookmark', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . '" title="' . planet_constant('MD_BOOKMARKS') . '" target="_self">' . planet_constant('MD_BOOKMARKS') . '</a>');
278
+	$xoopsTpl->assign('link_bookmark', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . '" title="' . planet_constant('MD_BOOKMARKS') . '" target="_self">' . planet_constant('MD_BOOKMARKS') . '</a>');
279 279
 }
280 280
 
281 281
 if (1 == $helper->getConfig('newblog_submit') || is_object($xoopsUser)) {
282
-    $xoopsTpl->assign('link_submit', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/action.blog.php" title="' . _SUBMIT . '" target="_blank">' . _SUBMIT . '</a>');
282
+	$xoopsTpl->assign('link_submit', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/action.blog.php" title="' . _SUBMIT . '" target="_blank">' . _SUBMIT . '</a>');
283 283
 }
284 284
 
285 285
 $xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_ARTICLES'));
@@ -293,22 +293,22 @@  discard block
 block discarded – undo
293 293
 $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1));
294 294
 if (empty($helper->getConfig('anonymous_rate')) && !is_object($xoopsUser)) {
295 295
 } elseif ($blog_id > 0) {
296
-    $xoopsTpl->assign('canrate', 1);
296
+	$xoopsTpl->assign('canrate', 1);
297 297
 }
298 298
 
299 299
 $sort_link   = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . (empty($blog_id) ? '' : '/b' . $blog_id) . (empty($list) ? '' : '/l1');
300 300
 $valid_sorts = [
301
-    'views'   => planet_constant('MD_VIEWS'),
302
-    'rating'  => planet_constant('MD_RATING'),
303
-    'time'    => planet_constant('MD_TIME'),
304
-    'default' => planet_constant('MD_DEFAULT')
301
+	'views'   => planet_constant('MD_VIEWS'),
302
+	'rating'  => planet_constant('MD_RATING'),
303
+	'time'    => planet_constant('MD_TIME'),
304
+	'default' => planet_constant('MD_DEFAULT')
305 305
 ];
306 306
 $sortlinks   = [];
307 307
 foreach ($valid_sorts as $val => $name) {
308
-    if ($val == $sort) {
309
-        continue;
310
-    }
311
-    $sortlinks[] = '<a href="' . $sort_link . '/' . $val . '">' . $name . '</a>';
308
+	if ($val == $sort) {
309
+		continue;
310
+	}
311
+	$sortlinks[] = '<a href="' . $sort_link . '/' . $val . '">' . $name . '</a>';
312 312
 }
313 313
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
314 314
 $xoopsTpl->assign('version', $xoopsModule->getVar('version'));
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 
318 318
 // for notification
319 319
 if (!empty($blog_id)) {
320
-    //$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php";
321
-    $_GET['blog'] = $blog_id;
320
+	//$_SERVER['REQUEST_URI'] = XOOPS_URL."/modules/".$GLOBALS["moddirname"]."/index.php";
321
+	$_GET['blog'] = $blog_id;
322 322
 }
323 323
 
324 324
 require_once __DIR__ . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 // URL: https://xoops.org                         //
25 25
 // Project: Article Project                                                 //
26 26
 // ------------------------------------------------------------------------ //
27
-include __DIR__ . '/header.php';
27
+include __DIR__.'/header.php';
28 28
 use XoopsModules\Planet;
29 29
 /** @var Planet\Helper $helper */
30 30
 $helper = Planet\Helper::getInstance();
31 31
 
32 32
 if (preg_match("/\/notification_update\.php/i", $_SERVER['REQUEST_URI'], $matches)) {
33
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
33
+    include XOOPS_ROOT_PATH.'/include/notification_update.php';
34 34
     exit();
35 35
 }
36 36
 
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 }
41 41
 
42 42
 /* Start */
43
-$start = (int)(empty($_GET['start']) ? @$args['start'] : $_GET['start']);
43
+$start = (int) (empty($_GET['start']) ? @$args['start'] : $_GET['start']);
44 44
 /* Specified Category */
45
-$category_id = (int)(empty($_GET['category']) ? @$args['category'] : $_GET['category']);
45
+$category_id = (int) (empty($_GET['category']) ? @$args['category'] : $_GET['category']);
46 46
 /* Specified Blog */
47
-$blog_id = (int)(empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']);
47
+$blog_id = (int) (empty($_GET['blog']) ? @$args['blog'] : $_GET['blog']);
48 48
 /* Specified Bookmar(Favorite) UID */
49
-$uid = (int)(empty($_GET['uid']) ? @$args['uid'] : $_GET['uid']);
49
+$uid = (int) (empty($_GET['uid']) ? @$args['uid'] : $_GET['uid']);
50 50
 /* Sort by term */
51 51
 $sort = empty($_GET['sort']) ? @$args['sort'] : $_GET['sort'];
52 52
 /* Display as list */
53
-$list = (int)(empty($_GET['list']) ? @$args['list'] : $_GET['list']);
53
+$list = (int) (empty($_GET['list']) ? @$args['list'] : $_GET['list']);
54 54
 
55 55
 // restore $_SERVER['REQUEST_URI']
56 56
 if (!empty($REQUEST_URI_parsed)) {
@@ -58,28 +58,28 @@  discard block
 block discarded – undo
58 58
     $_args            = ['start', 'sort', 'uid', 'list'];
59 59
     foreach ($_args as $arg) {
60 60
         if (!empty(${$arg})) {
61
-            $args_REQUEST_URI[] = $arg . '=' . ${$arg};
61
+            $args_REQUEST_URI[] = $arg.'='.${$arg};
62 62
         }
63 63
     }
64 64
     if (!empty($blog_id)) {
65
-        $args_REQUEST_URI[] = 'blog=' . $blog_id;
65
+        $args_REQUEST_URI[] = 'blog='.$blog_id;
66 66
     }
67 67
     if (!empty($category_id)) {
68
-        $args_REQUEST_URI[] = 'category=' . $category_id;
68
+        $args_REQUEST_URI[] = 'category='.$category_id;
69 69
     }
70
-    $_SERVER['REQUEST_URI'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($args_REQUEST_URI) ? '' : '?' . implode('&', $args_REQUEST_URI));
70
+    $_SERVER['REQUEST_URI'] = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.(empty($args_REQUEST_URI) ? '' : '?'.implode('&', $args_REQUEST_URI));
71 71
 }
72 72
 
73 73
 $GLOBALS['xoopsOption']['template_main'] = PlanetUtility::planetGetTemplate('index');
74 74
 $xoops_module_header                     = '
75
-    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rss" href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rss/c' . $category_id . '/b' . $blog_id . '/u' . $uid . '">
76
-    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name') . ' rdf" href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."rdf/c' . $category_id . '/b' . $blog_id . '/u' . $uid . '">
77
-    <link rel="alternate" type="application/atom+xml" title="' . $xoopsModule->getVar('name') . ' atom" href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php".URL_DELIMITER."atom/c' . $category_id . '/b' . $blog_id . '/u' . $uid . '">
75
+    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name').' rss" href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."rss/c'.$category_id.'/b'.$blog_id.'/u'.$uid.'">
76
+    <link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar('name').' rdf" href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."rdf/c'.$category_id.'/b'.$blog_id.'/u'.$uid.'">
77
+    <link rel="alternate" type="application/atom+xml" title="' . $xoopsModule->getVar('name').' atom" href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php".URL_DELIMITER."atom/c'.$category_id.'/b'.$blog_id.'/u'.$uid.'">
78 78
     ';
79 79
 
80 80
 $xoopsOption['xoops_module_header'] = $xoops_module_header;
81
-require_once XOOPS_ROOT_PATH . '/header.php';
82
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
81
+require_once XOOPS_ROOT_PATH.'/header.php';
82
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
83 83
 
84 84
 // Following part will not be executed after cache
85 85
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 $criteria       = new \CriteriaCompo();
92 92
 $article_prefix = '';
93 93
 /* Specific category */
94
-if ($category_id > 0) {
94
+if ($category_id>0) {
95 95
     $category_obj = $categoryHandler->get($category_id);
96 96
     $criteria->add(new \Criteria('bc.cat_id', $category_id));
97 97
     $uid            = 0;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     $article_prefix = 'a.';
102 102
 }
103 103
 /* Specific blog */
104
-if ($blog_id > 0) {
104
+if ($blog_id>0) {
105 105
     $blog_obj = $blogHandler->get($blog_id);
106 106
     if ($blog_obj->getVar('blog_status')
107 107
         || (is_object($xoopsUser)
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     $article_prefix = '';
129 129
 }
130 130
 /* User bookmarks(favorites) */
131
-if ($uid > 0) {
131
+if ($uid>0) {
132 132
     $criteria->add(new \Criteria('bm.bm_uid', $uid));
133 133
     $category_id     = 0;
134 134
     $blog_id         = 0;
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
 $sort  = empty($sort) ? 'time' : $sort;
148 148
 switch ($sort) {
149 149
     case 'views':
150
-        $sortby = $article_prefix . 'art_views';
150
+        $sortby = $article_prefix.'art_views';
151 151
         break;
152 152
     case 'rating':
153
-        $sortby = $article_prefix . 'art_rating';
153
+        $sortby = $article_prefix.'art_rating';
154 154
         break;
155 155
     case 'time':
156
-        $sortby = $article_prefix . 'art_time';
156
+        $sortby = $article_prefix.'art_time';
157 157
         break;
158 158
     case 'default':
159 159
     default:
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 $criteria->setLimit($limit);
167 167
 
168 168
 $tags = empty($list) ? '' : [
169
-    $article_prefix . 'art_title',
170
-    $article_prefix . 'blog_id',
171
-    $article_prefix . 'art_time'
169
+    $article_prefix.'art_title',
170
+    $article_prefix.'blog_id',
171
+    $article_prefix.'art_time'
172 172
 ];
173 173
 switch ($query_type) {
174 174
     case 'category':
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
 
188 188
 if (!empty($blog_data)) {
189 189
     $blogs[$blog_data['id']] = $blog_data['title'];
190
-} else {
190
+}else {
191 191
     $blog_array = [];
192 192
     foreach (array_keys($articles_obj) as $id) {
193 193
         $blog_array[$articles_obj[$id]->getVar('blog_id')] = 1;
194 194
     }
195
-    $criteria_blog = new \Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN');
195
+    $criteria_blog = new \Criteria('blog_id', '('.implode(',', array_keys($blog_array)).')', 'IN');
196 196
     $blogs         = $blogHandler->getList($criteria_blog);
197 197
 }
198 198
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         ]);
219 219
         if (!empty($helper->getConfig('display_summary'))) {
220 220
             $_article['content'] = $articles_obj[$id]->getSummary();
221
-        } else {
221
+        }else {
222 222
             $_article['content'] = $articles_obj[$id]->getVar('art_content');
223 223
         }
224 224
     }
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 }
228 228
 unset($articles_obj);
229 229
 
230
-if ($count_article > $limit) {
231
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
230
+if ($count_article>$limit) {
231
+    include XOOPS_ROOT_PATH.'/class/pagenav.php';
232 232
     $start_link = [];
233 233
     if ($sort) {
234
-        $start_link[] = 'sort=' . $sort;
234
+        $start_link[] = 'sort='.$sort;
235 235
     }
236 236
     if ($category_id) {
237
-        $start_link[] = 'category=' . $category_id;
237
+        $start_link[] = 'category='.$category_id;
238 238
     }
239 239
     if ($blog_id) {
240
-        $start_link[] = 'blog=' . $blog_id;
240
+        $start_link[] = 'blog='.$blog_id;
241 241
     }
242 242
     if ($list) {
243
-        $start_link[] = 'list=' . $list;
243
+        $start_link[] = 'list='.$list;
244 244
     }
245 245
     $nav     = new \XoopsPageNav($count_article, $limit, $start, 'start', implode('&amp;', $start_link));
246 246
     $pagenav = $nav->renderNav(4);
247
-} else {
247
+}else {
248 248
     $pagenav = '';
249 249
 }
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 $xoopsTpl->assign('dirname', $GLOBALS['moddirname']);
253 253
 
254 254
 if ($category_id || $blog_id || $uid) {
255
-    $xoopsTpl->assign('link_index', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php" title="' . planet_constant('MD_INDEX') . '" target="_self">' . planet_constant('MD_INDEX') . '</a>');
255
+    $xoopsTpl->assign('link_index', '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php" title="'.planet_constant('MD_INDEX').'" target="_self">'.planet_constant('MD_INDEX').'</a>');
256 256
 }
257 257
 
258 258
 $link_switch = '<a href="'
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
                . '/modules/'
261 261
                . $GLOBALS['moddirname']
262 262
                . '/index.php'
263
-               . (empty($category_id) ? '' : '/c' . $category_id)
264
-               . (empty($uid) ? '' : '/u' . $uid)
265
-               . (empty($blog_id) ? '' : '/b' . $blog_id)
263
+               . (empty($category_id) ? '' : '/c'.$category_id)
264
+               . (empty($uid) ? '' : '/u'.$uid)
265
+               . (empty($blog_id) ? '' : '/b'.$blog_id)
266 266
                . (empty($list) ? '/l1' : '')
267 267
                . '" title="'
268 268
                . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
@@ -271,18 +271,18 @@  discard block
 block discarded – undo
271 271
                . '</a>';
272 272
 $xoopsTpl->assign('link_switch', $link_switch);
273 273
 
274
-$link_blogs = '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . '" title="' . planet_constant('MD_BLOGS') . '">' . planet_constant('MD_BLOGS') . '</a>';
274
+$link_blogs = '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.(empty($category_id) ? '' : '/c'.$category_id).(empty($uid) ? '' : '/u'.$uid).'" title="'.planet_constant('MD_BLOGS').'">'.planet_constant('MD_BLOGS').'</a>';
275 275
 $xoopsTpl->assign('link_blogs', $link_blogs);
276 276
 
277 277
 if (empty($uid) && is_object($xoopsUser)) {
278
-    $xoopsTpl->assign('link_bookmark', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . '" title="' . planet_constant('MD_BOOKMARKS') . '" target="_self">' . planet_constant('MD_BOOKMARKS') . '</a>');
278
+    $xoopsTpl->assign('link_bookmark', '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'u'.$xoopsUser->getVar('uid').'" title="'.planet_constant('MD_BOOKMARKS').'" target="_self">'.planet_constant('MD_BOOKMARKS').'</a>');
279 279
 }
280 280
 
281 281
 if (1 == $helper->getConfig('newblog_submit') || is_object($xoopsUser)) {
282
-    $xoopsTpl->assign('link_submit', '<a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/action.blog.php" title="' . _SUBMIT . '" target="_blank">' . _SUBMIT . '</a>');
282
+    $xoopsTpl->assign('link_submit', '<a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/action.blog.php" title="'._SUBMIT.'" target="_blank">'._SUBMIT.'</a>');
283 283
 }
284 284
 
285
-$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_ARTICLES'));
285
+$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name').'::'.planet_constant('MD_ARTICLES'));
286 286
 $xoopsTpl->assign('category', @$category_data);
287 287
 $xoopsTpl->assign('blog', @$blog_data);
288 288
 $xoopsTpl->assign('user', @$user_data);
@@ -292,23 +292,23 @@  discard block
 block discarded – undo
292 292
 
293 293
 $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1));
294 294
 if (empty($helper->getConfig('anonymous_rate')) && !is_object($xoopsUser)) {
295
-} elseif ($blog_id > 0) {
295
+} elseif ($blog_id>0) {
296 296
     $xoopsTpl->assign('canrate', 1);
297 297
 }
298 298
 
299
-$sort_link   = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . (empty($blog_id) ? '' : '/b' . $blog_id) . (empty($list) ? '' : '/l1');
299
+$sort_link   = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.(empty($category_id) ? '' : '/c'.$category_id).(empty($uid) ? '' : '/u'.$uid).(empty($blog_id) ? '' : '/b'.$blog_id).(empty($list) ? '' : '/l1');
300 300
 $valid_sorts = [
301 301
     'views'   => planet_constant('MD_VIEWS'),
302 302
     'rating'  => planet_constant('MD_RATING'),
303 303
     'time'    => planet_constant('MD_TIME'),
304 304
     'default' => planet_constant('MD_DEFAULT')
305 305
 ];
306
-$sortlinks   = [];
306
+$sortlinks = [];
307 307
 foreach ($valid_sorts as $val => $name) {
308 308
     if ($val == $sort) {
309 309
         continue;
310 310
     }
311
-    $sortlinks[] = '<a href="' . $sort_link . '/' . $val . '">' . $name . '</a>';
311
+    $sortlinks[] = '<a href="'.$sort_link.'/'.$val.'">'.$name.'</a>';
312 312
 }
313 313
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
314 314
 $xoopsTpl->assign('version', $xoopsModule->getVar('version'));
@@ -321,4 +321,4 @@  discard block
 block discarded – undo
321 321
     $_GET['blog'] = $blog_id;
322 322
 }
323 323
 
324
-require_once __DIR__ . '/footer.php';
324
+require_once __DIR__.'/footer.php';
Please login to merge, or discard this patch.
include/common.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,19 +22,19 @@
 block discarded – undo
22 22
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
23 23
 
24 24
 define('NEWBB_DIRNAME', basename(dirname(__DIR__)));
25
-define('NEWBB_URL', XOOPS_URL . '/modules/' . NEWBB_DIRNAME);
26
-define('NEWBB_PATH', XOOPS_ROOT_PATH . '/modules/' . NEWBB_DIRNAME);
27
-define('NEWBB_IMAGES_URL', NEWBB_URL . '/assets/images');
28
-define('NEWBB_ADMIN_URL', NEWBB_URL . '/admin');
29
-define('NEWBB_ADMIN_PATH', NEWBB_PATH . '/admin/index.php');
30
-define('NEWBB_ROOT_PATH', $GLOBALS['xoops']->path('modules/' . NEWBB_DIRNAME));
31
-define('NEWBB_AUTHOR_LOGOIMG', NEWBB_URL . '/assets/images/logo_module.png');
32
-define('NEWBB_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash
33
-define('NEWBB_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . NEWBB_DIRNAME); // WITHOUT Trailing slash
25
+define('NEWBB_URL', XOOPS_URL.'/modules/'.NEWBB_DIRNAME);
26
+define('NEWBB_PATH', XOOPS_ROOT_PATH.'/modules/'.NEWBB_DIRNAME);
27
+define('NEWBB_IMAGES_URL', NEWBB_URL.'/assets/images');
28
+define('NEWBB_ADMIN_URL', NEWBB_URL.'/admin');
29
+define('NEWBB_ADMIN_PATH', NEWBB_PATH.'/admin/index.php');
30
+define('NEWBB_ROOT_PATH', $GLOBALS['xoops']->path('modules/'.NEWBB_DIRNAME));
31
+define('NEWBB_AUTHOR_LOGOIMG', NEWBB_URL.'/assets/images/logo_module.png');
32
+define('NEWBB_UPLOAD_URL', XOOPS_UPLOAD_URL.'/'.NEWBB_DIRNAME); // WITHOUT Trailing slash
33
+define('NEWBB_UPLOAD_PATH', XOOPS_UPLOAD_PATH.'/'.NEWBB_DIRNAME); // WITHOUT Trailing slash
34 34
 
35 35
 // module information
36 36
 $mod_copyright = "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
37
-                     <img src='" . NEWBB_AUTHOR_LOGOIMG . "' alt='XOOPS Project'></a>";
37
+                     <img src='" . NEWBB_AUTHOR_LOGOIMG."' alt='XOOPS Project'></a>";
38 38
 
39 39
 xoops_loadLanguage('common', NEWBB_DIRNAME);
40 40
 
Please login to merge, or discard this patch.