@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | include __DIR__ . '/header.php'; |
30 | 30 | |
31 | 31 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
32 | - $args['year'] = @$args_num[0]; |
|
33 | - $args['month'] = @$args_num[1]; |
|
34 | - $args['day'] = @$args_num[2]; |
|
32 | + $args['year'] = @$args_num[0]; |
|
33 | + $args['month'] = @$args_num[1]; |
|
34 | + $args['day'] = @$args_num[2]; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $day = Request::getInt('day', @$args['day'], 'GET'); //(int)(empty($_GET['day']) ? @$args['day'] : $_GET['day']); |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | |
53 | 53 | $year = empty($year) ? date('Y') : $year; |
54 | 54 | if ($month < 1) { |
55 | - $month = $day = 0; |
|
56 | - $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
|
55 | + $month = $day = 0; |
|
56 | + $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
|
57 | 57 | } elseif ($day < 1) { |
58 | - $day = 0; |
|
59 | - $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
|
58 | + $day = 0; |
|
59 | + $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
|
60 | 60 | } else { |
61 | - $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
|
61 | + $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
|
62 | 62 | } |
63 | 63 | $time = ['year' => $year, 'month' => $month, 'day' => $day]; |
64 | 64 | if ($xoopsUser) { |
65 | - $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
65 | + $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
66 | 66 | } else { |
67 | - $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
67 | + $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $criteria = new CriteriaCompo(); |
71 | 71 | if ($blog_id) { |
72 | - $criteria->add(new Criteria('blog_id', $blog_id)); |
|
72 | + $criteria->add(new Criteria('blog_id', $blog_id)); |
|
73 | 73 | } |
74 | 74 | $criteria->add(new Criteria("YEAR(FROM_UNIXTIME(art_time_publish - $timeoffset))", $year)); |
75 | 75 | if ($month) { |
76 | - $criteria->add(new Criteria("MONTH(FROM_UNIXTIME(art_time_publish - $timeoffset))", $month)); |
|
77 | - if ($day) { |
|
78 | - $criteria->add(new Criteria("DAY(FROM_UNIXTIME(art_time_publish - $timeoffset))", $day)); |
|
79 | - } |
|
76 | + $criteria->add(new Criteria("MONTH(FROM_UNIXTIME(art_time_publish - $timeoffset))", $month)); |
|
77 | + if ($day) { |
|
78 | + $criteria->add(new Criteria("DAY(FROM_UNIXTIME(art_time_publish - $timeoffset))", $day)); |
|
79 | + } |
|
80 | 80 | } |
81 | 81 | $criteria->setStart($start); |
82 | 82 | $criteria->setLimit($xoopsModuleConfig['articles_perpage']); |
@@ -87,115 +87,115 @@ discard block |
||
87 | 87 | $articles = []; |
88 | 88 | $blogs_id = []; |
89 | 89 | foreach ($articles_obj as $id => $article) { |
90 | - $articles[] = [ |
|
91 | - 'id' => $id, |
|
92 | - 'blog' => ['id' => $article->getVar('blog_id'), 'title' => ''], |
|
93 | - 'title' => $article->getVar('art_title'), |
|
94 | - 'time' => $article->getTime(), |
|
95 | - 'content' => $article->getVar('art_content') |
|
96 | - ]; |
|
97 | - $articles[] = $_article; |
|
98 | - $blogs_id[$article->getVar('blog_id')] = 1; |
|
99 | - unset($_article); |
|
90 | + $articles[] = [ |
|
91 | + 'id' => $id, |
|
92 | + 'blog' => ['id' => $article->getVar('blog_id'), 'title' => ''], |
|
93 | + 'title' => $article->getVar('art_title'), |
|
94 | + 'time' => $article->getTime(), |
|
95 | + 'content' => $article->getVar('art_content') |
|
96 | + ]; |
|
97 | + $articles[] = $_article; |
|
98 | + $blogs_id[$article->getVar('blog_id')] = 1; |
|
99 | + unset($_article); |
|
100 | 100 | } |
101 | 101 | $criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); |
102 | 102 | $blogs = $blogHandler->getList($criteria_blog); |
103 | 103 | foreach (array_keys($articles) as $key) { |
104 | - $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
|
104 | + $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
|
105 | 105 | } |
106 | 106 | if ($blog_id > 0) { |
107 | - $page['blog'] = $blogs[$blog_id]; |
|
107 | + $page['blog'] = $blogs[$blog_id]; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | if ($articles_count > $xoopsModuleConfig['articles_perpage']) { |
111 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
112 | - $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' . (int)$blog_id); |
|
113 | - $pagenav = $nav->renderNav(4); |
|
111 | + include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
112 | + $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' . (int)$blog_id); |
|
113 | + $pagenav = $nav->renderNav(4); |
|
114 | 114 | } else { |
115 | - $pagenav = ''; |
|
115 | + $pagenav = ''; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $timenav = null; |
119 | 119 | $calendar = null; |
120 | 120 | $months = null; |
121 | 121 | if (empty($start)) { |
122 | - if ($blog_id) { |
|
123 | - $blog_criteria = ' AND blog_id=' . $blog_id; |
|
124 | - } else { |
|
125 | - $blog_criteria = ''; |
|
126 | - } |
|
127 | - // Get monthly list |
|
128 | - if (empty($month)) { |
|
129 | - $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
122 | + if ($blog_id) { |
|
123 | + $blog_criteria = ' AND blog_id=' . $blog_id; |
|
124 | + } else { |
|
125 | + $blog_criteria = ''; |
|
126 | + } |
|
127 | + // Get monthly list |
|
128 | + if (empty($month)) { |
|
129 | + $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
130 | 130 | FROM " . planet_DB_prefix('article') . " |
131 | 131 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
132 | 132 | " . $blog_criteria . ' |
133 | 133 | GROUP BY mon |
134 | 134 | '; |
135 | - $result = $xoopsDB->query($sql); |
|
136 | - $months = []; |
|
137 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
138 | - $months[] = [ |
|
139 | - 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
140 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id |
|
141 | - ]; |
|
142 | - } |
|
143 | - $timenav['prev'] = [ |
|
144 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id, |
|
145 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
146 | - ]; |
|
147 | - if ($year < date('Y')) { |
|
148 | - $timenav['next'] = [ |
|
149 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id, |
|
150 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
151 | - ]; |
|
152 | - } |
|
153 | - } // Get daily list |
|
154 | - elseif (empty($day)) { |
|
155 | - $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
135 | + $result = $xoopsDB->query($sql); |
|
136 | + $months = []; |
|
137 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
138 | + $months[] = [ |
|
139 | + 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
140 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id |
|
141 | + ]; |
|
142 | + } |
|
143 | + $timenav['prev'] = [ |
|
144 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id, |
|
145 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
146 | + ]; |
|
147 | + if ($year < date('Y')) { |
|
148 | + $timenav['next'] = [ |
|
149 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id, |
|
150 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
151 | + ]; |
|
152 | + } |
|
153 | + } // Get daily list |
|
154 | + elseif (empty($day)) { |
|
155 | + $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
156 | 156 | FROM " . planet_DB_prefix('article') . " |
157 | 157 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
158 | 158 | AND MONTH(FROM_UNIXTIME(art_time - $timeoffset)) = $month |
159 | 159 | " . $blog_criteria . ' |
160 | 160 | GROUP BY day |
161 | 161 | '; |
162 | - $result = $xoopsDB->query($sql); |
|
163 | - $days = []; |
|
164 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
165 | - $days[$myrow['day']]['count'] = $myrow['count']; |
|
166 | - } |
|
167 | - for ($i = 1; $i <= 31; ++$i) { |
|
168 | - if (!isset($days[$i])) { |
|
169 | - continue; |
|
170 | - } |
|
171 | - $days[$i] = [ |
|
172 | - 'title' => $days[$i]['count'], |
|
173 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
174 | - ]; |
|
175 | - } |
|
176 | - $calendar = planet_getCalendar($year, $month, $days); |
|
177 | - $month_next = $month + 1; |
|
178 | - $month_prev = $month - 1; |
|
179 | - $_year = $year; |
|
180 | - if ($month == 12) { |
|
181 | - $month_next = 1; |
|
182 | - $_year = $year + 1; |
|
183 | - } |
|
184 | - if ($month == 1) { |
|
185 | - $month_pre = 12; |
|
186 | - $_year = $year - 1; |
|
187 | - } |
|
188 | - $timenav['prev'] = [ |
|
189 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
190 | - 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
191 | - ]; |
|
192 | - if ($year < date('Y') || $month < date('n')) { |
|
193 | - $timenav['next'] = [ |
|
194 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id, |
|
195 | - 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
196 | - ]; |
|
197 | - } |
|
198 | - } |
|
162 | + $result = $xoopsDB->query($sql); |
|
163 | + $days = []; |
|
164 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
165 | + $days[$myrow['day']]['count'] = $myrow['count']; |
|
166 | + } |
|
167 | + for ($i = 1; $i <= 31; ++$i) { |
|
168 | + if (!isset($days[$i])) { |
|
169 | + continue; |
|
170 | + } |
|
171 | + $days[$i] = [ |
|
172 | + 'title' => $days[$i]['count'], |
|
173 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
174 | + ]; |
|
175 | + } |
|
176 | + $calendar = planet_getCalendar($year, $month, $days); |
|
177 | + $month_next = $month + 1; |
|
178 | + $month_prev = $month - 1; |
|
179 | + $_year = $year; |
|
180 | + if ($month == 12) { |
|
181 | + $month_next = 1; |
|
182 | + $_year = $year + 1; |
|
183 | + } |
|
184 | + if ($month == 1) { |
|
185 | + $month_pre = 12; |
|
186 | + $_year = $year - 1; |
|
187 | + } |
|
188 | + $timenav['prev'] = [ |
|
189 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
190 | + 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
191 | + ]; |
|
192 | + if ($year < date('Y') || $month < date('n')) { |
|
193 | + $timenav['next'] = [ |
|
194 | + 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id, |
|
195 | + 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
196 | + ]; |
|
197 | + } |
|
198 | + } |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $xoopsTpl->assign('dirname', $GLOBALS['moddirname']); |
@@ -222,66 +222,66 @@ discard block |
||
222 | 222 | */ |
223 | 223 | function planet_getCalendar($year = null, $month = null, $days = null) |
224 | 224 | { |
225 | - $year = empty($year) ? date('Y') : $year; |
|
226 | - $month = empty($month) ? date('n') : $month; |
|
227 | - $unixmonth = mktime(0, 0, 0, $month, 1, $year); |
|
225 | + $year = empty($year) ? date('Y') : $year; |
|
226 | + $month = empty($month) ? date('n') : $month; |
|
227 | + $unixmonth = mktime(0, 0, 0, $month, 1, $year); |
|
228 | 228 | |
229 | - ob_start(); |
|
230 | - echo '<table id="calendar">'; |
|
231 | - echo '<caption>'; |
|
232 | - printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
233 | - echo '</caption>'; |
|
229 | + ob_start(); |
|
230 | + echo '<table id="calendar">'; |
|
231 | + echo '<caption>'; |
|
232 | + printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
233 | + echo '</caption>'; |
|
234 | 234 | |
235 | - for ($i = 1; $i <= 7; ++$i) { |
|
236 | - 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>'; |
|
237 | - } |
|
235 | + for ($i = 1; $i <= 7; ++$i) { |
|
236 | + 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>'; |
|
237 | + } |
|
238 | 238 | |
239 | - echo '<tr>'; |
|
239 | + echo '<tr>'; |
|
240 | 240 | |
241 | - // See how much we should pad in the beginning |
|
242 | - $week_begins = 1; |
|
243 | - $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
244 | - if (0 != $pad) { |
|
245 | - echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
246 | - } |
|
241 | + // See how much we should pad in the beginning |
|
242 | + $week_begins = 1; |
|
243 | + $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
244 | + if (0 != $pad) { |
|
245 | + echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
246 | + } |
|
247 | 247 | |
248 | - $daysinmonth = (int)date('t', $unixmonth); |
|
249 | - for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
250 | - if (isset($newrow) && $newrow) { |
|
251 | - echo "\n\t</tr>\n\t<tr>\n\t\t"; |
|
252 | - } |
|
253 | - $newrow = false; |
|
248 | + $daysinmonth = (int)date('t', $unixmonth); |
|
249 | + for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
250 | + if (isset($newrow) && $newrow) { |
|
251 | + echo "\n\t</tr>\n\t<tr>\n\t\t"; |
|
252 | + } |
|
253 | + $newrow = false; |
|
254 | 254 | |
255 | - echo '<td>'; |
|
255 | + echo '<td>'; |
|
256 | 256 | |
257 | - if (!empty($days[$day]['url'])) { |
|
258 | - echo '<a href="' . $days[$day]['url'] . "\""; |
|
259 | - if (!empty($days[$day]['title'])) { |
|
260 | - echo "title=\"" . $days[$day]['title'] . "\""; |
|
261 | - } |
|
262 | - echo ">$day</a>"; |
|
263 | - } elseif (!empty($days[$day]['title'])) { |
|
264 | - echo "<acronym title=\"" . $days[$day]['title'] . "\">$day</acronym>"; |
|
265 | - } else { |
|
266 | - echo $day; |
|
267 | - } |
|
268 | - echo '</td>'; |
|
257 | + if (!empty($days[$day]['url'])) { |
|
258 | + echo '<a href="' . $days[$day]['url'] . "\""; |
|
259 | + if (!empty($days[$day]['title'])) { |
|
260 | + echo "title=\"" . $days[$day]['title'] . "\""; |
|
261 | + } |
|
262 | + echo ">$day</a>"; |
|
263 | + } elseif (!empty($days[$day]['title'])) { |
|
264 | + echo "<acronym title=\"" . $days[$day]['title'] . "\">$day</acronym>"; |
|
265 | + } else { |
|
266 | + echo $day; |
|
267 | + } |
|
268 | + echo '</td>'; |
|
269 | 269 | |
270 | - if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
271 | - $newrow = true; |
|
272 | - } |
|
273 | - } |
|
270 | + if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
271 | + $newrow = true; |
|
272 | + } |
|
273 | + } |
|
274 | 274 | |
275 | - $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
276 | - if ($pad != 0 && $pad != 7) { |
|
277 | - echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
278 | - } |
|
275 | + $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
276 | + if ($pad != 0 && $pad != 7) { |
|
277 | + echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
278 | + } |
|
279 | 279 | |
280 | - echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
|
281 | - $calendar = ob_get_contents(); |
|
282 | - ob_end_clean(); |
|
280 | + echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
|
281 | + $calendar = ob_get_contents(); |
|
282 | + ob_end_clean(); |
|
283 | 283 | |
284 | - return $calendar; |
|
284 | + return $calendar; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | // Used in get_calendar |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | */ |
292 | 292 | function planet_calendar_week_mod($num) |
293 | 293 | { |
294 | - $base = 7; |
|
294 | + $base = 7; |
|
295 | 295 | |
296 | - return ($num - $base * floor($num / $base)); |
|
296 | + return ($num - $base * floor($num / $base)); |
|
297 | 297 | } |
@@ -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 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
32 | 32 | $args['year'] = @$args_num[0]; |
@@ -45,26 +45,26 @@ discard block |
||
45 | 45 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
46 | 46 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
47 | 47 | |
48 | -$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name') . ' - ' . planet_constant('MD_ACHIVE'); |
|
48 | +$xoopsOption['xoops_pagetitle'] = $xoopsModule->getVar('name').' - '.planet_constant('MD_ACHIVE'); |
|
49 | 49 | $xoopsOption['template_main'] = PlanetUtility::planetGetTemplate('archive'); |
50 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
51 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
50 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
51 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
52 | 52 | |
53 | 53 | $year = empty($year) ? date('Y') : $year; |
54 | -if ($month < 1) { |
|
54 | +if ($month<1) { |
|
55 | 55 | $month = $day = 0; |
56 | 56 | $page['time'] = sprintf(planet_constant('MD_TIME_Y'), $year); |
57 | -} elseif ($day < 1) { |
|
57 | +} elseif ($day<1) { |
|
58 | 58 | $day = 0; |
59 | 59 | $page['time'] = sprintf(planet_constant('MD_TIME_YM'), $year, $month); |
60 | -} else { |
|
60 | +}else { |
|
61 | 61 | $page['time'] = sprintf(planet_constant('MD_TIME_YMD'), $year, $month, $day); |
62 | 62 | } |
63 | 63 | $time = ['year' => $year, 'month' => $month, 'day' => $day]; |
64 | 64 | if ($xoopsUser) { |
65 | - $timeoffset = ($xoopsUser->getVar('timezone_offset') - $xoopsConfig['server_TZ']) * 3600; |
|
66 | -} else { |
|
67 | - $timeoffset = ($xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']) * 3600; |
|
65 | + $timeoffset = ($xoopsUser->getVar('timezone_offset')-$xoopsConfig['server_TZ'])*3600; |
|
66 | +}else { |
|
67 | + $timeoffset = ($xoopsConfig['default_TZ']-$xoopsConfig['server_TZ'])*3600; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $criteria = new CriteriaCompo(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $articles = []; |
88 | 88 | $blogs_id = []; |
89 | 89 | foreach ($articles_obj as $id => $article) { |
90 | - $articles[] = [ |
|
90 | + $articles[] = [ |
|
91 | 91 | 'id' => $id, |
92 | 92 | 'blog' => ['id' => $article->getVar('blog_id'), 'title' => ''], |
93 | 93 | 'title' => $article->getVar('art_title'), |
@@ -98,20 +98,20 @@ discard block |
||
98 | 98 | $blogs_id[$article->getVar('blog_id')] = 1; |
99 | 99 | unset($_article); |
100 | 100 | } |
101 | -$criteria_blog = new Criteria('blog_id', '(' . implode(',', array_keys($blog_array)) . ')', 'IN'); |
|
101 | +$criteria_blog = new Criteria('blog_id', '('.implode(',', array_keys($blog_array)).')', 'IN'); |
|
102 | 102 | $blogs = $blogHandler->getList($criteria_blog); |
103 | 103 | foreach (array_keys($articles) as $key) { |
104 | 104 | $articles[$key]['blog']['title'] = $blogs[$articles[$key]['blog']['id']]; |
105 | 105 | } |
106 | -if ($blog_id > 0) { |
|
106 | +if ($blog_id>0) { |
|
107 | 107 | $page['blog'] = $blogs[$blog_id]; |
108 | 108 | } |
109 | 109 | |
110 | -if ($articles_count > $xoopsModuleConfig['articles_perpage']) { |
|
111 | - include XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
112 | - $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month=' . $month . '&day=' . $day . '&year=' . $year . '&blog=' . (int)$blog_id); |
|
110 | +if ($articles_count>$xoopsModuleConfig['articles_perpage']) { |
|
111 | + include XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
112 | + $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, 'start', 'month='.$month.'&day='.$day.'&year='.$year.'&blog='.(int) $blog_id); |
|
113 | 113 | $pagenav = $nav->renderNav(4); |
114 | -} else { |
|
114 | +}else { |
|
115 | 115 | $pagenav = ''; |
116 | 116 | } |
117 | 117 | |
@@ -120,43 +120,43 @@ discard block |
||
120 | 120 | $months = null; |
121 | 121 | if (empty($start)) { |
122 | 122 | if ($blog_id) { |
123 | - $blog_criteria = ' AND blog_id=' . $blog_id; |
|
124 | - } else { |
|
123 | + $blog_criteria = ' AND blog_id='.$blog_id; |
|
124 | + }else { |
|
125 | 125 | $blog_criteria = ''; |
126 | 126 | } |
127 | 127 | // Get monthly list |
128 | 128 | if (empty($month)) { |
129 | - $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
130 | - FROM " . planet_DB_prefix('article') . " |
|
129 | + $sql = "SELECT MONTH(FROM_UNIXTIME(art_time - $timeoffset)) AS mon, COUNT(DISTINCT art_id) AS count |
|
130 | + FROM ".planet_DB_prefix('article')." |
|
131 | 131 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
132 | - " . $blog_criteria . ' |
|
132 | + ".$blog_criteria.' |
|
133 | 133 | GROUP BY mon |
134 | 134 | '; |
135 | 135 | $result = $xoopsDB->query($sql); |
136 | 136 | $months = []; |
137 | 137 | while ($myrow = $xoopsDB->fetchArray($result)) { |
138 | 138 | $months[] = [ |
139 | - 'title' => planet_constant('MD_MONTH_' . (int)$myrow['mon']) . ' (' . (int)$myrow['count'] . ')', |
|
140 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $myrow['mon'] . '/b' . $blog_id |
|
139 | + 'title' => planet_constant('MD_MONTH_'.(int) $myrow['mon']).' ('.(int) $myrow['count'].')', |
|
140 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$year.'/'.$myrow['mon'].'/b'.$blog_id |
|
141 | 141 | ]; |
142 | 142 | } |
143 | 143 | $timenav['prev'] = [ |
144 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year - 1) . '/b' . $blog_id, |
|
145 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year - 1) |
|
144 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.($year-1).'/b'.$blog_id, |
|
145 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year-1) |
|
146 | 146 | ]; |
147 | - if ($year < date('Y')) { |
|
147 | + if ($year<date('Y')) { |
|
148 | 148 | $timenav['next'] = [ |
149 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . ($year + 1) . '/b' . $blog_id, |
|
150 | - 'title' => sprintf(planet_constant('MD_TIME_Y'), $year + 1) |
|
149 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.($year+1).'/b'.$blog_id, |
|
150 | + 'title' => sprintf(planet_constant('MD_TIME_Y'), $year+1) |
|
151 | 151 | ]; |
152 | 152 | } |
153 | 153 | } // Get daily list |
154 | 154 | elseif (empty($day)) { |
155 | - $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
156 | - FROM " . planet_DB_prefix('article') . " |
|
155 | + $sql = "SELECT DAY(FROM_UNIXTIME(art_time - $timeoffset)) AS day, COUNT(DISTINCT a.art_id) AS count |
|
156 | + FROM ".planet_DB_prefix('article')." |
|
157 | 157 | WHERE YEAR(FROM_UNIXTIME(art_time - $timeoffset)) = $year |
158 | 158 | AND MONTH(FROM_UNIXTIME(art_time - $timeoffset)) = $month |
159 | - " . $blog_criteria . ' |
|
159 | + ".$blog_criteria.' |
|
160 | 160 | GROUP BY day |
161 | 161 | '; |
162 | 162 | $result = $xoopsDB->query($sql); |
@@ -164,35 +164,35 @@ discard block |
||
164 | 164 | while ($myrow = $xoopsDB->fetchArray($result)) { |
165 | 165 | $days[$myrow['day']]['count'] = $myrow['count']; |
166 | 166 | } |
167 | - for ($i = 1; $i <= 31; ++$i) { |
|
167 | + for ($i = 1; $i<=31; ++$i) { |
|
168 | 168 | if (!isset($days[$i])) { |
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | $days[$i] = [ |
172 | 172 | 'title' => $days[$i]['count'], |
173 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $year . '/' . $month . '/' . $i . '/b' . $blog_id |
|
173 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$year.'/'.$month.'/'.$i.'/b'.$blog_id |
|
174 | 174 | ]; |
175 | 175 | } |
176 | 176 | $calendar = planet_getCalendar($year, $month, $days); |
177 | - $month_next = $month + 1; |
|
178 | - $month_prev = $month - 1; |
|
177 | + $month_next = $month+1; |
|
178 | + $month_prev = $month-1; |
|
179 | 179 | $_year = $year; |
180 | 180 | if ($month == 12) { |
181 | 181 | $month_next = 1; |
182 | - $_year = $year + 1; |
|
182 | + $_year = $year+1; |
|
183 | 183 | } |
184 | 184 | if ($month == 1) { |
185 | 185 | $month_pre = 12; |
186 | - $_year = $year - 1; |
|
186 | + $_year = $year-1; |
|
187 | 187 | } |
188 | 188 | $timenav['prev'] = [ |
189 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_prev . '/b' . $blog_id, |
|
190 | - 'title' => planet_constant('MD_MONTH_' . $month_prev) |
|
189 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$_year.'/'.$month_prev.'/b'.$blog_id, |
|
190 | + 'title' => planet_constant('MD_MONTH_'.$month_prev) |
|
191 | 191 | ]; |
192 | - if ($year < date('Y') || $month < date('n')) { |
|
192 | + if ($year<date('Y') || $month<date('n')) { |
|
193 | 193 | $timenav['next'] = [ |
194 | - 'url' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.archive.php' . URL_DELIMITER . '' . $_year . '/' . $month_next . '/b' . $blog_id, |
|
195 | - 'title' => planet_constant('MD_MONTH_' . $month_next) |
|
194 | + 'url' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.archive.php'.URL_DELIMITER.''.$_year.'/'.$month_next.'/b'.$blog_id, |
|
195 | + 'title' => planet_constant('MD_MONTH_'.$month_next) |
|
196 | 196 | ]; |
197 | 197 | } |
198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $xoopsTpl->assign('timenav', $timenav); |
213 | 213 | $xoopsTpl->assign('pagenav', $pagenav); |
214 | 214 | |
215 | -require_once __DIR__ . '/footer.php'; |
|
215 | +require_once __DIR__.'/footer.php'; |
|
216 | 216 | |
217 | 217 | /** |
218 | 218 | * @param null $year |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | ob_start(); |
230 | 230 | echo '<table id="calendar">'; |
231 | 231 | echo '<caption>'; |
232 | - printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_' . $month)); |
|
232 | + printf(planet_constant('MD_TIME_YM'), $year, planet_constant('MD_MONTH_'.$month)); |
|
233 | 233 | echo '</caption>'; |
234 | 234 | |
235 | - for ($i = 1; $i <= 7; ++$i) { |
|
236 | - 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>'; |
|
235 | + for ($i = 1; $i<=7; ++$i) { |
|
236 | + 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>'; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | echo '<tr>'; |
240 | 240 | |
241 | 241 | // See how much we should pad in the beginning |
242 | 242 | $week_begins = 1; |
243 | - $pad = planet_calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
243 | + $pad = planet_calendar_week_mod(date('w', $unixmonth)-$week_begins); |
|
244 | 244 | if (0 != $pad) { |
245 | - echo "\n\t\t" . '<td colspan="' . $pad . '"> </td>'; |
|
245 | + echo "\n\t\t".'<td colspan="'.$pad.'"> </td>'; |
|
246 | 246 | } |
247 | 247 | |
248 | - $daysinmonth = (int)date('t', $unixmonth); |
|
249 | - for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
248 | + $daysinmonth = (int) date('t', $unixmonth); |
|
249 | + for ($day = 1; $day<=$daysinmonth; ++$day) { |
|
250 | 250 | if (isset($newrow) && $newrow) { |
251 | 251 | echo "\n\t</tr>\n\t<tr>\n\t\t"; |
252 | 252 | } |
@@ -255,26 +255,26 @@ discard block |
||
255 | 255 | echo '<td>'; |
256 | 256 | |
257 | 257 | if (!empty($days[$day]['url'])) { |
258 | - echo '<a href="' . $days[$day]['url'] . "\""; |
|
258 | + echo '<a href="'.$days[$day]['url']."\""; |
|
259 | 259 | if (!empty($days[$day]['title'])) { |
260 | - echo "title=\"" . $days[$day]['title'] . "\""; |
|
260 | + echo "title=\"".$days[$day]['title']."\""; |
|
261 | 261 | } |
262 | 262 | echo ">$day</a>"; |
263 | 263 | } elseif (!empty($days[$day]['title'])) { |
264 | - echo "<acronym title=\"" . $days[$day]['title'] . "\">$day</acronym>"; |
|
265 | - } else { |
|
264 | + echo "<acronym title=\"".$days[$day]['title']."\">$day</acronym>"; |
|
265 | + }else { |
|
266 | 266 | echo $day; |
267 | 267 | } |
268 | 268 | echo '</td>'; |
269 | 269 | |
270 | - if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins)) { |
|
270 | + if (6 == planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins)) { |
|
271 | 271 | $newrow = true; |
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | - $pad = 7 - planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year)) - $week_begins); |
|
275 | + $pad = 7-planet_calendar_week_mod(date('w', mktime(0, 0, 0, $month, $day, $year))-$week_begins); |
|
276 | 276 | if ($pad != 0 && $pad != 7) { |
277 | - echo "\n\t\t" . '<td class="pad" colspan="' . $pad . '"> </td>'; |
|
277 | + echo "\n\t\t".'<td class="pad" colspan="'.$pad.'"> </td>'; |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | echo "\n\t</tr>\n\t</tbody>\n\t</table>"; |
@@ -293,5 +293,5 @@ discard block |
||
293 | 293 | { |
294 | 294 | $base = 7; |
295 | 295 | |
296 | - return ($num - $base * floor($num / $base)); |
|
296 | + return ($num-$base*floor($num/$base)); |
|
297 | 297 | } |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | include __DIR__ . '/header.php'; |
18 | 18 | |
19 | 19 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
20 | - $args['article'] = @$args_num[0]; |
|
21 | - $args['op'] = @$args_str[0]; |
|
20 | + $args['article'] = @$args_num[0]; |
|
21 | + $args['op'] = @$args_str[0]; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $article_id = Request::getInt('article', Request::getInt('article', @$args['article'], 'POST'), 'GET');//(int)(empty($_GET['article']) ? (empty($_POST['article']) ? @$args['article'] : $_POST['article']) : $_GET['article']); |
@@ -27,33 +27,33 @@ discard block |
||
27 | 27 | $op = strtolower(trim($op)); |
28 | 28 | |
29 | 29 | if (empty($article_id)) { |
30 | - if (empty(Request::getUrl('HTTP_REFERER', '', 'SERVER'))) { |
|
31 | - //$_SERVER['HTTP_REFERER'])) |
|
30 | + if (empty(Request::getUrl('HTTP_REFERER', '', 'SERVER'))) { |
|
31 | + //$_SERVER['HTTP_REFERER'])) |
|
32 | 32 | |
33 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
34 | - xoops_error(_NOPERM); |
|
35 | - $xoopsOption['output_type'] = 'plain'; |
|
36 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
37 | - exit(); |
|
38 | - } else { |
|
39 | - $ref_parser = parse_url(Request::getUrl('HTTP_REFERER', '', 'SERVER')); //$_SERVER['HTTP_REFERER']); |
|
40 | - $uri_parser = parse_url(Request::getUrl('REQUEST_URI', '', 'SERVER'));// $_SERVER['REQUEST_URI']); |
|
41 | - if ((!empty($ref_parser['host']) && !empty($uri_parser['host']) && $uri_parser['host'] != $ref_parser['host']) |
|
42 | - || ($ref_parser['path'] != $uri_parser['path'])) { |
|
43 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
44 | - include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
45 | - xoops_confirm([], 'javascript: window.close();', sprintf(planet_constant('MD_TRANSFER_DONE'), ''), _CLOSE, Request::getUrl('HTTP_REFERER', '', 'SERVER')); |
|
46 | - $xoopsOption['output_type'] = 'plain'; |
|
47 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
48 | - exit(); |
|
49 | - } else { |
|
50 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
51 | - xoops_error(_NOPERM); |
|
52 | - $xoopsOption['output_type'] = 'plain'; |
|
53 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
54 | - exit(); |
|
55 | - } |
|
56 | - } |
|
33 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
34 | + xoops_error(_NOPERM); |
|
35 | + $xoopsOption['output_type'] = 'plain'; |
|
36 | + include XOOPS_ROOT_PATH . '/footer.php'; |
|
37 | + exit(); |
|
38 | + } else { |
|
39 | + $ref_parser = parse_url(Request::getUrl('HTTP_REFERER', '', 'SERVER')); //$_SERVER['HTTP_REFERER']); |
|
40 | + $uri_parser = parse_url(Request::getUrl('REQUEST_URI', '', 'SERVER'));// $_SERVER['REQUEST_URI']); |
|
41 | + if ((!empty($ref_parser['host']) && !empty($uri_parser['host']) && $uri_parser['host'] != $ref_parser['host']) |
|
42 | + || ($ref_parser['path'] != $uri_parser['path'])) { |
|
43 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
44 | + include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
45 | + xoops_confirm([], 'javascript: window.close();', sprintf(planet_constant('MD_TRANSFER_DONE'), ''), _CLOSE, Request::getUrl('HTTP_REFERER', '', 'SERVER')); |
|
46 | + $xoopsOption['output_type'] = 'plain'; |
|
47 | + include XOOPS_ROOT_PATH . '/footer.php'; |
|
48 | + exit(); |
|
49 | + } else { |
|
50 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
51 | + xoops_error(_NOPERM); |
|
52 | + $xoopsOption['output_type'] = 'plain'; |
|
53 | + include XOOPS_ROOT_PATH . '/footer.php'; |
|
54 | + exit(); |
|
55 | + } |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
@@ -61,37 +61,37 @@ discard block |
||
61 | 61 | |
62 | 62 | // Display option form |
63 | 63 | if (empty($op)) { |
64 | - $module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">"; |
|
65 | - include XOOPS_ROOT_PATH . '/Frameworks/transfer/option.transfer.php'; |
|
66 | - exit(); |
|
64 | + $module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">"; |
|
65 | + include XOOPS_ROOT_PATH . '/Frameworks/transfer/option.transfer.php'; |
|
66 | + exit(); |
|
67 | 67 | } else { |
68 | - $data = []; |
|
69 | - $data['id'] = $article_id; |
|
70 | - $data['title'] = $article_obj->getVar('art_title'); |
|
71 | - $data['time'] = $article_obj->getTime('l'); |
|
72 | - $data['image'] = ''; |
|
73 | - $data['source'] = $article_obj->getVar('art_link'); |
|
74 | - $data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
75 | - $data['author'] = $article_obj->getVar('art_author'); |
|
68 | + $data = []; |
|
69 | + $data['id'] = $article_id; |
|
70 | + $data['title'] = $article_obj->getVar('art_title'); |
|
71 | + $data['time'] = $article_obj->getTime('l'); |
|
72 | + $data['image'] = ''; |
|
73 | + $data['source'] = $article_obj->getVar('art_link'); |
|
74 | + $data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
75 | + $data['author'] = $article_obj->getVar('art_author'); |
|
76 | 76 | |
77 | - switch ($op) { |
|
77 | + switch ($op) { |
|
78 | 78 | |
79 | - // Use title |
|
80 | - case 'bookmark': |
|
81 | - break; |
|
79 | + // Use title |
|
80 | + case 'bookmark': |
|
81 | + break; |
|
82 | 82 | |
83 | - case 'print': |
|
84 | - case 'pdf': |
|
85 | - ${"{$op}_data"} =& $data; |
|
86 | - ${"{$op}_data"}['date'] = $pdf_data['time']; |
|
87 | - ${"{$op}_data"}['content'] = $article_obj->getVar('art_content'); |
|
88 | - break; |
|
83 | + case 'print': |
|
84 | + case 'pdf': |
|
85 | + ${"{$op}_data"} =& $data; |
|
86 | + ${"{$op}_data"}['date'] = $pdf_data['time']; |
|
87 | + ${"{$op}_data"}['content'] = $article_obj->getVar('art_content'); |
|
88 | + break; |
|
89 | 89 | |
90 | - case 'newbb': |
|
91 | - default: |
|
92 | - $data['content'] = $article_obj->getSummary(); |
|
93 | - break; |
|
94 | - } |
|
95 | - include XOOPS_ROOT_PATH . '/Frameworks/transfer/action.transfer.php'; |
|
96 | - exit(); |
|
90 | + case 'newbb': |
|
91 | + default: |
|
92 | + $data['content'] = $article_obj->getSummary(); |
|
93 | + break; |
|
94 | + } |
|
95 | + include XOOPS_ROOT_PATH . '/Frameworks/transfer/action.transfer.php'; |
|
96 | + exit(); |
|
97 | 97 | } |
@@ -14,43 +14,43 @@ discard block |
||
14 | 14 | |
15 | 15 | use Xmf\Request; |
16 | 16 | |
17 | -include __DIR__ . '/header.php'; |
|
17 | +include __DIR__.'/header.php'; |
|
18 | 18 | |
19 | 19 | if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
20 | 20 | $args['article'] = @$args_num[0]; |
21 | 21 | $args['op'] = @$args_str[0]; |
22 | 22 | } |
23 | 23 | |
24 | -$article_id = Request::getInt('article', Request::getInt('article', @$args['article'], 'POST'), 'GET');//(int)(empty($_GET['article']) ? (empty($_POST['article']) ? @$args['article'] : $_POST['article']) : $_GET['article']); |
|
24 | +$article_id = Request::getInt('article', Request::getInt('article', @$args['article'], 'POST'), 'GET'); //(int)(empty($_GET['article']) ? (empty($_POST['article']) ? @$args['article'] : $_POST['article']) : $_GET['article']); |
|
25 | 25 | |
26 | -$op = Request::getString('op', Request::getString('op', @$args['op'], 'POST'), 'GET');//empty($_GET['op']) ? (empty($_POST['op']) ? @$args['op'] : $_POST['op']) : $_GET['op']; |
|
26 | +$op = Request::getString('op', Request::getString('op', @$args['op'], 'POST'), 'GET'); //empty($_GET['op']) ? (empty($_POST['op']) ? @$args['op'] : $_POST['op']) : $_GET['op']; |
|
27 | 27 | $op = strtolower(trim($op)); |
28 | 28 | |
29 | 29 | if (empty($article_id)) { |
30 | 30 | if (empty(Request::getUrl('HTTP_REFERER', '', 'SERVER'))) { |
31 | 31 | //$_SERVER['HTTP_REFERER'])) |
32 | 32 | |
33 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
33 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
34 | 34 | xoops_error(_NOPERM); |
35 | 35 | $xoopsOption['output_type'] = 'plain'; |
36 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
36 | + include XOOPS_ROOT_PATH.'/footer.php'; |
|
37 | 37 | exit(); |
38 | - } else { |
|
38 | + }else { |
|
39 | 39 | $ref_parser = parse_url(Request::getUrl('HTTP_REFERER', '', 'SERVER')); //$_SERVER['HTTP_REFERER']); |
40 | - $uri_parser = parse_url(Request::getUrl('REQUEST_URI', '', 'SERVER'));// $_SERVER['REQUEST_URI']); |
|
40 | + $uri_parser = parse_url(Request::getUrl('REQUEST_URI', '', 'SERVER')); // $_SERVER['REQUEST_URI']); |
|
41 | 41 | if ((!empty($ref_parser['host']) && !empty($uri_parser['host']) && $uri_parser['host'] != $ref_parser['host']) |
42 | 42 | || ($ref_parser['path'] != $uri_parser['path'])) { |
43 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
44 | - include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
43 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
44 | + include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
45 | 45 | xoops_confirm([], 'javascript: window.close();', sprintf(planet_constant('MD_TRANSFER_DONE'), ''), _CLOSE, Request::getUrl('HTTP_REFERER', '', 'SERVER')); |
46 | 46 | $xoopsOption['output_type'] = 'plain'; |
47 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
47 | + include XOOPS_ROOT_PATH.'/footer.php'; |
|
48 | 48 | exit(); |
49 | - } else { |
|
50 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
49 | + }else { |
|
50 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
51 | 51 | xoops_error(_NOPERM); |
52 | 52 | $xoopsOption['output_type'] = 'plain'; |
53 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
53 | + include XOOPS_ROOT_PATH.'/footer.php'; |
|
54 | 54 | exit(); |
55 | 55 | } |
56 | 56 | } |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | // Display option form |
63 | 63 | if (empty($op)) { |
64 | 64 | $module_variables .= "<input type=\"hidden\" name=\"article\" id=\"article\" value=\"{$article_id}\">"; |
65 | - include XOOPS_ROOT_PATH . '/Frameworks/transfer/option.transfer.php'; |
|
65 | + include XOOPS_ROOT_PATH.'/Frameworks/transfer/option.transfer.php'; |
|
66 | 66 | exit(); |
67 | -} else { |
|
67 | +}else { |
|
68 | 68 | $data = []; |
69 | 69 | $data['id'] = $article_id; |
70 | 70 | $data['title'] = $article_obj->getVar('art_title'); |
71 | 71 | $data['time'] = $article_obj->getTime('l'); |
72 | 72 | $data['image'] = ''; |
73 | 73 | $data['source'] = $article_obj->getVar('art_link'); |
74 | - $data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id'); |
|
74 | + $data['url'] = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_obj->getVar('art_id'); |
|
75 | 75 | $data['author'] = $article_obj->getVar('art_author'); |
76 | 76 | |
77 | 77 | switch ($op) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | case 'print': |
84 | 84 | case 'pdf': |
85 | - ${"{$op}_data"} =& $data; |
|
85 | + ${"{$op}_data"} = & $data; |
|
86 | 86 | ${"{$op}_data"}['date'] = $pdf_data['time']; |
87 | 87 | ${"{$op}_data"}['content'] = $article_obj->getVar('art_content'); |
88 | 88 | break; |
@@ -92,6 +92,6 @@ discard block |
||
92 | 92 | $data['content'] = $article_obj->getSummary(); |
93 | 93 | break; |
94 | 94 | } |
95 | - include XOOPS_ROOT_PATH . '/Frameworks/transfer/action.transfer.php'; |
|
95 | + include XOOPS_ROOT_PATH.'/Frameworks/transfer/action.transfer.php'; |
|
96 | 96 | exit(); |
97 | 97 | } |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | $blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
34 | 34 | |
35 | 35 | if (empty($xoopsModuleConfig['newblog_submit']) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) { |
36 | - redirect_header('index.php', 2, _NOPERM); |
|
36 | + redirect_header('index.php', 2, _NOPERM); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if ($op === 'save' && !empty(Request::getString('fetch', '', 'POST'))) {//!empty($_POST['fetch'])) { |
40 | - $op = 'edit'; |
|
40 | + $op = 'edit'; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if ($op === 'save' && !$GLOBALS['xoopsSecurity']->check()) { |
44 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
44 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
45 | 45 | } |
46 | 46 | include XOOPS_ROOT_PATH . '/header.php'; |
47 | 47 | include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
@@ -50,110 +50,110 @@ discard block |
||
50 | 50 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
51 | 51 | |
52 | 52 | switch ($op) { |
53 | - /* save a single blog */ |
|
54 | - case 'save': |
|
55 | - |
|
56 | - if ($blog_id) { |
|
57 | - $blog_obj = $blogHandler->get($blog_id); |
|
58 | - if ($xoopsUser->isAdmin()) { |
|
59 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
60 | - } |
|
61 | - } else { |
|
62 | - if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
|
63 | - ) { |
|
64 | - redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
|
65 | - } |
|
66 | - |
|
67 | - $blog_obj = $blogHandler->create(); |
|
68 | - $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
69 | - |
|
70 | - switch ($xoopsModuleConfig['newblog_submit']) { |
|
71 | - case 2: |
|
72 | - if (!is_object($xoopsUser)) { |
|
73 | - $status = 0; |
|
74 | - } else { |
|
75 | - $status = 1; |
|
76 | - } |
|
77 | - break; |
|
78 | - case 0: |
|
79 | - case 3: |
|
80 | - $status = 1; |
|
81 | - break; |
|
82 | - case 1: |
|
83 | - default: |
|
84 | - if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
|
85 | - $status = 0; |
|
86 | - } else { |
|
87 | - $status = 1; |
|
88 | - } |
|
89 | - break; |
|
90 | - } |
|
91 | - |
|
92 | - $blog_obj->setVar('blog_status', $status); |
|
93 | - } |
|
94 | - |
|
95 | - $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
96 | - $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
97 | - $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
98 | - $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
99 | - $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
100 | - $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
101 | - $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
102 | - $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
103 | - if ($blog_obj->isNew()) { |
|
104 | - $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
105 | - } |
|
106 | - |
|
107 | - if (!$blogHandler->insert($blog_obj)) { |
|
108 | - } elseif (0 !== count(Request::getArray('categories', [], 'POST'))) { |
|
109 | - $blog_id = $blog_obj->getVar('blog_id'); |
|
110 | - if (in_array(0, $_POST['categories'])) { |
|
111 | - $_POST['categories'] = []; |
|
112 | - } |
|
113 | - $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
114 | - } |
|
115 | - $message = planet_constant('MD_DBUPDATED'); |
|
116 | - redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
117 | - |
|
118 | - /* edit a single blog */ |
|
119 | - // no break |
|
120 | - case 'edit': |
|
121 | - default: |
|
122 | - if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
123 | - $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
124 | - $blog_obj->setVar('blog_id', $blog_id); |
|
125 | - } else { |
|
126 | - $blog_obj = $blogHandler->get($blog_id); |
|
127 | - } |
|
128 | - $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
129 | - if (in_array('-1', $categories)) { |
|
130 | - $categories = []; |
|
131 | - } |
|
132 | - if (empty($categories) && $blog_id > 0) { |
|
133 | - $crit = new Criteria('bc.blog_id', $blog_id); |
|
134 | - $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
135 | - } |
|
136 | - if (empty($categories)) { |
|
137 | - $categories = [0 => _NONE]; |
|
138 | - } |
|
139 | - |
|
140 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
141 | - echo '<br>'; |
|
142 | - if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
143 | - $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
144 | - $blogs_obj = $blogHandler->getList($criteria); |
|
145 | - if (count($blogs_obj) > 0) { |
|
146 | - echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
147 | - foreach (array_keys($blogs_obj) as $bid) { |
|
148 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
149 | - } |
|
150 | - echo '</div>'; |
|
151 | - unset($blogs_obj, $criteria); |
|
152 | - } |
|
153 | - } |
|
154 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
155 | - echo '</fieldset>'; |
|
156 | - break; |
|
53 | + /* save a single blog */ |
|
54 | + case 'save': |
|
55 | + |
|
56 | + if ($blog_id) { |
|
57 | + $blog_obj = $blogHandler->get($blog_id); |
|
58 | + if ($xoopsUser->isAdmin()) { |
|
59 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
60 | + } |
|
61 | + } else { |
|
62 | + if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
|
63 | + ) { |
|
64 | + redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
|
65 | + } |
|
66 | + |
|
67 | + $blog_obj = $blogHandler->create(); |
|
68 | + $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
69 | + |
|
70 | + switch ($xoopsModuleConfig['newblog_submit']) { |
|
71 | + case 2: |
|
72 | + if (!is_object($xoopsUser)) { |
|
73 | + $status = 0; |
|
74 | + } else { |
|
75 | + $status = 1; |
|
76 | + } |
|
77 | + break; |
|
78 | + case 0: |
|
79 | + case 3: |
|
80 | + $status = 1; |
|
81 | + break; |
|
82 | + case 1: |
|
83 | + default: |
|
84 | + if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
|
85 | + $status = 0; |
|
86 | + } else { |
|
87 | + $status = 1; |
|
88 | + } |
|
89 | + break; |
|
90 | + } |
|
91 | + |
|
92 | + $blog_obj->setVar('blog_status', $status); |
|
93 | + } |
|
94 | + |
|
95 | + $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
96 | + $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
97 | + $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
98 | + $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
99 | + $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
100 | + $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
101 | + $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
102 | + $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
103 | + if ($blog_obj->isNew()) { |
|
104 | + $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
|
105 | + } |
|
106 | + |
|
107 | + if (!$blogHandler->insert($blog_obj)) { |
|
108 | + } elseif (0 !== count(Request::getArray('categories', [], 'POST'))) { |
|
109 | + $blog_id = $blog_obj->getVar('blog_id'); |
|
110 | + if (in_array(0, $_POST['categories'])) { |
|
111 | + $_POST['categories'] = []; |
|
112 | + } |
|
113 | + $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
114 | + } |
|
115 | + $message = planet_constant('MD_DBUPDATED'); |
|
116 | + redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
117 | + |
|
118 | + /* edit a single blog */ |
|
119 | + // no break |
|
120 | + case 'edit': |
|
121 | + default: |
|
122 | + if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
123 | + $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
124 | + $blog_obj->setVar('blog_id', $blog_id); |
|
125 | + } else { |
|
126 | + $blog_obj = $blogHandler->get($blog_id); |
|
127 | + } |
|
128 | + $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
129 | + if (in_array('-1', $categories)) { |
|
130 | + $categories = []; |
|
131 | + } |
|
132 | + if (empty($categories) && $blog_id > 0) { |
|
133 | + $crit = new Criteria('bc.blog_id', $blog_id); |
|
134 | + $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
135 | + } |
|
136 | + if (empty($categories)) { |
|
137 | + $categories = [0 => _NONE]; |
|
138 | + } |
|
139 | + |
|
140 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
141 | + echo '<br>'; |
|
142 | + if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
143 | + $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
144 | + $blogs_obj = $blogHandler->getList($criteria); |
|
145 | + if (count($blogs_obj) > 0) { |
|
146 | + echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
147 | + foreach (array_keys($blogs_obj) as $bid) { |
|
148 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
149 | + } |
|
150 | + echo '</div>'; |
|
151 | + unset($blogs_obj, $criteria); |
|
152 | + } |
|
153 | + } |
|
154 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
155 | + echo '</fieldset>'; |
|
156 | + break; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | use Xmf\Request; |
28 | 28 | |
29 | -include __DIR__ . '/header.php'; |
|
29 | +include __DIR__.'/header.php'; |
|
30 | 30 | |
31 | -$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
32 | -$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
33 | -$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id; |
|
31 | +$op = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : ''); |
|
32 | +$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0); |
|
33 | +$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id; |
|
34 | 34 | |
35 | 35 | if (empty($xoopsModuleConfig['newblog_submit']) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) { |
36 | 36 | redirect_header('index.php', 2, _NOPERM); |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if ($op === 'save' && !$GLOBALS['xoopsSecurity']->check()) { |
44 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed'); |
|
44 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID').': security check failed'); |
|
45 | 45 | } |
46 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
47 | -include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'; |
|
46 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
47 | +include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'; |
|
48 | 48 | |
49 | 49 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
50 | 50 | $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']); |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | if ($blog_id) { |
57 | 57 | $blog_obj = $blogHandler->get($blog_id); |
58 | 58 | if ($xoopsUser->isAdmin()) { |
59 | - $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']); |
|
59 | + $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); // @$_POST['blog_status']); |
|
60 | 60 | } |
61 | - } else { |
|
61 | + }else { |
|
62 | 62 | if ($blog_exists = $blogHandler->getCount(new Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST'))))) //$_POST['blog_feed'])))) |
63 | 63 | ) { |
64 | 64 | redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS')); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | case 2: |
72 | 72 | if (!is_object($xoopsUser)) { |
73 | 73 | $status = 0; |
74 | - } else { |
|
74 | + }else { |
|
75 | 75 | $status = 1; |
76 | 76 | } |
77 | 77 | break; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | default: |
84 | 84 | if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) { |
85 | 85 | $status = 0; |
86 | - } else { |
|
86 | + }else { |
|
87 | 87 | $status = 1; |
88 | 88 | } |
89 | 89 | break; |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | $blog_obj->setVar('blog_status', $status); |
93 | 93 | } |
94 | 94 | |
95 | - $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']); |
|
96 | - $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']); |
|
97 | - $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']); |
|
98 | - $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']); |
|
99 | - $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']); |
|
100 | - $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']); |
|
101 | - $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']); |
|
102 | - $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']); |
|
95 | + $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']); |
|
96 | + $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']); |
|
97 | + $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']); |
|
98 | + $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST')); //$_POST['blog_feed']); |
|
99 | + $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']); |
|
100 | + $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']); |
|
101 | + $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']); |
|
102 | + $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']); |
|
103 | 103 | if ($blog_obj->isNew()) { |
104 | 104 | $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true)); |
105 | 105 | } |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | if (in_array(0, $_POST['categories'])) { |
111 | 111 | $_POST['categories'] = []; |
112 | 112 | } |
113 | - $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']); |
|
113 | + $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST')); //$_POST['categories']); |
|
114 | 114 | } |
115 | 115 | $message = planet_constant('MD_DBUPDATED'); |
116 | - redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
116 | + redirect_header('index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
117 | 117 | |
118 | 118 | /* edit a single blog */ |
119 | 119 | // no break |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | if (!empty(Request::getString('fetch', '', 'POST'))) { |
123 | 123 | $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
124 | 124 | $blog_obj->setVar('blog_id', $blog_id); |
125 | - } else { |
|
125 | + }else { |
|
126 | 126 | $blog_obj = $blogHandler->get($blog_id); |
127 | 127 | } |
128 | - $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
128 | + $categories = Request::getArray('categories', [], 'POST'); //isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
129 | 129 | if (in_array('-1', $categories)) { |
130 | 130 | $categories = []; |
131 | 131 | } |
132 | - if (empty($categories) && $blog_id > 0) { |
|
132 | + if (empty($categories) && $blog_id>0) { |
|
133 | 133 | $crit = new Criteria('bc.blog_id', $blog_id); |
134 | 134 | $categories = array_keys($categoryHandler->getByBlog($crit)); |
135 | 135 | } |
@@ -137,23 +137,23 @@ discard block |
||
137 | 137 | $categories = [0 => _NONE]; |
138 | 138 | } |
139 | 139 | |
140 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
140 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>'; |
|
141 | 141 | echo '<br>'; |
142 | 142 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
143 | 143 | $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
144 | 144 | $blogs_obj = $blogHandler->getList($criteria); |
145 | - if (count($blogs_obj) > 0) { |
|
146 | - echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
145 | + if (count($blogs_obj)>0) { |
|
146 | + echo "<div class=\"errorMsg\">".planet_constant('MD_BLOGEXISTS'); |
|
147 | 147 | foreach (array_keys($blogs_obj) as $bid) { |
148 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
148 | + echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>'; |
|
149 | 149 | } |
150 | 150 | echo '</div>'; |
151 | 151 | unset($blogs_obj, $criteria); |
152 | 152 | } |
153 | 153 | } |
154 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
154 | + include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php'; |
|
155 | 155 | echo '</fieldset>'; |
156 | 156 | break; |
157 | 157 | } |
158 | 158 | |
159 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
159 | +include XOOPS_ROOT_PATH.'/footer.php'; |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | include __DIR__ . '/include/vars.php'; |
31 | 31 | |
32 | 32 | $modversion = [ |
33 | - 'name' => planet_constant('MI_NAME'), |
|
34 | - 'version' => 2.10, |
|
35 | - 'module_status' => 'Final', |
|
36 | - 'release_date' => '2016/08/01', |
|
37 | - 'description' => planet_constant('MI_DESC'), |
|
38 | - 'author' => 'D.J. (phppp)', |
|
39 | - 'credits' => 'XOOPS Project', |
|
40 | - 'image' => 'assets/images/logoModule.png', |
|
41 | - 'dirname' => $GLOBALS['moddirname'], |
|
42 | - 'help' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/readme.html' |
|
33 | + 'name' => planet_constant('MI_NAME'), |
|
34 | + 'version' => 2.10, |
|
35 | + 'module_status' => 'Final', |
|
36 | + 'release_date' => '2016/08/01', |
|
37 | + 'description' => planet_constant('MI_DESC'), |
|
38 | + 'author' => 'D.J. (phppp)', |
|
39 | + 'credits' => 'XOOPS Project', |
|
40 | + 'image' => 'assets/images/logoModule.png', |
|
41 | + 'dirname' => $GLOBALS['moddirname'], |
|
42 | + 'help' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/readme.html' |
|
43 | 43 | ]; |
44 | 44 | $modversion['help'] = 'page=help'; |
45 | 45 | $modversion['license'] = 'GNU see LICENSE'; |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | // database tables |
63 | 63 | $modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; |
64 | 64 | $modversion['tables'] = [ |
65 | - $GLOBALS['MOD_DB_PREFIX'] . '_category', |
|
66 | - $GLOBALS['MOD_DB_PREFIX'] . '_article', |
|
67 | - $GLOBALS['MOD_DB_PREFIX'] . '_blog', |
|
68 | - $GLOBALS['MOD_DB_PREFIX'] . '_blogcat', |
|
69 | - $GLOBALS['MOD_DB_PREFIX'] . '_bookmark', |
|
70 | - $GLOBALS['MOD_DB_PREFIX'] . '_rate' |
|
65 | + $GLOBALS['MOD_DB_PREFIX'] . '_category', |
|
66 | + $GLOBALS['MOD_DB_PREFIX'] . '_article', |
|
67 | + $GLOBALS['MOD_DB_PREFIX'] . '_blog', |
|
68 | + $GLOBALS['MOD_DB_PREFIX'] . '_blogcat', |
|
69 | + $GLOBALS['MOD_DB_PREFIX'] . '_bookmark', |
|
70 | + $GLOBALS['MOD_DB_PREFIX'] . '_rate' |
|
71 | 71 | ]; |
72 | 72 | |
73 | 73 | // Admin things |
@@ -149,162 +149,162 @@ discard block |
||
149 | 149 | // Configs |
150 | 150 | // Config items |
151 | 151 | $modversion['config'][] = [ |
152 | - 'name' => 'do_debug', |
|
153 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG', |
|
154 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG_DESC', |
|
155 | - 'formtype' => 'yesno', |
|
156 | - 'valuetype' => 'int', |
|
157 | - 'default' => 1 |
|
152 | + 'name' => 'do_debug', |
|
153 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG', |
|
154 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG_DESC', |
|
155 | + 'formtype' => 'yesno', |
|
156 | + 'valuetype' => 'int', |
|
157 | + 'default' => 1 |
|
158 | 158 | ]; |
159 | 159 | |
160 | 160 | $modversion['config'][] = [ |
161 | - 'name' => 'do_urw', |
|
162 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE', |
|
163 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE_DESC', |
|
164 | - 'formtype' => 'yesno', |
|
165 | - 'valuetype' => 'int', |
|
166 | - 'default' => in_array(php_sapi_name(), ['apache', 'apache2handler']) |
|
161 | + 'name' => 'do_urw', |
|
162 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE', |
|
163 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE_DESC', |
|
164 | + 'formtype' => 'yesno', |
|
165 | + 'valuetype' => 'int', |
|
166 | + 'default' => in_array(php_sapi_name(), ['apache', 'apache2handler']) |
|
167 | 167 | ]; |
168 | 168 | |
169 | 169 | $modversion['config'][] = [ |
170 | - 'name' => 'theme_set', |
|
171 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET', |
|
172 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET_DESC', |
|
173 | - 'formtype' => 'select', |
|
174 | - 'valuetype' => 'text', |
|
175 | - 'options' => [_NONE => '0'], |
|
176 | - 'default' => '' |
|
170 | + 'name' => 'theme_set', |
|
171 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET', |
|
172 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET_DESC', |
|
173 | + 'formtype' => 'select', |
|
174 | + 'valuetype' => 'text', |
|
175 | + 'options' => [_NONE => '0'], |
|
176 | + 'default' => '' |
|
177 | 177 | ]; |
178 | 178 | |
179 | 179 | $modversion['config'][] = [ |
180 | - 'name' => 'timeformat', |
|
181 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT', |
|
182 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_DESC', |
|
183 | - 'formtype' => 'select', |
|
184 | - 'valuetype' => 'text', |
|
185 | - 'options' => [ |
|
186 | - _DATESTRING => 'l', |
|
187 | - _MEDIUMDATESTRING => 'm', |
|
188 | - _SHORTDATESTRING => 's', |
|
189 | - $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_CUSTOM' => 'c' |
|
190 | - ], |
|
191 | - 'default' => 'c' |
|
180 | + 'name' => 'timeformat', |
|
181 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT', |
|
182 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_DESC', |
|
183 | + 'formtype' => 'select', |
|
184 | + 'valuetype' => 'text', |
|
185 | + 'options' => [ |
|
186 | + _DATESTRING => 'l', |
|
187 | + _MEDIUMDATESTRING => 'm', |
|
188 | + _SHORTDATESTRING => 's', |
|
189 | + $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_CUSTOM' => 'c' |
|
190 | + ], |
|
191 | + 'default' => 'c' |
|
192 | 192 | ]; |
193 | 193 | |
194 | 194 | $modversion['config'][] = [ |
195 | - 'name' => 'articles_perpage', |
|
196 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE', |
|
197 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE_DESC', |
|
198 | - 'formtype' => 'textbox', |
|
199 | - 'valuetype' => 'int', |
|
200 | - 'default' => 10 |
|
195 | + 'name' => 'articles_perpage', |
|
196 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE', |
|
197 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE_DESC', |
|
198 | + 'formtype' => 'textbox', |
|
199 | + 'valuetype' => 'int', |
|
200 | + 'default' => 10 |
|
201 | 201 | ]; |
202 | 202 | |
203 | 203 | $modversion['config'][] = [ |
204 | - 'name' => 'list_perpage', |
|
205 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE', |
|
206 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE_DESC', |
|
207 | - 'formtype' => 'textbox', |
|
208 | - 'valuetype' => 'int', |
|
209 | - 'default' => 20 |
|
204 | + 'name' => 'list_perpage', |
|
205 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE', |
|
206 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE_DESC', |
|
207 | + 'formtype' => 'textbox', |
|
208 | + 'valuetype' => 'int', |
|
209 | + 'default' => 20 |
|
210 | 210 | ]; |
211 | 211 | |
212 | 212 | $modversion['config'][] = [ |
213 | - 'name' => 'blogs_perupdate', |
|
214 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE', |
|
215 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE_DESC', |
|
216 | - 'formtype' => 'textbox', |
|
217 | - 'valuetype' => 'int', |
|
218 | - 'default' => 10 |
|
213 | + 'name' => 'blogs_perupdate', |
|
214 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE', |
|
215 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE_DESC', |
|
216 | + 'formtype' => 'textbox', |
|
217 | + 'valuetype' => 'int', |
|
218 | + 'default' => 10 |
|
219 | 219 | ]; |
220 | 220 | |
221 | 221 | $modversion['config'][] = [ |
222 | - 'name' => 'article_expire', |
|
223 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE', |
|
224 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE_DESC', |
|
225 | - 'formtype' => 'textbox', |
|
226 | - 'valuetype' => 'int', |
|
227 | - 'default' => 30 |
|
222 | + 'name' => 'article_expire', |
|
223 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE', |
|
224 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE_DESC', |
|
225 | + 'formtype' => 'textbox', |
|
226 | + 'valuetype' => 'int', |
|
227 | + 'default' => 30 |
|
228 | 228 | ]; |
229 | 229 | |
230 | 230 | $modversion['config'][] = [ |
231 | - 'name' => 'display_summary', |
|
232 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY', |
|
233 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY_DESC', |
|
234 | - 'formtype' => 'textbox', |
|
235 | - 'valuetype' => 'int', |
|
236 | - 'default' => 0 |
|
231 | + 'name' => 'display_summary', |
|
232 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY', |
|
233 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY_DESC', |
|
234 | + 'formtype' => 'textbox', |
|
235 | + 'valuetype' => 'int', |
|
236 | + 'default' => 0 |
|
237 | 237 | ]; |
238 | 238 | |
239 | 239 | $modversion['config'][] = [ |
240 | - 'name' => 'do_sibling', |
|
241 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING', |
|
242 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING_DESC', |
|
243 | - 'formtype' => 'yesno', |
|
244 | - 'valuetype' => 'int', |
|
245 | - 'default' => 1 |
|
240 | + 'name' => 'do_sibling', |
|
241 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING', |
|
242 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING_DESC', |
|
243 | + 'formtype' => 'yesno', |
|
244 | + 'valuetype' => 'int', |
|
245 | + 'default' => 1 |
|
246 | 246 | ]; |
247 | 247 | |
248 | 248 | $modversion['config'][] = [ |
249 | - 'name' => 'pings', |
|
250 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING', |
|
251 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING_DESC', |
|
252 | - 'formtype' => 'textarea', |
|
253 | - 'valuetype' => 'text', |
|
254 | - 'default' => '' |
|
249 | + 'name' => 'pings', |
|
250 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING', |
|
251 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING_DESC', |
|
252 | + 'formtype' => 'textarea', |
|
253 | + 'valuetype' => 'text', |
|
254 | + 'default' => '' |
|
255 | 255 | ]; |
256 | 256 | |
257 | 257 | $modversion['config'][] = [ |
258 | - 'name' => 'trackback_option', |
|
259 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION', |
|
260 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION_DESC', |
|
261 | - 'formtype' => 'select', |
|
262 | - 'valuetype' => 'int', |
|
263 | - 'default' => 0, |
|
264 | - 'options' => [planet_constant('MI_MODERATION') => 0, _ALL => 1, _NONE => 2] |
|
258 | + 'name' => 'trackback_option', |
|
259 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION', |
|
260 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION_DESC', |
|
261 | + 'formtype' => 'select', |
|
262 | + 'valuetype' => 'int', |
|
263 | + 'default' => 0, |
|
264 | + 'options' => [planet_constant('MI_MODERATION') => 0, _ALL => 1, _NONE => 2] |
|
265 | 265 | ]; |
266 | 266 | |
267 | 267 | $modversion['config'][] = [ |
268 | - 'name' => 'copyright', |
|
269 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT', |
|
270 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT_DESC', |
|
271 | - 'formtype' => 'textbox', |
|
272 | - 'valuetype' => 'text', |
|
273 | - 'default' => 'Copyright© %s & ' . $xoopsConfig['sitename'] |
|
268 | + 'name' => 'copyright', |
|
269 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT', |
|
270 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT_DESC', |
|
271 | + 'formtype' => 'textbox', |
|
272 | + 'valuetype' => 'text', |
|
273 | + 'default' => 'Copyright© %s & ' . $xoopsConfig['sitename'] |
|
274 | 274 | ]; |
275 | 275 | |
276 | 276 | $modversion['config'][] = [ |
277 | - 'name' => 'newblog_submit', |
|
278 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT', |
|
279 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT_DESC', |
|
280 | - 'formtype' => 'select', |
|
281 | - 'valuetype' => 'int', |
|
282 | - 'default' => 2, |
|
283 | - 'options' => [ |
|
284 | - _NONE => 0, |
|
285 | - planet_constant('MI_MODERATION') => 1, |
|
286 | - planet_constant('MI_MEMBER') => 2, |
|
287 | - _ALL => 3 |
|
288 | - ] |
|
289 | - // 0 - Only admin; 1 - all but need approval; 2 - members auto approved; 3 - all |
|
277 | + 'name' => 'newblog_submit', |
|
278 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT', |
|
279 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT_DESC', |
|
280 | + 'formtype' => 'select', |
|
281 | + 'valuetype' => 'int', |
|
282 | + 'default' => 2, |
|
283 | + 'options' => [ |
|
284 | + _NONE => 0, |
|
285 | + planet_constant('MI_MODERATION') => 1, |
|
286 | + planet_constant('MI_MEMBER') => 2, |
|
287 | + _ALL => 3 |
|
288 | + ] |
|
289 | + // 0 - Only admin; 1 - all but need approval; 2 - members auto approved; 3 - all |
|
290 | 290 | ]; |
291 | 291 | |
292 | 292 | $modversion['config'][] = [ |
293 | - 'name' => 'anonymous_rate', |
|
294 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE', |
|
295 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE_DESC', |
|
296 | - 'formtype' => 'yesno', |
|
297 | - 'valuetype' => 'int', |
|
298 | - 'default' => 0 |
|
293 | + 'name' => 'anonymous_rate', |
|
294 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE', |
|
295 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE_DESC', |
|
296 | + 'formtype' => 'yesno', |
|
297 | + 'valuetype' => 'int', |
|
298 | + 'default' => 0 |
|
299 | 299 | ]; |
300 | 300 | |
301 | 301 | $modversion['config'][] = [ |
302 | - 'name' => 'do_pseudocron', |
|
303 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON', |
|
304 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON_DESC', |
|
305 | - 'formtype' => 'yesno', |
|
306 | - 'valuetype' => 'int', |
|
307 | - 'default' => 1 |
|
302 | + 'name' => 'do_pseudocron', |
|
303 | + 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON', |
|
304 | + 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON_DESC', |
|
305 | + 'formtype' => 'yesno', |
|
306 | + 'valuetype' => 'int', |
|
307 | + 'default' => 1 |
|
308 | 308 | ]; |
309 | 309 | |
310 | 310 | // Notification |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
29 | 29 | |
30 | -include __DIR__ . '/include/vars.php'; |
|
30 | +include __DIR__.'/include/vars.php'; |
|
31 | 31 | |
32 | -$modversion = [ |
|
32 | +$modversion = [ |
|
33 | 33 | 'name' => planet_constant('MI_NAME'), |
34 | 34 | 'version' => 2.10, |
35 | 35 | 'module_status' => 'Final', |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | 'credits' => 'XOOPS Project', |
40 | 40 | 'image' => 'assets/images/logoModule.png', |
41 | 41 | 'dirname' => $GLOBALS['moddirname'], |
42 | - 'help' => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/readme.html' |
|
42 | + 'help' => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/readme.html' |
|
43 | 43 | ]; |
44 | 44 | $modversion['help'] = 'page=help'; |
45 | 45 | $modversion['license'] = 'GNU see LICENSE'; |
46 | -$modversion['license_file'] = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/gpl.txt'; |
|
46 | +$modversion['license_file'] = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/gpl.txt'; |
|
47 | 47 | $modversion['author_word'] = ''; |
48 | 48 | $modversion['module_team'] = ''; |
49 | 49 | |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | // database tables |
63 | 63 | $modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; |
64 | 64 | $modversion['tables'] = [ |
65 | - $GLOBALS['MOD_DB_PREFIX'] . '_category', |
|
66 | - $GLOBALS['MOD_DB_PREFIX'] . '_article', |
|
67 | - $GLOBALS['MOD_DB_PREFIX'] . '_blog', |
|
68 | - $GLOBALS['MOD_DB_PREFIX'] . '_blogcat', |
|
69 | - $GLOBALS['MOD_DB_PREFIX'] . '_bookmark', |
|
70 | - $GLOBALS['MOD_DB_PREFIX'] . '_rate' |
|
65 | + $GLOBALS['MOD_DB_PREFIX'].'_category', |
|
66 | + $GLOBALS['MOD_DB_PREFIX'].'_article', |
|
67 | + $GLOBALS['MOD_DB_PREFIX'].'_blog', |
|
68 | + $GLOBALS['MOD_DB_PREFIX'].'_blogcat', |
|
69 | + $GLOBALS['MOD_DB_PREFIX'].'_bookmark', |
|
70 | + $GLOBALS['MOD_DB_PREFIX'].'_rate' |
|
71 | 71 | ]; |
72 | 72 | |
73 | 73 | // Admin things |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * Templates |
95 | 95 | */ |
96 | -$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'] . '_index.tpl', 'description' => '']; |
|
97 | -$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'] . '_article.tpl', 'description' => '']; |
|
98 | -$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'] . '_archive.tpl', 'description' => '']; |
|
99 | -$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'] . '_blogs.tpl', 'description' => '']; |
|
100 | -$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'] . '_search.tpl', 'description' => '']; |
|
96 | +$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'].'_index.tpl', 'description' => '']; |
|
97 | +$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'].'_article.tpl', 'description' => '']; |
|
98 | +$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'].'_archive.tpl', 'description' => '']; |
|
99 | +$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'].'_blogs.tpl', 'description' => '']; |
|
100 | +$modversion['templates'][] = ['file' => $GLOBALS['VAR_PREFIX'].'_search.tpl', 'description' => '']; |
|
101 | 101 | |
102 | 102 | //module css |
103 | 103 | $modversion['css'] = 'templates/style.css'; |
@@ -109,31 +109,31 @@ discard block |
||
109 | 109 | $modversion['blocks'][$i]['file'] = 'block.php'; |
110 | 110 | $modversion['blocks'][$i]['name'] = planet_constant('MI_ARTICLE'); |
111 | 111 | $modversion['blocks'][$i]['description'] = planet_constant('MI_ARTICLE_DESC'); |
112 | -$modversion['blocks'][$i]['show_func'] = $GLOBALS['VAR_PREFIX'] . '_article_show'; |
|
112 | +$modversion['blocks'][$i]['show_func'] = $GLOBALS['VAR_PREFIX'].'_article_show'; |
|
113 | 113 | $modversion['blocks'][$i]['options'] = 'time|10|0|0'; // type|MaxItems|TitleLength|SummaryLength |
114 | -$modversion['blocks'][$i]['edit_func'] = $GLOBALS['VAR_PREFIX'] . '_article_edit'; |
|
115 | -$modversion['blocks'][$i]['template'] = $GLOBALS['VAR_PREFIX'] . '_block_article.tpl'; |
|
114 | +$modversion['blocks'][$i]['edit_func'] = $GLOBALS['VAR_PREFIX'].'_article_edit'; |
|
115 | +$modversion['blocks'][$i]['template'] = $GLOBALS['VAR_PREFIX'].'_block_article.tpl'; |
|
116 | 116 | |
117 | 117 | ++$i; |
118 | 118 | $modversion['blocks'][$i]['file'] = 'block.php'; |
119 | 119 | $modversion['blocks'][$i]['name'] = planet_constant('MI_CATEGORY'); |
120 | 120 | $modversion['blocks'][$i]['description'] = planet_constant('MI_CATEGORY_DESC'); |
121 | -$modversion['blocks'][$i]['show_func'] = $GLOBALS['VAR_PREFIX'] . '_category_show'; |
|
122 | -$modversion['blocks'][$i]['template'] = $GLOBALS['VAR_PREFIX'] . '_block_category.tpl'; |
|
121 | +$modversion['blocks'][$i]['show_func'] = $GLOBALS['VAR_PREFIX'].'_category_show'; |
|
122 | +$modversion['blocks'][$i]['template'] = $GLOBALS['VAR_PREFIX'].'_block_category.tpl'; |
|
123 | 123 | |
124 | 124 | ++$i; |
125 | 125 | $modversion['blocks'][$i]['file'] = 'block.php'; |
126 | 126 | $modversion['blocks'][$i]['name'] = planet_constant('MI_BLOG'); |
127 | 127 | $modversion['blocks'][$i]['description'] = planet_constant('MI_BLOG_DESC'); |
128 | -$modversion['blocks'][$i]['show_func'] = $GLOBALS['VAR_PREFIX'] . '_blog_show'; |
|
128 | +$modversion['blocks'][$i]['show_func'] = $GLOBALS['VAR_PREFIX'].'_blog_show'; |
|
129 | 129 | $modversion['blocks'][$i]['options'] = 'feature|10|0|1'; // type|MaxItems|TitleLength|ShowDesc |
130 | -$modversion['blocks'][$i]['edit_func'] = $GLOBALS['VAR_PREFIX'] . '_blog_edit'; |
|
131 | -$modversion['blocks'][$i]['template'] = $GLOBALS['VAR_PREFIX'] . '_block_blog.tpl'; |
|
130 | +$modversion['blocks'][$i]['edit_func'] = $GLOBALS['VAR_PREFIX'].'_blog_edit'; |
|
131 | +$modversion['blocks'][$i]['template'] = $GLOBALS['VAR_PREFIX'].'_block_blog.tpl'; |
|
132 | 132 | |
133 | 133 | // Search |
134 | 134 | $modversion['hasSearch'] = 1; |
135 | 135 | $modversion['search']['file'] = 'include/search.inc.php'; |
136 | -$modversion['search']['func'] = $GLOBALS['VAR_PREFIX'] . '_search'; |
|
136 | +$modversion['search']['func'] = $GLOBALS['VAR_PREFIX'].'_search'; |
|
137 | 137 | |
138 | 138 | // Comments |
139 | 139 | $modversion['hasComments'] = 1; |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | |
144 | 144 | // Comment callback functions |
145 | 145 | $modversion['comments']['callbackFile'] = 'include/comment.inc.php'; |
146 | -$modversion['comments']['callback']['approve'] = $GLOBALS['VAR_PREFIX'] . '_com_approve'; |
|
147 | -$modversion['comments']['callback']['update'] = $GLOBALS['VAR_PREFIX'] . '_com_update'; |
|
146 | +$modversion['comments']['callback']['approve'] = $GLOBALS['VAR_PREFIX'].'_com_approve'; |
|
147 | +$modversion['comments']['callback']['update'] = $GLOBALS['VAR_PREFIX'].'_com_update'; |
|
148 | 148 | |
149 | 149 | // Configs |
150 | 150 | // Config items |
151 | 151 | $modversion['config'][] = [ |
152 | 152 | 'name' => 'do_debug', |
153 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG', |
|
154 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DODEBUG_DESC', |
|
153 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_DODEBUG', |
|
154 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_DODEBUG_DESC', |
|
155 | 155 | 'formtype' => 'yesno', |
156 | 156 | 'valuetype' => 'int', |
157 | 157 | 'default' => 1 |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | |
160 | 160 | $modversion['config'][] = [ |
161 | 161 | 'name' => 'do_urw', |
162 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE', |
|
163 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOURLREWRITE_DESC', |
|
162 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_DOURLREWRITE', |
|
163 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_DOURLREWRITE_DESC', |
|
164 | 164 | 'formtype' => 'yesno', |
165 | 165 | 'valuetype' => 'int', |
166 | 166 | 'default' => in_array(php_sapi_name(), ['apache', 'apache2handler']) |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | |
169 | 169 | $modversion['config'][] = [ |
170 | 170 | 'name' => 'theme_set', |
171 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET', |
|
172 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_THEMESET_DESC', |
|
171 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_THEMESET', |
|
172 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_THEMESET_DESC', |
|
173 | 173 | 'formtype' => 'select', |
174 | 174 | 'valuetype' => 'text', |
175 | 175 | 'options' => [_NONE => '0'], |
@@ -178,23 +178,23 @@ discard block |
||
178 | 178 | |
179 | 179 | $modversion['config'][] = [ |
180 | 180 | 'name' => 'timeformat', |
181 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT', |
|
182 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_DESC', |
|
181 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_TIMEFORMAT', |
|
182 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_TIMEFORMAT_DESC', |
|
183 | 183 | 'formtype' => 'select', |
184 | 184 | 'valuetype' => 'text', |
185 | 185 | 'options' => [ |
186 | 186 | _DATESTRING => 'l', |
187 | 187 | _MEDIUMDATESTRING => 'm', |
188 | 188 | _SHORTDATESTRING => 's', |
189 | - $GLOBALS['VAR_PREFIXU'] . '_MI_TIMEFORMAT_CUSTOM' => 'c' |
|
189 | + $GLOBALS['VAR_PREFIXU'].'_MI_TIMEFORMAT_CUSTOM' => 'c' |
|
190 | 190 | ], |
191 | 191 | 'default' => 'c' |
192 | 192 | ]; |
193 | 193 | |
194 | 194 | $modversion['config'][] = [ |
195 | 195 | 'name' => 'articles_perpage', |
196 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE', |
|
197 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLESPERPAGE_DESC', |
|
196 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_ARTICLESPERPAGE', |
|
197 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_ARTICLESPERPAGE_DESC', |
|
198 | 198 | 'formtype' => 'textbox', |
199 | 199 | 'valuetype' => 'int', |
200 | 200 | 'default' => 10 |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | $modversion['config'][] = [ |
204 | 204 | 'name' => 'list_perpage', |
205 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE', |
|
206 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_LISTPERPAGE_DESC', |
|
205 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_LISTPERPAGE', |
|
206 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_LISTPERPAGE_DESC', |
|
207 | 207 | 'formtype' => 'textbox', |
208 | 208 | 'valuetype' => 'int', |
209 | 209 | 'default' => 20 |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | |
212 | 212 | $modversion['config'][] = [ |
213 | 213 | 'name' => 'blogs_perupdate', |
214 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE', |
|
215 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_BLOGSPERUPDATE_DESC', |
|
214 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_BLOGSPERUPDATE', |
|
215 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_BLOGSPERUPDATE_DESC', |
|
216 | 216 | 'formtype' => 'textbox', |
217 | 217 | 'valuetype' => 'int', |
218 | 218 | 'default' => 10 |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | |
221 | 221 | $modversion['config'][] = [ |
222 | 222 | 'name' => 'article_expire', |
223 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE', |
|
224 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ARTICLE_EXPIRE_DESC', |
|
223 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_ARTICLE_EXPIRE', |
|
224 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_ARTICLE_EXPIRE_DESC', |
|
225 | 225 | 'formtype' => 'textbox', |
226 | 226 | 'valuetype' => 'int', |
227 | 227 | 'default' => 30 |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | |
230 | 230 | $modversion['config'][] = [ |
231 | 231 | 'name' => 'display_summary', |
232 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY', |
|
233 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DISPLAY_SUMMARY_DESC', |
|
232 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_DISPLAY_SUMMARY', |
|
233 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_DISPLAY_SUMMARY_DESC', |
|
234 | 234 | 'formtype' => 'textbox', |
235 | 235 | 'valuetype' => 'int', |
236 | 236 | 'default' => 0 |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | |
239 | 239 | $modversion['config'][] = [ |
240 | 240 | 'name' => 'do_sibling', |
241 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING', |
|
242 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_DOSIBLING_DESC', |
|
241 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_DOSIBLING', |
|
242 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_DOSIBLING_DESC', |
|
243 | 243 | 'formtype' => 'yesno', |
244 | 244 | 'valuetype' => 'int', |
245 | 245 | 'default' => 1 |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | |
248 | 248 | $modversion['config'][] = [ |
249 | 249 | 'name' => 'pings', |
250 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING', |
|
251 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PING_DESC', |
|
250 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_PING', |
|
251 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_PING_DESC', |
|
252 | 252 | 'formtype' => 'textarea', |
253 | 253 | 'valuetype' => 'text', |
254 | 254 | 'default' => '' |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | |
257 | 257 | $modversion['config'][] = [ |
258 | 258 | 'name' => 'trackback_option', |
259 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION', |
|
260 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_TRACKBACK_OPTION_DESC', |
|
259 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_TRACKBACK_OPTION', |
|
260 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_TRACKBACK_OPTION_DESC', |
|
261 | 261 | 'formtype' => 'select', |
262 | 262 | 'valuetype' => 'int', |
263 | 263 | 'default' => 0, |
@@ -266,17 +266,17 @@ discard block |
||
266 | 266 | |
267 | 267 | $modversion['config'][] = [ |
268 | 268 | 'name' => 'copyright', |
269 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT', |
|
270 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_COPYRIGHT_DESC', |
|
269 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_COPYRIGHT', |
|
270 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_COPYRIGHT_DESC', |
|
271 | 271 | 'formtype' => 'textbox', |
272 | 272 | 'valuetype' => 'text', |
273 | - 'default' => 'Copyright© %s & ' . $xoopsConfig['sitename'] |
|
273 | + 'default' => 'Copyright© %s & '.$xoopsConfig['sitename'] |
|
274 | 274 | ]; |
275 | 275 | |
276 | 276 | $modversion['config'][] = [ |
277 | 277 | 'name' => 'newblog_submit', |
278 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT', |
|
279 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_NEWBLOG_SUBMIT_DESC', |
|
278 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_NEWBLOG_SUBMIT', |
|
279 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_NEWBLOG_SUBMIT_DESC', |
|
280 | 280 | 'formtype' => 'select', |
281 | 281 | 'valuetype' => 'int', |
282 | 282 | 'default' => 2, |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | |
292 | 292 | $modversion['config'][] = [ |
293 | 293 | 'name' => 'anonymous_rate', |
294 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE', |
|
295 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_ANONYMOUSRATE_DESC', |
|
294 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_ANONYMOUSRATE', |
|
295 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_ANONYMOUSRATE_DESC', |
|
296 | 296 | 'formtype' => 'yesno', |
297 | 297 | 'valuetype' => 'int', |
298 | 298 | 'default' => 0 |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | |
301 | 301 | $modversion['config'][] = [ |
302 | 302 | 'name' => 'do_pseudocron', |
303 | - 'title' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON', |
|
304 | - 'description' => $GLOBALS['VAR_PREFIXU'] . '_MI_PSEUDOCRON_DESC', |
|
303 | + 'title' => $GLOBALS['VAR_PREFIXU'].'_MI_PSEUDOCRON', |
|
304 | + 'description' => $GLOBALS['VAR_PREFIXU'].'_MI_PSEUDOCRON_DESC', |
|
305 | 305 | 'formtype' => 'yesno', |
306 | 306 | 'valuetype' => 'int', |
307 | 307 | 'default' => 1 |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | $modversion['hasNotification'] = 1; |
313 | 313 | $modversion['notification']['lookup_file'] = 'include/notification.inc.php'; |
314 | -$modversion['notification']['lookup_func'] = $GLOBALS['VAR_PREFIX'] . '_notify_iteminfo'; |
|
314 | +$modversion['notification']['lookup_func'] = $GLOBALS['VAR_PREFIX'].'_notify_iteminfo'; |
|
315 | 315 | |
316 | 316 | $i = 0; |
317 | 317 | ++$i; |
@@ -38,159 +38,159 @@ |
||
38 | 38 | $charset = trim(Request::getString('charset', '', 'POST'));//trim($_POST['charset']); |
39 | 39 | |
40 | 40 | if (empty($xoopsModuleConfig['trackback_option'])) { |
41 | - PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed'); |
|
41 | + PlanetUtility::planetRespondToTrackback(1, 'Trackback is closed'); |
|
42 | 42 | } |
43 | 43 | if (!strlen($title . $url . $blog_name)) { |
44 | - PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
44 | + PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID')); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | if (!empty($article_id) && !empty($url)) { |
48 | - $trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); |
|
49 | - $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
|
50 | - $criteria->add(new Criteria('tb_url', $url)); |
|
51 | - if ($trackbackHandler->getCount($criteria) > 0) { |
|
52 | - PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.'); |
|
53 | - } |
|
48 | + $trackbackHandler = xoops_getModuleHandler('trackback', $GLOBALS['moddirname']); |
|
49 | + $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
|
50 | + $criteria->add(new Criteria('tb_url', $url)); |
|
51 | + if ($trackbackHandler->getCount($criteria) > 0) { |
|
52 | + PlanetUtility::planetRespondToTrackback(1, 'We already have a ping from that URI for this article.'); |
|
53 | + } |
|
54 | 54 | |
55 | - $charset = empty($charset) ? 'utf-8' : $charset; |
|
56 | - $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); |
|
57 | - $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); |
|
58 | - $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); |
|
59 | - $tb_status = (int)$xoopsModuleConfig['trackback_option']; |
|
55 | + $charset = empty($charset) ? 'utf-8' : $charset; |
|
56 | + $title = XoopsLocal::convert_encoding($title, _CHARSET, $charset); |
|
57 | + $excerpt = XoopsLocal::convert_encoding($excerpt, _CHARSET, $charset); |
|
58 | + $blog_name = XoopsLocal::convert_encoding($blog_name, _CHARSET, $charset); |
|
59 | + $tb_status = (int)$xoopsModuleConfig['trackback_option']; |
|
60 | 60 | |
61 | - $com_pid = 0; |
|
62 | - $com_itemid = $article_id; |
|
63 | - $com_rootid = 0; |
|
64 | - $com_title = $title; |
|
65 | - $com_text = $excerpt; |
|
66 | - $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; |
|
67 | - if (!empty($url)) { |
|
68 | - $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; |
|
69 | - } else { |
|
70 | - $com_text .= $blog_name; |
|
71 | - } |
|
72 | - $com_modid = $xoopsModule->getVar('mid'); |
|
61 | + $com_pid = 0; |
|
62 | + $com_itemid = $article_id; |
|
63 | + $com_rootid = 0; |
|
64 | + $com_title = $title; |
|
65 | + $com_text = $excerpt; |
|
66 | + $com_text .= "\n\n[TRACKBACK]" . _POSTEDBY . ': '; |
|
67 | + if (!empty($url)) { |
|
68 | + $com_text .= '[url=' . $url . ']' . $blog_name . '[/url]'; |
|
69 | + } else { |
|
70 | + $com_text .= $blog_name; |
|
71 | + } |
|
72 | + $com_modid = $xoopsModule->getVar('mid'); |
|
73 | 73 | |
74 | - $commentHandler = xoops_getHandler('comment'); |
|
75 | - $comment = $commentHandler->create(); |
|
76 | - $comment->setVar('com_created', time()); |
|
77 | - $comment->setVar('com_pid', $com_pid); |
|
78 | - $comment->setVar('com_itemid', $com_itemid); |
|
79 | - $comment->setVar('com_rootid', $com_rootid); |
|
80 | - $comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR')); |
|
81 | - switch ($tb_status) { |
|
82 | - case 2: |
|
83 | - $comment->setVar('com_status', 2); |
|
84 | - $call_approvefunc = true; |
|
85 | - $call_updatefunc = true; |
|
86 | - $notify_event = 'comment'; |
|
87 | - break; |
|
88 | - case 1: |
|
89 | - default: |
|
90 | - $comment->setVar('com_status', 1); |
|
91 | - $notify_event = 'comment_submit'; |
|
92 | - break; |
|
93 | - } |
|
94 | - $comment->setVar('com_uid', 0); |
|
95 | - $com_title = xoops_trim($com_title); |
|
96 | - $com_title = empty($com_title) ? _NOTITLE : $com_title; |
|
97 | - $comment->setVar('com_title', $com_title); |
|
98 | - $comment->setVar('com_text', $com_text); |
|
99 | - $comment->setVar('dohtml', 0); |
|
100 | - $comment->setVar('dosmiley', 0); |
|
101 | - $comment->setVar('doxcode', 1); |
|
102 | - $comment->setVar('doimage', 0); |
|
103 | - $comment->setVar('dobr', 1); |
|
104 | - $comment->setVar('com_icon', ''); |
|
105 | - $comment->setVar('com_modified', time()); |
|
106 | - $comment->setVar('com_modid', $com_modid); |
|
107 | - if (false != $commentHandler->insert($comment)) { |
|
108 | - $newcid = $comment->getVar('com_id'); |
|
74 | + $commentHandler = xoops_getHandler('comment'); |
|
75 | + $comment = $commentHandler->create(); |
|
76 | + $comment->setVar('com_created', time()); |
|
77 | + $comment->setVar('com_pid', $com_pid); |
|
78 | + $comment->setVar('com_itemid', $com_itemid); |
|
79 | + $comment->setVar('com_rootid', $com_rootid); |
|
80 | + $comment->setVar('com_ip', xoops_getenv('REMOTE_ADDR')); |
|
81 | + switch ($tb_status) { |
|
82 | + case 2: |
|
83 | + $comment->setVar('com_status', 2); |
|
84 | + $call_approvefunc = true; |
|
85 | + $call_updatefunc = true; |
|
86 | + $notify_event = 'comment'; |
|
87 | + break; |
|
88 | + case 1: |
|
89 | + default: |
|
90 | + $comment->setVar('com_status', 1); |
|
91 | + $notify_event = 'comment_submit'; |
|
92 | + break; |
|
93 | + } |
|
94 | + $comment->setVar('com_uid', 0); |
|
95 | + $com_title = xoops_trim($com_title); |
|
96 | + $com_title = empty($com_title) ? _NOTITLE : $com_title; |
|
97 | + $comment->setVar('com_title', $com_title); |
|
98 | + $comment->setVar('com_text', $com_text); |
|
99 | + $comment->setVar('dohtml', 0); |
|
100 | + $comment->setVar('dosmiley', 0); |
|
101 | + $comment->setVar('doxcode', 1); |
|
102 | + $comment->setVar('doimage', 0); |
|
103 | + $comment->setVar('dobr', 1); |
|
104 | + $comment->setVar('com_icon', ''); |
|
105 | + $comment->setVar('com_modified', time()); |
|
106 | + $comment->setVar('com_modid', $com_modid); |
|
107 | + if (false != $commentHandler->insert($comment)) { |
|
108 | + $newcid = $comment->getVar('com_id'); |
|
109 | 109 | |
110 | - // set own id as root id |
|
111 | - $com_rootid = $newcid; |
|
112 | - if (!$commentHandler->updateByField($comment, 'com_rootid', $com_rootid)) { |
|
113 | - $commentHandler->delete($comment); |
|
114 | - PlanetUtility::planetRespondToTrackback(1, xoops_error()); |
|
115 | - } |
|
110 | + // set own id as root id |
|
111 | + $com_rootid = $newcid; |
|
112 | + if (!$commentHandler->updateByField($comment, 'com_rootid', $com_rootid)) { |
|
113 | + $commentHandler->delete($comment); |
|
114 | + PlanetUtility::planetRespondToTrackback(1, xoops_error()); |
|
115 | + } |
|
116 | 116 | |
117 | - // call custom approve function if any |
|
118 | - if (false != $call_approvefunc && isset($comment_config['callback']['approve']) |
|
119 | - && trim($comment_config['callback']['approve']) != '') { |
|
120 | - $skip = false; |
|
121 | - if (!function_exists($comment_config['callback']['approve'])) { |
|
122 | - if (isset($comment_config['callbackFile'])) { |
|
123 | - $callbackfile = trim($comment_config['callbackFile']); |
|
124 | - if ($callbackfile != '' |
|
125 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
126 | - require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
127 | - } |
|
128 | - if (!function_exists($comment_config['callback']['approve'])) { |
|
129 | - $skip = true; |
|
130 | - } |
|
131 | - } else { |
|
132 | - $skip = true; |
|
133 | - } |
|
134 | - } |
|
135 | - if (!$skip) { |
|
136 | - $comment_config['callback']['approve']($comment); |
|
137 | - } |
|
138 | - } |
|
117 | + // call custom approve function if any |
|
118 | + if (false != $call_approvefunc && isset($comment_config['callback']['approve']) |
|
119 | + && trim($comment_config['callback']['approve']) != '') { |
|
120 | + $skip = false; |
|
121 | + if (!function_exists($comment_config['callback']['approve'])) { |
|
122 | + if (isset($comment_config['callbackFile'])) { |
|
123 | + $callbackfile = trim($comment_config['callbackFile']); |
|
124 | + if ($callbackfile != '' |
|
125 | + && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
126 | + require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
127 | + } |
|
128 | + if (!function_exists($comment_config['callback']['approve'])) { |
|
129 | + $skip = true; |
|
130 | + } |
|
131 | + } else { |
|
132 | + $skip = true; |
|
133 | + } |
|
134 | + } |
|
135 | + if (!$skip) { |
|
136 | + $comment_config['callback']['approve']($comment); |
|
137 | + } |
|
138 | + } |
|
139 | 139 | |
140 | - // call custom update function if any |
|
141 | - if (false != $call_updatefunc && isset($comment_config['callback']['update']) |
|
142 | - && trim($comment_config['callback']['update']) != '') { |
|
143 | - $skip = false; |
|
144 | - if (!function_exists($comment_config['callback']['update'])) { |
|
145 | - if (isset($comment_config['callbackFile'])) { |
|
146 | - $callbackfile = trim($comment_config['callbackFile']); |
|
147 | - if ($callbackfile != '' |
|
148 | - && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
149 | - require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
150 | - } |
|
151 | - if (!function_exists($comment_config['callback']['update'])) { |
|
152 | - $skip = true; |
|
153 | - } |
|
154 | - } else { |
|
155 | - $skip = true; |
|
156 | - } |
|
157 | - } |
|
158 | - if (!$skip) { |
|
159 | - $criteria = new CriteriaCompo(new Criteria('com_modid', $com_modid)); |
|
160 | - $criteria->add(new Criteria('com_itemid', $com_itemid)); |
|
161 | - $criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); |
|
162 | - $comment_count = $commentHandler->getCount($criteria); |
|
163 | - $func = $comment_config['callback']['update']; |
|
164 | - call_user_func_array($func, [$com_itemid, $comment_count, $comment->getVar('com_id')]); |
|
165 | - } |
|
166 | - } |
|
140 | + // call custom update function if any |
|
141 | + if (false != $call_updatefunc && isset($comment_config['callback']['update']) |
|
142 | + && trim($comment_config['callback']['update']) != '') { |
|
143 | + $skip = false; |
|
144 | + if (!function_exists($comment_config['callback']['update'])) { |
|
145 | + if (isset($comment_config['callbackFile'])) { |
|
146 | + $callbackfile = trim($comment_config['callbackFile']); |
|
147 | + if ($callbackfile != '' |
|
148 | + && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { |
|
149 | + require_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; |
|
150 | + } |
|
151 | + if (!function_exists($comment_config['callback']['update'])) { |
|
152 | + $skip = true; |
|
153 | + } |
|
154 | + } else { |
|
155 | + $skip = true; |
|
156 | + } |
|
157 | + } |
|
158 | + if (!$skip) { |
|
159 | + $criteria = new CriteriaCompo(new Criteria('com_modid', $com_modid)); |
|
160 | + $criteria->add(new Criteria('com_itemid', $com_itemid)); |
|
161 | + $criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); |
|
162 | + $comment_count = $commentHandler->getCount($criteria); |
|
163 | + $func = $comment_config['callback']['update']; |
|
164 | + call_user_func_array($func, [$com_itemid, $comment_count, $comment->getVar('com_id')]); |
|
165 | + } |
|
166 | + } |
|
167 | 167 | |
168 | - // RMV-NOTIFY |
|
169 | - // trigger notification event if necessary |
|
170 | - if ($notify_event) { |
|
171 | - $not_modid = $com_modid; |
|
172 | - // require_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; |
|
173 | - $not_catinfo = notificationCommentCategoryInfo($not_modid); |
|
174 | - $not_category = $not_catinfo['name']; |
|
175 | - $not_itemid = $com_itemid; |
|
176 | - $not_event = $notify_event; |
|
177 | - // Build an ABSOLUTE URL to view the comment. Make sure we |
|
178 | - // point to a viewable page (i.e. not the system administration |
|
179 | - // module). |
|
180 | - $comment_tags = []; |
|
181 | - $not_module = $xoopsModule; |
|
182 | - if (!isset($comment_url)) { |
|
183 | - $com_config = $not_module->getInfo('comments'); |
|
184 | - $comment_url = $com_config['pageName'] . '?'; |
|
185 | - $comment_url .= $com_config['itemName']; |
|
186 | - } |
|
187 | - $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; |
|
188 | - $notificationHandler = xoops_getHandler('notification'); |
|
189 | - $notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid); |
|
190 | - } |
|
168 | + // RMV-NOTIFY |
|
169 | + // trigger notification event if necessary |
|
170 | + if ($notify_event) { |
|
171 | + $not_modid = $com_modid; |
|
172 | + // require_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; |
|
173 | + $not_catinfo = notificationCommentCategoryInfo($not_modid); |
|
174 | + $not_category = $not_catinfo['name']; |
|
175 | + $not_itemid = $com_itemid; |
|
176 | + $not_event = $notify_event; |
|
177 | + // Build an ABSOLUTE URL to view the comment. Make sure we |
|
178 | + // point to a viewable page (i.e. not the system administration |
|
179 | + // module). |
|
180 | + $comment_tags = []; |
|
181 | + $not_module = $xoopsModule; |
|
182 | + if (!isset($comment_url)) { |
|
183 | + $com_config = $not_module->getInfo('comments'); |
|
184 | + $comment_url = $com_config['pageName'] . '?'; |
|
185 | + $comment_url .= $com_config['itemName']; |
|
186 | + } |
|
187 | + $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; |
|
188 | + $notificationHandler = xoops_getHandler('notification'); |
|
189 | + $notificationHandler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid); |
|
190 | + } |
|
191 | 191 | |
192 | - PlanetUtility::planetRespondToTrackback(0); |
|
193 | - } else { |
|
194 | - PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors())); |
|
195 | - } |
|
192 | + PlanetUtility::planetRespondToTrackback(0); |
|
193 | + } else { |
|
194 | + PlanetUtility::planetRespondToTrackback(1, xoops_error($comment->getHtmlErrors())); |
|
195 | + } |
|
196 | 196 | } |
@@ -32,51 +32,51 @@ |
||
32 | 32 | include __DIR__ . '/header.php'; |
33 | 33 | global $pdf_data; |
34 | 34 | if (!empty($_POST['pdf_data'])) { |
35 | - $pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST'))); |
|
35 | + $pdf_data = unserialize(base64_decode(Request::getText('pdf_data', '', 'POST'))); |
|
36 | 36 | } elseif (!empty($pdf_data)) { |
37 | 37 | } else { |
38 | - error_reporting(0); |
|
39 | - include __DIR__ . '/header.php'; |
|
40 | - error_reporting(0); |
|
38 | + error_reporting(0); |
|
39 | + include __DIR__ . '/header.php'; |
|
40 | + error_reporting(0); |
|
41 | 41 | |
42 | - if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
|
43 | - $args['article'] = @$args_num[0]; |
|
44 | - } |
|
42 | + if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) { |
|
43 | + $args['article'] = @$args_num[0]; |
|
44 | + } |
|
45 | 45 | |
46 | - $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
46 | + $article_id = (int)(empty($_GET['article']) ? @$args['article'] : $_GET['article']); |
|
47 | 47 | |
48 | - $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
|
49 | - $article_obj = $articleHandler->get($article_id); |
|
48 | + $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
|
49 | + $article_obj = $articleHandler->get($article_id); |
|
50 | 50 | |
51 | - $article_data = []; |
|
51 | + $article_data = []; |
|
52 | 52 | |
53 | - // title |
|
54 | - $article_data['title'] = $article_obj->getVar('art_title'); |
|
53 | + // title |
|
54 | + $article_data['title'] = $article_obj->getVar('art_title'); |
|
55 | 55 | |
56 | - $article_data['author'] = $article_obj->getVar('art_author'); |
|
56 | + $article_data['author'] = $article_obj->getVar('art_author'); |
|
57 | 57 | |
58 | - // source |
|
59 | - $article_data['source'] = $article_obj->getVar('art_link'); |
|
58 | + // source |
|
59 | + $article_data['source'] = $article_obj->getVar('art_link'); |
|
60 | 60 | |
61 | - // publish time |
|
62 | - $article_data['time'] = $article_obj->getTime(); |
|
61 | + // publish time |
|
62 | + $article_data['time'] = $article_obj->getTime(); |
|
63 | 63 | |
64 | - // summary |
|
65 | - $article_data['summary'] = $article_obj->getSummary(); |
|
64 | + // summary |
|
65 | + $article_data['summary'] = $article_obj->getSummary(); |
|
66 | 66 | |
67 | - // text of page |
|
68 | - $article_data['text'] = $article_obj->getVar('art_content'); |
|
67 | + // text of page |
|
68 | + $article_data['text'] = $article_obj->getVar('art_content'); |
|
69 | 69 | |
70 | - // Build the pdf_data array |
|
71 | - $pdf_data['title'] = $article_data['title']; |
|
72 | - $pdf_data['author'] = $article_data['author']; |
|
73 | - $pdf_data['date'] = $article_data['time']; |
|
74 | - $pdf_data['content'] = ''; |
|
75 | - if ($article_data['summary']) { |
|
76 | - $pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>'; |
|
77 | - } |
|
78 | - $pdf_data['content'] .= $article_data['text'] . '<br>'; |
|
79 | - $pdf_data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id'); |
|
70 | + // Build the pdf_data array |
|
71 | + $pdf_data['title'] = $article_data['title']; |
|
72 | + $pdf_data['author'] = $article_data['author']; |
|
73 | + $pdf_data['date'] = $article_data['time']; |
|
74 | + $pdf_data['content'] = ''; |
|
75 | + if ($article_data['summary']) { |
|
76 | + $pdf_data['content'] .= planet_constant('MD_SUMMARY') . ': ' . $article_data['summary'] . '<br><br>'; |
|
77 | + } |
|
78 | + $pdf_data['content'] .= $article_data['text'] . '<br>'; |
|
79 | + $pdf_data['url'] = XOOPS_URL . '/modules/' . $GLOBALS['artdirname'] . '/view.article.php' . URL_DELIMITER . $article_obj->getVar('art_id'); |
|
80 | 80 | } |
81 | 81 | $pdf_data['filename'] = preg_replace("/[^0-9a-z\-_\.]/i", '', $pdf_data['title']); |
82 | 82 |
@@ -24,8 +24,8 @@ |
||
24 | 24 | |
25 | 25 | $moduleDirName = basename(dirname(__DIR__)); |
26 | 26 | $uploadFolders = [ |
27 | - NEWBB_UPLOAD_PATH, |
|
28 | - NEWBB_UPLOAD_PATH . '/thumbs' |
|
27 | + NEWBB_UPLOAD_PATH, |
|
28 | + NEWBB_UPLOAD_PATH . '/thumbs' |
|
29 | 29 | ]; |
30 | 30 | |
31 | 31 | //$copyFiles = array( |
@@ -20,12 +20,12 @@ |
||
20 | 20 | */ |
21 | 21 | |
22 | 22 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
23 | -require_once __DIR__ . '/common.php'; |
|
23 | +require_once __DIR__.'/common.php'; |
|
24 | 24 | |
25 | 25 | $moduleDirName = basename(dirname(__DIR__)); |
26 | 26 | $uploadFolders = [ |
27 | 27 | NEWBB_UPLOAD_PATH, |
28 | - NEWBB_UPLOAD_PATH . '/thumbs' |
|
28 | + NEWBB_UPLOAD_PATH.'/thumbs' |
|
29 | 29 | ]; |
30 | 30 | |
31 | 31 | //$copyFiles = array( |
@@ -32,88 +32,88 @@ |
||
32 | 32 | |
33 | 33 | // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
34 | 34 | if (!defined('PLANET_INI')) { |
35 | - exit(); |
|
35 | + exit(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if (!defined('PLANET_FUNCTIONS_INI')): |
39 | - define('PLANET_FUNCTIONS_INI', 1); |
|
39 | + define('PLANET_FUNCTIONS_INI', 1); |
|
40 | 40 | |
41 | - /** |
|
42 | - * @param $name |
|
43 | - * @return mixed |
|
44 | - */ |
|
45 | - function planet_constant($name) |
|
46 | - { |
|
47 | - return mod_constant($name); |
|
48 | - } |
|
41 | + /** |
|
42 | + * @param $name |
|
43 | + * @return mixed |
|
44 | + */ |
|
45 | + function planet_constant($name) |
|
46 | + { |
|
47 | + return mod_constant($name); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param $name |
|
52 | - * @param bool $isRel |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - function planet_DB_prefix($name, $isRel = false) |
|
56 | - { |
|
57 | - return mod_DB_prefix($name, $isRel); |
|
58 | - } |
|
50 | + /** |
|
51 | + * @param $name |
|
52 | + * @param bool $isRel |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + function planet_DB_prefix($name, $isRel = false) |
|
56 | + { |
|
57 | + return mod_DB_prefix($name, $isRel); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @return bool |
|
62 | - */ |
|
63 | - function planet_load_object() |
|
64 | - { |
|
65 | - return load_object(); |
|
66 | - } |
|
60 | + /** |
|
61 | + * @return bool |
|
62 | + */ |
|
63 | + function planet_load_object() |
|
64 | + { |
|
65 | + return load_object(); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return array|mixed |
|
70 | - */ |
|
71 | - function planet_load_config() |
|
72 | - { |
|
73 | - static $moduleConfig; |
|
74 | - if (isset($moduleConfig)) { |
|
75 | - return $moduleConfig; |
|
76 | - } |
|
68 | + /** |
|
69 | + * @return array|mixed |
|
70 | + */ |
|
71 | + function planet_load_config() |
|
72 | + { |
|
73 | + static $moduleConfig; |
|
74 | + if (isset($moduleConfig)) { |
|
75 | + return $moduleConfig; |
|
76 | + } |
|
77 | 77 | |
78 | - if (is_object($GLOBALS['xoopsModule']) |
|
79 | - && $GLOBALS['xoopsModule']->getVar('dirname') == $GLOBALS['moddirname']) { |
|
80 | - if (isset($GLOBALS['xoopsModuleConfig'])) { |
|
81 | - $moduleConfig = $GLOBALS['xoopsModuleConfig']; |
|
82 | - } |
|
83 | - } else { |
|
84 | - /** @var XoopsModuleHandler $moduleHandler */ |
|
85 | - $moduleHandler = xoops_getHandler('module'); |
|
86 | - $module = $moduleHandler->getByDirname($GLOBALS['moddirname']); |
|
78 | + if (is_object($GLOBALS['xoopsModule']) |
|
79 | + && $GLOBALS['xoopsModule']->getVar('dirname') == $GLOBALS['moddirname']) { |
|
80 | + if (isset($GLOBALS['xoopsModuleConfig'])) { |
|
81 | + $moduleConfig = $GLOBALS['xoopsModuleConfig']; |
|
82 | + } |
|
83 | + } else { |
|
84 | + /** @var XoopsModuleHandler $moduleHandler */ |
|
85 | + $moduleHandler = xoops_getHandler('module'); |
|
86 | + $module = $moduleHandler->getByDirname($GLOBALS['moddirname']); |
|
87 | 87 | |
88 | - $configHandler = xoops_getHandler('config'); |
|
89 | - $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid'))); |
|
90 | - $configs = $configHandler->getConfigs($criteria); |
|
91 | - foreach (array_keys($configs) as $i) { |
|
92 | - $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); |
|
93 | - } |
|
94 | - unset($configs); |
|
95 | - } |
|
96 | - if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') { |
|
97 | - $moduleConfig = array_merge($moduleConfig, $customConfig); |
|
98 | - } |
|
88 | + $configHandler = xoops_getHandler('config'); |
|
89 | + $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid'))); |
|
90 | + $configs = $configHandler->getConfigs($criteria); |
|
91 | + foreach (array_keys($configs) as $i) { |
|
92 | + $moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); |
|
93 | + } |
|
94 | + unset($configs); |
|
95 | + } |
|
96 | + if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') { |
|
97 | + $moduleConfig = array_merge($moduleConfig, $customConfig); |
|
98 | + } |
|
99 | 99 | |
100 | - return $moduleConfig; |
|
101 | - } |
|
100 | + return $moduleConfig; |
|
101 | + } |
|
102 | 102 | |
103 | - function planet_define_url_delimiter() |
|
104 | - { |
|
105 | - if (defined('URL_DELIMITER')) { |
|
106 | - if (!in_array(URL_DELIMITER, ['?', '/'])) { |
|
107 | - die('Exit on security'); |
|
108 | - } |
|
109 | - } else { |
|
110 | - $moduleConfig = planet_load_config(); |
|
111 | - if (empty($moduleConfig['do_urw'])) { |
|
112 | - define('URL_DELIMITER', '?'); |
|
113 | - } else { |
|
114 | - define('URL_DELIMITER', '/'); |
|
115 | - } |
|
116 | - } |
|
117 | - } |
|
103 | + function planet_define_url_delimiter() |
|
104 | + { |
|
105 | + if (defined('URL_DELIMITER')) { |
|
106 | + if (!in_array(URL_DELIMITER, ['?', '/'])) { |
|
107 | + die('Exit on security'); |
|
108 | + } |
|
109 | + } else { |
|
110 | + $moduleConfig = planet_load_config(); |
|
111 | + if (empty($moduleConfig['do_urw'])) { |
|
112 | + define('URL_DELIMITER', '?'); |
|
113 | + } else { |
|
114 | + define('URL_DELIMITER', '/'); |
|
115 | + } |
|
116 | + } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | endif; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if (isset($GLOBALS['xoopsModuleConfig'])) { |
81 | 81 | $moduleConfig = $GLOBALS['xoopsModuleConfig']; |
82 | 82 | } |
83 | - } else { |
|
83 | + }else { |
|
84 | 84 | /** @var XoopsModuleHandler $moduleHandler */ |
85 | 85 | $moduleHandler = xoops_getHandler('module'); |
86 | 86 | $module = $moduleHandler->getByDirname($GLOBALS['moddirname']); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | unset($configs); |
95 | 95 | } |
96 | - if ($customConfig = @include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/plugin.php') { |
|
96 | + if ($customConfig = @include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/plugin.php') { |
|
97 | 97 | $moduleConfig = array_merge($moduleConfig, $customConfig); |
98 | 98 | } |
99 | 99 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | if (!in_array(URL_DELIMITER, ['?', '/'])) { |
107 | 107 | die('Exit on security'); |
108 | 108 | } |
109 | - } else { |
|
109 | + }else { |
|
110 | 110 | $moduleConfig = planet_load_config(); |
111 | 111 | if (empty($moduleConfig['do_urw'])) { |
112 | 112 | define('URL_DELIMITER', '?'); |
113 | - } else { |
|
113 | + }else { |
|
114 | 114 | define('URL_DELIMITER', '/'); |
115 | 115 | } |
116 | 116 | } |
@@ -30,521 +30,521 @@ |
||
30 | 30 | |
31 | 31 | $current_path = __FILE__; |
32 | 32 | if (DIRECTORY_SEPARATOR !== '/') { |
33 | - $current_path = str_replace(strpos($current_path, '\\\\', 2) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path); |
|
33 | + $current_path = str_replace(strpos($current_path, '\\\\', 2) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $current_path); |
|
34 | 34 | } |
35 | 35 | $url_arr = explode('/', strstr($current_path, '/modules/')); |
36 | 36 | $GLOBALS['moddirname'] = $url_arr[2]; |
37 | 37 | |
38 | 38 | if (!defined('planet_FUNCTIONS')): |
39 | - define('planet_FUNCTIONS', 1); |
|
40 | - |
|
41 | - require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php'; |
|
42 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
43 | - require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php'; |
|
44 | - |
|
45 | - /** |
|
46 | - * Function to display messages |
|
47 | - * |
|
48 | - * @var mixed $messages |
|
49 | - * @return bool |
|
50 | - */ |
|
51 | - function planetDisplayMessage($message) |
|
52 | - { |
|
53 | - return mod_message($message); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * Function to parse arguments for a page according to $_SERVER['REQUEST_URI'] |
|
58 | - * |
|
59 | - * @var array $args_numeric array of numeric variable values |
|
60 | - * @var array $args array of indexed variables: name and value |
|
61 | - * @var array $args_string array of string variable values |
|
62 | - * |
|
63 | - * @return bool true on args parsed |
|
64 | - */ |
|
65 | - |
|
66 | - /* known issues: |
|
39 | + define('planet_FUNCTIONS', 1); |
|
40 | + |
|
41 | + require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php'; |
|
42 | + require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
43 | + require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php'; |
|
44 | + |
|
45 | + /** |
|
46 | + * Function to display messages |
|
47 | + * |
|
48 | + * @var mixed $messages |
|
49 | + * @return bool |
|
50 | + */ |
|
51 | + function planetDisplayMessage($message) |
|
52 | + { |
|
53 | + return mod_message($message); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * Function to parse arguments for a page according to $_SERVER['REQUEST_URI'] |
|
58 | + * |
|
59 | + * @var array $args_numeric array of numeric variable values |
|
60 | + * @var array $args array of indexed variables: name and value |
|
61 | + * @var array $args_string array of string variable values |
|
62 | + * |
|
63 | + * @return bool true on args parsed |
|
64 | + */ |
|
65 | + |
|
66 | + /* known issues: |
|
67 | 67 | * - "/" in a string |
68 | 68 | * - "&" in a string |
69 | 69 | */ |
70 | - function planetParseArguments(&$args_numeric, &$args, &$args_string) |
|
71 | - { |
|
72 | - $args_abb = [ |
|
73 | - 'a' => 'article', |
|
74 | - 'b' => 'blog', |
|
75 | - 'c' => 'category', |
|
76 | - 'l' => 'list', |
|
77 | - 'o' => 'sort', |
|
78 | - 's' => 'start', |
|
79 | - 'u' => 'uid' |
|
80 | - ]; |
|
81 | - $args = []; |
|
82 | - $args_numeric = []; |
|
83 | - $args_string = []; |
|
84 | - if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
|
85 | - $vars = preg_split("/[\/|&]/", $matches[1]); |
|
86 | - $vars = array_map('trim', $vars); |
|
87 | - if (count($vars) > 0) { |
|
88 | - foreach ($vars as $var) { |
|
89 | - if (is_numeric($var)) { |
|
90 | - $args_numeric[] = $var; |
|
91 | - } elseif (false === strpos($var, '=')) { |
|
92 | - if (is_numeric(substr($var, 1))) { |
|
93 | - $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1); |
|
94 | - } else { |
|
95 | - $args_string[] = urldecode($var); |
|
96 | - } |
|
97 | - } else { |
|
98 | - parse_str($var, $args); |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Function to parse class prefix |
|
109 | - * |
|
110 | - * @var string $class_string string to be parsed |
|
111 | - * @var mixed $pattern |
|
112 | - * @var mixed $replacement |
|
113 | - * |
|
114 | - * @return bool true on success |
|
115 | - */ |
|
116 | - function planetParseClass($class_string, $pattern = '', $replacement = '') |
|
117 | - { |
|
118 | - if (empty($class_string)) { |
|
119 | - return; |
|
120 | - } |
|
121 | - $patterns = ["/\[CLASS_PREFIX\]/"]; |
|
122 | - $replacements = [ucfirst(strtolower($GLOBALS['moddirname']))]; |
|
123 | - if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) { |
|
124 | - $pattern = [$pattern]; |
|
125 | - $replacement = [$replacement]; |
|
126 | - } |
|
127 | - if (is_array($pattern) && count($pattern) > 0) { |
|
128 | - $ii = 0; |
|
129 | - foreach ($pattern as $pat) { |
|
130 | - if (!in_array($pat, $patterns)) { |
|
131 | - $patterns[] = $pat; |
|
132 | - $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : ''; |
|
133 | - } |
|
134 | - ++$ii; |
|
135 | - } |
|
136 | - } |
|
137 | - $class_string = preg_replace($patterns, $replacements, $class_string); |
|
138 | - eval($class_string); |
|
139 | - |
|
140 | - return true; |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Function to parse function prefix |
|
145 | - * |
|
146 | - * @var string $function_string string to be parsed |
|
147 | - * @var mixed $pattern |
|
148 | - * @var mixed $replacement |
|
149 | - * |
|
150 | - * @return bool true on success |
|
151 | - */ |
|
152 | - function planetParseFunction($function_string, $pattern = '', $replacement = '') |
|
153 | - { |
|
154 | - if (empty($function_string)) { |
|
155 | - return; |
|
156 | - } |
|
157 | - $patterns = ["/\[DIRNAME\]/", "/\[VAR_PREFIX\]/"]; |
|
158 | - $replacements = [$GLOBALS['moddirname'], $GLOBALS['VAR_PREFIX']]; |
|
159 | - if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) { |
|
160 | - $pattern = [$pattern]; |
|
161 | - $replacement = [$replacement]; |
|
162 | - } |
|
163 | - if (is_array($pattern) && count($pattern) > 0) { |
|
164 | - $ii = 0; |
|
165 | - foreach ($pattern as $pat) { |
|
166 | - if (!in_array($pat, $patterns)) { |
|
167 | - $patterns[] = $pat; |
|
168 | - $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : ''; |
|
169 | - } |
|
170 | - ++$ii; |
|
171 | - } |
|
172 | - } |
|
173 | - $function_string = preg_replace($patterns, $replacements, $function_string); |
|
174 | - eval($function_string); |
|
175 | - |
|
176 | - return true; |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * Function to convert UNIX time to formatted time string |
|
181 | - * @param $time |
|
182 | - * @param string $format |
|
183 | - * @return string |
|
184 | - */ |
|
185 | - function planet_formatTimestamp($time, $format = '') |
|
186 | - { |
|
187 | - if (empty($time)) { |
|
188 | - return ''; |
|
189 | - } |
|
190 | - |
|
191 | - return formatTimestamp($time, $format); |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Function to a list of user names associated with their user IDs |
|
196 | - * @param int $userid |
|
197 | - * @param int $usereal |
|
198 | - * @param bool $linked |
|
199 | - * @return array |
|
200 | - */ |
|
201 | - function &planetGetUnameFromId($userid, $usereal = 0, $linked = false) |
|
202 | - { |
|
203 | - if (!is_array($userid)) { |
|
204 | - $userid = [$userid]; |
|
205 | - } |
|
206 | - $users =& mod_getUnameFromIds($userid, $usereal, $linked); |
|
207 | - |
|
208 | - return $users; |
|
209 | - } |
|
210 | - |
|
211 | - /** |
|
212 | - * Function to parse links, links are delimited by link break, URL and title of a link are delimited by space |
|
213 | - * |
|
214 | - * @var string $text raw content |
|
215 | - * |
|
216 | - * @return array associative array of link url and title |
|
217 | - */ |
|
218 | - function &planetParseLinks($text) |
|
219 | - { |
|
220 | - $myts = MyTextSanitizer::getInstance(); |
|
221 | - $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
|
222 | - $links = []; |
|
223 | - if (count($link_array) > 0) { |
|
224 | - foreach ($link_array as $link) { |
|
225 | - @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
|
226 | - if (empty($url)) { |
|
227 | - continue; |
|
228 | - } |
|
229 | - //if(empty($title)) $title = $url; |
|
230 | - $links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)]; |
|
231 | - } |
|
232 | - } |
|
233 | - |
|
234 | - return $links; |
|
235 | - } |
|
236 | - |
|
237 | - /** |
|
238 | - * @param $pagename |
|
239 | - * @return string |
|
240 | - */ |
|
241 | - function planetGetTemplate($pagename) |
|
242 | - { |
|
243 | - return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl'; |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * @param int $currentoption |
|
248 | - */ |
|
249 | - function planet_adminmenu($currentoption = -1) |
|
250 | - { |
|
251 | - loadModuleAdminMenu($currentoption, ''); |
|
252 | - |
|
253 | - return; |
|
254 | - } |
|
255 | - |
|
256 | - /** |
|
257 | - * Function to send a trackback |
|
258 | - * |
|
259 | - * @param $article |
|
260 | - * @param $comment |
|
261 | - * @return bool |
|
262 | - */ |
|
263 | - function planet_com_trackback(&$article, &$comment) |
|
264 | - { |
|
265 | - $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
|
266 | - $blog_obj = $blogHandler->get($article->getVar('blog_id')); |
|
267 | - if (!$pattern = $blog_obj->getVar('blog_trackback')) { |
|
268 | - return false; |
|
269 | - } |
|
270 | - @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern)); |
|
271 | - $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link')); |
|
272 | - |
|
273 | - return planetTrackback($trackback_url, $article); |
|
274 | - } |
|
275 | - |
|
276 | - /** |
|
277 | - * @param $trackback_url |
|
278 | - * @param $article |
|
279 | - * @return bool |
|
280 | - */ |
|
281 | - function planetTrackback($trackback_url, $article) |
|
282 | - { |
|
283 | - global $myts, $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
|
284 | - |
|
285 | - $title = $article->getVar('art_title'); |
|
286 | - $excerpt = $article->getVar('art_content'); |
|
287 | - $blog_name = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name'); |
|
288 | - $title = xoops_utf8_encode($title); |
|
289 | - $excerpt = xoops_utf8_encode($excerpt); |
|
290 | - $blog_name = xoops_utf8_encode($blog_name); |
|
291 | - $charset = 'utf-8'; |
|
292 | - $title1 = urlencode($title); |
|
293 | - $excerpt1 = urlencode($excerpt); |
|
294 | - $name1 = urlencode($blog_name); |
|
295 | - $url = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id')); |
|
296 | - $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
|
297 | - $trackback_url = parse_url($trackback_url); |
|
298 | - |
|
299 | - $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n"; |
|
300 | - $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n"; |
|
301 | - $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n"; |
|
302 | - $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; |
|
303 | - $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION; |
|
304 | - $http_request .= "\r\n\r\n"; |
|
305 | - $http_request .= $query_string; |
|
306 | - if ('' == $trackback_url['port']) { |
|
307 | - $trackback_url['port'] = 80; |
|
308 | - } |
|
309 | - $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
|
310 | - @fwrite($fs, $http_request); |
|
311 | - if ($xoopsModuleConfig['do_debug']) { |
|
312 | - $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log'; |
|
313 | - $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
|
314 | - $fr .= "CHARSET:$charset\n"; |
|
315 | - $fr .= "NAME:$blog_name\n"; |
|
316 | - $fr .= 'TITLE:' . $title . "\n"; |
|
317 | - $fr .= "EXCERPT:$excerpt\n\n"; |
|
318 | - while (!@feof($fs)) { |
|
319 | - $fr .= @fgets($fs, 4096); |
|
320 | - } |
|
321 | - $fr .= "\n\n"; |
|
322 | - |
|
323 | - if ($fp = fopen($debug_file, 'a')) { |
|
324 | - fwrite($fp, $fr); |
|
325 | - fclose($fp); |
|
326 | - } else { |
|
327 | - } |
|
328 | - } |
|
329 | - @fclose($fs); |
|
330 | - |
|
331 | - return true; |
|
332 | - } |
|
333 | - |
|
334 | - /** |
|
335 | - * Function to ping servers |
|
336 | - * @param $server |
|
337 | - * @param $id |
|
338 | - */ |
|
339 | - function planetGetPing($server, $id) |
|
340 | - { |
|
341 | - if (is_array($server)) { |
|
342 | - foreach ($server as $serv) { |
|
343 | - planetGetPing($serv, $id); |
|
344 | - } |
|
345 | - } |
|
346 | - require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php'; |
|
347 | - |
|
348 | - // using a timeout of 3 seconds should be enough to cover slow servers |
|
349 | - $client = new IXR_Client($server, false); |
|
350 | - $client->timeout = 3; |
|
351 | - $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION; |
|
352 | - |
|
353 | - // when set to true, this outputs debug messages by itself |
|
354 | - $client->debug = false; |
|
355 | - |
|
356 | - $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name')); |
|
357 | - $home = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/'; |
|
358 | - $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id; |
|
359 | - |
|
360 | - if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping |
|
361 | - $client->query('weblogUpdates.ping', $blogname, $home); |
|
362 | - } |
|
363 | - } |
|
364 | - |
|
365 | - /** |
|
366 | - * Function to respond to a trackback |
|
367 | - * @param int $error |
|
368 | - * @param string $error_message |
|
369 | - */ |
|
370 | - function planetRespondToTrackback($error = 0, $error_message = '') |
|
371 | - { |
|
372 | - $charset = 'utf-8'; |
|
373 | - $error_message = xoops_utf8_encode($error_message); |
|
374 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
375 | - if ($error) { |
|
376 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
377 | - echo "<response>\n"; |
|
378 | - echo "<error>1</error>\n"; |
|
379 | - echo "<message>$error_message</message>\n"; |
|
380 | - echo '</response>'; |
|
381 | - die(); |
|
382 | - } else { |
|
383 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
384 | - echo "<response>\n"; |
|
385 | - echo "<error>0</error>\n"; |
|
386 | - echo '</response>'; |
|
387 | - } |
|
388 | - } |
|
389 | - |
|
390 | - /** |
|
391 | - * Function to set a cookie with module-specified name |
|
392 | - * |
|
393 | - * using customized serialization method |
|
394 | - * @param $name |
|
395 | - * @param string $string |
|
396 | - * @param int $expire |
|
397 | - */ |
|
398 | - function planetSetCookie($name, $string = '', $expire = 0) |
|
399 | - { |
|
400 | - if (is_array($string)) { |
|
401 | - $value = []; |
|
402 | - foreach ($string as $key => $val) { |
|
403 | - $value[] = $key . '|' . $val; |
|
404 | - } |
|
405 | - $string = implode(',', $value); |
|
406 | - } |
|
407 | - setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/'); |
|
408 | - } |
|
409 | - |
|
410 | - /** |
|
411 | - * @param $name |
|
412 | - * @param bool $isArray |
|
413 | - * @return array|null |
|
414 | - */ |
|
415 | - function planetGetCookie($name, $isArray = false) |
|
416 | - { |
|
417 | - $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null; |
|
418 | - if ($isArray) { |
|
419 | - $_value = $value ? explode(',', $value) : []; |
|
420 | - $value = []; |
|
421 | - if (count($_value) > 0) { |
|
422 | - foreach ($_value as $string) { |
|
423 | - $key = substr($string, 0, strpos($string, '|')); |
|
424 | - $val = substr($string, strpos($string, '|') + 1); |
|
425 | - $value[$key] = $val; |
|
426 | - } |
|
427 | - } |
|
428 | - unset($_value); |
|
429 | - } |
|
430 | - |
|
431 | - return $value; |
|
432 | - } |
|
433 | - |
|
434 | - /** |
|
435 | - * Function to filter text |
|
436 | - * |
|
437 | - * @param $document |
|
438 | - * @return string filtered text |
|
439 | - */ |
|
440 | - function &planetHtml2text(&$document) |
|
441 | - { |
|
442 | - $document = strip_tags($document); |
|
443 | - |
|
444 | - return $document; |
|
445 | - } |
|
446 | - |
|
447 | - // Adapted from PMA_getIp() [phpmyadmin project] |
|
448 | - /** |
|
449 | - * @param bool $asString |
|
450 | - * @return mixed |
|
451 | - */ |
|
452 | - function planetGetIP($asString = false) |
|
453 | - { |
|
454 | - return mod_getIP($asString); |
|
455 | - } |
|
456 | - |
|
457 | - /** |
|
458 | - * @param $url |
|
459 | - * @return bool|mixed|string |
|
460 | - */ |
|
461 | - function planetGetRemoteContent($url) |
|
462 | - { |
|
463 | - if ($data = planet_fetch_snoopy($url)) { |
|
464 | - return $data; |
|
465 | - } |
|
466 | - if ($data = planet_fetch_CURL($url)) { |
|
467 | - return $data; |
|
468 | - } |
|
469 | - if ($data = planet_fetch_fopen($url)) { |
|
470 | - return $data; |
|
471 | - } |
|
472 | - |
|
473 | - return false; |
|
474 | - } |
|
475 | - |
|
476 | - /** |
|
477 | - * @param $url |
|
478 | - * @return string |
|
479 | - */ |
|
480 | - function planet_fetch_snoopy($url) |
|
481 | - { |
|
482 | - require_once XOOPS_ROOT_PATH . '/class/snoopy.php'; |
|
483 | - $snoopy = new Snoopy; |
|
484 | - $data = ''; |
|
485 | - if (@$snoopy->fetch($url)) { |
|
486 | - $data = is_array($snoopy->results) ? implode("\n", $snoopy->results) : $snoopy->results; |
|
487 | - } |
|
488 | - |
|
489 | - return $data; |
|
490 | - } |
|
491 | - |
|
492 | - /** |
|
493 | - * @param $url |
|
494 | - * @return bool|mixed |
|
495 | - */ |
|
496 | - function planet_fetch_CURL($url) |
|
497 | - { |
|
498 | - if (!function_exists('curl_init')) { |
|
499 | - return false; |
|
500 | - } |
|
501 | - $ch = curl_init(); // initialize curl handle |
|
502 | - curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
|
503 | - curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
|
504 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
505 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
|
506 | - curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
|
507 | - $data = curl_exec($ch); // run the whole process |
|
508 | - curl_close($ch); |
|
509 | - |
|
510 | - return $data; |
|
511 | - } |
|
512 | - |
|
513 | - /** |
|
514 | - * @param $url |
|
515 | - * @return bool|string |
|
516 | - */ |
|
517 | - function planet_fetch_fopen($url) |
|
518 | - { |
|
519 | - if (!$fp = @fopen($url, 'r')) { |
|
520 | - return false; |
|
521 | - } |
|
522 | - $data = ''; |
|
523 | - while (!feof($fp)) { |
|
524 | - $data .= fgets($fp, 1024); |
|
525 | - } |
|
526 | - fclose($fp); |
|
527 | - |
|
528 | - return $data; |
|
529 | - } |
|
530 | - |
|
531 | - /** |
|
532 | - * @param $haystack |
|
533 | - * @param $needle |
|
534 | - * @param int $offset |
|
535 | - * @return bool|int |
|
536 | - */ |
|
537 | - function planetStrrPos($haystack, $needle, $offset = 0) |
|
538 | - { |
|
539 | - if (substr(PHP_VERSION, 0, 1) == 5) { |
|
540 | - return strrpos($haystack, $needle, $offset); |
|
541 | - } |
|
542 | - $index = strpos(strrev($haystack), strrev($needle)); |
|
543 | - if ($index === false) { |
|
544 | - return false; |
|
545 | - } |
|
546 | - $index = strlen($haystack) - strlen($needle) - $index; |
|
547 | - |
|
548 | - return $index; |
|
549 | - } |
|
70 | + function planetParseArguments(&$args_numeric, &$args, &$args_string) |
|
71 | + { |
|
72 | + $args_abb = [ |
|
73 | + 'a' => 'article', |
|
74 | + 'b' => 'blog', |
|
75 | + 'c' => 'category', |
|
76 | + 'l' => 'list', |
|
77 | + 'o' => 'sort', |
|
78 | + 's' => 'start', |
|
79 | + 'u' => 'uid' |
|
80 | + ]; |
|
81 | + $args = []; |
|
82 | + $args_numeric = []; |
|
83 | + $args_string = []; |
|
84 | + if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
|
85 | + $vars = preg_split("/[\/|&]/", $matches[1]); |
|
86 | + $vars = array_map('trim', $vars); |
|
87 | + if (count($vars) > 0) { |
|
88 | + foreach ($vars as $var) { |
|
89 | + if (is_numeric($var)) { |
|
90 | + $args_numeric[] = $var; |
|
91 | + } elseif (false === strpos($var, '=')) { |
|
92 | + if (is_numeric(substr($var, 1))) { |
|
93 | + $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1); |
|
94 | + } else { |
|
95 | + $args_string[] = urldecode($var); |
|
96 | + } |
|
97 | + } else { |
|
98 | + parse_str($var, $args); |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Function to parse class prefix |
|
109 | + * |
|
110 | + * @var string $class_string string to be parsed |
|
111 | + * @var mixed $pattern |
|
112 | + * @var mixed $replacement |
|
113 | + * |
|
114 | + * @return bool true on success |
|
115 | + */ |
|
116 | + function planetParseClass($class_string, $pattern = '', $replacement = '') |
|
117 | + { |
|
118 | + if (empty($class_string)) { |
|
119 | + return; |
|
120 | + } |
|
121 | + $patterns = ["/\[CLASS_PREFIX\]/"]; |
|
122 | + $replacements = [ucfirst(strtolower($GLOBALS['moddirname']))]; |
|
123 | + if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) { |
|
124 | + $pattern = [$pattern]; |
|
125 | + $replacement = [$replacement]; |
|
126 | + } |
|
127 | + if (is_array($pattern) && count($pattern) > 0) { |
|
128 | + $ii = 0; |
|
129 | + foreach ($pattern as $pat) { |
|
130 | + if (!in_array($pat, $patterns)) { |
|
131 | + $patterns[] = $pat; |
|
132 | + $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : ''; |
|
133 | + } |
|
134 | + ++$ii; |
|
135 | + } |
|
136 | + } |
|
137 | + $class_string = preg_replace($patterns, $replacements, $class_string); |
|
138 | + eval($class_string); |
|
139 | + |
|
140 | + return true; |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Function to parse function prefix |
|
145 | + * |
|
146 | + * @var string $function_string string to be parsed |
|
147 | + * @var mixed $pattern |
|
148 | + * @var mixed $replacement |
|
149 | + * |
|
150 | + * @return bool true on success |
|
151 | + */ |
|
152 | + function planetParseFunction($function_string, $pattern = '', $replacement = '') |
|
153 | + { |
|
154 | + if (empty($function_string)) { |
|
155 | + return; |
|
156 | + } |
|
157 | + $patterns = ["/\[DIRNAME\]/", "/\[VAR_PREFIX\]/"]; |
|
158 | + $replacements = [$GLOBALS['moddirname'], $GLOBALS['VAR_PREFIX']]; |
|
159 | + if (!empty($pattern) && !is_array($pattern) && !is_array($replacement)) { |
|
160 | + $pattern = [$pattern]; |
|
161 | + $replacement = [$replacement]; |
|
162 | + } |
|
163 | + if (is_array($pattern) && count($pattern) > 0) { |
|
164 | + $ii = 0; |
|
165 | + foreach ($pattern as $pat) { |
|
166 | + if (!in_array($pat, $patterns)) { |
|
167 | + $patterns[] = $pat; |
|
168 | + $replacements[] = isset($replacement[$ii]) ? $replacement[$ii] : ''; |
|
169 | + } |
|
170 | + ++$ii; |
|
171 | + } |
|
172 | + } |
|
173 | + $function_string = preg_replace($patterns, $replacements, $function_string); |
|
174 | + eval($function_string); |
|
175 | + |
|
176 | + return true; |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * Function to convert UNIX time to formatted time string |
|
181 | + * @param $time |
|
182 | + * @param string $format |
|
183 | + * @return string |
|
184 | + */ |
|
185 | + function planet_formatTimestamp($time, $format = '') |
|
186 | + { |
|
187 | + if (empty($time)) { |
|
188 | + return ''; |
|
189 | + } |
|
190 | + |
|
191 | + return formatTimestamp($time, $format); |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Function to a list of user names associated with their user IDs |
|
196 | + * @param int $userid |
|
197 | + * @param int $usereal |
|
198 | + * @param bool $linked |
|
199 | + * @return array |
|
200 | + */ |
|
201 | + function &planetGetUnameFromId($userid, $usereal = 0, $linked = false) |
|
202 | + { |
|
203 | + if (!is_array($userid)) { |
|
204 | + $userid = [$userid]; |
|
205 | + } |
|
206 | + $users =& mod_getUnameFromIds($userid, $usereal, $linked); |
|
207 | + |
|
208 | + return $users; |
|
209 | + } |
|
210 | + |
|
211 | + /** |
|
212 | + * Function to parse links, links are delimited by link break, URL and title of a link are delimited by space |
|
213 | + * |
|
214 | + * @var string $text raw content |
|
215 | + * |
|
216 | + * @return array associative array of link url and title |
|
217 | + */ |
|
218 | + function &planetParseLinks($text) |
|
219 | + { |
|
220 | + $myts = MyTextSanitizer::getInstance(); |
|
221 | + $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
|
222 | + $links = []; |
|
223 | + if (count($link_array) > 0) { |
|
224 | + foreach ($link_array as $link) { |
|
225 | + @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
|
226 | + if (empty($url)) { |
|
227 | + continue; |
|
228 | + } |
|
229 | + //if(empty($title)) $title = $url; |
|
230 | + $links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)]; |
|
231 | + } |
|
232 | + } |
|
233 | + |
|
234 | + return $links; |
|
235 | + } |
|
236 | + |
|
237 | + /** |
|
238 | + * @param $pagename |
|
239 | + * @return string |
|
240 | + */ |
|
241 | + function planetGetTemplate($pagename) |
|
242 | + { |
|
243 | + return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl'; |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * @param int $currentoption |
|
248 | + */ |
|
249 | + function planet_adminmenu($currentoption = -1) |
|
250 | + { |
|
251 | + loadModuleAdminMenu($currentoption, ''); |
|
252 | + |
|
253 | + return; |
|
254 | + } |
|
255 | + |
|
256 | + /** |
|
257 | + * Function to send a trackback |
|
258 | + * |
|
259 | + * @param $article |
|
260 | + * @param $comment |
|
261 | + * @return bool |
|
262 | + */ |
|
263 | + function planet_com_trackback(&$article, &$comment) |
|
264 | + { |
|
265 | + $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
|
266 | + $blog_obj = $blogHandler->get($article->getVar('blog_id')); |
|
267 | + if (!$pattern = $blog_obj->getVar('blog_trackback')) { |
|
268 | + return false; |
|
269 | + } |
|
270 | + @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern)); |
|
271 | + $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link')); |
|
272 | + |
|
273 | + return planetTrackback($trackback_url, $article); |
|
274 | + } |
|
275 | + |
|
276 | + /** |
|
277 | + * @param $trackback_url |
|
278 | + * @param $article |
|
279 | + * @return bool |
|
280 | + */ |
|
281 | + function planetTrackback($trackback_url, $article) |
|
282 | + { |
|
283 | + global $myts, $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
|
284 | + |
|
285 | + $title = $article->getVar('art_title'); |
|
286 | + $excerpt = $article->getVar('art_content'); |
|
287 | + $blog_name = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name'); |
|
288 | + $title = xoops_utf8_encode($title); |
|
289 | + $excerpt = xoops_utf8_encode($excerpt); |
|
290 | + $blog_name = xoops_utf8_encode($blog_name); |
|
291 | + $charset = 'utf-8'; |
|
292 | + $title1 = urlencode($title); |
|
293 | + $excerpt1 = urlencode($excerpt); |
|
294 | + $name1 = urlencode($blog_name); |
|
295 | + $url = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id')); |
|
296 | + $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
|
297 | + $trackback_url = parse_url($trackback_url); |
|
298 | + |
|
299 | + $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n"; |
|
300 | + $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n"; |
|
301 | + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n"; |
|
302 | + $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; |
|
303 | + $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION; |
|
304 | + $http_request .= "\r\n\r\n"; |
|
305 | + $http_request .= $query_string; |
|
306 | + if ('' == $trackback_url['port']) { |
|
307 | + $trackback_url['port'] = 80; |
|
308 | + } |
|
309 | + $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
|
310 | + @fwrite($fs, $http_request); |
|
311 | + if ($xoopsModuleConfig['do_debug']) { |
|
312 | + $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log'; |
|
313 | + $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
|
314 | + $fr .= "CHARSET:$charset\n"; |
|
315 | + $fr .= "NAME:$blog_name\n"; |
|
316 | + $fr .= 'TITLE:' . $title . "\n"; |
|
317 | + $fr .= "EXCERPT:$excerpt\n\n"; |
|
318 | + while (!@feof($fs)) { |
|
319 | + $fr .= @fgets($fs, 4096); |
|
320 | + } |
|
321 | + $fr .= "\n\n"; |
|
322 | + |
|
323 | + if ($fp = fopen($debug_file, 'a')) { |
|
324 | + fwrite($fp, $fr); |
|
325 | + fclose($fp); |
|
326 | + } else { |
|
327 | + } |
|
328 | + } |
|
329 | + @fclose($fs); |
|
330 | + |
|
331 | + return true; |
|
332 | + } |
|
333 | + |
|
334 | + /** |
|
335 | + * Function to ping servers |
|
336 | + * @param $server |
|
337 | + * @param $id |
|
338 | + */ |
|
339 | + function planetGetPing($server, $id) |
|
340 | + { |
|
341 | + if (is_array($server)) { |
|
342 | + foreach ($server as $serv) { |
|
343 | + planetGetPing($serv, $id); |
|
344 | + } |
|
345 | + } |
|
346 | + require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php'; |
|
347 | + |
|
348 | + // using a timeout of 3 seconds should be enough to cover slow servers |
|
349 | + $client = new IXR_Client($server, false); |
|
350 | + $client->timeout = 3; |
|
351 | + $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION; |
|
352 | + |
|
353 | + // when set to true, this outputs debug messages by itself |
|
354 | + $client->debug = false; |
|
355 | + |
|
356 | + $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name')); |
|
357 | + $home = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/'; |
|
358 | + $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id; |
|
359 | + |
|
360 | + if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping |
|
361 | + $client->query('weblogUpdates.ping', $blogname, $home); |
|
362 | + } |
|
363 | + } |
|
364 | + |
|
365 | + /** |
|
366 | + * Function to respond to a trackback |
|
367 | + * @param int $error |
|
368 | + * @param string $error_message |
|
369 | + */ |
|
370 | + function planetRespondToTrackback($error = 0, $error_message = '') |
|
371 | + { |
|
372 | + $charset = 'utf-8'; |
|
373 | + $error_message = xoops_utf8_encode($error_message); |
|
374 | + header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
375 | + if ($error) { |
|
376 | + echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
377 | + echo "<response>\n"; |
|
378 | + echo "<error>1</error>\n"; |
|
379 | + echo "<message>$error_message</message>\n"; |
|
380 | + echo '</response>'; |
|
381 | + die(); |
|
382 | + } else { |
|
383 | + echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
384 | + echo "<response>\n"; |
|
385 | + echo "<error>0</error>\n"; |
|
386 | + echo '</response>'; |
|
387 | + } |
|
388 | + } |
|
389 | + |
|
390 | + /** |
|
391 | + * Function to set a cookie with module-specified name |
|
392 | + * |
|
393 | + * using customized serialization method |
|
394 | + * @param $name |
|
395 | + * @param string $string |
|
396 | + * @param int $expire |
|
397 | + */ |
|
398 | + function planetSetCookie($name, $string = '', $expire = 0) |
|
399 | + { |
|
400 | + if (is_array($string)) { |
|
401 | + $value = []; |
|
402 | + foreach ($string as $key => $val) { |
|
403 | + $value[] = $key . '|' . $val; |
|
404 | + } |
|
405 | + $string = implode(',', $value); |
|
406 | + } |
|
407 | + setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/'); |
|
408 | + } |
|
409 | + |
|
410 | + /** |
|
411 | + * @param $name |
|
412 | + * @param bool $isArray |
|
413 | + * @return array|null |
|
414 | + */ |
|
415 | + function planetGetCookie($name, $isArray = false) |
|
416 | + { |
|
417 | + $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null; |
|
418 | + if ($isArray) { |
|
419 | + $_value = $value ? explode(',', $value) : []; |
|
420 | + $value = []; |
|
421 | + if (count($_value) > 0) { |
|
422 | + foreach ($_value as $string) { |
|
423 | + $key = substr($string, 0, strpos($string, '|')); |
|
424 | + $val = substr($string, strpos($string, '|') + 1); |
|
425 | + $value[$key] = $val; |
|
426 | + } |
|
427 | + } |
|
428 | + unset($_value); |
|
429 | + } |
|
430 | + |
|
431 | + return $value; |
|
432 | + } |
|
433 | + |
|
434 | + /** |
|
435 | + * Function to filter text |
|
436 | + * |
|
437 | + * @param $document |
|
438 | + * @return string filtered text |
|
439 | + */ |
|
440 | + function &planetHtml2text(&$document) |
|
441 | + { |
|
442 | + $document = strip_tags($document); |
|
443 | + |
|
444 | + return $document; |
|
445 | + } |
|
446 | + |
|
447 | + // Adapted from PMA_getIp() [phpmyadmin project] |
|
448 | + /** |
|
449 | + * @param bool $asString |
|
450 | + * @return mixed |
|
451 | + */ |
|
452 | + function planetGetIP($asString = false) |
|
453 | + { |
|
454 | + return mod_getIP($asString); |
|
455 | + } |
|
456 | + |
|
457 | + /** |
|
458 | + * @param $url |
|
459 | + * @return bool|mixed|string |
|
460 | + */ |
|
461 | + function planetGetRemoteContent($url) |
|
462 | + { |
|
463 | + if ($data = planet_fetch_snoopy($url)) { |
|
464 | + return $data; |
|
465 | + } |
|
466 | + if ($data = planet_fetch_CURL($url)) { |
|
467 | + return $data; |
|
468 | + } |
|
469 | + if ($data = planet_fetch_fopen($url)) { |
|
470 | + return $data; |
|
471 | + } |
|
472 | + |
|
473 | + return false; |
|
474 | + } |
|
475 | + |
|
476 | + /** |
|
477 | + * @param $url |
|
478 | + * @return string |
|
479 | + */ |
|
480 | + function planet_fetch_snoopy($url) |
|
481 | + { |
|
482 | + require_once XOOPS_ROOT_PATH . '/class/snoopy.php'; |
|
483 | + $snoopy = new Snoopy; |
|
484 | + $data = ''; |
|
485 | + if (@$snoopy->fetch($url)) { |
|
486 | + $data = is_array($snoopy->results) ? implode("\n", $snoopy->results) : $snoopy->results; |
|
487 | + } |
|
488 | + |
|
489 | + return $data; |
|
490 | + } |
|
491 | + |
|
492 | + /** |
|
493 | + * @param $url |
|
494 | + * @return bool|mixed |
|
495 | + */ |
|
496 | + function planet_fetch_CURL($url) |
|
497 | + { |
|
498 | + if (!function_exists('curl_init')) { |
|
499 | + return false; |
|
500 | + } |
|
501 | + $ch = curl_init(); // initialize curl handle |
|
502 | + curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
|
503 | + curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
|
504 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
505 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
|
506 | + curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
|
507 | + $data = curl_exec($ch); // run the whole process |
|
508 | + curl_close($ch); |
|
509 | + |
|
510 | + return $data; |
|
511 | + } |
|
512 | + |
|
513 | + /** |
|
514 | + * @param $url |
|
515 | + * @return bool|string |
|
516 | + */ |
|
517 | + function planet_fetch_fopen($url) |
|
518 | + { |
|
519 | + if (!$fp = @fopen($url, 'r')) { |
|
520 | + return false; |
|
521 | + } |
|
522 | + $data = ''; |
|
523 | + while (!feof($fp)) { |
|
524 | + $data .= fgets($fp, 1024); |
|
525 | + } |
|
526 | + fclose($fp); |
|
527 | + |
|
528 | + return $data; |
|
529 | + } |
|
530 | + |
|
531 | + /** |
|
532 | + * @param $haystack |
|
533 | + * @param $needle |
|
534 | + * @param int $offset |
|
535 | + * @return bool|int |
|
536 | + */ |
|
537 | + function planetStrrPos($haystack, $needle, $offset = 0) |
|
538 | + { |
|
539 | + if (substr(PHP_VERSION, 0, 1) == 5) { |
|
540 | + return strrpos($haystack, $needle, $offset); |
|
541 | + } |
|
542 | + $index = strpos(strrev($haystack), strrev($needle)); |
|
543 | + if ($index === false) { |
|
544 | + return false; |
|
545 | + } |
|
546 | + $index = strlen($haystack) - strlen($needle) - $index; |
|
547 | + |
|
548 | + return $index; |
|
549 | + } |
|
550 | 550 | endif; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | if (!defined('planet_FUNCTIONS')): |
39 | 39 | define('planet_FUNCTIONS', 1); |
40 | 40 | |
41 | - require XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/vars.php'; |
|
42 | - require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
43 | - require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.php'; |
|
41 | + require XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/vars.php'; |
|
42 | + require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
43 | + require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.php'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Function to display messages |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function planetParseArguments(&$args_numeric, &$args, &$args_string) |
71 | 71 | { |
72 | - $args_abb = [ |
|
72 | + $args_abb = [ |
|
73 | 73 | 'a' => 'article', |
74 | 74 | 'b' => 'blog', |
75 | 75 | 'c' => 'category', |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | if (preg_match("/[^\?]*\.php[\/|\?]([^\?]*)/i", Request::getUrl('REQUEST_URI', '', 'SERVER'), $matches)) { |
85 | 85 | $vars = preg_split("/[\/|&]/", $matches[1]); |
86 | 86 | $vars = array_map('trim', $vars); |
87 | - if (count($vars) > 0) { |
|
87 | + if (count($vars)>0) { |
|
88 | 88 | foreach ($vars as $var) { |
89 | 89 | if (is_numeric($var)) { |
90 | 90 | $args_numeric[] = $var; |
91 | 91 | } elseif (false === strpos($var, '=')) { |
92 | 92 | if (is_numeric(substr($var, 1))) { |
93 | - $args[$args_abb[strtolower($var{0})]] = (int)substr($var, 1); |
|
94 | - } else { |
|
93 | + $args[$args_abb[strtolower($var{0})]] = (int) substr($var, 1); |
|
94 | + }else { |
|
95 | 95 | $args_string[] = urldecode($var); |
96 | 96 | } |
97 | - } else { |
|
97 | + }else { |
|
98 | 98 | parse_str($var, $args); |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - return (count($args) + count($args_numeric) + count($args_string) == 0) ? null : true; |
|
104 | + return (count($args)+count($args_numeric)+count($args_string) == 0) ? null : true; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $pattern = [$pattern]; |
125 | 125 | $replacement = [$replacement]; |
126 | 126 | } |
127 | - if (is_array($pattern) && count($pattern) > 0) { |
|
127 | + if (is_array($pattern) && count($pattern)>0) { |
|
128 | 128 | $ii = 0; |
129 | 129 | foreach ($pattern as $pat) { |
130 | 130 | if (!in_array($pat, $patterns)) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $pattern = [$pattern]; |
161 | 161 | $replacement = [$replacement]; |
162 | 162 | } |
163 | - if (is_array($pattern) && count($pattern) > 0) { |
|
163 | + if (is_array($pattern) && count($pattern)>0) { |
|
164 | 164 | $ii = 0; |
165 | 165 | foreach ($pattern as $pat) { |
166 | 166 | if (!in_array($pat, $patterns)) { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if (!is_array($userid)) { |
204 | 204 | $userid = [$userid]; |
205 | 205 | } |
206 | - $users =& mod_getUnameFromIds($userid, $usereal, $linked); |
|
206 | + $users = & mod_getUnameFromIds($userid, $usereal, $linked); |
|
207 | 207 | |
208 | 208 | return $users; |
209 | 209 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $myts = MyTextSanitizer::getInstance(); |
221 | 221 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
222 | 222 | $links = []; |
223 | - if (count($link_array) > 0) { |
|
223 | + if (count($link_array)>0) { |
|
224 | 224 | foreach ($link_array as $link) { |
225 | 225 | @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
226 | 226 | if (empty($url)) { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function planetGetTemplate($pagename) |
242 | 242 | { |
243 | - return $GLOBALS['VAR_PREFIX'] . '_' . $pagename . '.tpl'; |
|
243 | + return $GLOBALS['VAR_PREFIX'].'_'.$pagename.'.tpl'; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | @list($pat, $rep) = array_map('trim', preg_split("#[\s]+#", $pattern)); |
271 | - $trackback_url = preg_replace('#' . $pat . '#', $rep, $article_obj->getVar('art_link')); |
|
271 | + $trackback_url = preg_replace('#'.$pat.'#', $rep, $article_obj->getVar('art_link')); |
|
272 | 272 | |
273 | 273 | return planetTrackback($trackback_url, $article); |
274 | 274 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | $title = $article->getVar('art_title'); |
286 | 286 | $excerpt = $article->getVar('art_content'); |
287 | - $blog_name = $xoopsConfig['sitename'] . '-' . $xoopsModule->getVar('name'); |
|
287 | + $blog_name = $xoopsConfig['sitename'].'-'.$xoopsModule->getVar('name'); |
|
288 | 288 | $title = xoops_utf8_encode($title); |
289 | 289 | $excerpt = xoops_utf8_encode($excerpt); |
290 | 290 | $blog_name = xoops_utf8_encode($blog_name); |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | $title1 = urlencode($title); |
293 | 293 | $excerpt1 = urlencode($excerpt); |
294 | 294 | $name1 = urlencode($blog_name); |
295 | - $url = urlencode(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article->getVar('art_id')); |
|
295 | + $url = urlencode(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article->getVar('art_id')); |
|
296 | 296 | $query_string = "title=$title1&url=$url&blog_name=$name1&excerpt=$excerpt1&charset=$charset"; |
297 | 297 | $trackback_url = parse_url($trackback_url); |
298 | 298 | |
299 | - $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n"; |
|
300 | - $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n"; |
|
301 | - $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . $charset . "\r\n"; |
|
302 | - $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n"; |
|
303 | - $http_request .= 'User-Agent: XOOPS Blogs/' . XOOPS_VERSION; |
|
299 | + $http_request = 'POST '.$trackback_url['path'].($trackback_url['query'] ? '?'.$trackback_url['query'] : '')." HTTP/1.0\r\n"; |
|
300 | + $http_request .= 'Host: '.$trackback_url['host']."\r\n"; |
|
301 | + $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.$charset."\r\n"; |
|
302 | + $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; |
|
303 | + $http_request .= 'User-Agent: XOOPS Blogs/'.XOOPS_VERSION; |
|
304 | 304 | $http_request .= "\r\n\r\n"; |
305 | 305 | $http_request .= $query_string; |
306 | 306 | if ('' == $trackback_url['port']) { |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); |
310 | 310 | @fwrite($fs, $http_request); |
311 | 311 | if ($xoopsModuleConfig['do_debug']) { |
312 | - $debug_file = XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '_trackback.log'; |
|
312 | + $debug_file = XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'_trackback.log'; |
|
313 | 313 | $fr = "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"; |
314 | 314 | $fr .= "CHARSET:$charset\n"; |
315 | 315 | $fr .= "NAME:$blog_name\n"; |
316 | - $fr .= 'TITLE:' . $title . "\n"; |
|
316 | + $fr .= 'TITLE:'.$title."\n"; |
|
317 | 317 | $fr .= "EXCERPT:$excerpt\n\n"; |
318 | 318 | while (!@feof($fs)) { |
319 | 319 | $fr .= @fgets($fs, 4096); |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if ($fp = fopen($debug_file, 'a')) { |
324 | 324 | fwrite($fp, $fr); |
325 | 325 | fclose($fp); |
326 | - } else { |
|
326 | + }else { |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | @fclose($fs); |
@@ -343,19 +343,19 @@ discard block |
||
343 | 343 | planetGetPing($serv, $id); |
344 | 344 | } |
345 | 345 | } |
346 | - require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/class-IXR.php'; |
|
346 | + require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/class-IXR.php'; |
|
347 | 347 | |
348 | 348 | // using a timeout of 3 seconds should be enough to cover slow servers |
349 | 349 | $client = new IXR_Client($server, false); |
350 | 350 | $client->timeout = 3; |
351 | - $client->useragent .= ' -- XOOPS Article/' . XOOPS_VERSION; |
|
351 | + $client->useragent .= ' -- XOOPS Article/'.XOOPS_VERSION; |
|
352 | 352 | |
353 | 353 | // when set to true, this outputs debug messages by itself |
354 | 354 | $client->debug = false; |
355 | 355 | |
356 | 356 | $blogname = xoops_utf8_encode($GLOBALS['xoopsModule']->getVar('name')); |
357 | - $home = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/'; |
|
358 | - $rss2_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/xml.php' . URL_DELIMITER . 'rss2.0/' . $id; |
|
357 | + $home = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'; |
|
358 | + $rss2_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/xml.php'.URL_DELIMITER.'rss2.0/'.$id; |
|
359 | 359 | |
360 | 360 | if (!$client->query('weblogUpdates.extendedPing', $blogname, $home, $rss2_url)) { // then try a normal ping |
361 | 361 | $client->query('weblogUpdates.ping', $blogname, $home); |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | { |
372 | 372 | $charset = 'utf-8'; |
373 | 373 | $error_message = xoops_utf8_encode($error_message); |
374 | - header('Content-Type: text/xml; charset="' . $charset . '"'); |
|
374 | + header('Content-Type: text/xml; charset="'.$charset.'"'); |
|
375 | 375 | if ($error) { |
376 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
376 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
377 | 377 | echo "<response>\n"; |
378 | 378 | echo "<error>1</error>\n"; |
379 | 379 | echo "<message>$error_message</message>\n"; |
380 | 380 | echo '</response>'; |
381 | 381 | die(); |
382 | - } else { |
|
383 | - echo '<?xml version="1.0" encoding="' . $charset . '"?' . ">\n"; |
|
382 | + }else { |
|
383 | + echo '<?xml version="1.0" encoding="'.$charset.'"?'.">\n"; |
|
384 | 384 | echo "<response>\n"; |
385 | 385 | echo "<error>0</error>\n"; |
386 | 386 | echo '</response>'; |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | if (is_array($string)) { |
401 | 401 | $value = []; |
402 | 402 | foreach ($string as $key => $val) { |
403 | - $value[] = $key . '|' . $val; |
|
403 | + $value[] = $key.'|'.$val; |
|
404 | 404 | } |
405 | 405 | $string = implode(',', $value); |
406 | 406 | } |
407 | - setcookie($GLOBALS['VAR_PREFIX'] . $name, $string, (int)$expire, '/'); |
|
407 | + setcookie($GLOBALS['VAR_PREFIX'].$name, $string, (int) $expire, '/'); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /** |
@@ -414,14 +414,14 @@ discard block |
||
414 | 414 | */ |
415 | 415 | function planetGetCookie($name, $isArray = false) |
416 | 416 | { |
417 | - $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'] . $name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'] . $name] : null; |
|
417 | + $value = isset($_COOKIE[$GLOBALS['VAR_PREFIX'].$name]) ? $_COOKIE[$GLOBALS['VAR_PREFIX'].$name] : null; |
|
418 | 418 | if ($isArray) { |
419 | 419 | $_value = $value ? explode(',', $value) : []; |
420 | 420 | $value = []; |
421 | - if (count($_value) > 0) { |
|
421 | + if (count($_value)>0) { |
|
422 | 422 | foreach ($_value as $string) { |
423 | 423 | $key = substr($string, 0, strpos($string, '|')); |
424 | - $val = substr($string, strpos($string, '|') + 1); |
|
424 | + $val = substr($string, strpos($string, '|')+1); |
|
425 | 425 | $value[$key] = $val; |
426 | 426 | } |
427 | 427 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | */ |
480 | 480 | function planet_fetch_snoopy($url) |
481 | 481 | { |
482 | - require_once XOOPS_ROOT_PATH . '/class/snoopy.php'; |
|
482 | + require_once XOOPS_ROOT_PATH.'/class/snoopy.php'; |
|
483 | 483 | $snoopy = new Snoopy; |
484 | 484 | $data = ''; |
485 | 485 | if (@$snoopy->fetch($url)) { |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | if (!function_exists('curl_init')) { |
499 | 499 | return false; |
500 | 500 | } |
501 | - $ch = curl_init(); // initialize curl handle |
|
501 | + $ch = curl_init(); // initialize curl handle |
|
502 | 502 | curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
503 | 503 | curl_setopt($ch, CURLOPT_FAILONERROR, 1); |
504 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects |
|
504 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects |
|
505 | 505 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
506 | 506 | curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s |
507 | 507 | $data = curl_exec($ch); // run the whole process |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | if ($index === false) { |
544 | 544 | return false; |
545 | 545 | } |
546 | - $index = strlen($haystack) - strlen($needle) - $index; |
|
546 | + $index = strlen($haystack)-strlen($needle)-$index; |
|
547 | 547 | |
548 | 548 | return $index; |
549 | 549 | } |