@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | include __DIR__ . '/header.php'; |
33 | 33 | |
34 | 34 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
35 | - $args['year'] = @$args_num[0]; |
|
36 | - $args['month'] = @$args_num[1]; |
|
37 | - $args['day'] = @$args_num[2]; |
|
35 | + $args['year'] = @$args_num[0]; |
|
36 | + $args['month'] = @$args_num[1]; |
|
37 | + $args['day'] = @$args_num[2]; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $day = Request::getInt('day', @$args['day'], 'GET'); //(int)(empty($_GET['day']) ? @$args['day'] : $_GET['day']); |
@@ -55,31 +55,31 @@ discard block |
||
55 | 55 | |
56 | 56 | $year = empty($year) ? date('Y') : $year; |
57 | 57 | if ($month < 1) { |
58 | - $month = $day = 0; |
|
59 | - $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
|
58 | + $month = $day = 0; |
|
59 | + $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
|
60 | 60 | } elseif ($day < 1) { |
61 | - $day = 0; |
|
62 | - $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
|
61 | + $day = 0; |
|
62 | + $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
|
63 | 63 | } else { |
64 | - $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
|
64 | + $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
|
65 | 65 | } |
66 | 66 | $time = ['year' => $year, 'month' => $month, 'day' => $day]; |
67 | 67 | if ($xoopsUser) { |
68 | - $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
68 | + $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
69 | 69 | } else { |
70 | - $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
70 | + $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $criteria = new \CriteriaCompo(); |
74 | 74 | if ($blog_id) { |
75 | - $criteria->add(new \Criteria('blog_id', $blog_id)); |
|
75 | + $criteria->add(new \Criteria('blog_id', $blog_id)); |
|
76 | 76 | } |
77 | 77 | $criteria->add(new \Criteria("YEAR(FROM_UNIXTIME(art_time_publish - $timeoffset))", $year)); |
78 | 78 | if ($month) { |
79 | - $criteria->add(new \Criteria("MONTH(FROM_UNIXTIME(art_time_publish - $timeoffset))", $month)); |
|
80 | - if ($day) { |
|
81 | - $criteria->add(new \Criteria("DAY(FROM_UNIXTIME(art_time_publish - $timeoffset))", $day)); |
|
82 | - } |
|
79 | + $criteria->add(new \Criteria("MONTH(FROM_UNIXTIME(art_time_publish - $timeoffset))", $month)); |
|
80 | + if ($day) { |
|
81 | + $criteria->add(new \Criteria("DAY(FROM_UNIXTIME(art_time_publish - $timeoffset))", $day)); |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | $criteria->setStart($start); |
85 | 85 | $criteria->setLimit($helper->getConfig('articles_perpage')); |
@@ -90,115 +90,115 @@ discard block |
||
90 | 90 | $articles = []; |
91 | 91 | $blogs_id = []; |
92 | 92 | foreach ($articles_obj as $id => $article) { |
93 | - $articles[] = [ |
|
94 | - 'id' => $id, |
|
95 | - 'blog' => ['id' => $article->getVar('blog_id'), 'title' => ''], |
|
96 | - 'title' => $article->getVar('art_title'), |
|
97 | - 'time' => $article->getTime(), |
|
98 | - 'content' => $article->getVar('art_content') |
|
99 | - ]; |
|
100 | - $articles[] = $_article; |
|
101 | - $blogs_id[$article->getVar('blog_id')] = 1; |
|
102 | - unset($_article); |
|
93 | + $articles[] = [ |
|
94 | + 'id' => $id, |
|
95 | + 'blog' => ['id' => $article->getVar('blog_id'), 'title' => ''], |
|
96 | + 'title' => $article->getVar('art_title'), |
|
97 | + 'time' => $article->getTime(), |
|
98 | + 'content' => $article->getVar('art_content') |
|
99 | + ]; |
|
100 | + $articles[] = $_article; |
|
101 | + $blogs_id[$article->getVar('blog_id')] = 1; |
|
102 | + unset($_article); |
|
103 | 103 | } |
104 | 104 | $criteria_blog = new \Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); |
105 | 105 | $blogs = $blogHandler->getList($criteria_blog); |
106 | 106 | foreach (array_keys($articles) as $key) { |
107 | - $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
|
107 | + $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
|
108 | 108 | } |
109 | 109 | if ($blog_id > 0) { |
110 | - $page['blog'] = $blogs[$blog_id]; |
|
110 | + $page['blog'] = $blogs[$blog_id]; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if ($articles_count > $helper->getConfig('articles_perpage')) { |
114 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
115 | - $nav = new \XoopsPageNav($articles_count, $helper->getConfig('articles_perpage'), $start, 'start', 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' . $blog_id); |
|
116 | - $pagenav = $nav->renderNav(4); |
|
114 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
115 | + $nav = new \XoopsPageNav($articles_count, $helper->getConfig('articles_perpage'), $start, 'start', 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' . $blog_id); |
|
116 | + $pagenav = $nav->renderNav(4); |
|
117 | 117 | } else { |
118 | - $pagenav = ''; |
|
118 | + $pagenav = ''; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $timenav = null; |
122 | 122 | $calendar = null; |
123 | 123 | $months = null; |
124 | 124 | if (empty($start)) { |
125 | - if ($blog_id) { |
|
126 | - $blog_criteria = ' AND blog_id=' . $blog_id; |
|
127 | - } else { |
|
128 | - $blog_criteria = ''; |
|
129 | - } |
|
130 | - // Get monthly list |
|
131 | - if (empty($month)) { |
|
132 | - $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
125 | + if ($blog_id) { |
|
126 | + $blog_criteria = ' AND blog_id=' . $blog_id; |
|
127 | + } else { |
|
128 | + $blog_criteria = ''; |
|
129 | + } |
|
130 | + // Get monthly list |
|
131 | + if (empty($month)) { |
|
132 | + $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
133 | 133 | FROM " . planet_DB_prefix('article') . " |
134 | 134 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
135 | 135 | " . $blog_criteria . ' |
136 | 136 | GROUP BY mon |
137 | 137 | '; |
138 | - $result = $xoopsDB->query($sql); |
|
139 | - $months = []; |
|
140 | - while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
|
141 | - $months[] = [ |
|
142 | - 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
143 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id |
|
144 | - ]; |
|
145 | - } |
|
146 | - $timenav['prev'] = [ |
|
147 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id, |
|
148 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
149 | - ]; |
|
150 | - if ($year < date('Y')) { |
|
151 | - $timenav['next'] = [ |
|
152 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id, |
|
153 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
154 | - ]; |
|
155 | - } |
|
156 | - } // Get daily list |
|
157 | - elseif (empty($day)) { |
|
158 | - $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
138 | + $result = $xoopsDB->query($sql); |
|
139 | + $months = []; |
|
140 | + while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
|
141 | + $months[] = [ |
|
142 | + 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
143 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id |
|
144 | + ]; |
|
145 | + } |
|
146 | + $timenav['prev'] = [ |
|
147 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id, |
|
148 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
149 | + ]; |
|
150 | + if ($year < date('Y')) { |
|
151 | + $timenav['next'] = [ |
|
152 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id, |
|
153 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
154 | + ]; |
|
155 | + } |
|
156 | + } // Get daily list |
|
157 | + elseif (empty($day)) { |
|
158 | + $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
159 | 159 | FROM " . planet_DB_prefix('article') . " |
160 | 160 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
161 | 161 | AND MONTH(FROM_UNIXTIME(art_time - $timeoffset)) = $month |
162 | 162 | " . $blog_criteria . ' |
163 | 163 | GROUP BY day |
164 | 164 | '; |
165 | - $result = $xoopsDB->query($sql); |
|
166 | - $days = []; |
|
167 | - while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
|
168 | - $days[$myrow['day']]['count'] = $myrow['count']; |
|
169 | - } |
|
170 | - for ($i = 1; $i <= 31; ++$i) { |
|
171 | - if (!isset($days[$i])) { |
|
172 | - continue; |
|
173 | - } |
|
174 | - $days[$i] = [ |
|
175 | - 'title' => $days[$i]['count'], |
|
176 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
177 | - ]; |
|
178 | - } |
|
179 | - $calendar = planet_getCalendar($year, $month, $days); |
|
180 | - $month_next = $month + 1; |
|
181 | - $month_prev = $month - 1; |
|
182 | - $_year = $year; |
|
183 | - if (12 == $month) { |
|
184 | - $month_next = 1; |
|
185 | - $_year = $year + 1; |
|
186 | - } |
|
187 | - if (1 == $month) { |
|
188 | - $month_pre = 12; |
|
189 | - $_year = $year - 1; |
|
190 | - } |
|
191 | - $timenav['prev'] = [ |
|
192 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
193 | - 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
194 | - ]; |
|
195 | - if ($year < date('Y') || $month < date('n')) { |
|
196 | - $timenav['next'] = [ |
|
197 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id, |
|
198 | - 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
199 | - ]; |
|
200 | - } |
|
201 | - } |
|
165 | + $result = $xoopsDB->query($sql); |
|
166 | + $days = []; |
|
167 | + while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
|
168 | + $days[$myrow['day']]['count'] = $myrow['count']; |
|
169 | + } |
|
170 | + for ($i = 1; $i <= 31; ++$i) { |
|
171 | + if (!isset($days[$i])) { |
|
172 | + continue; |
|
173 | + } |
|
174 | + $days[$i] = [ |
|
175 | + 'title' => $days[$i]['count'], |
|
176 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
177 | + ]; |
|
178 | + } |
|
179 | + $calendar = planet_getCalendar($year, $month, $days); |
|
180 | + $month_next = $month + 1; |
|
181 | + $month_prev = $month - 1; |
|
182 | + $_year = $year; |
|
183 | + if (12 == $month) { |
|
184 | + $month_next = 1; |
|
185 | + $_year = $year + 1; |
|
186 | + } |
|
187 | + if (1 == $month) { |
|
188 | + $month_pre = 12; |
|
189 | + $_year = $year - 1; |
|
190 | + } |
|
191 | + $timenav['prev'] = [ |
|
192 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
193 | + 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
194 | + ]; |
|
195 | + if ($year < date('Y') || $month < date('n')) { |
|
196 | + $timenav['next'] = [ |
|
197 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id, |
|
198 | + 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
199 | + ]; |
|
200 | + } |
|
201 | + } |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | $xoopsTpl->assign('dirname', $GLOBALS['moddirname']); |
@@ -225,66 +225,66 @@ discard block |
||
225 | 225 | */ |
226 | 226 | function planet_getCalendar($year = null, $month = null, $days = null) |
227 | 227 | { |
228 | - $year = empty($year) ? date('Y') : $year; |
|
229 | - $month = empty($month) ? date('n') : $month; |
|
230 | - $unixmonth = mktime(0, 0, 0, $month, 1, $year); |
|
228 | + $year = empty($year) ? date('Y') : $year; |
|
229 | + $month = empty($month) ? date('n') : $month; |
|
230 | + $unixmonth = mktime(0, 0, 0, $month, 1, $year); |
|
231 | 231 | |
232 | - ob_start(); |
|
233 | - echo '<table id="calendar">'; |
|
234 | - echo '<caption>'; |
|
235 | - printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
236 | - echo '</caption>'; |
|
232 | + ob_start(); |
|
233 | + echo '<table id="calendar">'; |
|
234 | + echo '<caption>'; |
|
235 | + printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
236 | + echo '</caption>'; |
|
237 | 237 | |
238 | - for ($i = 1; $i <= 7; ++$i) { |
|
239 | - echo "\n\t\t<th abbr=\"" . planet_constant('MD_WEEK_' . $i) . '" scope="col" title="' . planet_constant('MD_WEEK_' . $i) . '">' . planet_constant('MD_WEEK_' . $i) . '</th>'; |
|
240 | - } |
|
238 | + for ($i = 1; $i <= 7; ++$i) { |
|
239 | + echo "\n\t\t<th abbr=\"" . planet_constant('MD_WEEK_' . $i) . '" scope="col" title="' . planet_constant('MD_WEEK_' . $i) . '">' . planet_constant('MD_WEEK_' . $i) . '</th>'; |
|
240 | + } |
|
241 | 241 | |
242 | - echo '<tr>'; |
|
242 | + echo '<tr>'; |
|
243 | 243 | |
244 | - // See how much we should pad in the beginning |
|
245 | - $week_begins = 1; |
|
246 | - $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
247 | - if (0 != $pad) { |
|
248 | - echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
249 | - } |
|
244 | + // See how much we should pad in the beginning |
|
245 | + $week_begins = 1; |
|
246 | + $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
247 | + if (0 != $pad) { |
|
248 | + echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
249 | + } |
|
250 | 250 | |
251 | - $daysinmonth = (int)date('t', $unixmonth); |
|
252 | - for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
253 | - if (isset($newrow) && $newrow) { |
|
254 | - echo "\n\t</tr>\n\t<tr>\n\t\t"; |
|
255 | - } |
|
256 | - $newrow = false; |
|
251 | + $daysinmonth = (int)date('t', $unixmonth); |
|
252 | + for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
253 | + if (isset($newrow) && $newrow) { |
|
254 | + echo "\n\t</tr>\n\t<tr>\n\t\t"; |
|
255 | + } |
|
256 | + $newrow = false; |
|
257 | 257 | |
258 | - echo '<td>'; |
|
258 | + echo '<td>'; |
|
259 | 259 | |
260 | - if (!empty($days[$day]['url'])) { |
|
261 | - echo '<a href="' . $days[$day]['url'] . '"'; |
|
262 | - if (!empty($days[$day]['title'])) { |
|
263 | - echo 'title="' . $days[$day]['title'] . '"'; |
|
264 | - } |
|
265 | - echo ">$day</a>"; |
|
266 | - } elseif (!empty($days[$day]['title'])) { |
|
267 | - echo '<acronym title="' . $days[$day]['title'] . "\">$day</acronym>"; |
|
268 | - } else { |
|
269 | - echo $day; |
|
270 | - } |
|
271 | - echo '</td>'; |
|
260 | + if (!empty($days[$day]['url'])) { |
|
261 | + echo '<a href="' . $days[$day]['url'] . '"'; |
|
262 | + if (!empty($days[$day]['title'])) { |
|
263 | + echo 'title="' . $days[$day]['title'] . '"'; |
|
264 | + } |
|
265 | + echo ">$day</a>"; |
|
266 | + } elseif (!empty($days[$day]['title'])) { |
|
267 | + echo '<acronym title="' . $days[$day]['title'] . "\">$day</acronym>"; |
|
268 | + } else { |
|
269 | + echo $day; |
|
270 | + } |
|
271 | + echo '</td>'; |
|
272 | 272 | |
273 | - if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
274 | - $newrow = true; |
|
275 | - } |
|
276 | - } |
|
273 | + if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
274 | + $newrow = true; |
|
275 | + } |
|
276 | + } |
|
277 | 277 | |
278 | - $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
279 | - if (0 != $pad && 7 != $pad) { |
|
280 | - echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
281 | - } |
|
278 | + $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
279 | + if (0 != $pad && 7 != $pad) { |
|
280 | + echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
281 | + } |
|
282 | 282 | |
283 | - echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
|
284 | - $calendar = ob_get_contents(); |
|
285 | - ob_end_clean(); |
|
283 | + echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
|
284 | + $calendar = ob_get_contents(); |
|
285 | + ob_end_clean(); |
|
286 | 286 | |
287 | - return $calendar; |
|
287 | + return $calendar; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Used in get_calendar |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | function planet_calendar_week_mod($num) |
296 | 296 | { |
297 | - $base = 7; |
|
297 | + $base = 7; |
|
298 | 298 | |
299 | - return ($num - $base * floor($num / $base)); |
|
299 | + return ($num - $base * floor($num / $base)); |
|
300 | 300 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** @var Planet\Helper $helper */ |
30 | 30 | $helper = Planet\Helper::getInstance(); |
31 | 31 | |
32 | -include __DIR__ . '/header.php'; |
|
32 | +include __DIR__.'/header.php'; |
|
33 | 33 | |
34 | 34 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
35 | 35 | $args['year'] = @$args_num[0]; |
@@ -48,26 +48,26 @@ discard block |
||
48 | 48 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
49 | 49 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
50 | 50 | |
51 | -$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_ACHIVE'); |
|
51 | +$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_ACHIVE'); |
|
52 | 52 | $xoopsOption['template_main'] = PlanetUtility::planetGetTemplate('archive'); |
53 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
54 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
53 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
54 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
55 | 55 | |
56 | 56 | $year = empty($year) ? date('Y') : $year; |
57 | -if ($month < 1) { |
|
57 | +if ($month<1) { |
|
58 | 58 | $month = $day = 0; |
59 | 59 | $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
60 | -} elseif ($day < 1) { |
|
60 | +} elseif ($day<1) { |
|
61 | 61 | $day = 0; |
62 | 62 | $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
63 | -} else { |
|
63 | +}else { |
|
64 | 64 | $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
65 | 65 | } |
66 | 66 | $time = ['year' => $year, 'month' => $month, 'day' => $day]; |
67 | 67 | if ($xoopsUser) { |
68 | - $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
69 | -} else { |
|
70 | - $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
68 | + $timeoffset = ($xoopsUser->getVar('timezone_offset')-$xoopsConfig['server_TZ'])*3600; |
|
69 | +}else { |
|
70 | + $timeoffset = ($xoopsConfig['default_TZ']-$xoopsConfig['server_TZ'])*3600; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $criteria = new \CriteriaCompo(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $articles = []; |
91 | 91 | $blogs_id = []; |
92 | 92 | foreach ($articles_obj as $id => $article) { |
93 | - $articles[] = [ |
|
93 | + $articles[] = [ |
|
94 | 94 | 'id' => $id, |
95 | 95 | 'blog' => ['id' => $article->getVar('blog_id'), 'title' => ''], |
96 | 96 | 'title' => $article->getVar('art_title'), |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | $blogs_id[$article->getVar('blog_id')] = 1; |
102 | 102 | unset($_article); |
103 | 103 | } |
104 | -$criteria_blog = new \Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); |
|
104 | +$criteria_blog = new \Criteria('blog_id', '('.implode(',', array_keys($blog_array)).')', 'IN'); |
|
105 | 105 | $blogs = $blogHandler->getList($criteria_blog); |
106 | 106 | foreach (array_keys($articles) as $key) { |
107 | 107 | $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
108 | 108 | } |
109 | -if ($blog_id > 0) { |
|
109 | +if ($blog_id>0) { |
|
110 | 110 | $page['blog'] = $blogs[$blog_id]; |
111 | 111 | } |
112 | 112 | |
113 | -if ($articles_count > $helper->getConfig('articles_perpage')) { |
|
114 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
115 | - $nav = new \XoopsPageNav($articles_count, $helper->getConfig('articles_perpage'), $start, 'start', 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' . $blog_id); |
|
113 | +if ($articles_count>$helper->getConfig('articles_perpage')) { |
|
114 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
115 | + $nav = new \XoopsPageNav($articles_count, $helper->getConfig('articles_perpage'), $start, 'start', 'month='.$month.'&day='.$day.'&year='.$year.'&blog='.$blog_id); |
|
116 | 116 | $pagenav = $nav->renderNav(4); |
117 | -} else { |
|
117 | +}else { |
|
118 | 118 | $pagenav = ''; |
119 | 119 | } |
120 | 120 | |
@@ -123,43 +123,43 @@ discard block |
||
123 | 123 | $months = null; |
124 | 124 | if (empty($start)) { |
125 | 125 | if ($blog_id) { |
126 | - $blog_criteria = ' AND blog_id=' . $blog_id; |
|
127 | - } else { |
|
126 | + $blog_criteria = ' AND blog_id='.$blog_id; |
|
127 | + }else { |
|
128 | 128 | $blog_criteria = ''; |
129 | 129 | } |
130 | 130 | // Get monthly list |
131 | 131 | if (empty($month)) { |
132 | - $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
133 | - FROM " . planet_DB_prefix('article') . " |
|
132 | + $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
133 | + FROM ".planet_DB_prefix('article')." |
|
134 | 134 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
135 | - " . $blog_criteria . ' |
|
135 | + ".$blog_criteria.' |
|
136 | 136 | GROUP BY mon |
137 | 137 | '; |
138 | 138 | $result = $xoopsDB->query($sql); |
139 | 139 | $months = []; |
140 | 140 | while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
141 | 141 | $months[] = [ |
142 | - 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
143 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id |
|
142 | + 'title' => planet_constant('MD_MONTH_'.(int) $myrow['mon']).' ('.(int) $myrow['count'].')', |
|
143 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$year.'/'.$myrow['mon'].'/b'.$blog_id |
|
144 | 144 | ]; |
145 | 145 | } |
146 | 146 | $timenav['prev'] = [ |
147 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id, |
|
148 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
147 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.($year-1).'/b'.$blog_id, |
|
148 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year-1) |
|
149 | 149 | ]; |
150 | - if ($year < date('Y')) { |
|
150 | + if ($year<date('Y')) { |
|
151 | 151 | $timenav['next'] = [ |
152 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id, |
|
153 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
152 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.($year+1).'/b'.$blog_id, |
|
153 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year+1) |
|
154 | 154 | ]; |
155 | 155 | } |
156 | 156 | } // Get daily list |
157 | 157 | elseif (empty($day)) { |
158 | - $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
159 | - FROM " . planet_DB_prefix('article') . " |
|
158 | + $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
159 | + FROM ".planet_DB_prefix('article')." |
|
160 | 160 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
161 | 161 | AND MONTH(FROM_UNIXTIME(art_time - $timeoffset)) = $month |
162 | - " . $blog_criteria . ' |
|
162 | + ".$blog_criteria.' |
|
163 | 163 | GROUP BY day |
164 | 164 | '; |
165 | 165 | $result = $xoopsDB->query($sql); |
@@ -167,35 +167,35 @@ discard block |
||
167 | 167 | while (false !== ($myrow = $xoopsDB->fetchArray($result))) { |
168 | 168 | $days[$myrow['day']]['count'] = $myrow['count']; |
169 | 169 | } |
170 | - for ($i = 1; $i <= 31; ++$i) { |
|
170 | + for ($i = 1; $i<=31; ++$i) { |
|
171 | 171 | if (!isset($days[$i])) { |
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | $days[$i] = [ |
175 | 175 | 'title' => $days[$i]['count'], |
176 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
176 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$year.'/'.$month.'/'.$i.'/b'.$blog_id |
|
177 | 177 | ]; |
178 | 178 | } |
179 | 179 | $calendar = planet_getCalendar($year, $month, $days); |
180 | - $month_next = $month + 1; |
|
181 | - $month_prev = $month - 1; |
|
180 | + $month_next = $month+1; |
|
181 | + $month_prev = $month-1; |
|
182 | 182 | $_year = $year; |
183 | 183 | if (12 == $month) { |
184 | 184 | $month_next = 1; |
185 | - $_year = $year + 1; |
|
185 | + $_year = $year+1; |
|
186 | 186 | } |
187 | 187 | if (1 == $month) { |
188 | 188 | $month_pre = 12; |
189 | - $_year = $year - 1; |
|
189 | + $_year = $year-1; |
|
190 | 190 | } |
191 | 191 | $timenav['prev'] = [ |
192 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
193 | - 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
192 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$_year.'/'.$month_prev.'/b'.$blog_id, |
|
193 | + 'title' => planet_constant('MD_MONTH_'.$month_prev) |
|
194 | 194 | ]; |
195 | - if ($year < date('Y') || $month < date('n')) { |
|
195 | + if ($year<date('Y') || $month<date('n')) { |
|
196 | 196 | $timenav['next'] = [ |
197 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id, |
|
198 | - 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
197 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$_year.'/'.$month_next.'/b'.$blog_id, |
|
198 | + 'title' => planet_constant('MD_MONTH_'.$month_next) |
|
199 | 199 | ]; |
200 | 200 | } |
201 | 201 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $xoopsTpl->assign('timenav', $timenav); |
216 | 216 | $xoopsTpl->assign('pagenav', $pagenav); |
217 | 217 | |
218 | -require_once __DIR__ . '/footer.php'; |
|
218 | +require_once __DIR__.'/footer.php'; |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * @param null $year |
@@ -232,24 +232,24 @@ discard block |
||
232 | 232 | ob_start(); |
233 | 233 | echo '<table id="calendar">'; |
234 | 234 | echo '<caption>'; |
235 | - printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
235 | + printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_'.$month)); |
|
236 | 236 | echo '</caption>'; |
237 | 237 | |
238 | - for ($i = 1; $i <= 7; ++$i) { |
|
239 | - echo "\n\t\t<th abbr=\"" . planet_constant('MD_WEEK_' . $i) . '" scope="col" title="' . planet_constant('MD_WEEK_' . $i) . '">' . planet_constant('MD_WEEK_' . $i) . '</th>'; |
|
238 | + for ($i = 1; $i<=7; ++$i) { |
|
239 | + echo "\n\t\t<th abbr=\"".planet_constant('MD_WEEK_'.$i).'" scope="col" title="'.planet_constant('MD_WEEK_'.$i).'">'.planet_constant('MD_WEEK_'.$i).'</th>'; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | echo '<tr>'; |
243 | 243 | |
244 | 244 | // See how much we should pad in the beginning |
245 | 245 | $week_begins = 1; |
246 | - $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
246 | + $pad = planet_calendar_week_mod(date('w', $unixmonth)-$week_begins); |
|
247 | 247 | if (0 != $pad) { |
248 | - echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
248 | + echo "\n\t\t".'<td colspan="'.$pad.'"> </td>'; |
|
249 | 249 | } |
250 | 250 | |
251 | - $daysinmonth = (int)date('t', $unixmonth); |
|
252 | - for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
251 | + $daysinmonth = (int) date('t', $unixmonth); |
|
252 | + for ($day = 1; $day<=$daysinmonth; ++$day) { |
|
253 | 253 | if (isset($newrow) && $newrow) { |
254 | 254 | echo "\n\t</tr>\n\t<tr>\n\t\t"; |
255 | 255 | } |
@@ -258,26 +258,26 @@ discard block |
||
258 | 258 | echo '<td>'; |
259 | 259 | |
260 | 260 | if (!empty($days[$day]['url'])) { |
261 | - echo '<a href="' . $days[$day]['url'] . '"'; |
|
261 | + echo '<a href="'.$days[$day]['url'].'"'; |
|
262 | 262 | if (!empty($days[$day]['title'])) { |
263 | - echo 'title="' . $days[$day]['title'] . '"'; |
|
263 | + echo 'title="'.$days[$day]['title'].'"'; |
|
264 | 264 | } |
265 | 265 | echo ">$day</a>"; |
266 | 266 | } elseif (!empty($days[$day]['title'])) { |
267 | - echo '<acronym title="' . $days[$day]['title'] . "\">$day</acronym>"; |
|
268 | - } else { |
|
267 | + echo '<acronym title="'.$days[$day]['title']."\">$day</acronym>"; |
|
268 | + }else { |
|
269 | 269 | echo $day; |
270 | 270 | } |
271 | 271 | echo '</td>'; |
272 | 272 | |
273 | - if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
273 | + if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins)) { |
|
274 | 274 | $newrow = true; |
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
278 | - $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
278 | + $pad = 7-planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins); |
|
279 | 279 | if (0 != $pad && 7 != $pad) { |
280 | - echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
280 | + echo "\n\t\t".'<td class="pad" colspan="'.$pad.'"> </td>'; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
@@ -296,5 +296,5 @@ discard block |
||
296 | 296 | { |
297 | 297 | $base = 7; |
298 | 298 | |
299 | - return ($num - $base * floor($num / $base)); |
|
299 | + return ($num-$base*floor($num/$base)); |
|
300 | 300 | } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | |
31 | 31 | $art_id = Request::getInt('article', Request::getInt('article', 0, 'POST'), 'GET');//(int)(isset($_GET['article']) ? $_GET['article'] : (isset($_POST['article']) ? $_POST['article'] : 0)); |
32 | 32 | if (empty($art_id)) { |
33 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
33 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
34 | 34 | } |
35 | 35 | if (!$xoopsUser->isAdmin()) { |
36 | - redirect_header('javascript:history.go(-1);', 2, _NOPERM); |
|
36 | + redirect_header('javascript:history.go(-1);', 2, _NOPERM); |
|
37 | 37 | } |
38 | 38 | include XOOPS_ROOT_PATH . '/header.php'; |
39 | 39 | include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
@@ -44,58 +44,58 @@ discard block |
||
44 | 44 | $op = Request::getCmd('op', 'check', 'POST');//isset($_POST['op']) ? $_POST['op'] : ''; |
45 | 45 | |
46 | 46 | if ('del' === $op || !empty(Request::getString('del', '', 'POST'))) { |
47 | - $articleHandler->delete($article_obj); |
|
48 | - $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
49 | - $message = planet_constant('MD_SAVED'); |
|
50 | - redirect_header($redirect, 2, $message); |
|
47 | + $articleHandler->delete($article_obj); |
|
48 | + $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
49 | + $message = planet_constant('MD_SAVED'); |
|
50 | + redirect_header($redirect, 2, $message); |
|
51 | 51 | } elseif ('save' === $op) { |
52 | - if (empty($_POST['art_content'])) { |
|
53 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_TEXTEMPTY')); |
|
54 | - } |
|
52 | + if (empty($_POST['art_content'])) { |
|
53 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_TEXTEMPTY')); |
|
54 | + } |
|
55 | 55 | |
56 | - foreach ([ |
|
57 | - 'art_title', |
|
58 | - 'art_link', |
|
59 | - 'art_author', |
|
60 | - 'art_content' |
|
61 | - ] as $tag) { |
|
62 | - if (@Request::getString('tag', '', 'POST') != $article_obj->getVar($tag)) { |
|
63 | - $article_obj->setVar($tag, @Request::getString('tag', '', 'POST')); |
|
64 | - } |
|
65 | - } |
|
56 | + foreach ([ |
|
57 | + 'art_title', |
|
58 | + 'art_link', |
|
59 | + 'art_author', |
|
60 | + 'art_content' |
|
61 | + ] as $tag) { |
|
62 | + if (@Request::getString('tag', '', 'POST') != $article_obj->getVar($tag)) { |
|
63 | + $article_obj->setVar($tag, @Request::getString('tag', '', 'POST')); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - $art_id_new = $articleHandler->insert($article_obj); |
|
68 | - if (!$article_obj->getVar('art_id')) { |
|
69 | - $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
70 | - $message = planet_constant('MD_INSERTERROR'); |
|
71 | - } else { |
|
72 | - $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
73 | - $message = planet_constant('MD_SAVED'); |
|
74 | - } |
|
75 | - redirect_header($redirect, 2, $message); |
|
67 | + $art_id_new = $articleHandler->insert($article_obj); |
|
68 | + if (!$article_obj->getVar('art_id')) { |
|
69 | + $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
70 | + $message = planet_constant('MD_INSERTERROR'); |
|
71 | + } else { |
|
72 | + $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
73 | + $message = planet_constant('MD_SAVED'); |
|
74 | + } |
|
75 | + redirect_header($redirect, 2, $message); |
|
76 | 76 | } else { |
77 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
77 | + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
78 | 78 | |
79 | - $form = new \XoopsThemeForm(_EDIT, 'formarticle', xoops_getenv('PHP_SELF'), 'post', true); |
|
79 | + $form = new \XoopsThemeForm(_EDIT, 'formarticle', xoops_getenv('PHP_SELF'), 'post', true); |
|
80 | 80 | |
81 | - $form->addElement(new \XoopsFormText(planet_constant('MD_TITLE'), 'art_title', 50, 255, $article_obj->getVar('art_title', 'E')), true); |
|
82 | - $form->addElement(new \XoopsFormText(planet_constant('MD_LINK'), 'art_link', 50, 255, $article_obj->getVar('art_link', 'E')), true); |
|
83 | - $form->addElement(new \XoopsFormText(planet_constant('MD_AUTHOR'), 'art_author', 80, 255, $article_obj->getVar('art_author', 'E'))); |
|
84 | - $form->addElement(new \XoopsFormTextArea(planet_constant('MD_CONTENT'), 'art_content', $article_obj->getVar('art_content', 'E')), true); |
|
81 | + $form->addElement(new \XoopsFormText(planet_constant('MD_TITLE'), 'art_title', 50, 255, $article_obj->getVar('art_title', 'E')), true); |
|
82 | + $form->addElement(new \XoopsFormText(planet_constant('MD_LINK'), 'art_link', 50, 255, $article_obj->getVar('art_link', 'E')), true); |
|
83 | + $form->addElement(new \XoopsFormText(planet_constant('MD_AUTHOR'), 'art_author', 80, 255, $article_obj->getVar('art_author', 'E'))); |
|
84 | + $form->addElement(new \XoopsFormTextArea(planet_constant('MD_CONTENT'), 'art_content', $article_obj->getVar('art_content', 'E')), true); |
|
85 | 85 | |
86 | - $form->addElement(new \XoopsFormHidden('article', $art_id)); |
|
87 | - $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
86 | + $form->addElement(new \XoopsFormHidden('article', $art_id)); |
|
87 | + $form->addElement(new \XoopsFormHidden('op', 'save')); |
|
88 | 88 | |
89 | - $button_tray = new \XoopsFormElementTray('', ''); |
|
90 | - $butt_save = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
91 | - $button_tray->addElement($butt_save); |
|
92 | - $butt_del = new \XoopsFormButton('', 'del', _DELETE, 'submit'); |
|
93 | - $butt_del->setExtra("onClick='document.forms.formarticle.op.value=del'"); |
|
94 | - $button_tray->addElement($butt_del); |
|
95 | - $butt_cancel = new \XoopsFormButton('', 'cancel', _CANCEL, 'button'); |
|
96 | - $butt_cancel->setExtra("onclick='window.document.location=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $art_id . "\"'"); |
|
97 | - $button_tray->addElement($butt_cancel); |
|
98 | - $form->addElement($button_tray); |
|
99 | - $form->display(); |
|
89 | + $button_tray = new \XoopsFormElementTray('', ''); |
|
90 | + $butt_save = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
91 | + $button_tray->addElement($butt_save); |
|
92 | + $butt_del = new \XoopsFormButton('', 'del', _DELETE, 'submit'); |
|
93 | + $butt_del->setExtra("onClick='document.forms.formarticle.op.value=del'"); |
|
94 | + $button_tray->addElement($butt_del); |
|
95 | + $butt_cancel = new \XoopsFormButton('', 'cancel', _CANCEL, 'button'); |
|
96 | + $butt_cancel->setExtra("onclick='window.document.location=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $art_id . "\"'"); |
|
97 | + $button_tray->addElement($butt_cancel); |
|
98 | + $form->addElement($button_tray); |
|
99 | + $form->display(); |
|
100 | 100 | } |
101 | 101 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -26,26 +26,26 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -include __DIR__ . '/header.php'; |
|
29 | +include __DIR__.'/header.php'; |
|
30 | 30 | |
31 | -$art_id = Request::getInt('article', Request::getInt('article', 0, 'POST'), 'GET');//(int)(isset($_GET['article']) ? $_GET['article'] : (isset($_POST['article']) ? $_POST['article'] : 0)); |
|
31 | +$art_id = Request::getInt('article', Request::getInt('article', 0, 'POST'), 'GET'); //(int)(isset($_GET['article']) ? $_GET['article'] : (isset($_POST['article']) ? $_POST['article'] : 0)); |
|
32 | 32 | if (empty($art_id)) { |
33 | 33 | redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
34 | 34 | } |
35 | 35 | if (!$xoopsUser->isAdmin()) { |
36 | 36 | redirect_header('javascript:history.go(-1);', 2, _NOPERM); |
37 | 37 | } |
38 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
39 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
38 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
39 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
40 | 40 | |
41 | 41 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
42 | 42 | $article_obj = $articleHandler->get($art_id); |
43 | 43 | |
44 | -$op = Request::getCmd('op', 'check', 'POST');//isset($_POST['op']) ? $_POST['op'] : ''; |
|
44 | +$op = Request::getCmd('op', 'check', 'POST'); //isset($_POST['op']) ? $_POST['op'] : ''; |
|
45 | 45 | |
46 | 46 | if ('del' === $op || !empty(Request::getString('del', '', 'POST'))) { |
47 | 47 | $articleHandler->delete($article_obj); |
48 | - $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
48 | + $redirect = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'; |
|
49 | 49 | $message = planet_constant('MD_SAVED'); |
50 | 50 | redirect_header($redirect, 2, $message); |
51 | 51 | } elseif ('save' === $op) { |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | $art_id_new = $articleHandler->insert($article_obj); |
68 | 68 | if (!$article_obj->getVar('art_id')) { |
69 | - $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
69 | + $redirect = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'; |
|
70 | 70 | $message = planet_constant('MD_INSERTERROR'); |
71 | - } else { |
|
72 | - $redirect = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
71 | + }else { |
|
72 | + $redirect = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_obj->getVar('art_id'); |
|
73 | 73 | $message = planet_constant('MD_SAVED'); |
74 | 74 | } |
75 | 75 | redirect_header($redirect, 2, $message); |
76 | -} else { |
|
77 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
76 | +}else { |
|
77 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
78 | 78 | |
79 | 79 | $form = new \XoopsThemeForm(_EDIT, 'formarticle', xoops_getenv('PHP_SELF'), 'post', true); |
80 | 80 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | $butt_del->setExtra("onClick='document.forms.formarticle.op.value=del'"); |
94 | 94 | $button_tray->addElement($butt_del); |
95 | 95 | $butt_cancel = new \XoopsFormButton('', 'cancel', _CANCEL, 'button'); |
96 | - $butt_cancel->setExtra("onclick='window.document.location=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $art_id . "\"'"); |
|
96 | + $butt_cancel->setExtra("onclick='window.document.location=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$art_id."\"'"); |
|
97 | 97 | $button_tray->addElement($butt_cancel); |
98 | 98 | $form->addElement($button_tray); |
99 | 99 | $form->display(); |
100 | 100 | } |
101 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
101 | +include XOOPS_ROOT_PATH.'/footer.php'; |
@@ -21,21 +21,21 @@ |
||
21 | 21 | $op = \Xmf\Request::getCmd('op', ''); |
22 | 22 | |
23 | 23 | switch ($op) { |
24 | - case 'load': |
|
25 | - loadSampleData(); |
|
26 | - break; |
|
24 | + case 'load': |
|
25 | + loadSampleData(); |
|
26 | + break; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // XMF TableLoad for SAMPLE data |
30 | 30 | |
31 | 31 | function loadSampleData() |
32 | 32 | { |
33 | - // $moduleDirName = basename(dirname(__DIR__)); |
|
34 | - xoops_loadLanguage('comment'); |
|
35 | - $items = \Xmf\Yaml::readWrapped('quotes_data.yml'); |
|
33 | + // $moduleDirName = basename(dirname(__DIR__)); |
|
34 | + xoops_loadLanguage('comment'); |
|
35 | + $items = \Xmf\Yaml::readWrapped('quotes_data.yml'); |
|
36 | 36 | |
37 | - \Xmf\Database\TableLoad::truncateTable('randomquote_quotes'); |
|
38 | - \Xmf\Database\TableLoad::loadTableFromArray('randomquote_quotes', $items); |
|
37 | + \Xmf\Database\TableLoad::truncateTable('randomquote_quotes'); |
|
38 | + \Xmf\Database\TableLoad::loadTableFromArray('randomquote_quotes', $items); |
|
39 | 39 | |
40 | - redirect_header('../admin/index.php', 1, _CM_ACTIVE); |
|
40 | + redirect_header('../admin/index.php', 1, _CM_ACTIVE); |
|
41 | 41 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @author Michael Beck (aka Mamba) |
16 | 16 | */ |
17 | 17 | |
18 | -require_once __DIR__ . '/../../../mainfile.php'; |
|
18 | +require_once __DIR__.'/../../../mainfile.php'; |
|
19 | 19 | |
20 | 20 | |
21 | 21 | $op = \Xmf\Request::getCmd('op', ''); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(isset($_GET['blog']) ? $_GET['blog'] : (isset($_POST['blog']) ? $_POST['blog'] : 0)); |
32 | 32 | |
33 | 33 | if (!is_object($xoopsUser) || empty($blog_id)) { |
34 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
34 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | $criteria = new \CriteriaCompo(new \Criteria('blog_id', $blog_id)); |
40 | 40 | $criteria->add(new \Criteria('bm_uid', $uid)); |
41 | 41 | if ($count = $bookmarkHandler->getCount($criteria)) { |
42 | - $message = planet_constant('MD_ALREADYBOOKMARKED'); |
|
43 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, $message); |
|
42 | + $message = planet_constant('MD_ALREADYBOOKMARKED'); |
|
43 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, $message); |
|
44 | 44 | } |
45 | 45 | $bookmark_obj = $bookmarkHandler->create(); |
46 | 46 | $bookmark_obj->setVar('blog_id', $blog_id); |
47 | 47 | $bookmark_obj->setVar('bm_uid', $uid); |
48 | 48 | if (!$bookmark_id = $bookmarkHandler->insert($bookmark_obj, true)) { |
49 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
49 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
50 | 50 | } |
51 | 51 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
52 | 52 | $blog_obj = $blogHandler->get($blog_id); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -include __DIR__ . '/header.php'; |
|
29 | +include __DIR__.'/header.php'; |
|
30 | 30 | |
31 | 31 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(isset($_GET['blog']) ? $_GET['blog'] : (isset($_POST['blog']) ? $_POST['blog'] : 0)); |
32 | 32 | |
@@ -40,19 +40,19 @@ discard block |
||
40 | 40 | $criteria->add(new \Criteria('bm_uid', $uid)); |
41 | 41 | if ($count = $bookmarkHandler->getCount($criteria)) { |
42 | 42 | $message = planet_constant('MD_ALREADYBOOKMARKED'); |
43 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid, 2, $message); |
|
43 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'u'.$uid, 2, $message); |
|
44 | 44 | } |
45 | 45 | $bookmark_obj = $bookmarkHandler->create(); |
46 | 46 | $bookmark_obj->setVar('blog_id', $blog_id); |
47 | 47 | $bookmark_obj->setVar('bm_uid', $uid); |
48 | 48 | if (!$bookmark_id = $bookmarkHandler->insert($bookmark_obj, true)) { |
49 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
49 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, planet_constant('MD_NOTSAVED')); |
|
50 | 50 | } |
51 | 51 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
52 | 52 | $blog_obj = $blogHandler->get($blog_id); |
53 | -$marks = $blog_obj->getVar('blog_marks') + 1; |
|
54 | -$blog_obj->setVar('blog_marks', $blog_obj->getVar('blog_marks') + 1); |
|
53 | +$marks = $blog_obj->getVar('blog_marks')+1; |
|
54 | +$blog_obj->setVar('blog_marks', $blog_obj->getVar('blog_marks')+1); |
|
55 | 55 | $blogHandler->insert($blog_obj, true); |
56 | 56 | $message = planet_constant('MD_ACTIONDONE'); |
57 | -redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
58 | -include __DIR__ . '/footer.php'; |
|
57 | +redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
58 | +include __DIR__.'/footer.php'; |
@@ -41,159 +41,159 @@ |
||
41 | 41 | $charset = trim(Request::getString('charset', '', 'POST'));//trim($_POST['charset']); |
42 | 42 | |
43 | 43 | if (empty($helper->getConfig('trackback_option'))) { |
44 | - PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed'); |
|
44 | + PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed'); |
|
45 | 45 | } |
46 | 46 | if (!strlen($title . $url . $blog_name)) { |
47 | - PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
47 | + PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if (!empty($article_id) && !empty($url)) { |
51 | - $trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); |
|
52 | - $criteria = new \CriteriaCompo(new \Criteria('art_id', $article_id)); |
|
53 | - $criteria->add(new \Criteria('tb_url', $url)); |
|
54 | - if ($trackbackHandler->getCount($criteria) > 0) { |
|
55 | - PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.'); |
|
56 | - } |
|
51 | + $trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); |
|
52 | + $criteria = new \CriteriaCompo(new \Criteria('art_id', $article_id)); |
|
53 | + $criteria->add(new \Criteria('tb_url', $url)); |
|
54 | + if ($trackbackHandler->getCount($criteria) > 0) { |
|
55 | + PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.'); |
|
56 | + } |
|
57 | 57 | |
58 | - $charset = empty($charset) ? 'utf-8' : $charset; |
|
59 | - $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); |
|
60 | - $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); |
|
61 | - $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); |
|
62 | - $tb_status = (int)$helper->getConfig('trackback_option'); |
|
58 | + $charset = empty($charset) ? 'utf-8' : $charset; |
|
59 | + $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); |
|
60 | + $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); |
|
61 | + $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); |
|
62 | + $tb_status = (int)$helper->getConfig('trackback_option'); |
|
63 | 63 | |
64 | - $com_pid = 0; |
|
65 | - $com_itemid = $article_id; |
|
66 | - $com_rootid = 0; |
|
67 | - $com_title = $title; |
|
68 | - $com_text = $excerpt; |
|
69 | - $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; |
|
70 | - if (!empty($url)) { |
|
71 | - $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; |
|
72 | - } else { |
|
73 | - $com_text .= $blog_name; |
|
74 | - } |
|
75 | - $com_modid = $xoopsModule->getVar('mid'); |
|
64 | + $com_pid = 0; |
|
65 | + $com_itemid = $article_id; |
|
66 | + $com_rootid = 0; |
|
67 | + $com_title = $title; |
|
68 | + $com_text = $excerpt; |
|
69 | + $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; |
|
70 | + if (!empty($url)) { |
|
71 | + $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; |
|
72 | + } else { |
|
73 | + $com_text .= $blog_name; |
|
74 | + } |
|
75 | + $com_modid = $xoopsModule->getVar('mid'); |
|
76 | 76 | |
77 | - $commentHandler = xoops_getHandler('comment'); |
|
78 | - $comment = $commentHandler->create(); |
|
79 | - $comment->setVar('com_created', time()); |
|
80 | - $comment->setVar('com_pid', $com_pid); |
|
81 | - $comment->setVar('com_itemid', $com_itemid); |
|
82 | - $comment->setVar('com_rootid', $com_rootid); |
|
83 | - $comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR')); |
|
84 | - switch ($tb_status) { |
|
85 | - case 2: |
|
86 | - $comment->setVar('com_status', 2); |
|
87 | - $call_approvefunc = true; |
|
88 | - $call_updatefunc = true; |
|
89 | - $notify_event = 'comment'; |
|
90 | - break; |
|
91 | - case 1: |
|
92 | - default: |
|
93 | - $comment->setVar('com_status', 1); |
|
94 | - $notify_event = 'comment_submit'; |
|
95 | - break; |
|
96 | - } |
|
97 | - $comment->setVar('com_uid', 0); |
|
98 | - $com_title = xoops_trim($com_title); |
|
99 | - $com_title = empty($com_title) ? _NOTITLE : $com_title; |
|
100 | - $comment->setVar('com_title', $com_title); |
|
101 | - $comment->setVar('com_text', $com_text); |
|
102 | - $comment->setVar('dohtml', 0); |
|
103 | - $comment->setVar('dosmiley', 0); |
|
104 | - $comment->setVar('doxcode', 1); |
|
105 | - $comment->setVar('doimage', 0); |
|
106 | - $comment->setVar('dobr', 1); |
|
107 | - $comment->setVar('com_icon', ''); |
|
108 | - $comment->setVar('com_modified', time()); |
|
109 | - $comment->setVar('com_modid', $com_modid); |
|
110 | - if (false != $commentHandler->insert($comment)) { |
|
111 | - $newcid = $comment->getVar('com_id'); |
|
77 | + $commentHandler = xoops_getHandler('comment'); |
|
78 | + $comment = $commentHandler->create(); |
|
79 | + $comment->setVar('com_created', time()); |
|
80 | + $comment->setVar('com_pid', $com_pid); |
|
81 | + $comment->setVar('com_itemid', $com_itemid); |
|
82 | + $comment->setVar('com_rootid', $com_rootid); |
|
83 | + $comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR')); |
|
84 | + switch ($tb_status) { |
|
85 | + case 2: |
|
86 | + $comment->setVar('com_status', 2); |
|
87 | + $call_approvefunc = true; |
|
88 | + $call_updatefunc = true; |
|
89 | + $notify_event = 'comment'; |
|
90 | + break; |
|
91 | + case 1: |
|
92 | + default: |
|
93 | + $comment->setVar('com_status', 1); |
|
94 | + $notify_event = 'comment_submit'; |
|
95 | + break; |
|
96 | + } |
|
97 | + $comment->setVar('com_uid', 0); |
|
98 | + $com_title = xoops_trim($com_title); |
|
99 | + $com_title = empty($com_title) ? _NOTITLE : $com_title; |
|
100 | + $comment->setVar('com_title', $com_title); |
|
101 | + $comment->setVar('com_text', $com_text); |
|
102 | + $comment->setVar('dohtml', 0); |
|
103 | + $comment->setVar('dosmiley', 0); |
|
104 | + $comment->setVar('doxcode', 1); |
|
105 | + $comment->setVar('doimage', 0); |
|
106 | + $comment->setVar('dobr', 1); |
|
107 | + $comment->setVar('com_icon', ''); |
|
108 | + $comment->setVar('com_modified', time()); |
|
109 | + $comment->setVar('com_modid', $com_modid); |
|
110 | + if (false != $commentHandler->insert($comment)) { |
|
111 | + $newcid = $comment->getVar('com_id'); |
|
112 | 112 | |
113 | - // set own id as root id |
|
114 | - $com_rootid = $newcid; |
|
115 | - if (!$commentHandler->updateByField($comment, 'com_rootid', $com_rootid)) { |
|
116 | - $commentHandler->delete($comment); |
|
117 | - PlanetUtility::planetRespondToTrackback(1, xoops_error()); |
|
118 | - } |
|
113 | + // set own id as root id |
|
114 | + $com_rootid = $newcid; |
|
115 | + if (!$commentHandler->updateByField($comment, 'com_rootid', $com_rootid)) { |
|
116 | + $commentHandler->delete($comment); |
|
117 | + PlanetUtility::planetRespondToTrackback(1, xoops_error()); |
|
118 | + } |
|
119 | 119 | |
120 | - // call custom approve function if any |
|
121 | - if (false != $call_approvefunc && isset($comment_config['callback']['approve']) |
|
122 | - && '' != trim($comment_config['callback']['approve'])) { |
|
123 | - $skip = false; |
|
124 | - if (!function_exists($comment_config['callback']['approve'])) { |
|
125 | - if (isset($comment_config['callbackFile'])) { |
|
126 | - $callbackfile = trim($comment_config['callbackFile']); |
|
127 | - if ('' != $callbackfile |
|
128 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
129 | - require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
130 | - } |
|
131 | - if (!function_exists($comment_config['callback']['approve'])) { |
|
132 | - $skip = true; |
|
133 | - } |
|
134 | - } else { |
|
135 | - $skip = true; |
|
136 | - } |
|
137 | - } |
|
138 | - if (!$skip) { |
|
139 | - $comment_config['callback']['approve']($comment); |
|
140 | - } |
|
141 | - } |
|
120 | + // call custom approve function if any |
|
121 | + if (false != $call_approvefunc && isset($comment_config['callback']['approve']) |
|
122 | + && '' != trim($comment_config['callback']['approve'])) { |
|
123 | + $skip = false; |
|
124 | + if (!function_exists($comment_config['callback']['approve'])) { |
|
125 | + if (isset($comment_config['callbackFile'])) { |
|
126 | + $callbackfile = trim($comment_config['callbackFile']); |
|
127 | + if ('' != $callbackfile |
|
128 | + && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
129 | + require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
130 | + } |
|
131 | + if (!function_exists($comment_config['callback']['approve'])) { |
|
132 | + $skip = true; |
|
133 | + } |
|
134 | + } else { |
|
135 | + $skip = true; |
|
136 | + } |
|
137 | + } |
|
138 | + if (!$skip) { |
|
139 | + $comment_config['callback']['approve']($comment); |
|
140 | + } |
|
141 | + } |
|
142 | 142 | |
143 | - // call custom update function if any |
|
144 | - if (false != $call_updatefunc && isset($comment_config['callback']['update']) |
|
145 | - && '' != trim($comment_config['callback']['update'])) { |
|
146 | - $skip = false; |
|
147 | - if (!function_exists($comment_config['callback']['update'])) { |
|
148 | - if (isset($comment_config['callbackFile'])) { |
|
149 | - $callbackfile = trim($comment_config['callbackFile']); |
|
150 | - if ('' != $callbackfile |
|
151 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
152 | - require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
153 | - } |
|
154 | - if (!function_exists($comment_config['callback']['update'])) { |
|
155 | - $skip = true; |
|
156 | - } |
|
157 | - } else { |
|
158 | - $skip = true; |
|
159 | - } |
|
160 | - } |
|
161 | - if (!$skip) { |
|
162 | - $criteria = new \CriteriaCompo(new \Criteria('com_modid', $com_modid)); |
|
163 | - $criteria->add(new \Criteria('com_itemid', $com_itemid)); |
|
164 | - $criteria->add(new \Criteria('com_status', XOOPS_COMMENT_ACTIVE)); |
|
165 | - $comment_count = $commentHandler->getCount($criteria); |
|
166 | - $func = $comment_config['callback']['update']; |
|
167 | - call_user_func_array($func, [$com_itemid, $comment_count, $comment->getVar('com_id')]); |
|
168 | - } |
|
169 | - } |
|
143 | + // call custom update function if any |
|
144 | + if (false != $call_updatefunc && isset($comment_config['callback']['update']) |
|
145 | + && '' != trim($comment_config['callback']['update'])) { |
|
146 | + $skip = false; |
|
147 | + if (!function_exists($comment_config['callback']['update'])) { |
|
148 | + if (isset($comment_config['callbackFile'])) { |
|
149 | + $callbackfile = trim($comment_config['callbackFile']); |
|
150 | + if ('' != $callbackfile |
|
151 | + && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
152 | + require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
153 | + } |
|
154 | + if (!function_exists($comment_config['callback']['update'])) { |
|
155 | + $skip = true; |
|
156 | + } |
|
157 | + } else { |
|
158 | + $skip = true; |
|
159 | + } |
|
160 | + } |
|
161 | + if (!$skip) { |
|
162 | + $criteria = new \CriteriaCompo(new \Criteria('com_modid', $com_modid)); |
|
163 | + $criteria->add(new \Criteria('com_itemid', $com_itemid)); |
|
164 | + $criteria->add(new \Criteria('com_status', XOOPS_COMMENT_ACTIVE)); |
|
165 | + $comment_count = $commentHandler->getCount($criteria); |
|
166 | + $func = $comment_config['callback']['update']; |
|
167 | + call_user_func_array($func, [$com_itemid, $comment_count, $comment->getVar('com_id')]); |
|
168 | + } |
|
169 | + } |
|
170 | 170 | |
171 | - // RMV-NOTIFY |
|
172 | - // trigger notification event if necessary |
|
173 | - if ($notify_event) { |
|
174 | - $not_modid = $com_modid; |
|
175 | - // require_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; |
|
176 | - $not_catinfo = notificationCommentCategoryInfo($not_modid); |
|
177 | - $not_category = $not_catinfo['name']; |
|
178 | - $not_itemid = $com_itemid; |
|
179 | - $not_event = $notify_event; |
|
180 | - // Build an ABSOLUTE URL to view the comment. Make sure we |
|
181 | - // point to a viewable page (i.e. not the system administration |
|
182 | - // module). |
|
183 | - $comment_tags = []; |
|
184 | - $not_module = $xoopsModule; |
|
185 | - if (!isset($comment_url)) { |
|
186 | - $com_config = $not_module->getInfo('comments'); |
|
187 | - $comment_url = $com_config['pageName'] . '?'; |
|
188 | - $comment_url .= $com_config['itemName']; |
|
189 | - } |
|
190 | - $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $com_itemid . '&com_id=' . $newcid . '&com_rootid=' . $com_rootid . '&com_mode=' . $com_mode . '&com_order=' . $com_order . '#comment' . $newcid; |
|
191 | - $notificationHandler = xoops_getHandler('notification'); |
|
192 | - $notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid); |
|
193 | - } |
|
171 | + // RMV-NOTIFY |
|
172 | + // trigger notification event if necessary |
|
173 | + if ($notify_event) { |
|
174 | + $not_modid = $com_modid; |
|
175 | + // require_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; |
|
176 | + $not_catinfo = notificationCommentCategoryInfo($not_modid); |
|
177 | + $not_category = $not_catinfo['name']; |
|
178 | + $not_itemid = $com_itemid; |
|
179 | + $not_event = $notify_event; |
|
180 | + // Build an ABSOLUTE URL to view the comment. Make sure we |
|
181 | + // point to a viewable page (i.e. not the system administration |
|
182 | + // module). |
|
183 | + $comment_tags = []; |
|
184 | + $not_module = $xoopsModule; |
|
185 | + if (!isset($comment_url)) { |
|
186 | + $com_config = $not_module->getInfo('comments'); |
|
187 | + $comment_url = $com_config['pageName'] . '?'; |
|
188 | + $comment_url .= $com_config['itemName']; |
|
189 | + } |
|
190 | + $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $com_itemid . '&com_id=' . $newcid . '&com_rootid=' . $com_rootid . '&com_mode=' . $com_mode . '&com_order=' . $com_order . '#comment' . $newcid; |
|
191 | + $notificationHandler = xoops_getHandler('notification'); |
|
192 | + $notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid); |
|
193 | + } |
|
194 | 194 | |
195 | - PlanetUtility::planetRespondToTrackback(0); |
|
196 | - } else { |
|
197 | - PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors())); |
|
198 | - } |
|
195 | + PlanetUtility::planetRespondToTrackback(0); |
|
196 | + } else { |
|
197 | + PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors())); |
|
198 | + } |
|
199 | 199 | } |
@@ -29,21 +29,21 @@ discard block |
||
29 | 29 | /** @var Planet\Helper $helper */ |
30 | 30 | $helper = Planet\Helper::getInstance(); |
31 | 31 | |
32 | -include __DIR__ . '/header.php'; |
|
32 | +include __DIR__.'/header.php'; |
|
33 | 33 | |
34 | 34 | // trackback is done by a POST |
35 | 35 | $art_id = explode('/', Request::getString('REQUEST_URI', '', 'SERVER')); |
36 | -$article_id = (int)$art_id[count($art_id) - 1]; |
|
37 | -$url = Request::getString('url', '', 'POST');//$_POST['url']; |
|
38 | -$title = Request::getString('title', '', 'POST');//$_POST['title']; |
|
39 | -$excerpt = Request::getString('excerpt', '', 'POST');//$_POST['excerpt']; |
|
40 | -$blog_name = Request::getString('blog_name', '', 'POST');//$_POST['blog_name']; |
|
41 | -$charset = trim(Request::getString('charset', '', 'POST'));//trim($_POST['charset']); |
|
36 | +$article_id = (int) $art_id[count($art_id)-1]; |
|
37 | +$url = Request::getString('url', '', 'POST'); //$_POST['url']; |
|
38 | +$title = Request::getString('title', '', 'POST'); //$_POST['title']; |
|
39 | +$excerpt = Request::getString('excerpt', '', 'POST'); //$_POST['excerpt']; |
|
40 | +$blog_name = Request::getString('blog_name', '', 'POST'); //$_POST['blog_name']; |
|
41 | +$charset = trim(Request::getString('charset', '', 'POST')); //trim($_POST['charset']); |
|
42 | 42 | |
43 | 43 | if (empty($helper->getConfig('trackback_option'))) { |
44 | 44 | PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed'); |
45 | 45 | } |
46 | -if (!strlen($title . $url . $blog_name)) { |
|
46 | +if (!strlen($title.$url.$blog_name)) { |
|
47 | 47 | PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
48 | 48 | } |
49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); |
52 | 52 | $criteria = new \CriteriaCompo(new \Criteria('art_id', $article_id)); |
53 | 53 | $criteria->add(new \Criteria('tb_url', $url)); |
54 | - if ($trackbackHandler->getCount($criteria) > 0) { |
|
54 | + if ($trackbackHandler->getCount($criteria)>0) { |
|
55 | 55 | PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.'); |
56 | 56 | } |
57 | 57 | |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); |
60 | 60 | $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); |
61 | 61 | $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); |
62 | - $tb_status = (int)$helper->getConfig('trackback_option'); |
|
62 | + $tb_status = (int) $helper->getConfig('trackback_option'); |
|
63 | 63 | |
64 | 64 | $com_pid = 0; |
65 | 65 | $com_itemid = $article_id; |
66 | 66 | $com_rootid = 0; |
67 | 67 | $com_title = $title; |
68 | 68 | $com_text = $excerpt; |
69 | - $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; |
|
69 | + $com_text .= "\n\n[TRACKBACK]"._POSTEDBY.': '; |
|
70 | 70 | if (!empty($url)) { |
71 | - $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; |
|
72 | - } else { |
|
71 | + $com_text .= '[url='.$url.']'.$blog_name.'[/url]'; |
|
72 | + }else { |
|
73 | 73 | $com_text .= $blog_name; |
74 | 74 | } |
75 | 75 | $com_modid = $xoopsModule->getVar('mid'); |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | if (isset($comment_config['callbackFile'])) { |
126 | 126 | $callbackfile = trim($comment_config['callbackFile']); |
127 | 127 | if ('' != $callbackfile |
128 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
129 | - require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
128 | + && file_exists(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile)) { |
|
129 | + require_once XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile; |
|
130 | 130 | } |
131 | 131 | if (!function_exists($comment_config['callback']['approve'])) { |
132 | 132 | $skip = true; |
133 | 133 | } |
134 | - } else { |
|
134 | + }else { |
|
135 | 135 | $skip = true; |
136 | 136 | } |
137 | 137 | } |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | if (isset($comment_config['callbackFile'])) { |
149 | 149 | $callbackfile = trim($comment_config['callbackFile']); |
150 | 150 | if ('' != $callbackfile |
151 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
152 | - require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
151 | + && file_exists(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile)) { |
|
152 | + require_once XOOPS_ROOT_PATH.'/modules/'.$moddir.'/'.$callbackfile; |
|
153 | 153 | } |
154 | 154 | if (!function_exists($comment_config['callback']['update'])) { |
155 | 155 | $skip = true; |
156 | 156 | } |
157 | - } else { |
|
157 | + }else { |
|
158 | 158 | $skip = true; |
159 | 159 | } |
160 | 160 | } |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | $not_module = $xoopsModule; |
185 | 185 | if (!isset($comment_url)) { |
186 | 186 | $com_config = $not_module->getInfo('comments'); |
187 | - $comment_url = $com_config['pageName'] . '?'; |
|
187 | + $comment_url = $com_config['pageName'].'?'; |
|
188 | 188 | $comment_url .= $com_config['itemName']; |
189 | 189 | } |
190 | - $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $com_itemid . '&com_id=' . $newcid . '&com_rootid=' . $com_rootid . '&com_mode=' . $com_mode . '&com_order=' . $com_order . '#comment' . $newcid; |
|
190 | + $comment_tags['X_COMMENT_URL'] = XOOPS_URL.'/modules/'.$not_module->getVar('dirname').'/'.$comment_url.'='.$com_itemid.'&com_id='.$newcid.'&com_rootid='.$com_rootid.'&com_mode='.$com_mode.'&com_order='.$com_order.'#comment'.$newcid; |
|
191 | 191 | $notificationHandler = xoops_getHandler('notification'); |
192 | 192 | $notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid); |
193 | 193 | } |
194 | 194 | |
195 | 195 | PlanetUtility::planetRespondToTrackback(0); |
196 | - } else { |
|
196 | + }else { |
|
197 | 197 | PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors())); |
198 | 198 | } |
199 | 199 | } |
@@ -37,61 +37,61 @@ |
||
37 | 37 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0)); |
38 | 38 | |
39 | 39 | if (empty($article_id) && empty($blog_id)) { |
40 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
40 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
44 | 44 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
45 | 45 | if (empty($helper->getConfig('anonymous_rate')) && !is_object($xoopsUser)) { |
46 | - $message = planet_constant('MD_NOACCESS'); |
|
46 | + $message = planet_constant('MD_NOACCESS'); |
|
47 | 47 | } else { |
48 | - $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
49 | - $ip = PlanetUtility::planetGetIP(); |
|
50 | - if ($article_id > 0) { |
|
51 | - $criteria = new \CriteriaCompo(new \Criteria('art_id', $article_id)); |
|
52 | - } else { |
|
53 | - $criteria = new \CriteriaCompo(new \Criteria('blog_id', $blog_id)); |
|
54 | - } |
|
55 | - if ($uid > 0) { |
|
56 | - $criteria->add(new \Criteria('rate_uid', $uid)); |
|
57 | - } else { |
|
58 | - $criteria->add(new \Criteria('rate_ip', $ip)); |
|
59 | - $criteria->add(new \Criteria('rate_time', time() - 24 * 3600, '>')); |
|
60 | - } |
|
61 | - $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
|
62 | - if ($count = $rateHandler->getCount($criteria)) { |
|
63 | - $message = planet_constant('MD_ALREADYRATED'); |
|
64 | - } else { |
|
65 | - $rate_obj = $rateHandler->create(); |
|
66 | - if ($article_id > 0) { |
|
67 | - $rate_obj->setVar('art_id', $article_id); |
|
68 | - } else { |
|
69 | - $rate_obj->setVar('blog_id', $blog_id); |
|
70 | - } |
|
71 | - $rate_obj->setVar('rate_uid', $uid); |
|
72 | - $rate_obj->setVar('rate_ip', $ip); |
|
73 | - $rate_obj->setVar('rate_rating', $rate); |
|
74 | - $rate_obj->setVar('rate_time', time()); |
|
75 | - if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
|
76 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
|
77 | - } |
|
78 | - if ($article_id > 0) { |
|
79 | - $article_obj = $articleHandler->get($article_id); |
|
80 | - $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
81 | - $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
82 | - $articleHandler->insert($article_obj, true); |
|
83 | - } else { |
|
84 | - $blog_obj = $blogHandler->get($blog_id); |
|
85 | - $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
86 | - $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
87 | - $blogHandler->insert($blog_obj, true); |
|
88 | - } |
|
89 | - $message = planet_constant('MD_ACTIONDONE'); |
|
90 | - } |
|
48 | + $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
49 | + $ip = PlanetUtility::planetGetIP(); |
|
50 | + if ($article_id > 0) { |
|
51 | + $criteria = new \CriteriaCompo(new \Criteria('art_id', $article_id)); |
|
52 | + } else { |
|
53 | + $criteria = new \CriteriaCompo(new \Criteria('blog_id', $blog_id)); |
|
54 | + } |
|
55 | + if ($uid > 0) { |
|
56 | + $criteria->add(new \Criteria('rate_uid', $uid)); |
|
57 | + } else { |
|
58 | + $criteria->add(new \Criteria('rate_ip', $ip)); |
|
59 | + $criteria->add(new \Criteria('rate_time', time() - 24 * 3600, '>')); |
|
60 | + } |
|
61 | + $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
|
62 | + if ($count = $rateHandler->getCount($criteria)) { |
|
63 | + $message = planet_constant('MD_ALREADYRATED'); |
|
64 | + } else { |
|
65 | + $rate_obj = $rateHandler->create(); |
|
66 | + if ($article_id > 0) { |
|
67 | + $rate_obj->setVar('art_id', $article_id); |
|
68 | + } else { |
|
69 | + $rate_obj->setVar('blog_id', $blog_id); |
|
70 | + } |
|
71 | + $rate_obj->setVar('rate_uid', $uid); |
|
72 | + $rate_obj->setVar('rate_ip', $ip); |
|
73 | + $rate_obj->setVar('rate_rating', $rate); |
|
74 | + $rate_obj->setVar('rate_time', time()); |
|
75 | + if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
|
76 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
|
77 | + } |
|
78 | + if ($article_id > 0) { |
|
79 | + $article_obj = $articleHandler->get($article_id); |
|
80 | + $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
81 | + $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
82 | + $articleHandler->insert($article_obj, true); |
|
83 | + } else { |
|
84 | + $blog_obj = $blogHandler->get($blog_id); |
|
85 | + $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
86 | + $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
87 | + $blogHandler->insert($blog_obj, true); |
|
88 | + } |
|
89 | + $message = planet_constant('MD_ACTIONDONE'); |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | if ($article_id > 0) { |
93 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
93 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
94 | 94 | } else { |
95 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
95 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
96 | 96 | } |
97 | 97 | include __DIR__ . '/footer.php'; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | use Xmf\Request; |
28 | 28 | use XoopsModules\Planet; |
29 | 29 | |
30 | -include __DIR__ . '/header.php'; |
|
30 | +include __DIR__.'/header.php'; |
|
31 | 31 | |
32 | 32 | /** @var Planet\Helper $helper */ |
33 | 33 | $helper = Planet\Helper::getInstance(); |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
45 | 45 | if (empty($helper->getConfig('anonymous_rate')) && !is_object($xoopsUser)) { |
46 | 46 | $message = planet_constant('MD_NOACCESS'); |
47 | -} else { |
|
47 | +}else { |
|
48 | 48 | $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
49 | 49 | $ip = PlanetUtility::planetGetIP(); |
50 | - if ($article_id > 0) { |
|
50 | + if ($article_id>0) { |
|
51 | 51 | $criteria = new \CriteriaCompo(new \Criteria('art_id', $article_id)); |
52 | - } else { |
|
52 | + }else { |
|
53 | 53 | $criteria = new \CriteriaCompo(new \Criteria('blog_id', $blog_id)); |
54 | 54 | } |
55 | - if ($uid > 0) { |
|
55 | + if ($uid>0) { |
|
56 | 56 | $criteria->add(new \Criteria('rate_uid', $uid)); |
57 | - } else { |
|
57 | + }else { |
|
58 | 58 | $criteria->add(new \Criteria('rate_ip', $ip)); |
59 | - $criteria->add(new \Criteria('rate_time', time() - 24 * 3600, '>')); |
|
59 | + $criteria->add(new \Criteria('rate_time', time()-24*3600, '>')); |
|
60 | 60 | } |
61 | 61 | $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
62 | 62 | if ($count = $rateHandler->getCount($criteria)) { |
63 | 63 | $message = planet_constant('MD_ALREADYRATED'); |
64 | - } else { |
|
64 | + }else { |
|
65 | 65 | $rate_obj = $rateHandler->create(); |
66 | - if ($article_id > 0) { |
|
66 | + if ($article_id>0) { |
|
67 | 67 | $rate_obj->setVar('art_id', $article_id); |
68 | - } else { |
|
68 | + }else { |
|
69 | 69 | $rate_obj->setVar('blog_id', $blog_id); |
70 | 70 | } |
71 | 71 | $rate_obj->setVar('rate_uid', $uid); |
@@ -75,23 +75,23 @@ discard block |
||
75 | 75 | if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
76 | 76 | redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
77 | 77 | } |
78 | - if ($article_id > 0) { |
|
78 | + if ($article_id>0) { |
|
79 | 79 | $article_obj = $articleHandler->get($article_id); |
80 | - $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
81 | - $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
80 | + $article_obj->setVar('art_rating', $article_obj->getVar('art_rating')+$rate); |
|
81 | + $article_obj->setVar('art_rates', $article_obj->getVar('art_rates')+1); |
|
82 | 82 | $articleHandler->insert($article_obj, true); |
83 | - } else { |
|
83 | + }else { |
|
84 | 84 | $blog_obj = $blogHandler->get($blog_id); |
85 | - $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
86 | - $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
85 | + $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating')+$rate); |
|
86 | + $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates')+1); |
|
87 | 87 | $blogHandler->insert($blog_obj, true); |
88 | 88 | } |
89 | 89 | $message = planet_constant('MD_ACTIONDONE'); |
90 | 90 | } |
91 | 91 | } |
92 | -if ($article_id > 0) { |
|
93 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
94 | -} else { |
|
95 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
92 | +if ($article_id>0) { |
|
93 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_id, 2, $message); |
|
94 | +}else { |
|
95 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
96 | 96 | } |
97 | -include __DIR__ . '/footer.php'; |
|
97 | +include __DIR__.'/footer.php'; |
@@ -27,8 +27,8 @@ |
||
27 | 27 | include __DIR__ . '/header.php'; |
28 | 28 | $com_itemid = \Xmf\Request::getInt('com_itemid', 0, 'GET'); |
29 | 29 | if ($com_itemid > 0) { |
30 | - $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
|
31 | - $article_obj = $articleHandler->get($com_itemid); |
|
32 | - $com_replytitle = $article_obj->getVar('art_title'); |
|
33 | - require_once XOOPS_ROOT_PATH . '/include/comment_new.php'; |
|
30 | + $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
|
31 | + $article_obj = $articleHandler->get($com_itemid); |
|
32 | + $com_replytitle = $article_obj->getVar('art_title'); |
|
33 | + require_once XOOPS_ROOT_PATH . '/include/comment_new.php'; |
|
34 | 34 | } |
@@ -24,11 +24,11 @@ |
||
24 | 24 | // URL: https://xoops.org // |
25 | 25 | // Project: Article Project // |
26 | 26 | // ------------------------------------------------------------------------ // |
27 | -include __DIR__ . '/header.php'; |
|
27 | +include __DIR__.'/header.php'; |
|
28 | 28 | $com_itemid = \Xmf\Request::getInt('com_itemid', 0, 'GET'); |
29 | -if ($com_itemid > 0) { |
|
29 | +if ($com_itemid>0) { |
|
30 | 30 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
31 | 31 | $article_obj = $articleHandler->get($com_itemid); |
32 | 32 | $com_replytitle = $article_obj->getVar('art_title'); |
33 | - require_once XOOPS_ROOT_PATH . '/include/comment_new.php'; |
|
33 | + require_once XOOPS_ROOT_PATH.'/include/comment_new.php'; |
|
34 | 34 | } |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | $blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
38 | 38 | |
39 | 39 | if (empty($helper->getConfig('newblog_submit')) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) { |
40 | - redirect_header('index.php', 2, _NOPERM); |
|
40 | + redirect_header('index.php', 2, _NOPERM); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) {//!empty($_POST['fetch'])) { |
44 | - $op = 'edit'; |
|
44 | + $op = 'edit'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | if ('save' === $op && !$GLOBALS['xoopsSecurity']->check()) { |
48 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
48 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
49 | 49 | } |
50 | 50 | include XOOPS_ROOT_PATH . '/header.php'; |
51 | 51 | include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
@@ -54,110 +54,110 @@ discard block |
||
54 | 54 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
55 | 55 | |
56 | 56 | switch ($op) { |
57 | - /* save a single blog */ |
|
58 | - case 'save': |
|
59 | - |
|
60 | - if ($blog_id) { |
|
61 | - $blog_obj = $blogHandler->get($blog_id); |
|
62 | - if ($xoopsUser->isAdmin()) { |
|
63 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
64 | - } |
|
65 | - } else { |
|
66 | - if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
|
67 | - ) { |
|
68 | - redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
|
69 | - } |
|
70 | - |
|
71 | - $blog_obj = $blogHandler->create(); |
|
72 | - $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
73 | - |
|
74 | - switch ($helper->getConfig('newblog_submit')) { |
|
75 | - case 2: |
|
76 | - if (!is_object($xoopsUser)) { |
|
77 | - $status = 0; |
|
78 | - } else { |
|
79 | - $status = 1; |
|
80 | - } |
|
81 | - break; |
|
82 | - case 0: |
|
83 | - case 3: |
|
84 | - $status = 1; |
|
85 | - break; |
|
86 | - case 1: |
|
87 | - default: |
|
88 | - if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
|
89 | - $status = 0; |
|
90 | - } else { |
|
91 | - $status = 1; |
|
92 | - } |
|
93 | - break; |
|
94 | - } |
|
95 | - |
|
96 | - $blog_obj->setVar('blog_status', $status); |
|
97 | - } |
|
98 | - |
|
99 | - $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
100 | - $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
101 | - $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
102 | - $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
103 | - $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
104 | - $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
105 | - $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
106 | - $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
107 | - if ($blog_obj->isNew()) { |
|
108 | - $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
109 | - } |
|
110 | - |
|
111 | - if (!$blogHandler->insert($blog_obj)) { |
|
112 | - } elseif (0 !== count(Request::getArray('categories', [], 'POST'))) { |
|
113 | - $blog_id = $blog_obj->getVar('blog_id'); |
|
114 | - if (in_array(0, $_POST['categories'])) { |
|
115 | - $_POST['categories'] = []; |
|
116 | - } |
|
117 | - $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
118 | - } |
|
119 | - $message = planet_constant('MD_DBUPDATED'); |
|
120 | - redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
121 | - |
|
122 | - /* edit a single blog */ |
|
123 | - // no break |
|
124 | - case 'edit': |
|
125 | - default: |
|
126 | - if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
127 | - $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
128 | - $blog_obj->setVar('blog_id', $blog_id); |
|
129 | - } else { |
|
130 | - $blog_obj = $blogHandler->get($blog_id); |
|
131 | - } |
|
132 | - $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
133 | - if (in_array('-1', $categories)) { |
|
134 | - $categories = []; |
|
135 | - } |
|
136 | - if (empty($categories) && $blog_id > 0) { |
|
137 | - $crit = new \Criteria('bc.blog_id', $blog_id); |
|
138 | - $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
139 | - } |
|
140 | - if (empty($categories)) { |
|
141 | - $categories = [0 => _NONE]; |
|
142 | - } |
|
143 | - |
|
144 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
145 | - echo '<br>'; |
|
146 | - if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
147 | - $criteria = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
148 | - $blogs_obj = $blogHandler->getList($criteria); |
|
149 | - if (count($blogs_obj) > 0) { |
|
150 | - echo '<div class="errorMsg">' . planet_constant('MD_BLOGEXISTS'); |
|
151 | - foreach (array_keys($blogs_obj) as $bid) { |
|
152 | - echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>'; |
|
153 | - } |
|
154 | - echo '</div>'; |
|
155 | - unset($blogs_obj, $criteria); |
|
156 | - } |
|
157 | - } |
|
158 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
159 | - echo '</fieldset>'; |
|
160 | - break; |
|
57 | + /* save a single blog */ |
|
58 | + case 'save': |
|
59 | + |
|
60 | + if ($blog_id) { |
|
61 | + $blog_obj = $blogHandler->get($blog_id); |
|
62 | + if ($xoopsUser->isAdmin()) { |
|
63 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
64 | + } |
|
65 | + } else { |
|
66 | + if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
|
67 | + ) { |
|
68 | + redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
|
69 | + } |
|
70 | + |
|
71 | + $blog_obj = $blogHandler->create(); |
|
72 | + $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
73 | + |
|
74 | + switch ($helper->getConfig('newblog_submit')) { |
|
75 | + case 2: |
|
76 | + if (!is_object($xoopsUser)) { |
|
77 | + $status = 0; |
|
78 | + } else { |
|
79 | + $status = 1; |
|
80 | + } |
|
81 | + break; |
|
82 | + case 0: |
|
83 | + case 3: |
|
84 | + $status = 1; |
|
85 | + break; |
|
86 | + case 1: |
|
87 | + default: |
|
88 | + if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
|
89 | + $status = 0; |
|
90 | + } else { |
|
91 | + $status = 1; |
|
92 | + } |
|
93 | + break; |
|
94 | + } |
|
95 | + |
|
96 | + $blog_obj->setVar('blog_status', $status); |
|
97 | + } |
|
98 | + |
|
99 | + $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
100 | + $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
101 | + $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
102 | + $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
103 | + $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
104 | + $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
105 | + $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
106 | + $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
107 | + if ($blog_obj->isNew()) { |
|
108 | + $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
109 | + } |
|
110 | + |
|
111 | + if (!$blogHandler->insert($blog_obj)) { |
|
112 | + } elseif (0 !== count(Request::getArray('categories', [], 'POST'))) { |
|
113 | + $blog_id = $blog_obj->getVar('blog_id'); |
|
114 | + if (in_array(0, $_POST['categories'])) { |
|
115 | + $_POST['categories'] = []; |
|
116 | + } |
|
117 | + $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
118 | + } |
|
119 | + $message = planet_constant('MD_DBUPDATED'); |
|
120 | + redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
121 | + |
|
122 | + /* edit a single blog */ |
|
123 | + // no break |
|
124 | + case 'edit': |
|
125 | + default: |
|
126 | + if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
127 | + $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
128 | + $blog_obj->setVar('blog_id', $blog_id); |
|
129 | + } else { |
|
130 | + $blog_obj = $blogHandler->get($blog_id); |
|
131 | + } |
|
132 | + $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
133 | + if (in_array('-1', $categories)) { |
|
134 | + $categories = []; |
|
135 | + } |
|
136 | + if (empty($categories) && $blog_id > 0) { |
|
137 | + $crit = new \Criteria('bc.blog_id', $blog_id); |
|
138 | + $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
139 | + } |
|
140 | + if (empty($categories)) { |
|
141 | + $categories = [0 => _NONE]; |
|
142 | + } |
|
143 | + |
|
144 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
145 | + echo '<br>'; |
|
146 | + if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
147 | + $criteria = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
148 | + $blogs_obj = $blogHandler->getList($criteria); |
|
149 | + if (count($blogs_obj) > 0) { |
|
150 | + echo '<div class="errorMsg">' . planet_constant('MD_BLOGEXISTS'); |
|
151 | + foreach (array_keys($blogs_obj) as $bid) { |
|
152 | + echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>'; |
|
153 | + } |
|
154 | + echo '</div>'; |
|
155 | + unset($blogs_obj, $criteria); |
|
156 | + } |
|
157 | + } |
|
158 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
159 | + echo '</fieldset>'; |
|
160 | + break; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | use Xmf\Request; |
28 | 28 | use XoopsModules\Planet; |
29 | 29 | |
30 | -include __DIR__ . '/header.php'; |
|
30 | +include __DIR__.'/header.php'; |
|
31 | 31 | |
32 | 32 | /** @var Planet\Helper $helper */ |
33 | 33 | $helper = Planet\Helper::getInstance(); |
34 | 34 | |
35 | -$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
36 | -$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
37 | -$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
|
35 | +$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
36 | +$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
37 | +$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id; |
|
38 | 38 | |
39 | 39 | if (empty($helper->getConfig('newblog_submit')) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) { |
40 | 40 | redirect_header('index.php', 2, _NOPERM); |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | if ('save' === $op && !$GLOBALS['xoopsSecurity']->check()) { |
48 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
48 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID').': security check failed'); |
|
49 | 49 | } |
50 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
51 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
50 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
51 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
52 | 52 | |
53 | 53 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
54 | 54 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | if ($blog_id) { |
61 | 61 | $blog_obj = $blogHandler->get($blog_id); |
62 | 62 | if ($xoopsUser->isAdmin()) { |
63 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
63 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); // @$_POST['blog_status']); |
|
64 | 64 | } |
65 | - } else { |
|
65 | + }else { |
|
66 | 66 | if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
67 | 67 | ) { |
68 | 68 | redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | case 2: |
76 | 76 | if (!is_object($xoopsUser)) { |
77 | 77 | $status = 0; |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $status = 1; |
80 | 80 | } |
81 | 81 | break; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | default: |
88 | 88 | if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
89 | 89 | $status = 0; |
90 | - } else { |
|
90 | + }else { |
|
91 | 91 | $status = 1; |
92 | 92 | } |
93 | 93 | break; |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $blog_obj->setVar('blog_status', $status); |
97 | 97 | } |
98 | 98 | |
99 | - $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
100 | - $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
101 | - $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
102 | - $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
103 | - $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
104 | - $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
105 | - $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
106 | - $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
99 | + $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']); |
|
100 | + $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']); |
|
101 | + $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']); |
|
102 | + $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST')); //$_POST['blog_feed']); |
|
103 | + $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']); |
|
104 | + $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']); |
|
105 | + $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']); |
|
106 | + $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']); |
|
107 | 107 | if ($blog_obj->isNew()) { |
108 | 108 | $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
109 | 109 | } |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | if (in_array(0, $_POST['categories'])) { |
115 | 115 | $_POST['categories'] = []; |
116 | 116 | } |
117 | - $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
117 | + $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST')); //$_POST['categories']); |
|
118 | 118 | } |
119 | 119 | $message = planet_constant('MD_DBUPDATED'); |
120 | - redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
120 | + redirect_header('index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
121 | 121 | |
122 | 122 | /* edit a single blog */ |
123 | 123 | // no break |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | if (!empty(Request::getString('fetch', '', 'POST'))) { |
127 | 127 | $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
128 | 128 | $blog_obj->setVar('blog_id', $blog_id); |
129 | - } else { |
|
129 | + }else { |
|
130 | 130 | $blog_obj = $blogHandler->get($blog_id); |
131 | 131 | } |
132 | - $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
132 | + $categories = Request::getArray('categories', [], 'POST'); //isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
133 | 133 | if (in_array('-1', $categories)) { |
134 | 134 | $categories = []; |
135 | 135 | } |
136 | - if (empty($categories) && $blog_id > 0) { |
|
136 | + if (empty($categories) && $blog_id>0) { |
|
137 | 137 | $crit = new \Criteria('bc.blog_id', $blog_id); |
138 | 138 | $categories = array_keys($categoryHandler->getByBlog($crit)); |
139 | 139 | } |
@@ -141,23 +141,23 @@ discard block |
||
141 | 141 | $categories = [0 => _NONE]; |
142 | 142 | } |
143 | 143 | |
144 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
144 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>'; |
|
145 | 145 | echo '<br>'; |
146 | 146 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
147 | 147 | $criteria = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
148 | 148 | $blogs_obj = $blogHandler->getList($criteria); |
149 | - if (count($blogs_obj) > 0) { |
|
150 | - echo '<div class="errorMsg">' . planet_constant('MD_BLOGEXISTS'); |
|
149 | + if (count($blogs_obj)>0) { |
|
150 | + echo '<div class="errorMsg">'.planet_constant('MD_BLOGEXISTS'); |
|
151 | 151 | foreach (array_keys($blogs_obj) as $bid) { |
152 | - echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>'; |
|
152 | + echo '<br><a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid.'" target="_blank">'.$blogs_obj[$bid].'</a>'; |
|
153 | 153 | } |
154 | 154 | echo '</div>'; |
155 | 155 | unset($blogs_obj, $criteria); |
156 | 156 | } |
157 | 157 | } |
158 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
158 | + include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php'; |
|
159 | 159 | echo '</fieldset>'; |
160 | 160 | break; |
161 | 161 | } |
162 | 162 | |
163 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
163 | +include XOOPS_ROOT_PATH.'/footer.php'; |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | include __DIR__ . '/header.php'; |
34 | 34 | |
35 | 35 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
36 | - $args['article'] = @$args_num[0]; |
|
37 | - $args['type'] = @$args_str[0]; |
|
36 | + $args['article'] = @$args_num[0]; |
|
37 | + $args['type'] = @$args_str[0]; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /* Specified Article */ |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | $valid_format = ['RSS0.91', 'RSS1.0', 'RSS2.0', 'PIE0.1', 'MBOX', 'OPML', 'ATOM', 'ATOM0.3', 'HTML', 'JS']; |
53 | 53 | if ('RDF' === $type) { |
54 | - $type = 'RSS1.0'; |
|
54 | + $type = 'RSS1.0'; |
|
55 | 55 | } |
56 | 56 | if ('RSS' === $type) { |
57 | - $type = 'RSS0.91'; |
|
57 | + $type = 'RSS0.91'; |
|
58 | 58 | } |
59 | 59 | if (empty($type) || !in_array($type, $valid_format)) { |
60 | - PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
61 | - exit(); |
|
60 | + PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
61 | + exit(); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -67,30 +67,30 @@ discard block |
||
67 | 67 | $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']); |
68 | 68 | |
69 | 69 | if (!empty($article_id)) { |
70 | - $article_obj = $articleHandler->get($article_id); |
|
71 | - if (!$article_obj->getVar('art_id')) { |
|
72 | - PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED')); |
|
73 | - exit(); |
|
74 | - } |
|
75 | - $source = 'article'; |
|
70 | + $article_obj = $articleHandler->get($article_id); |
|
71 | + if (!$article_obj->getVar('art_id')) { |
|
72 | + PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED')); |
|
73 | + exit(); |
|
74 | + } |
|
75 | + $source = 'article'; |
|
76 | 76 | } elseif (!empty($blog_id)) { |
77 | - $blog_obj = $blogHandler->get($blog_id); |
|
78 | - if (!$blog_obj->getVar('blog_id')) { |
|
79 | - PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
80 | - exit(); |
|
81 | - } |
|
82 | - $source = 'blog'; |
|
77 | + $blog_obj = $blogHandler->get($blog_id); |
|
78 | + if (!$blog_obj->getVar('blog_id')) { |
|
79 | + PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
80 | + exit(); |
|
81 | + } |
|
82 | + $source = 'blog'; |
|
83 | 83 | } elseif (!empty($category_id)) { |
84 | - $source = 'category'; |
|
85 | - $category_obj = $categoryHandler->get($category_id); |
|
86 | - if (!$category_obj->getVar('cat_id')) { |
|
87 | - PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
88 | - exit(); |
|
89 | - } |
|
84 | + $source = 'category'; |
|
85 | + $category_obj = $categoryHandler->get($category_id); |
|
86 | + if (!$category_obj->getVar('cat_id')) { |
|
87 | + PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
88 | + exit(); |
|
89 | + } |
|
90 | 90 | } elseif (!empty($uid)) { |
91 | - $source = 'bookmark'; |
|
91 | + $source = 'bookmark'; |
|
92 | 92 | } else { |
93 | - $source = ''; |
|
93 | + $source = ''; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $xml_charset = 'UTF-8'; |
@@ -100,102 +100,102 @@ discard block |
||
100 | 100 | $tpl->xoops_setCacheTime(3600); |
101 | 101 | $xoopsCachedTemplateId = md5($xoopsModule->getVar('mid') . ',' . $article_id . ',' . $category_id . ',' . $blog_id . ',' . $uid . ',' . $type); |
102 | 102 | if (!$tpl->is_cached('db:system_dummy.tpl', $xoopsCachedTemplateId)) { |
103 | - $criteria = new \CriteriaCompo(); |
|
104 | - $criteria->setLimit($helper->getConfig('articles_perpage')); |
|
105 | - $articles_obj = []; |
|
106 | - switch ($source) { |
|
107 | - case 'article': |
|
108 | - $pagetitle = planet_constant('MD_ARTICLE'); |
|
109 | - $rssdesc = planet_constant('MD_XMLDESC_ARTICLE'); |
|
110 | - |
|
111 | - $articles_obj[$article_id] = $article_obj; |
|
112 | - |
|
113 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
114 | - break; |
|
115 | - |
|
116 | - case 'category': |
|
117 | - $pagetitle = planet_constant('MD_CATEGORY'); |
|
118 | - $rssdesc = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title')); |
|
119 | - |
|
120 | - $criteria->add(new \Criteria('bc.cat_id', $category_id)); |
|
121 | - $articles_obj = $articleHandler->getByCategory($criteria); |
|
122 | - |
|
123 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id; |
|
124 | - break; |
|
125 | - |
|
126 | - case 'blog': |
|
127 | - $pagetitle = planet_constant('MD_BLOG'); |
|
128 | - $rssdesc = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title')); |
|
129 | - |
|
130 | - $criteria->add(new \Criteria('blog_id', $blog_id)); |
|
131 | - $articles_obj = $articleHandler->getAll($criteria); |
|
132 | - |
|
133 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id; |
|
134 | - break; |
|
135 | - |
|
136 | - case 'bookmark': |
|
137 | - $author_name = XoopsUser::getUnameFromId($uid); |
|
138 | - $pagetitle = planet_constant('MD_BOOKMARKS'); |
|
139 | - $rssdesc = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name); |
|
140 | - |
|
141 | - $criteria->add(new \Criteria('bm.bm_uid', $uid)); |
|
142 | - $articles_obj = $articleHandler->getByBookmark($criteria); |
|
143 | - |
|
144 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid; |
|
145 | - |
|
146 | - break; |
|
147 | - |
|
148 | - default: |
|
149 | - $pagetitle = planet_constant('MD_INDEX'); |
|
150 | - $rssdesc = planet_constant('MD_XMLDESC_INDEX'); |
|
151 | - |
|
152 | - $articles_obj = $articleHandler->getAll($criteria); |
|
153 | - |
|
154 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
155 | - break; |
|
156 | - } |
|
157 | - $items = []; |
|
158 | - foreach (array_keys($articles_obj) as $id) { |
|
159 | - $content = $articles_obj[$id]->getVar('art_content'); |
|
160 | - $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author'); |
|
161 | - $items[] = [ |
|
162 | - 'title' => $articles_obj[$id]->getVar('art_title'), |
|
163 | - 'link' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'), |
|
164 | - 'description' => $content, |
|
165 | - 'descriptionHtmlSyndicated' => true, |
|
166 | - 'date' => $articles_obj[$id]->getTime('rss'), |
|
167 | - 'source' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/', |
|
168 | - 'author' => $articles_obj[$id]->getVar('art_author') |
|
169 | - ]; |
|
170 | - } |
|
171 | - unset($articles_obj, $criteria); |
|
172 | - |
|
173 | - $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']); |
|
174 | - $xml = $xmlHandler->create($type); |
|
175 | - $xml->setVar('encoding', $xml_charset); |
|
176 | - $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true); |
|
177 | - $xml->setVar('description', $rssdesc, true); |
|
178 | - $xml->setVar('descriptionHtmlSyndicated', true); |
|
179 | - $xml->setVar('link', $xml_link); |
|
180 | - $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true); |
|
181 | - $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true)); |
|
182 | - $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true)); |
|
183 | - $xml->setVar('category', $xoopsModule->getVar('name'), true); |
|
184 | - $xml->setVar('generator', $xoopsModule->getInfo('version')); |
|
185 | - $xml->setVar('language', _LANGCODE); |
|
186 | - |
|
187 | - $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image')); |
|
188 | - $image = [ |
|
189 | - 'width' => $dimention[0], |
|
190 | - 'height' => $dimention[1], |
|
191 | - 'title' => $xoopsConfig['sitename'] . ' :: ' . $pagetitle, |
|
192 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'), |
|
193 | - 'link' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/', |
|
194 | - 'description' => $rssdesc |
|
195 | - ]; |
|
196 | - $xml->setImage($image); |
|
197 | - |
|
198 | - /* |
|
103 | + $criteria = new \CriteriaCompo(); |
|
104 | + $criteria->setLimit($helper->getConfig('articles_perpage')); |
|
105 | + $articles_obj = []; |
|
106 | + switch ($source) { |
|
107 | + case 'article': |
|
108 | + $pagetitle = planet_constant('MD_ARTICLE'); |
|
109 | + $rssdesc = planet_constant('MD_XMLDESC_ARTICLE'); |
|
110 | + |
|
111 | + $articles_obj[$article_id] = $article_obj; |
|
112 | + |
|
113 | + $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
114 | + break; |
|
115 | + |
|
116 | + case 'category': |
|
117 | + $pagetitle = planet_constant('MD_CATEGORY'); |
|
118 | + $rssdesc = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title')); |
|
119 | + |
|
120 | + $criteria->add(new \Criteria('bc.cat_id', $category_id)); |
|
121 | + $articles_obj = $articleHandler->getByCategory($criteria); |
|
122 | + |
|
123 | + $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id; |
|
124 | + break; |
|
125 | + |
|
126 | + case 'blog': |
|
127 | + $pagetitle = planet_constant('MD_BLOG'); |
|
128 | + $rssdesc = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title')); |
|
129 | + |
|
130 | + $criteria->add(new \Criteria('blog_id', $blog_id)); |
|
131 | + $articles_obj = $articleHandler->getAll($criteria); |
|
132 | + |
|
133 | + $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id; |
|
134 | + break; |
|
135 | + |
|
136 | + case 'bookmark': |
|
137 | + $author_name = XoopsUser::getUnameFromId($uid); |
|
138 | + $pagetitle = planet_constant('MD_BOOKMARKS'); |
|
139 | + $rssdesc = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name); |
|
140 | + |
|
141 | + $criteria->add(new \Criteria('bm.bm_uid', $uid)); |
|
142 | + $articles_obj = $articleHandler->getByBookmark($criteria); |
|
143 | + |
|
144 | + $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid; |
|
145 | + |
|
146 | + break; |
|
147 | + |
|
148 | + default: |
|
149 | + $pagetitle = planet_constant('MD_INDEX'); |
|
150 | + $rssdesc = planet_constant('MD_XMLDESC_INDEX'); |
|
151 | + |
|
152 | + $articles_obj = $articleHandler->getAll($criteria); |
|
153 | + |
|
154 | + $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
155 | + break; |
|
156 | + } |
|
157 | + $items = []; |
|
158 | + foreach (array_keys($articles_obj) as $id) { |
|
159 | + $content = $articles_obj[$id]->getVar('art_content'); |
|
160 | + $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author'); |
|
161 | + $items[] = [ |
|
162 | + 'title' => $articles_obj[$id]->getVar('art_title'), |
|
163 | + 'link' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'), |
|
164 | + 'description' => $content, |
|
165 | + 'descriptionHtmlSyndicated' => true, |
|
166 | + 'date' => $articles_obj[$id]->getTime('rss'), |
|
167 | + 'source' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/', |
|
168 | + 'author' => $articles_obj[$id]->getVar('art_author') |
|
169 | + ]; |
|
170 | + } |
|
171 | + unset($articles_obj, $criteria); |
|
172 | + |
|
173 | + $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']); |
|
174 | + $xml = $xmlHandler->create($type); |
|
175 | + $xml->setVar('encoding', $xml_charset); |
|
176 | + $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true); |
|
177 | + $xml->setVar('description', $rssdesc, true); |
|
178 | + $xml->setVar('descriptionHtmlSyndicated', true); |
|
179 | + $xml->setVar('link', $xml_link); |
|
180 | + $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true); |
|
181 | + $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true)); |
|
182 | + $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true)); |
|
183 | + $xml->setVar('category', $xoopsModule->getVar('name'), true); |
|
184 | + $xml->setVar('generator', $xoopsModule->getInfo('version')); |
|
185 | + $xml->setVar('language', _LANGCODE); |
|
186 | + |
|
187 | + $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image')); |
|
188 | + $image = [ |
|
189 | + 'width' => $dimention[0], |
|
190 | + 'height' => $dimention[1], |
|
191 | + 'title' => $xoopsConfig['sitename'] . ' :: ' . $pagetitle, |
|
192 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'), |
|
193 | + 'link' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/', |
|
194 | + 'description' => $rssdesc |
|
195 | + ]; |
|
196 | + $xml->setImage($image); |
|
197 | + |
|
198 | + /* |
|
199 | 199 | $item = array( |
200 | 200 | "title" => $datatitle, |
201 | 201 | "link" => $dataurl, |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | "author" => $dataauthor |
207 | 207 | ); |
208 | 208 | */ |
209 | - $xml->addItems($items); |
|
209 | + $xml->addItems($items); |
|
210 | 210 | |
211 | - $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp'); |
|
211 | + $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp'); |
|
212 | 212 | |
213 | - $tpl->assign_by_ref('dummy_content', $dummy_content); |
|
213 | + $tpl->assign_by_ref('dummy_content', $dummy_content); |
|
214 | 214 | } |
215 | 215 | //$content = ob_get_contents(); |
216 | 216 | ob_end_clean(); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $helper = Planet\Helper::getInstance(); |
31 | 31 | |
32 | 32 | ob_start(); |
33 | -include __DIR__ . '/header.php'; |
|
33 | +include __DIR__.'/header.php'; |
|
34 | 34 | |
35 | 35 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
36 | 36 | $args['article'] = @$args_num[0]; |
@@ -89,16 +89,16 @@ discard block |
||
89 | 89 | } |
90 | 90 | } elseif (!empty($uid)) { |
91 | 91 | $source = 'bookmark'; |
92 | -} else { |
|
92 | +}else { |
|
93 | 93 | $source = ''; |
94 | 94 | } |
95 | 95 | |
96 | 96 | $xml_charset = 'UTF-8'; |
97 | -require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
97 | +require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
98 | 98 | $tpl = new \XoopsTpl(); |
99 | -$tpl->caching=(2); |
|
99 | +$tpl->caching = (2); |
|
100 | 100 | $tpl->xoops_setCacheTime(3600); |
101 | -$xoopsCachedTemplateId = md5($xoopsModule->getVar('mid') . ',' . $article_id . ',' . $category_id . ',' . $blog_id . ',' . $uid . ',' . $type); |
|
101 | +$xoopsCachedTemplateId = md5($xoopsModule->getVar('mid').','.$article_id.','.$category_id.','.$blog_id.','.$uid.','.$type); |
|
102 | 102 | if (!$tpl->is_cached('db:system_dummy.tpl', $xoopsCachedTemplateId)) { |
103 | 103 | $criteria = new \CriteriaCompo(); |
104 | 104 | $criteria->setLimit($helper->getConfig('articles_perpage')); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $articles_obj[$article_id] = $article_obj; |
112 | 112 | |
113 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
113 | + $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_obj->getVar('art_id'); |
|
114 | 114 | break; |
115 | 115 | |
116 | 116 | case 'category': |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $criteria->add(new \Criteria('bc.cat_id', $category_id)); |
121 | 121 | $articles_obj = $articleHandler->getByCategory($criteria); |
122 | 122 | |
123 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id; |
|
123 | + $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'c'.$category_id; |
|
124 | 124 | break; |
125 | 125 | |
126 | 126 | case 'blog': |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $criteria->add(new \Criteria('blog_id', $blog_id)); |
131 | 131 | $articles_obj = $articleHandler->getAll($criteria); |
132 | 132 | |
133 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id; |
|
133 | + $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id; |
|
134 | 134 | break; |
135 | 135 | |
136 | 136 | case 'bookmark': |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $criteria->add(new \Criteria('bm.bm_uid', $uid)); |
142 | 142 | $articles_obj = $articleHandler->getByBookmark($criteria); |
143 | 143 | |
144 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid; |
|
144 | + $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'u'.$uid; |
|
145 | 145 | |
146 | 146 | break; |
147 | 147 | |
@@ -151,20 +151,20 @@ discard block |
||
151 | 151 | |
152 | 152 | $articles_obj = $articleHandler->getAll($criteria); |
153 | 153 | |
154 | - $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php'; |
|
154 | + $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'; |
|
155 | 155 | break; |
156 | 156 | } |
157 | 157 | $items = []; |
158 | 158 | foreach (array_keys($articles_obj) as $id) { |
159 | 159 | $content = $articles_obj[$id]->getVar('art_content'); |
160 | - $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author'); |
|
160 | + $content .= '<br>'.planet_constant('MD_SOURCE').': '.$articles_obj[$id]->getVar('art_link').' '.$articles_obj[$id]->getVar('art_author'); |
|
161 | 161 | $items[] = [ |
162 | 162 | 'title' => $articles_obj[$id]->getVar('art_title'), |
163 | - 'link' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'), |
|
163 | + 'link' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$articles_obj[$id]->getVar('art_id'), |
|
164 | 164 | 'description' => $content, |
165 | 165 | 'descriptionHtmlSyndicated' => true, |
166 | 166 | 'date' => $articles_obj[$id]->getTime('rss'), |
167 | - 'source' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/', |
|
167 | + 'source' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/', |
|
168 | 168 | 'author' => $articles_obj[$id]->getVar('art_author') |
169 | 169 | ]; |
170 | 170 | } |
@@ -173,24 +173,24 @@ discard block |
||
173 | 173 | $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']); |
174 | 174 | $xml = $xmlHandler->create($type); |
175 | 175 | $xml->setVar('encoding', $xml_charset); |
176 | - $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true); |
|
176 | + $xml->setVar('title', $xoopsConfig['sitename'].' :: '.$pagetitle, 'UTF-8', $xml_charset, true); |
|
177 | 177 | $xml->setVar('description', $rssdesc, true); |
178 | 178 | $xml->setVar('descriptionHtmlSyndicated', true); |
179 | 179 | $xml->setVar('link', $xml_link); |
180 | - $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true); |
|
180 | + $xml->setVar('syndicationURL', XOOPS_URL.'/'.xoops_getenv('PHP_SELF'), 'post', true); |
|
181 | 181 | $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true)); |
182 | 182 | $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true)); |
183 | 183 | $xml->setVar('category', $xoopsModule->getVar('name'), true); |
184 | 184 | $xml->setVar('generator', $xoopsModule->getInfo('version')); |
185 | 185 | $xml->setVar('language', _LANGCODE); |
186 | 186 | |
187 | - $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image')); |
|
187 | + $dimention = @getimagesize(XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/'.$xoopsModule->getInfo('image')); |
|
188 | 188 | $image = [ |
189 | 189 | 'width' => $dimention[0], |
190 | 190 | 'height' => $dimention[1], |
191 | - 'title' => $xoopsConfig['sitename'] . ' :: ' . $pagetitle, |
|
192 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'), |
|
193 | - 'link' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/', |
|
191 | + 'title' => $xoopsConfig['sitename'].' :: '.$pagetitle, |
|
192 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'.$xoopsModule->getInfo('image'), |
|
193 | + 'link' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/', |
|
194 | 194 | 'description' => $rssdesc |
195 | 195 | ]; |
196 | 196 | $xml->setImage($image); |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | */ |
209 | 209 | $xml->addItems($items); |
210 | 210 | |
211 | - $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp'); |
|
211 | + $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'.xml.tmp'); |
|
212 | 212 | |
213 | 213 | $tpl->assign_by_ref('dummy_content', $dummy_content); |
214 | 214 | } |
215 | 215 | //$content = ob_get_contents(); |
216 | 216 | ob_end_clean(); |
217 | -header('Content-Type:text/xml; charset=' . $xml_charset); |
|
217 | +header('Content-Type:text/xml; charset='.$xml_charset); |
|
218 | 218 | $tpl->display('db:system_dummy.tpl', $xoopsCachedTemplateId); |