Completed
Push — master ( 7c5656...a50592 )
by Michael
01:55
created
comment_edit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
 // URL: https://xoops.org                         //
25 25
 // Project: Article Project                                                 //
26 26
 // ------------------------------------------------------------------------ //
27
-include __DIR__ . '/../../mainfile.php';
28
-include XOOPS_ROOT_PATH . '/include/comment_edit.php';
27
+include __DIR__.'/../../mainfile.php';
28
+include XOOPS_ROOT_PATH.'/include/comment_edit.php';
Please login to merge, or discard this patch.
comment_delete.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
 // URL: https://xoops.org                         //
25 25
 // Project: Article Project                                                 //
26 26
 // ------------------------------------------------------------------------ //
27
-include __DIR__ . '/../../mainfile.php';
28
-include XOOPS_ROOT_PATH . '/include/comment_delete.php';
27
+include __DIR__.'/../../mainfile.php';
28
+include XOOPS_ROOT_PATH.'/include/comment_delete.php';
Please login to merge, or discard this patch.
comment_post.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
 // URL: https://xoops.org                         //
25 25
 // Project: Article Project                                                 //
26 26
 // ------------------------------------------------------------------------ //
27
-include __DIR__ . '/../../mainfile.php';
28
-include XOOPS_ROOT_PATH . '/include/comment_post.php';
27
+include __DIR__.'/../../mainfile.php';
28
+include XOOPS_ROOT_PATH.'/include/comment_post.php';
Please login to merge, or discard this patch.
view.blogs.php 2 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 include __DIR__ . '/header.php';
30 30
 
31 31
 if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
32
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
33
-    exit();
32
+	include XOOPS_ROOT_PATH . '/include/notification_update.php';
33
+	exit();
34 34
 }
35 35
 
36 36
 if ($REQUEST_URI_parsed = PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
37
-    $args['start'] = @$args_num[0];
38
-    $args['sort']  = @$args_str[0];
37
+	$args['start'] = @$args_num[0];
38
+	$args['sort']  = @$args_str[0];
39 39
 }
40 40
 
41 41
 /* Start */
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
 $blog_prefix = '';
83 83
 /* Specific category */
84 84
 if ($category_id > 0) {
85
-    $category_obj = $categoryHandler->get($category_id);
86
-    $criteria->add(new Criteria('bc.cat_id', $category_id));
87
-    $uid           = 0;
88
-    $blog_id       = 0;
89
-    $category_data = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
90
-    $query_type    = 'category';
91
-    $blog_prefix   = 'b.';
85
+	$category_obj = $categoryHandler->get($category_id);
86
+	$criteria->add(new Criteria('bc.cat_id', $category_id));
87
+	$uid           = 0;
88
+	$blog_id       = 0;
89
+	$category_data = ['id' => $category_id, 'title' => $category_obj->getVar('cat_title')];
90
+	$query_type    = 'category';
91
+	$blog_prefix   = 'b.';
92 92
 }
93 93
 
94 94
 /* User bookmarks(favorites) */
95 95
 if ($uid > 0) {
96
-    $criteria->add(new Criteria('bm.bm_uid', $uid));
97
-    $category_id     = 0;
98
-    $blog_id         = 0;
99
-    $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
100
-    $user_data       = [
101
-        'uid'   => $uid,
102
-        'name'  => XoopsUser::getUnameFromId($uid),
103
-        'marks' => $bookmarkHandler->getCount(new Criteria('bm_uid', $uid))
104
-    ];
105
-    $query_type      = 'bookmark';
106
-    $blog_prefix     = 'b.';
96
+	$criteria->add(new Criteria('bm.bm_uid', $uid));
97
+	$category_id     = 0;
98
+	$blog_id         = 0;
99
+	$bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
100
+	$user_data       = [
101
+		'uid'   => $uid,
102
+		'name'  => XoopsUser::getUnameFromId($uid),
103
+		'marks' => $bookmarkHandler->getCount(new Criteria('bm_uid', $uid))
104
+	];
105
+	$query_type      = 'bookmark';
106
+	$blog_prefix     = 'b.';
107 107
 }
108 108
 
109 109
 $criteria->add(new Criteria($blog_prefix . 'blog_status', 0, '>'));
@@ -112,20 +112,20 @@  discard block
 block discarded – undo
112 112
 $order = 'DESC';
113 113
 $sort  = empty($sort) ? 'default' : $sort;
114 114
 switch ($sort) {
115
-    case 'marks':
116
-        $sortby = $blog_prefix . 'blog_marks';
117
-        break;
118
-    case 'rating':
119
-        $sortby = $blog_prefix . 'blog_rating';
120
-        break;
121
-    case 'time':
122
-        $sortby = $blog_prefix . 'blog_time';
123
-        break;
124
-    case 'default':
125
-    default:
126
-        $sort   = 'default';
127
-        $sortby = $blog_prefix . 'blog_id';
128
-        break;
115
+	case 'marks':
116
+		$sortby = $blog_prefix . 'blog_marks';
117
+		break;
118
+	case 'rating':
119
+		$sortby = $blog_prefix . 'blog_rating';
120
+		break;
121
+	case 'time':
122
+		$sortby = $blog_prefix . 'blog_time';
123
+		break;
124
+	case 'default':
125
+	default:
126
+		$sort   = 'default';
127
+		$sortby = $blog_prefix . 'blog_id';
128
+		break;
129 129
 }
130 130
 $criteria->setSort($sortby);
131 131
 $criteria->setOrder($order);
@@ -134,93 +134,93 @@  discard block
 block discarded – undo
134 134
 
135 135
 $tags = empty($list) ? '' : [$blog_prefix . 'blog_title', $blog_prefix . 'blog_time'];
136 136
 switch ($query_type) {
137
-    case 'category':
138
-        $blogs_obj  = $blogHandler->getByCategory($criteria, $tags);
139
-        $count_blog = $blogHandler->getCountByCategory($criteria);
140
-        break;
141
-    case 'bookmark':
142
-        $blogs_obj  = $blogHandler->getByBookmark($criteria, $tags);
143
-        $count_blog = $blogHandler->getCountByBookmark($criteria);
144
-        break;
145
-    default:
146
-        $blogs_obj  = $blogHandler->getAll($criteria, $tags);
147
-        $count_blog = $blogHandler->getCount($criteria);
148
-        break;
137
+	case 'category':
138
+		$blogs_obj  = $blogHandler->getByCategory($criteria, $tags);
139
+		$count_blog = $blogHandler->getCountByCategory($criteria);
140
+		break;
141
+	case 'bookmark':
142
+		$blogs_obj  = $blogHandler->getByBookmark($criteria, $tags);
143
+		$count_blog = $blogHandler->getCountByBookmark($criteria);
144
+		break;
145
+	default:
146
+		$blogs_obj  = $blogHandler->getAll($criteria, $tags);
147
+		$count_blog = $blogHandler->getCount($criteria);
148
+		break;
149 149
 }
150 150
 
151 151
 /* Objects to array */
152 152
 $blogs = [];
153 153
 foreach (array_keys($blogs_obj) as $id) {
154
-    $_blog = [
155
-        'id'    => $id,
156
-        'title' => $blogs_obj[$id]->getVar('blog_title'),
157
-        'time'  => $blogs_obj[$id]->getTime()
158
-    ];
159
-    if (empty($list)) {
160
-        $_blog = array_merge($_blog, [
161
-            'image' => $blogs_obj[$id]->getImage(),
162
-            'feed'  => $blogs_obj[$id]->getVar('blog_feed'),
163
-            'link'  => $blogs_obj[$id]->getVar('blog_link'),
164
-            'desc'  => $blogs_obj[$id]->getVar('blog_desc'),
165
-            'star'  => $blogs_obj[$id]->getStar(),
166
-            'rates' => $blogs_obj[$id]->getVar('blog_rates'),
167
-            'marks' => $blogs_obj[$id]->getVar('blog_marks')
168
-        ]);
169
-    }
170
-    $blogs[] = $_blog;
171
-    unset($_blog);
154
+	$_blog = [
155
+		'id'    => $id,
156
+		'title' => $blogs_obj[$id]->getVar('blog_title'),
157
+		'time'  => $blogs_obj[$id]->getTime()
158
+	];
159
+	if (empty($list)) {
160
+		$_blog = array_merge($_blog, [
161
+			'image' => $blogs_obj[$id]->getImage(),
162
+			'feed'  => $blogs_obj[$id]->getVar('blog_feed'),
163
+			'link'  => $blogs_obj[$id]->getVar('blog_link'),
164
+			'desc'  => $blogs_obj[$id]->getVar('blog_desc'),
165
+			'star'  => $blogs_obj[$id]->getStar(),
166
+			'rates' => $blogs_obj[$id]->getVar('blog_rates'),
167
+			'marks' => $blogs_obj[$id]->getVar('blog_marks')
168
+		]);
169
+	}
170
+	$blogs[] = $_blog;
171
+	unset($_blog);
172 172
 }
173 173
 unset($blogs_obj);
174 174
 
175 175
 if ($count_blog > $limit) {
176
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
177
-    $start_link = [];
178
-    if ($sort) {
179
-        $start_link[] = 'sort=' . $sort;
180
-    }
181
-    if ($category_id) {
182
-        $start_link[] = 'category=' . $category_id;
183
-    }
184
-    if ($list) {
185
-        $start_link[] = 'list=' . $list;
186
-    }
187
-    $nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link));
188
-    $pagenav = $nav->renderNav(4);
176
+	include XOOPS_ROOT_PATH . '/class/pagenav.php';
177
+	$start_link = [];
178
+	if ($sort) {
179
+		$start_link[] = 'sort=' . $sort;
180
+	}
181
+	if ($category_id) {
182
+		$start_link[] = 'category=' . $category_id;
183
+	}
184
+	if ($list) {
185
+		$start_link[] = 'list=' . $list;
186
+	}
187
+	$nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&', $start_link));
188
+	$pagenav = $nav->renderNav(4);
189 189
 } else {
190
-    $pagenav = '';
190
+	$pagenav = '';
191 191
 }
192 192
 
193 193
 $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']);
194 194
 $xoopsTpl->assign('link_home', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" . planet_constant('MD_HOME') . "\" target=\"_self\">" . planet_constant('MD_HOME') . '</a>');
195 195
 
196 196
 if ($category_id || $uid) {
197
-    $xoopsTpl->assign('link_index', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/view.blogs.php\" title=\"" . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>');
197
+	$xoopsTpl->assign('link_index', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/view.blogs.php\" title=\"" . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>');
198 198
 
199
-    $link_articles = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" . planet_constant('MD_ARTICLES') . "\">" . planet_constant('MD_ARTICLES') . '</a>';
200
-    $xoopsTpl->assign('link_articles', $link_articles);
199
+	$link_articles = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" . planet_constant('MD_ARTICLES') . "\">" . planet_constant('MD_ARTICLES') . '</a>';
200
+	$xoopsTpl->assign('link_articles', $link_articles);
201 201
 }
202 202
 
203 203
 $link_switch = "<a href=\""
204
-               . XOOPS_URL
205
-               . '/modules/'
206
-               . $GLOBALS['moddirname']
207
-               . '/view.blogs.php'
208
-               . (empty($category_id) ? '' : '/c' . $category_id)
209
-               . (empty($uid) ? '' : '/u' . $uid)
210
-               . (empty($list) ? '/l1' : '')
211
-               . "\" title=\""
212
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
213
-               . "\">"
214
-               . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
215
-               . '</a>';
204
+			   . XOOPS_URL
205
+			   . '/modules/'
206
+			   . $GLOBALS['moddirname']
207
+			   . '/view.blogs.php'
208
+			   . (empty($category_id) ? '' : '/c' . $category_id)
209
+			   . (empty($uid) ? '' : '/u' . $uid)
210
+			   . (empty($list) ? '/l1' : '')
211
+			   . "\" title=\""
212
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
213
+			   . "\">"
214
+			   . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
215
+			   . '</a>';
216 216
 $xoopsTpl->assign('link_switch', $link_switch);
217 217
 
218 218
 if (empty($uid) && is_object($xoopsUser)) {
219
-    $xoopsTpl->assign('link_bookmark', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>');
219
+	$xoopsTpl->assign('link_bookmark', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>');
220 220
 }
221 221
 
222 222
 if ($xoopsModuleConfig['newblog_submit'] == 1 || is_object($xoopsUser)) {
223
-    $xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
223
+	$xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
224 224
 }
225 225
 
226 226
 $xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS'));
@@ -234,35 +234,35 @@  discard block
 block discarded – undo
234 234
 $xoopsTpl->assign('user_level', !is_object($xoopsUser) ? 0 : ($xoopsUser->isAdmin() ? 2 : 1));
235 235
 if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) {
236 236
 } elseif (!$list) {
237
-    $xoopsTpl->assign('canrate', 1);
237
+	$xoopsTpl->assign('canrate', 1);
238 238
 }
239 239
 
240 240
 $sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER;
241 241
 $vars      = [];
242 242
 if (!empty($category_id)) {
243
-    $vars[] = 'c' . $category_id;
243
+	$vars[] = 'c' . $category_id;
244 244
 }
245 245
 if (!empty($uid)) {
246
-    $vars[] = 'u' . $uid;
246
+	$vars[] = 'u' . $uid;
247 247
 }
248 248
 if (!empty($list)) {
249
-    $vars[] = 'li';
249
+	$vars[] = 'li';
250 250
 }
251 251
 if (!empty($vars)) {
252
-    $sort_link .= implode('/', $vars) . '/';
252
+	$sort_link .= implode('/', $vars) . '/';
253 253
 }
254 254
 $sortlinks   = [];
255 255
 $valid_sorts = [
256
-    'marks'   => planet_constant('MD_BOOKMARKS'),
257
-    'rating'  => planet_constant('MD_RATING'),
258
-    'time'    => planet_constant('MD_TIME'),
259
-    'default' => planet_constant('MD_DEFAULT')
256
+	'marks'   => planet_constant('MD_BOOKMARKS'),
257
+	'rating'  => planet_constant('MD_RATING'),
258
+	'time'    => planet_constant('MD_TIME'),
259
+	'default' => planet_constant('MD_DEFAULT')
260 260
 ];
261 261
 foreach ($valid_sorts as $val => $name) {
262
-    if ($val == $sort) {
263
-        continue;
264
-    }
265
-    $sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>';
262
+	if ($val == $sort) {
263
+		continue;
264
+	}
265
+	$sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>';
266 266
 }
267 267
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
268 268
 
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 
31 31
 if (preg_match("/\/notification_update\.php/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) {
32
-    include XOOPS_ROOT_PATH . '/include/notification_update.php';
32
+    include XOOPS_ROOT_PATH.'/include/notification_update.php';
33 33
     exit();
34 34
 }
35 35
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 }
67 67
 */
68 68
 
69
-$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_BLOGS');
69
+$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_BLOGS');
70 70
 $xoopsOption['template_main']   = PlanetUtility::planetGetTemplate('blogs');
71
-require_once XOOPS_ROOT_PATH . '/header.php';
72
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
71
+require_once XOOPS_ROOT_PATH.'/header.php';
72
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
73 73
 
74 74
 // Following part will not be executed after cache
75 75
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 $criteria    = new CriteriaCompo();
82 82
 $blog_prefix = '';
83 83
 /* Specific category */
84
-if ($category_id > 0) {
84
+if ($category_id>0) {
85 85
     $category_obj = $categoryHandler->get($category_id);
86 86
     $criteria->add(new Criteria('bc.cat_id', $category_id));
87 87
     $uid           = 0;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 }
93 93
 
94 94
 /* User bookmarks(favorites) */
95
-if ($uid > 0) {
95
+if ($uid>0) {
96 96
     $criteria->add(new Criteria('bm.bm_uid', $uid));
97 97
     $category_id     = 0;
98 98
     $blog_id         = 0;
@@ -106,25 +106,25 @@  discard block
 block discarded – undo
106 106
     $blog_prefix     = 'b.';
107 107
 }
108 108
 
109
-$criteria->add(new Criteria($blog_prefix . 'blog_status', 0, '>'));
109
+$criteria->add(new Criteria($blog_prefix.'blog_status', 0, '>'));
110 110
 
111 111
 /* Sort */
112 112
 $order = 'DESC';
113 113
 $sort  = empty($sort) ? 'default' : $sort;
114 114
 switch ($sort) {
115 115
     case 'marks':
116
-        $sortby = $blog_prefix . 'blog_marks';
116
+        $sortby = $blog_prefix.'blog_marks';
117 117
         break;
118 118
     case 'rating':
119
-        $sortby = $blog_prefix . 'blog_rating';
119
+        $sortby = $blog_prefix.'blog_rating';
120 120
         break;
121 121
     case 'time':
122
-        $sortby = $blog_prefix . 'blog_time';
122
+        $sortby = $blog_prefix.'blog_time';
123 123
         break;
124 124
     case 'default':
125 125
     default:
126 126
         $sort   = 'default';
127
-        $sortby = $blog_prefix . 'blog_id';
127
+        $sortby = $blog_prefix.'blog_id';
128 128
         break;
129 129
 }
130 130
 $criteria->setSort($sortby);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 $criteria->setStart($start);
133 133
 $criteria->setLimit($limit);
134 134
 
135
-$tags = empty($list) ? '' : [$blog_prefix . 'blog_title', $blog_prefix . 'blog_time'];
135
+$tags = empty($list) ? '' : [$blog_prefix.'blog_title', $blog_prefix.'blog_time'];
136 136
 switch ($query_type) {
137 137
     case 'category':
138 138
         $blogs_obj  = $blogHandler->getByCategory($criteria, $tags);
@@ -172,31 +172,31 @@  discard block
 block discarded – undo
172 172
 }
173 173
 unset($blogs_obj);
174 174
 
175
-if ($count_blog > $limit) {
176
-    include XOOPS_ROOT_PATH . '/class/pagenav.php';
175
+if ($count_blog>$limit) {
176
+    include XOOPS_ROOT_PATH.'/class/pagenav.php';
177 177
     $start_link = [];
178 178
     if ($sort) {
179
-        $start_link[] = 'sort=' . $sort;
179
+        $start_link[] = 'sort='.$sort;
180 180
     }
181 181
     if ($category_id) {
182
-        $start_link[] = 'category=' . $category_id;
182
+        $start_link[] = 'category='.$category_id;
183 183
     }
184 184
     if ($list) {
185
-        $start_link[] = 'list=' . $list;
185
+        $start_link[] = 'list='.$list;
186 186
     }
187 187
     $nav     = new XoopsPageNav($count_blog, $limit, $start, 'start', implode('&amp;', $start_link));
188 188
     $pagenav = $nav->renderNav(4);
189
-} else {
189
+}else {
190 190
     $pagenav = '';
191 191
 }
192 192
 
193 193
 $xoopsTpl->assign('xoops_pagetitle', $xoopsOption['xoops_pagetitle']);
194
-$xoopsTpl->assign('link_home', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/index.php\" title=\"" . planet_constant('MD_HOME') . "\" target=\"_self\">" . planet_constant('MD_HOME') . '</a>');
194
+$xoopsTpl->assign('link_home', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/index.php\" title=\"".planet_constant('MD_HOME')."\" target=\"_self\">".planet_constant('MD_HOME').'</a>');
195 195
 
196 196
 if ($category_id || $uid) {
197
-    $xoopsTpl->assign('link_index', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/view.blogs.php\" title=\"" . planet_constant('MD_INDEX') . "\" target=\"_self\">" . planet_constant('MD_INDEX') . '</a>');
197
+    $xoopsTpl->assign('link_index', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/view.blogs.php\" title=\"".planet_constant('MD_INDEX')."\" target=\"_self\">".planet_constant('MD_INDEX').'</a>');
198 198
 
199
-    $link_articles = "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . (empty($category_id) ? '' : '/c' . $category_id) . (empty($uid) ? '' : '/u' . $uid) . "\" title=\"" . planet_constant('MD_ARTICLES') . "\">" . planet_constant('MD_ARTICLES') . '</a>';
199
+    $link_articles = "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.(empty($category_id) ? '' : '/c'.$category_id).(empty($uid) ? '' : '/u'.$uid)."\" title=\"".planet_constant('MD_ARTICLES')."\">".planet_constant('MD_ARTICLES').'</a>';
200 200
     $xoopsTpl->assign('link_articles', $link_articles);
201 201
 }
202 202
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                . '/modules/'
206 206
                . $GLOBALS['moddirname']
207 207
                . '/view.blogs.php'
208
-               . (empty($category_id) ? '' : '/c' . $category_id)
209
-               . (empty($uid) ? '' : '/u' . $uid)
208
+               . (empty($category_id) ? '' : '/c'.$category_id)
209
+               . (empty($uid) ? '' : '/u'.$uid)
210 210
                . (empty($list) ? '/l1' : '')
211 211
                . "\" title=\""
212 212
                . (empty($list) ? planet_constant('MD_LISTVIEW') : planet_constant('MD_FULLVIEW'))
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 $xoopsTpl->assign('link_switch', $link_switch);
217 217
 
218 218
 if (empty($uid) && is_object($xoopsUser)) {
219
-    $xoopsTpl->assign('link_bookmark', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER . 'u' . $xoopsUser->getVar('uid') . "\" title=\"" . planet_constant('MD_BOOKMARKS') . "\" target=\"_self\">" . planet_constant('MD_BOOKMARKS') . '</a>');
219
+    $xoopsTpl->assign('link_bookmark', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.URL_DELIMITER.'u'.$xoopsUser->getVar('uid')."\" title=\"".planet_constant('MD_BOOKMARKS')."\" target=\"_self\">".planet_constant('MD_BOOKMARKS').'</a>');
220 220
 }
221 221
 
222 222
 if ($xoopsModuleConfig['newblog_submit'] == 1 || is_object($xoopsUser)) {
223
-    $xoopsTpl->assign('link_submit', "<a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . "/action.blog.php\" title=\"" . _SUBMIT . "\" target=\"_blank\">" . _SUBMIT . '</a>');
223
+    $xoopsTpl->assign('link_submit', "<a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname']."/action.blog.php\" title=\""._SUBMIT."\" target=\"_blank\">"._SUBMIT.'</a>');
224 224
 }
225 225
 
226
-$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name') . '::' . planet_constant('MD_BLOGS'));
226
+$xoopsTpl->assign('pagetitle', $xoopsModule->getVar('name').'::'.planet_constant('MD_BLOGS'));
227 227
 $xoopsTpl->assign('category', @$category_data);
228 228
 $xoopsTpl->assign('user', @$user_data);
229 229
 $xoopsTpl->assign('blogs', $blogs);
@@ -237,19 +237,19 @@  discard block
 block discarded – undo
237 237
     $xoopsTpl->assign('canrate', 1);
238 238
 }
239 239
 
240
-$sort_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.blogs.php' . URL_DELIMITER;
240
+$sort_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.blogs.php'.URL_DELIMITER;
241 241
 $vars      = [];
242 242
 if (!empty($category_id)) {
243
-    $vars[] = 'c' . $category_id;
243
+    $vars[] = 'c'.$category_id;
244 244
 }
245 245
 if (!empty($uid)) {
246
-    $vars[] = 'u' . $uid;
246
+    $vars[] = 'u'.$uid;
247 247
 }
248 248
 if (!empty($list)) {
249 249
     $vars[] = 'li';
250 250
 }
251 251
 if (!empty($vars)) {
252
-    $sort_link .= implode('/', $vars) . '/';
252
+    $sort_link .= implode('/', $vars).'/';
253 253
 }
254 254
 $sortlinks   = [];
255 255
 $valid_sorts = [
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
     if ($val == $sort) {
263 263
         continue;
264 264
     }
265
-    $sortlinks[] = "<a href=\"" . $sort_link . $val . "\">" . $name . '</a>';
265
+    $sortlinks[] = "<a href=\"".$sort_link.$val."\">".$name.'</a>';
266 266
 }
267 267
 $xoopsTpl->assign('link_sort', implode(' | ', $sortlinks));
268 268
 
269
-require_once __DIR__ . '/footer.php';
269
+require_once __DIR__.'/footer.php';
Please login to merge, or discard this patch.
search.php 2 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 $configHandler     = xoops_getHandler('config');
33 33
 $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
34 34
 if (empty($xoopsConfigSearch['enable_search'])) {
35
-    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
35
+	redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
36 36
 }
37 37
 
38 38
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
@@ -50,93 +50,93 @@  discard block
 block discarded – undo
50 50
 $blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51 51
 $uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
52 52
 $searchin = Request::getArray(
53
-    'searchin',
54
-    0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
55
-                              'POST'
53
+	'searchin',
54
+	0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
55
+							  'POST'
56 56
 ); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array());
57 57
 $sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58 58
 $term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
59 59
 
60 60
 $andor  = in_array(strtoupper($andor), ['OR', 'AND', 'EXACT']) ? strtoupper($andor) : 'OR';
61 61
 $sortby = in_array(strtolower($sortby), [
62
-    'a.art_id desc',
63
-    'a.art_time desc',
64
-    'a.art_title',
65
-    'a.blog_id',
66
-    'b.blog_id',
67
-    'b.blog_feed',
68
-    'b.blog_title',
69
-    'b.blog_time'
62
+	'a.art_id desc',
63
+	'a.art_time desc',
64
+	'a.art_title',
65
+	'a.blog_id',
66
+	'b.blog_id',
67
+	'b.blog_feed',
68
+	'b.blog_title',
69
+	'b.blog_time'
70 70
 ]) ? strtolower($sortby) : '';
71 71
 
72 72
 if (!(empty(Request::getString('submit', '', 'POST')) && empty(Request::getString('term', '', 'GET')))) {
73
-    $next_search['category'] = $category;
74
-    $next_search['blog']     = $blog;
75
-    $next_search['uid']      = $uid;
76
-    $next_search['andor']    = $andor;
73
+	$next_search['category'] = $category;
74
+	$next_search['blog']     = $blog;
75
+	$next_search['uid']      = $uid;
76
+	$next_search['andor']    = $andor;
77 77
 
78
-    $next_search['term'] = $term;
79
-    $query               = trim($term);
78
+	$next_search['term'] = $term;
79
+	$query               = trim($term);
80 80
 
81
-    if ($andor !== 'EXACT') {
82
-        $ignored_queries = []; // holds kewords that are shorter than allowed minmum length
83
-        $temp_queries    = preg_split("/[\s,]+/", $query);
84
-        foreach ($temp_queries as $q) {
85
-            $q = trim($q);
86
-            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
87
-                $queries[] = $myts->addSlashes($q);
88
-            } else {
89
-                $ignored_queries[] = $myts->addSlashes($q);
90
-            }
91
-        }
92
-        if (count($queries) == 0) {
93
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
94
-        }
95
-    } else {
96
-        if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
97
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98
-        }
99
-        $queries = [$myts->addSlashes($query)];
100
-    }
81
+	if ($andor !== 'EXACT') {
82
+		$ignored_queries = []; // holds kewords that are shorter than allowed minmum length
83
+		$temp_queries    = preg_split("/[\s,]+/", $query);
84
+		foreach ($temp_queries as $q) {
85
+			$q = trim($q);
86
+			if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
87
+				$queries[] = $myts->addSlashes($q);
88
+			} else {
89
+				$ignored_queries[] = $myts->addSlashes($q);
90
+			}
91
+		}
92
+		if (count($queries) == 0) {
93
+			redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
94
+		}
95
+	} else {
96
+		if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
97
+			redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98
+		}
99
+		$queries = [$myts->addSlashes($query)];
100
+	}
101 101
 
102
-    $next_search['sortby']   = $sortby;
103
-    $next_search['searchin'] = implode('|', $searchin);
102
+	$next_search['sortby']   = $sortby;
103
+	$next_search['searchin'] = implode('|', $searchin);
104 104
 
105
-    /* To be added: year-month
105
+	/* To be added: year-month
106 106
      * see view.archive.php
107 107
      */
108
-    if (!empty($time)) {
109
-        $extra = '';
110
-    } else {
111
-        $extra = '';
112
-    }
108
+	if (!empty($time)) {
109
+		$extra = '';
110
+	} else {
111
+		$extra = '';
112
+	}
113 113
 
114
-    $results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra);
114
+	$results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra);
115 115
 
116
-    /*
116
+	/*
117 117
     if ( count($results) < 1 ) {
118 118
         redirect_header("javascript:history.go(-1);", 2, _SR_NOMATCH);
119 119
     } else
120 120
     */
121
-    {
122
-        $xoopsTpl->assign('results', $results);
121
+	{
122
+		$xoopsTpl->assign('results', $results);
123 123
 
124
-        if (count($next_search) > 0) {
125
-            $items = [];
126
-            foreach ($next_search as $para => $val) {
127
-                if (!empty($val)) {
128
-                    $items[] = "$para=$val";
129
-                }
130
-            }
131
-            if (count($items) > 0) {
132
-                $paras = implode('&', $items);
133
-            }
134
-            unset($next_search);
135
-            unset($items);
136
-        }
137
-        $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
124
+		if (count($next_search) > 0) {
125
+			$items = [];
126
+			foreach ($next_search as $para => $val) {
127
+				if (!empty($val)) {
128
+					$items[] = "$para=$val";
129
+				}
130
+			}
131
+			if (count($items) > 0) {
132
+				$paras = implode('&', $items);
133
+			}
134
+			unset($next_search);
135
+			unset($items);
136
+		}
137
+		$search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
138 138
 
139
-        /*
139
+		/*
140 140
          $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra);
141 141
       $next_count = count($next_results);
142 142
       $has_next = false;
@@ -145,41 +145,41 @@  discard block
 block discarded – undo
145 145
       }
146 146
       if (false != $has_next)
147 147
       */
148
-        if (count($results)) {
149
-            $next            = $start + $limit;
150
-            $queries         = implode(',', $queries);
151
-            $search_url_next = $search_url . "&start=$next";
152
-            $search_next     = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>';
153
-            $xoopsTpl->assign('search_next', $search_next);
154
-        }
155
-        if ($start > 0) {
156
-            $prev            = $start - $limit;
157
-            $search_url_prev = $search_url . "&start=$prev";
158
-            $search_prev     = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>';
159
-            $xoopsTpl->assign('search_prev', $search_prev);
160
-        }
161
-    }
148
+		if (count($results)) {
149
+			$next            = $start + $limit;
150
+			$queries         = implode(',', $queries);
151
+			$search_url_next = $search_url . "&start=$next";
152
+			$search_next     = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>';
153
+			$xoopsTpl->assign('search_next', $search_next);
154
+		}
155
+		if ($start > 0) {
156
+			$prev            = $start - $limit;
157
+			$search_url_prev = $search_url . "&start=$prev";
158
+			$search_prev     = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>';
159
+			$xoopsTpl->assign('search_prev', $search_prev);
160
+		}
161
+	}
162 162
 
163
-    unset($results);
164
-    $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
165
-    $xoopsTpl->assign('search_info', $search_info);
163
+	unset($results);
164
+	$search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
165
+	$xoopsTpl->assign('search_info', $search_info);
166 166
 }
167 167
 
168 168
 /* type */
169 169
 $type_select = "<select name=\"andor\">";
170 170
 $type_select .= "<option value=\"OR\"";
171 171
 if ('OR' === $andor) {
172
-    $type_select .= " selected=\"selected\"";
172
+	$type_select .= " selected=\"selected\"";
173 173
 }
174 174
 $type_select .= '>' . _SR_ANY . '</option>';
175 175
 $type_select .= "<option value=\"AND\"";
176 176
 if ('AND' === $andor) {
177
-    $type_select .= " selected=\"selected\"";
177
+	$type_select .= " selected=\"selected\"";
178 178
 }
179 179
 $type_select .= '>' . _SR_ALL . '</option>';
180 180
 $type_select .= "<option value=\"EXACT\"";
181 181
 if ('exact' === $andor) {
182
-    $type_select .= " selected=\"selected\"";
182
+	$type_select .= " selected=\"selected\"";
183 183
 }
184 184
 $type_select .= '>' . _SR_EXACT . '</option>';
185 185
 $type_select .= '</select>';
@@ -188,32 +188,32 @@  discard block
 block discarded – undo
188 188
 $searchin_select = '';
189 189
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"title\"";
190 190
 if (in_array('title', $searchin)) {
191
-    $searchin_select .= ' checked';
191
+	$searchin_select .= ' checked';
192 192
 }
193 193
 $searchin_select .= '>' . planet_constant('MD_TITLE') . '&nbsp;&nbsp;';
194 194
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\"";
195 195
 if (in_array('text', $searchin)) {
196
-    $searchin_select .= ' checked';
196
+	$searchin_select .= ' checked';
197 197
 }
198 198
 $searchin_select .= '>' . planet_constant('MD_BODY') . '&nbsp;&nbsp;||&nbsp;&nbsp;';
199 199
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\"";
200 200
 if (in_array('blog', $searchin)) {
201
-    $searchin_select .= ' checked';
201
+	$searchin_select .= ' checked';
202 202
 }
203 203
 $searchin_select .= '>' . planet_constant('MD_BLOG') . '&nbsp;&nbsp;';
204 204
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\"";
205 205
 if (in_array('feed', $searchin)) {
206
-    $searchin_select .= ' checked';
206
+	$searchin_select .= ' checked';
207 207
 }
208 208
 $searchin_select .= '>' . planet_constant('MD_FEED') . '&nbsp;&nbsp;';
209 209
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\"";
210 210
 if (in_array('desc', $searchin)) {
211
-    $searchin_select .= ' checked';
211
+	$searchin_select .= ' checked';
212 212
 }
213 213
 $searchin_select .= '>' . planet_constant('MD_DESC') . '&nbsp;&nbsp;';
214 214
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\"";
215 215
 if (empty($searchin)) {
216
-    $searchin_select .= ' checked';
216
+	$searchin_select .= ' checked';
217 217
 }
218 218
 $searchin_select .= '>' . _ALL . '&nbsp;&nbsp;';
219 219
 
@@ -221,28 +221,28 @@  discard block
 block discarded – undo
221 221
 $sortby_select = "<select name=\"sortby\">";
222 222
 $sortby_select .= "<option value=\"\"";
223 223
 if (empty($sortby)) {
224
-    $sortby_select .= " selected=\"selected\"";
224
+	$sortby_select .= " selected=\"selected\"";
225 225
 }
226 226
 $sortby_select .= '>' . _NONE . '</option>';
227 227
 $sortby_select .= "<option value=\"a.art_time\"";
228 228
 if ('a.art_time' === $sortby) {
229
-    $sortby_select .= " selected=\"selected\"";
229
+	$sortby_select .= " selected=\"selected\"";
230 230
 }
231 231
 $sortby_select .= '>' . planet_constant('MD_TIME') . '</option>';
232 232
 $sortby_select .= "<option value=\"a.art_title\"";
233 233
 if ('a.art_title' === $sortby) {
234
-    $sortby_select .= " selected=\"selected\"";
234
+	$sortby_select .= " selected=\"selected\"";
235 235
 }
236 236
 $sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>';
237 237
 $sortby_select .= "<option value=\"\">&nbsp;&nbsp;----&nbsp;&nbsp;</option>";
238 238
 $sortby_select .= "<option value=\"a.blog_title\"";
239 239
 if ('a.blog_title' === $sortby) {
240
-    $sortby_select .= " selected=\"selected\"";
240
+	$sortby_select .= " selected=\"selected\"";
241 241
 }
242 242
 $sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>';
243 243
 $sortby_select .= "<option value=\"a.blog_time\"";
244 244
 if ('b.blog_time' === $sortby) {
245
-    $sortby_select .= " selected=\"selected\"";
245
+	$sortby_select .= " selected=\"selected\"";
246 246
 }
247 247
 $sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>';
248 248
 $sortby_select .= '</select>';
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 $xoopsTpl->assign('uid', $uid);
260 260
 
261 261
 if ($xoopsConfigSearch['keyword_min'] > 0) {
262
-    $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
262
+	$xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
263 263
 }
264 264
 
265 265
 include XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -27,35 +27,35 @@  discard block
 block discarded – undo
27 27
 use Xmf\Request;
28 28
 
29 29
 $xoopsOption['pagetype'] = 'search';
30
-include __DIR__ . '/header.php';
30
+include __DIR__.'/header.php';
31 31
 $xoopsModule->loadLanguage('main');
32 32
 $configHandler     = xoops_getHandler('config');
33 33
 $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
34 34
 if (empty($xoopsConfigSearch['enable_search'])) {
35
-    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
35
+    redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php', 2, planet_constant('MD_NOACCESS'));
36 36
 }
37 37
 
38 38
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
39 39
 $xoopsOption['template_main']                             = PlanetUtility::planetGetTemplate('search');
40
-include XOOPS_ROOT_PATH . '/header.php';
41
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
40
+include XOOPS_ROOT_PATH.'/header.php';
41
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
42 42
 
43
-require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/search.inc.php';
43
+require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/search.inc.php';
44 44
 $limit = $xoopsModuleConfig['articles_perpage'];
45 45
 
46 46
 $queries  = [];
47
-$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST');//isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
48
-$start    = Request::getInt('start', 0, 'GET');//isset($_GET['start']) ? $_GET['start'] : 0;
47
+$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST'); //isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
48
+$start    = Request::getInt('start', 0, 'GET'); //isset($_GET['start']) ? $_GET['start'] : 0;
49 49
 $category = Request::getInt('category', Request::getInt('category', 0, 'GET'), 'POST'); //(int)(isset($_POST['category']) ? $_POST['category'] : (isset($_GET['category']) ? $_GET['category'] : null));
50
-$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51
-$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
50
+$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST'); //(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
51
+$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST'); //(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
52 52
 $searchin = Request::getArray(
53 53
     'searchin',
54 54
     0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
55 55
                               'POST'
56 56
 ); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array());
57
-$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58
-$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
57
+$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST'); //isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
58
+$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST'); //isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
59 59
 
60 60
 $andor  = in_array(strtoupper($andor), ['OR', 'AND', 'EXACT']) ? strtoupper($andor) : 'OR';
61 61
 $sortby = in_array(strtolower($sortby), [
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
         $temp_queries    = preg_split("/[\s,]+/", $query);
84 84
         foreach ($temp_queries as $q) {
85 85
             $q = trim($q);
86
-            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
86
+            if (strlen($q)>=$xoopsConfigSearch['keyword_min']) {
87 87
                 $queries[] = $myts->addSlashes($q);
88
-            } else {
88
+            }else {
89 89
                 $ignored_queries[] = $myts->addSlashes($q);
90 90
             }
91 91
         }
92 92
         if (count($queries) == 0) {
93
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
93
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
94 94
         }
95
-    } else {
96
-        if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
97
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
95
+    }else {
96
+        if (strlen($query)<$xoopsConfigSearch['keyword_min']) {
97
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98 98
         }
99 99
         $queries = [$myts->addSlashes($query)];
100 100
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     if (!empty($time)) {
109 109
         $extra = '';
110
-    } else {
110
+    }else {
111 111
         $extra = '';
112 112
     }
113 113
 
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $xoopsTpl->assign('results', $results);
123 123
 
124
-        if (count($next_search) > 0) {
124
+        if (count($next_search)>0) {
125 125
             $items = [];
126 126
             foreach ($next_search as $para => $val) {
127 127
                 if (!empty($val)) {
128 128
                     $items[] = "$para=$val";
129 129
                 }
130 130
             }
131
-            if (count($items) > 0) {
131
+            if (count($items)>0) {
132 132
                 $paras = implode('&', $items);
133 133
             }
134 134
             unset($next_search);
135 135
             unset($items);
136 136
         }
137
-        $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
137
+        $search_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php?'.$paras;
138 138
 
139 139
         /*
140 140
          $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra);
@@ -146,22 +146,22 @@  discard block
 block discarded – undo
146 146
       if (false != $has_next)
147 147
       */
148 148
         if (count($results)) {
149
-            $next            = $start + $limit;
149
+            $next            = $start+$limit;
150 150
             $queries         = implode(',', $queries);
151
-            $search_url_next = $search_url . "&start=$next";
152
-            $search_next     = "<a href=\"" . htmlspecialchars($search_url_next) . "\">" . _SR_NEXT . '</a>';
151
+            $search_url_next = $search_url."&start=$next";
152
+            $search_next     = "<a href=\"".htmlspecialchars($search_url_next)."\">"._SR_NEXT.'</a>';
153 153
             $xoopsTpl->assign('search_next', $search_next);
154 154
         }
155
-        if ($start > 0) {
156
-            $prev            = $start - $limit;
157
-            $search_url_prev = $search_url . "&start=$prev";
158
-            $search_prev     = "<a href=\"" . htmlspecialchars($search_url_prev) . "\">" . _SR_PREVIOUS . '</a>';
155
+        if ($start>0) {
156
+            $prev            = $start-$limit;
157
+            $search_url_prev = $search_url."&start=$prev";
158
+            $search_prev     = "<a href=\"".htmlspecialchars($search_url_prev)."\">"._SR_PREVIOUS.'</a>';
159 159
             $xoopsTpl->assign('search_prev', $search_prev);
160 160
         }
161 161
     }
162 162
 
163 163
     unset($results);
164
-    $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
164
+    $search_info = _SR_KEYWORDS.': '.$myts->htmlSpecialChars($term);
165 165
     $xoopsTpl->assign('search_info', $search_info);
166 166
 }
167 167
 
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 if ('OR' === $andor) {
172 172
     $type_select .= " selected=\"selected\"";
173 173
 }
174
-$type_select .= '>' . _SR_ANY . '</option>';
174
+$type_select .= '>'._SR_ANY.'</option>';
175 175
 $type_select .= "<option value=\"AND\"";
176 176
 if ('AND' === $andor) {
177 177
     $type_select .= " selected=\"selected\"";
178 178
 }
179
-$type_select .= '>' . _SR_ALL . '</option>';
179
+$type_select .= '>'._SR_ALL.'</option>';
180 180
 $type_select .= "<option value=\"EXACT\"";
181 181
 if ('exact' === $andor) {
182 182
     $type_select .= " selected=\"selected\"";
183 183
 }
184
-$type_select .= '>' . _SR_EXACT . '</option>';
184
+$type_select .= '>'._SR_EXACT.'</option>';
185 185
 $type_select .= '</select>';
186 186
 
187 187
 /* scope */
@@ -190,32 +190,32 @@  discard block
 block discarded – undo
190 190
 if (in_array('title', $searchin)) {
191 191
     $searchin_select .= ' checked';
192 192
 }
193
-$searchin_select .= '>' . planet_constant('MD_TITLE') . '&nbsp;&nbsp;';
193
+$searchin_select .= '>'.planet_constant('MD_TITLE').'&nbsp;&nbsp;';
194 194
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"text\"";
195 195
 if (in_array('text', $searchin)) {
196 196
     $searchin_select .= ' checked';
197 197
 }
198
-$searchin_select .= '>' . planet_constant('MD_BODY') . '&nbsp;&nbsp;||&nbsp;&nbsp;';
198
+$searchin_select .= '>'.planet_constant('MD_BODY').'&nbsp;&nbsp;||&nbsp;&nbsp;';
199 199
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"blog\"";
200 200
 if (in_array('blog', $searchin)) {
201 201
     $searchin_select .= ' checked';
202 202
 }
203
-$searchin_select .= '>' . planet_constant('MD_BLOG') . '&nbsp;&nbsp;';
203
+$searchin_select .= '>'.planet_constant('MD_BLOG').'&nbsp;&nbsp;';
204 204
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"feed\"";
205 205
 if (in_array('feed', $searchin)) {
206 206
     $searchin_select .= ' checked';
207 207
 }
208
-$searchin_select .= '>' . planet_constant('MD_FEED') . '&nbsp;&nbsp;';
208
+$searchin_select .= '>'.planet_constant('MD_FEED').'&nbsp;&nbsp;';
209 209
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"desc\"";
210 210
 if (in_array('desc', $searchin)) {
211 211
     $searchin_select .= ' checked';
212 212
 }
213
-$searchin_select .= '>' . planet_constant('MD_DESC') . '&nbsp;&nbsp;';
213
+$searchin_select .= '>'.planet_constant('MD_DESC').'&nbsp;&nbsp;';
214 214
 $searchin_select .= "<input type=\"checkbox\" name=\"searchin[]\" value=\"all\"";
215 215
 if (empty($searchin)) {
216 216
     $searchin_select .= ' checked';
217 217
 }
218
-$searchin_select .= '>' . _ALL . '&nbsp;&nbsp;';
218
+$searchin_select .= '>'._ALL.'&nbsp;&nbsp;';
219 219
 
220 220
 /* sortby */
221 221
 $sortby_select = "<select name=\"sortby\">";
@@ -223,28 +223,28 @@  discard block
 block discarded – undo
223 223
 if (empty($sortby)) {
224 224
     $sortby_select .= " selected=\"selected\"";
225 225
 }
226
-$sortby_select .= '>' . _NONE . '</option>';
226
+$sortby_select .= '>'._NONE.'</option>';
227 227
 $sortby_select .= "<option value=\"a.art_time\"";
228 228
 if ('a.art_time' === $sortby) {
229 229
     $sortby_select .= " selected=\"selected\"";
230 230
 }
231
-$sortby_select .= '>' . planet_constant('MD_TIME') . '</option>';
231
+$sortby_select .= '>'.planet_constant('MD_TIME').'</option>';
232 232
 $sortby_select .= "<option value=\"a.art_title\"";
233 233
 if ('a.art_title' === $sortby) {
234 234
     $sortby_select .= " selected=\"selected\"";
235 235
 }
236
-$sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>';
236
+$sortby_select .= '>'.planet_constant('MD_TITLE').'</option>';
237 237
 $sortby_select .= "<option value=\"\">&nbsp;&nbsp;----&nbsp;&nbsp;</option>";
238 238
 $sortby_select .= "<option value=\"a.blog_title\"";
239 239
 if ('a.blog_title' === $sortby) {
240 240
     $sortby_select .= " selected=\"selected\"";
241 241
 }
242
-$sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>';
242
+$sortby_select .= '>'.planet_constant('MD_BLOG').'</option>';
243 243
 $sortby_select .= "<option value=\"a.blog_time\"";
244 244
 if ('b.blog_time' === $sortby) {
245 245
     $sortby_select .= " selected=\"selected\"";
246 246
 }
247
-$sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>';
247
+$sortby_select .= '>'.planet_constant('MD_UPDATE').'</option>';
248 248
 $sortby_select .= '</select>';
249 249
 
250 250
 $xoopsTpl->assign('type_select', $type_select);
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 $xoopsTpl->assign('blog', $blog);
259 259
 $xoopsTpl->assign('uid', $uid);
260 260
 
261
-if ($xoopsConfigSearch['keyword_min'] > 0) {
261
+if ($xoopsConfigSearch['keyword_min']>0) {
262 262
     $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
263 263
 }
264 264
 
265
-include XOOPS_ROOT_PATH . '/footer.php';
265
+include XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
admin/admin.blog.php 3 patches
Indentation   +341 added lines, -341 removed lines patch added patch discarded remove patch
@@ -52,353 +52,353 @@
 block discarded – undo
52 52
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
53 53
 
54 54
 if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) {
55
-    $op = 'edit';
55
+	$op = 'edit';
56 56
 }
57 57
 
58 58
 switch ($op) {
59
-    /* save a single blog */
60
-    case 'save':
61
-
62
-        if ($blog_id) {
63
-            $blog_obj = $blogHandler->get($blog_id);
64
-        } else {
65
-            if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
-                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
-            }
68
-            $blog_obj = $blogHandler->create();
69
-            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
-        }
71
-
72
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
-        $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
-        $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
-
82
-        if (!$blogHandler->insert($blog_obj)) {
83
-        } elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
-            $blog_id = $blog_obj->getVar('blog_id');
85
-            if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
-                $_POST['categories'] = [];
87
-            }
88
-            $blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
-        }
90
-        $message = planet_constant('AM_DBUPDATED');
91
-        redirect_header('admin.blog.php', 2, $message);
92
-
93
-    /* fetch and add a list of blogs to a category */
94
-    // no break
95
-    case 'add':
96
-        $links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
-        $blogs = [];
98
-        foreach ($links as $link) {
99
-            if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
-                continue;
101
-            }
102
-            $blog_obj = $blogHandler->fetch($link['url']);
103
-            if (!empty($link['title'])) {
104
-                $blog_obj->setVar('blog_title', $link['title']);
105
-            }
106
-            $blogHandler->insert($blog_obj);
107
-            $blogs[] = $blog_obj->getVar('blog_id');
108
-            unset($blog_obj);
109
-        }
110
-        if (!empty(Request::getArray('categories', [], 'POST'))) {
111
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
-            foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
-                $categoryHandler->addBlogs($cat_id, $blogs);
114
-            }
115
-        }
116
-        $message = planet_constant('AM_DBUPDATED');
117
-        redirect_header('admin.blog.php', 2, $message);
118
-
119
-    /* update a list of blogs */
120
-    // no break
121
-    case 'update':
122
-        foreach ($blog_id as $bid) {
123
-            $blog_obj = $blogHandler->fetch($bid);
124
-            if (!$blogHandler->insert($blog_obj)) {
125
-            }
126
-            unset($blog_obj);
127
-        }
128
-        $message = planet_constant('AM_DBUPDATED');
129
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
-
131
-    /* add a list of blogs to a category */
132
-    // no break
133
-    case 'register':
134
-        if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
-            if (!is_array($blog_id)) {
136
-                $blog_id = [$blog_id];
137
-            }
138
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
-            $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
-        }
141
-        $message = planet_constant('AM_DBUPDATED');
142
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
-
144
-    /* remove a list of blogs from a category */
145
-    // no break
146
-    case 'remove':
147
-        if (!is_array($blog_id)) {
148
-            $blog_id = [$blog_id];
149
-        }
150
-        if (!empty($category_id)) {
151
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
-            $categoryHandler->removeBlogs($category_id, $blog_id);
153
-        }
154
-        $message = planet_constant('AM_DBUPDATED');
155
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
-
157
-    /* delete a single blog or a list blogs */
158
-    // no break
159
-    case 'del':
160
-        if (!is_array($blog_id)) {
161
-            $blog_id = [$blog_id];
162
-        }
163
-        foreach ($blog_id as $bid) {
164
-            $blog_obj = $blogHandler->get($bid);
165
-            if (!$blogHandler->delete($blog_obj, true)) {
166
-            }
167
-            unset($blog_obj);
168
-        }
169
-        $message = planet_constant('AM_DBUPDATED');
170
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
-
172
-    /* empty a single blog or a list blogs */
173
-    // no break
174
-    case 'empty':
175
-        if (!is_array($blog_id)) {
176
-            $blog_id = [$blog_id];
177
-        }
178
-        foreach ($blog_id as $bid) {
179
-            $blog_obj = $blogHandler->get($bid);
180
-            if (!$blogHandler->do_empty($blog_obj)) {
181
-            }
182
-        }
183
-        $message = planet_constant('AM_DBUPDATED');
184
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
-
186
-    /* approve a single blog or a list blogs */
187
-    // no break
188
-    case 'approve':
189
-        if (!is_array($blog_id)) {
190
-            $blog_id = [$blog_id];
191
-        }
192
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
-        $blogHandler->updateAll('blog_status', 1, $criteria, true);
194
-        $message = planet_constant('AM_DBUPDATED');
195
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
-
197
-    /* mark a single blog or a list blogs as featured */
198
-    // no break
199
-    case 'feature':
200
-        if (!is_array($blog_id)) {
201
-            $blog_id = [$blog_id];
202
-        }
203
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
-        $blogHandler->updateAll('blog_status', 2, $criteria, true);
205
-        $message = planet_constant('AM_DBUPDATED');
206
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
-
208
-    /* edit a single blog */
209
-    // no break
210
-    case 'edit':
211
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
212
-            $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
-            $blog_obj->setVar('blog_id', $blog_id);
214
-        } else {
215
-            $blog_obj = $blogHandler->get($blog_id);
216
-        }
217
-        $categories = Request::getArray('categories', [], 'POST');
218
-        if (empty($categories) && $blog_id > 0) {
219
-            $crit       = new Criteria('bc.blog_id', $blog_id);
220
-            $categories = array_keys($categoryHandler->getByBlog($crit));
221
-        }
222
-        if (empty($categories)) {
223
-            $categories = [0 => _NONE];
224
-        }
225
-
226
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
-        echo '<br>';
228
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
-            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
-            $blogs_obj = $blogHandler->getList($criteria);
231
-            if (count($blogs_obj) > 0) {
232
-                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
-                foreach (array_keys($blogs_obj) as $bid) {
234
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
-                }
236
-                echo '</div>';
237
-            }
238
-            unset($blogs_obj, $criteria);
239
-        }
240
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
-        echo '</fieldset>';
242
-        break;
243
-
244
-    default:
245
-
246
-        $crit = new Criteria('1', 1);
247
-        $crit->setSort('cat_order');
248
-        $crit->setOrder('ASC');
249
-        $categories = $categoryHandler->getList($crit);
250
-
251
-        // Display category option form
252
-        $opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
-        $op_select = new XoopsFormSelect('', 'category', $category_id);
254
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
255
-        $options = [
256
-            '0'  => _ALL,
257
-            '-1' => planet_constant('MD_ACTIVE'),
258
-            '-2' => planet_constant('MD_FEATURED'),
259
-            '-3' => planet_constant('MD_PENDING')
260
-        ];
261
-        foreach (array_keys($categories) as $key) {
262
-            $options[$key] = $categories[$key];
263
-        }
264
-        $op_select->addOptionArray($options);
265
-        $opform->addElement($op_select);
266
-        $opform->display();
267
-
268
-        if ($category_id > 0) {
269
-            $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
-            $criteria->add(new Criteria('bc.cat_id', $category_id));
271
-            $blog_count = $blogHandler->getCountByCategory($criteria);
272
-            $criteria->setStart($start);
273
-            $criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
-            $blog_objs = $blogHandler->getByCategory($criteria);
275
-        } else {
276
-            /* All active blogs */
277
-            if ($category_id == 0) {
278
-                $criteria = new Criteria('1', 1);
279
-                $criteria->setStart($start);
280
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
-                /* Active blogs */
282
-            } elseif ($category_id == -1) {
283
-                $criteria = new Criteria('blog_status', 1);
284
-                $criteria->setStart($start);
285
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
-                /* Featured blogs */
287
-            } elseif ($category_id == -2) {
288
-                $criteria = new Criteria('blog_status', 2);
289
-                $criteria->setStart($start);
290
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
-                /* Pending blogs */
292
-            } else {
293
-                $criteria = new Criteria('blog_status', 0);
294
-                $criteria->setStart($start);
295
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
-            }
297
-            $blog_count = $blogHandler->getCount($criteria);
298
-            $blog_objs  = $blogHandler->getAll($criteria);
299
-        }
300
-
301
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
-        echo "<br style=\"clear:both\">";
303
-
304
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
-        echo "<tr align='center'>";
307
-        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
-        //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
-        //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
-        echo '</tr>';
315
-
316
-        $status = [
317
-            '0' => planet_constant('MD_PENDING'),
318
-            '1' => planet_constant('MD_ACTIVE'),
319
-            '2' => planet_constant('MD_FEATURED')
320
-        ];
321
-        foreach (array_keys($blog_objs) as $bid) {
322
-            echo "<tr class='odd' align='left'>";
323
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
59
+	/* save a single blog */
60
+	case 'save':
61
+
62
+		if ($blog_id) {
63
+			$blog_obj = $blogHandler->get($blog_id);
64
+		} else {
65
+			if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
+				redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
+			}
68
+			$blog_obj = $blogHandler->create();
69
+			$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
+		}
71
+
72
+		$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
+		$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
+		$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
+		$blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
+		$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
+		$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
+		$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
+		$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
+		$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
+
82
+		if (!$blogHandler->insert($blog_obj)) {
83
+		} elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
+			$blog_id = $blog_obj->getVar('blog_id');
85
+			if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
+				$_POST['categories'] = [];
87
+			}
88
+			$blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
+		}
90
+		$message = planet_constant('AM_DBUPDATED');
91
+		redirect_header('admin.blog.php', 2, $message);
92
+
93
+	/* fetch and add a list of blogs to a category */
94
+	// no break
95
+	case 'add':
96
+		$links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
+		$blogs = [];
98
+		foreach ($links as $link) {
99
+			if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
+				continue;
101
+			}
102
+			$blog_obj = $blogHandler->fetch($link['url']);
103
+			if (!empty($link['title'])) {
104
+				$blog_obj->setVar('blog_title', $link['title']);
105
+			}
106
+			$blogHandler->insert($blog_obj);
107
+			$blogs[] = $blog_obj->getVar('blog_id');
108
+			unset($blog_obj);
109
+		}
110
+		if (!empty(Request::getArray('categories', [], 'POST'))) {
111
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
+			foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
+				$categoryHandler->addBlogs($cat_id, $blogs);
114
+			}
115
+		}
116
+		$message = planet_constant('AM_DBUPDATED');
117
+		redirect_header('admin.blog.php', 2, $message);
118
+
119
+	/* update a list of blogs */
120
+	// no break
121
+	case 'update':
122
+		foreach ($blog_id as $bid) {
123
+			$blog_obj = $blogHandler->fetch($bid);
124
+			if (!$blogHandler->insert($blog_obj)) {
125
+			}
126
+			unset($blog_obj);
127
+		}
128
+		$message = planet_constant('AM_DBUPDATED');
129
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
+
131
+	/* add a list of blogs to a category */
132
+	// no break
133
+	case 'register':
134
+		if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
+			if (!is_array($blog_id)) {
136
+				$blog_id = [$blog_id];
137
+			}
138
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
+			$categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
+		}
141
+		$message = planet_constant('AM_DBUPDATED');
142
+		redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
+
144
+	/* remove a list of blogs from a category */
145
+	// no break
146
+	case 'remove':
147
+		if (!is_array($blog_id)) {
148
+			$blog_id = [$blog_id];
149
+		}
150
+		if (!empty($category_id)) {
151
+			$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
+			$categoryHandler->removeBlogs($category_id, $blog_id);
153
+		}
154
+		$message = planet_constant('AM_DBUPDATED');
155
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
+
157
+	/* delete a single blog or a list blogs */
158
+	// no break
159
+	case 'del':
160
+		if (!is_array($blog_id)) {
161
+			$blog_id = [$blog_id];
162
+		}
163
+		foreach ($blog_id as $bid) {
164
+			$blog_obj = $blogHandler->get($bid);
165
+			if (!$blogHandler->delete($blog_obj, true)) {
166
+			}
167
+			unset($blog_obj);
168
+		}
169
+		$message = planet_constant('AM_DBUPDATED');
170
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
+
172
+	/* empty a single blog or a list blogs */
173
+	// no break
174
+	case 'empty':
175
+		if (!is_array($blog_id)) {
176
+			$blog_id = [$blog_id];
177
+		}
178
+		foreach ($blog_id as $bid) {
179
+			$blog_obj = $blogHandler->get($bid);
180
+			if (!$blogHandler->do_empty($blog_obj)) {
181
+			}
182
+		}
183
+		$message = planet_constant('AM_DBUPDATED');
184
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
+
186
+	/* approve a single blog or a list blogs */
187
+	// no break
188
+	case 'approve':
189
+		if (!is_array($blog_id)) {
190
+			$blog_id = [$blog_id];
191
+		}
192
+		$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
+		$blogHandler->updateAll('blog_status', 1, $criteria, true);
194
+		$message = planet_constant('AM_DBUPDATED');
195
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
+
197
+	/* mark a single blog or a list blogs as featured */
198
+	// no break
199
+	case 'feature':
200
+		if (!is_array($blog_id)) {
201
+			$blog_id = [$blog_id];
202
+		}
203
+		$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
+		$blogHandler->updateAll('blog_status', 2, $criteria, true);
205
+		$message = planet_constant('AM_DBUPDATED');
206
+		redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
+
208
+	/* edit a single blog */
209
+	// no break
210
+	case 'edit':
211
+		if (!empty(Request::getString('fetch', '', 'POST'))) {
212
+			$blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
+			$blog_obj->setVar('blog_id', $blog_id);
214
+		} else {
215
+			$blog_obj = $blogHandler->get($blog_id);
216
+		}
217
+		$categories = Request::getArray('categories', [], 'POST');
218
+		if (empty($categories) && $blog_id > 0) {
219
+			$crit       = new Criteria('bc.blog_id', $blog_id);
220
+			$categories = array_keys($categoryHandler->getByBlog($crit));
221
+		}
222
+		if (empty($categories)) {
223
+			$categories = [0 => _NONE];
224
+		}
225
+
226
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
+		echo '<br>';
228
+		if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
+			$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
+			$blogs_obj = $blogHandler->getList($criteria);
231
+			if (count($blogs_obj) > 0) {
232
+				echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
+				foreach (array_keys($blogs_obj) as $bid) {
234
+					echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
+				}
236
+				echo '</div>';
237
+			}
238
+			unset($blogs_obj, $criteria);
239
+		}
240
+		include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
+		echo '</fieldset>';
242
+		break;
243
+
244
+	default:
245
+
246
+		$crit = new Criteria('1', 1);
247
+		$crit->setSort('cat_order');
248
+		$crit->setOrder('ASC');
249
+		$categories = $categoryHandler->getList($crit);
250
+
251
+		// Display category option form
252
+		$opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
+		$op_select = new XoopsFormSelect('', 'category', $category_id);
254
+		$op_select->setExtra('onchange="document.forms.opform.submit()"');
255
+		$options = [
256
+			'0'  => _ALL,
257
+			'-1' => planet_constant('MD_ACTIVE'),
258
+			'-2' => planet_constant('MD_FEATURED'),
259
+			'-3' => planet_constant('MD_PENDING')
260
+		];
261
+		foreach (array_keys($categories) as $key) {
262
+			$options[$key] = $categories[$key];
263
+		}
264
+		$op_select->addOptionArray($options);
265
+		$opform->addElement($op_select);
266
+		$opform->display();
267
+
268
+		if ($category_id > 0) {
269
+			$criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
+			$criteria->add(new Criteria('bc.cat_id', $category_id));
271
+			$blog_count = $blogHandler->getCountByCategory($criteria);
272
+			$criteria->setStart($start);
273
+			$criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
+			$blog_objs = $blogHandler->getByCategory($criteria);
275
+		} else {
276
+			/* All active blogs */
277
+			if ($category_id == 0) {
278
+				$criteria = new Criteria('1', 1);
279
+				$criteria->setStart($start);
280
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
+				/* Active blogs */
282
+			} elseif ($category_id == -1) {
283
+				$criteria = new Criteria('blog_status', 1);
284
+				$criteria->setStart($start);
285
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
+				/* Featured blogs */
287
+			} elseif ($category_id == -2) {
288
+				$criteria = new Criteria('blog_status', 2);
289
+				$criteria->setStart($start);
290
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
+				/* Pending blogs */
292
+			} else {
293
+				$criteria = new Criteria('blog_status', 0);
294
+				$criteria->setStart($start);
295
+				$criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
+			}
297
+			$blog_count = $blogHandler->getCount($criteria);
298
+			$blog_objs  = $blogHandler->getAll($criteria);
299
+		}
300
+
301
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
+		echo "<br style=\"clear:both\">";
303
+
304
+		echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
+		echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
+		echo "<tr align='center'>";
307
+		echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
+		echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
+		echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
+		echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
+		//        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
+		//        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
+		echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
+		echo '</tr>';
315
+
316
+		$status = [
317
+			'0' => planet_constant('MD_PENDING'),
318
+			'1' => planet_constant('MD_ACTIVE'),
319
+			'2' => planet_constant('MD_FEATURED')
320
+		];
321
+		foreach (array_keys($blog_objs) as $bid) {
322
+			echo "<tr class='odd' align='left'>";
323
+			echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
+			echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
+			echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
+			echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
+			echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
328 328
                       <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
329 329
                       <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>';
330 330
 
331
-            echo '</tr>';
332
-        }
333
-        echo "<tr class='even' align='center'>";
334
-        echo "<td colspan='7'>";
335
-        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
-        echo "<option value=''>" . _SELECT . '</option>';
337
-        echo "<option value='del'>" . _DELETE . '</option>';
338
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
-        if ($category_id > 0) {
341
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
-        }
343
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
-
347
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
-
350
-        echo '</select>';
351
-        echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
-        echo "<select name='category_dest'>";
353
-        echo "<option value=''>" . _SELECT . '</option>';
354
-        foreach ($categories as $cid => $name) {
355
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
356
-        }
357
-        echo '</select>';
358
-        echo '</div>';
359
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
360
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
-        echo '</td>';
364
-        echo '</tr>';
365
-        if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
-            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
-            $pagenav = $nav->renderNav(4);
369
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
-        }
371
-        echo '</table></form>';
372
-        echo "</fieldset><br style='clear:both;'>";
373
-
374
-        if (empty($start) && empty($category_id)) {
375
-            $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
-            $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
-            $form->addElement(new XoopsFormHidden('op', 'edit'));
378
-            $button_tray = new XoopsFormElementTray('', '');
379
-            $butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
-            $button_tray->addElement($butt_save);
381
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
-            $button_tray->addElement($butt_cancel);
383
-            $form->addElement($button_tray);
384
-
385
-            $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
-            $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
-            $form_add->addElement(new XoopsFormHidden('op', 'add'));
388
-            $button_tray = new XoopsFormElementTray('', '');
389
-            $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
-            $button_tray->addElement($butt_save);
391
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
-            $button_tray->addElement($butt_cancel);
393
-            $form_add->addElement($button_tray);
394
-
395
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
-            echo '<br>';
397
-            $form->display();
398
-            $form_add->display();
399
-            echo '</fieldset>';
400
-        }
401
-        break;
331
+			echo '</tr>';
332
+		}
333
+		echo "<tr class='even' align='center'>";
334
+		echo "<td colspan='7'>";
335
+		echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
+		echo "<option value=''>" . _SELECT . '</option>';
337
+		echo "<option value='del'>" . _DELETE . '</option>';
338
+		echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
+		echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
+		if ($category_id > 0) {
341
+			echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
+		}
343
+		echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
+		echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
+		echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
+
347
+		echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
+		echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
+
350
+		echo '</select>';
351
+		echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
+		echo "<select name='category_dest'>";
353
+		echo "<option value=''>" . _SELECT . '</option>';
354
+		foreach ($categories as $cid => $name) {
355
+			echo "<option value='" . $cid . "'>" . $name . '</option>';
356
+		}
357
+		echo '</select>';
358
+		echo '</div>';
359
+		echo "<input name='start' value='" . $start . "' type='hidden'>";
360
+		echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
+		echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
+		echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
+		echo '</td>';
364
+		echo '</tr>';
365
+		if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
+			include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
+			$nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
+			$pagenav = $nav->renderNav(4);
369
+			echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
+		}
371
+		echo '</table></form>';
372
+		echo "</fieldset><br style='clear:both;'>";
373
+
374
+		if (empty($start) && empty($category_id)) {
375
+			$form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
+			$form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
+			$form->addElement(new XoopsFormHidden('op', 'edit'));
378
+			$button_tray = new XoopsFormElementTray('', '');
379
+			$butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
+			$button_tray->addElement($butt_save);
381
+			$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
+			$button_tray->addElement($butt_cancel);
383
+			$form->addElement($button_tray);
384
+
385
+			$form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
+			$form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
+			$form_add->addElement(new XoopsFormHidden('op', 'add'));
388
+			$button_tray = new XoopsFormElementTray('', '');
389
+			$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
+			$button_tray->addElement($butt_save);
391
+			$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
+			$button_tray->addElement($butt_cancel);
393
+			$form_add->addElement($button_tray);
394
+
395
+			echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
+			echo '<br>';
397
+			$form->display();
398
+			$form_add->display();
399
+			echo '</fieldset>';
400
+		}
401
+		break;
402 402
 }
403 403
 
404 404
 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
@@ -57,348 +57,348 @@
 block discarded – undo
57 57
 
58 58
 switch ($op) {
59 59
     /* save a single blog */
60
-    case 'save':
61
-
62
-        if ($blog_id) {
63
-            $blog_obj = $blogHandler->get($blog_id);
64
-        } else {
65
-            if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
-                redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
-            }
68
-            $blog_obj = $blogHandler->create();
69
-            $blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
-        }
71
-
72
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
-        $blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
-        $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
-
82
-        if (!$blogHandler->insert($blog_obj)) {
83
-        } elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
-            $blog_id = $blog_obj->getVar('blog_id');
85
-            if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
-                $_POST['categories'] = [];
87
-            }
88
-            $blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
-        }
90
-        $message = planet_constant('AM_DBUPDATED');
91
-        redirect_header('admin.blog.php', 2, $message);
92
-
93
-    /* fetch and add a list of blogs to a category */
94
-    // no break
95
-    case 'add':
96
-        $links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
-        $blogs = [];
98
-        foreach ($links as $link) {
99
-            if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
-                continue;
101
-            }
102
-            $blog_obj = $blogHandler->fetch($link['url']);
103
-            if (!empty($link['title'])) {
104
-                $blog_obj->setVar('blog_title', $link['title']);
105
-            }
106
-            $blogHandler->insert($blog_obj);
107
-            $blogs[] = $blog_obj->getVar('blog_id');
108
-            unset($blog_obj);
109
-        }
110
-        if (!empty(Request::getArray('categories', [], 'POST'))) {
111
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
-            foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
-                $categoryHandler->addBlogs($cat_id, $blogs);
114
-            }
115
-        }
116
-        $message = planet_constant('AM_DBUPDATED');
117
-        redirect_header('admin.blog.php', 2, $message);
118
-
119
-    /* update a list of blogs */
120
-    // no break
121
-    case 'update':
122
-        foreach ($blog_id as $bid) {
123
-            $blog_obj = $blogHandler->fetch($bid);
124
-            if (!$blogHandler->insert($blog_obj)) {
125
-            }
126
-            unset($blog_obj);
127
-        }
128
-        $message = planet_constant('AM_DBUPDATED');
129
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
-
131
-    /* add a list of blogs to a category */
132
-    // no break
133
-    case 'register':
134
-        if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
-            if (!is_array($blog_id)) {
136
-                $blog_id = [$blog_id];
137
-            }
138
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
-            $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
-        }
141
-        $message = planet_constant('AM_DBUPDATED');
142
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
-
144
-    /* remove a list of blogs from a category */
145
-    // no break
146
-    case 'remove':
147
-        if (!is_array($blog_id)) {
148
-            $blog_id = [$blog_id];
149
-        }
150
-        if (!empty($category_id)) {
151
-            $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
-            $categoryHandler->removeBlogs($category_id, $blog_id);
153
-        }
154
-        $message = planet_constant('AM_DBUPDATED');
155
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
-
157
-    /* delete a single blog or a list blogs */
158
-    // no break
159
-    case 'del':
160
-        if (!is_array($blog_id)) {
161
-            $blog_id = [$blog_id];
162
-        }
163
-        foreach ($blog_id as $bid) {
164
-            $blog_obj = $blogHandler->get($bid);
165
-            if (!$blogHandler->delete($blog_obj, true)) {
166
-            }
167
-            unset($blog_obj);
168
-        }
169
-        $message = planet_constant('AM_DBUPDATED');
170
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
-
172
-    /* empty a single blog or a list blogs */
173
-    // no break
174
-    case 'empty':
175
-        if (!is_array($blog_id)) {
176
-            $blog_id = [$blog_id];
177
-        }
178
-        foreach ($blog_id as $bid) {
179
-            $blog_obj = $blogHandler->get($bid);
180
-            if (!$blogHandler->do_empty($blog_obj)) {
181
-            }
182
-        }
183
-        $message = planet_constant('AM_DBUPDATED');
184
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
-
186
-    /* approve a single blog or a list blogs */
187
-    // no break
188
-    case 'approve':
189
-        if (!is_array($blog_id)) {
190
-            $blog_id = [$blog_id];
191
-        }
192
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
-        $blogHandler->updateAll('blog_status', 1, $criteria, true);
194
-        $message = planet_constant('AM_DBUPDATED');
195
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
-
197
-    /* mark a single blog or a list blogs as featured */
198
-    // no break
199
-    case 'feature':
200
-        if (!is_array($blog_id)) {
201
-            $blog_id = [$blog_id];
202
-        }
203
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
-        $blogHandler->updateAll('blog_status', 2, $criteria, true);
205
-        $message = planet_constant('AM_DBUPDATED');
206
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
-
208
-    /* edit a single blog */
209
-    // no break
210
-    case 'edit':
211
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
212
-            $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
-            $blog_obj->setVar('blog_id', $blog_id);
214
-        } else {
215
-            $blog_obj = $blogHandler->get($blog_id);
216
-        }
217
-        $categories = Request::getArray('categories', [], 'POST');
218
-        if (empty($categories) && $blog_id > 0) {
219
-            $crit       = new Criteria('bc.blog_id', $blog_id);
220
-            $categories = array_keys($categoryHandler->getByBlog($crit));
221
-        }
222
-        if (empty($categories)) {
223
-            $categories = [0 => _NONE];
224
-        }
225
-
226
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
-        echo '<br>';
228
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
-            $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
-            $blogs_obj = $blogHandler->getList($criteria);
231
-            if (count($blogs_obj) > 0) {
232
-                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
-                foreach (array_keys($blogs_obj) as $bid) {
234
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
-                }
236
-                echo '</div>';
237
-            }
238
-            unset($blogs_obj, $criteria);
239
-        }
240
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
-        echo '</fieldset>';
242
-        break;
243
-
244
-    default:
245
-
246
-        $crit = new Criteria('1', 1);
247
-        $crit->setSort('cat_order');
248
-        $crit->setOrder('ASC');
249
-        $categories = $categoryHandler->getList($crit);
250
-
251
-        // Display category option form
252
-        $opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
-        $op_select = new XoopsFormSelect('', 'category', $category_id);
254
-        $op_select->setExtra('onchange="document.forms.opform.submit()"');
255
-        $options = [
256
-            '0'  => _ALL,
257
-            '-1' => planet_constant('MD_ACTIVE'),
258
-            '-2' => planet_constant('MD_FEATURED'),
259
-            '-3' => planet_constant('MD_PENDING')
260
-        ];
261
-        foreach (array_keys($categories) as $key) {
262
-            $options[$key] = $categories[$key];
263
-        }
264
-        $op_select->addOptionArray($options);
265
-        $opform->addElement($op_select);
266
-        $opform->display();
267
-
268
-        if ($category_id > 0) {
269
-            $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
-            $criteria->add(new Criteria('bc.cat_id', $category_id));
271
-            $blog_count = $blogHandler->getCountByCategory($criteria);
272
-            $criteria->setStart($start);
273
-            $criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
-            $blog_objs = $blogHandler->getByCategory($criteria);
275
-        } else {
276
-            /* All active blogs */
277
-            if ($category_id == 0) {
278
-                $criteria = new Criteria('1', 1);
279
-                $criteria->setStart($start);
280
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
-                /* Active blogs */
282
-            } elseif ($category_id == -1) {
283
-                $criteria = new Criteria('blog_status', 1);
284
-                $criteria->setStart($start);
285
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
-                /* Featured blogs */
287
-            } elseif ($category_id == -2) {
288
-                $criteria = new Criteria('blog_status', 2);
289
-                $criteria->setStart($start);
290
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
-                /* Pending blogs */
292
-            } else {
293
-                $criteria = new Criteria('blog_status', 0);
294
-                $criteria->setStart($start);
295
-                $criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
-            }
297
-            $blog_count = $blogHandler->getCount($criteria);
298
-            $blog_objs  = $blogHandler->getAll($criteria);
299
-        }
300
-
301
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
-        echo "<br style=\"clear:both\">";
303
-
304
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
-        echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
-        echo "<tr align='center'>";
307
-        echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
-        //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
-        //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
-        echo '</tr>';
315
-
316
-        $status = [
317
-            '0' => planet_constant('MD_PENDING'),
318
-            '1' => planet_constant('MD_ACTIVE'),
319
-            '2' => planet_constant('MD_FEATURED')
320
-        ];
321
-        foreach (array_keys($blog_objs) as $bid) {
322
-            echo "<tr class='odd' align='left'>";
323
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
60
+    	case 'save':
61
+
62
+        	if ($blog_id) {
63
+            	$blog_obj = $blogHandler->get($blog_id);
64
+        	} else {
65
+            	if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66
+                	redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67
+            	}
68
+            	$blog_obj = $blogHandler->create();
69
+            	$blog_obj->setVar('blog_submitter', $xoopsUser->getVar('uid'));
70
+        	}
71
+
72
+        	$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
73
+        	$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
74
+        	$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
75
+        	$blog_obj->setVar('blog_feed', Request::getString('blog_feed', '', 'POST')); //$_POST['blog_feed']);
76
+        	$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
77
+        	$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
78
+        	$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
79
+        	$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
80
+        	$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); //$_POST['blog_status']);
81
+
82
+        	if (!$blogHandler->insert($blog_obj)) {
83
+        	} elseif (!empty(Request::getArray('categories', [], 'POST'))) {
84
+            	$blog_id = $blog_obj->getVar('blog_id');
85
+            	if (in_array(0, Request::getArray('categories', [], 'POST'))) {
86
+                	$_POST['categories'] = [];
87
+            	}
88
+            	$blogHandler->setCategories($blog_id, Request::getArray('categories', [], 'POST'));
89
+        	}
90
+        	$message = planet_constant('AM_DBUPDATED');
91
+        	redirect_header('admin.blog.php', 2, $message);
92
+
93
+    	/* fetch and add a list of blogs to a category */
94
+    	// no break
95
+    	case 'add':
96
+        	$links = PlanetUtility::planetParseLinks(Request::getArray('links', [], 'POST'));
97
+        	$blogs = [];
98
+        	foreach ($links as $link) {
99
+            	if ($blog_exist = $blogHandler->getCount(new Criteria('blog_feed', $link['url']))) {
100
+                	continue;
101
+            	}
102
+            	$blog_obj = $blogHandler->fetch($link['url']);
103
+            	if (!empty($link['title'])) {
104
+                	$blog_obj->setVar('blog_title', $link['title']);
105
+            	}
106
+            	$blogHandler->insert($blog_obj);
107
+            	$blogs[] = $blog_obj->getVar('blog_id');
108
+            	unset($blog_obj);
109
+        	}
110
+        	if (!empty(Request::getArray('categories', [], 'POST'))) {
111
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
112
+            	foreach (Request::getArray('categories', [], 'POST') as $cat_id) {
113
+                	$categoryHandler->addBlogs($cat_id, $blogs);
114
+            	}
115
+        	}
116
+        	$message = planet_constant('AM_DBUPDATED');
117
+        	redirect_header('admin.blog.php', 2, $message);
118
+
119
+    	/* update a list of blogs */
120
+    	// no break
121
+    	case 'update':
122
+        	foreach ($blog_id as $bid) {
123
+            	$blog_obj = $blogHandler->fetch($bid);
124
+            	if (!$blogHandler->insert($blog_obj)) {
125
+            	}
126
+            	unset($blog_obj);
127
+        	}
128
+        	$message = planet_constant('AM_DBUPDATED');
129
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
130
+
131
+    	/* add a list of blogs to a category */
132
+    	// no break
133
+    	case 'register':
134
+        	if (!empty(Request::getArray('category_dest', [], 'POST'))) {
135
+            	if (!is_array($blog_id)) {
136
+                	$blog_id = [$blog_id];
137
+            	}
138
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
139
+            	$categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140
+        	}
141
+        	$message = planet_constant('AM_DBUPDATED');
142
+        	redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
143
+
144
+    	/* remove a list of blogs from a category */
145
+    	// no break
146
+    	case 'remove':
147
+        	if (!is_array($blog_id)) {
148
+            	$blog_id = [$blog_id];
149
+        	}
150
+        	if (!empty($category_id)) {
151
+            	$categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
152
+            	$categoryHandler->removeBlogs($category_id, $blog_id);
153
+        	}
154
+        	$message = planet_constant('AM_DBUPDATED');
155
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
156
+
157
+    	/* delete a single blog or a list blogs */
158
+    	// no break
159
+    	case 'del':
160
+        	if (!is_array($blog_id)) {
161
+            	$blog_id = [$blog_id];
162
+        	}
163
+        	foreach ($blog_id as $bid) {
164
+            	$blog_obj = $blogHandler->get($bid);
165
+            	if (!$blogHandler->delete($blog_obj, true)) {
166
+            	}
167
+            	unset($blog_obj);
168
+        	}
169
+        	$message = planet_constant('AM_DBUPDATED');
170
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
171
+
172
+    	/* empty a single blog or a list blogs */
173
+    	// no break
174
+    	case 'empty':
175
+        	if (!is_array($blog_id)) {
176
+            	$blog_id = [$blog_id];
177
+        	}
178
+        	foreach ($blog_id as $bid) {
179
+            	$blog_obj = $blogHandler->get($bid);
180
+            	if (!$blogHandler->do_empty($blog_obj)) {
181
+            	}
182
+        	}
183
+        	$message = planet_constant('AM_DBUPDATED');
184
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
185
+
186
+    	/* approve a single blog or a list blogs */
187
+    	// no break
188
+    	case 'approve':
189
+        	if (!is_array($blog_id)) {
190
+            	$blog_id = [$blog_id];
191
+        	}
192
+        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
193
+        	$blogHandler->updateAll('blog_status', 1, $criteria, true);
194
+        	$message = planet_constant('AM_DBUPDATED');
195
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
196
+
197
+    	/* mark a single blog or a list blogs as featured */
198
+    	// no break
199
+    	case 'feature':
200
+        	if (!is_array($blog_id)) {
201
+            	$blog_id = [$blog_id];
202
+        	}
203
+        	$criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
204
+        	$blogHandler->updateAll('blog_status', 2, $criteria, true);
205
+        	$message = planet_constant('AM_DBUPDATED');
206
+        	redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
207
+
208
+    	/* edit a single blog */
209
+    	// no break
210
+    	case 'edit':
211
+        	if (!empty(Request::getString('fetch', '', 'POST'))) {
212
+            	$blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213
+            	$blog_obj->setVar('blog_id', $blog_id);
214
+        	} else {
215
+            	$blog_obj = $blogHandler->get($blog_id);
216
+        	}
217
+        	$categories = Request::getArray('categories', [], 'POST');
218
+        	if (empty($categories) && $blog_id > 0) {
219
+            	$crit       = new Criteria('bc.blog_id', $blog_id);
220
+            	$categories = array_keys($categoryHandler->getByBlog($crit));
221
+        	}
222
+        	if (empty($categories)) {
223
+            	$categories = [0 => _NONE];
224
+        	}
225
+
226
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
227
+        	echo '<br>';
228
+        	if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229
+            	$criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230
+            	$blogs_obj = $blogHandler->getList($criteria);
231
+            	if (count($blogs_obj) > 0) {
232
+                	echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
233
+                	foreach (array_keys($blogs_obj) as $bid) {
234
+                    	echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
235
+                	}
236
+                	echo '</div>';
237
+            	}
238
+            	unset($blogs_obj, $criteria);
239
+        	}
240
+        	include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
241
+        	echo '</fieldset>';
242
+        	break;
243
+
244
+    	default:
245
+
246
+        	$crit = new Criteria('1', 1);
247
+        	$crit->setSort('cat_order');
248
+        	$crit->setOrder('ASC');
249
+        	$categories = $categoryHandler->getList($crit);
250
+
251
+        	// Display category option form
252
+        	$opform    = new XoopsSimpleForm('', 'opform', 'admin.blog.php', 'get');
253
+        	$op_select = new XoopsFormSelect('', 'category', $category_id);
254
+        	$op_select->setExtra('onchange="document.forms.opform.submit()"');
255
+        	$options = [
256
+            	'0'  => _ALL,
257
+            	'-1' => planet_constant('MD_ACTIVE'),
258
+            	'-2' => planet_constant('MD_FEATURED'),
259
+            	'-3' => planet_constant('MD_PENDING')
260
+        	];
261
+        	foreach (array_keys($categories) as $key) {
262
+            	$options[$key] = $categories[$key];
263
+        	}
264
+        	$op_select->addOptionArray($options);
265
+        	$opform->addElement($op_select);
266
+        	$opform->display();
267
+
268
+        	if ($category_id > 0) {
269
+            	$criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270
+            	$criteria->add(new Criteria('bc.cat_id', $category_id));
271
+            	$blog_count = $blogHandler->getCountByCategory($criteria);
272
+            	$criteria->setStart($start);
273
+            	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
274
+            	$blog_objs = $blogHandler->getByCategory($criteria);
275
+        	} else {
276
+            	/* All active blogs */
277
+            	if ($category_id == 0) {
278
+                	$criteria = new Criteria('1', 1);
279
+                	$criteria->setStart($start);
280
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
281
+                	/* Active blogs */
282
+            	} elseif ($category_id == -1) {
283
+                	$criteria = new Criteria('blog_status', 1);
284
+                	$criteria->setStart($start);
285
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
286
+                	/* Featured blogs */
287
+            	} elseif ($category_id == -2) {
288
+                	$criteria = new Criteria('blog_status', 2);
289
+                	$criteria->setStart($start);
290
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
291
+                	/* Pending blogs */
292
+            	} else {
293
+                	$criteria = new Criteria('blog_status', 0);
294
+                	$criteria->setStart($start);
295
+                	$criteria->setLimit($xoopsModuleConfig['list_perpage']);
296
+            	}
297
+            	$blog_count = $blogHandler->getCount($criteria);
298
+            	$blog_objs  = $blogHandler->getAll($criteria);
299
+        	}
300
+
301
+        	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
302
+        	echo "<br style=\"clear:both\">";
303
+
304
+        	echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
305
+        	echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306
+        	echo "<tr align='center'>";
307
+        	echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
+        	echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
+        	echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
+        	echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
311
+        	//        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312
+        	//        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
+        	echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
314
+        	echo '</tr>';
315
+
316
+        	$status = [
317
+            	'0' => planet_constant('MD_PENDING'),
318
+            	'1' => planet_constant('MD_ACTIVE'),
319
+            	'2' => planet_constant('MD_FEATURED')
320
+        	];
321
+        	foreach (array_keys($blog_objs) as $bid) {
322
+            	echo "<tr class='odd' align='left'>";
323
+            	echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
+            	echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
+            	echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
+            	echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
+            	echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
328 328
                       <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
329 329
                       <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>';
330 330
 
331
-            echo '</tr>';
332
-        }
333
-        echo "<tr class='even' align='center'>";
334
-        echo "<td colspan='7'>";
335
-        echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
-        echo "<option value=''>" . _SELECT . '</option>';
337
-        echo "<option value='del'>" . _DELETE . '</option>';
338
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
-        if ($category_id > 0) {
341
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
-        }
343
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
-
347
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
-
350
-        echo '</select>';
351
-        echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
-        echo "<select name='category_dest'>";
353
-        echo "<option value=''>" . _SELECT . '</option>';
354
-        foreach ($categories as $cid => $name) {
355
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
356
-        }
357
-        echo '</select>';
358
-        echo '</div>';
359
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
360
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
-        echo '</td>';
364
-        echo '</tr>';
365
-        if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
-            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
-            $pagenav = $nav->renderNav(4);
369
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
-        }
371
-        echo '</table></form>';
372
-        echo "</fieldset><br style='clear:both;'>";
373
-
374
-        if (empty($start) && empty($category_id)) {
375
-            $form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
-            $form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
-            $form->addElement(new XoopsFormHidden('op', 'edit'));
378
-            $button_tray = new XoopsFormElementTray('', '');
379
-            $butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
-            $button_tray->addElement($butt_save);
381
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
-            $button_tray->addElement($butt_cancel);
383
-            $form->addElement($button_tray);
384
-
385
-            $form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
-            $form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
-            $form_add->addElement(new XoopsFormHidden('op', 'add'));
388
-            $button_tray = new XoopsFormElementTray('', '');
389
-            $butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
-            $button_tray->addElement($butt_save);
391
-            $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
-            $button_tray->addElement($butt_cancel);
393
-            $form_add->addElement($button_tray);
394
-
395
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
-            echo '<br>';
397
-            $form->display();
398
-            $form_add->display();
399
-            echo '</fieldset>';
400
-        }
401
-        break;
331
+            	echo '</tr>';
332
+        	}
333
+        	echo "<tr class='even' align='center'>";
334
+        	echo "<td colspan='7'>";
335
+        	echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
+        	echo "<option value=''>" . _SELECT . '</option>';
337
+        	echo "<option value='del'>" . _DELETE . '</option>';
338
+        	echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
+        	echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
+        	if ($category_id > 0) {
341
+            	echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
342
+        	}
343
+        	echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
+        	echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
+        	echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
346
+
347
+        	echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
+        	echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
349
+
350
+        	echo '</select>';
351
+        	echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352
+        	echo "<select name='category_dest'>";
353
+        	echo "<option value=''>" . _SELECT . '</option>';
354
+        	foreach ($categories as $cid => $name) {
355
+            	echo "<option value='" . $cid . "'>" . $name . '</option>';
356
+        	}
357
+        	echo '</select>';
358
+        	echo '</div>';
359
+        	echo "<input name='start' value='" . $start . "' type='hidden'>";
360
+        	echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
+        	echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
+        	echo "<input name='' value='" . _CANCEL . "' type='reset'>";
363
+        	echo '</td>';
364
+        	echo '</tr>';
365
+        	if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
+            	include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
+            	$nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
368
+            	$pagenav = $nav->renderNav(4);
369
+            	echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
370
+        	}
371
+        	echo '</table></form>';
372
+        	echo "</fieldset><br style='clear:both;'>";
373
+
374
+        	if (empty($start) && empty($category_id)) {
375
+            	$form = new XoopsThemeForm(_ADD, 'edit', xoops_getenv('PHP_SELF'), 'post', true);
376
+            	$form->addElement(new XoopsFormText(planet_constant('AM_FEED'), 'blog_feed', 50, 255), true);
377
+            	$form->addElement(new XoopsFormHidden('op', 'edit'));
378
+            	$button_tray = new XoopsFormElementTray('', '');
379
+            	$butt_save   = new XoopsFormButton('', 'fetch', _SUBMIT, 'submit');
380
+            	$button_tray->addElement($butt_save);
381
+            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
382
+            	$button_tray->addElement($butt_cancel);
383
+            	$form->addElement($button_tray);
384
+
385
+            	$form_add = new XoopsThemeForm(_ADD, 'add', xoops_getenv('PHP_SELF'), 'post', true);
386
+            	$form_add->addElement(new XoopsFormTextArea(planet_constant('AM_FEED'), 'links'));
387
+            	$form_add->addElement(new XoopsFormHidden('op', 'add'));
388
+            	$button_tray = new XoopsFormElementTray('', '');
389
+            	$butt_save   = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
390
+            	$button_tray->addElement($butt_save);
391
+            	$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'reset');
392
+            	$button_tray->addElement($butt_cancel);
393
+            	$form_add->addElement($button_tray);
394
+
395
+            	echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
396
+            	echo '<br>';
397
+            	$form->display();
398
+            	$form_add->display();
399
+            	echo '</fieldset>';
400
+        	}
401
+        	break;
402 402
 }
403 403
 
404 404
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 // ------------------------------------------------------------------------ //
27 27
 use Xmf\Request;
28 28
 
29
-require_once __DIR__ . '/admin_header.php';
30
-require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
29
+require_once __DIR__.'/admin_header.php';
30
+require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
31 31
 
32 32
 xoops_cp_header();
33 33
 $adminObject = \Xmf\Module\Admin::getInstance();
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
  * This is a tricky fix for incomplete solution of module cone
40 40
  * it is expected to have a better solution in article 1.0
41 41
  */
42
-require XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
42
+require XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
43 43
 //planet_adminmenu(2);
44 44
 
45
-$op          = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
46
-$blog_id     = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
47
-$blog_id     = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id;
48
-$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET');//(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0));
49
-$start       = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET');//(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0));
45
+$op          = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
46
+$blog_id     = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
47
+$blog_id     = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id;
48
+$category_id = Request::getInt('category', Request::getInt('category', 0, 'POST'), 'GET'); //(int)(!empty($_POST['category']) ? $_POST['category'] : (!empty($_GET['category']) ? $_GET['category'] : 0));
49
+$start       = Request::getInt('start', Request::getInt('start', 0, 'POST'), 'GET'); //(int)(!empty($_POST['start']) ? $_POST['start'] : (!empty($_GET['start']) ? $_GET['start'] : 0));
50 50
 
51 51
 $blogHandler     = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
52 52
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         if ($blog_id) {
63 63
             $blog_obj = $blogHandler->get($blog_id);
64
-        } else {
64
+        }else {
65 65
             if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', Request::getString('blog_feed', '', 'POST')))) {
66 66
                 redirect_header('admin.blog.php', 2, planet_constant('AM_BLOGEXISTS'));
67 67
             }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             unset($blog_obj);
127 127
         }
128 128
         $message = planet_constant('AM_DBUPDATED');
129
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
129
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
130 130
 
131 131
     /* add a list of blogs to a category */
132 132
     // no break
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             $categoryHandler->addBlogs(Request::getArray('category_dest', [], 'POST'), $blog_id);
140 140
         }
141 141
         $message = planet_constant('AM_DBUPDATED');
142
-        redirect_header('admin.blog.php?category=' . Request::getArray('category_dest', [], 'POST') . '&amp;start=' . $start, 2, $message);
142
+        redirect_header('admin.blog.php?category='.Request::getArray('category_dest', [], 'POST').'&amp;start='.$start, 2, $message);
143 143
 
144 144
     /* remove a list of blogs from a category */
145 145
     // no break
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             $categoryHandler->removeBlogs($category_id, $blog_id);
153 153
         }
154 154
         $message = planet_constant('AM_DBUPDATED');
155
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
155
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
156 156
 
157 157
     /* delete a single blog or a list blogs */
158 158
     // no break
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             unset($blog_obj);
168 168
         }
169 169
         $message = planet_constant('AM_DBUPDATED');
170
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
170
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
171 171
 
172 172
     /* empty a single blog or a list blogs */
173 173
     // no break
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             }
182 182
         }
183 183
         $message = planet_constant('AM_DBUPDATED');
184
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
184
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
185 185
 
186 186
     /* approve a single blog or a list blogs */
187 187
     // no break
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
         if (!is_array($blog_id)) {
190 190
             $blog_id = [$blog_id];
191 191
         }
192
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
192
+        $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN');
193 193
         $blogHandler->updateAll('blog_status', 1, $criteria, true);
194 194
         $message = planet_constant('AM_DBUPDATED');
195
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
195
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
196 196
 
197 197
     /* mark a single blog or a list blogs as featured */
198 198
     // no break
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
         if (!is_array($blog_id)) {
201 201
             $blog_id = [$blog_id];
202 202
         }
203
-        $criteria = new Criteria('blog_id', '(' . implode(',', $blog_id) . ')', 'IN');
203
+        $criteria = new Criteria('blog_id', '('.implode(',', $blog_id).')', 'IN');
204 204
         $blogHandler->updateAll('blog_status', 2, $criteria, true);
205 205
         $message = planet_constant('AM_DBUPDATED');
206
-        redirect_header('admin.blog.php?category=' . $category_id . '&amp;start=' . $start, 2, $message);
206
+        redirect_header('admin.blog.php?category='.$category_id.'&amp;start='.$start, 2, $message);
207 207
 
208 208
     /* edit a single blog */
209 209
     // no break
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
         if (!empty(Request::getString('fetch', '', 'POST'))) {
212 212
             $blog_obj = $blogHandler->fetch(Request::getString('blog_feed', '', 'POST'));
213 213
             $blog_obj->setVar('blog_id', $blog_id);
214
-        } else {
214
+        }else {
215 215
             $blog_obj = $blogHandler->get($blog_id);
216 216
         }
217 217
         $categories = Request::getArray('categories', [], 'POST');
218
-        if (empty($categories) && $blog_id > 0) {
218
+        if (empty($categories) && $blog_id>0) {
219 219
             $crit       = new Criteria('bc.blog_id', $blog_id);
220 220
             $categories = array_keys($categoryHandler->getByBlog($crit));
221 221
         }
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
             $categories = [0 => _NONE];
224 224
         }
225 225
 
226
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
226
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>';
227 227
         echo '<br>';
228 228
         if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
229 229
             $criteria  = new Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
230 230
             $blogs_obj = $blogHandler->getList($criteria);
231
-            if (count($blogs_obj) > 0) {
232
-                echo "<div class=\"errorMsg\">" . planet_constant('AM_BLOGEXISTS');
231
+            if (count($blogs_obj)>0) {
232
+                echo "<div class=\"errorMsg\">".planet_constant('AM_BLOGEXISTS');
233 233
                 foreach (array_keys($blogs_obj) as $bid) {
234
-                    echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>';
234
+                    echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>';
235 235
                 }
236 236
                 echo '</div>';
237 237
             }
238 238
             unset($blogs_obj, $criteria);
239 239
         }
240
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
240
+        include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php';
241 241
         echo '</fieldset>';
242 242
         break;
243 243
 
@@ -265,14 +265,14 @@  discard block
 block discarded – undo
265 265
         $opform->addElement($op_select);
266 266
         $opform->display();
267 267
 
268
-        if ($category_id > 0) {
268
+        if ($category_id>0) {
269 269
             $criteria = new CriteriaCompo(new Criteria('b.blog_status', 0, '>'));
270 270
             $criteria->add(new Criteria('bc.cat_id', $category_id));
271 271
             $blog_count = $blogHandler->getCountByCategory($criteria);
272 272
             $criteria->setStart($start);
273 273
             $criteria->setLimit($xoopsModuleConfig['list_perpage']);
274 274
             $blog_objs = $blogHandler->getByCategory($criteria);
275
-        } else {
275
+        }else {
276 276
             /* All active blogs */
277 277
             if ($category_id == 0) {
278 278
                 $criteria = new Criteria('1', 1);
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                 $criteria->setStart($start);
290 290
                 $criteria->setLimit($xoopsModuleConfig['list_perpage']);
291 291
                 /* Pending blogs */
292
-            } else {
292
+            }else {
293 293
                 $criteria = new Criteria('blog_status', 0);
294 294
                 $criteria->setStart($start);
295 295
                 $criteria->setLimit($xoopsModuleConfig['list_perpage']);
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
             $blog_objs  = $blogHandler->getAll($criteria);
299 299
         }
300 300
 
301
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . planet_constant('AM_LIST') . '</legend>';
301
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>".planet_constant('AM_LIST').'</legend>';
302 302
         echo "<br style=\"clear:both\">";
303 303
 
304
-        echo "<form name='list' id='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>";
304
+        echo "<form name='list' id='list' method='post' action='".xoops_getenv('PHP_SELF')."'>";
305 305
         echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>";
306 306
         echo "<tr align='center'>";
307 307
         echo "<th class='bg3' width='5%'><input name='blog_check' id='blog_check' value='1' type='checkbox'  onclick=\"xoopsCheckAll('list', 'blog_check');\"></td>";
308
-        echo "<th class='bg3'>" . planet_constant('AM_TITLE') . '</td>';
309
-        echo "<th class='bg3' width='5%'>" . planet_constant('AM_STATUS') . '</td>';
310
-        echo "<th class='bg3' width='40%'>" . planet_constant('AM_FEED') . '</td>';
308
+        echo "<th class='bg3'>".planet_constant('AM_TITLE').'</td>';
309
+        echo "<th class='bg3' width='5%'>".planet_constant('AM_STATUS').'</td>';
310
+        echo "<th class='bg3' width='40%'>".planet_constant('AM_FEED').'</td>';
311 311
         //        echo "<th class='bg3' width='5%'>" . _EDIT . "</td>";
312 312
         //        echo "<th class='bg3' width='5%'>" . _DELETE . "</td>";
313
-        echo "<th class='bg3' width='10%'>" . planet_constant('AM_ACTIONS') . '</td>';
313
+        echo "<th class='bg3' width='10%'>".planet_constant('AM_ACTIONS').'</td>';
314 314
         echo '</tr>';
315 315
 
316 316
         $status = [
@@ -320,53 +320,53 @@  discard block
 block discarded – undo
320 320
         ];
321 321
         foreach (array_keys($blog_objs) as $bid) {
322 322
             echo "<tr class='odd' align='left'>";
323
-            echo "<td align='center'><input name='blog[]' value='" . $bid . "' type='checkbox'></td>";
324
-            echo "<td><a href='" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "'>" . $blog_objs[$bid]->getVar('blog_title') . '</a></td>';
325
-            echo "<td align='center'>" . $status[$blog_objs[$bid]->getVar('blog_status')] . '</td>';
326
-            echo '<td>' . $blog_objs[$bid]->getVar('blog_feed') . '</td>';
327
-            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=" . $bid . "' title='" . _EDIT . "'><img src='" . $pathIcon16 . "/edit.png '" . "alt='" . _EDIT . " title='" . _EDIT . " </a>
328
-                      <a href='admin.blog.php?op=del&amp;blog=" . $bid . "' title='" . _DELETE . "'><img src='" . $pathIcon16 . "/delete.png '" . " alt='" . _EDIT . " title='" . _DELETE . " </a>&nbsp;
329
-                      <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>';
323
+            echo "<td align='center'><input name='blog[]' value='".$bid."' type='checkbox'></td>";
324
+            echo "<td><a href='".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."'>".$blog_objs[$bid]->getVar('blog_title').'</a></td>';
325
+            echo "<td align='center'>".$status[$blog_objs[$bid]->getVar('blog_status')].'</td>';
326
+            echo '<td>'.$blog_objs[$bid]->getVar('blog_feed').'</td>';
327
+            echo "<td align='center'><a href='admin.blog.php?op=edit&amp;blog=".$bid."' title='"._EDIT."'><img src='".$pathIcon16."/edit.png '"."alt='"._EDIT." title='"._EDIT." </a>
328
+                      <a href='admin.blog.php?op=del&amp;blog=" . $bid."' title='"._DELETE."'><img src='".$pathIcon16."/delete.png '"." alt='"._EDIT." title='"._DELETE." </a>&nbsp;
329
+                      <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>';
330 330
 
331 331
             echo '</tr>';
332 332
         }
333 333
         echo "<tr class='even' align='center'>";
334 334
         echo "<td colspan='7'>";
335 335
         echo "<select name='op' onChange='if (this.options[this.selectedIndex].value==\"register\") {setVisible(\"catdiv\");} else {setHidden(\"catdiv\");}'>";
336
-        echo "<option value=''>" . _SELECT . '</option>';
337
-        echo "<option value='del'>" . _DELETE . '</option>';
338
-        echo "<option value='empty'>" . planet_constant('MD_EMPTY_BLOG') . '</option>';
339
-        echo "<option value='register'>" . planet_constant('AM_REGISTER') . '</option>';
340
-        if ($category_id > 0) {
341
-            echo "<option value='remove'>" . planet_constant('AM_REMOVE') . '</option>';
336
+        echo "<option value=''>"._SELECT.'</option>';
337
+        echo "<option value='del'>"._DELETE.'</option>';
338
+        echo "<option value='empty'>".planet_constant('MD_EMPTY_BLOG').'</option>';
339
+        echo "<option value='register'>".planet_constant('AM_REGISTER').'</option>';
340
+        if ($category_id>0) {
341
+            echo "<option value='remove'>".planet_constant('AM_REMOVE').'</option>';
342 342
         }
343
-        echo "<option value='approve'>" . planet_constant('AM_APPROVE') . '</option>';
344
-        echo "<option value='feature'>" . planet_constant('AM_FEATURE') . '</option>';
345
-        echo "<option value='update'>" . planet_constant('AM_UPDATE') . '</option>';
343
+        echo "<option value='approve'>".planet_constant('AM_APPROVE').'</option>';
344
+        echo "<option value='feature'>".planet_constant('AM_FEATURE').'</option>';
345
+        echo "<option value='update'>".planet_constant('AM_UPDATE').'</option>';
346 346
 
347
-        echo "<option value='pending'>" . planet_constant('AM_PENDING') . '</option>';
348
-        echo "<option value='active'>" . planet_constant('AM_ACTIVE') . '</option>';
347
+        echo "<option value='pending'>".planet_constant('AM_PENDING').'</option>';
348
+        echo "<option value='active'>".planet_constant('AM_ACTIVE').'</option>';
349 349
 
350 350
         echo '</select>';
351 351
         echo "<div id='catdiv' style='visibility:hidden;display:inline;'>";
352 352
         echo "<select name='category_dest'>";
353
-        echo "<option value=''>" . _SELECT . '</option>';
353
+        echo "<option value=''>"._SELECT.'</option>';
354 354
         foreach ($categories as $cid => $name) {
355
-            echo "<option value='" . $cid . "'>" . $name . '</option>';
355
+            echo "<option value='".$cid."'>".$name.'</option>';
356 356
         }
357 357
         echo '</select>';
358 358
         echo '</div>';
359
-        echo "<input name='start' value='" . $start . "' type='hidden'>";
360
-        echo "<input name='category' value='" . $category_id . "' type='hidden'>";
361
-        echo "<input name='submit' value='" . _SUBMIT . "' type='submit'>";
362
-        echo "<input name='' value='" . _CANCEL . "' type='reset'>";
359
+        echo "<input name='start' value='".$start."' type='hidden'>";
360
+        echo "<input name='category' value='".$category_id."' type='hidden'>";
361
+        echo "<input name='submit' value='"._SUBMIT."' type='submit'>";
362
+        echo "<input name='' value='"._CANCEL."' type='reset'>";
363 363
         echo '</td>';
364 364
         echo '</tr>';
365
-        if ($blog_count > $xoopsModuleConfig['list_perpage']) {
366
-            include XOOPS_ROOT_PATH . '/class/pagenav.php';
367
-            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category=' . $category_id);
365
+        if ($blog_count>$xoopsModuleConfig['list_perpage']) {
366
+            include XOOPS_ROOT_PATH.'/class/pagenav.php';
367
+            $nav     = new XoopsPageNav($blog_count, $xoopsModuleConfig['list_perpage'], $start, 'start', 'category='.$category_id);
368 368
             $pagenav = $nav->renderNav(4);
369
-            echo "<tr align='right'><td colspan='6'>" . $pagenav . '</td></tr>';
369
+            echo "<tr align='right'><td colspan='6'>".$pagenav.'</td></tr>';
370 370
         }
371 371
         echo '</table></form>';
372 372
         echo "</fieldset><br style='clear:both;'>";
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
             $button_tray->addElement($butt_cancel);
393 393
             $form_add->addElement($button_tray);
394 394
 
395
-            echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _ADD . '</legend>';
395
+            echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._ADD.'</legend>';
396 396
             echo '<br>';
397 397
             $form->display();
398 398
             $form_add->display();
Please login to merge, or discard this patch.
admin/menu.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
 if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
31 31
 } else {
32
-    $moduleHelper = Xmf\Module\Helper::getHelper('system');
32
+	$moduleHelper = Xmf\Module\Helper::getHelper('system');
33 33
 }
34 34
 
35 35
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 $moduleDirName = basename(dirname(__DIR__));
29 29
 
30 30
 if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
31
-} else {
31
+}else {
32 32
     $moduleHelper = Xmf\Module\Helper::getHelper('system');
33 33
 }
34 34
 
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 $i                      = 0;
43 43
 $adminmenu[$i]['title'] = _AM_MODULEADMIN_HOME;
44 44
 $adminmenu[$i]['link']  = 'admin/index.php';
45
-$adminmenu[$i]['icon']  = $pathIcon32 . '/home.png';
45
+$adminmenu[$i]['icon']  = $pathIcon32.'/home.png';
46 46
 ++$i;
47 47
 $adminmenu[$i]['title'] = planet_constant('MI_ADMENU_INDEX');
48 48
 $adminmenu[$i]['link']  = 'admin/main.php';
49
-$adminmenu[$i]['icon']  = $pathIcon32 . '/manage.png';
49
+$adminmenu[$i]['icon']  = $pathIcon32.'/manage.png';
50 50
 
51 51
 ++$i;
52 52
 $adminmenu[$i]['title'] = planet_constant('MI_ADMENU_CATEGORY');
53 53
 $adminmenu[$i]['link']  = 'admin/admin.category.php';
54
-$adminmenu[$i]['icon']  = $pathIcon32 . '/category.png';
54
+$adminmenu[$i]['icon']  = $pathIcon32.'/category.png';
55 55
 ++$i;
56 56
 $adminmenu[$i]['title'] = planet_constant('MI_ADMENU_BLOG');
57 57
 $adminmenu[$i]['link']  = 'admin/admin.blog.php';
58
-$adminmenu[$i]['icon']  = $pathIcon32 . '/translations.png';
58
+$adminmenu[$i]['icon']  = $pathIcon32.'/translations.png';
59 59
 ++$i;
60 60
 $adminmenu[$i]['title'] = planet_constant('MI_ADMENU_ARTICLE');
61 61
 $adminmenu[$i]['link']  = 'admin/admin.article.php';
62
-$adminmenu[$i]['icon']  = $pathIcon32 . '/content.png';
62
+$adminmenu[$i]['icon']  = $pathIcon32.'/content.png';
63 63
 //++$i;
64 64
 //$adminmenu[$i]['title'] = planet_constant("MI_ADMENU_BLOCK");
65 65
 //$adminmenu[$i]['link'] = "admin/admin.block.php";
@@ -67,4 +67,4 @@  discard block
 block discarded – undo
67 67
 ++$i;
68 68
 $adminmenu[$i]['title'] = _AM_MODULEADMIN_ABOUT;
69 69
 $adminmenu[$i]['link']  = 'admin/about.php';
70
-$adminmenu[$i]['icon']  = $pathIcon32 . '/about.png';
70
+$adminmenu[$i]['icon']  = $pathIcon32.'/about.png';
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.
xml.php 2 patches
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 include __DIR__ . '/header.php';
31 31
 
32 32
 if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
33
-    $args['article'] = @$args_num[0];
34
-    $args['type']    = @$args_str[0];
33
+	$args['article'] = @$args_num[0];
34
+	$args['type']    = @$args_str[0];
35 35
 }
36 36
 
37 37
 /* Specified Article */
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 
49 49
 $valid_format = ['RSS0.91', 'RSS1.0', 'RSS2.0', 'PIE0.1', 'MBOX', 'OPML', 'ATOM', 'ATOM0.3', 'HTML', 'JS'];
50 50
 if ($type === 'RDF') {
51
-    $type = 'RSS1.0';
51
+	$type = 'RSS1.0';
52 52
 }
53 53
 if ($type === 'RSS') {
54
-    $type = 'RSS0.91';
54
+	$type = 'RSS0.91';
55 55
 }
56 56
 if (empty($type) || !in_array($type, $valid_format)) {
57
-    PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
58
-    exit();
57
+	PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
58
+	exit();
59 59
 }
60 60
 
61 61
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -64,30 +64,30 @@  discard block
 block discarded – undo
64 64
 $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
65 65
 
66 66
 if (!empty($article_id)) {
67
-    $article_obj = $articleHandler->get($article_id);
68
-    if (!$article_obj->getVar('art_id')) {
69
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED'));
70
-        exit();
71
-    }
72
-    $source = 'article';
67
+	$article_obj = $articleHandler->get($article_id);
68
+	if (!$article_obj->getVar('art_id')) {
69
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED'));
70
+		exit();
71
+	}
72
+	$source = 'article';
73 73
 } elseif (!empty($blog_id)) {
74
-    $blog_obj = $blogHandler->get($blog_id);
75
-    if (!$blog_obj->getVar('blog_id')) {
76
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
77
-        exit();
78
-    }
79
-    $source = 'blog';
74
+	$blog_obj = $blogHandler->get($blog_id);
75
+	if (!$blog_obj->getVar('blog_id')) {
76
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
77
+		exit();
78
+	}
79
+	$source = 'blog';
80 80
 } elseif (!empty($category_id)) {
81
-    $source       = 'category';
82
-    $category_obj = $categoryHandler->get($category_id);
83
-    if (!$category_obj->getVar('cat_id')) {
84
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
85
-        exit();
86
-    }
81
+	$source       = 'category';
82
+	$category_obj = $categoryHandler->get($category_id);
83
+	if (!$category_obj->getVar('cat_id')) {
84
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
85
+		exit();
86
+	}
87 87
 } elseif (!empty($uid)) {
88
-    $source = 'bookmark';
88
+	$source = 'bookmark';
89 89
 } else {
90
-    $source = '';
90
+	$source = '';
91 91
 }
92 92
 
93 93
 $xml_charset = 'UTF-8';
@@ -97,102 +97,102 @@  discard block
 block discarded – undo
97 97
 $tpl->xoops_setCacheTime(3600);
98 98
 $xoopsCachedTemplateId = md5($xoopsModule->getVar('mid') . ',' . $article_id . ',' . $category_id . ',' . $blog_id . ',' . $uid . ',' . $type);
99 99
 if (!$tpl->is_cached('db:system_dummy.tpl', $xoopsCachedTemplateId)) {
100
-    $criteria = new CriteriaCompo();
101
-    $criteria->setLimit($xoopsModuleConfig['articles_perpage']);
102
-    $articles_obj = [];
103
-    switch ($source) {
104
-        case 'article':
105
-            $pagetitle = planet_constant('MD_ARTICLE');
106
-            $rssdesc   = planet_constant('MD_XMLDESC_ARTICLE');
107
-
108
-            $articles_obj[$article_id] = $article_obj;
109
-
110
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
111
-            break;
112
-
113
-        case 'category':
114
-            $pagetitle = planet_constant('MD_CATEGORY');
115
-            $rssdesc   = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title'));
116
-
117
-            $criteria->add(new Criteria('bc.cat_id', $category_id));
118
-            $articles_obj = $articleHandler->getByCategory($criteria);
119
-
120
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
121
-            break;
122
-
123
-        case 'blog':
124
-            $pagetitle = planet_constant('MD_BLOG');
125
-            $rssdesc   = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title'));
126
-
127
-            $criteria->add(new Criteria('blog_id', $blog_id));
128
-            $articles_obj = $articleHandler->getAll($criteria);
129
-
130
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
131
-            break;
132
-
133
-        case 'bookmark':
134
-            $author_name = XoopsUser::getUnameFromId($uid);
135
-            $pagetitle   = planet_constant('MD_BOOKMARKS');
136
-            $rssdesc     = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name);
137
-
138
-            $criteria->add(new Criteria('bm.bm_uid', $uid));
139
-            $articles_obj = $articleHandler->getByBookmark($criteria);
140
-
141
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
142
-
143
-            break;
144
-
145
-        default:
146
-            $pagetitle = planet_constant('MD_INDEX');
147
-            $rssdesc   = planet_constant('MD_XMLDESC_INDEX');
148
-
149
-            $articles_obj = $articleHandler->getAll($criteria);
150
-
151
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
152
-            break;
153
-    }
154
-    $items = [];
155
-    foreach (array_keys($articles_obj) as $id) {
156
-        $content = $articles_obj[$id]->getVar('art_content');
157
-        $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
158
-        $items[] = [
159
-            'title'                     => $articles_obj[$id]->getVar('art_title'),
160
-            'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
161
-            'description'               => $content,
162
-            'descriptionHtmlSyndicated' => true,
163
-            'date'                      => $articles_obj[$id]->getTime('rss'),
164
-            'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
165
-            'author'                    => $articles_obj[$id]->getVar('art_author')
166
-        ];
167
-    }
168
-    unset($articles_obj, $criteria);
169
-
170
-    $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
171
-    $xml        = $xmlHandler->create($type);
172
-    $xml->setVar('encoding', $xml_charset);
173
-    $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
174
-    $xml->setVar('description', $rssdesc, true);
175
-    $xml->setVar('descriptionHtmlSyndicated', true);
176
-    $xml->setVar('link', $xml_link);
177
-    $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
178
-    $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
179
-    $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
180
-    $xml->setVar('category', $xoopsModule->getVar('name'), true);
181
-    $xml->setVar('generator', $xoopsModule->getInfo('version'));
182
-    $xml->setVar('language', _LANGCODE);
183
-
184
-    $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
185
-    $image     = [
186
-        'width'       => $dimention[0],
187
-        'height'      => $dimention[1],
188
-        'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
189
-        'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
190
-        'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
191
-        'description' => $rssdesc
192
-    ];
193
-    $xml->setImage($image);
194
-
195
-    /*
100
+	$criteria = new CriteriaCompo();
101
+	$criteria->setLimit($xoopsModuleConfig['articles_perpage']);
102
+	$articles_obj = [];
103
+	switch ($source) {
104
+		case 'article':
105
+			$pagetitle = planet_constant('MD_ARTICLE');
106
+			$rssdesc   = planet_constant('MD_XMLDESC_ARTICLE');
107
+
108
+			$articles_obj[$article_id] = $article_obj;
109
+
110
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
111
+			break;
112
+
113
+		case 'category':
114
+			$pagetitle = planet_constant('MD_CATEGORY');
115
+			$rssdesc   = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title'));
116
+
117
+			$criteria->add(new Criteria('bc.cat_id', $category_id));
118
+			$articles_obj = $articleHandler->getByCategory($criteria);
119
+
120
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
121
+			break;
122
+
123
+		case 'blog':
124
+			$pagetitle = planet_constant('MD_BLOG');
125
+			$rssdesc   = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title'));
126
+
127
+			$criteria->add(new Criteria('blog_id', $blog_id));
128
+			$articles_obj = $articleHandler->getAll($criteria);
129
+
130
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
131
+			break;
132
+
133
+		case 'bookmark':
134
+			$author_name = XoopsUser::getUnameFromId($uid);
135
+			$pagetitle   = planet_constant('MD_BOOKMARKS');
136
+			$rssdesc     = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name);
137
+
138
+			$criteria->add(new Criteria('bm.bm_uid', $uid));
139
+			$articles_obj = $articleHandler->getByBookmark($criteria);
140
+
141
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
142
+
143
+			break;
144
+
145
+		default:
146
+			$pagetitle = planet_constant('MD_INDEX');
147
+			$rssdesc   = planet_constant('MD_XMLDESC_INDEX');
148
+
149
+			$articles_obj = $articleHandler->getAll($criteria);
150
+
151
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
152
+			break;
153
+	}
154
+	$items = [];
155
+	foreach (array_keys($articles_obj) as $id) {
156
+		$content = $articles_obj[$id]->getVar('art_content');
157
+		$content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
158
+		$items[] = [
159
+			'title'                     => $articles_obj[$id]->getVar('art_title'),
160
+			'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
161
+			'description'               => $content,
162
+			'descriptionHtmlSyndicated' => true,
163
+			'date'                      => $articles_obj[$id]->getTime('rss'),
164
+			'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
165
+			'author'                    => $articles_obj[$id]->getVar('art_author')
166
+		];
167
+	}
168
+	unset($articles_obj, $criteria);
169
+
170
+	$xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
171
+	$xml        = $xmlHandler->create($type);
172
+	$xml->setVar('encoding', $xml_charset);
173
+	$xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
174
+	$xml->setVar('description', $rssdesc, true);
175
+	$xml->setVar('descriptionHtmlSyndicated', true);
176
+	$xml->setVar('link', $xml_link);
177
+	$xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
178
+	$xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
179
+	$xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
180
+	$xml->setVar('category', $xoopsModule->getVar('name'), true);
181
+	$xml->setVar('generator', $xoopsModule->getInfo('version'));
182
+	$xml->setVar('language', _LANGCODE);
183
+
184
+	$dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
185
+	$image     = [
186
+		'width'       => $dimention[0],
187
+		'height'      => $dimention[1],
188
+		'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
189
+		'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
190
+		'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
191
+		'description' => $rssdesc
192
+	];
193
+	$xml->setImage($image);
194
+
195
+	/*
196 196
     $item = array(
197 197
         "title" => $datatitle,
198 198
         "link" => $dataurl,
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
         "author" => $dataauthor
204 204
         );
205 205
     */
206
-    $xml->addItems($items);
206
+	$xml->addItems($items);
207 207
 
208
-    $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
208
+	$dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
209 209
 
210
-    $tpl->assign_by_ref('dummy_content', $dummy_content);
210
+	$tpl->assign_by_ref('dummy_content', $dummy_content);
211 211
 }
212 212
 //$content = ob_get_contents();
213 213
 ob_end_clean();
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 use Xmf\Request;
28 28
 
29 29
 ob_start();
30
-include __DIR__ . '/header.php';
30
+include __DIR__.'/header.php';
31 31
 
32 32
 if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
33 33
     $args['article'] = @$args_num[0];
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
     }
87 87
 } elseif (!empty($uid)) {
88 88
     $source = 'bookmark';
89
-} else {
89
+}else {
90 90
     $source = '';
91 91
 }
92 92
 
93 93
 $xml_charset = 'UTF-8';
94
-require_once XOOPS_ROOT_PATH . '/class/template.php';
94
+require_once XOOPS_ROOT_PATH.'/class/template.php';
95 95
 $tpl = new XoopsTpl();
96 96
 $tpl->xoops_setCaching(2);
97 97
 $tpl->xoops_setCacheTime(3600);
98
-$xoopsCachedTemplateId = md5($xoopsModule->getVar('mid') . ',' . $article_id . ',' . $category_id . ',' . $blog_id . ',' . $uid . ',' . $type);
98
+$xoopsCachedTemplateId = md5($xoopsModule->getVar('mid').','.$article_id.','.$category_id.','.$blog_id.','.$uid.','.$type);
99 99
 if (!$tpl->is_cached('db:system_dummy.tpl', $xoopsCachedTemplateId)) {
100 100
     $criteria = new CriteriaCompo();
101 101
     $criteria->setLimit($xoopsModuleConfig['articles_perpage']);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
             $articles_obj[$article_id] = $article_obj;
109 109
 
110
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
110
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_obj->getVar('art_id');
111 111
             break;
112 112
 
113 113
         case 'category':
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $criteria->add(new Criteria('bc.cat_id', $category_id));
118 118
             $articles_obj = $articleHandler->getByCategory($criteria);
119 119
 
120
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
120
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'c'.$category_id;
121 121
             break;
122 122
 
123 123
         case 'blog':
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $criteria->add(new Criteria('blog_id', $blog_id));
128 128
             $articles_obj = $articleHandler->getAll($criteria);
129 129
 
130
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
130
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id;
131 131
             break;
132 132
 
133 133
         case 'bookmark':
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $criteria->add(new Criteria('bm.bm_uid', $uid));
139 139
             $articles_obj = $articleHandler->getByBookmark($criteria);
140 140
 
141
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
141
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'u'.$uid;
142 142
 
143 143
             break;
144 144
 
@@ -148,20 +148,20 @@  discard block
 block discarded – undo
148 148
 
149 149
             $articles_obj = $articleHandler->getAll($criteria);
150 150
 
151
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
151
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php';
152 152
             break;
153 153
     }
154 154
     $items = [];
155 155
     foreach (array_keys($articles_obj) as $id) {
156 156
         $content = $articles_obj[$id]->getVar('art_content');
157
-        $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
157
+        $content .= '<br>'.planet_constant('MD_SOURCE').': '.$articles_obj[$id]->getVar('art_link').' '.$articles_obj[$id]->getVar('art_author');
158 158
         $items[] = [
159 159
             'title'                     => $articles_obj[$id]->getVar('art_title'),
160
-            'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
160
+            'link'                      => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$articles_obj[$id]->getVar('art_id'),
161 161
             'description'               => $content,
162 162
             'descriptionHtmlSyndicated' => true,
163 163
             'date'                      => $articles_obj[$id]->getTime('rss'),
164
-            'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
164
+            'source'                    => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/',
165 165
             'author'                    => $articles_obj[$id]->getVar('art_author')
166 166
         ];
167 167
     }
@@ -170,24 +170,24 @@  discard block
 block discarded – undo
170 170
     $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
171 171
     $xml        = $xmlHandler->create($type);
172 172
     $xml->setVar('encoding', $xml_charset);
173
-    $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
173
+    $xml->setVar('title', $xoopsConfig['sitename'].' :: '.$pagetitle, 'UTF-8', $xml_charset, true);
174 174
     $xml->setVar('description', $rssdesc, true);
175 175
     $xml->setVar('descriptionHtmlSyndicated', true);
176 176
     $xml->setVar('link', $xml_link);
177
-    $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
177
+    $xml->setVar('syndicationURL', XOOPS_URL.'/'.xoops_getenv('PHP_SELF'), 'post', true);
178 178
     $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
179 179
     $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
180 180
     $xml->setVar('category', $xoopsModule->getVar('name'), true);
181 181
     $xml->setVar('generator', $xoopsModule->getInfo('version'));
182 182
     $xml->setVar('language', _LANGCODE);
183 183
 
184
-    $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
184
+    $dimention = @getimagesize(XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/'.$xoopsModule->getInfo('image'));
185 185
     $image     = [
186 186
         'width'       => $dimention[0],
187 187
         'height'      => $dimention[1],
188
-        'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
189
-        'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
190
-        'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
188
+        'title'       => $xoopsConfig['sitename'].' :: '.$pagetitle,
189
+        'url'         => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'.$xoopsModule->getInfo('image'),
190
+        'link'        => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/',
191 191
         'description' => $rssdesc
192 192
     ];
193 193
     $xml->setImage($image);
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
     */
206 206
     $xml->addItems($items);
207 207
 
208
-    $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
208
+    $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'.xml.tmp');
209 209
 
210 210
     $tpl->assign_by_ref('dummy_content', $dummy_content);
211 211
 }
212 212
 //$content = ob_get_contents();
213 213
 ob_end_clean();
214
-header('Content-Type:text/xml; charset=' . $xml_charset);
214
+header('Content-Type:text/xml; charset='.$xml_charset);
215 215
 $tpl->display('db:system_dummy.tpl', $xoopsCachedTemplateId);
Please login to merge, or discard this patch.