@@ -287,7 +287,7 @@ |
||
287 | 287 | // Used in get_calendar |
288 | 288 | /** |
289 | 289 | * @param $num |
290 | - * @return mixed |
|
290 | + * @return double |
|
291 | 291 | */ |
292 | 292 | function planet_calendar_week_mod($num) |
293 | 293 | { |
@@ -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 = array('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 = array(); |
88 | 88 | $blogs_id = array(); |
89 | 89 | foreach ($articles_obj as $id => $article) { |
90 | - $articles[] = array( |
|
91 | - 'id' => $id, |
|
92 | - 'blog' => array('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[] = array( |
|
91 | + 'id' => $id, |
|
92 | + 'blog' => array('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 = array(); |
|
137 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
138 | - $months[] = array( |
|
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'] = array( |
|
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'] = array( |
|
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 = array(); |
|
137 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
138 | + $months[] = array( |
|
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'] = array( |
|
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'] = array( |
|
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 = array(); |
|
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] = array( |
|
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'] = array( |
|
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'] = array( |
|
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 = array(); |
|
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] = array( |
|
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'] = array( |
|
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'] = array( |
|
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 = array('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 = array(); |
88 | 88 | $blogs_id = array(); |
89 | 89 | foreach ($articles_obj as $id => $article) { |
90 | - $articles[] = array( |
|
90 | + $articles[] = array( |
|
91 | 91 | 'id' => $id, |
92 | 92 | 'blog' => array('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 = array(); |
137 | 137 | while ($myrow = $xoopsDB->fetchArray($result)) { |
138 | 138 | $months[] = array( |
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'] = array( |
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'] = array( |
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] = array( |
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'] = array( |
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'] = array( |
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 | } |
@@ -30,77 +30,77 @@ |
||
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Xmlrpc_client')) { |
33 | - /** |
|
34 | - * Class Xmlrpc_client |
|
35 | - */ |
|
36 | - class Xmlrpc_client |
|
37 | - { |
|
38 | - /** |
|
39 | - * Xmlrpc_client constructor. |
|
40 | - */ |
|
41 | - public function __construct() |
|
42 | - { |
|
43 | - } |
|
33 | + /** |
|
34 | + * Class Xmlrpc_client |
|
35 | + */ |
|
36 | + class Xmlrpc_client |
|
37 | + { |
|
38 | + /** |
|
39 | + * Xmlrpc_client constructor. |
|
40 | + */ |
|
41 | + public function __construct() |
|
42 | + { |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param $article |
|
47 | - */ |
|
48 | - public function setObject(&$article) |
|
49 | - { |
|
50 | - $this->$var = $val; |
|
51 | - } |
|
45 | + /** |
|
46 | + * @param $article |
|
47 | + */ |
|
48 | + public function setObject(&$article) |
|
49 | + { |
|
50 | + $this->$var = $val; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param $var |
|
55 | - * @param $val |
|
56 | - */ |
|
57 | - public function setVar($var, $val) |
|
58 | - { |
|
59 | - $this->$var = $val; |
|
60 | - } |
|
53 | + /** |
|
54 | + * @param $var |
|
55 | + * @param $val |
|
56 | + */ |
|
57 | + public function setVar($var, $val) |
|
58 | + { |
|
59 | + $this->$var = $val; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param $var |
|
64 | - * @return mixed |
|
65 | - */ |
|
66 | - public function getVar($var) |
|
67 | - { |
|
68 | - return $this->$var; |
|
69 | - } |
|
70 | - } |
|
62 | + /** |
|
63 | + * @param $var |
|
64 | + * @return mixed |
|
65 | + */ |
|
66 | + public function getVar($var) |
|
67 | + { |
|
68 | + return $this->$var; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if (!class_exists('Xmlrpc_server')) { |
74 | - /** |
|
75 | - * Class Xmlrpc_server |
|
76 | - */ |
|
77 | - class Xmlrpc_server |
|
78 | - { |
|
79 | - /** |
|
80 | - * Xmlrpc_server constructor. |
|
81 | - */ |
|
82 | - public function __construct() |
|
83 | - { |
|
84 | - } |
|
74 | + /** |
|
75 | + * Class Xmlrpc_server |
|
76 | + */ |
|
77 | + class Xmlrpc_server |
|
78 | + { |
|
79 | + /** |
|
80 | + * Xmlrpc_server constructor. |
|
81 | + */ |
|
82 | + public function __construct() |
|
83 | + { |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @param $var |
|
88 | - * @param $val |
|
89 | - */ |
|
90 | - public function setVar($var, $val) |
|
91 | - { |
|
92 | - $this->$var = $val; |
|
93 | - } |
|
86 | + /** |
|
87 | + * @param $var |
|
88 | + * @param $val |
|
89 | + */ |
|
90 | + public function setVar($var, $val) |
|
91 | + { |
|
92 | + $this->$var = $val; |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * @param $var |
|
97 | - * @return mixed |
|
98 | - */ |
|
99 | - public function getVar($var) |
|
100 | - { |
|
101 | - return $this->$var; |
|
102 | - } |
|
103 | - } |
|
95 | + /** |
|
96 | + * @param $var |
|
97 | + * @return mixed |
|
98 | + */ |
|
99 | + public function getVar($var) |
|
100 | + { |
|
101 | + return $this->$var; |
|
102 | + } |
|
103 | + } |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | PlanetUtility::planetParseClass(' |
@@ -26,7 +26,7 @@ |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -require_once __DIR__ . '/../include/vars.php'; |
|
29 | +require_once __DIR__.'/../include/vars.php'; |
|
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Xmlrpc_client')) { |
@@ -44,23 +44,23 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bcategory')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bcategory |
|
49 | - */ |
|
50 | - class Bcategory extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() |
|
56 | - { |
|
57 | - // $this->ArtObject(); |
|
58 | - $this->table = planet_DB_prefix('category'); |
|
59 | - $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false); |
|
60 | - $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, '', true); |
|
61 | - $this->initVar('cat_order', XOBJ_DTYPE_INT, 1, false); |
|
62 | - } |
|
63 | - } |
|
47 | + /** |
|
48 | + * Class Bcategory |
|
49 | + */ |
|
50 | + class Bcategory extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() |
|
56 | + { |
|
57 | + // $this->ArtObject(); |
|
58 | + $this->table = planet_DB_prefix('category'); |
|
59 | + $this->initVar('cat_id', XOBJ_DTYPE_INT, null, false); |
|
60 | + $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, '', true); |
|
61 | + $this->initVar('cat_order', XOBJ_DTYPE_INT, 1, false); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | endif; |
66 | 66 | /** |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -require_once __DIR__ . '/../include/vars.php'; |
|
33 | +require_once __DIR__.'/../include/vars.php'; |
|
34 | 34 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -44,25 +44,25 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bookmark')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bookmark |
|
49 | - */ |
|
50 | - class bookmark extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() |
|
56 | - { |
|
57 | - // $this->ArtObject(); |
|
58 | - $this->table = planet_DB_prefix('bookmark'); |
|
59 | - $this->initVar('bm_id', XOBJ_DTYPE_INT, null, false); |
|
60 | - /* user ID */ |
|
61 | - $this->initVar('bm_uid', XOBJ_DTYPE_INT, 0, true); |
|
62 | - /* blog ID */ |
|
63 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
64 | - } |
|
65 | - } |
|
47 | + /** |
|
48 | + * Class Bookmark |
|
49 | + */ |
|
50 | + class bookmark extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() |
|
56 | + { |
|
57 | + // $this->ArtObject(); |
|
58 | + $this->table = planet_DB_prefix('bookmark'); |
|
59 | + $this->initVar('bm_id', XOBJ_DTYPE_INT, null, false); |
|
60 | + /* user ID */ |
|
61 | + $this->initVar('bm_uid', XOBJ_DTYPE_INT, 0, true); |
|
62 | + /* blog ID */ |
|
63 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | endif; |
67 | 67 | /** |
68 | 68 | * Topic object handler class. |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -require_once __DIR__ . '/../include/vars.php'; |
|
33 | +require_once __DIR__.'/../include/vars.php'; |
|
34 | 34 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Bblog')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Bblog |
|
49 | - */ |
|
50 | - class Bblog extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - */ |
|
55 | - public function __construct() |
|
56 | - { |
|
57 | - // parent:__construct(); |
|
58 | - $this->table = planet_DB_prefix('blog'); |
|
59 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
60 | - $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
61 | - $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
62 | - /* rss URI */ |
|
63 | - $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
64 | - $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
65 | - $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
66 | - /* blog website */ |
|
67 | - $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
68 | - $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
69 | - |
|
70 | - /* regexp for blog article trackback |
|
47 | + /** |
|
48 | + * Class Bblog |
|
49 | + */ |
|
50 | + class Bblog extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + */ |
|
55 | + public function __construct() |
|
56 | + { |
|
57 | + // parent:__construct(); |
|
58 | + $this->table = planet_DB_prefix('blog'); |
|
59 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, null, false); |
|
60 | + $this->initVar('blog_title', XOBJ_DTYPE_TXTBOX, null, true); |
|
61 | + $this->initVar('blog_desc', XOBJ_DTYPE_TXTBOX, null); |
|
62 | + /* rss URI */ |
|
63 | + $this->initVar('blog_feed', XOBJ_DTYPE_TXTBOX, null, true); |
|
64 | + $this->initVar('blog_language', XOBJ_DTYPE_TXTBOX, null); |
|
65 | + $this->initVar('blog_charset', XOBJ_DTYPE_TXTBOX, null); |
|
66 | + /* blog website */ |
|
67 | + $this->initVar('blog_link', XOBJ_DTYPE_TXTBOX, null); |
|
68 | + $this->initVar('blog_image', XOBJ_DTYPE_TXTBOX, null); |
|
69 | + |
|
70 | + /* regexp for blog article trackback |
|
71 | 71 | * From article url to article trackback URI |
72 | 72 | * |
73 | 73 | * For example: http://www.example.com/blog/111.html => http://www.example.com/blog/trackback/111.html |
@@ -78,75 +78,75 @@ discard block |
||
78 | 78 | * The input shall be: pattern[SPACE]replacement |
79 | 79 | * (.*wordpress/)(index.php)?(\?p.*) $1wp-trackback/$3 |
80 | 80 | */ |
81 | - $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
82 | - |
|
83 | - /* blog submitter: is_numeric - uid; is_string - IP */ |
|
84 | - $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
85 | - |
|
86 | - /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
87 | - $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
88 | - |
|
89 | - /* key for blog content */ |
|
90 | - $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
91 | - |
|
92 | - $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
93 | - $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
94 | - $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
95 | - /* bookmark times */ |
|
96 | - $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * get formatted publish time of the article |
|
101 | - * |
|
102 | - * {@link Config} |
|
103 | - * |
|
104 | - * @param string $format format of time |
|
105 | - * @return string |
|
106 | - */ |
|
107 | - public function getTime($format = '') |
|
108 | - { |
|
109 | - $time = PlanetUtility::planetFormatTimestamp($this->getVar('blog_time'), $format); |
|
110 | - |
|
111 | - return $time; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * get verified image url of the category |
|
116 | - * |
|
117 | - * @return string |
|
118 | - */ |
|
119 | - public function getImage() |
|
120 | - { |
|
121 | - $image = $this->getVar('blog_image'); |
|
122 | - |
|
123 | - return $image; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * get rating average of the article |
|
128 | - * |
|
129 | - * @param int $decimals decimal length |
|
130 | - * @return numeric |
|
131 | - */ |
|
132 | - public function getRatingAverage($decimals = 1) |
|
133 | - { |
|
134 | - $ave = 3; |
|
135 | - if ($this->getVar('blog_rates')) { |
|
136 | - $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
137 | - } |
|
138 | - |
|
139 | - return $ave; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * @return numeric |
|
144 | - */ |
|
145 | - public function getStar() |
|
146 | - { |
|
147 | - return $this->getRatingAverage(0); |
|
148 | - } |
|
149 | - } |
|
81 | + $this->initVar('blog_trackback', XOBJ_DTYPE_TXTBOX, ''); |
|
82 | + |
|
83 | + /* blog submitter: is_numeric - uid; is_string - IP */ |
|
84 | + $this->initVar('blog_submitter', XOBJ_DTYPE_TXTBOX, ''); |
|
85 | + |
|
86 | + /* blog status: 0 - pending; 1 - active; 2 - featured */ |
|
87 | + $this->initVar('blog_status', XOBJ_DTYPE_INT, 1); |
|
88 | + |
|
89 | + /* key for blog content */ |
|
90 | + $this->initVar('blog_key', XOBJ_DTYPE_TXTBOX, ''); |
|
91 | + |
|
92 | + $this->initVar('blog_time', XOBJ_DTYPE_INT, 0); |
|
93 | + $this->initVar('blog_rating', XOBJ_DTYPE_INT, 0); |
|
94 | + $this->initVar('blog_rates', XOBJ_DTYPE_INT, 0); |
|
95 | + /* bookmark times */ |
|
96 | + $this->initVar('blog_marks', XOBJ_DTYPE_INT, 0); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * get formatted publish time of the article |
|
101 | + * |
|
102 | + * {@link Config} |
|
103 | + * |
|
104 | + * @param string $format format of time |
|
105 | + * @return string |
|
106 | + */ |
|
107 | + public function getTime($format = '') |
|
108 | + { |
|
109 | + $time = PlanetUtility::planetFormatTimestamp($this->getVar('blog_time'), $format); |
|
110 | + |
|
111 | + return $time; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * get verified image url of the category |
|
116 | + * |
|
117 | + * @return string |
|
118 | + */ |
|
119 | + public function getImage() |
|
120 | + { |
|
121 | + $image = $this->getVar('blog_image'); |
|
122 | + |
|
123 | + return $image; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * get rating average of the article |
|
128 | + * |
|
129 | + * @param int $decimals decimal length |
|
130 | + * @return numeric |
|
131 | + */ |
|
132 | + public function getRatingAverage($decimals = 1) |
|
133 | + { |
|
134 | + $ave = 3; |
|
135 | + if ($this->getVar('blog_rates')) { |
|
136 | + $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
137 | + } |
|
138 | + |
|
139 | + return $ave; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * @return numeric |
|
144 | + */ |
|
145 | + public function getStar() |
|
146 | + { |
|
147 | + return $this->getRatingAverage(0); |
|
148 | + } |
|
149 | + } |
|
150 | 150 | endif; |
151 | 151 | /** |
152 | 152 | * Topic object handler class. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -require_once __DIR__ . '/../include/vars.php'; |
|
33 | +require_once __DIR__.'/../include/vars.php'; |
|
34 | 34 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | $ave = 3; |
135 | 135 | if ($this->getVar('blog_rates')) { |
136 | - $ave = number_format($this->getVar('blog_rating') / $this->getVar('blog_rates'), $decimals); |
|
136 | + $ave = number_format($this->getVar('blog_rating')/$this->getVar('blog_rates'), $decimals); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | return $ave; |
@@ -44,116 +44,116 @@ |
||
44 | 44 | **/ |
45 | 45 | if (!class_exists('Barticle')): |
46 | 46 | |
47 | - /** |
|
48 | - * Class Barticle |
|
49 | - */ |
|
50 | - class Barticle extends XoopsObject |
|
51 | - { |
|
52 | - /** |
|
53 | - * Constructor |
|
54 | - * |
|
55 | - * @param int $id ID of the article |
|
56 | - */ |
|
57 | - public function __construct($id = null) |
|
58 | - { |
|
59 | - // $this->ArtObject(); |
|
60 | - $this->table = planet_DB_prefix('article'); |
|
61 | - $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
62 | - $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
63 | - |
|
64 | - $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
65 | - $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
66 | - $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
67 | - $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
68 | - $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
69 | - |
|
70 | - $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
71 | - $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
72 | - $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
73 | - $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
74 | - |
|
75 | - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
76 | - $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
77 | - $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
78 | - $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
79 | - $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * get title of the article |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function getTitle() |
|
88 | - { |
|
89 | - $title = $this->getVar('art_title'); |
|
90 | - |
|
91 | - return $title; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * get formatted publish time of the article |
|
96 | - * |
|
97 | - * {@link Config} |
|
98 | - * |
|
99 | - * @param string $format format of time |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public function getTime($format = 'c') |
|
103 | - { |
|
104 | - $time = $this->getVar('art_time'); |
|
105 | - if (empty($time)) { |
|
106 | - $time = time(); |
|
107 | - } |
|
108 | - $time = PlanetUtility::planetFormatTimestamp($time, $format); |
|
109 | - |
|
110 | - return $time; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * get summary of the article |
|
115 | - * |
|
116 | - * @param int $length |
|
117 | - * @return string $summary |
|
118 | - */ |
|
119 | - public function &getSummary($length = 0) |
|
120 | - { |
|
121 | - $content = $this->getVar('art_content'); |
|
122 | - $summary =& PlanetUtility::planetHtml2text($content); |
|
123 | - if (empty($length)) { |
|
124 | - $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
125 | - } |
|
126 | - if (!empty($length)) { |
|
127 | - $summary = xoops_substr($summary, 0, $length); |
|
128 | - } |
|
129 | - |
|
130 | - return $summary; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * get rating average of the article |
|
135 | - * |
|
136 | - * @param int $decimals decimal length |
|
137 | - * @return numeric |
|
138 | - */ |
|
139 | - public function getRatingAverage($decimals = 1) |
|
140 | - { |
|
141 | - $ave = 3; |
|
142 | - if ($this->getVar('art_rates')) { |
|
143 | - $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
144 | - } |
|
145 | - |
|
146 | - return $ave; |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * @return numeric |
|
151 | - */ |
|
152 | - public function getStar() |
|
153 | - { |
|
154 | - return $this->getRatingAverage(0); |
|
155 | - } |
|
156 | - } |
|
47 | + /** |
|
48 | + * Class Barticle |
|
49 | + */ |
|
50 | + class Barticle extends XoopsObject |
|
51 | + { |
|
52 | + /** |
|
53 | + * Constructor |
|
54 | + * |
|
55 | + * @param int $id ID of the article |
|
56 | + */ |
|
57 | + public function __construct($id = null) |
|
58 | + { |
|
59 | + // $this->ArtObject(); |
|
60 | + $this->table = planet_DB_prefix('article'); |
|
61 | + $this->initVar('art_id', XOBJ_DTYPE_INT, null, false); |
|
62 | + $this->initVar('blog_id', XOBJ_DTYPE_INT, 0, true); |
|
63 | + |
|
64 | + $this->initVar('art_title', XOBJ_DTYPE_TXTBOX, ''); |
|
65 | + $this->initVar('art_content', XOBJ_DTYPE_TXTAREA, ''); |
|
66 | + $this->initVar('art_link', XOBJ_DTYPE_TXTBOX, ''); |
|
67 | + $this->initVar('art_time', XOBJ_DTYPE_INT, 0); |
|
68 | + $this->initVar('art_author', XOBJ_DTYPE_TXTBOX, ''); |
|
69 | + |
|
70 | + $this->initVar('art_views', XOBJ_DTYPE_INT, 0); |
|
71 | + $this->initVar('art_rating', XOBJ_DTYPE_INT, 0); |
|
72 | + $this->initVar('art_rates', XOBJ_DTYPE_INT, 0); |
|
73 | + $this->initVar('art_comments', XOBJ_DTYPE_INT, 0); |
|
74 | + |
|
75 | + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
76 | + $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1); |
|
77 | + $this->initVar('doxcode', XOBJ_DTYPE_INT, 1); |
|
78 | + $this->initVar('doimage', XOBJ_DTYPE_INT, 1); |
|
79 | + $this->initVar('dobr', XOBJ_DTYPE_INT, 1); |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * get title of the article |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function getTitle() |
|
88 | + { |
|
89 | + $title = $this->getVar('art_title'); |
|
90 | + |
|
91 | + return $title; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * get formatted publish time of the article |
|
96 | + * |
|
97 | + * {@link Config} |
|
98 | + * |
|
99 | + * @param string $format format of time |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public function getTime($format = 'c') |
|
103 | + { |
|
104 | + $time = $this->getVar('art_time'); |
|
105 | + if (empty($time)) { |
|
106 | + $time = time(); |
|
107 | + } |
|
108 | + $time = PlanetUtility::planetFormatTimestamp($time, $format); |
|
109 | + |
|
110 | + return $time; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * get summary of the article |
|
115 | + * |
|
116 | + * @param int $length |
|
117 | + * @return string $summary |
|
118 | + */ |
|
119 | + public function &getSummary($length = 0) |
|
120 | + { |
|
121 | + $content = $this->getVar('art_content'); |
|
122 | + $summary =& PlanetUtility::planetHtml2text($content); |
|
123 | + if (empty($length)) { |
|
124 | + $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
|
125 | + } |
|
126 | + if (!empty($length)) { |
|
127 | + $summary = xoops_substr($summary, 0, $length); |
|
128 | + } |
|
129 | + |
|
130 | + return $summary; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * get rating average of the article |
|
135 | + * |
|
136 | + * @param int $decimals decimal length |
|
137 | + * @return numeric |
|
138 | + */ |
|
139 | + public function getRatingAverage($decimals = 1) |
|
140 | + { |
|
141 | + $ave = 3; |
|
142 | + if ($this->getVar('art_rates')) { |
|
143 | + $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
144 | + } |
|
145 | + |
|
146 | + return $ave; |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * @return numeric |
|
151 | + */ |
|
152 | + public function getStar() |
|
153 | + { |
|
154 | + return $this->getRatingAverage(0); |
|
155 | + } |
|
156 | + } |
|
157 | 157 | endif; |
158 | 158 | |
159 | 159 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
33 | -require_once __DIR__ . '/../include/vars.php'; |
|
33 | +require_once __DIR__.'/../include/vars.php'; |
|
34 | 34 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
35 | 35 | |
36 | 36 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function &getSummary($length = 0) |
120 | 120 | { |
121 | 121 | $content = $this->getVar('art_content'); |
122 | - $summary =& PlanetUtility::planetHtml2text($content); |
|
122 | + $summary = & PlanetUtility::planetHtml2text($content); |
|
123 | 123 | if (empty($length)) { |
124 | 124 | $length = $GLOBALS['xoopsModuleConfig']['display_summary']; |
125 | 125 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $ave = 3; |
142 | 142 | if ($this->getVar('art_rates')) { |
143 | - $ave = number_format($this->getVar('art_rating') / $this->getVar('art_rates'), $decimals); |
|
143 | + $ave = number_format($this->getVar('art_rating')/$this->getVar('art_rates'), $decimals); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $ave; |
@@ -30,27 +30,27 @@ |
||
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Brate')): |
33 | - /** |
|
34 | - * Class Brate |
|
35 | - */ |
|
36 | - class Brate extends XoopsObject |
|
37 | - { |
|
38 | - /** |
|
39 | - * Brate constructor. |
|
40 | - * @param null $id |
|
41 | - */ |
|
42 | - public function __construct($id = null) |
|
43 | - { |
|
44 | - // $this->ArtObject(); |
|
45 | - $this->table = planet_DB_prefix('rate'); |
|
46 | - $this->initVar('rate_id', XOBJ_DTYPE_INT, null, false); |
|
47 | - $this->initVar('art_id', XOBJ_DTYPE_INT, 0, true); |
|
48 | - $this->initVar('rate_uid', XOBJ_DTYPE_INT, 0); |
|
49 | - $this->initVar('rate_ip', XOBJ_DTYPE_INT, 0); |
|
50 | - $this->initVar('rate_rating', XOBJ_DTYPE_INT, 0, true); |
|
51 | - $this->initVar('rate_time', XOBJ_DTYPE_INT, 0, true); |
|
52 | - } |
|
53 | - } |
|
33 | + /** |
|
34 | + * Class Brate |
|
35 | + */ |
|
36 | + class Brate extends XoopsObject |
|
37 | + { |
|
38 | + /** |
|
39 | + * Brate constructor. |
|
40 | + * @param null $id |
|
41 | + */ |
|
42 | + public function __construct($id = null) |
|
43 | + { |
|
44 | + // $this->ArtObject(); |
|
45 | + $this->table = planet_DB_prefix('rate'); |
|
46 | + $this->initVar('rate_id', XOBJ_DTYPE_INT, null, false); |
|
47 | + $this->initVar('art_id', XOBJ_DTYPE_INT, 0, true); |
|
48 | + $this->initVar('rate_uid', XOBJ_DTYPE_INT, 0); |
|
49 | + $this->initVar('rate_ip', XOBJ_DTYPE_INT, 0); |
|
50 | + $this->initVar('rate_rating', XOBJ_DTYPE_INT, 0, true); |
|
51 | + $this->initVar('rate_time', XOBJ_DTYPE_INT, 0, true); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | endif; |
55 | 55 | |
56 | 56 | PlanetUtility::planetParseClass(' |
@@ -26,7 +26,7 @@ |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -require_once __DIR__ . '/../include/vars.php'; |
|
29 | +require_once __DIR__.'/../include/vars.php'; |
|
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | if (!class_exists('Brate')): |
@@ -81,100 +81,100 @@ |
||
81 | 81 | * @link |
82 | 82 | */ |
83 | 83 | if (!class_exists('Xmlfeed')) { |
84 | - /** |
|
85 | - * Class Bxmlfeed |
|
86 | - */ |
|
87 | - class Bxmlfeed extends UniversalFeedCreator |
|
88 | - { |
|
89 | - public $version; |
|
90 | - public $filename = ''; |
|
91 | - |
|
92 | - /** |
|
93 | - * Bxmlfeed constructor. |
|
94 | - * @param $version |
|
95 | - */ |
|
96 | - public function __construct($version) |
|
97 | - { |
|
98 | - $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
99 | - $this->version = $version; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * @param $var |
|
104 | - * @param $val |
|
105 | - * @param bool $encoding |
|
106 | - */ |
|
107 | - public function setVar($var, $val, $encoding = false) |
|
108 | - { |
|
109 | - if (!empty($encoding)) { |
|
110 | - $val = $this->convert_encoding($val); |
|
111 | - } |
|
112 | - $this->$var = $val; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * @param $val |
|
117 | - * @return array|mixed|string |
|
118 | - */ |
|
119 | - public function convert_encoding($val) |
|
120 | - { |
|
121 | - if (is_array($val)) { |
|
122 | - foreach (array_keys($val) as $key) { |
|
123 | - $val[$key] = $this->convert_encoding($val[$key]); |
|
124 | - } |
|
125 | - } else { |
|
126 | - $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
|
127 | - } |
|
128 | - |
|
129 | - return $val; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @param $var |
|
134 | - * @return mixed |
|
135 | - */ |
|
136 | - public function getVar($var) |
|
137 | - { |
|
138 | - return $this->$var; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * @param $img |
|
143 | - */ |
|
144 | - public function setImage(&$img) |
|
145 | - { |
|
146 | - $image = new FeedImage(); |
|
147 | - foreach ($img as $key => $val) { |
|
148 | - $image->$key = $this->convert_encoding($val); |
|
149 | - } |
|
150 | - $this->setVar('image', $image); |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * @param $itm |
|
155 | - */ |
|
156 | - public function _addItem(&$itm) |
|
157 | - { |
|
158 | - $item = new FeedItem(); |
|
159 | - foreach ($itm as $key => $val) { |
|
160 | - $item->$key = $this->convert_encoding($val); |
|
161 | - } |
|
162 | - $this->addItem($item); |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @param $items |
|
167 | - */ |
|
168 | - public function addItems(&$items) |
|
169 | - { |
|
170 | - if (!is_array($items) || count($items) == 0) { |
|
171 | - return; |
|
172 | - } |
|
173 | - foreach ($items as $item) { |
|
174 | - $this->_addItem($item); |
|
175 | - } |
|
176 | - } |
|
177 | - } |
|
84 | + /** |
|
85 | + * Class Bxmlfeed |
|
86 | + */ |
|
87 | + class Bxmlfeed extends UniversalFeedCreator |
|
88 | + { |
|
89 | + public $version; |
|
90 | + public $filename = ''; |
|
91 | + |
|
92 | + /** |
|
93 | + * Bxmlfeed constructor. |
|
94 | + * @param $version |
|
95 | + */ |
|
96 | + public function __construct($version) |
|
97 | + { |
|
98 | + $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
99 | + $this->version = $version; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * @param $var |
|
104 | + * @param $val |
|
105 | + * @param bool $encoding |
|
106 | + */ |
|
107 | + public function setVar($var, $val, $encoding = false) |
|
108 | + { |
|
109 | + if (!empty($encoding)) { |
|
110 | + $val = $this->convert_encoding($val); |
|
111 | + } |
|
112 | + $this->$var = $val; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * @param $val |
|
117 | + * @return array|mixed|string |
|
118 | + */ |
|
119 | + public function convert_encoding($val) |
|
120 | + { |
|
121 | + if (is_array($val)) { |
|
122 | + foreach (array_keys($val) as $key) { |
|
123 | + $val[$key] = $this->convert_encoding($val[$key]); |
|
124 | + } |
|
125 | + } else { |
|
126 | + $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
|
127 | + } |
|
128 | + |
|
129 | + return $val; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @param $var |
|
134 | + * @return mixed |
|
135 | + */ |
|
136 | + public function getVar($var) |
|
137 | + { |
|
138 | + return $this->$var; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * @param $img |
|
143 | + */ |
|
144 | + public function setImage(&$img) |
|
145 | + { |
|
146 | + $image = new FeedImage(); |
|
147 | + foreach ($img as $key => $val) { |
|
148 | + $image->$key = $this->convert_encoding($val); |
|
149 | + } |
|
150 | + $this->setVar('image', $image); |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * @param $itm |
|
155 | + */ |
|
156 | + public function _addItem(&$itm) |
|
157 | + { |
|
158 | + $item = new FeedItem(); |
|
159 | + foreach ($itm as $key => $val) { |
|
160 | + $item->$key = $this->convert_encoding($val); |
|
161 | + } |
|
162 | + $this->addItem($item); |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @param $items |
|
167 | + */ |
|
168 | + public function addItems(&$items) |
|
169 | + { |
|
170 | + if (!is_array($items) || count($items) == 0) { |
|
171 | + return; |
|
172 | + } |
|
173 | + foreach ($items as $item) { |
|
174 | + $this->_addItem($item); |
|
175 | + } |
|
176 | + } |
|
177 | + } |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | PlanetUtility::planetParseClass(' |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
29 | -require_once __DIR__ . '/../include/vars.php'; |
|
29 | +require_once __DIR__.'/../include/vars.php'; |
|
30 | 30 | //mod_loadFunctions('', $GLOBALS['moddirname']); |
31 | 31 | |
32 | 32 | /*** GENERAL USAGE ********************************************************* |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | */ |
65 | 65 | |
66 | 66 | // your local timezone, set to "" to disable or for GMT |
67 | -$server_TZ = abs((int)($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0)); |
|
68 | -$prefix = ($GLOBALS['xoopsConfig']['server_TZ'] < 0) ? '-' : '+'; |
|
69 | -$TIME_ZONE = $prefix . date('H:i', $server_TZ); |
|
67 | +$server_TZ = abs((int) ($GLOBALS['xoopsConfig']['server_TZ']*3600.0)); |
|
68 | +$prefix = ($GLOBALS['xoopsConfig']['server_TZ']<0) ? '-' : '+'; |
|
69 | +$TIME_ZONE = $prefix.date('H:i', $server_TZ); |
|
70 | 70 | define('TIME_ZONE', $TIME_ZONE); |
71 | 71 | // Version string. |
72 | 72 | define('FEEDCREATOR_VERSION', 'ARTICLE @ XOOPS powered by FeedCreator'); |
73 | 73 | |
74 | -require_once __DIR__ . '/feedcreator.class.php'; |
|
74 | +require_once __DIR__.'/feedcreator.class.php'; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Description |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function __construct($version) |
97 | 97 | { |
98 | - $this->filename = XOOPS_CACHE_PATH . '/feed.xml'; |
|
98 | + $this->filename = XOOPS_CACHE_PATH.'/feed.xml'; |
|
99 | 99 | $this->version = $version; |
100 | 100 | } |
101 | 101 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | foreach (array_keys($val) as $key) { |
123 | 123 | $val[$key] = $this->convert_encoding($val[$key]); |
124 | 124 | } |
125 | - } else { |
|
125 | + }else { |
|
126 | 126 | $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET); |
127 | 127 | } |
128 | 128 |
@@ -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,109 +50,109 @@ 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', array(), 'POST'))) { |
|
109 | - $blog_id = $blog_obj->getVar('blog_id'); |
|
110 | - if (in_array(0, $_POST['categories'])) { |
|
111 | - $_POST['categories'] = array(); |
|
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 | - case 'edit': |
|
120 | - default: |
|
121 | - if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
122 | - $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
123 | - $blog_obj->setVar('blog_id', $blog_id); |
|
124 | - } else { |
|
125 | - $blog_obj = $blogHandler->get($blog_id); |
|
126 | - } |
|
127 | - $categories = Request::getArray('categories', array(), 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
128 | - if (in_array('-1', $categories)) { |
|
129 | - $categories = array(); |
|
130 | - } |
|
131 | - if (empty($categories) && $blog_id > 0) { |
|
132 | - $crit = new Criteria('bc.blog_id', $blog_id); |
|
133 | - $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
134 | - } |
|
135 | - if (empty($categories)) { |
|
136 | - $categories = array(0 => _NONE); |
|
137 | - } |
|
138 | - |
|
139 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
140 | - echo '<br>'; |
|
141 | - if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
142 | - $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
143 | - $blogs_obj = $blogHandler->getList($criteria); |
|
144 | - if (count($blogs_obj) > 0) { |
|
145 | - echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
146 | - foreach (array_keys($blogs_obj) as $bid) { |
|
147 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
148 | - } |
|
149 | - echo '</div>'; |
|
150 | - unset($blogs_obj, $criteria); |
|
151 | - } |
|
152 | - } |
|
153 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
154 | - echo '</fieldset>'; |
|
155 | - 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', array(), 'POST'))) { |
|
109 | + $blog_id = $blog_obj->getVar('blog_id'); |
|
110 | + if (in_array(0, $_POST['categories'])) { |
|
111 | + $_POST['categories'] = array(); |
|
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 | + case 'edit': |
|
120 | + default: |
|
121 | + if (!empty(Request::getString('fetch', '', 'POST'))) { |
|
122 | + $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
|
123 | + $blog_obj->setVar('blog_id', $blog_id); |
|
124 | + } else { |
|
125 | + $blog_obj = $blogHandler->get($blog_id); |
|
126 | + } |
|
127 | + $categories = Request::getArray('categories', array(), 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
128 | + if (in_array('-1', $categories)) { |
|
129 | + $categories = array(); |
|
130 | + } |
|
131 | + if (empty($categories) && $blog_id > 0) { |
|
132 | + $crit = new Criteria('bc.blog_id', $blog_id); |
|
133 | + $categories = array_keys($categoryHandler->getByBlog($crit)); |
|
134 | + } |
|
135 | + if (empty($categories)) { |
|
136 | + $categories = array(0 => _NONE); |
|
137 | + } |
|
138 | + |
|
139 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
140 | + echo '<br>'; |
|
141 | + if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
|
142 | + $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
|
143 | + $blogs_obj = $blogHandler->getList($criteria); |
|
144 | + if (count($blogs_obj) > 0) { |
|
145 | + echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
146 | + foreach (array_keys($blogs_obj) as $bid) { |
|
147 | + echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
148 | + } |
|
149 | + echo '</div>'; |
|
150 | + unset($blogs_obj, $criteria); |
|
151 | + } |
|
152 | + } |
|
153 | + include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
154 | + echo '</fieldset>'; |
|
155 | + break; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | 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', array(), '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', array(), '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'] = array(); |
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 | case 'edit': |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | if (!empty(Request::getString('fetch', '', 'POST'))) { |
122 | 122 | $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST')); |
123 | 123 | $blog_obj->setVar('blog_id', $blog_id); |
124 | - } else { |
|
124 | + }else { |
|
125 | 125 | $blog_obj = $blogHandler->get($blog_id); |
126 | 126 | } |
127 | - $categories = Request::getArray('categories', array(), 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
127 | + $categories = Request::getArray('categories', array(), 'POST'); //isset($_POST['categories']) ? $_POST['categories'] : array(); |
|
128 | 128 | if (in_array('-1', $categories)) { |
129 | 129 | $categories = array(); |
130 | 130 | } |
131 | - if (empty($categories) && $blog_id > 0) { |
|
131 | + if (empty($categories) && $blog_id>0) { |
|
132 | 132 | $crit = new Criteria('bc.blog_id', $blog_id); |
133 | 133 | $categories = array_keys($categoryHandler->getByBlog($crit)); |
134 | 134 | } |
@@ -136,23 +136,23 @@ discard block |
||
136 | 136 | $categories = array(0 => _NONE); |
137 | 137 | } |
138 | 138 | |
139 | - echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>'; |
|
139 | + echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>'; |
|
140 | 140 | echo '<br>'; |
141 | 141 | if (empty($blog_id) && $blog_obj->getVar('blog_feed')) { |
142 | 142 | $criteria = new Criteria('blog_feed', $blog_obj->getVar('blog_feed')); |
143 | 143 | $blogs_obj = $blogHandler->getList($criteria); |
144 | - if (count($blogs_obj) > 0) { |
|
145 | - echo "<div class=\"errorMsg\">" . planet_constant('MD_BLOGEXISTS'); |
|
144 | + if (count($blogs_obj)>0) { |
|
145 | + echo "<div class=\"errorMsg\">".planet_constant('MD_BLOGEXISTS'); |
|
146 | 146 | foreach (array_keys($blogs_obj) as $bid) { |
147 | - echo "<br><a href=\"" . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . "\" target=\"_blank\">" . $blogs_obj[$bid] . '</a>'; |
|
147 | + echo "<br><a href=\"".XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid."\" target=\"_blank\">".$blogs_obj[$bid].'</a>'; |
|
148 | 148 | } |
149 | 149 | echo '</div>'; |
150 | 150 | unset($blogs_obj, $criteria); |
151 | 151 | } |
152 | 152 | } |
153 | - include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php'; |
|
153 | + include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php'; |
|
154 | 154 | echo '</fieldset>'; |
155 | 155 | break; |
156 | 156 | } |
157 | 157 | |
158 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
158 | +include XOOPS_ROOT_PATH.'/footer.php'; |