@@ -52,16 +52,14 @@ discard block |
||
52 | 52 | { |
53 | 53 | // Register pageview |
54 | 54 | $this->insertPageView($site_srl); |
55 | - } |
|
56 | - else // If unregistered IP |
|
55 | + } else // If unregistered IP |
|
57 | 56 | { |
58 | 57 | // Leave logs |
59 | 58 | $this->insertLog($site_srl); |
60 | 59 | // Register unique and pageview |
61 | 60 | $this->insertUniqueVisitor($site_srl); |
62 | 61 | } |
63 | - } |
|
64 | - else // Register today's row if not exist |
|
62 | + } else // Register today's row if not exist |
|
65 | 63 | { |
66 | 64 | $this->insertTodayStatus(0, $site_srl); |
67 | 65 | // check user if the previous row exists |
@@ -101,8 +99,7 @@ discard block |
||
101 | 99 | { |
102 | 100 | $args->site_srl = $site_srl; |
103 | 101 | $output = executeQuery('counter.updateSiteCounterUnique', $args); |
104 | - } |
|
105 | - else |
|
102 | + } else |
|
106 | 103 | { |
107 | 104 | $output = executeQuery('counter.updateCounterUnique', $args); |
108 | 105 | } |
@@ -123,8 +120,7 @@ discard block |
||
123 | 120 | { |
124 | 121 | $args->site_srl = $site_srl; |
125 | 122 | executeQuery('counter.updateSiteCounterPageview', $args); |
126 | - } |
|
127 | - else |
|
123 | + } else |
|
128 | 124 | { |
129 | 125 | executeQuery('counter.updateCounterPageview', $args); |
130 | 126 | } |
@@ -145,8 +141,7 @@ discard block |
||
145 | 141 | { |
146 | 142 | $args->site_srl = $site_srl; |
147 | 143 | executeQuery('counter.insertSiteTodayStatus', $args); |
148 | - } |
|
149 | - else |
|
144 | + } else |
|
150 | 145 | { |
151 | 146 | executeQuery('counter.insertTodayStatus', $args); |
152 | 147 | } |
@@ -165,8 +160,7 @@ discard block |
||
165 | 160 | if($regdate) |
166 | 161 | { |
167 | 162 | $args->regdate = $regdate; |
168 | - } |
|
169 | - else |
|
163 | + } else |
|
170 | 164 | { |
171 | 165 | $args->regdate = date("Ymd"); |
172 | 166 | } |
@@ -178,8 +172,7 @@ discard block |
||
178 | 172 | |
179 | 173 | $u_args->site_srl = $site_srl; // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together |
180 | 174 | executeQuery($query_id, $u_args); |
181 | - } |
|
182 | - else |
|
175 | + } else |
|
183 | 176 | { |
184 | 177 | $query_id = 'counter.insertTodayStatus'; |
185 | 178 | executeQuery($query_id); // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | // Check the logs |
47 | 47 | $oCounterModel = getModel('counter'); |
48 | 48 | |
49 | - if($oCounterModel->isInsertedTodayStatus($site_srl)) |
|
49 | + if ($oCounterModel->isInsertedTodayStatus($site_srl)) |
|
50 | 50 | { |
51 | - if($oCounterModel->isLogged($site_srl)) |
|
51 | + if ($oCounterModel->isLogged($site_srl)) |
|
52 | 52 | { |
53 | 53 | // Register pageview |
54 | 54 | $this->insertPageView($site_srl); |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | function insertUniqueVisitor($site_srl = 0) |
96 | 96 | { |
97 | 97 | $args = new stdClass(); |
98 | - $args->regdate = '0,' . date('Ymd'); |
|
98 | + $args->regdate = '0,'.date('Ymd'); |
|
99 | 99 | |
100 | - if($site_srl) |
|
100 | + if ($site_srl) |
|
101 | 101 | { |
102 | 102 | $args->site_srl = $site_srl; |
103 | 103 | $output = executeQuery('counter.updateSiteCounterUnique', $args); |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | function insertPageView($site_srl = 0) |
118 | 118 | { |
119 | 119 | $args = new stdClass; |
120 | - $args->regdate = '0,' . date('Ymd'); |
|
120 | + $args->regdate = '0,'.date('Ymd'); |
|
121 | 121 | |
122 | - if($site_srl) |
|
122 | + if ($site_srl) |
|
123 | 123 | { |
124 | 124 | $args->site_srl = $site_srl; |
125 | 125 | executeQuery('counter.updateSiteCounterPageview', $args); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $args = new stdClass(); |
142 | 142 | $args->regdate = 0; |
143 | 143 | |
144 | - if($site_srl) |
|
144 | + if ($site_srl) |
|
145 | 145 | { |
146 | 146 | $args->site_srl = $site_srl; |
147 | 147 | executeQuery('counter.insertSiteTodayStatus', $args); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | function insertTodayStatus($regdate = 0, $site_srl = 0) |
163 | 163 | { |
164 | 164 | $args = new stdClass(); |
165 | - if($regdate) |
|
165 | + if ($regdate) |
|
166 | 166 | { |
167 | 167 | $args->regdate = $regdate; |
168 | 168 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $args->regdate = date("Ymd"); |
172 | 172 | } |
173 | 173 | |
174 | - if($site_srl) |
|
174 | + if ($site_srl) |
|
175 | 175 | { |
176 | 176 | $args->site_srl = $site_srl; |
177 | 177 | $query_id = 'counter.insertSiteTodayStatus'; |
@@ -42,7 +42,9 @@ discard block |
||
42 | 42 | if($iplogged === false) |
43 | 43 | { |
44 | 44 | $output = executeQuery('counter.getCounterLog', $args); |
45 | - if($output->data->count) $iplogged = TRUE; |
|
45 | + if($output->data->count) { |
|
46 | + $iplogged = TRUE; |
|
47 | + } |
|
46 | 48 | } |
47 | 49 | |
48 | 50 | if($iplogged && $oCacheHandler->isSupport()) |
@@ -78,8 +80,7 @@ discard block |
||
78 | 80 | { |
79 | 81 | $args->site_srl = $site_srl; |
80 | 82 | $output = executeQuery('counter.getSiteTodayStatus', $args); |
81 | - } |
|
82 | - else |
|
83 | + } else |
|
83 | 84 | { |
84 | 85 | $output = executeQuery('counter.getTodayStatus', $args); |
85 | 86 | } |
@@ -113,8 +114,7 @@ discard block |
||
113 | 114 | { |
114 | 115 | $args->site_srl = $site_srl; |
115 | 116 | $output = executeQuery('counter.getSiteCounterStatusDays', $args); |
116 | - } |
|
117 | - else |
|
117 | + } else |
|
118 | 118 | { |
119 | 119 | $output = executeQuery('counter.getCounterStatusDays', $args); |
120 | 120 | } |
@@ -125,7 +125,9 @@ discard block |
||
125 | 125 | return $status; |
126 | 126 | } |
127 | 127 | |
128 | - if(!is_array($status)) $status = array($status); |
|
128 | + if(!is_array($status)) { |
|
129 | + $status = array($status); |
|
130 | + } |
|
129 | 131 | $output = array(); |
130 | 132 | foreach($status as $val) |
131 | 133 | { |
@@ -157,8 +159,7 @@ discard block |
||
157 | 159 | $args = new stdClass(); |
158 | 160 | $args->site_srl = $site_srl; |
159 | 161 | $output = executeQuery('counter.getSiteStartLogDate', $args); |
160 | - } |
|
161 | - else |
|
162 | + } else |
|
162 | 163 | { |
163 | 164 | $output = executeQuery('counter.getStartLogDate'); |
164 | 165 | } |
@@ -178,8 +179,7 @@ discard block |
||
178 | 179 | { |
179 | 180 | $args->site_srl = $site_srl; |
180 | 181 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
181 | - } |
|
182 | - else |
|
182 | + } else |
|
183 | 183 | { |
184 | 184 | $output = executeQuery('counter.getCounterStatus', $args); |
185 | 185 | } |
@@ -187,7 +187,9 @@ discard block |
||
187 | 187 | $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
188 | 188 | $status->list[$i] = $count; |
189 | 189 | |
190 | - if($count > $max) $max = $count; |
|
190 | + if($count > $max) { |
|
191 | + $max = $count; |
|
192 | + } |
|
191 | 193 | |
192 | 194 | $sum += $count; |
193 | 195 | } |
@@ -224,8 +226,7 @@ discard block |
||
224 | 226 | { |
225 | 227 | $args->site_srl = $site_srl; |
226 | 228 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
227 | - } |
|
228 | - else |
|
229 | + } else |
|
229 | 230 | { |
230 | 231 | $output = executeQuery('counter.getCounterStatus', $args); |
231 | 232 | } |
@@ -233,7 +234,9 @@ discard block |
||
233 | 234 | $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
234 | 235 | $status->list[$day] = $count; |
235 | 236 | |
236 | - if($count > $max) $max = $count; |
|
237 | + if($count > $max) { |
|
238 | + $max = $count; |
|
239 | + } |
|
237 | 240 | |
238 | 241 | $sum += $count; |
239 | 242 | } |
@@ -251,8 +254,7 @@ discard block |
||
251 | 254 | { |
252 | 255 | $args->site_srl = $site_srl; |
253 | 256 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
254 | - } |
|
255 | - else |
|
257 | + } else |
|
256 | 258 | { |
257 | 259 | $output = executeQuery('counter.getCounterStatus', $args); |
258 | 260 | } |
@@ -260,7 +262,9 @@ discard block |
||
260 | 262 | $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
261 | 263 | $status->list[$i] = $count; |
262 | 264 | |
263 | - if($count > $max) $max = $count; |
|
265 | + if($count > $max) { |
|
266 | + $max = $count; |
|
267 | + } |
|
264 | 268 | |
265 | 269 | $sum += $count; |
266 | 270 | } |
@@ -277,8 +281,7 @@ discard block |
||
277 | 281 | { |
278 | 282 | $args->site_srl = $site_srl; |
279 | 283 | $output = executeQuery('counter.getSiteCounterLogStatus', $args); |
280 | - } |
|
281 | - else |
|
284 | + } else |
|
282 | 285 | { |
283 | 286 | $args->site_srl = 0; |
284 | 287 | $output = executeQuery('counter.getCounterLogStatus', $args); |
@@ -287,7 +290,9 @@ discard block |
||
287 | 290 | $count = (int) $output->data->count; |
288 | 291 | $status->list[$i] = $count; |
289 | 292 | |
290 | - if($count > $max) $max = $count; |
|
293 | + if($count > $max) { |
|
294 | + $max = $count; |
|
295 | + } |
|
291 | 296 | |
292 | 297 | $sum += $count; |
293 | 298 | } |
@@ -308,8 +313,7 @@ discard block |
||
308 | 313 | { |
309 | 314 | $args->site_srl = $site_srl; |
310 | 315 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
311 | - } |
|
312 | - else |
|
316 | + } else |
|
313 | 317 | { |
314 | 318 | $output = executeQuery('counter.getCounterStatus', $args); |
315 | 319 | } |
@@ -317,7 +321,9 @@ discard block |
||
317 | 321 | $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
318 | 322 | $status->list[$i] = $count; |
319 | 323 | |
320 | - if($count > $max) $max = $count; |
|
324 | + if($count > $max) { |
|
325 | + $max = $count; |
|
326 | + } |
|
321 | 327 | |
322 | 328 | $sum += $count; |
323 | 329 | } |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | |
33 | 33 | $iplogged = false; |
34 | 34 | $oCacheHandler = CacheHandler::getInstance('object'); |
35 | - if($oCacheHandler->isSupport()) |
|
35 | + if ($oCacheHandler->isSupport()) |
|
36 | 36 | { |
37 | - $object_key = 'counter:' . $site_srl . '_' . str_replace(array('.', ':'), '-', $args->ipaddress); |
|
38 | - $cache_key = $oCacheHandler->getGroupKey('counterIpLogged_' . $args->regdate, $object_key); |
|
37 | + $object_key = 'counter:'.$site_srl.'_'.str_replace(array('.', ':'), '-', $args->ipaddress); |
|
38 | + $cache_key = $oCacheHandler->getGroupKey('counterIpLogged_'.$args->regdate, $object_key); |
|
39 | 39 | $iplogged = $oCacheHandler->get($cache_key); |
40 | 40 | } |
41 | 41 | |
42 | - if($iplogged === false) |
|
42 | + if ($iplogged === false) |
|
43 | 43 | { |
44 | 44 | $output = executeQuery('counter.getCounterLog', $args); |
45 | - if($output->data->count) $iplogged = TRUE; |
|
45 | + if ($output->data->count) $iplogged = TRUE; |
|
46 | 46 | } |
47 | 47 | |
48 | - if($iplogged && $oCacheHandler->isSupport()) |
|
48 | + if ($iplogged && $oCacheHandler->isSupport()) |
|
49 | 49 | { |
50 | 50 | $oCacheHandler->put($cache_key, $iplogged); |
51 | 51 | } |
@@ -66,15 +66,15 @@ discard block |
||
66 | 66 | |
67 | 67 | $insertedTodayStatus = false; |
68 | 68 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
69 | - if($oCacheHandler->isSupport()) |
|
69 | + if ($oCacheHandler->isSupport()) |
|
70 | 70 | { |
71 | - $cache_key = 'counter:insertedTodayStatus:' . $site_srl . '_' . $args->regdate; |
|
71 | + $cache_key = 'counter:insertedTodayStatus:'.$site_srl.'_'.$args->regdate; |
|
72 | 72 | $insertedTodayStatus = $oCacheHandler->get($cache_key); |
73 | 73 | } |
74 | 74 | |
75 | - if($insertedTodayStatus === false) |
|
75 | + if ($insertedTodayStatus === false) |
|
76 | 76 | { |
77 | - if($site_srl) |
|
77 | + if ($site_srl) |
|
78 | 78 | { |
79 | 79 | $args->site_srl = $site_srl; |
80 | 80 | $output = executeQuery('counter.getSiteTodayStatus', $args); |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | |
87 | 87 | $insertedTodayStatus = !!$output->data->count; |
88 | 88 | |
89 | - if($insertedTodayStatus && $oCacheHandler->isSupport()) |
|
89 | + if ($insertedTodayStatus && $oCacheHandler->isSupport()) |
|
90 | 90 | { |
91 | 91 | $oCacheHandler->put($cache_key, TRUE); |
92 | 92 | $_old_date = date('Ymd', strtotime('-1 day')); |
93 | - $oCacheHandler->delete('counter:insertedTodayStatus:' . $site_srl . '_' . $_old_date); |
|
93 | + $oCacheHandler->delete('counter:insertedTodayStatus:'.$site_srl.'_'.$_old_date); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | // If more than one date logs are selected |
110 | 110 | $args = new stdClass(); |
111 | 111 | $args->regdate = is_array($selected_date) ? join(',', $selected_date) : $selected_date; |
112 | - if($site_srl) |
|
112 | + if ($site_srl) |
|
113 | 113 | { |
114 | 114 | $args->site_srl = $site_srl; |
115 | 115 | $output = executeQuery('counter.getSiteCounterStatusDays', $args); |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | } |
121 | 121 | $status = $output->data; |
122 | 122 | |
123 | - if(!is_array($selected_date)) |
|
123 | + if (!is_array($selected_date)) |
|
124 | 124 | { |
125 | 125 | return $status; |
126 | 126 | } |
127 | 127 | |
128 | - if(!is_array($status)) $status = array($status); |
|
128 | + if (!is_array($status)) $status = array($status); |
|
129 | 129 | $output = array(); |
130 | - foreach($status as $val) |
|
130 | + foreach ($status as $val) |
|
131 | 131 | { |
132 | 132 | $output[substr($val->regdate, 0, 8)] = $val; |
133 | 133 | } |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $max = 0; |
149 | 149 | $sum = 0; |
150 | 150 | |
151 | - switch($type) |
|
151 | + switch ($type) |
|
152 | 152 | { |
153 | 153 | case 'year' : |
154 | 154 | // Get a date to start counting |
155 | - if($site_srl) |
|
155 | + if ($site_srl) |
|
156 | 156 | { |
157 | 157 | $args = new stdClass(); |
158 | 158 | $args->site_srl = $site_srl; |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | $output = executeQuery('counter.getStartLogDate'); |
164 | 164 | } |
165 | 165 | |
166 | - if(!($start_year = substr($output->data->regdate, 0, 4))) |
|
166 | + if (!($start_year = substr($output->data->regdate, 0, 4))) |
|
167 | 167 | { |
168 | 168 | $start_year = date("Y"); |
169 | 169 | } |
170 | 170 | |
171 | - for($i = $start_year, $y = date("Y"); $i <= $y; $i++) |
|
171 | + for ($i = $start_year, $y = date("Y"); $i <= $y; $i++) |
|
172 | 172 | { |
173 | 173 | $args = new stdClass(); |
174 | 174 | $args->start_date = sprintf('%04d0000', $i); |
175 | 175 | $args->end_date = sprintf('%04d1231', $i); |
176 | 176 | |
177 | - if($site_srl) |
|
177 | + if ($site_srl) |
|
178 | 178 | { |
179 | 179 | $args->site_srl = $site_srl; |
180 | 180 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
@@ -184,10 +184,10 @@ discard block |
||
184 | 184 | $output = executeQuery('counter.getCounterStatus', $args); |
185 | 185 | } |
186 | 186 | |
187 | - $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
187 | + $count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
188 | 188 | $status->list[$i] = $count; |
189 | 189 | |
190 | - if($count > $max) $max = $count; |
|
190 | + if ($count > $max) $max = $count; |
|
191 | 191 | |
192 | 192 | $sum += $count; |
193 | 193 | } |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | $time = strtotime($selected_date); |
198 | 198 | $w = date("D"); |
199 | 199 | |
200 | - while(date("D", $time) != "Sun") |
|
200 | + while (date("D", $time) != "Sun") |
|
201 | 201 | { |
202 | 202 | $time += 60 * 60 * 24; |
203 | 203 | } |
204 | 204 | |
205 | 205 | $time -= 60 * 60 * 24; |
206 | 206 | |
207 | - while(date("D", $time) != "Sun") |
|
207 | + while (date("D", $time) != "Sun") |
|
208 | 208 | { |
209 | 209 | $thisWeek[] = date("Ymd", $time); |
210 | 210 | $time -= 60 * 60 * 24; |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | |
215 | 215 | asort($thisWeek); |
216 | 216 | |
217 | - foreach($thisWeek as $day) |
|
217 | + foreach ($thisWeek as $day) |
|
218 | 218 | { |
219 | 219 | $args = new stdClass(); |
220 | 220 | $args->start_date = $day; |
221 | 221 | $args->end_date = $day; |
222 | 222 | |
223 | - if($site_srl) |
|
223 | + if ($site_srl) |
|
224 | 224 | { |
225 | 225 | $args->site_srl = $site_srl; |
226 | 226 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | $output = executeQuery('counter.getCounterStatus', $args); |
231 | 231 | } |
232 | 232 | |
233 | - $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
233 | + $count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
234 | 234 | $status->list[$day] = $count; |
235 | 235 | |
236 | - if($count > $max) $max = $count; |
|
236 | + if ($count > $max) $max = $count; |
|
237 | 237 | |
238 | 238 | $sum += $count; |
239 | 239 | } |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | |
242 | 242 | case 'month' : |
243 | 243 | $year = substr($selected_date, 0, 4); |
244 | - for($i = 1; $i <= 12; $i++) |
|
244 | + for ($i = 1; $i <= 12; $i++) |
|
245 | 245 | { |
246 | 246 | $args = new stdClass(); |
247 | 247 | $args->start_date = sprintf('%04d%02d00', $year, $i); |
248 | 248 | $args->end_date = sprintf('%04d%02d31', $year, $i); |
249 | 249 | |
250 | - if($site_srl) |
|
250 | + if ($site_srl) |
|
251 | 251 | { |
252 | 252 | $args->site_srl = $site_srl; |
253 | 253 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
@@ -257,23 +257,23 @@ discard block |
||
257 | 257 | $output = executeQuery('counter.getCounterStatus', $args); |
258 | 258 | } |
259 | 259 | |
260 | - $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
260 | + $count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
261 | 261 | $status->list[$i] = $count; |
262 | 262 | |
263 | - if($count > $max) $max = $count; |
|
263 | + if ($count > $max) $max = $count; |
|
264 | 264 | |
265 | 265 | $sum += $count; |
266 | 266 | } |
267 | 267 | break; |
268 | 268 | |
269 | 269 | case 'hour' : |
270 | - for($i = 0; $i < 24; $i++) |
|
270 | + for ($i = 0; $i < 24; $i++) |
|
271 | 271 | { |
272 | 272 | $args = new stdClass(); |
273 | 273 | $args->start_date = sprintf('%08d%02d0000', $selected_date, $i); |
274 | 274 | $args->end_date = sprintf('%08d%02d5959', $selected_date, $i); |
275 | 275 | |
276 | - if($site_srl) |
|
276 | + if ($site_srl) |
|
277 | 277 | { |
278 | 278 | $args->site_srl = $site_srl; |
279 | 279 | $output = executeQuery('counter.getSiteCounterLogStatus', $args); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $count = (int) $output->data->count; |
288 | 288 | $status->list[$i] = $count; |
289 | 289 | |
290 | - if($count > $max) $max = $count; |
|
290 | + if ($count > $max) $max = $count; |
|
291 | 291 | |
292 | 292 | $sum += $count; |
293 | 293 | } |
@@ -298,13 +298,13 @@ discard block |
||
298 | 298 | $month = substr($selected_date, 4, 2); |
299 | 299 | $end_day = date('t', mktime(0, 0, 0, $month, 1, $year)); |
300 | 300 | |
301 | - for($i = 1; $i <= $end_day; $i++) |
|
301 | + for ($i = 1; $i <= $end_day; $i++) |
|
302 | 302 | { |
303 | 303 | $args = new stdClass(); |
304 | 304 | $args->start_date = sprintf('%04d%02d%02d', $year, $month, $i); |
305 | 305 | $args->end_date = sprintf('%04d%02d%02d', $year, $month, $i); |
306 | 306 | |
307 | - if($site_srl) |
|
307 | + if ($site_srl) |
|
308 | 308 | { |
309 | 309 | $args->site_srl = $site_srl; |
310 | 310 | $output = executeQuery('counter.getSiteCounterStatus', $args); |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | $output = executeQuery('counter.getCounterStatus', $args); |
315 | 315 | } |
316 | 316 | |
317 | - $count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
317 | + $count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor); |
|
318 | 318 | $status->list[$i] = $count; |
319 | 319 | |
320 | - if($count > $max) $max = $count; |
|
320 | + if ($count > $max) $max = $count; |
|
321 | 321 | |
322 | 322 | $sum += $count; |
323 | 323 | } |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | $output1 = $this->getHourlyStatus('week', $date1); |
338 | 338 | |
339 | 339 | $tmp = array(); |
340 | - foreach($output1->list as $key => $value) |
|
340 | + foreach ($output1->list as $key => $value) |
|
341 | 341 | { |
342 | - $tmp["'" . $key . "'"] = $value; |
|
342 | + $tmp["'".$key."'"] = $value; |
|
343 | 343 | } |
344 | 344 | $output1->list = $tmp; |
345 | 345 | |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | $output2 = $this->getHourlyStatus('week', $date2); |
349 | 349 | |
350 | 350 | $tmp = array(); |
351 | - foreach($output2->list as $key => $value) |
|
351 | + foreach ($output2->list as $key => $value) |
|
352 | 352 | { |
353 | - $tmp["'" . $key . "'"] = $value; |
|
353 | + $tmp["'".$key."'"] = $value; |
|
354 | 354 | } |
355 | 355 | $output2->list = $tmp; |
356 | 356 | |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | $output1 = $this->getHourlyStatus('week', $date1, 0, TRUE); |
366 | 366 | |
367 | 367 | $tmp = array(); |
368 | - foreach($output1->list as $key => $value) |
|
368 | + foreach ($output1->list as $key => $value) |
|
369 | 369 | { |
370 | - $tmp["'" . $key . "'"] = $value; |
|
370 | + $tmp["'".$key."'"] = $value; |
|
371 | 371 | } |
372 | 372 | $output1->list = $tmp; |
373 | 373 | |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $output2 = $this->getHourlyStatus('week', $date2, 0, TRUE); |
377 | 377 | |
378 | 378 | $tmp = array(); |
379 | - foreach($output2->list as $key => $value) |
|
379 | + foreach ($output2->list as $key => $value) |
|
380 | 380 | { |
381 | - $tmp["'" . $key . "'"] = $value; |
|
381 | + $tmp["'".$key."'"] = $value; |
|
382 | 382 | } |
383 | 383 | $output2->list = $tmp; |
384 | 384 |
@@ -721,10 +721,10 @@ |
||
721 | 721 | } |
722 | 722 | |
723 | 723 | /** |
724 | - * @fn procDocumentAdminMoveToTrash |
|
725 | - * @brief move a document to trash. |
|
726 | - * @see documentModel::getDocumentMenu |
|
727 | - */ |
|
724 | + * @fn procDocumentAdminMoveToTrash |
|
725 | + * @brief move a document to trash. |
|
726 | + * @see documentModel::getDocumentMenu |
|
727 | + */ |
|
728 | 728 | function procDocumentAdminMoveToTrash() |
729 | 729 | { |
730 | 730 | $document_srl = Context::get('document_srl'); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Remove the selected docs from admin page |
24 | - * @return void |
|
24 | + * @return ModuleObject|null |
|
25 | 25 | */ |
26 | 26 | function procDocumentAdminDeleteChecked() |
27 | 27 | { |
@@ -869,8 +869,8 @@ discard block |
||
869 | 869 | /** |
870 | 870 | * Restore document from trash module, called by trash module |
871 | 871 | * This method is passived |
872 | - * @param object|array $originObject |
|
873 | - * @return object |
|
872 | + * @param string $originObject |
|
873 | + * @return BaseObject |
|
874 | 874 | */ |
875 | 875 | function restoreTrash($originObject) |
876 | 876 | { |
@@ -27,16 +27,22 @@ discard block |
||
27 | 27 | { |
28 | 28 | // error appears if no doc is selected |
29 | 29 | $cart = Context::get('cart'); |
30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
30 | + if(!$cart) { |
|
31 | + return $this->stop('msg_cart_is_null'); |
|
32 | + } |
|
31 | 33 | $document_srl_list= explode('|@|', $cart); |
32 | 34 | $document_count = count($document_srl_list); |
33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
35 | + if(!$document_count) { |
|
36 | + return $this->stop('msg_cart_is_null'); |
|
37 | + } |
|
34 | 38 | // Delete a doc |
35 | 39 | $oDocumentController = getController('document'); |
36 | 40 | for($i=0;$i<$document_count;$i++) |
37 | 41 | { |
38 | 42 | $document_srl = trim($document_srl_list[$i]); |
39 | - if(!$document_srl) continue; |
|
43 | + if(!$document_srl) { |
|
44 | + continue; |
|
45 | + } |
|
40 | 46 | |
41 | 47 | $oDocumentController->deleteDocument($document_srl, true); |
42 | 48 | } |
@@ -53,7 +59,9 @@ discard block |
||
53 | 59 | */ |
54 | 60 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
55 | 61 | { |
56 | - if(!count($document_srl_list)) return; |
|
62 | + if(!count($document_srl_list)) { |
|
63 | + return; |
|
64 | + } |
|
57 | 65 | |
58 | 66 | $oDocumentModel = getModel('document'); |
59 | 67 | $oDocumentController = getController('document'); |
@@ -79,7 +87,9 @@ discard block |
||
79 | 87 | { |
80 | 88 | $document_srl = $document_srl_list[$i]; |
81 | 89 | $oDocument = $oDocumentModel->getDocument($document_srl); |
82 | - if(!$oDocument->isExists()) continue; |
|
90 | + if(!$oDocument->isExists()) { |
|
91 | + continue; |
|
92 | + } |
|
83 | 93 | |
84 | 94 | $triggerObj->source_module_srl[$document_srl] = $oDocument->get('module_srl'); |
85 | 95 | |
@@ -117,8 +127,7 @@ discard block |
||
117 | 127 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
118 | 128 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
119 | 129 | // For binary files |
120 | - } |
|
121 | - else |
|
130 | + } else |
|
122 | 131 | { |
123 | 132 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
124 | 133 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -155,8 +164,12 @@ discard block |
||
155 | 164 | // Set 0 if a new category doesn't exist after catergory change |
156 | 165 | if($source_category_srl != $category_srl) |
157 | 166 | { |
158 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
159 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
167 | + if($source_category_srl) { |
|
168 | + $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
169 | + } |
|
170 | + if($category_srl) { |
|
171 | + $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
172 | + } |
|
160 | 173 | } |
161 | 174 | } |
162 | 175 | |
@@ -227,7 +240,9 @@ discard block |
||
227 | 240 | */ |
228 | 241 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
229 | 242 | { |
230 | - if(count($document_srl_list) < 1) return; |
|
243 | + if(count($document_srl_list) < 1) { |
|
244 | + return; |
|
245 | + } |
|
231 | 246 | |
232 | 247 | $oDocumentModel = getModel('document'); |
233 | 248 | $oDocumentController = getController('document'); |
@@ -268,7 +283,9 @@ discard block |
||
268 | 283 | { |
269 | 284 | $document_srl = $document_srl_list[$i]; |
270 | 285 | $oDocument = $oDocumentModel->getDocument($document_srl); |
271 | - if(!$oDocument->isExists()) continue; |
|
286 | + if(!$oDocument->isExists()) { |
|
287 | + continue; |
|
288 | + } |
|
272 | 289 | |
273 | 290 | $obj = $oDocument->getObjectVars(); |
274 | 291 | |
@@ -279,7 +296,9 @@ discard block |
||
279 | 296 | { |
280 | 297 | foreach($extraVars as $extraItem) |
281 | 298 | { |
282 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
299 | + if($extraItem->var_idx >= 0) { |
|
300 | + $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
301 | + } |
|
283 | 302 | } |
284 | 303 | } |
285 | 304 | } |
@@ -308,8 +327,7 @@ discard block |
||
308 | 327 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
309 | 328 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
310 | 329 | // If binary file |
311 | - } |
|
312 | - else |
|
330 | + } else |
|
313 | 331 | { |
314 | 332 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
315 | 333 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -376,8 +394,7 @@ discard block |
||
376 | 394 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
377 | 395 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
378 | 396 | // If binary file |
379 | - } |
|
380 | - else |
|
397 | + } else |
|
381 | 398 | { |
382 | 399 | $comment_obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $comment_obj->content); |
383 | 400 | $comment_obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $comment_obj->content); |
@@ -389,10 +406,14 @@ discard block |
||
389 | 406 | $comment_obj->document_srl = $obj->document_srl; |
390 | 407 | $comment_obj->comment_srl = $comment_srl; |
391 | 408 | |
392 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
409 | + if($comment_obj->parent_srl) { |
|
410 | + $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
411 | + } |
|
393 | 412 | |
394 | 413 | $output = $oCommentController->insertComment($comment_obj, true); |
395 | - if($output->toBool()) $success_count ++; |
|
414 | + if($output->toBool()) { |
|
415 | + $success_count ++; |
|
416 | + } |
|
396 | 417 | } |
397 | 418 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
398 | 419 | } |
@@ -412,7 +433,9 @@ discard block |
||
412 | 433 | $trackback_obj->module_srl = $obj->module_srl; |
413 | 434 | $trackback_obj->document_srl = $obj->document_srl; |
414 | 435 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
415 | - if($output->toBool()) $success_count++; |
|
436 | + if($output->toBool()) { |
|
437 | + $success_count++; |
|
438 | + } |
|
416 | 439 | } |
417 | 440 | // Update the number of trackbacks |
418 | 441 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -510,7 +533,9 @@ discard block |
||
510 | 533 | { |
511 | 534 | $args->document_srl = $document_srl; |
512 | 535 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
513 | - if(!$output->toBool()) return $output; |
|
536 | + if(!$output->toBool()) { |
|
537 | + return $output; |
|
538 | + } |
|
514 | 539 | } |
515 | 540 | } |
516 | 541 | |
@@ -541,7 +566,9 @@ discard block |
||
541 | 566 | if (is_dir($path."/".$entry)) { |
542 | 567 | $this->deleteThumbnailFile($path."/".$entry); |
543 | 568 | } else { |
544 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
569 | + if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) { |
|
570 | + continue; |
|
571 | + } |
|
545 | 572 | FileHandler::removeFile($path.'/'.$entry); |
546 | 573 | } |
547 | 574 | } |
@@ -566,7 +593,9 @@ discard block |
||
566 | 593 | $eid = Context::get('eid'); |
567 | 594 | $obj = new stdClass(); |
568 | 595 | |
569 | - if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
596 | + if(!$module_srl || !$name || !$eid) { |
|
597 | + return new BaseObject(-1,'msg_invalid_request'); |
|
598 | + } |
|
570 | 599 | // set the max value if idx is not specified |
571 | 600 | if(!$var_idx) |
572 | 601 | { |
@@ -588,7 +617,9 @@ discard block |
||
588 | 617 | // insert or update |
589 | 618 | $oDocumentController = getController('document'); |
590 | 619 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
591 | - if(!$output->toBool()) return $output; |
|
620 | + if(!$output->toBool()) { |
|
621 | + return $output; |
|
622 | + } |
|
592 | 623 | |
593 | 624 | $this->setMessage('success_registed'); |
594 | 625 | |
@@ -604,11 +635,15 @@ discard block |
||
604 | 635 | { |
605 | 636 | $module_srl = Context::get('module_srl'); |
606 | 637 | $var_idx = Context::get('var_idx'); |
607 | - if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
638 | + if(!$module_srl || !$var_idx) { |
|
639 | + return new BaseObject(-1,'msg_invalid_request'); |
|
640 | + } |
|
608 | 641 | |
609 | 642 | $oDocumentController = getController('document'); |
610 | 643 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
611 | - if(!$output->toBool()) return $output; |
|
644 | + if(!$output->toBool()) { |
|
645 | + return $output; |
|
646 | + } |
|
612 | 647 | |
613 | 648 | $this->setMessage('success_deleted'); |
614 | 649 | } |
@@ -623,26 +658,41 @@ discard block |
||
623 | 658 | $module_srl = Context::get('module_srl'); |
624 | 659 | $var_idx = Context::get('var_idx'); |
625 | 660 | |
626 | - if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
661 | + if(!$type || !$module_srl || !$var_idx) { |
|
662 | + return new BaseObject(-1,'msg_invalid_request'); |
|
663 | + } |
|
627 | 664 | |
628 | 665 | $oModuleModel = getModel('module'); |
629 | 666 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
630 | - if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
667 | + if(!$module_info->module_srl) { |
|
668 | + return new BaseObject(-1,'msg_invalid_request'); |
|
669 | + } |
|
631 | 670 | |
632 | 671 | $oDocumentModel = getModel('document'); |
633 | 672 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
634 | - if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request'); |
|
673 | + if(!$extra_keys[$var_idx]) { |
|
674 | + return new BaseObject(-1,'msg_invalid_request'); |
|
675 | + } |
|
635 | 676 | |
636 | - if($type == 'up') $new_idx = $var_idx-1; |
|
637 | - else $new_idx = $var_idx+1; |
|
638 | - if($new_idx<1) return new BaseObject(-1,'msg_invalid_request'); |
|
677 | + if($type == 'up') { |
|
678 | + $new_idx = $var_idx-1; |
|
679 | + } else { |
|
680 | + $new_idx = $var_idx+1; |
|
681 | + } |
|
682 | + if($new_idx<1) { |
|
683 | + return new BaseObject(-1,'msg_invalid_request'); |
|
684 | + } |
|
639 | 685 | |
640 | 686 | $args = new stdClass(); |
641 | 687 | $args->module_srl = $module_srl; |
642 | 688 | $args->var_idx = $new_idx; |
643 | 689 | $output = executeQuery('document.getDocumentExtraKeys', $args); |
644 | - if (!$output->toBool()) return $output; |
|
645 | - if (!$output->data) return new BaseObject(-1, 'msg_invalid_request'); |
|
690 | + if (!$output->toBool()) { |
|
691 | + return $output; |
|
692 | + } |
|
693 | + if (!$output->data) { |
|
694 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
695 | + } |
|
646 | 696 | unset($args); |
647 | 697 | |
648 | 698 | // update immediately if there is no idx to change |
@@ -653,35 +703,50 @@ discard block |
||
653 | 703 | $args->var_idx = $var_idx; |
654 | 704 | $args->new_idx = $new_idx; |
655 | 705 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
656 | - if(!$output->toBool()) return $output; |
|
706 | + if(!$output->toBool()) { |
|
707 | + return $output; |
|
708 | + } |
|
657 | 709 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
658 | - if(!$output->toBool()) return $output; |
|
710 | + if(!$output->toBool()) { |
|
711 | + return $output; |
|
712 | + } |
|
659 | 713 | // replace if exists |
660 | - } |
|
661 | - else |
|
714 | + } else |
|
662 | 715 | { |
663 | 716 | $args = new stdClass(); |
664 | 717 | $args->module_srl = $module_srl; |
665 | 718 | $args->var_idx = $new_idx; |
666 | 719 | $args->new_idx = -10000; |
667 | 720 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
668 | - if(!$output->toBool()) return $output; |
|
721 | + if(!$output->toBool()) { |
|
722 | + return $output; |
|
723 | + } |
|
669 | 724 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
670 | - if(!$output->toBool()) return $output; |
|
725 | + if(!$output->toBool()) { |
|
726 | + return $output; |
|
727 | + } |
|
671 | 728 | |
672 | 729 | $args->var_idx = $var_idx; |
673 | 730 | $args->new_idx = $new_idx; |
674 | 731 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
675 | - if(!$output->toBool()) return $output; |
|
732 | + if(!$output->toBool()) { |
|
733 | + return $output; |
|
734 | + } |
|
676 | 735 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
677 | - if(!$output->toBool()) return $output; |
|
736 | + if(!$output->toBool()) { |
|
737 | + return $output; |
|
738 | + } |
|
678 | 739 | |
679 | 740 | $args->var_idx = -10000; |
680 | 741 | $args->new_idx = $var_idx; |
681 | 742 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
682 | - if(!$output->toBool()) return $output; |
|
743 | + if(!$output->toBool()) { |
|
744 | + return $output; |
|
745 | + } |
|
683 | 746 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
684 | - if(!$output->toBool()) return $output; |
|
747 | + if(!$output->toBool()) { |
|
748 | + return $output; |
|
749 | + } |
|
685 | 750 | } |
686 | 751 | |
687 | 752 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
@@ -705,8 +770,7 @@ discard block |
||
705 | 770 | { |
706 | 771 | $args->alias_srl = getNextSequence(); |
707 | 772 | $query = "document.insertAlias"; |
708 | - } |
|
709 | - else |
|
773 | + } else |
|
710 | 774 | { |
711 | 775 | $args->alias_srl = $alias_srl; |
712 | 776 | $query = "document.updateAlias"; |
@@ -744,7 +808,9 @@ discard block |
||
744 | 808 | $oDocumentModel = getModel('document'); |
745 | 809 | $oDocumentController = getController('document'); |
746 | 810 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
747 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
811 | + if(!$oDocument->isGranted()) { |
|
812 | + return $this->stop('msg_not_permitted'); |
|
813 | + } |
|
748 | 814 | |
749 | 815 | $oModuleModel = getModel('module'); |
750 | 816 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -766,8 +832,9 @@ discard block |
||
766 | 832 | parse_str($arrUrl['query'], $arrQuery); |
767 | 833 | |
768 | 834 | // set query |
769 | - if(isset($arrQuery['document_srl'])) |
|
770 | - unset($arrQuery['document_srl']); |
|
835 | + if(isset($arrQuery['document_srl'])) { |
|
836 | + unset($arrQuery['document_srl']); |
|
837 | + } |
|
771 | 838 | |
772 | 839 | $searchArgs = new stdClass; |
773 | 840 | foreach($arrQuery as $key=>$val) |
@@ -775,13 +842,15 @@ discard block |
||
775 | 842 | $searchArgs->{$key} = $val; |
776 | 843 | } |
777 | 844 | |
778 | - if(!isset($searchArgs->sort_index)) |
|
779 | - $searchArgs->sort_index = $module_info->order_target; |
|
845 | + if(!isset($searchArgs->sort_index)) { |
|
846 | + $searchArgs->sort_index = $module_info->order_target; |
|
847 | + } |
|
780 | 848 | |
781 | 849 | foreach($module_info as $key=>$val) |
782 | 850 | { |
783 | - if(!isset($searchArgs->{$key})) |
|
784 | - $searchArgs->{$key} = $val; |
|
851 | + if(!isset($searchArgs->{$key})) { |
|
852 | + $searchArgs->{$key} = $val; |
|
853 | + } |
|
785 | 854 | } |
786 | 855 | |
787 | 856 | $oDocumentModel = getModel('document'); |
@@ -793,12 +862,14 @@ discard block |
||
793 | 862 | } |
794 | 863 | |
795 | 864 | |
796 | - if($cur_page>1 && count($output->data) == 0) |
|
797 | - $arrQuery['page'] = $cur_page - 1; |
|
865 | + if($cur_page>1 && count($output->data) == 0) { |
|
866 | + $arrQuery['page'] = $cur_page - 1; |
|
867 | + } |
|
798 | 868 | |
799 | 869 | $query = "?"; |
800 | - foreach($arrQuery as $key=>$val) |
|
801 | - $query .= sprintf("%s=%s&", $key, $val); |
|
870 | + foreach($arrQuery as $key=>$val) { |
|
871 | + $query .= sprintf("%s=%s&", $key, $val); |
|
872 | + } |
|
802 | 873 | $query = substr($query, 0, -1); |
803 | 874 | } |
804 | 875 | $returnUrl = $arrUrl['path'] . $query; |
@@ -878,7 +949,9 @@ discard block |
||
878 | 949 | */ |
879 | 950 | function restoreTrash($originObject) |
880 | 951 | { |
881 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
952 | + if(is_array($originObject)) { |
|
953 | + $originObject = (object)$originObject; |
|
954 | + } |
|
882 | 955 | |
883 | 956 | $oDocumentController = getController('document'); |
884 | 957 | $oDocumentModel = getModel('document'); |
@@ -888,7 +961,9 @@ discard block |
||
888 | 961 | |
889 | 962 | //DB restore |
890 | 963 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
891 | - if(!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
964 | + if(!$output->toBool()) { |
|
965 | + return new BaseObject(-1, $output->getMessage()); |
|
966 | + } |
|
892 | 967 | |
893 | 968 | //FILE restore |
894 | 969 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
@@ -926,7 +1001,9 @@ discard block |
||
926 | 1001 | function emptyTrash($originObject) |
927 | 1002 | { |
928 | 1003 | $originObject = unserialize($originObject); |
929 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
1004 | + if(is_array($originObject)) { |
|
1005 | + $originObject = (object) $originObject; |
|
1006 | + } |
|
930 | 1007 | |
931 | 1008 | $oDocument = new documentItem(); |
932 | 1009 | $oDocument->setAttribute($originObject); |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | { |
28 | 28 | // error appears if no doc is selected |
29 | 29 | $cart = Context::get('cart'); |
30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
31 | - $document_srl_list= explode('|@|', $cart); |
|
30 | + if (!$cart) return $this->stop('msg_cart_is_null'); |
|
31 | + $document_srl_list = explode('|@|', $cart); |
|
32 | 32 | $document_count = count($document_srl_list); |
33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
33 | + if (!$document_count) return $this->stop('msg_cart_is_null'); |
|
34 | 34 | // Delete a doc |
35 | 35 | $oDocumentController = getController('document'); |
36 | - for($i=0;$i<$document_count;$i++) |
|
36 | + for ($i = 0; $i < $document_count; $i++) |
|
37 | 37 | { |
38 | 38 | $document_srl = trim($document_srl_list[$i]); |
39 | - if(!$document_srl) continue; |
|
39 | + if (!$document_srl) continue; |
|
40 | 40 | |
41 | 41 | $oDocumentController->deleteDocument($document_srl, true); |
42 | 42 | } |
43 | 43 | |
44 | - $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) ); |
|
44 | + $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count)); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
55 | 55 | { |
56 | - if(!count($document_srl_list)) return; |
|
56 | + if (!count($document_srl_list)) return; |
|
57 | 57 | |
58 | 58 | $oDocumentModel = getModel('document'); |
59 | 59 | $oDocumentController = getController('document'); |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | $oDB->begin(); |
63 | 63 | |
64 | 64 | $triggerObj = new stdClass(); |
65 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
65 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
66 | 66 | $triggerObj->module_srl = $module_srl; |
67 | 67 | $triggerObj->source_module_srl = array(); |
68 | 68 | $triggerObj->category_srl = $category_srl; |
69 | 69 | |
70 | 70 | // Call a trigger (before) |
71 | 71 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj); |
72 | - if(!$output->toBool()) |
|
72 | + if (!$output->toBool()) |
|
73 | 73 | { |
74 | 74 | $oDB->rollback(); |
75 | 75 | return $output; |
76 | 76 | } |
77 | 77 | |
78 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
78 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
79 | 79 | { |
80 | 80 | $document_srl = $document_srl_list[$i]; |
81 | 81 | $oDocument = $oDocumentModel->getDocument($document_srl); |
82 | - if(!$oDocument->isExists()) continue; |
|
82 | + if (!$oDocument->isExists()) continue; |
|
83 | 83 | |
84 | 84 | $triggerObj->source_module_srl[$document_srl] = $oDocument->get('module_srl'); |
85 | 85 | |
@@ -94,33 +94,33 @@ discard block |
||
94 | 94 | $obj->content = $output_ori->data->content; |
95 | 95 | |
96 | 96 | // Move the attached file if the target module is different |
97 | - if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
97 | + if ($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
98 | 98 | { |
99 | 99 | $oFileController = getController('file'); |
100 | 100 | |
101 | 101 | $files = $oDocument->getUploadedFiles(); |
102 | 102 | $delete_file_srls = array(); |
103 | - if(is_array($files)) |
|
103 | + if (is_array($files)) |
|
104 | 104 | { |
105 | - foreach($files as $val) |
|
105 | + foreach ($files as $val) |
|
106 | 106 | { |
107 | 107 | $file_info = array(); |
108 | 108 | $file_info['tmp_name'] = $val->uploaded_filename; |
109 | 109 | $file_info['name'] = $val->source_filename; |
110 | 110 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true); |
111 | 111 | |
112 | - if(!$inserted_file->toBool()) { |
|
112 | + if (!$inserted_file->toBool()) { |
|
113 | 113 | $oDB->rollback(); |
114 | 114 | return $inserted_file; |
115 | 115 | } |
116 | 116 | |
117 | - if($inserted_file && $inserted_file->toBool()) |
|
117 | + if ($inserted_file && $inserted_file->toBool()) |
|
118 | 118 | { |
119 | 119 | // for image/video files |
120 | - if($val->direct_download == 'Y') |
|
120 | + if ($val->direct_download == 'Y') |
|
121 | 121 | { |
122 | - $source_filename = substr($val->uploaded_filename,2); |
|
123 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
122 | + $source_filename = substr($val->uploaded_filename, 2); |
|
123 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
124 | 124 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
125 | 125 | // For binary files |
126 | 126 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $oFileController->setFilesValid($obj->document_srl); |
140 | 140 | } |
141 | 141 | |
142 | - if($module_srl != $obj->module_srl) |
|
142 | + if ($module_srl != $obj->module_srl) |
|
143 | 143 | { |
144 | 144 | $oDocumentController->deleteDocumentAliasByDocument($obj->document_srl); |
145 | 145 | } |
@@ -147,48 +147,48 @@ discard block |
||
147 | 147 | $obj->module_srl = $module_srl; |
148 | 148 | $obj->category_srl = $category_srl; |
149 | 149 | $output = executeQuery('document.updateDocumentModule', $obj); |
150 | - if(!$output->toBool()) { |
|
150 | + if (!$output->toBool()) { |
|
151 | 151 | $oDB->rollback(); |
152 | 152 | return $output; |
153 | 153 | } |
154 | 154 | |
155 | 155 | //Move a module of the extra vars |
156 | 156 | $output = executeQuery('document.moveDocumentExtraVars', $obj); |
157 | - if(!$output->toBool()) { |
|
157 | + if (!$output->toBool()) { |
|
158 | 158 | $oDB->rollback(); |
159 | 159 | return $output; |
160 | 160 | } |
161 | 161 | // Set 0 if a new category doesn't exist after catergory change |
162 | - if($source_category_srl != $category_srl) |
|
162 | + if ($source_category_srl != $category_srl) |
|
163 | 163 | { |
164 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
165 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
164 | + if ($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
165 | + if ($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | 169 | $args = new stdClass(); |
170 | - $args->document_srls = implode(',',$document_srl_list); |
|
170 | + $args->document_srls = implode(',', $document_srl_list); |
|
171 | 171 | $args->module_srl = $module_srl; |
172 | 172 | // move the comment |
173 | 173 | $output = executeQuery('comment.updateCommentModule', $args); |
174 | - if(!$output->toBool()) |
|
174 | + if (!$output->toBool()) |
|
175 | 175 | { |
176 | 176 | $oDB->rollback(); |
177 | 177 | return $output; |
178 | 178 | } |
179 | 179 | |
180 | 180 | $output = executeQuery('comment.updateCommentListModule', $args); |
181 | - if(!$output->toBool()) |
|
181 | + if (!$output->toBool()) |
|
182 | 182 | { |
183 | 183 | $oDB->rollback(); |
184 | 184 | return $output; |
185 | 185 | } |
186 | 186 | |
187 | 187 | // move the trackback |
188 | - if(getClass('trackback')) |
|
188 | + if (getClass('trackback')) |
|
189 | 189 | { |
190 | 190 | $output = executeQuery('trackback.updateTrackbackModule', $args); |
191 | - if(!$output->toBool()) |
|
191 | + if (!$output->toBool()) |
|
192 | 192 | { |
193 | 193 | $oDB->rollback(); |
194 | 194 | return $output; |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | |
198 | 198 | // Tags |
199 | 199 | $output = executeQuery('tag.updateTagModule', $args); |
200 | - if(!$output->toBool()) |
|
200 | + if (!$output->toBool()) |
|
201 | 201 | { |
202 | 202 | $oDB->rollback(); |
203 | 203 | return $output; |
204 | 204 | } |
205 | 205 | // Call a trigger (before) |
206 | 206 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj); |
207 | - if(!$output->toBool()) |
|
207 | + if (!$output->toBool()) |
|
208 | 208 | { |
209 | 209 | $oDB->rollback(); |
210 | 210 | return $output; |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | $oDB->commit(); |
214 | 214 | //remove from cache |
215 | 215 | $oCacheHandler = CacheHandler::getInstance('object'); |
216 | - if($oCacheHandler->isSupport()) |
|
216 | + if ($oCacheHandler->isSupport()) |
|
217 | 217 | { |
218 | - foreach($document_srl_list as $document_srl) |
|
218 | + foreach ($document_srl_list as $document_srl) |
|
219 | 219 | { |
220 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
220 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
221 | 221 | $oCacheHandler->delete($cache_key_item); |
222 | 222 | } |
223 | 223 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
235 | 235 | { |
236 | - if(count($document_srl_list) < 1) return; |
|
236 | + if (count($document_srl_list) < 1) return; |
|
237 | 237 | |
238 | 238 | $oDocumentModel = getModel('document'); |
239 | 239 | $oDocumentController = getController('document'); |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | $oDB->begin(); |
245 | 245 | |
246 | 246 | $triggerObj = new stdClass(); |
247 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
247 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
248 | 248 | $triggerObj->module_srl = $module_srl; |
249 | 249 | $triggerObj->category_srl = $category_srl; |
250 | 250 | // Call a trigger (before) |
251 | 251 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $triggerObj); |
252 | - if(!$output->toBool()) |
|
252 | + if (!$output->toBool()) |
|
253 | 253 | { |
254 | 254 | $oDB->rollback(); |
255 | 255 | return $output; |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | |
258 | 258 | $extraVarsList = $oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list); |
259 | 259 | $extraVarsListByDocumentSrl = array(); |
260 | - if(is_array($extraVarsList->data)) |
|
260 | + if (is_array($extraVarsList->data)) |
|
261 | 261 | { |
262 | - foreach($extraVarsList->data as $value) |
|
262 | + foreach ($extraVarsList->data as $value) |
|
263 | 263 | { |
264 | - if(!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
264 | + if (!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
265 | 265 | { |
266 | 266 | $extraVarsListByDocumentSrl[$value->document_srl] = array(); |
267 | 267 | } |
@@ -270,22 +270,22 @@ discard block |
||
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
273 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
274 | 274 | { |
275 | 275 | $document_srl = $document_srl_list[$i]; |
276 | 276 | $oDocument = $oDocumentModel->getDocument($document_srl); |
277 | - if(!$oDocument->isExists()) continue; |
|
277 | + if (!$oDocument->isExists()) continue; |
|
278 | 278 | |
279 | 279 | $obj = $oDocument->getObjectVars(); |
280 | 280 | |
281 | 281 | $extraVars = $extraVarsListByDocumentSrl[$document_srl]; |
282 | - if($module_srl == $obj->module_srl) |
|
282 | + if ($module_srl == $obj->module_srl) |
|
283 | 283 | { |
284 | - if(is_array($extraVars)) |
|
284 | + if (is_array($extraVars)) |
|
285 | 285 | { |
286 | - foreach($extraVars as $extraItem) |
|
286 | + foreach ($extraVars as $extraItem) |
|
287 | 287 | { |
288 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
288 | + if ($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | } |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | $obj->trackback_count = 0; |
298 | 298 | |
299 | 299 | // Pre-register the attachment |
300 | - if($oDocument->hasUploadedFiles()) |
|
300 | + if ($oDocument->hasUploadedFiles()) |
|
301 | 301 | { |
302 | 302 | $files = $oDocument->getUploadedFiles(); |
303 | - foreach($files as $val) |
|
303 | + foreach ($files as $val) |
|
304 | 304 | { |
305 | 305 | $file_info = array(); |
306 | 306 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -308,16 +308,16 @@ discard block |
||
308 | 308 | $oFileController = getController('file'); |
309 | 309 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true); |
310 | 310 | |
311 | - if(!$inserted_file->toBool()) { |
|
311 | + if (!$inserted_file->toBool()) { |
|
312 | 312 | $oDB->rollback(); |
313 | 313 | return $inserted_file; |
314 | 314 | } |
315 | 315 | |
316 | 316 | // if image/video files |
317 | - if($val->direct_download == 'Y') |
|
317 | + if ($val->direct_download == 'Y') |
|
318 | 318 | { |
319 | - $source_filename = substr($val->uploaded_filename,2); |
|
320 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
319 | + $source_filename = substr($val->uploaded_filename, 2); |
|
320 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
321 | 321 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
322 | 322 | // If binary file |
323 | 323 | } |
@@ -331,23 +331,23 @@ discard block |
||
331 | 331 | |
332 | 332 | // Write a post |
333 | 333 | $output = $oDocumentController->insertDocument($obj, true, true); |
334 | - if(!$output->toBool()) |
|
334 | + if (!$output->toBool()) |
|
335 | 335 | { |
336 | 336 | $oDB->rollback(); |
337 | 337 | return $output; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // copy multi language contents |
341 | - if(is_array($extraVars)) |
|
341 | + if (is_array($extraVars)) |
|
342 | 342 | { |
343 | - foreach($extraVars as $value) |
|
343 | + foreach ($extraVars as $value) |
|
344 | 344 | { |
345 | - if($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
345 | + if ($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
346 | 346 | { |
347 | 347 | continue; |
348 | 348 | } |
349 | 349 | |
350 | - if( $value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0) ) |
|
350 | + if ($value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0)) |
|
351 | 351 | { |
352 | 352 | $oDocumentController->insertDocumentExtraVar($value->module_srl, $obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code); |
353 | 353 | } |
@@ -355,26 +355,26 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | // Move the comments |
358 | - if($oDocument->getCommentCount()) |
|
358 | + if ($oDocument->getCommentCount()) |
|
359 | 359 | { |
360 | 360 | $oCommentModel = getModel('comment'); |
361 | 361 | $comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999); |
362 | 362 | $comments = $comment_output->data; |
363 | - if(count($comments) > 0) |
|
363 | + if (count($comments) > 0) |
|
364 | 364 | { |
365 | 365 | $oCommentController = getController('comment'); |
366 | 366 | $success_count = 0; |
367 | 367 | $p_comment_srl = array(); |
368 | - foreach($comments as $comment_obj) |
|
368 | + foreach ($comments as $comment_obj) |
|
369 | 369 | { |
370 | 370 | $comment_srl = getNextSequence(); |
371 | 371 | $p_comment_srl[$comment_obj->comment_srl] = $comment_srl; |
372 | 372 | |
373 | 373 | // Pre-register the attachment |
374 | - if($comment_obj->uploaded_count) |
|
374 | + if ($comment_obj->uploaded_count) |
|
375 | 375 | { |
376 | 376 | $files = $oFileModel->getFiles($comment_obj->comment_srl, true); |
377 | - foreach($files as $val) |
|
377 | + foreach ($files as $val) |
|
378 | 378 | { |
379 | 379 | $file_info = array(); |
380 | 380 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | $oFileController = getController('file'); |
383 | 383 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $comment_srl, 0, true); |
384 | 384 | // if image/video files |
385 | - if($val->direct_download == 'Y') |
|
385 | + if ($val->direct_download == 'Y') |
|
386 | 386 | { |
387 | - $source_filename = substr($val->uploaded_filename,2); |
|
388 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
387 | + $source_filename = substr($val->uploaded_filename, 2); |
|
388 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
389 | 389 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
390 | 390 | // If binary file |
391 | 391 | } |
@@ -401,10 +401,10 @@ discard block |
||
401 | 401 | $comment_obj->document_srl = $obj->document_srl; |
402 | 402 | $comment_obj->comment_srl = $comment_srl; |
403 | 403 | |
404 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
404 | + if ($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
405 | 405 | |
406 | 406 | $output = $oCommentController->insertComment($comment_obj, true); |
407 | - if($output->toBool()) $success_count ++; |
|
407 | + if ($output->toBool()) $success_count++; |
|
408 | 408 | } |
409 | 409 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
410 | 410 | } |
@@ -412,19 +412,19 @@ discard block |
||
412 | 412 | |
413 | 413 | // Move the trackbacks |
414 | 414 | $oTrackbackModel = getModel('trackback'); |
415 | - if($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
415 | + if ($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
416 | 416 | { |
417 | 417 | $trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl); |
418 | - if(count($trackbacks)) |
|
418 | + if (count($trackbacks)) |
|
419 | 419 | { |
420 | 420 | $success_count = 0; |
421 | - foreach($trackbacks as $trackback_obj) |
|
421 | + foreach ($trackbacks as $trackback_obj) |
|
422 | 422 | { |
423 | 423 | $trackback_obj->trackback_srl = getNextSequence(); |
424 | 424 | $trackback_obj->module_srl = $obj->module_srl; |
425 | 425 | $trackback_obj->document_srl = $obj->document_srl; |
426 | 426 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
427 | - if($output->toBool()) $success_count++; |
|
427 | + if ($output->toBool()) $success_count++; |
|
428 | 428 | } |
429 | 429 | // Update the number of trackbacks |
430 | 430 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | // Call a trigger (before) |
438 | 438 | $triggerObj->copied_srls = $copied_srls; |
439 | 439 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj); |
440 | - if(!$output->toBool()) |
|
440 | + if (!$output->toBool()) |
|
441 | 441 | { |
442 | 442 | $oDB->rollback(); |
443 | 443 | return $output; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $document_list = $oDocumentModel->getDocumentList($args); |
465 | 465 | $documents = $document_list->data; |
466 | 466 | $output = executeQuery('document.deleteModuleDocument', $args); |
467 | - if(is_array($documents)) |
|
467 | + if (is_array($documents)) |
|
468 | 468 | { |
469 | 469 | foreach ($documents as $oDocument) |
470 | 470 | { |
@@ -473,13 +473,13 @@ discard block |
||
473 | 473 | } |
474 | 474 | //remove from cache |
475 | 475 | $oCacheHandler = CacheHandler::getInstance('object'); |
476 | - if($oCacheHandler->isSupport()) |
|
476 | + if ($oCacheHandler->isSupport()) |
|
477 | 477 | { |
478 | - if(is_array($document_srl_list)) |
|
478 | + if (is_array($document_srl_list)) |
|
479 | 479 | { |
480 | - foreach($document_srl_list as $document_srl) |
|
480 | + foreach ($document_srl_list as $document_srl) |
|
481 | 481 | { |
482 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
482 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
483 | 483 | $oCacheHandler->delete($cache_key_item); |
484 | 484 | } |
485 | 485 | } |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | $config = getModel('document')->getDocumentConfig(); |
499 | 499 | $config->icons = Context::get('icons'); |
500 | 500 | $config->micons = Context::get('micons'); |
501 | - $output = $oModuleController->insertModuleConfig('document',$config); |
|
502 | - if(!$output->toBool()) |
|
501 | + $output = $oModuleController->insertModuleConfig('document', $config); |
|
502 | + if (!$output->toBool()) |
|
503 | 503 | { |
504 | 504 | return $output; |
505 | 505 | } |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | { |
519 | 519 | $document_srl = trim(Context::get('document_srl')); |
520 | 520 | |
521 | - if($document_srl) |
|
521 | + if ($document_srl) |
|
522 | 522 | { |
523 | 523 | $args->document_srl = $document_srl; |
524 | 524 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
525 | - if(!$output->toBool()) return $output; |
|
525 | + if (!$output->toBool()) return $output; |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | */ |
533 | 533 | function procDocumentAdminDeleteAllThumbnail() |
534 | 534 | { |
535 | - $temp_cache_dir = './files/thumbnails_' . $_SERVER['REQUEST_TIME']; |
|
535 | + $temp_cache_dir = './files/thumbnails_'.$_SERVER['REQUEST_TIME']; |
|
536 | 536 | FileHandler::rename('./files/thumbnails', $temp_cache_dir); |
537 | 537 | FileHandler::makeDir('./files/thumbnails'); |
538 | 538 | |
@@ -548,12 +548,12 @@ discard block |
||
548 | 548 | function deleteThumbnailFile($path) |
549 | 549 | { |
550 | 550 | $directory = dir($path); |
551 | - while($entry = $directory->read()) { |
|
551 | + while ($entry = $directory->read()) { |
|
552 | 552 | if ($entry != "." && $entry != "..") { |
553 | 553 | if (is_dir($path."/".$entry)) { |
554 | 554 | $this->deleteThumbnailFile($path."/".$entry); |
555 | 555 | } else { |
556 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
556 | + if (!preg_match('/^thumbnail_([^\.]*)\.jpg$/i', $entry)) continue; |
|
557 | 557 | FileHandler::removeFile($path.'/'.$entry); |
558 | 558 | } |
559 | 559 | } |
@@ -578,13 +578,13 @@ discard block |
||
578 | 578 | $eid = Context::get('eid'); |
579 | 579 | $obj = new stdClass(); |
580 | 580 | |
581 | - if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
581 | + if (!$module_srl || !$name || !$eid) return new BaseObject(-1, 'msg_invalid_request'); |
|
582 | 582 | // set the max value if idx is not specified |
583 | - if(!$var_idx) |
|
583 | + if (!$var_idx) |
|
584 | 584 | { |
585 | 585 | $obj->module_srl = $module_srl; |
586 | 586 | $output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj); |
587 | - $var_idx = $output->data->var_idx+1; |
|
587 | + $var_idx = $output->data->var_idx + 1; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | // Check if the module name already exists |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $obj->var_idx = $var_idx; |
593 | 593 | $obj->eid = $eid; |
594 | 594 | $output = executeQuery('document.isExistsExtraKey', $obj); |
595 | - if(!$output->toBool() || $output->data->count) |
|
595 | + if (!$output->toBool() || $output->data->count) |
|
596 | 596 | { |
597 | 597 | return new BaseObject(-1, 'msg_extra_name_exists'); |
598 | 598 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | // insert or update |
601 | 601 | $oDocumentController = getController('document'); |
602 | 602 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
603 | - if(!$output->toBool()) return $output; |
|
603 | + if (!$output->toBool()) return $output; |
|
604 | 604 | |
605 | 605 | $this->setMessage('success_registed'); |
606 | 606 | |
@@ -616,11 +616,11 @@ discard block |
||
616 | 616 | { |
617 | 617 | $module_srl = Context::get('module_srl'); |
618 | 618 | $var_idx = Context::get('var_idx'); |
619 | - if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
619 | + if (!$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request'); |
|
620 | 620 | |
621 | 621 | $oDocumentController = getController('document'); |
622 | 622 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
623 | - if(!$output->toBool()) return $output; |
|
623 | + if (!$output->toBool()) return $output; |
|
624 | 624 | |
625 | 625 | $this->setMessage('success_deleted'); |
626 | 626 | } |
@@ -635,19 +635,19 @@ discard block |
||
635 | 635 | $module_srl = Context::get('module_srl'); |
636 | 636 | $var_idx = Context::get('var_idx'); |
637 | 637 | |
638 | - if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
638 | + if (!$type || !$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request'); |
|
639 | 639 | |
640 | 640 | $oModuleModel = getModel('module'); |
641 | 641 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
642 | - if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
642 | + if (!$module_info->module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
643 | 643 | |
644 | 644 | $oDocumentModel = getModel('document'); |
645 | 645 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
646 | - if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request'); |
|
646 | + if (!$extra_keys[$var_idx]) return new BaseObject(-1, 'msg_invalid_request'); |
|
647 | 647 | |
648 | - if($type == 'up') $new_idx = $var_idx-1; |
|
649 | - else $new_idx = $var_idx+1; |
|
650 | - if($new_idx<1) return new BaseObject(-1,'msg_invalid_request'); |
|
648 | + if ($type == 'up') $new_idx = $var_idx - 1; |
|
649 | + else $new_idx = $var_idx + 1; |
|
650 | + if ($new_idx < 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
651 | 651 | |
652 | 652 | $args = new stdClass(); |
653 | 653 | $args->module_srl = $module_srl; |
@@ -658,16 +658,16 @@ discard block |
||
658 | 658 | unset($args); |
659 | 659 | |
660 | 660 | // update immediately if there is no idx to change |
661 | - if(!$extra_keys[$new_idx]) |
|
661 | + if (!$extra_keys[$new_idx]) |
|
662 | 662 | { |
663 | 663 | $args = new stdClass(); |
664 | 664 | $args->module_srl = $module_srl; |
665 | 665 | $args->var_idx = $var_idx; |
666 | 666 | $args->new_idx = $new_idx; |
667 | 667 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
668 | - if(!$output->toBool()) return $output; |
|
668 | + if (!$output->toBool()) return $output; |
|
669 | 669 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
670 | - if(!$output->toBool()) return $output; |
|
670 | + if (!$output->toBool()) return $output; |
|
671 | 671 | // replace if exists |
672 | 672 | } |
673 | 673 | else |
@@ -677,27 +677,27 @@ discard block |
||
677 | 677 | $args->var_idx = $new_idx; |
678 | 678 | $args->new_idx = -10000; |
679 | 679 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
680 | - if(!$output->toBool()) return $output; |
|
680 | + if (!$output->toBool()) return $output; |
|
681 | 681 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
682 | - if(!$output->toBool()) return $output; |
|
682 | + if (!$output->toBool()) return $output; |
|
683 | 683 | |
684 | 684 | $args->var_idx = $var_idx; |
685 | 685 | $args->new_idx = $new_idx; |
686 | 686 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
687 | - if(!$output->toBool()) return $output; |
|
687 | + if (!$output->toBool()) return $output; |
|
688 | 688 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
689 | - if(!$output->toBool()) return $output; |
|
689 | + if (!$output->toBool()) return $output; |
|
690 | 690 | |
691 | 691 | $args->var_idx = -10000; |
692 | 692 | $args->new_idx = $var_idx; |
693 | 693 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
694 | - if(!$output->toBool()) return $output; |
|
694 | + if (!$output->toBool()) return $output; |
|
695 | 695 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
696 | - if(!$output->toBool()) return $output; |
|
696 | + if (!$output->toBool()) return $output; |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
700 | - if($oCacheHandler->isSupport()) |
|
700 | + if ($oCacheHandler->isSupport()) |
|
701 | 701 | { |
702 | 702 | $object_key = 'module_document_extra_keys:'.$module_srl; |
703 | 703 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -711,9 +711,9 @@ discard block |
||
711 | 711 | */ |
712 | 712 | function procDocumentAdminInsertAlias() |
713 | 713 | { |
714 | - $args = Context::gets('module_srl','document_srl', 'alias_title'); |
|
714 | + $args = Context::gets('module_srl', 'document_srl', 'alias_title'); |
|
715 | 715 | $alias_srl = Context::get('alias_srl'); |
716 | - if(!$alias_srl) |
|
716 | + if (!$alias_srl) |
|
717 | 717 | { |
718 | 718 | $args->alias_srl = getNextSequence(); |
719 | 719 | $query = "document.insertAlias"; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $oDocumentModel = getModel('document'); |
757 | 757 | $oDocumentController = getController('document'); |
758 | 758 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
759 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
759 | + if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
760 | 760 | |
761 | 761 | $oModuleModel = getModel('module'); |
762 | 762 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -768,31 +768,31 @@ discard block |
||
768 | 768 | $oDocumentController->moveDocumentToTrash($args); |
769 | 769 | |
770 | 770 | $returnUrl = Context::get('success_return_url'); |
771 | - if(!$returnUrl) |
|
771 | + if (!$returnUrl) |
|
772 | 772 | { |
773 | 773 | $arrUrl = parse_url(Context::get('cur_url')); |
774 | 774 | $query = ""; |
775 | 775 | |
776 | - if($arrUrl['query']) |
|
776 | + if ($arrUrl['query']) |
|
777 | 777 | { |
778 | 778 | parse_str($arrUrl['query'], $arrQuery); |
779 | 779 | |
780 | 780 | // set query |
781 | - if(isset($arrQuery['document_srl'])) |
|
781 | + if (isset($arrQuery['document_srl'])) |
|
782 | 782 | unset($arrQuery['document_srl']); |
783 | 783 | |
784 | 784 | $searchArgs = new stdClass; |
785 | - foreach($arrQuery as $key=>$val) |
|
785 | + foreach ($arrQuery as $key=>$val) |
|
786 | 786 | { |
787 | 787 | $searchArgs->{$key} = $val; |
788 | 788 | } |
789 | 789 | |
790 | - if(!isset($searchArgs->sort_index)) |
|
790 | + if (!isset($searchArgs->sort_index)) |
|
791 | 791 | $searchArgs->sort_index = $module_info->order_target; |
792 | 792 | |
793 | - foreach($module_info as $key=>$val) |
|
793 | + foreach ($module_info as $key=>$val) |
|
794 | 794 | { |
795 | - if(!isset($searchArgs->{$key})) |
|
795 | + if (!isset($searchArgs->{$key})) |
|
796 | 796 | $searchArgs->{$key} = $val; |
797 | 797 | } |
798 | 798 | |
@@ -800,20 +800,20 @@ discard block |
||
800 | 800 | $output = $oDocumentModel->getDocumentList($searchArgs, $module_info->except_notice, TRUE, array('document_srl')); |
801 | 801 | |
802 | 802 | $cur_page = 1; |
803 | - if(isset($arrQuery['page'])) { |
|
804 | - $cur_page = (int)$arrQuery['page']; |
|
803 | + if (isset($arrQuery['page'])) { |
|
804 | + $cur_page = (int) $arrQuery['page']; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | |
808 | - if($cur_page>1 && count($output->data) == 0) |
|
808 | + if ($cur_page > 1 && count($output->data) == 0) |
|
809 | 809 | $arrQuery['page'] = $cur_page - 1; |
810 | 810 | |
811 | 811 | $query = "?"; |
812 | - foreach($arrQuery as $key=>$val) |
|
812 | + foreach ($arrQuery as $key=>$val) |
|
813 | 813 | $query .= sprintf("%s=%s&", $key, $val); |
814 | 814 | $query = substr($query, 0, -1); |
815 | 815 | } |
816 | - $returnUrl = $arrUrl['path'] . $query; |
|
816 | + $returnUrl = $arrUrl['path'].$query; |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | $this->add('redirect_url', $returnUrl); |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | */ |
891 | 891 | function restoreTrash($originObject) |
892 | 892 | { |
893 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
893 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
894 | 894 | |
895 | 895 | $oDocumentController = getController('document'); |
896 | 896 | $oDocumentModel = getModel('document'); |
@@ -900,12 +900,12 @@ discard block |
||
900 | 900 | |
901 | 901 | //DB restore |
902 | 902 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
903 | - if(!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
903 | + if (!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
904 | 904 | |
905 | 905 | //FILE restore |
906 | 906 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
907 | 907 | // If the post was not temorarily saved, set the attachment's status to be valid |
908 | - if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
908 | + if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
909 | 909 | { |
910 | 910 | $args = new stdClass(); |
911 | 911 | $args->upload_target_srl = $oDocument->document_srl; |
@@ -914,10 +914,10 @@ discard block |
||
914 | 914 | } |
915 | 915 | |
916 | 916 | // call a trigger (after) |
917 | - if($output->toBool()) |
|
917 | + if ($output->toBool()) |
|
918 | 918 | { |
919 | 919 | $trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject); |
920 | - if(!$trigger_output->toBool()) |
|
920 | + if (!$trigger_output->toBool()) |
|
921 | 921 | { |
922 | 922 | $oDB->rollback(); |
923 | 923 | return $trigger_output; |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | function emptyTrash($originObject) |
939 | 939 | { |
940 | 940 | $originObject = unserialize($originObject); |
941 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
941 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
942 | 942 | |
943 | 943 | $oDocument = new documentItem(); |
944 | 944 | $oDocument->setAttribute($originObject); |
@@ -27,31 +27,31 @@ discard block |
||
27 | 27 | function getDocumentTrashList($obj) |
28 | 28 | { |
29 | 29 | // check a list and its order |
30 | - if(!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order'; |
|
31 | - if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc'; |
|
30 | + if (!in_array($obj->sort_index, array('list_order', 'delete_date', 'title'))) $obj->sort_index = 'list_order'; |
|
31 | + if (!in_array($obj->order_type, array('desc', 'asc'))) $obj->order_type = 'asc'; |
|
32 | 32 | // get a module_srl if mid is returned instead of modul_srl |
33 | - if($obj->mid) |
|
33 | + if ($obj->mid) |
|
34 | 34 | { |
35 | 35 | $oModuleModel = getModel('module'); |
36 | 36 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
37 | 37 | unset($obj->mid); |
38 | 38 | } |
39 | 39 | // check if the module_srl is an array |
40 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
40 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
41 | 41 | else $args->module_srl = $obj->module_srl; |
42 | 42 | // Variable check |
43 | 43 | $args->sort_index = $obj->sort_index; |
44 | 44 | $args->order_type = $obj->order_type; |
45 | - $args->page = $obj->page?$obj->page:1; |
|
46 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
47 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
45 | + $args->page = $obj->page ? $obj->page : 1; |
|
46 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
47 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
48 | 48 | $args->member_srl = $obj->member_srl; |
49 | 49 | // Specify query_id |
50 | 50 | $query_id = 'document.getTrashList'; |
51 | 51 | // Execute a query |
52 | 52 | $output = executeQueryArray($query_id, $args); |
53 | 53 | // Return if no result or an error occurs |
54 | - if(!$output->toBool() || !count($output->data)) return $output; |
|
54 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
55 | 55 | |
56 | 56 | $idx = 0; |
57 | 57 | $data = $output->data; |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $keys = array_keys($data); |
61 | 61 | $virtual_number = $keys[0]; |
62 | 62 | |
63 | - foreach($data as $key => $attribute) |
|
63 | + foreach ($data as $key => $attribute) |
|
64 | 64 | { |
65 | 65 | $oDocument = null; |
66 | 66 | $oDocument = new documentItem(); |
67 | 67 | $oDocument->setAttribute($attribute, false); |
68 | - if($is_admin) $oDocument->setGrant(); |
|
68 | + if ($is_admin) $oDocument->setGrant(); |
|
69 | 69 | |
70 | 70 | $output->data[$virtual_number] = $oDocument; |
71 | 71 | $virtual_number--; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $output = executeQuery('document.getTrash', $args); |
86 | 86 | |
87 | 87 | $node = $output->data; |
88 | - if(!$node) return; |
|
88 | + if (!$node) return; |
|
89 | 89 | |
90 | 90 | return $node; |
91 | 91 | } |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | function getDocumentCountByDate($date = '', $moduleSrlList = array(), $statusList = array()) |
101 | 101 | { |
102 | 102 | $args = new stdClass(); |
103 | - if($date) $args->regDate = date('Ymd', strtotime($date)); |
|
104 | - if(count($moduleSrlList)>0) $args->moduleSrlList = $moduleSrlList; |
|
105 | - if(count($statusList)>0) $args->statusList = $statusList; |
|
103 | + if ($date) $args->regDate = date('Ymd', strtotime($date)); |
|
104 | + if (count($moduleSrlList) > 0) $args->moduleSrlList = $moduleSrlList; |
|
105 | + if (count($statusList) > 0) $args->statusList = $statusList; |
|
106 | 106 | |
107 | 107 | $output = executeQuery('document.getDocumentCountByDate', $args); |
108 | - if(!$output->toBool()) return 0; |
|
108 | + if (!$output->toBool()) return 0; |
|
109 | 109 | |
110 | 110 | return $output->data->count; |
111 | 111 | } |
@@ -27,8 +27,12 @@ discard block |
||
27 | 27 | function getDocumentTrashList($obj) |
28 | 28 | { |
29 | 29 | // check a list and its order |
30 | - if(!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order'; |
|
31 | - if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc'; |
|
30 | + if(!in_array($obj->sort_index, array('list_order','delete_date','title'))) { |
|
31 | + $obj->sort_index = 'list_order'; |
|
32 | + } |
|
33 | + if(!in_array($obj->order_type, array('desc','asc'))) { |
|
34 | + $obj->order_type = 'asc'; |
|
35 | + } |
|
32 | 36 | // get a module_srl if mid is returned instead of modul_srl |
33 | 37 | if($obj->mid) |
34 | 38 | { |
@@ -37,8 +41,11 @@ discard block |
||
37 | 41 | unset($obj->mid); |
38 | 42 | } |
39 | 43 | // check if the module_srl is an array |
40 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
41 | - else $args->module_srl = $obj->module_srl; |
|
44 | + if(is_array($obj->module_srl)) { |
|
45 | + $args->module_srl = implode(',', $obj->module_srl); |
|
46 | + } else { |
|
47 | + $args->module_srl = $obj->module_srl; |
|
48 | + } |
|
42 | 49 | // Variable check |
43 | 50 | $args->sort_index = $obj->sort_index; |
44 | 51 | $args->order_type = $obj->order_type; |
@@ -51,7 +58,9 @@ discard block |
||
51 | 58 | // Execute a query |
52 | 59 | $output = executeQueryArray($query_id, $args); |
53 | 60 | // Return if no result or an error occurs |
54 | - if(!$output->toBool() || !count($output->data)) return $output; |
|
61 | + if(!$output->toBool() || !count($output->data)) { |
|
62 | + return $output; |
|
63 | + } |
|
55 | 64 | |
56 | 65 | $idx = 0; |
57 | 66 | $data = $output->data; |
@@ -65,7 +74,9 @@ discard block |
||
65 | 74 | $oDocument = null; |
66 | 75 | $oDocument = new documentItem(); |
67 | 76 | $oDocument->setAttribute($attribute, false); |
68 | - if($is_admin) $oDocument->setGrant(); |
|
77 | + if($is_admin) { |
|
78 | + $oDocument->setGrant(); |
|
79 | + } |
|
69 | 80 | |
70 | 81 | $output->data[$virtual_number] = $oDocument; |
71 | 82 | $virtual_number--; |
@@ -85,7 +96,9 @@ discard block |
||
85 | 96 | $output = executeQuery('document.getTrash', $args); |
86 | 97 | |
87 | 98 | $node = $output->data; |
88 | - if(!$node) return; |
|
99 | + if(!$node) { |
|
100 | + return; |
|
101 | + } |
|
89 | 102 | |
90 | 103 | return $node; |
91 | 104 | } |
@@ -100,12 +113,20 @@ discard block |
||
100 | 113 | function getDocumentCountByDate($date = '', $moduleSrlList = array(), $statusList = array()) |
101 | 114 | { |
102 | 115 | $args = new stdClass(); |
103 | - if($date) $args->regDate = date('Ymd', strtotime($date)); |
|
104 | - if(count($moduleSrlList)>0) $args->moduleSrlList = $moduleSrlList; |
|
105 | - if(count($statusList)>0) $args->statusList = $statusList; |
|
116 | + if($date) { |
|
117 | + $args->regDate = date('Ymd', strtotime($date)); |
|
118 | + } |
|
119 | + if(count($moduleSrlList)>0) { |
|
120 | + $args->moduleSrlList = $moduleSrlList; |
|
121 | + } |
|
122 | + if(count($statusList)>0) { |
|
123 | + $args->statusList = $statusList; |
|
124 | + } |
|
106 | 125 | |
107 | 126 | $output = executeQuery('document.getDocumentCountByDate', $args); |
108 | - if(!$output->toBool()) return 0; |
|
127 | + if(!$output->toBool()) { |
|
128 | + return 0; |
|
129 | + } |
|
109 | 130 | |
110 | 131 | return $output->data->count; |
111 | 132 | } |
@@ -168,19 +168,22 @@ |
||
168 | 168 | function dispDocumentAdminAlias() |
169 | 169 | { |
170 | 170 | $args->document_srl = Context::get('document_srl'); |
171 | - if(!$args->document_srl) return $this->dispDocumentAdminList(); |
|
171 | + if(!$args->document_srl) { |
|
172 | + return $this->dispDocumentAdminList(); |
|
173 | + } |
|
172 | 174 | |
173 | 175 | $oModel = getModel('document'); |
174 | 176 | $oDocument = $oModel->getDocument($args->document_srl); |
175 | - if(!$oDocument->isExists()) return $this->dispDocumentAdminList(); |
|
177 | + if(!$oDocument->isExists()) { |
|
178 | + return $this->dispDocumentAdminList(); |
|
179 | + } |
|
176 | 180 | Context::set('oDocument', $oDocument); |
177 | 181 | |
178 | 182 | $output = executeQueryArray('document.getAliases', $args); |
179 | 183 | if(!$output->data) |
180 | 184 | { |
181 | 185 | $aliases = array(); |
182 | - } |
|
183 | - else |
|
186 | + } else |
|
184 | 187 | { |
185 | 188 | $aliases = $output->data; |
186 | 189 | } |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | // check current location in admin menu |
20 | 20 | $oModuleModel = getModel('module'); |
21 | 21 | $info = $oModuleModel->getModuleActionXml('document'); |
22 | - foreach($info->menu AS $key => $menu) |
|
22 | + foreach ($info->menu AS $key => $menu) |
|
23 | 23 | { |
24 | - if(in_array($this->act, $menu->acts)) |
|
24 | + if (in_array($this->act, $menu->acts)) |
|
25 | 25 | { |
26 | 26 | Context::set('currentMenu', $key); |
27 | 27 | break; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | // set a search option used in the template |
68 | 68 | $count_search_option = count($this->search_option); |
69 | - for($i=0;$i<$count_search_option;$i++) |
|
69 | + for ($i = 0; $i < $count_search_option; $i++) |
|
70 | 70 | { |
71 | 71 | $search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]); |
72 | 72 | } |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | $oModuleModel = getModel('module'); |
76 | 76 | $module_list = array(); |
77 | 77 | $mod_srls = array(); |
78 | - foreach($output->data as $oDocument) |
|
78 | + foreach ($output->data as $oDocument) |
|
79 | 79 | { |
80 | 80 | $mod_srls[] = $oDocument->get('module_srl'); |
81 | 81 | } |
82 | 82 | $mod_srls = array_unique($mod_srls); |
83 | 83 | // Module List |
84 | 84 | $mod_srls_count = count($mod_srls); |
85 | - if($mod_srls_count) |
|
85 | + if ($mod_srls_count) |
|
86 | 86 | { |
87 | 87 | $columnList = array('module_srl', 'mid', 'browser_title'); |
88 | 88 | $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList); |
89 | - if($module_output && is_array($module_output)) |
|
89 | + if ($module_output && is_array($module_output)) |
|
90 | 90 | { |
91 | - foreach($module_output as $module) |
|
91 | + foreach ($module_output as $module) |
|
92 | 92 | { |
93 | 93 | $module_list[$module->module_srl] = $module; |
94 | 94 | } |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | Context::set('config', $config); |
116 | 116 | |
117 | 117 | $oModuleModel = getModel('module'); |
118 | - $pcIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'icons'); |
|
119 | - $mobileIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'm.icons'); |
|
118 | + $pcIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'icons'); |
|
119 | + $mobileIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'm.icons'); |
|
120 | 120 | |
121 | 121 | Context::set('pcIconSkinList', $pcIconSkinList); |
122 | 122 | Context::set('mobileIconSkinList', $mobileIconSkinList); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | function dispDocumentAdminDeclared() |
134 | 134 | { |
135 | 135 | // option for a list |
136 | - $args =new stdClass(); |
|
136 | + $args = new stdClass(); |
|
137 | 137 | $args->page = Context::get('page'); // /< Page |
138 | 138 | $args->list_count = 30; // /< the number of posts to display on a single page |
139 | 139 | $args->page_count = 10; // /< the number of pages that appear in the page navigation |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | |
148 | 148 | // get a list |
149 | 149 | $declared_output = executeQuery('document.getDeclaredList', $args); |
150 | - if($declared_output->data && count($declared_output->data)) |
|
150 | + if ($declared_output->data && count($declared_output->data)) |
|
151 | 151 | { |
152 | 152 | $document_list = array(); |
153 | 153 | |
154 | - foreach($declared_output->data as $key => $document) |
|
154 | + foreach ($declared_output->data as $key => $document) |
|
155 | 155 | { |
156 | 156 | $document_list[$key] = new documentItem(); |
157 | 157 | $document_list[$key]->setAttribute($document); |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | function dispDocumentAdminAlias() |
179 | 179 | { |
180 | 180 | $args->document_srl = Context::get('document_srl'); |
181 | - if(!$args->document_srl) return $this->dispDocumentAdminList(); |
|
181 | + if (!$args->document_srl) return $this->dispDocumentAdminList(); |
|
182 | 182 | |
183 | 183 | $oModel = getModel('document'); |
184 | 184 | $oDocument = $oModel->getDocument($args->document_srl); |
185 | - if(!$oDocument->isExists()) return $this->dispDocumentAdminList(); |
|
185 | + if (!$oDocument->isExists()) return $this->dispDocumentAdminList(); |
|
186 | 186 | Context::set('oDocument', $oDocument); |
187 | 187 | |
188 | 188 | $output = executeQueryArray('document.getAliases', $args); |
189 | - if(!$output->data) |
|
189 | + if (!$output->data) |
|
190 | 190 | { |
191 | 191 | $aliases = array(); |
192 | 192 | } |
@@ -75,15 +75,20 @@ |
||
75 | 75 | // HTML gallery output, the output settings via the template for the conversion to generate the html code should |
76 | 76 | preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches); |
77 | 77 | $gallery_info->width = trim($matches[3][0]); |
78 | - if(!$gallery_info->width) $gallery_info->width = 400; |
|
78 | + if(!$gallery_info->width) { |
|
79 | + $gallery_info->width = 400; |
|
80 | + } |
|
79 | 81 | |
80 | 82 | Context::set('gallery_info', $gallery_info); |
81 | 83 | |
82 | 84 | $tpl_path = $this->component_path.'tpl'; |
83 | 85 | Context::set("tpl_path", $tpl_path); |
84 | 86 | |
85 | - if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html'; |
|
86 | - else $tpl_file = 'slide_gallery.html'; |
|
87 | + if($gallery_info->gallery_style == "list") { |
|
88 | + $tpl_file = 'list_gallery.html'; |
|
89 | + } else { |
|
90 | + $tpl_file = 'slide_gallery.html'; |
|
91 | + } |
|
87 | 92 | |
88 | 93 | $oTemplate = &TemplateHandler::getInstance(); |
89 | 94 | return $oTemplate->compile($tpl_path, $tpl_file); |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | { |
46 | 46 | $gallery_info = new stdClass(); |
47 | 47 | $gallery_info->srl = rand(111111, 999999); |
48 | - $gallery_info->border_thickness = (int)$xml_obj->attrs->border_thickness; |
|
48 | + $gallery_info->border_thickness = (int) $xml_obj->attrs->border_thickness; |
|
49 | 49 | $gallery_info->gallery_style = $xml_obj->attrs->gallery_style; |
50 | 50 | $color_preg = "/^([a-fA-F0-9]{6})/"; |
51 | - $gallery_info->border_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->border_color); |
|
52 | - $gallery_info->bg_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->bg_color); |
|
51 | + $gallery_info->border_color = preg_replace($color_preg, "#$1", $xml_obj->attrs->border_color); |
|
52 | + $gallery_info->bg_color = preg_replace($color_preg, "#$1", $xml_obj->attrs->bg_color); |
|
53 | 53 | $gallery_info->gallery_align = $xml_obj->attrs->gallery_align; |
54 | 54 | |
55 | - if(!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) { |
|
55 | + if (!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) { |
|
56 | 56 | $gallery_info->gallery_align = 'center'; |
57 | 57 | } |
58 | 58 | |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | $gallery_info->images_list = preg_grep("/^[a-z0-9\/]+\.(gif|jpe?g|png)+$/i", $images_list); |
63 | 63 | |
64 | 64 | // If you set the output to output the XML code generated a list of the image |
65 | - if(Context::getResponseMethod() == 'XMLRPC') |
|
65 | + if (Context::getResponseMethod() == 'XMLRPC') |
|
66 | 66 | { |
67 | 67 | $output = array(); |
68 | - for($i=0;$i<count($gallery_info->images_list);$i++) |
|
68 | + for ($i = 0; $i < count($gallery_info->images_list); $i++) |
|
69 | 69 | { |
70 | 70 | $output[] = sprintf('<img src="%s" alt="" />', $gallery_info->images_list[$i]); |
71 | 71 | } |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | return implode('<br />', $output); |
74 | 74 | } |
75 | 75 | // HTML gallery output, the output settings via the template for the conversion to generate the html code should |
76 | - preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches); |
|
76 | + preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches); |
|
77 | 77 | $gallery_info->width = trim($matches[3][0]); |
78 | - if(!$gallery_info->width) $gallery_info->width = 400; |
|
78 | + if (!$gallery_info->width) $gallery_info->width = 400; |
|
79 | 79 | |
80 | 80 | Context::set('gallery_info', $gallery_info); |
81 | 81 | |
82 | 82 | $tpl_path = $this->component_path.'tpl'; |
83 | 83 | Context::set("tpl_path", $tpl_path); |
84 | 84 | |
85 | - if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html'; |
|
85 | + if ($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html'; |
|
86 | 86 | else $tpl_file = 'slide_gallery.html'; |
87 | 87 | |
88 | 88 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -47,11 +47,15 @@ |
||
47 | 47 | { |
48 | 48 | $poll_srl = $xml_obj->attrs->poll_srl; |
49 | 49 | $skin = $xml_obj->attrs->skin; |
50 | - if(!$skin) $skin = 'default'; |
|
50 | + if(!$skin) { |
|
51 | + $skin = 'default'; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches); |
53 | 55 | $width = $matches[2]; |
54 | - if(!$width) $width = 400; |
|
56 | + if(!$width) { |
|
57 | + $width = 400; |
|
58 | + } |
|
55 | 59 | $style = sprintf('width:%dpx', $width); |
56 | 60 | // poll model object creation to come get it return html |
57 | 61 | $oPollModel = getModel('poll'); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | // Wanted Skins survey |
29 | 29 | $oModuleModel = getModel('module'); |
30 | - $skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/poll/'); |
|
30 | + $skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/poll/'); |
|
31 | 31 | Context::set('skin_list', $skin_list); |
32 | 32 | // Pre-compiled source code to compile template return to |
33 | 33 | $tpl_path = $this->component_path.'tpl'; |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | { |
48 | 48 | $poll_srl = $xml_obj->attrs->poll_srl; |
49 | 49 | $skin = $xml_obj->attrs->skin; |
50 | - if(!$skin) $skin = 'default'; |
|
50 | + if (!$skin) $skin = 'default'; |
|
51 | 51 | |
52 | - preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches); |
|
52 | + preg_match('/width([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches); |
|
53 | 53 | $width = $matches[2]; |
54 | - if(!$width) $width = 400; |
|
54 | + if (!$width) $width = 400; |
|
55 | 55 | $style = sprintf('width:%dpx', $width); |
56 | 56 | // poll model object creation to come get it return html |
57 | 57 | $oPollModel = getModel('poll'); |
@@ -35,12 +35,24 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | //editor_config init |
38 | - if(!$editor_config->editor_height) $editor_config->editor_height = 300; |
|
39 | - if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100; |
|
40 | - if(!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor'; |
|
41 | - if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor'; |
|
42 | - if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'moono'; |
|
43 | - if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'moono'; |
|
38 | + if(!$editor_config->editor_height) { |
|
39 | + $editor_config->editor_height = 300; |
|
40 | + } |
|
41 | + if(!$editor_config->comment_editor_height) { |
|
42 | + $editor_config->comment_editor_height = 100; |
|
43 | + } |
|
44 | + if(!$editor_config->editor_skin) { |
|
45 | + $editor_config->editor_skin = 'ckeditor'; |
|
46 | + } |
|
47 | + if(!$editor_config->comment_editor_skin) { |
|
48 | + $editor_config->comment_editor_skin = 'ckeditor'; |
|
49 | + } |
|
50 | + if(!$editor_config->sel_editor_colorset) { |
|
51 | + $editor_config->sel_editor_colorset= 'moono'; |
|
52 | + } |
|
53 | + if(!$editor_config->sel_comment_editor_colorset) { |
|
54 | + $editor_config->sel_comment_editor_colorset= 'moono'; |
|
55 | + } |
|
44 | 56 | |
45 | 57 | $component_list = $oEditorModel->getComponentList(false, $site_srl, true); |
46 | 58 | $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); |
@@ -65,14 +77,20 @@ discard block |
||
65 | 77 | $xml_info->path = './modules/editor/components/'.$xml_info->component_name; |
66 | 78 | $xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path); |
67 | 79 | $xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path); |
68 | - if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; |
|
80 | + if($xml_info->package_srl) { |
|
81 | + $targetpackages[$xml_info->package_srl] = 0; |
|
82 | + } |
|
69 | 83 | } |
70 | 84 | |
71 | - if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); |
|
85 | + if(is_array($targetpackages)) { |
|
86 | + $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); |
|
87 | + } |
|
72 | 88 | |
73 | 89 | foreach($component_list as $component_name => $xml_info) |
74 | 90 | { |
75 | - if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; |
|
91 | + if($packages[$xml_info->package_srl]) { |
|
92 | + $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; |
|
93 | + } |
|
76 | 94 | } |
77 | 95 | $editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"13"); |
78 | 96 | |
@@ -162,13 +180,16 @@ discard block |
||
162 | 180 | // Get a list of module category |
163 | 181 | $module_categories = $oModuleModel->getModuleCategories(); |
164 | 182 | |
165 | - if(!is_array($mid_list)) $mid_list = array($mid_list); |
|
183 | + if(!is_array($mid_list)) { |
|
184 | + $mid_list = array($mid_list); |
|
185 | + } |
|
166 | 186 | foreach($mid_list as $module_srl => $module) |
167 | 187 | { |
168 | - if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
|
188 | + if($module) { |
|
189 | + $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
|
190 | + } |
|
169 | 191 | } |
170 | - } |
|
171 | - else |
|
192 | + } else |
|
172 | 193 | { |
173 | 194 | $module_categories[0]->list = $mid_list; |
174 | 195 | } |
@@ -22,59 +22,59 @@ discard block |
||
22 | 22 | { |
23 | 23 | $component_count = 0; |
24 | 24 | $site_module_info = Context::get('site_module_info'); |
25 | - $site_srl = (int)$site_module_info->site_srl; |
|
25 | + $site_srl = (int) $site_module_info->site_srl; |
|
26 | 26 | |
27 | 27 | // Get a type of component |
28 | 28 | $oEditorModel = getModel('editor'); |
29 | 29 | $oModuleModel = getModel('module'); |
30 | 30 | $editor_config = $oModuleModel->getModuleConfig('editor'); |
31 | 31 | |
32 | - if(!$editor_config) |
|
32 | + if (!$editor_config) |
|
33 | 33 | { |
34 | 34 | $editor_config = new stdClass(); |
35 | 35 | } |
36 | 36 | |
37 | 37 | //editor_config init |
38 | - if(!$editor_config->editor_height) $editor_config->editor_height = 300; |
|
39 | - if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100; |
|
40 | - if(!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor'; |
|
41 | - if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor'; |
|
42 | - if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'moono'; |
|
43 | - if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'moono'; |
|
38 | + if (!$editor_config->editor_height) $editor_config->editor_height = 300; |
|
39 | + if (!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100; |
|
40 | + if (!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor'; |
|
41 | + if (!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor'; |
|
42 | + if (!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset = 'moono'; |
|
43 | + if (!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset = 'moono'; |
|
44 | 44 | |
45 | 45 | $component_list = $oEditorModel->getComponentList(false, $site_srl, true); |
46 | 46 | $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); |
47 | 47 | |
48 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin); |
|
48 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->editor_skin); |
|
49 | 49 | |
50 | 50 | $contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles'); |
51 | 51 | $content_style_list = array(); |
52 | - for($i=0,$c=count($contents);$i<$c;$i++) |
|
52 | + for ($i = 0, $c = count($contents); $i < $c; $i++) |
|
53 | 53 | { |
54 | 54 | $style = $contents[$i]; |
55 | - $info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles'); |
|
55 | + $info = $oModuleModel->loadSkinInfo($this->module_path, $style, 'styles'); |
|
56 | 56 | $content_style_list[$style] = new stdClass(); |
57 | 57 | $content_style_list[$style]->title = $info->title; |
58 | 58 | } |
59 | 59 | |
60 | 60 | // Get install info, update info, count |
61 | 61 | $oAutoinstallModel = getModel('autoinstall'); |
62 | - foreach($component_list as $component_name => $xml_info) |
|
62 | + foreach ($component_list as $component_name => $xml_info) |
|
63 | 63 | { |
64 | 64 | $component_count++; |
65 | 65 | $xml_info->path = './modules/editor/components/'.$xml_info->component_name; |
66 | 66 | $xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path); |
67 | 67 | $xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path); |
68 | - if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; |
|
68 | + if ($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; |
|
69 | 69 | } |
70 | 70 | |
71 | - if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); |
|
71 | + if (is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); |
|
72 | 72 | |
73 | - foreach($component_list as $component_name => $xml_info) |
|
73 | + foreach ($component_list as $component_name => $xml_info) |
|
74 | 74 | { |
75 | - if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; |
|
75 | + if ($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; |
|
76 | 76 | } |
77 | - $editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"13"); |
|
77 | + $editor_config_default = array("editor_height" => "300", "comment_editor_height" => "100", "content_font_size"=>"13"); |
|
78 | 78 | |
79 | 79 | //editor preview |
80 | 80 | $config = $oEditorModel->getEditorConfig(); |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | function dispEditorAdminSetupComponent() |
139 | 139 | { |
140 | 140 | $site_module_info = Context::get('site_module_info'); |
141 | - $site_srl = (int)$site_module_info->site_srl; |
|
141 | + $site_srl = (int) $site_module_info->site_srl; |
|
142 | 142 | |
143 | 143 | $component_name = Context::get('component_name'); |
144 | 144 | // Get information of the editor component |
145 | 145 | $oEditorModel = getModel('editor'); |
146 | - $component = $oEditorModel->getComponent($component_name,$site_srl); |
|
146 | + $component = $oEditorModel->getComponent($component_name, $site_srl); |
|
147 | 147 | |
148 | - if(!$component->component_name) { |
|
148 | + if (!$component->component_name) { |
|
149 | 149 | $this->stop('msg_invalid_request'); |
150 | 150 | return; |
151 | 151 | } |
@@ -158,20 +158,20 @@ discard block |
||
158 | 158 | // Get a mid list |
159 | 159 | $oModuleModel = getModel('module'); |
160 | 160 | |
161 | - $args =new stdClass(); |
|
161 | + $args = new stdClass(); |
|
162 | 162 | $args->site_srl = $site_srl; |
163 | 163 | $columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title'); |
164 | 164 | $mid_list = $oModuleModel->getMidList($args, $columnList); |
165 | 165 | // Combination of module_category and module |
166 | - if(!$args->site_srl) |
|
166 | + if (!$args->site_srl) |
|
167 | 167 | { |
168 | 168 | // Get a list of module category |
169 | 169 | $module_categories = $oModuleModel->getModuleCategories(); |
170 | 170 | |
171 | - if(!is_array($mid_list)) $mid_list = array($mid_list); |
|
172 | - foreach($mid_list as $module_srl => $module) |
|
171 | + if (!is_array($mid_list)) $mid_list = array($mid_list); |
|
172 | + foreach ($mid_list as $module_srl => $module) |
|
173 | 173 | { |
174 | - if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
|
174 | + if ($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | else |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $module_categories[0]->list = $mid_list; |
180 | 180 | } |
181 | 181 | |
182 | - Context::set('mid_list',$module_categories); |
|
182 | + Context::set('mid_list', $module_categories); |
|
183 | 183 | |
184 | 184 | //Security |
185 | 185 | $security = new Security(); |
186 | 186 | $security->encodeHTML('group_list..title'); |
187 | 187 | $security->encodeHTML('component...', 'component_name'); |
188 | - $security->encodeHTML('mid_list..title','mid_list..list..browser_title'); |
|
188 | + $security->encodeHTML('mid_list..title', 'mid_list..list..browser_title'); |
|
189 | 189 | |
190 | 190 | $this->setTemplatePath($this->module_path.'tpl'); |
191 | 191 | $this->setTemplateFile('setup_component'); |
@@ -64,16 +64,13 @@ discard block |
||
64 | 64 | if($document_list[$target_srl]) |
65 | 65 | { |
66 | 66 | $file->upload_target_type = 'doc'; |
67 | - } |
|
68 | - else if($comment_list[$target_srl]) |
|
67 | + } else if($comment_list[$target_srl]) |
|
69 | 68 | { |
70 | 69 | $file->upload_target_type = 'com'; |
71 | - } |
|
72 | - else if($module_list[$target_srl]) |
|
70 | + } else if($module_list[$target_srl]) |
|
73 | 71 | { |
74 | 72 | $file->upload_target_type = 'mod'; |
75 | - } |
|
76 | - else |
|
73 | + } else |
|
77 | 74 | { |
78 | 75 | // document |
79 | 76 | $document = $oDocumentModel->getDocument($target_srl); |
@@ -115,15 +112,21 @@ discard block |
||
115 | 112 | // Check if data is already obtained |
116 | 113 | for($i = 0; $i < $com_srls_count; ++$i) |
117 | 114 | { |
118 | - if($comment_list[$com_srls[$i]]) delete($com_srls[$i]); |
|
115 | + if($comment_list[$com_srls[$i]]) { |
|
116 | + delete($com_srls[$i]); |
|
117 | + } |
|
119 | 118 | } |
120 | 119 | for($i = 0; $i < $doc_srls_count; ++$i) |
121 | 120 | { |
122 | - if($document_list[$doc_srls[$i]]) delete($doc_srls[$i]); |
|
121 | + if($document_list[$doc_srls[$i]]) { |
|
122 | + delete($doc_srls[$i]); |
|
123 | + } |
|
123 | 124 | } |
124 | 125 | for($i = 0; $i < $mod_srls_count; ++$i) |
125 | 126 | { |
126 | - if($module_list[$mod_srls[$i]]) delete($mod_srls[$i]); |
|
127 | + if($module_list[$mod_srls[$i]]) { |
|
128 | + delete($mod_srls[$i]); |
|
129 | + } |
|
127 | 130 | } |
128 | 131 | } |
129 | 132 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | , 'source_filename', 'isvalid', 'file_size', 'download_count', 'files.regdate', 'ipaddress', 'member.member_srl', 'member.nick_name', 'uploaded_filename'); |
37 | 37 | $output = $oFileAdminModel->getFileList($args, $columnList); |
38 | 38 | // Get the document for looping a list |
39 | - if($output->data) |
|
39 | + if ($output->data) |
|
40 | 40 | { |
41 | 41 | $oCommentModel = getModel('comment'); |
42 | 42 | $oDocumentModel = getModel('document'); |
@@ -45,31 +45,31 @@ discard block |
||
45 | 45 | $file_list = array(); |
46 | 46 | $document_list = array(); |
47 | 47 | $comment_list = array(); |
48 | - $module_list= array(); |
|
48 | + $module_list = array(); |
|
49 | 49 | |
50 | 50 | $doc_srls = array(); |
51 | 51 | $com_srls = array(); |
52 | - $mod_srls= array(); |
|
52 | + $mod_srls = array(); |
|
53 | 53 | |
54 | - foreach($output->data as $file) |
|
54 | + foreach ($output->data as $file) |
|
55 | 55 | { |
56 | 56 | $file_srl = $file->file_srl; |
57 | 57 | $target_srl = $file->upload_target_srl; |
58 | 58 | $file_update_args = new stdClass(); |
59 | 59 | $file_update_args->file_srl = $file_srl; |
60 | 60 | // Find and update if upload_target_type doesn't exist |
61 | - if(!$file->upload_target_type) |
|
61 | + if (!$file->upload_target_type) |
|
62 | 62 | { |
63 | 63 | // Pass if upload_target_type is already found |
64 | - if($document_list[$target_srl]) |
|
64 | + if ($document_list[$target_srl]) |
|
65 | 65 | { |
66 | 66 | $file->upload_target_type = 'doc'; |
67 | 67 | } |
68 | - else if($comment_list[$target_srl]) |
|
68 | + else if ($comment_list[$target_srl]) |
|
69 | 69 | { |
70 | 70 | $file->upload_target_type = 'com'; |
71 | 71 | } |
72 | - else if($module_list[$target_srl]) |
|
72 | + else if ($module_list[$target_srl]) |
|
73 | 73 | { |
74 | 74 | $file->upload_target_type = 'mod'; |
75 | 75 | } |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | { |
78 | 78 | // document |
79 | 79 | $document = $oDocumentModel->getDocument($target_srl); |
80 | - if($document->isExists()) |
|
80 | + if ($document->isExists()) |
|
81 | 81 | { |
82 | 82 | $file->upload_target_type = 'doc'; |
83 | 83 | $file_update_args->upload_target_type = $file->upload_target_type; |
84 | 84 | $document_list[$target_srl] = $document; |
85 | 85 | } |
86 | 86 | // comment |
87 | - if(!$file->upload_target_type) |
|
87 | + if (!$file->upload_target_type) |
|
88 | 88 | { |
89 | 89 | $comment = $oCommentModel->getComment($target_srl); |
90 | - if($comment->isExists()) |
|
90 | + if ($comment->isExists()) |
|
91 | 91 | { |
92 | 92 | $file->upload_target_type = 'com'; |
93 | 93 | $file->target_document_srl = $comment->document_srl; |
@@ -97,39 +97,39 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | // module (for a page) |
100 | - if(!$file->upload_target_type) |
|
100 | + if (!$file->upload_target_type) |
|
101 | 101 | { |
102 | 102 | $module = $oModuleModel->getModulesInfo($target_srl); |
103 | - if($module) |
|
103 | + if ($module) |
|
104 | 104 | { |
105 | 105 | $file->upload_target_type = 'mod'; |
106 | 106 | $file_update_args->upload_target_type = $file->upload_target_type; |
107 | 107 | $module_list[$module->comment_srl] = $module; |
108 | 108 | } |
109 | 109 | } |
110 | - if($file_update_args->upload_target_type) |
|
110 | + if ($file_update_args->upload_target_type) |
|
111 | 111 | { |
112 | 112 | executeQuery('file.updateFileTargetType', $file_update_args); |
113 | 113 | } |
114 | 114 | } |
115 | 115 | // Check if data is already obtained |
116 | - for($i = 0; $i < $com_srls_count; ++$i) |
|
116 | + for ($i = 0; $i < $com_srls_count; ++$i) |
|
117 | 117 | { |
118 | - if($comment_list[$com_srls[$i]]) delete($com_srls[$i]); |
|
118 | + if ($comment_list[$com_srls[$i]]) delete($com_srls[$i]); |
|
119 | 119 | } |
120 | - for($i = 0; $i < $doc_srls_count; ++$i) |
|
120 | + for ($i = 0; $i < $doc_srls_count; ++$i) |
|
121 | 121 | { |
122 | - if($document_list[$doc_srls[$i]]) delete($doc_srls[$i]); |
|
122 | + if ($document_list[$doc_srls[$i]]) delete($doc_srls[$i]); |
|
123 | 123 | } |
124 | - for($i = 0; $i < $mod_srls_count; ++$i) |
|
124 | + for ($i = 0; $i < $mod_srls_count; ++$i) |
|
125 | 125 | { |
126 | - if($module_list[$mod_srls[$i]]) delete($mod_srls[$i]); |
|
126 | + if ($module_list[$mod_srls[$i]]) delete($mod_srls[$i]); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - if($file->upload_target_type) |
|
130 | + if ($file->upload_target_type) |
|
131 | 131 | { |
132 | - if(!in_array($file->upload_target_srl, ${$file->upload_target_type.'_srls'})) |
|
132 | + if (!in_array($file->upload_target_srl, ${$file->upload_target_type.'_srls'})) |
|
133 | 133 | { |
134 | 134 | ${$file->upload_target_type.'_srls'}[] = $target_srl; |
135 | 135 | } |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | $mod_srls = array_unique($mod_srls); |
145 | 145 | // Comment list |
146 | 146 | $com_srls_count = count($com_srls); |
147 | - if($com_srls_count) |
|
147 | + if ($com_srls_count) |
|
148 | 148 | { |
149 | 149 | $comment_output = $oCommentModel->getComments($com_srls); |
150 | - foreach($comment_output as $comment) |
|
150 | + foreach ($comment_output as $comment) |
|
151 | 151 | { |
152 | 152 | $comment_list[$comment->comment_srl] = $comment; |
153 | 153 | $doc_srls[] = $comment->document_srl; |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | } |
156 | 156 | // Document list |
157 | 157 | $doc_srls_count = count($doc_srls); |
158 | - if($doc_srls_count) |
|
158 | + if ($doc_srls_count) |
|
159 | 159 | { |
160 | 160 | $document_output = $oDocumentModel->getDocuments($doc_srls); |
161 | - if(is_array($document_output)) |
|
161 | + if (is_array($document_output)) |
|
162 | 162 | { |
163 | - foreach($document_output as $document) |
|
163 | + foreach ($document_output as $document) |
|
164 | 164 | { |
165 | 165 | $document_list[$document->document_srl] = $document; |
166 | 166 | } |
@@ -168,22 +168,22 @@ discard block |
||
168 | 168 | } |
169 | 169 | // Module List |
170 | 170 | $mod_srls_count = count($mod_srls); |
171 | - if($mod_srls_count) |
|
171 | + if ($mod_srls_count) |
|
172 | 172 | { |
173 | 173 | $columnList = array('module_srl', 'mid', 'browser_title'); |
174 | 174 | $module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList); |
175 | - if($module_output && is_array($module_output)) |
|
175 | + if ($module_output && is_array($module_output)) |
|
176 | 176 | { |
177 | - foreach($module_output as $module) |
|
177 | + foreach ($module_output as $module) |
|
178 | 178 | { |
179 | 179 | $module_list[$module->module_srl] = $module; |
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - foreach($file_list as $srl => $file) |
|
184 | + foreach ($file_list as $srl => $file) |
|
185 | 185 | { |
186 | - if($file->upload_target_type == 'com') |
|
186 | + if ($file->upload_target_type == 'com') |
|
187 | 187 | { |
188 | 188 | $file_list[$srl]->target_document_srl = $comment_list[$file->upload_target_srl]->document_srl; |
189 | 189 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $oFileModel = getModel('file'); |
218 | 218 | $config = $oFileModel->getFileConfig(); |
219 | - Context::set('config',$config); |
|
219 | + Context::set('config', $config); |
|
220 | 220 | $iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size')); |
221 | 221 | $iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize')); |
222 | 222 | $iniMinSize = min($iniPostMaxSize, $iniUploadMaxSize); |