@@ -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 = ['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 (12 == $month) { |
|
181 | - $month_next = 1; |
|
182 | - $_year = $year + 1; |
|
183 | - } |
|
184 | - if (1 == $month) { |
|
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 (12 == $month) { |
|
181 | + $month_next = 1; |
|
182 | + $_year = $year + 1; |
|
183 | + } |
|
184 | + if (1 == $month) { |
|
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 (0 != $pad && 7 != $pad) { |
|
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 (0 != $pad && 7 != $pad) { |
|
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 (12 == $month) { |
181 | 181 | $month_next = 1; |
182 | - $_year = $year + 1; |
|
182 | + $_year = $year+1; |
|
183 | 183 | } |
184 | 184 | if (1 == $month) { |
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 (0 != $pad && 7 != $pad) { |
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('Restricted access.'); |
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('Restricted access.'); |
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('Restricted access.'); |
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('Restricted access.'); |
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('Restricted access.'); |
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('Restricted access.'); |
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')): |
@@ -33,61 +33,61 @@ |
||
33 | 33 | $blog_id = Request::getInt('blog', Request::getInt('blog', 0, 'POST'), 'GET'); //(int)(!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0)); |
34 | 34 | |
35 | 35 | if (empty($article_id) && empty($blog_id)) { |
36 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
36 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $articleHandler = xoops_getModuleHandler('article', $GLOBALS['moddirname']); |
40 | 40 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
41 | 41 | if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { |
42 | - $message = planet_constant('MD_NOACCESS'); |
|
42 | + $message = planet_constant('MD_NOACCESS'); |
|
43 | 43 | } else { |
44 | - $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
45 | - $ip = PlanetUtility::planetGetIP(); |
|
46 | - if ($article_id > 0) { |
|
47 | - $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
|
48 | - } else { |
|
49 | - $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
|
50 | - } |
|
51 | - if ($uid > 0) { |
|
52 | - $criteria->add(new Criteria('rate_uid', $uid)); |
|
53 | - } else { |
|
54 | - $criteria->add(new Criteria('rate_ip', $ip)); |
|
55 | - $criteria->add(new Criteria('rate_time', time() - 24 * 3600, '>')); |
|
56 | - } |
|
57 | - $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
|
58 | - if ($count = $rateHandler->getCount($criteria)) { |
|
59 | - $message = planet_constant('MD_ALREADYRATED'); |
|
60 | - } else { |
|
61 | - $rate_obj = $rateHandler->create(); |
|
62 | - if ($article_id > 0) { |
|
63 | - $rate_obj->setVar('art_id', $article_id); |
|
64 | - } else { |
|
65 | - $rate_obj->setVar('blog_id', $blog_id); |
|
66 | - } |
|
67 | - $rate_obj->setVar('rate_uid', $uid); |
|
68 | - $rate_obj->setVar('rate_ip', $ip); |
|
69 | - $rate_obj->setVar('rate_rating', $rate); |
|
70 | - $rate_obj->setVar('rate_time', time()); |
|
71 | - if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
|
72 | - redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
|
73 | - } |
|
74 | - if ($article_id > 0) { |
|
75 | - $article_obj = $articleHandler->get($article_id); |
|
76 | - $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
77 | - $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
78 | - $articleHandler->insert($article_obj, true); |
|
79 | - } else { |
|
80 | - $blog_obj = $blogHandler->get($blog_id); |
|
81 | - $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
82 | - $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
83 | - $blogHandler->insert($blog_obj, true); |
|
84 | - } |
|
85 | - $message = planet_constant('MD_ACTIONDONE'); |
|
86 | - } |
|
44 | + $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
45 | + $ip = PlanetUtility::planetGetIP(); |
|
46 | + if ($article_id > 0) { |
|
47 | + $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
|
48 | + } else { |
|
49 | + $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
|
50 | + } |
|
51 | + if ($uid > 0) { |
|
52 | + $criteria->add(new Criteria('rate_uid', $uid)); |
|
53 | + } else { |
|
54 | + $criteria->add(new Criteria('rate_ip', $ip)); |
|
55 | + $criteria->add(new Criteria('rate_time', time() - 24 * 3600, '>')); |
|
56 | + } |
|
57 | + $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
|
58 | + if ($count = $rateHandler->getCount($criteria)) { |
|
59 | + $message = planet_constant('MD_ALREADYRATED'); |
|
60 | + } else { |
|
61 | + $rate_obj = $rateHandler->create(); |
|
62 | + if ($article_id > 0) { |
|
63 | + $rate_obj->setVar('art_id', $article_id); |
|
64 | + } else { |
|
65 | + $rate_obj->setVar('blog_id', $blog_id); |
|
66 | + } |
|
67 | + $rate_obj->setVar('rate_uid', $uid); |
|
68 | + $rate_obj->setVar('rate_ip', $ip); |
|
69 | + $rate_obj->setVar('rate_rating', $rate); |
|
70 | + $rate_obj->setVar('rate_time', time()); |
|
71 | + if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
|
72 | + redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
|
73 | + } |
|
74 | + if ($article_id > 0) { |
|
75 | + $article_obj = $articleHandler->get($article_id); |
|
76 | + $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
77 | + $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
78 | + $articleHandler->insert($article_obj, true); |
|
79 | + } else { |
|
80 | + $blog_obj = $blogHandler->get($blog_id); |
|
81 | + $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
82 | + $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
83 | + $blogHandler->insert($blog_obj, true); |
|
84 | + } |
|
85 | + $message = planet_constant('MD_ACTIONDONE'); |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | if ($article_id > 0) { |
89 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
89 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
90 | 90 | } else { |
91 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
91 | + redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
92 | 92 | } |
93 | 93 | include __DIR__ . '/footer.php'; |
@@ -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 | $rate = Request::getInt('rate', Request::getInt('rate', 0, 'POST'), 'GET'); //(int)(!empty($_POST['rate']) ? $_POST['rate'] : (!empty($_GET['rate']) ? $_GET['rate'] : 0)); |
32 | 32 | $article_id = Request::getInt('article', Request::getInt('article', 0, 'POST'), 'GET'); //(int)(!empty($_POST['article']) ? $_POST['article'] : (!empty($_GET['article']) ? $_GET['article'] : 0)); |
@@ -40,28 +40,28 @@ discard block |
||
40 | 40 | $blogHandler = xoops_getModuleHandler('blog', $GLOBALS['moddirname']); |
41 | 41 | if (empty($xoopsModuleConfig['anonymous_rate']) && !is_object($xoopsUser)) { |
42 | 42 | $message = planet_constant('MD_NOACCESS'); |
43 | -} else { |
|
43 | +}else { |
|
44 | 44 | $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
45 | 45 | $ip = PlanetUtility::planetGetIP(); |
46 | - if ($article_id > 0) { |
|
46 | + if ($article_id>0) { |
|
47 | 47 | $criteria = new CriteriaCompo(new Criteria('art_id', $article_id)); |
48 | - } else { |
|
48 | + }else { |
|
49 | 49 | $criteria = new CriteriaCompo(new Criteria('blog_id', $blog_id)); |
50 | 50 | } |
51 | - if ($uid > 0) { |
|
51 | + if ($uid>0) { |
|
52 | 52 | $criteria->add(new Criteria('rate_uid', $uid)); |
53 | - } else { |
|
53 | + }else { |
|
54 | 54 | $criteria->add(new Criteria('rate_ip', $ip)); |
55 | - $criteria->add(new Criteria('rate_time', time() - 24 * 3600, '>')); |
|
55 | + $criteria->add(new Criteria('rate_time', time()-24*3600, '>')); |
|
56 | 56 | } |
57 | 57 | $rateHandler = xoops_getModuleHandler('rate', $GLOBALS['moddirname']); |
58 | 58 | if ($count = $rateHandler->getCount($criteria)) { |
59 | 59 | $message = planet_constant('MD_ALREADYRATED'); |
60 | - } else { |
|
60 | + }else { |
|
61 | 61 | $rate_obj = $rateHandler->create(); |
62 | - if ($article_id > 0) { |
|
62 | + if ($article_id>0) { |
|
63 | 63 | $rate_obj->setVar('art_id', $article_id); |
64 | - } else { |
|
64 | + }else { |
|
65 | 65 | $rate_obj->setVar('blog_id', $blog_id); |
66 | 66 | } |
67 | 67 | $rate_obj->setVar('rate_uid', $uid); |
@@ -71,23 +71,23 @@ discard block |
||
71 | 71 | if (!$rate_id = $rateHandler->insert($rate_obj, true)) { |
72 | 72 | redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_NOTSAVED')); |
73 | 73 | } |
74 | - if ($article_id > 0) { |
|
74 | + if ($article_id>0) { |
|
75 | 75 | $article_obj = $articleHandler->get($article_id); |
76 | - $article_obj->setVar('art_rating', $article_obj->getVar('art_rating') + $rate); |
|
77 | - $article_obj->setVar('art_rates', $article_obj->getVar('art_rates') + 1); |
|
76 | + $article_obj->setVar('art_rating', $article_obj->getVar('art_rating')+$rate); |
|
77 | + $article_obj->setVar('art_rates', $article_obj->getVar('art_rates')+1); |
|
78 | 78 | $articleHandler->insert($article_obj, true); |
79 | - } else { |
|
79 | + }else { |
|
80 | 80 | $blog_obj = $blogHandler->get($blog_id); |
81 | - $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating') + $rate); |
|
82 | - $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates') + 1); |
|
81 | + $blog_obj->setVar('blog_rating', $blog_obj->getVar('blog_rating')+$rate); |
|
82 | + $blog_obj->setVar('blog_rates', $blog_obj->getVar('blog_rates')+1); |
|
83 | 83 | $blogHandler->insert($blog_obj, true); |
84 | 84 | } |
85 | 85 | $message = planet_constant('MD_ACTIONDONE'); |
86 | 86 | } |
87 | 87 | } |
88 | -if ($article_id > 0) { |
|
89 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_id, 2, $message); |
|
90 | -} else { |
|
91 | - redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message); |
|
88 | +if ($article_id>0) { |
|
89 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_id, 2, $message); |
|
90 | +}else { |
|
91 | + redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message); |
|
92 | 92 | } |
93 | -include __DIR__ . '/footer.php'; |
|
93 | +include __DIR__.'/footer.php'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // ------------------------------------------------------------------------ // |
27 | 27 | |
28 | 28 | if (!defined('PLANET_INI')) { |
29 | - define('PLANET_INI', 1); |
|
29 | + define('PLANET_INI', 1); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | require_once __DIR__ . '/../class/utility.php'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | // include customized variables |
57 | 57 | if (is_object($GLOBALS['xoopsModule']) && $GLOBALS['moddirname'] == $GLOBALS['xoopsModule']->getVar('dirname', 'n')) { |
58 | - $GLOBALS['xoopsModuleConfig'] = planet_load_config(); |
|
58 | + $GLOBALS['xoopsModuleConfig'] = planet_load_config(); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | planet_load_object(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | define('PLANET_INI', 1); |
30 | 30 | } |
31 | 31 | |
32 | -require_once __DIR__ . '/../class/utility.php'; |
|
32 | +require_once __DIR__.'/../class/utility.php'; |
|
33 | 33 | /* |
34 | 34 | * The prefix for database table name prefix |
35 | 35 | * You can change to any term but be consistent with the table names in /sql/mysql.sql, and be unique , no conflict with other modules |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $GLOBALS['MOD_DB_PREFIX'] = 'planet'; |
38 | 38 | |
39 | 39 | /* You are not supposed to modify following contents */ |
40 | -defined('FRAMEWORKS_ART_FUNCTIONS_INI') || require_once XOOPS_ROOT_PATH . '/Frameworks/art/functions.ini.php'; |
|
40 | +defined('FRAMEWORKS_ART_FUNCTIONS_INI') || require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.ini.php'; |
|
41 | 41 | $GLOBALS['moddirname'] = mod_getDirname(__FILE__); |
42 | 42 | |
43 | 43 | /* |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * You can change to any term but be capital and unique, no conflict with other modules |
52 | 52 | */ |
53 | 53 | $GLOBALS['VAR_PREFIXU'] = strtoupper($GLOBALS['moddirname']); |
54 | -require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/functions.ini.php'; |
|
54 | +require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/functions.ini.php'; |
|
55 | 55 | |
56 | 56 | // include customized variables |
57 | 57 | if (is_object($GLOBALS['xoopsModule']) && $GLOBALS['moddirname'] == $GLOBALS['xoopsModule']->getVar('dirname', 'n')) { |