@@ -141,7 +141,7 @@ |
||
141 | 141 | * @param string $addon Name to get information |
142 | 142 | * @param int $site_srl Site srl |
143 | 143 | * @param string $gtype site or global |
144 | - * @return object Returns a information |
|
144 | + * @return null|stdClass Returns a information |
|
145 | 145 | */ |
146 | 146 | function getAddonInfoXml($addon, $site_srl = 0, $gtype = 'site') |
147 | 147 | { |
@@ -100,7 +100,9 @@ discard block |
||
100 | 100 | // Wanted information on the add-on |
101 | 101 | $info = $this->getAddonInfoXml($addon_name, $site_srl, $gtype); |
102 | 102 | |
103 | - if(!$info) $info = new stdClass(); |
|
103 | + if(!$info) { |
|
104 | + $info = new stdClass(); |
|
105 | + } |
|
104 | 106 | |
105 | 107 | $info->addon = $addon_name; |
106 | 108 | $info->path = $path; |
@@ -113,8 +115,7 @@ discard block |
||
113 | 115 | // If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ) |
114 | 116 | $oAddonAdminController->doInsert($addon_name, $site_srl, $type); |
115 | 117 | // Is activated |
116 | - } |
|
117 | - else |
|
118 | + } else |
|
118 | 119 | { |
119 | 120 | if($inserted_addons[$addon_name]->is_used == 'Y') |
120 | 121 | { |
@@ -174,8 +175,7 @@ discard block |
||
174 | 175 | if($gtype == 'global') |
175 | 176 | { |
176 | 177 | $output = executeQuery('addon.getAddonInfo', $db_args); |
177 | - } |
|
178 | - else |
|
178 | + } else |
|
179 | 179 | { |
180 | 180 | $db_args->site_srl = $site_srl; |
181 | 181 | $output = executeQuery('addon.getSiteAddonInfo', $db_args); |
@@ -186,8 +186,7 @@ discard block |
||
186 | 186 | if($extra_vals->mid_list) |
187 | 187 | { |
188 | 188 | $addon_info->mid_list = $extra_vals->mid_list; |
189 | - } |
|
190 | - else |
|
189 | + } else |
|
191 | 190 | { |
192 | 191 | $addon_info->mid_list = array(); |
193 | 192 | } |
@@ -217,8 +216,7 @@ discard block |
||
217 | 216 | { |
218 | 217 | $author_list = array(); |
219 | 218 | $author_list[] = $xml_obj->author; |
220 | - } |
|
221 | - else |
|
219 | + } else |
|
222 | 220 | { |
223 | 221 | $author_list = $xml_obj->author; |
224 | 222 | } |
@@ -306,8 +304,7 @@ discard block |
||
306 | 304 | } |
307 | 305 | } |
308 | 306 | } |
309 | - } |
|
310 | - else |
|
307 | + } else |
|
311 | 308 | { |
312 | 309 | // addon format 0.1 |
313 | 310 | $addon_info = new stdClass(); |
@@ -409,8 +406,7 @@ discard block |
||
409 | 406 | if($gtype == 'global') |
410 | 407 | { |
411 | 408 | $output = executeQueryArray('addon.getAddons', $args); |
412 | - } |
|
413 | - else |
|
409 | + } else |
|
414 | 410 | { |
415 | 411 | $args->site_srl = $site_srl; |
416 | 412 | $output = executeQueryArray('addon.getSiteAddons', $args); |
@@ -448,20 +444,17 @@ discard block |
||
448 | 444 | if($type == "pc") |
449 | 445 | { |
450 | 446 | $output = executeQuery('addon.getAddonIsActivated', $args); |
451 | - } |
|
452 | - else |
|
447 | + } else |
|
453 | 448 | { |
454 | 449 | $output = executeQuery('addon.getMAddonIsActivated', $args); |
455 | 450 | } |
456 | - } |
|
457 | - else |
|
451 | + } else |
|
458 | 452 | { |
459 | 453 | $args->site_srl = $site_srl; |
460 | 454 | if($type == "pc") |
461 | 455 | { |
462 | 456 | $output = executeQuery('addon.getSiteAddonIsActivated', $args); |
463 | - } |
|
464 | - else |
|
457 | + } else |
|
465 | 458 | { |
466 | 459 | $output = executeQuery('addon.getSiteMAddonIsActivated', $args); |
467 | 460 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | function getAddonPath($addon_name) |
28 | 28 | { |
29 | 29 | $class_path = sprintf('./addons/%s/', $addon_name); |
30 | - if(is_dir($class_path)) |
|
30 | + if (is_dir($class_path)) |
|
31 | 31 | { |
32 | 32 | return $class_path; |
33 | 33 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $addonList = $this->getAddonList(0, 'site'); |
45 | 45 | |
46 | 46 | $oAutoinstallModel = getModel('autoinstall'); |
47 | - foreach($addonList as $key => $addon) |
|
47 | + foreach ($addonList as $key => $addon) |
|
48 | 48 | { |
49 | 49 | // get easyinstall remove url |
50 | 50 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($addon->path); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $addonList[$key]->need_update = $package[$packageSrl]->need_update; |
56 | 56 | |
57 | 57 | // get easyinstall update url |
58 | - if($addonList[$key]->need_update == 'Y') |
|
58 | + if ($addonList[$key]->need_update == 'Y') |
|
59 | 59 | { |
60 | 60 | $addonList[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl); |
61 | 61 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // Downloaded and installed add-on to the list of Wanted |
79 | 79 | $searched_list = FileHandler::readDir('./addons', '/^([a-zA-Z0-9_]+)$/'); |
80 | 80 | $searched_count = count($searched_list); |
81 | - if(!$searched_count) |
|
81 | + if (!$searched_count) |
|
82 | 82 | { |
83 | 83 | return; |
84 | 84 | } |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | |
88 | 88 | $oAddonAdminController = getAdminController('addon'); |
89 | 89 | |
90 | - for($i = 0; $i < $searched_count; $i++) |
|
90 | + for ($i = 0; $i < $searched_count; $i++) |
|
91 | 91 | { |
92 | 92 | // Add the name of |
93 | 93 | $addon_name = $searched_list[$i]; |
94 | - if($addon_name == "smartphone") |
|
94 | + if ($addon_name == "smartphone") |
|
95 | 95 | { |
96 | 96 | continue; |
97 | 97 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // Wanted information on the add-on |
101 | 101 | $info = $this->getAddonInfoXml($addon_name, $site_srl, $gtype); |
102 | 102 | |
103 | - if(!$info) $info = new stdClass(); |
|
103 | + if (!$info) $info = new stdClass(); |
|
104 | 104 | |
105 | 105 | $info->addon = $addon_name; |
106 | 106 | $info->path = $path; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $info->mactivated = FALSE; |
109 | 109 | $info->fixed = FALSE; |
110 | 110 | // Check if a permossion is granted entered in DB |
111 | - if(!in_array($addon_name, array_keys($inserted_addons))) |
|
111 | + if (!in_array($addon_name, array_keys($inserted_addons))) |
|
112 | 112 | { |
113 | 113 | // If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ) |
114 | 114 | $oAddonAdminController->doInsert($addon_name, $site_srl, $type); |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | } |
117 | 117 | else |
118 | 118 | { |
119 | - if($inserted_addons[$addon_name]->is_used == 'Y') |
|
119 | + if ($inserted_addons[$addon_name]->is_used == 'Y') |
|
120 | 120 | { |
121 | 121 | $info->activated = TRUE; |
122 | 122 | } |
123 | - if($inserted_addons[$addon_name]->is_used_m == 'Y') |
|
123 | + if ($inserted_addons[$addon_name]->is_used_m == 'Y') |
|
124 | 124 | { |
125 | 125 | $info->mactivated = TRUE; |
126 | 126 | } |
127 | - if($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y') |
|
127 | + if ($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y') |
|
128 | 128 | { |
129 | 129 | $info->fixed = TRUE; |
130 | 130 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | { |
148 | 148 | // Get a path of the requested module. Return if not exists. |
149 | 149 | $addon_path = $this->getAddonPath($addon); |
150 | - if(!$addon_path) |
|
150 | + if (!$addon_path) |
|
151 | 151 | { |
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
155 | 155 | // Read the xml file for module skin information |
156 | 156 | $xml_file = sprintf("%sconf/info.xml", FileHandler::getRealpath($addon_path)); |
157 | - if(!file_exists($xml_file)) |
|
157 | + if (!file_exists($xml_file)) |
|
158 | 158 | { |
159 | 159 | return; |
160 | 160 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
164 | 164 | $xml_obj = $tmp_xml_obj->addon; |
165 | 165 | |
166 | - if(!$xml_obj) |
|
166 | + if (!$xml_obj) |
|
167 | 167 | { |
168 | 168 | return; |
169 | 169 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // DB is set to bring history |
172 | 172 | $db_args = new stdClass(); |
173 | 173 | $db_args->addon = $addon; |
174 | - if($gtype == 'global') |
|
174 | + if ($gtype == 'global') |
|
175 | 175 | { |
176 | 176 | $output = executeQuery('addon.getAddonInfo', $db_args); |
177 | 177 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $extra_vals = unserialize($output->data->extra_vars); |
184 | 184 | |
185 | 185 | $addon_info = new stdClass(); |
186 | - if($extra_vals->mid_list) |
|
186 | + if ($extra_vals->mid_list) |
|
187 | 187 | { |
188 | 188 | $addon_info->mid_list = $extra_vals->mid_list; |
189 | 189 | } |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | $addon_info->mid_list = array(); |
193 | 193 | } |
194 | 194 | |
195 | - if($extra_vals->xe_run_method) |
|
195 | + if ($extra_vals->xe_run_method) |
|
196 | 196 | { |
197 | 197 | $addon_info->xe_run_method = $extra_vals->xe_run_method; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // Add information |
201 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
201 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
202 | 202 | { |
203 | 203 | // addon format v0.2 |
204 | 204 | $date_obj = new stdClass(); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $addon_info->license = $xml_obj->license->body; |
214 | 214 | $addon_info->license_link = $xml_obj->license->attrs->link; |
215 | 215 | |
216 | - if(!is_array($xml_obj->author)) |
|
216 | + if (!is_array($xml_obj->author)) |
|
217 | 217 | { |
218 | 218 | $author_list = array(); |
219 | 219 | $author_list[] = $xml_obj->author; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | $addon_info->author = array(); |
227 | - foreach($author_list as $author) |
|
227 | + foreach ($author_list as $author) |
|
228 | 228 | { |
229 | 229 | $author_obj = new stdClass(); |
230 | 230 | $author_obj->name = $author->name->body; |
@@ -234,39 +234,39 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | // Expand the variable order |
237 | - if($xml_obj->extra_vars) |
|
237 | + if ($xml_obj->extra_vars) |
|
238 | 238 | { |
239 | 239 | $extra_var_groups = $xml_obj->extra_vars->group; |
240 | - if(!$extra_var_groups) |
|
240 | + if (!$extra_var_groups) |
|
241 | 241 | { |
242 | 242 | $extra_var_groups = $xml_obj->extra_vars; |
243 | 243 | } |
244 | - if(!is_array($extra_var_groups)) |
|
244 | + if (!is_array($extra_var_groups)) |
|
245 | 245 | { |
246 | 246 | $extra_var_groups = array($extra_var_groups); |
247 | 247 | } |
248 | 248 | |
249 | - foreach($extra_var_groups as $group) |
|
249 | + foreach ($extra_var_groups as $group) |
|
250 | 250 | { |
251 | 251 | $extra_vars = $group->var; |
252 | - if(!is_array($group->var)) |
|
252 | + if (!is_array($group->var)) |
|
253 | 253 | { |
254 | 254 | $extra_vars = array($group->var); |
255 | 255 | } |
256 | 256 | |
257 | - foreach($extra_vars as $key => $val) |
|
257 | + foreach ($extra_vars as $key => $val) |
|
258 | 258 | { |
259 | - if(!$val) |
|
259 | + if (!$val) |
|
260 | 260 | { |
261 | 261 | continue; |
262 | 262 | } |
263 | 263 | |
264 | 264 | $obj = new stdClass(); |
265 | - if(!$val->attrs) |
|
265 | + if (!$val->attrs) |
|
266 | 266 | { |
267 | 267 | $val->attrs = new stdClass(); |
268 | 268 | } |
269 | - if(!$val->attrs->type) |
|
269 | + if (!$val->attrs->type) |
|
270 | 270 | { |
271 | 271 | $val->attrs->type = 'text'; |
272 | 272 | } |
@@ -276,26 +276,26 @@ discard block |
||
276 | 276 | $obj->title = $val->title->body; |
277 | 277 | $obj->type = $val->attrs->type; |
278 | 278 | $obj->description = $val->description->body; |
279 | - if($obj->name) |
|
279 | + if ($obj->name) |
|
280 | 280 | { |
281 | 281 | $obj->value = $extra_vals->{$obj->name}; |
282 | 282 | } |
283 | - if(strpos($obj->value, '|@|') != FALSE) |
|
283 | + if (strpos($obj->value, '|@|') != FALSE) |
|
284 | 284 | { |
285 | 285 | $obj->value = explode('|@|', $obj->value); |
286 | 286 | } |
287 | - if($obj->type == 'mid_list' && !is_array($obj->value)) |
|
287 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) |
|
288 | 288 | { |
289 | 289 | $obj->value = array($obj->value); |
290 | 290 | } |
291 | 291 | |
292 | 292 | // 'Select'type obtained from the option list. |
293 | - if($val->options && !is_array($val->options)) |
|
293 | + if ($val->options && !is_array($val->options)) |
|
294 | 294 | { |
295 | 295 | $val->options = array($val->options); |
296 | 296 | } |
297 | 297 | |
298 | - for($i = 0, $c = count($val->options); $i < $c; $i++) |
|
298 | + for ($i = 0, $c = count($val->options); $i < $c; $i++) |
|
299 | 299 | { |
300 | 300 | $obj->options[$i] = new stdClass(); |
301 | 301 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -328,30 +328,30 @@ discard block |
||
328 | 328 | $addon_info->author = array(); |
329 | 329 | $addon_info->author[] = $author_obj; |
330 | 330 | |
331 | - if($xml_obj->extra_vars) |
|
331 | + if ($xml_obj->extra_vars) |
|
332 | 332 | { |
333 | 333 | // Expand the variable order |
334 | 334 | $extra_var_groups = $xml_obj->extra_vars->group; |
335 | - if(!$extra_var_groups) |
|
335 | + if (!$extra_var_groups) |
|
336 | 336 | { |
337 | 337 | $extra_var_groups = $xml_obj->extra_vars; |
338 | 338 | } |
339 | - if(!is_array($extra_var_groups)) |
|
339 | + if (!is_array($extra_var_groups)) |
|
340 | 340 | { |
341 | 341 | $extra_var_groups = array($extra_var_groups); |
342 | 342 | } |
343 | - foreach($extra_var_groups as $group) |
|
343 | + foreach ($extra_var_groups as $group) |
|
344 | 344 | { |
345 | 345 | $extra_vars = $group->var; |
346 | - if(!is_array($group->var)) |
|
346 | + if (!is_array($group->var)) |
|
347 | 347 | { |
348 | 348 | $extra_vars = array($group->var); |
349 | 349 | } |
350 | 350 | |
351 | 351 | $addon_info->extra_vars = array(); |
352 | - foreach($extra_vars as $key => $val) |
|
352 | + foreach ($extra_vars as $key => $val) |
|
353 | 353 | { |
354 | - if(!$val) |
|
354 | + if (!$val) |
|
355 | 355 | { |
356 | 356 | continue; |
357 | 357 | } |
@@ -363,26 +363,26 @@ discard block |
||
363 | 363 | $obj->title = $val->title->body; |
364 | 364 | $obj->type = $val->type->body ? $val->type->body : 'text'; |
365 | 365 | $obj->description = $val->description->body; |
366 | - if($obj->name) |
|
366 | + if ($obj->name) |
|
367 | 367 | { |
368 | 368 | $obj->value = $extra_vals->{$obj->name}; |
369 | 369 | } |
370 | - if(strpos($obj->value, '|@|') != false) |
|
370 | + if (strpos($obj->value, '|@|') != false) |
|
371 | 371 | { |
372 | 372 | $obj->value = explode('|@|', $obj->value); |
373 | 373 | } |
374 | - if($obj->type == 'mid_list' && !is_array($obj->value)) |
|
374 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) |
|
375 | 375 | { |
376 | 376 | $obj->value = array($obj->value); |
377 | 377 | } |
378 | 378 | // 'Select'type obtained from the option list. |
379 | - if($val->options && !is_array($val->options)) |
|
379 | + if ($val->options && !is_array($val->options)) |
|
380 | 380 | { |
381 | 381 | $val->options = array($val->options); |
382 | 382 | } |
383 | 383 | |
384 | 384 | $obj->options = array(); |
385 | - for($i = 0, $c = count($val->options); $i < $c; $i++) |
|
385 | + for ($i = 0, $c = count($val->options); $i < $c; $i++) |
|
386 | 386 | { |
387 | 387 | $obj->options[$i]->title = $val->options[$i]->title->body; |
388 | 388 | $obj->options[$i]->value = $val->options[$i]->value->body; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | { |
407 | 407 | $args = new stdClass(); |
408 | 408 | $args->list_order = 'addon'; |
409 | - if($gtype == 'global') |
|
409 | + if ($gtype == 'global') |
|
410 | 410 | { |
411 | 411 | $output = executeQueryArray('addon.getAddons', $args); |
412 | 412 | } |
@@ -415,14 +415,14 @@ discard block |
||
415 | 415 | $args->site_srl = $site_srl; |
416 | 416 | $output = executeQueryArray('addon.getSiteAddons', $args); |
417 | 417 | } |
418 | - if(!$output->data) |
|
418 | + if (!$output->data) |
|
419 | 419 | { |
420 | 420 | return array(); |
421 | 421 | } |
422 | 422 | |
423 | 423 | $activated_count = count($output->data); |
424 | 424 | $addon_list = array(); |
425 | - for($i = 0; $i < $activated_count; $i++) |
|
425 | + for ($i = 0; $i < $activated_count; $i++) |
|
426 | 426 | { |
427 | 427 | $addon = $output->data[$i]; |
428 | 428 | $addon_list[$addon->addon] = $addon; |
@@ -443,9 +443,9 @@ discard block |
||
443 | 443 | { |
444 | 444 | $args = new stdClass(); |
445 | 445 | $args->addon = $addon; |
446 | - if($gtype == 'global') |
|
446 | + if ($gtype == 'global') |
|
447 | 447 | { |
448 | - if($type == "pc") |
|
448 | + if ($type == "pc") |
|
449 | 449 | { |
450 | 450 | $output = executeQuery('addon.getAddonIsActivated', $args); |
451 | 451 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | else |
458 | 458 | { |
459 | 459 | $args->site_srl = $site_srl; |
460 | - if($type == "pc") |
|
460 | + if ($type == "pc") |
|
461 | 461 | { |
462 | 462 | $output = executeQuery('addon.getSiteAddonIsActivated', $args); |
463 | 463 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $output = executeQuery('addon.getSiteMAddonIsActivated', $args); |
467 | 467 | } |
468 | 468 | } |
469 | - if($output->data->count > 0) |
|
469 | + if ($output->data->count > 0) |
|
470 | 470 | { |
471 | 471 | return TRUE; |
472 | 472 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Initilization |
44 | - * @return void |
|
44 | + * @return ModuleObject|null |
|
45 | 45 | */ |
46 | 46 | function init() |
47 | 47 | { |
@@ -566,7 +566,7 @@ |
||
566 | 566 | /** |
567 | 567 | * Retrun server environment to XML string |
568 | 568 | * @return object |
569 | - */ |
|
569 | + */ |
|
570 | 570 | function dispAdminViewServerEnv() |
571 | 571 | { |
572 | 572 | $info = array(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $db_info = Context::getDBInfo(); |
30 | 30 | |
31 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
31 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
32 | 32 | { |
33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url); |
34 | 34 | } |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | // forbit access if the user is not an administrator |
49 | 49 | $oMemberModel = getModel('member'); |
50 | 50 | $logged_info = $oMemberModel->getLoggedInfo(); |
51 | - if($logged_info->is_admin != 'Y') |
|
51 | + if ($logged_info->is_admin != 'Y') |
|
52 | 52 | { |
53 | 53 | return $this->stop("msg_is_not_administrator"); |
54 | 54 | } |
55 | 55 | |
56 | 56 | // change into administration layout |
57 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
57 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
58 | 58 | $this->setLayoutPath($this->getTemplatePath()); |
59 | 59 | $this->setLayoutFile('layout.html'); |
60 | 60 | |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y'); |
75 | 75 | Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N'); |
76 | 76 | Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none"); |
77 | - if($db_info->http_port) |
|
77 | + if ($db_info->http_port) |
|
78 | 78 | { |
79 | 79 | Context::set('http_port', $db_info->http_port); |
80 | 80 | } |
81 | - if($db_info->https_port) |
|
81 | + if ($db_info->https_port) |
|
82 | 82 | { |
83 | 83 | Context::set('https_port', $db_info->https_port); |
84 | 84 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | function checkEasyinstall() |
95 | 95 | { |
96 | 96 | $lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile); |
97 | - if($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
97 | + if ($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
98 | 98 | { |
99 | 99 | return; |
100 | 100 | } |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | $lUpdateDoc = $xml_lUpdate->parse($buff); |
109 | 109 | $updateDate = $lUpdateDoc->response->updatedate->body; |
110 | 110 | |
111 | - if(!$updateDate) |
|
111 | + if (!$updateDate) |
|
112 | 112 | { |
113 | 113 | $this->_markingCheckEasyinstall(); |
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | $item = $oAutoinstallModel->getLatestPackage(); |
118 | - if(!$item || $item->updatedate < $updateDate) |
|
118 | + if (!$item || $item->updatedate < $updateDate) |
|
119 | 119 | { |
120 | 120 | $oController = getAdminController('autoinstall'); |
121 | 121 | $oController->_updateinfo(); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | // Check is_shortcut column |
146 | 146 | $oDB = DB::getInstance(); |
147 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
147 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
148 | 148 | { |
149 | 149 | return; |
150 | 150 | } |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | $currentAct = Context::get('act'); |
163 | 163 | $subMenuTitle = ''; |
164 | 164 | |
165 | - foreach((array) $moduleActionInfo->menu as $key => $value) |
|
165 | + foreach ((array) $moduleActionInfo->menu as $key => $value) |
|
166 | 166 | { |
167 | - if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
167 | + if (isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
168 | 168 | { |
169 | 169 | $subMenuTitle = $value->title; |
170 | 170 | break; |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | // get current menu's srl(=parentSrl) |
174 | 174 | $parentSrl = 0; |
175 | 175 | $oMenuAdminConroller = getAdminController('menu'); |
176 | - foreach((array) $menu->list as $parentKey => $parentMenu) |
|
176 | + foreach ((array) $menu->list as $parentKey => $parentMenu) |
|
177 | 177 | { |
178 | - if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
178 | + if (!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
179 | 179 | { |
180 | 180 | continue; |
181 | 181 | } |
182 | - if($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
182 | + if ($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
183 | 183 | { |
184 | 184 | $firstChild = current($parentMenu['list']); |
185 | 185 | $menu->list[$parentKey]['href'] = $firstChild['href']; |
186 | 186 | } |
187 | 187 | |
188 | - foreach($parentMenu['list'] as $childKey => $childMenu) |
|
188 | + foreach ($parentMenu['list'] as $childKey => $childMenu) |
|
189 | 189 | { |
190 | - if($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
190 | + if ($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
191 | 191 | { |
192 | 192 | $parentSrl = $childMenu['parent_srl']; |
193 | 193 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'XE Admin'; |
201 | 201 | $gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : 'modules/admin/tpl/img/xe.h1.png'; |
202 | 202 | |
203 | - $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle; |
|
203 | + $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard').' - '.$gnbTitleInfo->adminTitle; |
|
204 | 204 | |
205 | 205 | // Get list of favorite |
206 | 206 | $oAdminAdminModel = getAdminModel('admin'); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | // move from index method, because use in admin footer |
212 | 212 | $newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); |
213 | 213 | $cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); |
214 | - if(!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
214 | + if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
215 | 215 | { |
216 | 216 | // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page |
217 | 217 | // Ensure to access the administration page even though news cannot be displayed |
@@ -219,20 +219,20 @@ discard block |
||
219 | 219 | FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); |
220 | 220 | } |
221 | 221 | |
222 | - if(file_exists($cache_file)) |
|
222 | + if (file_exists($cache_file)) |
|
223 | 223 | { |
224 | 224 | $oXml = new XmlParser(); |
225 | 225 | $buff = $oXml->parse(FileHandler::readFile($cache_file)); |
226 | 226 | |
227 | 227 | $item = $buff->zbxe_news->item; |
228 | - if($item) |
|
228 | + if ($item) |
|
229 | 229 | { |
230 | - if(!is_array($item)) |
|
230 | + if (!is_array($item)) |
|
231 | 231 | { |
232 | 232 | $item = array($item); |
233 | 233 | } |
234 | 234 | |
235 | - foreach($item as $key => $val) |
|
235 | + foreach ($item as $key => $val) |
|
236 | 236 | { |
237 | 237 | $obj = new stdClass(); |
238 | 238 | $obj->title = $val->body; |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $news[] = $obj; |
242 | 242 | } |
243 | 243 | Context::set('news', $news); |
244 | - if(isset($news) && is_array($news)) |
|
244 | + if (isset($news) && is_array($news)) |
|
245 | 245 | { |
246 | 246 | Context::set('latestVersion', array_shift($news)); |
247 | 247 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | function dispAdminIndex() |
265 | 265 | { |
266 | 266 | $db_info = Context::getDBInfo(); |
267 | - Context::set('db_info',$db_info); |
|
267 | + Context::set('db_info', $db_info); |
|
268 | 268 | |
269 | 269 | // Get statistics |
270 | 270 | $args = new stdClass(); |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | $args = new stdClass(); |
302 | 302 | $args->list_count = 5; |
303 | 303 | $output = $oCommentModel->getNewestCommentList($args, $columnList); |
304 | - if(is_array($output)) |
|
304 | + if (is_array($output)) |
|
305 | 305 | { |
306 | - foreach($output AS $key => $value) |
|
306 | + foreach ($output AS $key => $value) |
|
307 | 307 | { |
308 | 308 | $value->content = strip_tags($value->content); |
309 | 309 | } |
@@ -314,17 +314,17 @@ discard block |
||
314 | 314 | // Get list of modules |
315 | 315 | $oModuleModel = getModel('module'); |
316 | 316 | $module_list = $oModuleModel->getModuleList(); |
317 | - if(is_array($module_list)) |
|
317 | + if (is_array($module_list)) |
|
318 | 318 | { |
319 | 319 | $needUpdate = FALSE; |
320 | 320 | $addTables = FALSE; |
321 | - foreach($module_list AS $key => $value) |
|
321 | + foreach ($module_list AS $key => $value) |
|
322 | 322 | { |
323 | - if($value->need_install) |
|
323 | + if ($value->need_install) |
|
324 | 324 | { |
325 | 325 | $addTables = TRUE; |
326 | 326 | } |
327 | - if($value->need_update) |
|
327 | + if ($value->need_update) |
|
328 | 328 | { |
329 | 329 | $needUpdate = TRUE; |
330 | 330 | } |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | $oAutoinstallAdminModel = getAdminModel('autoinstall'); |
336 | 336 | $needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList(); |
337 | 337 | |
338 | - if(is_array($needUpdateList)) |
|
338 | + if (is_array($needUpdateList)) |
|
339 | 339 | { |
340 | - foreach($needUpdateList AS $key => $value) |
|
340 | + foreach ($needUpdateList AS $key => $value) |
|
341 | 341 | { |
342 | 342 | $helpUrl = './admin/help/index.html#'; |
343 | - switch($value->type) |
|
343 | + switch ($value->type) |
|
344 | 344 | { |
345 | 345 | case 'addon': |
346 | 346 | $helpUrl .= 'UMAN_terminology_addon'; |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | |
368 | 368 | $site_module_info = Context::get('site_module_info'); |
369 | 369 | $oAddonAdminModel = getAdminModel('addon'); |
370 | - $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl ); |
|
371 | - if(!$counterAddonActivated) |
|
370 | + $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl); |
|
371 | + if (!$counterAddonActivated) |
|
372 | 372 | { |
373 | 373 | $columnList = array('member_srl', 'nick_name', 'user_name', 'user_id', 'email_address'); |
374 | 374 | $args = new stdClass; |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | |
392 | 392 | // gathering enviroment check |
393 | 393 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
394 | - $path = FileHandler::getRealPath('./files/env/' . $mainVersion); |
|
394 | + $path = FileHandler::getRealPath('./files/env/'.$mainVersion); |
|
395 | 395 | $isEnviromentGatheringAgreement = FALSE; |
396 | - if(file_exists($path)) |
|
396 | + if (file_exists($path)) |
|
397 | 397 | { |
398 | 398 | $isEnviromentGatheringAgreement = TRUE; |
399 | 399 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $isLicenseAgreement = FALSE; |
404 | 404 | $path = FileHandler::getRealPath('./files/env/license_agreement'); |
405 | 405 | $isLicenseAgreement = FALSE; |
406 | - if(file_exists($path)) |
|
406 | + if (file_exists($path)) |
|
407 | 407 | { |
408 | 408 | $isLicenseAgreement = TRUE; |
409 | 409 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | |
426 | 426 | Context::set('selected_lang', $db_info->lang_type); |
427 | 427 | |
428 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
428 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
429 | 429 | { |
430 | 430 | $db_info->default_url = Context::decodeIdna($db_info->default_url); |
431 | 431 | } |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | |
435 | 435 | // site lock |
436 | 436 | Context::set('IP', $_SERVER['REMOTE_ADDR']); |
437 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | - if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
439 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
437 | + if (!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | + if (!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
439 | + if (!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
440 | 440 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
441 | 441 | Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
442 | 442 | Context::set('use_sitelock', $db_info->use_sitelock); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | Context::set('sitelock_whitelist', $whitelist); |
448 | 448 | |
449 | 449 | |
450 | - if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
450 | + if ($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
451 | 451 | else $admin_ip_list = ''; |
452 | 452 | Context::set('admin_ip_list', $admin_ip_list); |
453 | 453 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | Context::set('htmlFooter', htmlspecialchars($config->htmlFooter)); |
471 | 471 | |
472 | 472 | // embed filter |
473 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
473 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
474 | 474 | $oEmbedFilter = EmbedFilter::getInstance(); |
475 | 475 | context::set('embed_white_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList)); |
476 | 476 | context::set('embed_white_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList)); |
@@ -529,36 +529,36 @@ discard block |
||
529 | 529 | */ |
530 | 530 | function showSendEnv() |
531 | 531 | { |
532 | - if(Context::getResponseMethod() != 'HTML') |
|
532 | + if (Context::getResponseMethod() != 'HTML') |
|
533 | 533 | { |
534 | 534 | return; |
535 | 535 | } |
536 | 536 | |
537 | 537 | $server = 'http://collect.xpressengine.com/env/img.php?'; |
538 | 538 | $path = './files/env/'; |
539 | - $install_env = $path . 'install'; |
|
539 | + $install_env = $path.'install'; |
|
540 | 540 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
541 | 541 | |
542 | - if(file_exists(FileHandler::getRealPath($install_env))) |
|
542 | + if (file_exists(FileHandler::getRealPath($install_env))) |
|
543 | 543 | { |
544 | 544 | $oAdminAdminModel = getAdminModel('admin'); |
545 | 545 | $params = $oAdminAdminModel->getEnv('INSTALL'); |
546 | - $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
|
546 | + $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); |
|
547 | 547 | Context::addHtmlFooter($img); |
548 | 548 | |
549 | - FileHandler::writeFile($path . $mainVersion, '1'); |
|
549 | + FileHandler::writeFile($path.$mainVersion, '1'); |
|
550 | 550 | } |
551 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
551 | + else if (isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion))) |
|
552 | 552 | { |
553 | - if($_SESSION['enviroment_gather'] == 'Y') |
|
553 | + if ($_SESSION['enviroment_gather'] == 'Y') |
|
554 | 554 | { |
555 | 555 | $oAdminAdminModel = getAdminModel('admin'); |
556 | 556 | $params = $oAdminAdminModel->getEnv(); |
557 | - $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
|
557 | + $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); |
|
558 | 558 | Context::addHtmlFooter($img); |
559 | 559 | } |
560 | 560 | |
561 | - FileHandler::writeFile($path . $mainVersion, '1'); |
|
561 | + FileHandler::writeFile($path.$mainVersion, '1'); |
|
562 | 562 | unset($_SESSION['enviroment_gather']); |
563 | 563 | } |
564 | 564 | } |
@@ -576,64 +576,64 @@ discard block |
||
576 | 576 | $tmp = explode("&", $envInfo); |
577 | 577 | $arrInfo = array(); |
578 | 578 | $xe_check_env = array(); |
579 | - foreach($tmp as $value) { |
|
579 | + foreach ($tmp as $value) { |
|
580 | 580 | $arr = explode("=", $value); |
581 | - if($arr[0]=="type") { |
|
581 | + if ($arr[0] == "type") { |
|
582 | 582 | continue; |
583 | - }elseif($arr[0]=="phpext" ) { |
|
583 | + }elseif ($arr[0] == "phpext") { |
|
584 | 584 | $str = urldecode($arr[1]); |
585 | - $xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
|
586 | - } elseif($arr[0]=="module" ) { |
|
585 | + $xe_check_env[$arr[0]] = str_replace("|", ", ", $str); |
|
586 | + } elseif ($arr[0] == "module") { |
|
587 | 587 | $str = urldecode($arr[1]); |
588 | 588 | $arrModuleName = explode("|", $str); |
589 | 589 | $oModuleModel = getModel("module"); |
590 | 590 | $mInfo = array(); |
591 | - foreach($arrModuleName as $moduleName) { |
|
591 | + foreach ($arrModuleName as $moduleName) { |
|
592 | 592 | $moduleInfo = $oModuleModel->getModuleInfoXml($moduleName); |
593 | 593 | $mInfo[] = "{$moduleName}({$moduleInfo->version})"; |
594 | 594 | } |
595 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
596 | - } elseif($arr[0]=="addon") { |
|
595 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
596 | + } elseif ($arr[0] == "addon") { |
|
597 | 597 | $str = urldecode($arr[1]); |
598 | 598 | $arrAddonName = explode("|", $str); |
599 | 599 | $oAddonModel = getAdminModel("addon"); |
600 | 600 | $mInfo = array(); |
601 | - foreach($arrAddonName as $addonName) { |
|
601 | + foreach ($arrAddonName as $addonName) { |
|
602 | 602 | $addonInfo = $oAddonModel->getAddonInfoXml($addonName); |
603 | 603 | $mInfo[] = "{$addonName}({$addonInfo->version})"; |
604 | 604 | } |
605 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
606 | - } elseif($arr[0]=="widget") { |
|
605 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
606 | + } elseif ($arr[0] == "widget") { |
|
607 | 607 | $str = urldecode($arr[1]); |
608 | 608 | $arrWidgetName = explode("|", $str); |
609 | 609 | $oWidgetModel = getModel("widget"); |
610 | 610 | $mInfo = array(); |
611 | - foreach($arrWidgetName as $widgetName) { |
|
611 | + foreach ($arrWidgetName as $widgetName) { |
|
612 | 612 | $widgetInfo = $oWidgetModel->getWidgetInfo($widgetName); |
613 | 613 | $mInfo[] = "{$widgetName}({$widgetInfo->version})"; |
614 | 614 | } |
615 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
616 | - } elseif($arr[0]=="widgetstyle") { |
|
615 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
616 | + } elseif ($arr[0] == "widgetstyle") { |
|
617 | 617 | $str = urldecode($arr[1]); |
618 | 618 | $arrWidgetstyleName = explode("|", $str); |
619 | 619 | $oWidgetModel = getModel("widget"); |
620 | 620 | $mInfo = array(); |
621 | - foreach($arrWidgetstyleName as $widgetstyleName) { |
|
621 | + foreach ($arrWidgetstyleName as $widgetstyleName) { |
|
622 | 622 | $widgetstyleInfo = $oWidgetModel->getWidgetStyleInfo($widgetstyleName); |
623 | 623 | $mInfo[] = "{$widgetstyleName}({$widgetstyleInfo->version})"; |
624 | 624 | } |
625 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
625 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
626 | 626 | |
627 | - } elseif($arr[0]=="layout") { |
|
627 | + } elseif ($arr[0] == "layout") { |
|
628 | 628 | $str = urldecode($arr[1]); |
629 | 629 | $arrLayoutName = explode("|", $str); |
630 | 630 | $oLayoutModel = getModel("layout"); |
631 | 631 | $mInfo = array(); |
632 | - foreach($arrLayoutName as $layoutName) { |
|
632 | + foreach ($arrLayoutName as $layoutName) { |
|
633 | 633 | $layoutInfo = $oLayoutModel->getLayoutInfo($layoutName); |
634 | 634 | $mInfo[] = "{$layoutName}({$layoutInfo->version})"; |
635 | 635 | } |
636 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
636 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
637 | 637 | } else { |
638 | 638 | $xe_check_env[$arr[0]] = urldecode($arr[1]); |
639 | 639 | } |
@@ -647,15 +647,15 @@ discard block |
||
647 | 647 | $php_core['memory_limit'] = "{$ini_info['memory_limit']['local_value']}"; |
648 | 648 | $info['PHP_Core'] = $php_core; |
649 | 649 | |
650 | - $str_info = "[XE Server Environment " . date("Y-m-d") . "]\n\n"; |
|
650 | + $str_info = "[XE Server Environment ".date("Y-m-d")."]\n\n"; |
|
651 | 651 | $str_info .= "realpath : ".realpath('./')."\n"; |
652 | - foreach( $info as $key=>$value ) |
|
652 | + foreach ($info as $key=>$value) |
|
653 | 653 | { |
654 | - if( is_array( $value ) == false ) { |
|
654 | + if (is_array($value) == false) { |
|
655 | 655 | $str_info .= "{$key} : {$value}\n"; |
656 | 656 | } else { |
657 | 657 | //$str_info .= "\n{$key} \n"; |
658 | - foreach( $value as $key2=>$value2 ) |
|
658 | + foreach ($value as $key2=>$value2) |
|
659 | 659 | $str_info .= "{$key2} : {$value2}\n"; |
660 | 660 | } |
661 | 661 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | Context::set('use_rewrite', $useRewrite); |
673 | 673 | |
674 | 674 | // nginx 체크, rewrite 사용법 안내 |
675 | - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
675 | + if ($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
676 | 676 | |
677 | 677 | Context::set('useable', $oInstallController->checkInstallEnv()); |
678 | 678 | $this->setTemplateFile('check_env.html'); |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | if(strpos($db_info->default_url, 'xn--') !== FALSE) |
32 | 32 | { |
33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url); |
34 | - } |
|
35 | - else |
|
34 | + } else |
|
36 | 35 | { |
37 | 36 | $xe_default_url = $db_info->default_url; |
38 | 37 | } |
@@ -434,9 +433,15 @@ discard block |
||
434 | 433 | |
435 | 434 | // site lock |
436 | 435 | Context::set('IP', $_SERVER['REMOTE_ADDR']); |
437 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | - if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
439 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
436 | + if(!$db_info->sitelock_title) { |
|
437 | + $db_info->sitelock_title = 'Maintenance in progress...'; |
|
438 | + } |
|
439 | + if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) { |
|
440 | + $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
441 | + } |
|
442 | + if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) { |
|
443 | + $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
444 | + } |
|
440 | 445 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
441 | 446 | Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
442 | 447 | Context::set('use_sitelock', $db_info->use_sitelock); |
@@ -447,8 +452,11 @@ discard block |
||
447 | 452 | Context::set('sitelock_whitelist', $whitelist); |
448 | 453 | |
449 | 454 | |
450 | - if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
451 | - else $admin_ip_list = ''; |
|
455 | + if($db_info->admin_ip_list) { |
|
456 | + $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
457 | + } else { |
|
458 | + $admin_ip_list = ''; |
|
459 | + } |
|
452 | 460 | Context::set('admin_ip_list', $admin_ip_list); |
453 | 461 | |
454 | 462 | Context::set('lang_selected', Context::loadLangSelected()); |
@@ -547,8 +555,7 @@ discard block |
||
547 | 555 | Context::addHtmlFooter($img); |
548 | 556 | |
549 | 557 | FileHandler::writeFile($path . $mainVersion, '1'); |
550 | - } |
|
551 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
558 | + } else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
552 | 559 | { |
553 | 560 | if($_SESSION['enviroment_gather'] == 'Y') |
554 | 561 | { |
@@ -580,7 +587,7 @@ discard block |
||
580 | 587 | $arr = explode("=", $value); |
581 | 588 | if($arr[0]=="type") { |
582 | 589 | continue; |
583 | - }elseif($arr[0]=="phpext" ) { |
|
590 | + } elseif($arr[0]=="phpext" ) { |
|
584 | 591 | $str = urldecode($arr[1]); |
585 | 592 | $xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
586 | 593 | } elseif($arr[0]=="module" ) { |
@@ -655,8 +662,9 @@ discard block |
||
655 | 662 | $str_info .= "{$key} : {$value}\n"; |
656 | 663 | } else { |
657 | 664 | //$str_info .= "\n{$key} \n"; |
658 | - foreach( $value as $key2=>$value2 ) |
|
659 | - $str_info .= "{$key2} : {$value2}\n"; |
|
665 | + foreach( $value as $key2=>$value2 ) { |
|
666 | + $str_info .= "{$key2} : {$value2}\n"; |
|
667 | + } |
|
660 | 668 | } |
661 | 669 | } |
662 | 670 | |
@@ -672,7 +680,9 @@ discard block |
||
672 | 680 | Context::set('use_rewrite', $useRewrite); |
673 | 681 | |
674 | 682 | // nginx 체크, rewrite 사용법 안내 |
675 | - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
683 | + if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) { |
|
684 | + Context::set('use_nginx', 'Y'); |
|
685 | + } |
|
676 | 686 | |
677 | 687 | Context::set('useable', $oInstallController->checkInstallEnv()); |
678 | 688 | $this->setTemplateFile('check_env.html'); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Initialization |
17 | - * @return void |
|
17 | + * @return ModuleObject|null |
|
18 | 18 | */ |
19 | 19 | function init() |
20 | 20 | { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | // forbit access if the user is not an administrator |
22 | 22 | $oMemberModel = getModel('member'); |
23 | 23 | $logged_info = $oMemberModel->getLoggedInfo(); |
24 | - if($logged_info->is_admin != 'Y') |
|
24 | + if ($logged_info->is_admin != 'Y') |
|
25 | 25 | { |
26 | 26 | return $this->stop("msg_is_not_administrator"); |
27 | 27 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function insertLog($module, $act) |
35 | 35 | { |
36 | - if(!$module || !$act) |
|
36 | + if (!$module || !$act) |
|
37 | 37 | { |
38 | 38 | return; |
39 | 39 | } |
@@ -15,6 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Pre process parameters |
18 | + * @param string $order_target |
|
19 | + * @param string $order_type |
|
20 | + * @param string $page |
|
18 | 21 | */ |
19 | 22 | function preProcParam(&$order_target, &$order_type, &$page) |
20 | 23 | { |
@@ -115,6 +118,10 @@ discard block |
||
115 | 118 | |
116 | 119 | /** |
117 | 120 | * Get Package List |
121 | + * @param string $type |
|
122 | + * @param string $search_keyword |
|
123 | + * @param integer $category_srl |
|
124 | + * @param string $parent_program |
|
118 | 125 | */ |
119 | 126 | function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL) |
120 | 127 | { |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | if($type == 'P') |
72 | 72 | { |
73 | 73 | $category_srl = $this->layout_category_srl; |
74 | - } |
|
75 | - else |
|
74 | + } else |
|
76 | 75 | { |
77 | 76 | $category_srl = $this->mobile_layout_category_srl; |
78 | 77 | } |
@@ -103,8 +102,7 @@ discard block |
||
103 | 102 | if($type == 'P') |
104 | 103 | { |
105 | 104 | $category_srl = $this->module_skin_category_srl; |
106 | - } |
|
107 | - else |
|
105 | + } else |
|
108 | 106 | { |
109 | 107 | $category_srl = $this->module_mobile_skin_category_srl; |
110 | 108 | } |
@@ -121,13 +119,11 @@ discard block |
||
121 | 119 | if($type == 'menu') |
122 | 120 | { |
123 | 121 | $params["act"] = "getResourceapiMenuPackageList"; |
124 | - } |
|
125 | - elseif($type == 'skin') |
|
122 | + } elseif($type == 'skin') |
|
126 | 123 | { |
127 | 124 | $params["act"] = "getResourceapiSkinPackageList"; |
128 | 125 | $params['parent_program'] = $parent_program; |
129 | - } |
|
130 | - else |
|
126 | + } else |
|
131 | 127 | { |
132 | 128 | $params["act"] = "getResourceapiPackagelist"; |
133 | 129 | } |
@@ -172,15 +168,13 @@ discard block |
||
172 | 168 | if($output->toBool()==TRUE) |
173 | 169 | { |
174 | 170 | $is_authed = 1; |
175 | - } |
|
176 | - else |
|
171 | + } else |
|
177 | 172 | { |
178 | 173 | $ftp_info = Context::getFTPInfo(); |
179 | 174 | if(!$ftp_info->ftp_root_path) |
180 | 175 | { |
181 | 176 | $is_authed = -1; |
182 | - } |
|
183 | - else |
|
177 | + } else |
|
184 | 178 | { |
185 | 179 | $is_authed = (int) isset($_SESSION['ftp_password']); |
186 | 180 | } |
@@ -216,8 +210,7 @@ discard block |
||
216 | 210 | if($packageInfo->type == 'core') |
217 | 211 | { |
218 | 212 | $title = 'XpressEngine'; |
219 | - } |
|
220 | - else |
|
213 | + } else |
|
221 | 214 | { |
222 | 215 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
223 | 216 | $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
@@ -238,8 +231,7 @@ discard block |
||
238 | 231 | $type = "layout"; |
239 | 232 | } |
240 | 233 | $title = $xmlDoc->{$type}->title->body; |
241 | - } |
|
242 | - else |
|
234 | + } else |
|
243 | 235 | { |
244 | 236 | $pathInfo = explode('/', $package->path); |
245 | 237 | $title = $pathInfo[count($pathInfo) - 1]; |
@@ -303,8 +295,7 @@ discard block |
||
303 | 295 | { |
304 | 296 | $package->depends[$key]->installed = FALSE; |
305 | 297 | $package->package_srl .= "," . $dep->package_srl; |
306 | - } |
|
307 | - else |
|
298 | + } else |
|
308 | 299 | { |
309 | 300 | $package->depends[$key]->installed = TRUE; |
310 | 301 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
@@ -318,8 +309,7 @@ discard block |
||
318 | 309 | $package->contain_core = TRUE; |
319 | 310 | $package->contain_core_version = $dep->version; |
320 | 311 | } |
321 | - } |
|
322 | - else |
|
312 | + } else |
|
323 | 313 | { |
324 | 314 | $package->need_update = FALSE; |
325 | 315 | } |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | function preProcParam(&$order_target, &$order_type, &$page) |
20 | 20 | { |
21 | 21 | $order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1); |
22 | - if(!isset($order_target_array[$order_target])) |
|
22 | + if (!isset($order_target_array[$order_target])) |
|
23 | 23 | { |
24 | 24 | $order_target = 'newest'; |
25 | 25 | } |
26 | 26 | |
27 | 27 | $order_type_array = array('asc' => 1, 'desc' => 1); |
28 | - if(!isset($order_type_array[$order_type])) |
|
28 | + if (!isset($order_type_array[$order_type])) |
|
29 | 29 | { |
30 | 30 | $order_type = 'desc'; |
31 | 31 | } |
32 | 32 | |
33 | 33 | $page = (int) $page; |
34 | - if($page < 1) |
|
34 | + if ($page < 1) |
|
35 | 35 | { |
36 | 36 | $page = 1; |
37 | 37 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | |
64 | 64 | $type_array = array('M' => 1, 'P' => 1); |
65 | 65 | $type = Context::get('type'); |
66 | - if(!isset($type_array[$type])) |
|
66 | + if (!isset($type_array[$type])) |
|
67 | 67 | { |
68 | 68 | $type = 'P'; |
69 | 69 | } |
70 | 70 | |
71 | - if($type == 'P') |
|
71 | + if ($type == 'P') |
|
72 | 72 | { |
73 | 73 | $category_srl = $this->layout_category_srl; |
74 | 74 | } |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | |
96 | 96 | $type_array = array('M' => 1, 'P' => 1); |
97 | 97 | $type = Context::get('type'); |
98 | - if(!isset($type_array[$type])) |
|
98 | + if (!isset($type_array[$type])) |
|
99 | 99 | { |
100 | 100 | $type = 'P'; |
101 | 101 | } |
102 | 102 | |
103 | - if($type == 'P') |
|
103 | + if ($type == 'P') |
|
104 | 104 | { |
105 | 105 | $category_srl = $this->module_skin_category_srl; |
106 | 106 | } |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL) |
120 | 120 | { |
121 | - if($type == 'menu') |
|
121 | + if ($type == 'menu') |
|
122 | 122 | { |
123 | 123 | $params["act"] = "getResourceapiMenuPackageList"; |
124 | 124 | } |
125 | - elseif($type == 'skin') |
|
125 | + elseif ($type == 'skin') |
|
126 | 126 | { |
127 | 127 | $params["act"] = "getResourceapiSkinPackageList"; |
128 | 128 | $params['parent_program'] = $parent_program; |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | $params["order_type"] = $order_type; |
138 | 138 | $params["page"] = $page; |
139 | 139 | |
140 | - if($category_srl) |
|
140 | + if ($category_srl) |
|
141 | 141 | { |
142 | 142 | $params["category_srl"] = $category_srl; |
143 | 143 | } |
144 | 144 | |
145 | - if($search_keyword) |
|
145 | + if ($search_keyword) |
|
146 | 146 | { |
147 | 147 | $params["search_keyword"] = $search_keyword; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $xmlDoc = XmlGenerater::getXmlDoc($params); |
151 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
151 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
152 | 152 | { |
153 | 153 | $item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item); |
154 | 154 | $this->add('item_list', $item_list); |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | |
170 | 170 | $is_authed = 0; |
171 | 171 | $output = $oAdminModel->checkUseDirectModuleInstall($package); |
172 | - if($output->toBool()==TRUE) |
|
172 | + if ($output->toBool() == TRUE) |
|
173 | 173 | { |
174 | 174 | $is_authed = 1; |
175 | 175 | } |
176 | 176 | else |
177 | 177 | { |
178 | 178 | $ftp_info = Context::getFTPInfo(); |
179 | - if(!$ftp_info->ftp_root_path) |
|
179 | + if (!$ftp_info->ftp_root_path) |
|
180 | 180 | { |
181 | 181 | $is_authed = -1; |
182 | 182 | } |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | { |
197 | 197 | $oModel = getModel('autoinstall'); |
198 | 198 | $output = executeQueryArray('autoinstall.getNeedUpdate'); |
199 | - if(!is_array($output->data)) |
|
199 | + if (!is_array($output->data)) |
|
200 | 200 | { |
201 | 201 | return NULL; |
202 | 202 | } |
203 | 203 | |
204 | 204 | $result = array(); |
205 | 205 | $xml = new XmlParser(); |
206 | - foreach($output->data as $package) |
|
206 | + foreach ($output->data as $package) |
|
207 | 207 | { |
208 | 208 | $packageSrl = $package->package_srl; |
209 | 209 | |
@@ -213,27 +213,27 @@ discard block |
||
213 | 213 | $packageInfo->type = $oModel->getTypeFromPath($package->path); |
214 | 214 | $packageInfo->url = $oModel->getUpdateUrlByPackageSrl($package->package_srl); |
215 | 215 | |
216 | - if($packageInfo->type == 'core') |
|
216 | + if ($packageInfo->type == 'core') |
|
217 | 217 | { |
218 | 218 | $title = 'XpressEngine'; |
219 | 219 | } |
220 | 220 | else |
221 | 221 | { |
222 | 222 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
223 | - $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
|
223 | + $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path).$configFile); |
|
224 | 224 | |
225 | - if($xmlDoc) |
|
225 | + if ($xmlDoc) |
|
226 | 226 | { |
227 | 227 | $type = $packageInfo->type; |
228 | - if($type == "drcomponent") |
|
228 | + if ($type == "drcomponent") |
|
229 | 229 | { |
230 | 230 | $type = "component"; |
231 | 231 | } |
232 | - if($type == "style" || $type == "m.skin") |
|
232 | + if ($type == "style" || $type == "m.skin") |
|
233 | 233 | { |
234 | 234 | $type = "skin"; |
235 | 235 | } |
236 | - if($type == "m.layout") |
|
236 | + if ($type == "m.layout") |
|
237 | 237 | { |
238 | 238 | $type = "layout"; |
239 | 239 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $oModel = getModel('autoinstall'); |
268 | 268 | |
269 | 269 | $targetpackages = array(); |
270 | - if($xmlDoc) |
|
270 | + if ($xmlDoc) |
|
271 | 271 | { |
272 | 272 | $xmlPackage = $xmlDoc->response->package; |
273 | 273 | $package = new stdClass(); |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | $package->package_description = $xmlPackage->package_description->body; |
277 | 277 | $package->version = $xmlPackage->version->body; |
278 | 278 | $package->path = $xmlPackage->path->body; |
279 | - if($xmlPackage->depends) |
|
279 | + if ($xmlPackage->depends) |
|
280 | 280 | { |
281 | - if(!is_array($xmlPackage->depends->item)) |
|
281 | + if (!is_array($xmlPackage->depends->item)) |
|
282 | 282 | { |
283 | 283 | $xmlPackage->depends->item = array($xmlPackage->depends->item); |
284 | 284 | } |
285 | 285 | |
286 | 286 | $package->depends = array(); |
287 | - foreach($xmlPackage->depends->item as $item) |
|
287 | + foreach ($xmlPackage->depends->item as $item) |
|
288 | 288 | { |
289 | 289 | $dep_item = new stdClass(); |
290 | 290 | $dep_item->package_srl = $item->package_srl->body; |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | |
298 | 298 | $packages = $oModel->getInstalledPackages(array_keys($targetpackages)); |
299 | 299 | $package->deplist = ""; |
300 | - foreach($package->depends as $key => $dep) |
|
300 | + foreach ($package->depends as $key => $dep) |
|
301 | 301 | { |
302 | - if(!$packages[$dep->package_srl]) |
|
302 | + if (!$packages[$dep->package_srl]) |
|
303 | 303 | { |
304 | 304 | $package->depends[$key]->installed = FALSE; |
305 | - $package->package_srl .= "," . $dep->package_srl; |
|
305 | + $package->package_srl .= ",".$dep->package_srl; |
|
306 | 306 | } |
307 | 307 | else |
308 | 308 | { |
309 | 309 | $package->depends[$key]->installed = TRUE; |
310 | 310 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
311 | - if(version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
311 | + if (version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
312 | 312 | { |
313 | 313 | $package->depends[$key]->need_update = TRUE; |
314 | - $package->package_srl .= "," . $dep->package_srl; |
|
314 | + $package->package_srl .= ",".$dep->package_srl; |
|
315 | 315 | |
316 | - if($dep->path === '.') |
|
316 | + if ($dep->path === '.') |
|
317 | 317 | { |
318 | 318 | $package->contain_core = TRUE; |
319 | 319 | $package->contain_core_version = $dep->version; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $installedPackage = $oModel->getInstalledPackage($packageSrl); |
331 | - if($installedPackage) |
|
331 | + if ($installedPackage) |
|
332 | 332 | { |
333 | 333 | $package->installed = TRUE; |
334 | 334 | $package->cur_version = $installedPackage->current_version; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | public function getAutoInstallAdminInstallInfo() |
346 | 346 | { |
347 | 347 | $packageSrl = Context::get('package_srl'); |
348 | - if(!$packageSrl) |
|
348 | + if (!$packageSrl) |
|
349 | 349 | { |
350 | 350 | return new BaseObject(-1, 'msg_invalid_request'); |
351 | 351 | } |
@@ -359,23 +359,23 @@ discard block |
||
359 | 359 | $directModuleInstall = TRUE; |
360 | 360 | $arrUnwritableDir = array(); |
361 | 361 | $output = $this->isWritableDir($package->path); |
362 | - if($output->toBool()==FALSE) |
|
362 | + if ($output->toBool() == FALSE) |
|
363 | 363 | { |
364 | 364 | $directModuleInstall = FALSE; |
365 | 365 | $arrUnwritableDir[] = $output->get('path'); |
366 | 366 | } |
367 | 367 | |
368 | - foreach($package->depends as $dep) |
|
368 | + foreach ($package->depends as $dep) |
|
369 | 369 | { |
370 | 370 | $output = $this->isWritableDir($dep->path); |
371 | - if($output->toBool()==FALSE) |
|
371 | + if ($output->toBool() == FALSE) |
|
372 | 372 | { |
373 | 373 | $directModuleInstall = FALSE; |
374 | 374 | $arrUnwritableDir[] = $output->get('path'); |
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
378 | - if($directModuleInstall==FALSE) |
|
378 | + if ($directModuleInstall == FALSE) |
|
379 | 379 | { |
380 | 380 | $output = new BaseObject(-1, 'msg_direct_inall_invalid'); |
381 | 381 | $output->add('path', $arrUnwritableDir); |
@@ -390,17 +390,17 @@ discard block |
||
390 | 390 | $path_list = explode('/', dirname($path)); |
391 | 391 | $real_path = './'; |
392 | 392 | |
393 | - while($path_list) |
|
393 | + while ($path_list) |
|
394 | 394 | { |
395 | - $check_path = realpath($real_path . implode('/', $path_list)); |
|
396 | - if(FileHandler::isDir($check_path)) |
|
395 | + $check_path = realpath($real_path.implode('/', $path_list)); |
|
396 | + if (FileHandler::isDir($check_path)) |
|
397 | 397 | { |
398 | 398 | break; |
399 | 399 | } |
400 | 400 | array_pop($path_list); |
401 | 401 | } |
402 | 402 | |
403 | - if(FileHandler::isWritableDir($check_path)==FALSE) |
|
403 | + if (FileHandler::isWritableDir($check_path) == FALSE) |
|
404 | 404 | { |
405 | 405 | $output = new BaseObject(-1, 'msg_unwritable_directory'); |
406 | 406 | $output->add('path', FileHandler::getRealPath($check_path)); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Get the board module admin simple setting page |
24 | - * @return void |
|
24 | + * @return null|string |
|
25 | 25 | */ |
26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
27 | 27 | { |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
27 | 27 | { |
28 | - if(!$moduleSrl) |
|
28 | + if (!$moduleSrl) |
|
29 | 29 | { |
30 | 30 | return; |
31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $oModuleModel = getModel('module'); |
36 | 36 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
37 | 37 | $moduleInfo->use_status = explode('|@|', $moduleInfo->use_status); |
38 | - if($moduleInfo) |
|
38 | + if ($moduleInfo) |
|
39 | 39 | { |
40 | 40 | Context::set('module_info', $moduleInfo); |
41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | Context::set('document_status_list', $documentStatusList); |
47 | 47 | |
48 | 48 | // set order target list |
49 | - foreach($this->order_target AS $key) |
|
49 | + foreach ($this->order_target AS $key) |
|
50 | 50 | { |
51 | 51 | $order_target[$key] = Context::getLang($key); |
52 | 52 | } |
@@ -747,6 +747,9 @@ |
||
747 | 747 | $this->setTemplateFile('write_form'); |
748 | 748 | } |
749 | 749 | |
750 | + /** |
|
751 | + * @param ModuleObject $oDocumentModel |
|
752 | + */ |
|
750 | 753 | function _getStatusNameList(&$oDocumentModel) |
751 | 754 | { |
752 | 755 | $resultList = array(); |
@@ -53,18 +53,15 @@ discard block |
||
53 | 53 | if($this->module_info->hide_category) |
54 | 54 | { |
55 | 55 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
56 | - } |
|
57 | - else if($this->module_info->use_category) |
|
56 | + } else if($this->module_info->use_category) |
|
58 | 57 | { |
59 | 58 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
60 | - } |
|
61 | - else |
|
59 | + } else |
|
62 | 60 | { |
63 | 61 | $this->module_info->hide_category = 'N'; |
64 | 62 | $this->module_info->use_category = 'Y'; |
65 | 63 | } |
66 | - } |
|
67 | - else |
|
64 | + } else |
|
68 | 65 | { |
69 | 66 | $this->module_info->hide_category = 'Y'; |
70 | 67 | $this->module_info->use_category = 'N'; |
@@ -84,8 +81,7 @@ discard block |
||
84 | 81 | $this->grant->write_comment = FALSE; |
85 | 82 | $this->grant->view = FALSE; |
86 | 83 | } |
87 | - } |
|
88 | - else |
|
84 | + } else |
|
89 | 85 | { |
90 | 86 | $this->consultation = FALSE; |
91 | 87 | } |
@@ -160,13 +156,17 @@ discard block |
||
160 | 156 | * add extra vaiables to the search options |
161 | 157 | **/ |
162 | 158 | // use search options on the template (the search options key has been declared, based on the language selected) |
163 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
159 | + foreach($this->search_option as $opt) { |
|
160 | + $search_option[$opt] = Context::getLang($opt); |
|
161 | + } |
|
164 | 162 | $extra_keys = Context::get('extra_keys'); |
165 | 163 | if($extra_keys) |
166 | 164 | { |
167 | 165 | foreach($extra_keys as $key => $val) |
168 | 166 | { |
169 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
167 | + if($val->search == 'Y') { |
|
168 | + $search_option['extra_vars'.$val->idx] = $val->name; |
|
169 | + } |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | // remove a search option that is not public in member config |
@@ -175,8 +175,9 @@ discard block |
||
175 | 175 | { |
176 | 176 | if(in_array($signupFormElement->title, $search_option)) |
177 | 177 | { |
178 | - if($signupFormElement->isPublic == 'N') |
|
179 | - unset($search_option[$signupFormElement->name]); |
|
178 | + if($signupFormElement->isPublic == 'N') { |
|
179 | + unset($search_option[$signupFormElement->name]); |
|
180 | + } |
|
180 | 181 | } |
181 | 182 | } |
182 | 183 | Context::set('search_option', $search_option); |
@@ -194,7 +195,9 @@ discard block |
||
194 | 195 | // list config, columnList setting |
195 | 196 | $oBoardModel = getModel('board'); |
196 | 197 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
197 | - if(!$this->listConfig) $this->listConfig = array(); |
|
198 | + if(!$this->listConfig) { |
|
199 | + $this->listConfig = array(); |
|
200 | + } |
|
198 | 201 | $this->_makeListColumnList(); |
199 | 202 | |
200 | 203 | // display the notice list |
@@ -265,7 +268,9 @@ discard block |
||
265 | 268 | } |
266 | 269 | |
267 | 270 | // check the manage grant |
268 | - if($this->grant->manager) $oDocument->setGrant(); |
|
271 | + if($this->grant->manager) { |
|
272 | + $oDocument->setGrant(); |
|
273 | + } |
|
269 | 274 | |
270 | 275 | // if the consultation function is enabled, and the document is not a notice |
271 | 276 | if($this->consultation && !$oDocument->isNotice()) |
@@ -286,8 +291,7 @@ discard block |
||
286 | 291 | } |
287 | 292 | } |
288 | 293 | |
289 | - } |
|
290 | - else |
|
294 | + } else |
|
291 | 295 | { |
292 | 296 | // if the document is not existed, then alert a warning message |
293 | 297 | Context::set('document_srl','',true); |
@@ -297,8 +301,7 @@ discard block |
||
297 | 301 | /** |
298 | 302 | * if the document is not existed, get an empty document |
299 | 303 | **/ |
300 | - } |
|
301 | - else |
|
304 | + } else |
|
302 | 305 | { |
303 | 306 | $oDocument = $oDocumentModel->getDocument(0); |
304 | 307 | } |
@@ -313,8 +316,7 @@ discard block |
||
313 | 316 | $oDocument = $oDocumentModel->getDocument(0); |
314 | 317 | Context::set('document_srl','',true); |
315 | 318 | $this->alertMessage('msg_not_permitted'); |
316 | - } |
|
317 | - else |
|
319 | + } else |
|
318 | 320 | { |
319 | 321 | // add the document title to the browser |
320 | 322 | Context::addBrowserTitle($oDocument->getTitleText()); |
@@ -368,13 +370,16 @@ discard block |
||
368 | 370 | $downloadGrantCount = 0; |
369 | 371 | if(is_array($file_module_config->download_grant)) |
370 | 372 | { |
371 | - foreach($file_module_config->download_grant AS $value) |
|
372 | - if($value) $downloadGrantCount++; |
|
373 | + foreach($file_module_config->download_grant AS $value) { |
|
374 | + if($value) $downloadGrantCount++; |
|
375 | + } |
|
373 | 376 | } |
374 | 377 | |
375 | 378 | if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
376 | 379 | { |
377 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
380 | + if(!Context::get('is_logged')) { |
|
381 | + return $this->stop('msg_not_permitted_download'); |
|
382 | + } |
|
378 | 383 | $logged_info = Context::get('logged_info'); |
379 | 384 | if($logged_info->is_admin != 'Y') |
380 | 385 | { |
@@ -397,7 +402,9 @@ discard block |
||
397 | 402 | break; |
398 | 403 | } |
399 | 404 | } |
400 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
405 | + if(!$is_permitted) { |
|
406 | + return $this->stop('msg_not_permitted_download'); |
|
407 | + } |
|
401 | 408 | } |
402 | 409 | } |
403 | 410 | } |
@@ -560,7 +567,9 @@ discard block |
||
560 | 567 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
561 | 568 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
562 | 569 | |
563 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
570 | + if(in_array('summary', $configColumList)) { |
|
571 | + array_push($this->columnList, 'content'); |
|
572 | + } |
|
564 | 573 | |
565 | 574 | // default column list add |
566 | 575 | $defaultColumn = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'member_srl', 'last_update', 'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'title_bold', 'title_color'); |
@@ -654,8 +663,7 @@ discard block |
||
654 | 663 | { |
655 | 664 | $logged_info = Context::get('logged_info'); |
656 | 665 | $group_srls = array_keys($logged_info->group_list); |
657 | - } |
|
658 | - else |
|
666 | + } else |
|
659 | 667 | { |
660 | 668 | $group_srls = array(); |
661 | 669 | } |
@@ -672,10 +680,14 @@ discard block |
||
672 | 680 | { |
673 | 681 | $category_group_srls = explode(',',$category->group_srls); |
674 | 682 | $is_granted = FALSE; |
675 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
683 | + if(count(array_intersect($group_srls, $category_group_srls))) { |
|
684 | + $is_granted = TRUE; |
|
685 | + } |
|
676 | 686 | |
677 | 687 | } |
678 | - if($is_granted) $category_list[$category_srl] = $category; |
|
688 | + if($is_granted) { |
|
689 | + $category_list[$category_srl] = $category; |
|
690 | + } |
|
679 | 691 | } |
680 | 692 | } |
681 | 693 | Context::set('category_list', $category_list); |
@@ -686,7 +698,9 @@ discard block |
||
686 | 698 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
687 | 699 | $oDocument->setDocument($document_srl); |
688 | 700 | |
689 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
701 | + if($oDocument->get('module_srl') == $oDocument->get('member_srl')) { |
|
702 | + $savedDoc = TRUE; |
|
703 | + } |
|
690 | 704 | $oDocument->add('module_srl', $this->module_srl); |
691 | 705 | |
692 | 706 | if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
@@ -712,17 +726,20 @@ discard block |
||
712 | 726 | if( !$logged_info ) |
713 | 727 | { |
714 | 728 | return $this->dispBoardMessage('msg_not_permitted'); |
715 | - } |
|
716 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
729 | + } else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
717 | 730 | { |
718 | 731 | return $this->dispBoardMessage('msg_not_enough_point'); |
719 | 732 | } |
720 | 733 | } |
721 | 734 | } |
722 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
735 | + if(!$oDocument->get('status')) { |
|
736 | + $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
737 | + } |
|
723 | 738 | |
724 | 739 | $statusList = $this->_getStatusNameList($oDocumentModel); |
725 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
740 | + if(count($statusList) > 0) { |
|
741 | + Context::set('status_list', $statusList); |
|
742 | + } |
|
726 | 743 | |
727 | 744 | // get Document status config value |
728 | 745 | Context::set('document_srl',$document_srl); |
@@ -733,13 +750,18 @@ discard block |
||
733 | 750 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
734 | 751 | |
735 | 752 | // if the document exists, then setup extra variabels on context |
736 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
753 | + if($oDocument->isExists() && !$savedDoc) { |
|
754 | + Context::set('extra_keys', $oDocument->getExtraVars()); |
|
755 | + } |
|
737 | 756 | |
738 | 757 | /** |
739 | 758 | * add JS filters |
740 | 759 | **/ |
741 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
742 | - else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
760 | + if(Context::get('logged_info')->is_admin=='Y') { |
|
761 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
762 | + } else { |
|
763 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
764 | + } |
|
743 | 765 | |
744 | 766 | $oSecurity = new Security(); |
745 | 767 | $oSecurity->encodeHTML('category_list.text', 'category_list.title'); |
@@ -1054,7 +1076,9 @@ discard block |
||
1054 | 1076 | function dispBoardMessage($msg_code) |
1055 | 1077 | { |
1056 | 1078 | $msg = Context::getLang($msg_code); |
1057 | - if(!$msg) $msg = $msg_code; |
|
1079 | + if(!$msg) { |
|
1080 | + $msg = $msg_code; |
|
1081 | + } |
|
1058 | 1082 | Context::set('message', $msg); |
1059 | 1083 | $this->setTemplateFile('message'); |
1060 | 1084 | } |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * setup the module general information |
25 | 25 | **/ |
26 | - if($this->module_info->list_count) |
|
26 | + if ($this->module_info->list_count) |
|
27 | 27 | { |
28 | 28 | $this->list_count = $this->module_info->list_count; |
29 | 29 | } |
30 | - if($this->module_info->search_list_count) |
|
30 | + if ($this->module_info->search_list_count) |
|
31 | 31 | { |
32 | 32 | $this->search_list_count = $this->module_info->search_list_count; |
33 | 33 | } |
34 | - if($this->module_info->page_count) |
|
34 | + if ($this->module_info->page_count) |
|
35 | 35 | { |
36 | 36 | $this->page_count = $this->module_info->page_count; |
37 | 37 | } |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | $oDocumentModel = getModel('document'); |
42 | 42 | |
43 | 43 | $statusList = $this->_getStatusNameList($oDocumentModel); |
44 | - if(isset($statusList['SECRET'])) |
|
44 | + if (isset($statusList['SECRET'])) |
|
45 | 45 | { |
46 | 46 | $this->module_info->secret = 'Y'; |
47 | 47 | } |
48 | 48 | |
49 | 49 | // use_category <=1.5.x, hide_category >=1.7.x |
50 | 50 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
51 | - if($count_category) |
|
51 | + if ($count_category) |
|
52 | 52 | { |
53 | - if($this->module_info->hide_category) |
|
53 | + if ($this->module_info->hide_category) |
|
54 | 54 | { |
55 | 55 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
56 | 56 | } |
57 | - else if($this->module_info->use_category) |
|
57 | + else if ($this->module_info->use_category) |
|
58 | 58 | { |
59 | 59 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
60 | 60 | } |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * check the consultation function, if the user is admin then swich off consultation function |
75 | 75 | * if the user is not logged, then disppear write document/write comment./ view document |
76 | 76 | **/ |
77 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
77 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
78 | 78 | { |
79 | 79 | $this->consultation = TRUE; |
80 | - if(!Context::get('is_logged')) |
|
80 | + if (!Context::get('is_logged')) |
|
81 | 81 | { |
82 | 82 | $this->grant->list = FALSE; |
83 | 83 | $this->grant->write_document = FALSE; |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * setup the template path based on the skin |
95 | 95 | * the default skin is default |
96 | 96 | **/ |
97 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
98 | - if(!is_dir($template_path)||!$this->module_info->skin) |
|
97 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
98 | + if (!is_dir($template_path) || !$this->module_info->skin) |
|
99 | 99 | { |
100 | 100 | $this->module_info->skin = 'default'; |
101 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
101 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
102 | 102 | } |
103 | 103 | $this->setTemplatePath($template_path); |
104 | 104 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | **/ |
115 | 115 | if (is_array($extra_keys)) |
116 | 116 | { |
117 | - foreach($extra_keys as $val) |
|
117 | + foreach ($extra_keys as $val) |
|
118 | 118 | { |
119 | 119 | $this->order_target[] = $val->eid; |
120 | 120 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | |
128 | 128 | // remove [document_srl]_cpage from get_vars |
129 | 129 | $args = Context::getRequestVars(); |
130 | - foreach($args as $name => $value) |
|
130 | + foreach ($args as $name => $value) |
|
131 | 131 | { |
132 | - if(preg_match('/[0-9]+_cpage/', $name)) |
|
132 | + if (preg_match('/[0-9]+_cpage/', $name)) |
|
133 | 133 | { |
134 | 134 | Context::set($name, '', TRUE); |
135 | 135 | Context::set($name, $value); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | /** |
146 | 146 | * check the access grant (all the grant has been set by the module object) |
147 | 147 | **/ |
148 | - if(!$this->grant->access || !$this->grant->list) |
|
148 | + if (!$this->grant->access || !$this->grant->list) |
|
149 | 149 | { |
150 | 150 | return $this->dispBoardMessage('msg_not_permitted'); |
151 | 151 | } |
@@ -160,22 +160,22 @@ discard block |
||
160 | 160 | * add extra vaiables to the search options |
161 | 161 | **/ |
162 | 162 | // use search options on the template (the search options key has been declared, based on the language selected) |
163 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
163 | + foreach ($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
164 | 164 | $extra_keys = Context::get('extra_keys'); |
165 | - if($extra_keys) |
|
165 | + if ($extra_keys) |
|
166 | 166 | { |
167 | - foreach($extra_keys as $key => $val) |
|
167 | + foreach ($extra_keys as $key => $val) |
|
168 | 168 | { |
169 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
169 | + if ($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | // remove a search option that is not public in member config |
173 | 173 | $memberConfig = getModel('module')->getModuleConfig('member'); |
174 | - foreach($memberConfig->signupForm as $signupFormElement) |
|
174 | + foreach ($memberConfig->signupForm as $signupFormElement) |
|
175 | 175 | { |
176 | - if(in_array($signupFormElement->title, $search_option)) |
|
176 | + if (in_array($signupFormElement->title, $search_option)) |
|
177 | 177 | { |
178 | - if($signupFormElement->isPublic == 'N') |
|
178 | + if ($signupFormElement->isPublic == 'N') |
|
179 | 179 | unset($search_option[$signupFormElement->name]); |
180 | 180 | } |
181 | 181 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $oDocumentModel = getModel('document'); |
185 | 185 | $statusNameList = $this->_getStatusNameList($oDocumentModel); |
186 | - if(count($statusNameList) > 0) |
|
186 | + if (count($statusNameList) > 0) |
|
187 | 187 | { |
188 | 188 | Context::set('status_list', $statusNameList); |
189 | 189 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | // list config, columnList setting |
195 | 195 | $oBoardModel = getModel('board'); |
196 | 196 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
197 | - if(!$this->listConfig) $this->listConfig = array(); |
|
197 | + if (!$this->listConfig) $this->listConfig = array(); |
|
198 | 198 | $this->_makeListColumnList(); |
199 | 199 | |
200 | 200 | // display the notice list |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * @brief display the category list |
220 | 220 | **/ |
221 | - function dispBoardCategoryList(){ |
|
221 | + function dispBoardCategoryList() { |
|
222 | 222 | // check if the use_category option is enabled |
223 | - if($this->module_info->use_category=='Y') |
|
223 | + if ($this->module_info->use_category == 'Y') |
|
224 | 224 | { |
225 | 225 | // check the grant |
226 | - if(!$this->grant->list) |
|
226 | + if (!$this->grant->list) |
|
227 | 227 | { |
228 | 228 | Context::set('category_list', array()); |
229 | 229 | return; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | /** |
241 | 241 | * @brief display the board conent view |
242 | 242 | **/ |
243 | - function dispBoardContentView(){ |
|
243 | + function dispBoardContentView() { |
|
244 | 244 | // get the variable value |
245 | 245 | $document_srl = Context::get('document_srl'); |
246 | 246 | $page = Context::get('page'); |
@@ -251,36 +251,36 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * if the document exists, then get the document information |
253 | 253 | **/ |
254 | - if($document_srl) |
|
254 | + if ($document_srl) |
|
255 | 255 | { |
256 | 256 | $oDocument = $oDocumentModel->getDocument($document_srl, false, true); |
257 | 257 | |
258 | 258 | // if the document is existed |
259 | - if($oDocument->isExists()) |
|
259 | + if ($oDocument->isExists()) |
|
260 | 260 | { |
261 | 261 | // if the module srl is not consistent |
262 | - if($oDocument->get('module_srl')!=$this->module_info->module_srl ) |
|
262 | + if ($oDocument->get('module_srl') != $this->module_info->module_srl) |
|
263 | 263 | { |
264 | 264 | return $this->stop('msg_invalid_request'); |
265 | 265 | } |
266 | 266 | |
267 | 267 | // check the manage grant |
268 | - if($this->grant->manager) $oDocument->setGrant(); |
|
268 | + if ($this->grant->manager) $oDocument->setGrant(); |
|
269 | 269 | |
270 | 270 | // if the consultation function is enabled, and the document is not a notice |
271 | - if($this->consultation && !$oDocument->isNotice()) |
|
271 | + if ($this->consultation && !$oDocument->isNotice()) |
|
272 | 272 | { |
273 | 273 | $logged_info = Context::get('logged_info'); |
274 | - if(abs($oDocument->get('member_srl')) != $logged_info->member_srl) |
|
274 | + if (abs($oDocument->get('member_srl')) != $logged_info->member_srl) |
|
275 | 275 | { |
276 | 276 | $oDocument = $oDocumentModel->getDocument(0); |
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | 280 | // if the document is TEMP saved, check Grant |
281 | - if($oDocument->getStatus() == 'TEMP') |
|
281 | + if ($oDocument->getStatus() == 'TEMP') |
|
282 | 282 | { |
283 | - if(!$oDocument->isGranted()) |
|
283 | + if (!$oDocument->isGranted()) |
|
284 | 284 | { |
285 | 285 | $oDocument = $oDocumentModel->getDocument(0); |
286 | 286 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | else |
291 | 291 | { |
292 | 292 | // if the document is not existed, then alert a warning message |
293 | - Context::set('document_srl','',true); |
|
293 | + Context::set('document_srl', '', true); |
|
294 | 294 | $this->alertMessage('msg_not_founded'); |
295 | 295 | } |
296 | 296 | |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | /** |
307 | 307 | *check the document view grant |
308 | 308 | **/ |
309 | - if($oDocument->isExists()) |
|
309 | + if ($oDocument->isExists()) |
|
310 | 310 | { |
311 | - if(!$this->grant->view && !$oDocument->isGranted()) |
|
311 | + if (!$this->grant->view && !$oDocument->isGranted()) |
|
312 | 312 | { |
313 | 313 | $oDocument = $oDocumentModel->getDocument(0); |
314 | - Context::set('document_srl','',true); |
|
314 | + Context::set('document_srl', '', true); |
|
315 | 315 | $this->alertMessage('msg_not_permitted'); |
316 | 316 | } |
317 | 317 | else |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | Context::addBrowserTitle($oDocument->getTitleText()); |
321 | 321 | |
322 | 322 | // update the document view count (if the document is not secret) |
323 | - if(!$oDocument->isSecret() || $oDocument->isGranted()) |
|
323 | + if (!$oDocument->isSecret() || $oDocument->isGranted()) |
|
324 | 324 | { |
325 | 325 | $oDocument->updateReadedCount(); |
326 | 326 | } |
327 | 327 | |
328 | 328 | // disappear the document if it is secret |
329 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
329 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
330 | 330 | { |
331 | - $oDocument->add('content',Context::getLang('thisissecret')); |
|
331 | + $oDocument->add('content', Context::getLang('thisissecret')); |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | } |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | /** |
349 | 349 | * @brief display the document file list (can be used by API) |
350 | 350 | **/ |
351 | - function dispBoardContentFileList(){ |
|
351 | + function dispBoardContentFileList() { |
|
352 | 352 | /** |
353 | 353 | * check the access grant (all the grant has been set by the module object) |
354 | 354 | **/ |
355 | - if(!$this->grant->access) |
|
355 | + if (!$this->grant->access) |
|
356 | 356 | { |
357 | 357 | return $this->dispBoardMessage('msg_not_permitted'); |
358 | 358 | } |
@@ -363,41 +363,41 @@ discard block |
||
363 | 363 | // Check if a permission for file download is granted |
364 | 364 | // Get configurations (using module model object) |
365 | 365 | $oModuleModel = getModel('module'); |
366 | - $file_module_config = $oModuleModel->getModulePartConfig('file',$this->module_srl); |
|
366 | + $file_module_config = $oModuleModel->getModulePartConfig('file', $this->module_srl); |
|
367 | 367 | |
368 | 368 | $downloadGrantCount = 0; |
369 | - if(is_array($file_module_config->download_grant)) |
|
369 | + if (is_array($file_module_config->download_grant)) |
|
370 | 370 | { |
371 | - foreach($file_module_config->download_grant AS $value) |
|
372 | - if($value) $downloadGrantCount++; |
|
371 | + foreach ($file_module_config->download_grant AS $value) |
|
372 | + if ($value) $downloadGrantCount++; |
|
373 | 373 | } |
374 | 374 | |
375 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
375 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
376 | 376 | { |
377 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
377 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
378 | 378 | $logged_info = Context::get('logged_info'); |
379 | - if($logged_info->is_admin != 'Y') |
|
379 | + if ($logged_info->is_admin != 'Y') |
|
380 | 380 | { |
381 | - $oModuleModel =& getModel('module'); |
|
381 | + $oModuleModel = & getModel('module'); |
|
382 | 382 | $columnList = array('module_srl', 'site_srl'); |
383 | 383 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl, $columnList); |
384 | 384 | |
385 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
385 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
386 | 386 | { |
387 | - $oMemberModel =& getModel('member'); |
|
387 | + $oMemberModel = & getModel('member'); |
|
388 | 388 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
389 | 389 | |
390 | 390 | $is_permitted = false; |
391 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
391 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
392 | 392 | { |
393 | 393 | $group_srl = $file_module_config->download_grant[$i]; |
394 | - if($member_groups[$group_srl]) |
|
394 | + if ($member_groups[$group_srl]) |
|
395 | 395 | { |
396 | 396 | $is_permitted = true; |
397 | 397 | break; |
398 | 398 | } |
399 | 399 | } |
400 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
400 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $document_srl = Context::get('document_srl'); |
407 | 407 | $oDocument = $oDocumentModel->getDocument($document_srl); |
408 | 408 | Context::set('oDocument', $oDocument); |
409 | - Context::set('file_list',$oDocument->getUploadedFiles()); |
|
409 | + Context::set('file_list', $oDocument->getUploadedFiles()); |
|
410 | 410 | |
411 | 411 | $oSecurity = new Security(); |
412 | 412 | $oSecurity->encodeHTML('file_list..source_filename'); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | /** |
416 | 416 | * @brief display the document comment list (can be used by API) |
417 | 417 | **/ |
418 | - function dispBoardContentCommentList(){ |
|
418 | + function dispBoardContentCommentList() { |
|
419 | 419 | // check document view grant |
420 | 420 | $this->dispBoardContentView(); |
421 | 421 | |
@@ -425,26 +425,26 @@ discard block |
||
425 | 425 | $comment_list = $oDocument->getComments(); |
426 | 426 | |
427 | 427 | // setup the comment list |
428 | - if(is_array($comment_list)) |
|
428 | + if (is_array($comment_list)) |
|
429 | 429 | { |
430 | - foreach($comment_list as $key => $val) |
|
430 | + foreach ($comment_list as $key => $val) |
|
431 | 431 | { |
432 | - if(!$val->isAccessible()) |
|
432 | + if (!$val->isAccessible()) |
|
433 | 433 | { |
434 | - $val->add('content',Context::getLang('thisissecret')); |
|
434 | + $val->add('content', Context::getLang('thisissecret')); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | } |
438 | - Context::set('comment_list',$comment_list); |
|
438 | + Context::set('comment_list', $comment_list); |
|
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
443 | 443 | * @brief display notice list (can be used by API) |
444 | 444 | **/ |
445 | - function dispBoardNoticeList(){ |
|
445 | + function dispBoardNoticeList() { |
|
446 | 446 | // check the grant |
447 | - if(!$this->grant->list) |
|
447 | + if (!$this->grant->list) |
|
448 | 448 | { |
449 | 449 | Context::set('notice_list', array()); |
450 | 450 | return; |
@@ -460,15 +460,15 @@ discard block |
||
460 | 460 | /** |
461 | 461 | * @brief display board content list |
462 | 462 | **/ |
463 | - function dispBoardContentList(){ |
|
463 | + function dispBoardContentList() { |
|
464 | 464 | // check the grant |
465 | - if(!$this->grant->list) |
|
465 | + if (!$this->grant->list) |
|
466 | 466 | { |
467 | 467 | Context::set('document_list', array()); |
468 | 468 | Context::set('total_count', 0); |
469 | 469 | Context::set('total_page', 1); |
470 | 470 | Context::set('page', 1); |
471 | - Context::set('page_navigation', new PageHandler(0,0,1,10)); |
|
471 | + Context::set('page_navigation', new PageHandler(0, 0, 1, 10)); |
|
472 | 472 | return; |
473 | 473 | } |
474 | 474 | |
@@ -482,23 +482,23 @@ discard block |
||
482 | 482 | $args->page_count = $this->page_count; |
483 | 483 | |
484 | 484 | // get the search target and keyword |
485 | - if($this->grant->view) { |
|
485 | + if ($this->grant->view) { |
|
486 | 486 | $args->search_target = Context::get('search_target'); |
487 | 487 | $args->search_keyword = Context::get('search_keyword'); |
488 | 488 | } |
489 | 489 | |
490 | 490 | $search_option = Context::get('search_option'); |
491 | - if($search_option==FALSE) |
|
491 | + if ($search_option == FALSE) |
|
492 | 492 | { |
493 | 493 | $search_option = $this->search_option; |
494 | 494 | } |
495 | - if(isset($search_option[$args->search_target])==FALSE) |
|
495 | + if (isset($search_option[$args->search_target]) == FALSE) |
|
496 | 496 | { |
497 | 497 | $args->search_target = ''; |
498 | 498 | } |
499 | 499 | |
500 | 500 | // if the category is enabled, then get the category |
501 | - if($this->module_info->use_category=='Y') |
|
501 | + if ($this->module_info->use_category == 'Y') |
|
502 | 502 | { |
503 | 503 | $args->category_srl = Context::get('category'); |
504 | 504 | } |
@@ -506,21 +506,21 @@ discard block |
||
506 | 506 | // setup the sort index and order index |
507 | 507 | $args->sort_index = Context::get('sort_index'); |
508 | 508 | $args->order_type = Context::get('order_type'); |
509 | - if(!in_array($args->sort_index, $this->order_target)) |
|
509 | + if (!in_array($args->sort_index, $this->order_target)) |
|
510 | 510 | { |
511 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
|
511 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; |
|
512 | 512 | } |
513 | - if(!in_array($args->order_type, array('asc','desc'))) |
|
513 | + if (!in_array($args->order_type, array('asc', 'desc'))) |
|
514 | 514 | { |
515 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
|
515 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | // set the current page of documents |
519 | 519 | $document_srl = Context::get('document_srl'); |
520 | - if(!$args->page && $document_srl) |
|
520 | + if (!$args->page && $document_srl) |
|
521 | 521 | { |
522 | 522 | $oDocument = $oDocumentModel->getDocument($document_srl); |
523 | - if($oDocument->isExists() && !$oDocument->isNotice()) |
|
523 | + if ($oDocument->isExists() && !$oDocument->isNotice()) |
|
524 | 524 | { |
525 | 525 | $page = $oDocumentModel->getDocumentPage($oDocument, $args); |
526 | 526 | Context::set('page', $page); |
@@ -529,21 +529,21 @@ discard block |
||
529 | 529 | } |
530 | 530 | |
531 | 531 | // setup the list count to be serach list count, if the category or search keyword has been set |
532 | - if($args->category_srl || $args->search_keyword) |
|
532 | + if ($args->category_srl || $args->search_keyword) |
|
533 | 533 | { |
534 | 534 | $args->list_count = $this->search_list_count; |
535 | 535 | } |
536 | 536 | |
537 | 537 | // if the consultation function is enabled, the get the logged user information |
538 | - if($this->consultation) |
|
538 | + if ($this->consultation) |
|
539 | 539 | { |
540 | 540 | $logged_info = Context::get('logged_info'); |
541 | 541 | $args->member_srl = $logged_info->member_srl; |
542 | 542 | |
543 | - if($this->module_info->use_anonymous === 'Y') |
|
543 | + if ($this->module_info->use_anonymous === 'Y') |
|
544 | 544 | { |
545 | 545 | unset($args->member_srl); |
546 | - $args->member_srls = $logged_info->member_srl . ',' . $logged_info->member_srl * -1; |
|
546 | + $args->member_srls = $logged_info->member_srl.','.$logged_info->member_srl * -1; |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | |
@@ -569,18 +569,18 @@ discard block |
||
569 | 569 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
570 | 570 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
571 | 571 | |
572 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
572 | + if (in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
573 | 573 | |
574 | 574 | // default column list add |
575 | 575 | $defaultColumn = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'member_srl', 'last_update', 'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'title_bold', 'title_color'); |
576 | 576 | |
577 | 577 | //TODO guestbook, blog style supports legacy codes. |
578 | - if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
578 | + if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
579 | 579 | { |
580 | 580 | $defaultColumn = $tableColumnList; |
581 | 581 | } |
582 | 582 | |
583 | - if (in_array('last_post', $configColumList)){ |
|
583 | + if (in_array('last_post', $configColumList)) { |
|
584 | 584 | array_push($this->columnList, 'last_updater'); |
585 | 585 | } |
586 | 586 | |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | $this->columnList = array_unique(array_merge($this->columnList, $defaultColumn)); |
593 | 593 | |
594 | 594 | // add table name |
595 | - foreach($this->columnList as $no => $value) |
|
595 | + foreach ($this->columnList as $no => $value) |
|
596 | 596 | { |
597 | - $this->columnList[$no] = 'documents.' . $value; |
|
597 | + $this->columnList[$no] = 'documents.'.$value; |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | function dispBoardTagList() |
605 | 605 | { |
606 | 606 | // check if there is not grant fot view list, then alert an warning message |
607 | - if(!$this->grant->list) |
|
607 | + if (!$this->grant->list) |
|
608 | 608 | { |
609 | 609 | return $this->dispBoardMessage('msg_not_permitted'); |
610 | 610 | } |
@@ -618,14 +618,14 @@ discard block |
||
618 | 618 | $output = $oTagModel->getTagList($obj); |
619 | 619 | |
620 | 620 | // automatically order |
621 | - if(count($output->data)) |
|
621 | + if (count($output->data)) |
|
622 | 622 | { |
623 | 623 | $numbers = array_keys($output->data); |
624 | 624 | shuffle($numbers); |
625 | 625 | |
626 | - if(count($output->data)) |
|
626 | + if (count($output->data)) |
|
627 | 627 | { |
628 | - foreach($numbers as $k => $v) |
|
628 | + foreach ($numbers as $k => $v) |
|
629 | 629 | { |
630 | 630 | $tag_list[] = $output->data[$v]; |
631 | 631 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | function dispBoardWrite() |
647 | 647 | { |
648 | 648 | // check grant |
649 | - if(!$this->grant->write_document) |
|
649 | + if (!$this->grant->write_document) |
|
650 | 650 | { |
651 | 651 | return $this->dispBoardMessage('msg_not_permitted'); |
652 | 652 | } |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | /** |
657 | 657 | * check if the category option is enabled not not |
658 | 658 | **/ |
659 | - if($this->module_info->use_category=='Y') |
|
659 | + if ($this->module_info->use_category == 'Y') |
|
660 | 660 | { |
661 | 661 | // get the user group information |
662 | - if(Context::get('is_logged')) |
|
662 | + if (Context::get('is_logged')) |
|
663 | 663 | { |
664 | 664 | $logged_info = Context::get('logged_info'); |
665 | 665 | $group_srls = array_keys($logged_info->group_list); |
@@ -672,19 +672,19 @@ discard block |
||
672 | 672 | |
673 | 673 | // check the grant after obtained the category list |
674 | 674 | $normal_category_list = $oDocumentModel->getCategoryList($this->module_srl); |
675 | - if(count($normal_category_list)) |
|
675 | + if (count($normal_category_list)) |
|
676 | 676 | { |
677 | - foreach($normal_category_list as $category_srl => $category) |
|
677 | + foreach ($normal_category_list as $category_srl => $category) |
|
678 | 678 | { |
679 | 679 | $is_granted = TRUE; |
680 | - if($category->group_srls) |
|
680 | + if ($category->group_srls) |
|
681 | 681 | { |
682 | - $category_group_srls = explode(',',$category->group_srls); |
|
682 | + $category_group_srls = explode(',', $category->group_srls); |
|
683 | 683 | $is_granted = FALSE; |
684 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
684 | + if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
685 | 685 | |
686 | 686 | } |
687 | - if($is_granted) $category_list[$category_srl] = $category; |
|
687 | + if ($is_granted) $category_list[$category_srl] = $category; |
|
688 | 688 | } |
689 | 689 | } |
690 | 690 | Context::set('category_list', $category_list); |
@@ -695,46 +695,46 @@ discard block |
||
695 | 695 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
696 | 696 | $oDocument->setDocument($document_srl); |
697 | 697 | |
698 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
698 | + if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
699 | 699 | $oDocument->add('module_srl', $this->module_srl); |
700 | 700 | |
701 | - if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
701 | + if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
702 | 702 | { |
703 | 703 | return new BaseObject(-1, 'msg_protect_content'); |
704 | 704 | } |
705 | 705 | |
706 | 706 | // if the document is not granted, then back to the password input form |
707 | 707 | $oModuleModel = getModel('module'); |
708 | - if($oDocument->isExists()&&!$oDocument->isGranted()) |
|
708 | + if ($oDocument->isExists() && !$oDocument->isGranted()) |
|
709 | 709 | { |
710 | 710 | return $this->setTemplateFile('input_password_form'); |
711 | 711 | } |
712 | 712 | |
713 | - if(!$oDocument->isExists()) |
|
713 | + if (!$oDocument->isExists()) |
|
714 | 714 | { |
715 | - $point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl); |
|
715 | + $point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl); |
|
716 | 716 | $logged_info = Context::get('logged_info'); |
717 | 717 | $oPointModel = getModel('point'); |
718 | 718 | $pointForInsert = $point_config["insert_document"]; |
719 | - if($pointForInsert < 0) |
|
719 | + if ($pointForInsert < 0) |
|
720 | 720 | { |
721 | - if( !$logged_info ) |
|
721 | + if (!$logged_info) |
|
722 | 722 | { |
723 | 723 | return $this->dispBoardMessage('msg_not_permitted'); |
724 | 724 | } |
725 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
725 | + else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0) |
|
726 | 726 | { |
727 | 727 | return $this->dispBoardMessage('msg_not_enough_point'); |
728 | 728 | } |
729 | 729 | } |
730 | 730 | } |
731 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
731 | + if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
732 | 732 | |
733 | 733 | $statusList = $this->_getStatusNameList($oDocumentModel); |
734 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
734 | + if (count($statusList) > 0) Context::set('status_list', $statusList); |
|
735 | 735 | |
736 | 736 | // get Document status config value |
737 | - Context::set('document_srl',$document_srl); |
|
737 | + Context::set('document_srl', $document_srl); |
|
738 | 738 | Context::set('oDocument', $oDocument); |
739 | 739 | |
740 | 740 | // apply xml_js_filter on header |
@@ -742,12 +742,12 @@ discard block |
||
742 | 742 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
743 | 743 | |
744 | 744 | // if the document exists, then setup extra variabels on context |
745 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
745 | + if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
746 | 746 | |
747 | 747 | /** |
748 | 748 | * add JS filters |
749 | 749 | **/ |
750 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
750 | + if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
751 | 751 | else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
752 | 752 | |
753 | 753 | $oSecurity = new Security(); |
@@ -759,14 +759,14 @@ discard block |
||
759 | 759 | function _getStatusNameList(&$oDocumentModel) |
760 | 760 | { |
761 | 761 | $resultList = array(); |
762 | - if(!empty($this->module_info->use_status)) |
|
762 | + if (!empty($this->module_info->use_status)) |
|
763 | 763 | { |
764 | 764 | $statusNameList = $oDocumentModel->getStatusNameList(); |
765 | 765 | $statusList = explode('|@|', $this->module_info->use_status); |
766 | 766 | |
767 | - if(is_array($statusList)) |
|
767 | + if (is_array($statusList)) |
|
768 | 768 | { |
769 | - foreach($statusList as $key => $value) |
|
769 | + foreach ($statusList as $key => $value) |
|
770 | 770 | { |
771 | 771 | $resultList[$value] = $statusNameList[$value]; |
772 | 772 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | function dispBoardDelete() |
782 | 782 | { |
783 | 783 | // check grant |
784 | - if(!$this->grant->write_document) |
|
784 | + if (!$this->grant->write_document) |
|
785 | 785 | { |
786 | 786 | return $this->dispBoardMessage('msg_not_permitted'); |
787 | 787 | } |
@@ -790,30 +790,30 @@ discard block |
||
790 | 790 | $document_srl = Context::get('document_srl'); |
791 | 791 | |
792 | 792 | // if document exists, get the document information |
793 | - if($document_srl) |
|
793 | + if ($document_srl) |
|
794 | 794 | { |
795 | 795 | $oDocumentModel = getModel('document'); |
796 | 796 | $oDocument = $oDocumentModel->getDocument($document_srl); |
797 | 797 | } |
798 | 798 | |
799 | 799 | // if the document is not existed, then back to the board content page |
800 | - if(!$oDocument || !$oDocument->isExists()) |
|
800 | + if (!$oDocument || !$oDocument->isExists()) |
|
801 | 801 | { |
802 | 802 | return $this->dispBoardContent(); |
803 | 803 | } |
804 | 804 | |
805 | 805 | // if the document is not granted, then back to the password input form |
806 | - if(!$oDocument->isGranted()) |
|
806 | + if (!$oDocument->isGranted()) |
|
807 | 807 | { |
808 | 808 | return $this->setTemplateFile('input_password_form'); |
809 | 809 | } |
810 | 810 | |
811 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
811 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
812 | 812 | { |
813 | 813 | return $this->dispBoardMessage('msg_protect_content'); |
814 | 814 | } |
815 | 815 | |
816 | - Context::set('oDocument',$oDocument); |
|
816 | + Context::set('oDocument', $oDocument); |
|
817 | 817 | |
818 | 818 | /** |
819 | 819 | * add JS filters |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | $document_srl = Context::get('document_srl'); |
832 | 832 | |
833 | 833 | // check grant |
834 | - if(!$this->grant->write_comment) |
|
834 | + if (!$this->grant->write_comment) |
|
835 | 835 | { |
836 | 836 | return $this->dispBoardMessage('msg_not_permitted'); |
837 | 837 | } |
@@ -839,13 +839,13 @@ discard block |
||
839 | 839 | // get the document information |
840 | 840 | $oDocumentModel = getModel('document'); |
841 | 841 | $oDocument = $oDocumentModel->getDocument($document_srl); |
842 | - if(!$oDocument->isExists()) |
|
842 | + if (!$oDocument->isExists()) |
|
843 | 843 | { |
844 | 844 | return $this->dispBoardMessage('msg_invalid_request'); |
845 | 845 | } |
846 | 846 | |
847 | 847 | // Check allow comment |
848 | - if(!$oDocument->allowComment()) |
|
848 | + if (!$oDocument->allowComment()) |
|
849 | 849 | { |
850 | 850 | return $this->dispBoardMessage('msg_not_allow_comment'); |
851 | 851 | } |
@@ -857,9 +857,9 @@ discard block |
||
857 | 857 | $oComment->add('module_srl', $this->module_srl); |
858 | 858 | |
859 | 859 | // setup document variables on context |
860 | - Context::set('oDocument',$oDocument); |
|
861 | - Context::set('oSourceComment',$oSourceComment); |
|
862 | - Context::set('oComment',$oComment); |
|
860 | + Context::set('oDocument', $oDocument); |
|
861 | + Context::set('oSourceComment', $oSourceComment); |
|
862 | + Context::set('oComment', $oComment); |
|
863 | 863 | |
864 | 864 | /** |
865 | 865 | * add JS filter |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | function dispBoardReplyComment() |
876 | 876 | { |
877 | 877 | // check grant |
878 | - if(!$this->grant->write_comment) |
|
878 | + if (!$this->grant->write_comment) |
|
879 | 879 | { |
880 | 880 | return $this->dispBoardMessage('msg_not_permitted'); |
881 | 881 | } |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | $parent_srl = Context::get('comment_srl'); |
885 | 885 | |
886 | 886 | // if the parent comment is not existed |
887 | - if(!$parent_srl) |
|
887 | + if (!$parent_srl) |
|
888 | 888 | { |
889 | 889 | return new BaseObject(-1, 'msg_invalid_request'); |
890 | 890 | } |
@@ -894,11 +894,11 @@ discard block |
||
894 | 894 | $oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager); |
895 | 895 | |
896 | 896 | // if the comment is not existed, opoup an error message |
897 | - if(!$oSourceComment->isExists()) |
|
897 | + if (!$oSourceComment->isExists()) |
|
898 | 898 | { |
899 | 899 | return $this->dispBoardMessage('msg_invalid_request'); |
900 | 900 | } |
901 | - if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
901 | + if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
902 | 902 | { |
903 | 903 | return $this->dispBoardMessage('msg_invalid_request'); |
904 | 904 | } |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | // Check allow comment |
907 | 907 | $oDocumentModel = getModel('document'); |
908 | 908 | $oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl')); |
909 | - if(!$oDocument->allowComment()) |
|
909 | + if (!$oDocument->allowComment()) |
|
910 | 910 | { |
911 | 911 | return $this->dispBoardMessage('msg_not_allow_comment'); |
912 | 912 | } |
@@ -917,9 +917,9 @@ discard block |
||
917 | 917 | $oComment->add('document_srl', $oSourceComment->get('document_srl')); |
918 | 918 | |
919 | 919 | // setup comment variables |
920 | - Context::set('oSourceComment',$oSourceComment); |
|
921 | - Context::set('oComment',$oComment); |
|
922 | - Context::set('module_srl',$this->module_info->module_srl); |
|
920 | + Context::set('oSourceComment', $oSourceComment); |
|
921 | + Context::set('oComment', $oComment); |
|
922 | + Context::set('module_srl', $this->module_info->module_srl); |
|
923 | 923 | |
924 | 924 | /** |
925 | 925 | * add JS filters |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | function dispBoardModifyComment() |
936 | 936 | { |
937 | 937 | // check grant |
938 | - if(!$this->grant->write_comment) |
|
938 | + if (!$this->grant->write_comment) |
|
939 | 939 | { |
940 | 940 | return $this->dispBoardMessage('msg_not_permitted'); |
941 | 941 | } |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | $comment_srl = Context::get('comment_srl'); |
946 | 946 | |
947 | 947 | // if the comment is not existed |
948 | - if(!$comment_srl) |
|
948 | + if (!$comment_srl) |
|
949 | 949 | { |
950 | 950 | return new BaseObject(-1, 'msg_invalid_request'); |
951 | 951 | } |
@@ -955,13 +955,13 @@ discard block |
||
955 | 955 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
956 | 956 | |
957 | 957 | // if the comment is not exited, alert an error message |
958 | - if(!$oComment->isExists()) |
|
958 | + if (!$oComment->isExists()) |
|
959 | 959 | { |
960 | 960 | return $this->dispBoardMessage('msg_invalid_request'); |
961 | 961 | } |
962 | 962 | |
963 | 963 | // if the comment is not granted, then back to the password input form |
964 | - if(!$oComment->isGranted()) |
|
964 | + if (!$oComment->isGranted()) |
|
965 | 965 | { |
966 | 966 | return $this->setTemplateFile('input_password_form'); |
967 | 967 | } |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | function dispBoardDeleteComment() |
985 | 985 | { |
986 | 986 | // check grant |
987 | - if(!$this->grant->write_comment) |
|
987 | + if (!$this->grant->write_comment) |
|
988 | 988 | { |
989 | 989 | return $this->dispBoardMessage('msg_not_permitted'); |
990 | 990 | } |
@@ -993,25 +993,25 @@ discard block |
||
993 | 993 | $comment_srl = Context::get('comment_srl'); |
994 | 994 | |
995 | 995 | // if the comment exists, then get the comment information |
996 | - if($comment_srl) |
|
996 | + if ($comment_srl) |
|
997 | 997 | { |
998 | 998 | $oCommentModel = getModel('comment'); |
999 | 999 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | // if the comment is not existed, then back to the board content page |
1003 | - if(!$oComment->isExists() ) |
|
1003 | + if (!$oComment->isExists()) |
|
1004 | 1004 | { |
1005 | 1005 | return $this->dispBoardContent(); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | // if the comment is not granted, then back to the password input form |
1009 | - if(!$oComment->isGranted()) |
|
1009 | + if (!$oComment->isGranted()) |
|
1010 | 1010 | { |
1011 | 1011 | return $this->setTemplateFile('input_password_form'); |
1012 | 1012 | } |
1013 | 1013 | |
1014 | - Context::set('oComment',$oComment); |
|
1014 | + Context::set('oComment', $oComment); |
|
1015 | 1015 | |
1016 | 1016 | /** |
1017 | 1017 | * add JS filters |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | { |
1029 | 1029 | $oTrackbackModel = getModel('trackback'); |
1030 | 1030 | |
1031 | - if(!$oTrackbackModel) |
|
1031 | + if (!$oTrackbackModel) |
|
1032 | 1032 | { |
1033 | 1033 | return; |
1034 | 1034 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $trackback = $output->data; |
1043 | 1043 | |
1044 | 1044 | // if no trackback, then display the board content |
1045 | - if(!$trackback) |
|
1045 | + if (!$trackback) |
|
1046 | 1046 | { |
1047 | 1047 | return $this->dispBoardContent(); |
1048 | 1048 | } |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | function dispBoardMessage($msg_code) |
1064 | 1064 | { |
1065 | 1065 | $msg = Context::getLang($msg_code); |
1066 | - if(!$msg) $msg = $msg_code; |
|
1066 | + if (!$msg) $msg = $msg_code; |
|
1067 | 1067 | Context::set('message', $msg); |
1068 | 1068 | $this->setTemplateFile('message'); |
1069 | 1069 | } |
@@ -1074,8 +1074,8 @@ discard block |
||
1074 | 1074 | **/ |
1075 | 1075 | function alertMessage($message) |
1076 | 1076 | { |
1077 | - $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
1078 | - Context::addHtmlFooter( $script ); |
|
1077 | + $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
1078 | + Context::addHtmlFooter($script); |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | } |
@@ -279,6 +279,9 @@ discard block |
||
279 | 279 | $this->setRedirectUrl($returnUrl); |
280 | 280 | } |
281 | 281 | |
282 | + /** |
|
283 | + * @param string $message_content |
|
284 | + */ |
|
282 | 285 | private function _sendMessageForComment($message_content, $comment_srl_list) |
283 | 286 | { |
284 | 287 | $oCommunicationController = getController('communication'); |
@@ -308,6 +311,9 @@ discard block |
||
308 | 311 | |
309 | 312 | /** |
310 | 313 | * comment move to trash |
314 | + * @param ModuleObject $oCommentController |
|
315 | + * @param DB $oDB |
|
316 | + * @param string $message_content |
|
311 | 317 | * @return void|object |
312 | 318 | */ |
313 | 319 | function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL) |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | |
134 | 134 | //mail to author of thread - START |
135 | 135 | /** |
136 | - * @todo Removed code send email to document author. |
|
137 | - */ |
|
136 | + * @todo Removed code send email to document author. |
|
137 | + */ |
|
138 | 138 | /* |
139 | 139 | if($document_author_email != $comment->email_address && $logged_info->email_address != $document_author_email) |
140 | 140 | { |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
344 | - * @fn procCommentAdminMoveToTrash |
|
345 | - * @brief move a comment to trash |
|
346 | - * @see commentModel::getCommentMenu |
|
347 | - */ |
|
344 | + * @fn procCommentAdminMoveToTrash |
|
345 | + * @brief move a comment to trash |
|
346 | + * @see commentModel::getCommentMenu |
|
347 | + */ |
|
348 | 348 | function procCommentAdminMoveToTrash() |
349 | 349 | { |
350 | 350 | $oDB = DB::getInstance(); |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | if(!is_array($cart)) |
33 | 33 | { |
34 | 34 | $comment_srl_list = explode('|@|', $cart); |
35 | - } |
|
36 | - else |
|
35 | + } else |
|
37 | 36 | { |
38 | 37 | $comment_srl_list = $cart; |
39 | 38 | } |
@@ -61,8 +60,7 @@ discard block |
||
61 | 60 | if(!is_array($cart)) |
62 | 61 | { |
63 | 62 | $comment_srl_list = explode('|@|', $cart); |
64 | - } |
|
65 | - else |
|
63 | + } else |
|
66 | 64 | { |
67 | 65 | $comment_srl_list = $cart; |
68 | 66 | } |
@@ -74,8 +72,7 @@ discard block |
||
74 | 72 | if(!$output->toBool()) |
75 | 73 | { |
76 | 74 | return $output; |
77 | - } |
|
78 | - else |
|
75 | + } else |
|
79 | 76 | { |
80 | 77 | //update comment count for document |
81 | 78 | $updated_documents_arr = array(); |
@@ -202,8 +199,7 @@ discard block |
||
202 | 199 | if(!is_array($cart)) |
203 | 200 | { |
204 | 201 | $comment_srl_list = explode('|@|', $cart); |
205 | - } |
|
206 | - else |
|
202 | + } else |
|
207 | 203 | { |
208 | 204 | $comment_srl_list = $cart; |
209 | 205 | } |
@@ -262,8 +258,7 @@ discard block |
||
262 | 258 | if($isTrash == 'true') |
263 | 259 | { |
264 | 260 | $msgCode = 'success_trashed'; |
265 | - } |
|
266 | - else |
|
261 | + } else |
|
267 | 262 | { |
268 | 263 | $msgCode = 'success_deleted'; |
269 | 264 | } |
@@ -355,7 +350,9 @@ discard block |
||
355 | 350 | $oCommentController = getController('comment'); |
356 | 351 | $oComment = $oCommentModel->getComment($comment_srl, false); |
357 | 352 | |
358 | - if(!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
353 | + if(!$oComment->isGranted()) { |
|
354 | + return $this->stop('msg_not_permitted'); |
|
355 | + } |
|
359 | 356 | |
360 | 357 | $message_content = ""; |
361 | 358 | $this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content); |
@@ -410,8 +407,7 @@ discard block |
||
410 | 407 | if($_SESSION['comment_management'][$key]) |
411 | 408 | { |
412 | 409 | unset($_SESSION['comment_management'][$key]); |
413 | - } |
|
414 | - else |
|
410 | + } else |
|
415 | 411 | { |
416 | 412 | $_SESSION['comment_management'][$key] = TRUE; |
417 | 413 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | // Error display if none is selected |
31 | 31 | $cart = Context::get('cart'); |
32 | - if(!is_array($cart)) |
|
32 | + if (!is_array($cart)) |
|
33 | 33 | { |
34 | 34 | $comment_srl_list = explode('|@|', $cart); |
35 | 35 | } |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | |
55 | 55 | // Error display if none is selected |
56 | 56 | $cart = Context::get('cart'); |
57 | - if(!$cart) |
|
57 | + if (!$cart) |
|
58 | 58 | { |
59 | 59 | return $this->stop('msg_cart_is_null'); |
60 | 60 | } |
61 | - if(!is_array($cart)) |
|
61 | + if (!is_array($cart)) |
|
62 | 62 | { |
63 | 63 | $comment_srl_list = explode('|@|', $cart); |
64 | 64 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $args->status = $will_publish; |
72 | 72 | $args->comment_srls_list = $comment_srl_list; |
73 | 73 | $output = executeQuery('comment.updatePublishedStatus', $args); |
74 | - if(!$output->toBool()) |
|
74 | + if (!$output->toBool()) |
|
75 | 75 | { |
76 | 76 | return $output; |
77 | 77 | } |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | //$oMemberModule = getModel("member"); |
91 | 91 | //$logged_info = $oMemberModule->getMemberInfoByMemberSrl($logged_member_srl); |
92 | 92 | $new_status = ($will_publish) ? "published" : "unpublished"; |
93 | - foreach($comment_srl_list as $comment_srl) |
|
93 | + foreach ($comment_srl_list as $comment_srl) |
|
94 | 94 | { |
95 | 95 | // check if comment already exists |
96 | 96 | $comment = $oCommentModel->getComment($comment_srl); |
97 | - if($comment->comment_srl != $comment_srl) |
|
97 | + if ($comment->comment_srl != $comment_srl) |
|
98 | 98 | { |
99 | 99 | return new BaseObject(-1, 'msg_invalid_request'); |
100 | 100 | } |
101 | 101 | $document_srl = $comment->document_srl; |
102 | - if(!in_array($document_srl, $updated_documents_arr)) |
|
102 | + if (!in_array($document_srl, $updated_documents_arr)) |
|
103 | 103 | { |
104 | 104 | $updated_documents_arr[] = $document_srl; |
105 | 105 | // update the number of comments |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | // send email to comment's author, all admins and thread(document) subscribers - START |
118 | 118 | // ------------------------------------------------------- |
119 | 119 | $oMail = new Mail(); |
120 | - $mail_title = "[XE - " . $module_info->mid . "] comment(s) status changed to " . $new_status . " on document: \"" . $oDocument->getTitleText() . "\""; |
|
120 | + $mail_title = "[XE - ".$module_info->mid."] comment(s) status changed to ".$new_status." on document: \"".$oDocument->getTitleText()."\""; |
|
121 | 121 | $oMail->setTitle($mail_title); |
122 | 122 | $mail_content = " |
123 | - The comment #" . $comment_srl . " on document \"" . $oDocument->getTitleText() . "\" has been " . $new_status . " by admin of <strong><i>" . strtoupper($module_info->mid) . "</i></strong> module. |
|
123 | + The comment #" . $comment_srl." on document \"".$oDocument->getTitleText()."\" has been ".$new_status." by admin of <strong><i>".strtoupper($module_info->mid)."</i></strong> module. |
|
124 | 124 | <br /> |
125 | 125 | <br />Comment content: |
126 | - " . $comment->content . " |
|
126 | + " . $comment->content." |
|
127 | 127 | <br /> |
128 | 128 | "; |
129 | 129 | $oMail->setContent($mail_content); |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | */ |
146 | 146 | //mail to author of thread - STOP |
147 | 147 | //mail to all emails set for administrators - START |
148 | - if($module_info->admin_mail) |
|
148 | + if ($module_info->admin_mail) |
|
149 | 149 | { |
150 | 150 | $target_mail = explode(',', $module_info->admin_mail); |
151 | - for($i = 0; $i < count($target_mail); $i++) |
|
151 | + for ($i = 0; $i < count($target_mail); $i++) |
|
152 | 152 | { |
153 | 153 | $email_address = trim($target_mail[$i]); |
154 | - if(!$email_address) |
|
154 | + if (!$email_address) |
|
155 | 155 | { |
156 | 156 | continue; |
157 | 157 | } |
158 | - if($author_email != $email_address) |
|
158 | + if ($author_email != $email_address) |
|
159 | 159 | { |
160 | 160 | $oMail->setReceiptor($email_address, $email_address); |
161 | 161 | $oMail->send(); |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | |
174 | 174 | // for message send - start |
175 | 175 | $message_content = Context::get('message_content'); |
176 | - if($message_content) |
|
176 | + if ($message_content) |
|
177 | 177 | { |
178 | 178 | $message_content = nl2br($message_content); |
179 | 179 | } |
180 | 180 | |
181 | - if($message_content) |
|
181 | + if ($message_content) |
|
182 | 182 | { |
183 | 183 | $this->_sendMessageForComment($message_content, $comment_srl_list); |
184 | 184 | } |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | |
196 | 196 | // Error display if none is selected |
197 | 197 | $cart = Context::get('cart'); |
198 | - if(!$cart) |
|
198 | + if (!$cart) |
|
199 | 199 | { |
200 | 200 | return $this->stop('msg_cart_is_null'); |
201 | 201 | } |
202 | - if(!is_array($cart)) |
|
202 | + if (!is_array($cart)) |
|
203 | 203 | { |
204 | 204 | $comment_srl_list = explode('|@|', $cart); |
205 | 205 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $comment_srl_list = $cart; |
209 | 209 | } |
210 | 210 | $comment_count = count($comment_srl_list); |
211 | - if(!$comment_count) |
|
211 | + if (!$comment_count) |
|
212 | 212 | { |
213 | 213 | return $this->stop('msg_cart_is_null'); |
214 | 214 | } |
@@ -220,34 +220,34 @@ discard block |
||
220 | 220 | |
221 | 221 | // for message send - start |
222 | 222 | $message_content = Context::get('message_content'); |
223 | - if($message_content) |
|
223 | + if ($message_content) |
|
224 | 224 | { |
225 | 225 | $message_content = nl2br($message_content); |
226 | 226 | } |
227 | 227 | |
228 | - if($message_content) |
|
228 | + if ($message_content) |
|
229 | 229 | { |
230 | 230 | $this->_sendMessageForComment($message_content, $comment_srl_list); |
231 | 231 | } |
232 | 232 | // for message send - end |
233 | 233 | // comment into trash |
234 | - if($isTrash == 'true') |
|
234 | + if ($isTrash == 'true') |
|
235 | 235 | { |
236 | 236 | $this->_moveCommentToTrash($comment_srl_list, $oCommentController, $oDB, $message_content); |
237 | 237 | } |
238 | 238 | |
239 | 239 | $deleted_count = 0; |
240 | 240 | // Delete the comment posting |
241 | - for($i = 0; $i < $comment_count; $i++) |
|
241 | + for ($i = 0; $i < $comment_count; $i++) |
|
242 | 242 | { |
243 | 243 | $comment_srl = trim($comment_srl_list[$i]); |
244 | - if(!$comment_srl) |
|
244 | + if (!$comment_srl) |
|
245 | 245 | { |
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | |
249 | 249 | $output = $oCommentController->deleteComment($comment_srl, TRUE, $isTrash); |
250 | - if(!$output->toBool()) |
|
250 | + if (!$output->toBool()) |
|
251 | 251 | { |
252 | 252 | $oDB->rollback(); |
253 | 253 | return $output; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $oDB->commit(); |
260 | 260 | |
261 | 261 | $msgCode = ''; |
262 | - if($isTrash == 'true') |
|
262 | + if ($isTrash == 'true') |
|
263 | 263 | { |
264 | 264 | $msgCode = 'success_trashed'; |
265 | 265 | } |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | $sender_member_srl = $logged_info->member_srl; |
291 | 291 | |
292 | 292 | $comment_count = count($comment_srl_list); |
293 | - for($i = 0; $i < $comment_count; $i++) |
|
293 | + for ($i = 0; $i < $comment_count; $i++) |
|
294 | 294 | { |
295 | 295 | $comment_srl = $comment_srl_list[$i]; |
296 | 296 | $oComment = $oCommentModel->getComment($comment_srl, TRUE); |
297 | 297 | |
298 | - if(!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl) |
|
298 | + if (!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl) |
|
299 | 299 | { |
300 | 300 | continue; |
301 | 301 | } |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | */ |
313 | 313 | function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL) |
314 | 314 | { |
315 | - require_once(_XE_PATH_ . 'modules/trash/model/TrashVO.php'); |
|
315 | + require_once(_XE_PATH_.'modules/trash/model/TrashVO.php'); |
|
316 | 316 | |
317 | - if(is_array($commentSrlList)) |
|
317 | + if (is_array($commentSrlList)) |
|
318 | 318 | { |
319 | 319 | $logged_info = Context::get('logged_info'); |
320 | 320 | $oCommentModel = getModel('comment'); |
321 | 321 | $commentItemList = $oCommentModel->getComments($commentSrlList); |
322 | 322 | $oTrashAdminController = getAdminController('trash'); |
323 | 323 | |
324 | - foreach($commentItemList AS $key => $oComment) |
|
324 | + foreach ($commentItemList AS $key => $oComment) |
|
325 | 325 | { |
326 | 326 | $oTrashVO = new TrashVO(); |
327 | 327 | $oTrashVO->setTrashSrl(getNextSequence()); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $oTrashVO->setDescription($message_content); |
332 | 332 | |
333 | 333 | $output = $oTrashAdminController->insertTrash($oTrashVO); |
334 | - if(!$output->toBool()) |
|
334 | + if (!$output->toBool()) |
|
335 | 335 | { |
336 | 336 | $oDB->rollback(); |
337 | 337 | return $output; |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $oCommentController = getController('comment'); |
356 | 356 | $oComment = $oCommentModel->getComment($comment_srl, false); |
357 | 357 | |
358 | - if(!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
358 | + if (!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
359 | 359 | |
360 | 360 | $message_content = ""; |
361 | 361 | $this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content); |
@@ -377,12 +377,12 @@ discard block |
||
377 | 377 | { |
378 | 378 | $comment_srl = trim(Context::get('comment_srl')); |
379 | 379 | |
380 | - if($comment_srl) |
|
380 | + if ($comment_srl) |
|
381 | 381 | { |
382 | 382 | $args = new stdClass(); |
383 | 383 | $args->comment_srl = $comment_srl; |
384 | 384 | $output = executeQuery('comment.deleteDeclaredComments', $args); |
385 | - if(!$output->toBool()) |
|
385 | + if (!$output->toBool()) |
|
386 | 386 | { |
387 | 387 | return $output; |
388 | 388 | } |
@@ -403,11 +403,11 @@ discard block |
||
403 | 403 | |
404 | 404 | $output = $oCommentModel->getComments($commentSrlList); |
405 | 405 | |
406 | - if(is_array($output)) |
|
406 | + if (is_array($output)) |
|
407 | 407 | { |
408 | - foreach($output AS $key => $value) |
|
408 | + foreach ($output AS $key => $value) |
|
409 | 409 | { |
410 | - if($_SESSION['comment_management'][$key]) |
|
410 | + if ($_SESSION['comment_management'][$key]) |
|
411 | 411 | { |
412 | 412 | unset($_SESSION['comment_management'][$key]); |
413 | 413 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $args = new stdClass(); |
429 | 429 | $args->module_srl = $module_srl; |
430 | 430 | $output = executeQuery('comment.deleteModuleComments', $args); |
431 | - if(!$output->toBool()) |
|
431 | + if (!$output->toBool()) |
|
432 | 432 | { |
433 | 433 | return $output; |
434 | 434 | } |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | //remove from cache |
439 | 439 | $oCacheHandler = CacheHandler::getInstance('object'); |
440 | - if($oCacheHandler->isSupport()) |
|
440 | + if ($oCacheHandler->isSupport()) |
|
441 | 441 | { |
442 | 442 | // Invalidate newest comments. Per document cache is invalidated inside document admin controller. |
443 | 443 | $oCacheHandler->invalidateGroupKey('newestCommentsList'); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | */ |
453 | 453 | function restoreTrash($originObject) |
454 | 454 | { |
455 | - if(is_array($originObject)) |
|
455 | + if (is_array($originObject)) |
|
456 | 456 | { |
457 | 457 | $originObject = (object) $originObject; |
458 | 458 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | function emptyTrash($originObject) |
486 | 486 | { |
487 | 487 | $originObject = unserialize($originObject); |
488 | - if(is_array($originObject)) |
|
488 | + if (is_array($originObject)) |
|
489 | 489 | { |
490 | 490 | $originObject = (object) $originObject; |
491 | 491 | } |
@@ -101,7 +101,6 @@ |
||
101 | 101 | |
102 | 102 | /** |
103 | 103 | * @brief check member's grant |
104 | - * @param object $member_info |
|
105 | 104 | * @param array $arrGrant |
106 | 105 | * @return boolean |
107 | 106 | */ |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * @brief get grant array for insert to database. table module_config's config field |
|
65 | - * @param string $default |
|
66 | - * @param array $group |
|
67 | - * @return array |
|
68 | - */ |
|
64 | + * @brief get grant array for insert to database. table module_config's config field |
|
65 | + * @param string $default |
|
66 | + * @param array $group |
|
67 | + * @return array |
|
68 | + */ |
|
69 | 69 | function getGrantArray($default, $group) |
70 | 70 | { |
71 | 71 | $grant = array(); |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * @brief check member's grant |
|
104 | - * @param object $member_info |
|
105 | - * @param array $arrGrant |
|
106 | - * @return boolean |
|
107 | - */ |
|
103 | + * @brief check member's grant |
|
104 | + * @param object $member_info |
|
105 | + * @param array $arrGrant |
|
106 | + * @return boolean |
|
107 | + */ |
|
108 | 108 | function checkGrant($arrGrant) |
109 | 109 | { |
110 | 110 | if(!$arrGrant) |
@@ -27,32 +27,32 @@ discard block |
||
27 | 27 | $oModuleModel = getModel('module'); |
28 | 28 | $communication_config = $oModuleModel->getModuleConfig('communication'); |
29 | 29 | |
30 | - if(!is_object($communication_config)) |
|
30 | + if (!is_object($communication_config)) |
|
31 | 31 | { |
32 | 32 | $communication_config = new stdClass(); |
33 | 33 | } |
34 | 34 | |
35 | - if(!$communication_config->skin) |
|
35 | + if (!$communication_config->skin) |
|
36 | 36 | { |
37 | 37 | $communication_config->skin = 'default'; |
38 | 38 | } |
39 | 39 | |
40 | - if(!$communication_config->colorset) |
|
40 | + if (!$communication_config->colorset) |
|
41 | 41 | { |
42 | 42 | $communication_config->colorset = 'white'; |
43 | 43 | } |
44 | 44 | |
45 | - if(!$communication_config->editor_skin) |
|
45 | + if (!$communication_config->editor_skin) |
|
46 | 46 | { |
47 | 47 | $communication_config->editor_skin = 'ckeditor'; |
48 | 48 | } |
49 | 49 | |
50 | - if(!$communication_config->mskin) |
|
50 | + if (!$communication_config->mskin) |
|
51 | 51 | { |
52 | 52 | $communication_config->mskin = 'default'; |
53 | 53 | } |
54 | 54 | |
55 | - if(!$communication_config->grant_write) |
|
55 | + if (!$communication_config->grant_write) |
|
56 | 56 | { |
57 | 57 | $communication_config->grant_write = array('default_grant'=>'member'); |
58 | 58 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | function getGrantArray($default, $group) |
70 | 70 | { |
71 | 71 | $grant = array(); |
72 | - if($default!="") |
|
72 | + if ($default != "") |
|
73 | 73 | { |
74 | - switch($default) |
|
74 | + switch ($default) |
|
75 | 75 | { |
76 | 76 | case "-2": |
77 | 77 | $grant = array("default_grant"=>"site"); |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | break; |
85 | 85 | } |
86 | 86 | } |
87 | - else if(is_array($group)) |
|
87 | + else if (is_array($group)) |
|
88 | 88 | { |
89 | 89 | $oMemberModel = getModel('member'); |
90 | 90 | $group_list = $oMemberModel->getGroups($this->site_srl); |
91 | 91 | |
92 | 92 | $group_grant = array(); |
93 | - foreach($group as $group_srl) |
|
93 | + foreach ($group as $group_srl) |
|
94 | 94 | { |
95 | 95 | $group_grant[$group_srl] = $group_list[$group_srl]->title; |
96 | 96 | } |
@@ -107,37 +107,37 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function checkGrant($arrGrant) |
109 | 109 | { |
110 | - if(!$arrGrant) |
|
110 | + if (!$arrGrant) |
|
111 | 111 | return false; |
112 | 112 | |
113 | 113 | $logged_info = Context::get('logged_info'); |
114 | - if(!$logged_info) |
|
114 | + if (!$logged_info) |
|
115 | 115 | return false; |
116 | 116 | |
117 | - if($logged_info->is_admin == "Y") |
|
117 | + if ($logged_info->is_admin == "Y") |
|
118 | 118 | return true; |
119 | 119 | |
120 | - if($arrGrant['default_grant']) |
|
120 | + if ($arrGrant['default_grant']) |
|
121 | 121 | { |
122 | - if($arrGrant['default_grant'] == "member" && $logged_info) |
|
122 | + if ($arrGrant['default_grant'] == "member" && $logged_info) |
|
123 | 123 | return true; |
124 | 124 | |
125 | - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
125 | + if ($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
126 | 126 | return true; |
127 | 127 | |
128 | - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
128 | + if ($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
129 | 129 | return true; |
130 | 130 | } |
131 | 131 | |
132 | - if($arrGrant['group_grant']) |
|
132 | + if ($arrGrant['group_grant']) |
|
133 | 133 | { |
134 | 134 | $group_grant = $arrGrant['group_grant']; |
135 | - if(!is_array($group_grant)) |
|
135 | + if (!is_array($group_grant)) |
|
136 | 136 | return false; |
137 | 137 | |
138 | - foreach($logged_info->group_list as $group_srl=>$title) |
|
138 | + foreach ($logged_info->group_list as $group_srl=>$title) |
|
139 | 139 | { |
140 | - if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) |
|
140 | + if (isset($group_grant[$group_srl]) && $group_grant[$group_srl] == $title) |
|
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $output = executeQuery('communication.getMessage', $args, $columnList); |
163 | 163 | |
164 | 164 | $message = $output->data; |
165 | - if(!$message) |
|
165 | + if (!$message) |
|
166 | 166 | { |
167 | 167 | return; |
168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | // get recipient's information if it is a sent message |
171 | 171 | $oMemberModel = getModel('member'); |
172 | 172 | |
173 | - if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') |
|
173 | + if ($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') |
|
174 | 174 | { |
175 | 175 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl); |
176 | 176 | } |
@@ -180,22 +180,22 @@ discard block |
||
180 | 180 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl); |
181 | 181 | } |
182 | 182 | |
183 | - if($member_info) |
|
183 | + if ($member_info) |
|
184 | 184 | { |
185 | - foreach($member_info as $key => $val) |
|
185 | + foreach ($member_info as $key => $val) |
|
186 | 186 | { |
187 | - if($key === 'title') continue; |
|
188 | - if($key === 'content') continue; |
|
189 | - if($key === 'sender_srl') continue; |
|
190 | - if($key === 'password') continue; |
|
191 | - if($key === 'regdate') continue; |
|
187 | + if ($key === 'title') continue; |
|
188 | + if ($key === 'content') continue; |
|
189 | + if ($key === 'sender_srl') continue; |
|
190 | + if ($key === 'password') continue; |
|
191 | + if ($key === 'regdate') continue; |
|
192 | 192 | |
193 | 193 | $message->{$key} = $val; |
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | 197 | // change the status if is a received and not yet read message |
198 | - if($message->message_type == 'R' && $message->readed != 'Y') |
|
198 | + if ($message->message_type == 'R' && $message->readed != 'Y') |
|
199 | 199 | { |
200 | 200 | $oCommunicationController = getController('communication'); |
201 | 201 | $oCommunicationController->setMessageReaded($message_srl); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $args->readed = 'N'; |
219 | 219 | |
220 | 220 | $output = executeQuery('communication.getNewMessage', $args, $columnList); |
221 | - if(!count($output->data)) |
|
221 | + if (!count($output->data)) |
|
222 | 222 | { |
223 | 223 | return; |
224 | 224 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $logged_info = Context::get('logged_info'); |
243 | 243 | $args = new stdClass(); |
244 | 244 | |
245 | - switch($message_type) |
|
245 | + switch ($message_type) |
|
246 | 246 | { |
247 | 247 | case 'R' : |
248 | 248 | $args->member_srl = $logged_info->member_srl; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $output = executeQueryArray('communication.getFriendGroups', $args); |
348 | 348 | |
349 | 349 | $group_list = $output->data; |
350 | - if(!$group_list) |
|
350 | + if (!$group_list) |
|
351 | 351 | { |
352 | 352 | return; |
353 | 353 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | |
371 | 371 | $output = executeQuery('communication.isAddedFriend', $args); |
372 | 372 | |
373 | - if($output->data->count) |
|
373 | + if ($output->data->count) |
|
374 | 374 | { |
375 | 375 | return TRUE; |
376 | 376 | } |
@@ -83,8 +83,7 @@ discard block |
||
83 | 83 | $grant = array("default_grant"=>"member"); |
84 | 84 | break; |
85 | 85 | } |
86 | - } |
|
87 | - else if(is_array($group)) |
|
86 | + } else if(is_array($group)) |
|
88 | 87 | { |
89 | 88 | $oMemberModel = getModel('member'); |
90 | 89 | $group_list = $oMemberModel->getGroups($this->site_srl); |
@@ -107,38 +106,46 @@ discard block |
||
107 | 106 | */ |
108 | 107 | function checkGrant($arrGrant) |
109 | 108 | { |
110 | - if(!$arrGrant) |
|
111 | - return false; |
|
109 | + if(!$arrGrant) { |
|
110 | + return false; |
|
111 | + } |
|
112 | 112 | |
113 | 113 | $logged_info = Context::get('logged_info'); |
114 | - if(!$logged_info) |
|
115 | - return false; |
|
114 | + if(!$logged_info) { |
|
115 | + return false; |
|
116 | + } |
|
116 | 117 | |
117 | - if($logged_info->is_admin == "Y") |
|
118 | - return true; |
|
118 | + if($logged_info->is_admin == "Y") { |
|
119 | + return true; |
|
120 | + } |
|
119 | 121 | |
120 | 122 | if($arrGrant['default_grant']) |
121 | 123 | { |
122 | - if($arrGrant['default_grant'] == "member" && $logged_info) |
|
123 | - return true; |
|
124 | + if($arrGrant['default_grant'] == "member" && $logged_info) { |
|
125 | + return true; |
|
126 | + } |
|
124 | 127 | |
125 | - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
126 | - return true; |
|
128 | + if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) { |
|
129 | + return true; |
|
130 | + } |
|
127 | 131 | |
128 | - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
129 | - return true; |
|
132 | + if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") { |
|
133 | + return true; |
|
134 | + } |
|
130 | 135 | } |
131 | 136 | |
132 | 137 | if($arrGrant['group_grant']) |
133 | 138 | { |
134 | 139 | $group_grant = $arrGrant['group_grant']; |
135 | - if(!is_array($group_grant)) |
|
136 | - return false; |
|
140 | + if(!is_array($group_grant)) { |
|
141 | + return false; |
|
142 | + } |
|
137 | 143 | |
138 | 144 | foreach($logged_info->group_list as $group_srl=>$title) |
139 | 145 | { |
140 | - if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) |
|
141 | - return true; |
|
146 | + if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) { |
|
147 | + return true; |
|
148 | + } |
|
142 | 149 | } |
143 | 150 | |
144 | 151 | } |
@@ -184,11 +191,21 @@ discard block |
||
184 | 191 | { |
185 | 192 | foreach($member_info as $key => $val) |
186 | 193 | { |
187 | - if($key === 'title') continue; |
|
188 | - if($key === 'content') continue; |
|
189 | - if($key === 'sender_srl') continue; |
|
190 | - if($key === 'password') continue; |
|
191 | - if($key === 'regdate') continue; |
|
194 | + if($key === 'title') { |
|
195 | + continue; |
|
196 | + } |
|
197 | + if($key === 'content') { |
|
198 | + continue; |
|
199 | + } |
|
200 | + if($key === 'sender_srl') { |
|
201 | + continue; |
|
202 | + } |
|
203 | + if($key === 'password') { |
|
204 | + continue; |
|
205 | + } |
|
206 | + if($key === 'regdate') { |
|
207 | + continue; |
|
208 | + } |
|
192 | 209 | |
193 | 210 | $message->{$key} = $val; |
194 | 211 | } |
@@ -351,6 +351,7 @@ |
||
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Return status by key |
354 | + * @param string $key |
|
354 | 355 | * @return string |
355 | 356 | */ |
356 | 357 | function getConfigStatus($key) |
@@ -70,68 +70,126 @@ discard block |
||
70 | 70 | if($oModuleModel->needUpdate($version_update_id)) |
71 | 71 | { |
72 | 72 | // 2007. 7. 25: Add a column(notify_message) for notification |
73 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
73 | + if(!$oDB->isColumnExists("documents","notify_message")) { |
|
74 | + return true; |
|
75 | + } |
|
74 | 76 | |
75 | 77 | // 2007. 8. 23: create a clustered index in the document table |
76 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
77 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
78 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
79 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
78 | + if(!$oDB->isIndexExists("documents","idx_module_list_order")) { |
|
79 | + return true; |
|
80 | + } |
|
81 | + if(!$oDB->isIndexExists("documents","idx_module_update_order")) { |
|
82 | + return true; |
|
83 | + } |
|
84 | + if(!$oDB->isIndexExists("documents","idx_module_readed_count")) { |
|
85 | + return true; |
|
86 | + } |
|
87 | + if(!$oDB->isIndexExists("documents","idx_module_voted_count")) { |
|
88 | + return true; |
|
89 | + } |
|
80 | 90 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
81 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
91 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
92 | + return true; |
|
93 | + } |
|
82 | 94 | // 2007. 10. 25 add parent_srl, expand to the document category |
83 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
84 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
85 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
95 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
96 | + return true; |
|
97 | + } |
|
98 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
99 | + return true; |
|
100 | + } |
|
101 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
102 | + return true; |
|
103 | + } |
|
86 | 104 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
87 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
105 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
106 | + return true; |
|
107 | + } |
|
88 | 108 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
89 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
109 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
110 | + return true; |
|
111 | + } |
|
90 | 112 | |
91 | 113 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
92 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
114 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
115 | + return true; |
|
116 | + } |
|
93 | 117 | // 2008. 04. 23 Add a column(blamed_count) |
94 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
95 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
96 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
118 | + if(!$oDB->isColumnExists("documents", "blamed_count")) { |
|
119 | + return true; |
|
120 | + } |
|
121 | + if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) { |
|
122 | + return true; |
|
123 | + } |
|
124 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
125 | + return true; |
|
126 | + } |
|
97 | 127 | // 2008-12-15 Add a column(color) |
98 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
128 | + if(!$oDB->isColumnExists("document_categories", "color")) { |
|
129 | + return true; |
|
130 | + } |
|
99 | 131 | |
100 | 132 | /** |
101 | 133 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
102 | 134 | */ |
103 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
135 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
136 | + return true; |
|
137 | + } |
|
104 | 138 | |
105 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
139 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
140 | + return true; |
|
141 | + } |
|
106 | 142 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
107 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
143 | + if(!$oDB->isColumnExists("documents","lang_code")) { |
|
144 | + return true; |
|
145 | + } |
|
108 | 146 | // 2009. 03. 11 check the index in the document_extra_vars table |
109 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
147 | + if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) { |
|
148 | + return true; |
|
149 | + } |
|
110 | 150 | |
111 | 151 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
112 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
113 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
152 | + if(!$oDB->isColumnExists("document_extra_keys","eid")) { |
|
153 | + return true; |
|
154 | + } |
|
155 | + if(!$oDB->isColumnExists("document_extra_vars","eid")) { |
|
156 | + return true; |
|
157 | + } |
|
114 | 158 | |
115 | 159 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
116 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
160 | + if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) { |
|
161 | + return true; |
|
162 | + } |
|
117 | 163 | |
118 | 164 | //2011. 04. 07 adding description column to document categories |
119 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
165 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
166 | + return true; |
|
167 | + } |
|
120 | 168 | |
121 | 169 | //2011. 05. 23 adding status column to document |
122 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
170 | + if(!$oDB->isColumnExists('documents', 'status')) { |
|
171 | + return true; |
|
172 | + } |
|
123 | 173 | |
124 | 174 | //2011. 06. 07 check comment status update |
125 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
175 | + if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) { |
|
176 | + return true; |
|
177 | + } |
|
126 | 178 | |
127 | 179 | // 2011. 10. 25 status index check |
128 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
180 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
181 | + return true; |
|
182 | + } |
|
129 | 183 | |
130 | 184 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
131 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
185 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) { |
|
186 | + return true; |
|
187 | + } |
|
132 | 188 | |
133 | 189 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
134 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
190 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) { |
|
191 | + return true; |
|
192 | + } |
|
135 | 193 | |
136 | 194 | $oModuleController->insertUpdatedLog($version_update_id); |
137 | 195 | } |
@@ -178,20 +236,33 @@ discard block |
||
178 | 236 | $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
179 | 237 | } |
180 | 238 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
181 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
182 | - $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
239 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
240 | + $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
241 | + } |
|
183 | 242 | // 2007. 10. 25 add columns(parent_srl, expand) |
184 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
185 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
186 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
243 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
244 | + $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
245 | + } |
|
246 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
247 | + $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
248 | + } |
|
249 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
250 | + $oDB->addColumn('document_categories',"group_srls","text"); |
|
251 | + } |
|
187 | 252 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
188 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
253 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
254 | + $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
255 | + } |
|
189 | 256 | |
190 | 257 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
191 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
258 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
259 | + $oDB->addColumn('documents','extra_vars','text'); |
|
260 | + } |
|
192 | 261 | |
193 | 262 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
194 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
263 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
264 | + $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
265 | + } |
|
195 | 266 | // 2008. 04. 23 Add a column(blamed count) |
196 | 267 | if(!$oDB->isColumnExists("documents", "blamed_count")) |
197 | 268 | { |
@@ -204,18 +275,24 @@ discard block |
||
204 | 275 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
205 | 276 | } |
206 | 277 | |
207 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
208 | - $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
278 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
279 | + $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
280 | + } |
|
209 | 281 | |
210 | 282 | |
211 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
283 | + if(!$oDB->isColumnExists("document_categories","color")) { |
|
284 | + $oDB->addColumn('document_categories',"color","char",7); |
|
285 | + } |
|
212 | 286 | |
213 | 287 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
214 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
288 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
289 | + $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
290 | + } |
|
215 | 291 | |
216 | 292 | // 2009. 01. 29 Added a trigger for additional setup |
217 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
218 | - $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
293 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
294 | + $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
295 | + } |
|
219 | 296 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
220 | 297 | if(!$oDB->isColumnExists("documents","lang_code")) |
221 | 298 | { |
@@ -276,7 +353,9 @@ discard block |
||
276 | 353 | } |
277 | 354 | |
278 | 355 | //2011. 04. 07 adding description column to document categories |
279 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
356 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
357 | + $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
358 | + } |
|
280 | 359 | |
281 | 360 | //2011. 05. 23 adding status column to document |
282 | 361 | if(!$oDB->isColumnExists('documents', 'status')) |
@@ -287,8 +366,9 @@ discard block |
||
287 | 366 | } |
288 | 367 | |
289 | 368 | // 2011. 09. 08 drop column document is_secret |
290 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
291 | - $oDB->dropColumn('documents', 'is_secret'); |
|
369 | + if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) { |
|
370 | + $oDB->dropColumn('documents', 'is_secret'); |
|
371 | + } |
|
292 | 372 | |
293 | 373 | //2011. 06. 07 merge column, allow_comment and lock_comment |
294 | 374 | if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
@@ -313,14 +393,17 @@ discard block |
||
313 | 393 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
314 | 394 | } |
315 | 395 | |
316 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
317 | - $oDB->dropColumn('documents', 'allow_comment'); |
|
396 | + if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
397 | + $oDB->dropColumn('documents', 'allow_comment'); |
|
398 | + } |
|
318 | 399 | |
319 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
320 | - $oDB->dropColumn('documents', 'lock_comment'); |
|
400 | + if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
401 | + $oDB->dropColumn('documents', 'lock_comment'); |
|
402 | + } |
|
321 | 403 | |
322 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
323 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
404 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
405 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
406 | + } |
|
324 | 407 | |
325 | 408 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
326 | 409 | if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
@@ -376,8 +459,11 @@ discard block |
||
376 | 459 | */ |
377 | 460 | function getConfigStatus($key) |
378 | 461 | { |
379 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
380 | - else $this->getDefaultStatus(); |
|
462 | + if(array_key_exists(strtolower($key), $this->statusList)) { |
|
463 | + return $this->statusList[$key]; |
|
464 | + } else { |
|
465 | + $this->getDefaultStatus(); |
|
466 | + } |
|
381 | 467 | } |
382 | 468 | } |
383 | 469 | /* End of file document.class.php */ |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * Search option to use in admin page |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - var $search_option = array('title','content','title_content','user_name',); // /< Search options |
|
20 | + var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options |
|
21 | 21 | /** |
22 | 22 | * Status list |
23 | 23 | * @var array |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | $oModuleController = getController('module'); |
35 | 35 | |
36 | 36 | $oDB = &DB::getInstance(); |
37 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
38 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
39 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
40 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
41 | - $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
42 | - $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
43 | - $oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count")); |
|
44 | - $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true); |
|
45 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
37 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
38 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
39 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
40 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
41 | + $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
42 | + $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
43 | + $oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count")); |
|
44 | + $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true); |
|
45 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
46 | 46 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
47 | 47 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
48 | 48 | |
49 | 49 | // 2009. 01. 29 Added a trigger for additional setup |
50 | 50 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
51 | 51 | |
52 | - if(!is_dir('./files/cache/tmp')) |
|
52 | + if (!is_dir('./files/cache/tmp')) |
|
53 | 53 | { |
54 | 54 | FileHandler::makeDir('./files/cache/tmp'); |
55 | 55 | } |
@@ -67,71 +67,71 @@ discard block |
||
67 | 67 | $oModuleModel = getModel('module'); |
68 | 68 | $oModuleController = getController('module'); |
69 | 69 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
70 | - if($oModuleModel->needUpdate($version_update_id)) |
|
70 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
71 | 71 | { |
72 | 72 | // 2007. 7. 25: Add a column(notify_message) for notification |
73 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
73 | + if (!$oDB->isColumnExists("documents", "notify_message")) return true; |
|
74 | 74 | |
75 | 75 | // 2007. 8. 23: create a clustered index in the document table |
76 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
77 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
78 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
79 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
76 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true; |
|
77 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true; |
|
78 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true; |
|
79 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true; |
|
80 | 80 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
81 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
81 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
82 | 82 | // 2007. 10. 25 add parent_srl, expand to the document category |
83 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
84 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
85 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
83 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true; |
|
84 | + if (!$oDB->isColumnExists("document_categories", "expand")) return true; |
|
85 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) return true; |
|
86 | 86 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
87 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
87 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true; |
|
88 | 88 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
89 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
89 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true; |
|
90 | 90 | |
91 | 91 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
92 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
92 | + if (!$oDB->isColumnExists("documents", "extra_vars")) return true; |
|
93 | 93 | // 2008. 04. 23 Add a column(blamed_count) |
94 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
95 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
96 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
94 | + if (!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
95 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true; |
|
96 | + if (!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
97 | 97 | // 2008-12-15 Add a column(color) |
98 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
98 | + if (!$oDB->isColumnExists("document_categories", "color")) return true; |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
102 | 102 | */ |
103 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
103 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true; |
|
104 | 104 | |
105 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
105 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
106 | 106 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
107 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
107 | + if (!$oDB->isColumnExists("documents", "lang_code")) return true; |
|
108 | 108 | // 2009. 03. 11 check the index in the document_extra_vars table |
109 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
109 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
110 | 110 | |
111 | 111 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
112 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
113 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
112 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true; |
|
113 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true; |
|
114 | 114 | |
115 | 115 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
116 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
116 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
117 | 117 | |
118 | 118 | //2011. 04. 07 adding description column to document categories |
119 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
119 | + if (!$oDB->isColumnExists("document_categories", "description")) return true; |
|
120 | 120 | |
121 | 121 | //2011. 05. 23 adding status column to document |
122 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
122 | + if (!$oDB->isColumnExists('documents', 'status')) return true; |
|
123 | 123 | |
124 | 124 | //2011. 06. 07 check comment status update |
125 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
125 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
126 | 126 | |
127 | 127 | // 2011. 10. 25 status index check |
128 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
128 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
129 | 129 | |
130 | 130 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
131 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
131 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
132 | 132 | |
133 | 133 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
134 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
134 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
135 | 135 | |
136 | 136 | $oModuleController->insertUpdatedLog($version_update_id); |
137 | 137 | } |
@@ -149,101 +149,101 @@ discard block |
||
149 | 149 | $oModuleModel = getModel('module'); |
150 | 150 | $oModuleController = getController('module'); |
151 | 151 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
152 | - if($oModuleModel->needUpdate($version_update_id)) |
|
152 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
153 | 153 | { |
154 | 154 | // 2007. 7. 25: Add a column(notify_message) for notification |
155 | - if(!$oDB->isColumnExists("documents","notify_message")) |
|
155 | + if (!$oDB->isColumnExists("documents", "notify_message")) |
|
156 | 156 | { |
157 | - $oDB->addColumn('documents',"notify_message","char",1); |
|
157 | + $oDB->addColumn('documents', "notify_message", "char", 1); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | // 2007. 8. 23: create a clustered index in the document table |
161 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) |
|
161 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) |
|
162 | 162 | { |
163 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
163 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
164 | 164 | } |
165 | 165 | |
166 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) |
|
166 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) |
|
167 | 167 | { |
168 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
168 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
169 | 169 | } |
170 | 170 | |
171 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) |
|
171 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) |
|
172 | 172 | { |
173 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
173 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
174 | 174 | } |
175 | 175 | |
176 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) |
|
176 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) |
|
177 | 177 | { |
178 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
178 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
179 | 179 | } |
180 | 180 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
181 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
181 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
182 | 182 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
183 | 183 | // 2007. 10. 25 add columns(parent_srl, expand) |
184 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
185 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
186 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
184 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0); |
|
185 | + if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N"); |
|
186 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text"); |
|
187 | 187 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
188 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
188 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
189 | 189 | |
190 | 190 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
191 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
191 | + if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text'); |
|
192 | 192 | |
193 | 193 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
194 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
194 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
195 | 195 | // 2008. 04. 23 Add a column(blamed count) |
196 | - if(!$oDB->isColumnExists("documents", "blamed_count")) |
|
196 | + if (!$oDB->isColumnExists("documents", "blamed_count")) |
|
197 | 197 | { |
198 | 198 | $oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true); |
199 | 199 | $oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count')); |
200 | 200 | } |
201 | 201 | |
202 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) |
|
202 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) |
|
203 | 203 | { |
204 | 204 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
205 | 205 | } |
206 | 206 | |
207 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
207 | + if (!$oDB->isColumnExists("document_voted_log", "point")) |
|
208 | 208 | $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
209 | 209 | |
210 | 210 | |
211 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
211 | + if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7); |
|
212 | 212 | |
213 | 213 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
214 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
214 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10); |
|
215 | 215 | |
216 | 216 | // 2009. 01. 29 Added a trigger for additional setup |
217 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
217 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
218 | 218 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
219 | 219 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
220 | - if(!$oDB->isColumnExists("documents","lang_code")) |
|
220 | + if (!$oDB->isColumnExists("documents", "lang_code")) |
|
221 | 221 | { |
222 | 222 | $db_info = Context::getDBInfo(); |
223 | - $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); |
|
223 | + $oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code); |
|
224 | 224 | $obj->lang_code = $db_info->lang_type; |
225 | 225 | executeQuery('document.updateDocumentsLangCode', $obj); |
226 | 226 | } |
227 | 227 | // 2009. 03. 11 Check the index in the document_extra_vars table |
228 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
228 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
229 | 229 | { |
230 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
230 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
231 | 231 | } |
232 | 232 | |
233 | - if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
233 | + if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
234 | 234 | { |
235 | 235 | $oDB->dropIndex("document_extra_vars", "unique_module_vars", true); |
236 | 236 | } |
237 | 237 | |
238 | 238 | // 2009. 03. 19: Add a column(eid) |
239 | 239 | // 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column |
240 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) |
|
240 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) |
|
241 | 241 | { |
242 | - $oDB->addColumn("document_extra_keys","eid","varchar",40); |
|
242 | + $oDB->addColumn("document_extra_keys", "eid", "varchar", 40); |
|
243 | 243 | |
244 | 244 | $output = executeQuery('document.getGroupsExtraKeys', $obj); |
245 | - if($output->toBool() && $output->data && count($output->data)) { |
|
246 | - foreach($output->data as $extra_keys) { |
|
245 | + if ($output->toBool() && $output->data && count($output->data)) { |
|
246 | + foreach ($output->data as $extra_keys) { |
|
247 | 247 | $args->module_srl = $extra_keys->module_srl; |
248 | 248 | $args->var_idx = $extra_keys->idx; |
249 | 249 | $args->new_eid = "extra_vars".$extra_keys->idx; |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) |
|
255 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) |
|
256 | 256 | { |
257 | - $oDB->addColumn("document_extra_vars","eid","varchar",40); |
|
257 | + $oDB->addColumn("document_extra_vars", "eid", "varchar", 40); |
|
258 | 258 | $obj->var_idx = '-1,-2'; |
259 | 259 | $output = executeQuery('document.getGroupsExtraVars', $obj); |
260 | - if($output->toBool() && $output->data && count($output->data)) |
|
260 | + if ($output->toBool() && $output->data && count($output->data)) |
|
261 | 261 | { |
262 | - foreach($output->data as $extra_vars) |
|
262 | + foreach ($output->data as $extra_vars) |
|
263 | 263 | { |
264 | 264 | $args->module_srl = $extra_vars->module_srl; |
265 | 265 | $args->var_idx = $extra_vars->idx; |
@@ -270,16 +270,16 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
273 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
273 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
274 | 274 | { |
275 | - $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false); |
|
275 | + $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | //2011. 04. 07 adding description column to document categories |
279 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
279 | + if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0); |
|
280 | 280 | |
281 | 281 | //2011. 05. 23 adding status column to document |
282 | - if(!$oDB->isColumnExists('documents', 'status')) |
|
282 | + if (!$oDB->isColumnExists('documents', 'status')) |
|
283 | 283 | { |
284 | 284 | $oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC'); |
285 | 285 | $args->is_secret = 'Y'; |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | } |
288 | 288 | |
289 | 289 | // 2011. 09. 08 drop column document is_secret |
290 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
290 | + if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
291 | 291 | $oDB->dropColumn('documents', 'is_secret'); |
292 | 292 | |
293 | 293 | //2011. 06. 07 merge column, allow_comment and lock_comment |
294 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
294 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
295 | 295 | { |
296 | 296 | $oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW'); |
297 | 297 | |
@@ -313,23 +313,23 @@ discard block |
||
313 | 313 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
314 | 314 | } |
315 | 315 | |
316 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
316 | + if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
317 | 317 | $oDB->dropColumn('documents', 'allow_comment'); |
318 | 318 | |
319 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
319 | + if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
320 | 320 | $oDB->dropColumn('documents', 'lock_comment'); |
321 | 321 | |
322 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
323 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
322 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) |
|
323 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl", "status")); |
|
324 | 324 | |
325 | 325 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
326 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
326 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
327 | 327 | { |
328 | 328 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'); |
329 | 329 | } |
330 | 330 | |
331 | 331 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
332 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
332 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
333 | 333 | { |
334 | 334 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'); |
335 | 335 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $oModuleController->insertUpdatedLog($version_update_id); |
338 | 338 | } |
339 | 339 | |
340 | - return new BaseObject(0,'success_updated'); |
|
340 | + return new BaseObject(0, 'success_updated'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | function recompileCache() |
348 | 348 | { |
349 | - if(!is_dir('./files/cache/tmp')) |
|
349 | + if (!is_dir('./files/cache/tmp')) |
|
350 | 350 | { |
351 | 351 | FileHandler::makeDir('./files/cache/tmp'); |
352 | 352 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | function getConfigStatus($key) |
378 | 378 | { |
379 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
379 | + if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
380 | 380 | else $this->getDefaultStatus(); |
381 | 381 | } |
382 | 382 | } |