@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | $oModuleModel = getModel('module'); |
35 | 35 | $skin_info = $oModuleModel->loadSkinInfo($path, $skin); |
36 | 36 | |
37 | - for($i=0;$i<count($skin_info->colorset);$i++) |
|
37 | + for ($i = 0; $i < count($skin_info->colorset); $i++) |
|
38 | 38 | { |
39 | 39 | $colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title); |
40 | 40 | $colorset_list[] = $colorset; |
41 | 41 | } |
42 | 42 | |
43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
43 | + if (count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
44 | 44 | $this->add('colorset_list', $colorsets); |
45 | 45 | } |
46 | 46 | |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | function procWidgetGenerateCode() |
51 | 51 | { |
52 | 52 | $widget = Context::get('selected_widget'); |
53 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
54 | - if(!Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
53 | + if (!$widget) return new Object(-1, 'msg_invalid_request'); |
|
54 | + if (!Context::get('skin')) return new Object(-1, Context::getLang('msg_widget_skin_is_null')); |
|
55 | 55 | |
56 | 56 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
57 | 57 | |
58 | - $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute)); |
|
58 | + $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ', $attribute)); |
|
59 | 59 | // Code output |
60 | 60 | $this->add('widget_code', $widget_code); |
61 | 61 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | function procWidgetGenerateCodeInPage() |
67 | 67 | { |
68 | 68 | $widget = Context::get('selected_widget'); |
69 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
69 | + if (!$widget) return new Object(-1, 'msg_invalid_request'); |
|
70 | 70 | |
71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
71 | + if (!in_array($widget, array('widgetBox', 'widgetContent')) && !Context::get('skin')) return new Object(-1, Context::getLang('msg_widget_skin_is_null')); |
|
72 | 72 | |
73 | 73 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
74 | 74 | // Wanted results |
@@ -107,26 +107,26 @@ discard block |
||
107 | 107 | $err = 0; |
108 | 108 | $oLayoutModel = getModel('layout'); |
109 | 109 | $layout_info = $oLayoutModel->getLayout($module_srl); |
110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
110 | + if (!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
111 | 111 | |
112 | 112 | // Destination Information Wanted page module |
113 | 113 | $oModuleModel = getModel('module'); |
114 | 114 | $columnList = array('module_srl', 'module'); |
115 | 115 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
116 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
116 | + if (!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
117 | 117 | |
118 | - if($err > 1) return new Object(-1,'msg_invalid_request'); |
|
118 | + if ($err > 1) return new Object(-1, 'msg_invalid_request'); |
|
119 | 119 | |
120 | 120 | // Check permissions |
121 | 121 | $logged_info = Context::get('logged_info'); |
122 | - if(!$logged_info->member_srl) |
|
122 | + if (!$logged_info->member_srl) |
|
123 | 123 | { |
124 | - return new Object(-1,'msg_not_permitted'); |
|
124 | + return new Object(-1, 'msg_not_permitted'); |
|
125 | 125 | } |
126 | 126 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
127 | - if(!$module_grant->manager) |
|
127 | + if (!$module_grant->manager) |
|
128 | 128 | { |
129 | - return new Object(-1,'msg_not_permitted'); |
|
129 | + return new Object(-1, 'msg_not_permitted'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // Enter post |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $obj->document_srl = $document_srl; |
140 | 140 | |
141 | 141 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
142 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
142 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
143 | 143 | { |
144 | 144 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
145 | 145 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | // Stop when an error occurs |
153 | - if(!$output->toBool()) return $output; |
|
153 | + if (!$output->toBool()) return $output; |
|
154 | 154 | |
155 | 155 | // Return results |
156 | 156 | $this->add('document_srl', $obj->document_srl); |
@@ -169,29 +169,29 @@ discard block |
||
169 | 169 | $oDocumentAdminController = getAdminController('document'); |
170 | 170 | |
171 | 171 | $oDocument = $oDocumentModel->getDocument($document_srl); |
172 | - if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request'); |
|
172 | + if (!$oDocument->isExists()) return new Object(-1, 'msg_invalid_request'); |
|
173 | 173 | $module_srl = $oDocument->get('module_srl'); |
174 | 174 | |
175 | 175 | // Destination Information Wanted page module |
176 | 176 | $oModuleModel = getModel('module'); |
177 | 177 | $columnList = array('module_srl', 'module'); |
178 | 178 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
179 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
179 | + if (!$page_info->module_srl || $page_info->module != 'page') return new Object(-1, 'msg_invalid_request'); |
|
180 | 180 | |
181 | 181 | // Check permissions |
182 | 182 | $logged_info = Context::get('logged_info'); |
183 | - if(!$logged_info->member_srl) |
|
183 | + if (!$logged_info->member_srl) |
|
184 | 184 | { |
185 | - return new Object(-1,'msg_not_permitted'); |
|
185 | + return new Object(-1, 'msg_not_permitted'); |
|
186 | 186 | } |
187 | 187 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
188 | - if(!$module_grant->manager) |
|
188 | + if (!$module_grant->manager) |
|
189 | 189 | { |
190 | - return new Object(-1,'msg_not_permitted'); |
|
190 | + return new Object(-1, 'msg_not_permitted'); |
|
191 | 191 | } |
192 | 192 | |
193 | - $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
|
194 | - if(!$output->toBool()) return $output; |
|
193 | + $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'), 0); |
|
194 | + if (!$output->toBool()) return $output; |
|
195 | 195 | |
196 | 196 | // Return results |
197 | 197 | $copied_srls = $output->get('copied_srls'); |
@@ -210,28 +210,28 @@ discard block |
||
210 | 210 | $oDocumentController = getController('document'); |
211 | 211 | |
212 | 212 | $oDocument = $oDocumentModel->getDocument($document_srl); |
213 | - if(!$oDocument->isExists()) return new Object(); |
|
213 | + if (!$oDocument->isExists()) return new Object(); |
|
214 | 214 | $module_srl = $oDocument->get('module_srl'); |
215 | 215 | |
216 | 216 | // Destination Information Wanted page module |
217 | 217 | $oModuleModel = getModel('module'); |
218 | 218 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
219 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
219 | + if (!$page_info->module_srl || $page_info->module != 'page') return new Object(-1, 'msg_invalid_request'); |
|
220 | 220 | |
221 | 221 | // Check permissions |
222 | 222 | $logged_info = Context::get('logged_info'); |
223 | - if(!$logged_info->member_srl) |
|
223 | + if (!$logged_info->member_srl) |
|
224 | 224 | { |
225 | 225 | return new Object(-1, 'msg_not_permitted'); |
226 | 226 | } |
227 | 227 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
228 | - if(!$module_grant->manager) |
|
228 | + if (!$module_grant->manager) |
|
229 | 229 | { |
230 | 230 | return new Object(-1, 'msg_not_permitted'); |
231 | 231 | } |
232 | 232 | |
233 | 233 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl')); |
234 | - if(!$output->toBool()) return $output; |
|
234 | + if (!$output->toBool()) return $output; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function triggerWidgetCompile(&$content) |
250 | 250 | { |
251 | - if(Context::getResponseMethod()!='HTML') return new Object(); |
|
251 | + if (Context::getResponseMethod() != 'HTML') return new Object(); |
|
252 | 252 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
253 | 253 | return new Object(); |
254 | 254 | } |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | // Check whether to include information about editing |
265 | 265 | $this->javascript_mode = $javascript_mode; |
266 | 266 | // Widget code box change |
267 | - $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content); |
|
267 | + $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content); |
|
268 | 268 | // Widget code information byeogyeong |
269 | - $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content); |
|
269 | + $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this, 'transWidget'), $content); |
|
270 | 270 | |
271 | 271 | return $content; |
272 | 272 | } |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | $oXmlParser = new XmlParser(); |
282 | 282 | $xml_doc = $oXmlParser->parse(trim($buff)); |
283 | 283 | |
284 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
284 | + if ($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
285 | 285 | else $vars = $xml_doc->attrs; |
286 | 286 | |
287 | 287 | $widget = $vars->widget; |
288 | - if(!$widget) return $matches[0]; |
|
288 | + if (!$widget) return $matches[0]; |
|
289 | 289 | unset($vars->widget); |
290 | 290 | |
291 | 291 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function transWidgetBox($matches) |
298 | 298 | { |
299 | - $buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]); |
|
299 | + $buff = preg_replace('/<div><div>(.*)$/i', '</div>', $matches[0]); |
|
300 | 300 | $oXmlParser = new XmlParser(); |
301 | 301 | $xml_doc = $oXmlParser->parse($buff); |
302 | 302 | |
303 | 303 | $vars = $xml_doc->div->attrs; |
304 | 304 | $widget = $vars->widget; |
305 | - if(!$widget) return $matches[0]; |
|
305 | + if (!$widget) return $matches[0]; |
|
306 | 306 | unset($vars->widget); |
307 | 307 | |
308 | 308 | $vars->widgetbox_content = $matches[3]; |
@@ -323,28 +323,28 @@ discard block |
||
323 | 323 | $oXmlParser = new XmlParser(); |
324 | 324 | |
325 | 325 | $cnt = count($matches[1]); |
326 | - for($i=0;$i<$cnt;$i++) |
|
326 | + for ($i = 0; $i < $cnt; $i++) |
|
327 | 327 | { |
328 | 328 | $buff = $matches[0][$i]; |
329 | 329 | $xml_doc = $oXmlParser->parse(trim($buff)); |
330 | 330 | |
331 | 331 | $args = $xml_doc->img->attrs; |
332 | - if(!$args) continue; |
|
332 | + if (!$args) continue; |
|
333 | 333 | // If you are not caching path |
334 | 334 | $widget = $args->widget; |
335 | 335 | $sequence = $args->widget_sequence; |
336 | 336 | $cache = $args->widget_cache; |
337 | - if(!$sequence || !$cache) continue; |
|
337 | + if (!$sequence || !$cache) continue; |
|
338 | 338 | |
339 | - if(count($args)) |
|
339 | + if (count($args)) |
|
340 | 340 | { |
341 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
341 | + foreach ($args as $k => $v) $args->{$k} = urldecode($v); |
|
342 | 342 | } |
343 | 343 | // If the cache file for each language widget regeneration |
344 | - foreach($lang_list as $lang_type => $val) |
|
344 | + foreach ($lang_list as $lang_type => $val) |
|
345 | 345 | { |
346 | 346 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
347 | - if(!file_exists($cache_file)) continue; |
|
347 | + if (!file_exists($cache_file)) continue; |
|
348 | 348 | $this->getCache($widget, $args, $lang_type, true); |
349 | 349 | } |
350 | 350 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
357 | 357 | { |
358 | 358 | // If the specified language specifies the current language |
359 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
359 | + if (!$lang_type) $lang_type = Context::getLangType(); |
|
360 | 360 | // widget, the cache number and cache values are set |
361 | 361 | $widget_sequence = $args->widget_sequence; |
362 | 362 | $widget_cache = $args->widget_cache; |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | /** |
365 | 365 | * Even if the cache number and value of the cache and return it to extract data |
366 | 366 | */ |
367 | - if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
367 | + if (!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
368 | 368 | { |
369 | 369 | $oWidget = $this->getWidgetObject($widget); |
370 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
370 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
371 | 371 | |
372 | 372 | $widget_content = $oWidget->proc($args); |
373 | 373 | $oModuleController = getController('module'); |
@@ -376,15 +376,15 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | $oCacheHandler = CacheHandler::getInstance('template'); |
379 | - if($oCacheHandler->isSupport()) |
|
379 | + if ($oCacheHandler->isSupport()) |
|
380 | 380 | { |
381 | - $key = 'widget_cache:' . $widget_sequence; |
|
381 | + $key = 'widget_cache:'.$widget_sequence; |
|
382 | 382 | |
383 | 383 | $cache_body = $oCacheHandler->get($key); |
384 | 384 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
385 | 385 | } |
386 | 386 | |
387 | - if($cache_body) |
|
387 | + if ($cache_body) |
|
388 | 388 | { |
389 | 389 | return $cache_body; |
390 | 390 | } |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | // Wanted cache file |
398 | 398 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type); |
399 | 399 | // If the file exists in the cache, the file validation |
400 | - if(!$ignore_cache && file_exists($cache_file)) |
|
400 | + if (!$ignore_cache && file_exists($cache_file)) |
|
401 | 401 | { |
402 | 402 | $filemtime = filemtime($cache_file); |
403 | 403 | // Should be modified compared to the time of the cache or in the future if creating more than widget.controller.php file a return value of the cache |
404 | - if($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
404 | + if ($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
405 | 405 | { |
406 | 406 | $cache_body = FileHandler::readFile($cache_file); |
407 | 407 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
@@ -410,18 +410,18 @@ discard block |
||
410 | 410 | } |
411 | 411 | } |
412 | 412 | // cache update and cache renewal of the file mtime |
413 | - if(!$oCacheHandler->isSupport()) |
|
413 | + if (!$oCacheHandler->isSupport()) |
|
414 | 414 | { |
415 | 415 | touch($cache_file); |
416 | 416 | } |
417 | 417 | |
418 | 418 | $oWidget = $this->getWidgetObject($widget); |
419 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
419 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
420 | 420 | |
421 | 421 | $widget_content = $oWidget->proc($args); |
422 | 422 | $oModuleController = getController('module'); |
423 | 423 | $oModuleController->replaceDefinedLangCode($widget_content); |
424 | - if($oCacheHandler->isSupport()) |
|
424 | + if ($oCacheHandler->isSupport()) |
|
425 | 425 | { |
426 | 426 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
427 | 427 | } |
@@ -443,16 +443,16 @@ discard block |
||
443 | 443 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
444 | 444 | { |
445 | 445 | // Save for debug run-time widget |
446 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
446 | + if (__DEBUG__ == 3) $start = getMicroTime(); |
|
447 | 447 | $before = microtime(true); |
448 | 448 | // urldecode the value of args haejum |
449 | 449 | $object_vars = get_object_vars($args); |
450 | - if(count($object_vars)) |
|
450 | + if (count($object_vars)) |
|
451 | 451 | { |
452 | - foreach($object_vars as $key => $val) |
|
452 | + foreach ($object_vars as $key => $val) |
|
453 | 453 | { |
454 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
455 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
454 | + if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) continue; |
|
455 | + if ($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
@@ -461,14 +461,14 @@ discard block |
||
461 | 461 | * Widgets widgetContent/widgetBox Wanted If you are not content |
462 | 462 | */ |
463 | 463 | $widget_content = ''; |
464 | - if($widget != 'widgetContent' && $widget != 'widgetBox') |
|
464 | + if ($widget != 'widgetContent' && $widget != 'widgetBox') |
|
465 | 465 | { |
466 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
466 | + if (!is_dir(sprintf(_XE_PATH_.'widgets/%s/', $widget))) return; |
|
467 | 467 | // Hold the contents of the widget parameter |
468 | 468 | $widget_content = $this->getCache($widget, $args); |
469 | 469 | } |
470 | 470 | |
471 | - if($widget == 'widgetBox') |
|
471 | + if ($widget == 'widgetBox') |
|
472 | 472 | { |
473 | 473 | $widgetbox_content = $args->widgetbox_content; |
474 | 474 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * Wanted specified by the administrator of the widget style |
478 | 478 | */ |
479 | 479 | // Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed |
480 | - $style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style); |
|
480 | + $style = preg_replace('/url\((.+)(\/?)none\)/is', '', $args->style); |
|
481 | 481 | // Find a style statement that based on the internal margin dropping pre-change |
482 | 482 | $widget_padding_left = $args->widget_padding_left; |
483 | 483 | $widget_padding_right = $args->widget_padding_right; |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | $widget_content_body = ''; |
494 | 494 | $widget_content_footer = ''; |
495 | 495 | // If general call is given on page styles should return immediately dreamin ' |
496 | - if(!$javascript_mode) |
|
496 | + if (!$javascript_mode) |
|
497 | 497 | { |
498 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
499 | - switch($widget) |
|
498 | + if ($args->id) $args->id = ' id="'.$args->id.'" '; |
|
499 | + switch ($widget) |
|
500 | 500 | { |
501 | 501 | // If a direct orthogonal addition information |
502 | 502 | case 'widgetContent' : |
503 | - if($args->document_srl) |
|
503 | + if ($args->document_srl) |
|
504 | 504 | { |
505 | 505 | $oDocumentModel = getModel('document'); |
506 | 506 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
507 | - $body = $oDocument->getContent(false,false,false, false); |
|
507 | + $body = $oDocument->getContent(false, false, false, false); |
|
508 | 508 | } |
509 | 509 | else |
510 | 510 | { |
@@ -514,21 +514,21 @@ discard block |
||
514 | 514 | $oEditorController = getController('editor'); |
515 | 515 | $body = $oEditorController->transComponent($body); |
516 | 516 | |
517 | - $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
517 | + $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper '.$args->css_class.'" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
518 | 518 | $widget_content_body = $body; |
519 | 519 | $widget_content_footer = '</div></div>'; |
520 | 520 | |
521 | 521 | break; |
522 | 522 | // If the widget box; it could |
523 | 523 | case 'widgetBox' : |
524 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
524 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
525 | 525 | $widget_content_body = $widgetbox_content; |
526 | 526 | |
527 | 527 | break; |
528 | 528 | // If the General wijetil |
529 | 529 | default : |
530 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">',$args->id,$style); |
|
531 | - $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content); |
|
530 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s">', $args->id, $style); |
|
531 | + $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content); |
|
532 | 532 | $widget_content_footer = '</div>'; |
533 | 533 | break; |
534 | 534 | } |
@@ -536,15 +536,15 @@ discard block |
||
536 | 536 | } |
537 | 537 | else |
538 | 538 | { |
539 | - switch($widget) |
|
539 | + switch ($widget) |
|
540 | 540 | { |
541 | 541 | // If a direct orthogonal addition information |
542 | 542 | case 'widgetContent' : |
543 | - if($args->document_srl) |
|
543 | + if ($args->document_srl) |
|
544 | 544 | { |
545 | 545 | $oDocumentModel = getModel('document'); |
546 | 546 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
547 | - $body = $oDocument->getContent(false,false,false); |
|
547 | + $body = $oDocument->getContent(false, false, false); |
|
548 | 548 | } |
549 | 549 | else |
550 | 550 | { |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | } |
553 | 553 | // by args |
554 | 554 | $attribute = array(); |
555 | - if($args) |
|
555 | + if ($args) |
|
556 | 556 | { |
557 | - foreach($args as $key => $val) |
|
557 | + foreach ($args as $key => $val) |
|
558 | 558 | { |
559 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
560 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
559 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
560 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
561 | 561 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
562 | 562 | } |
563 | 563 | } |
@@ -565,44 +565,44 @@ discard block |
||
565 | 565 | $oWidgetController = getController('widget'); |
566 | 566 | |
567 | 567 | $widget_content_header = sprintf( |
568 | - '<div class="xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
568 | + '<div class="xe_content widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
569 | 569 | '<div class="widgetResize"></div>'. |
570 | 570 | '<div class="widgetResizeLeft"></div>'. |
571 | 571 | '<div class="widgetBorder">'. |
572 | - '<div style="%s">',$args->widgetstyle, |
|
572 | + '<div style="%s">', $args->widgetstyle, |
|
573 | 573 | $style, |
574 | 574 | $args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom, |
575 | 575 | $args->document_srl, |
576 | - implode(' ',$attribute), |
|
576 | + implode(' ', $attribute), |
|
577 | 577 | $inner_style); |
578 | 578 | |
579 | 579 | $widget_content_body = $body; |
580 | 580 | $widget_content_footer = sprintf('</div>'. |
581 | 581 | '</div>'. |
582 | 582 | '<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'. |
583 | - '</div>',base64_encode($body)); |
|
583 | + '</div>', base64_encode($body)); |
|
584 | 584 | |
585 | 585 | break; |
586 | 586 | // If the widget box; it could |
587 | 587 | case 'widgetBox' : |
588 | 588 | // by args |
589 | 589 | $attribute = array(); |
590 | - if($args) |
|
590 | + if ($args) |
|
591 | 591 | { |
592 | - foreach($args as $key => $val) |
|
592 | + foreach ($args as $key => $val) |
|
593 | 593 | { |
594 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
595 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
596 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
594 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
595 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
596 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
597 | 597 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
598 | 598 | } |
599 | 599 | } |
600 | 600 | |
601 | 601 | $widget_content_header = sprintf( |
602 | - '<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
602 | + '<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
603 | 603 | '<div class="widgetBoxResize"></div>'. |
604 | 604 | '<div class="widgetBoxResizeLeft"></div>'. |
605 | - '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style); |
|
605 | + '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style); |
|
606 | 606 | |
607 | 607 | $widget_content_body = $widgetbox_content; |
608 | 608 | |
@@ -611,26 +611,26 @@ discard block |
||
611 | 611 | default : |
612 | 612 | // by args |
613 | 613 | $attribute = array(); |
614 | - if($args) |
|
614 | + if ($args) |
|
615 | 615 | { |
616 | - $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
|
617 | - foreach($args as $key => $val) |
|
616 | + $allowed_key = array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget'); |
|
617 | + foreach ($args as $key => $val) |
|
618 | 618 | { |
619 | - if(in_array($key, $allowed_key)) continue; |
|
620 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
621 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
619 | + if (in_array($key, $allowed_key)) continue; |
|
620 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
621 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
622 | 622 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
626 | - $widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
626 | + $widget_content_header = sprintf('<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
627 | 627 | '<div class="widgetResize"></div>'. |
628 | 628 | '<div class="widgetResizeLeft"></div>'. |
629 | - '<div class="widgetBorder">',$args->widgetstyle,$style, |
|
629 | + '<div class="widgetBorder">', $args->widgetstyle, $style, |
|
630 | 630 | $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, |
631 | - $widget, implode(' ',$attribute)); |
|
631 | + $widget, implode(' ', $attribute)); |
|
632 | 632 | |
633 | - $widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content); |
|
633 | + $widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style, $widget_content); |
|
634 | 634 | |
635 | 635 | $widget_content_footer = '</div></div>'; |
636 | 636 | |
@@ -638,11 +638,11 @@ discard block |
||
638 | 638 | } |
639 | 639 | } |
640 | 640 | // Compile the widget style. |
641 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
641 | + if ($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode); |
|
642 | 642 | |
643 | - $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
|
643 | + $output = $widget_content_header.$widget_content_body.$widget_content_footer; |
|
644 | 644 | // Debug widget creation time information added to the results |
645 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
645 | + if (__DEBUG__ == 3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
646 | 646 | |
647 | 647 | $after = microtime(true); |
648 | 648 | |
@@ -663,32 +663,32 @@ discard block |
||
663 | 663 | */ |
664 | 664 | function getWidgetObject($widget) |
665 | 665 | { |
666 | - if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
666 | + if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
667 | 667 | { |
668 | 668 | return Context::getLang('msg_invalid_request'); |
669 | 669 | } |
670 | 670 | |
671 | - if(!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
671 | + if (!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
672 | 672 | { |
673 | 673 | // Finding the location of a widget |
674 | 674 | $oWidgetModel = getModel('widget'); |
675 | 675 | $path = $oWidgetModel->getWidgetPath($widget); |
676 | 676 | // If you do not find the class file error output widget (html output) |
677 | 677 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
678 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
678 | + if (!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
679 | 679 | // Widget classes include |
680 | 680 | require_once($class_file); |
681 | 681 | |
682 | 682 | // Creating Objects |
683 | - if(!class_exists($widget, false)) |
|
683 | + if (!class_exists($widget, false)) |
|
684 | 684 | { |
685 | 685 | return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
686 | 686 | } |
687 | 687 | |
688 | 688 | $oWidget = new $widget(); |
689 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
689 | + if (!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
690 | 690 | |
691 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
691 | + if (!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
692 | 692 | |
693 | 693 | $oWidget->widget_path = $path; |
694 | 694 | |
@@ -697,29 +697,29 @@ discard block |
||
697 | 697 | return $GLOBALS['_xe_loaded_widgets_'][$widget]; |
698 | 698 | } |
699 | 699 | |
700 | - function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
|
700 | + function compileWidgetStyle($widgetStyle, $widget, $widget_content_body, $args, $javascript_mode) |
|
701 | 701 | { |
702 | - if(!$widgetStyle) return $widget_content_body; |
|
702 | + if (!$widgetStyle) return $widget_content_body; |
|
703 | 703 | |
704 | 704 | $oWidgetModel = getModel('widget'); |
705 | 705 | // Bring extra_var widget style tie |
706 | 706 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
707 | - if(!$widgetstyle_info) return $widget_content_body; |
|
707 | + if (!$widgetstyle_info) return $widget_content_body; |
|
708 | 708 | |
709 | 709 | $widgetstyle_extra_var = new stdClass(); |
710 | 710 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
711 | - if(count($widgetstyle_extra_var_key['extra_var'])) |
|
711 | + if (count($widgetstyle_extra_var_key['extra_var'])) |
|
712 | 712 | { |
713 | - foreach($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
713 | + foreach ($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
714 | 714 | { |
715 | - $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
715 | + $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
716 | 716 | } |
717 | 717 | } |
718 | 718 | Context::set('widgetstyle_extra_var', $widgetstyle_extra_var); |
719 | 719 | // #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated |
720 | 720 | Context::set('widgetstyle_extar_var', $widgetstyle_extra_var); |
721 | 721 | |
722 | - if($javascript_mode && $widget=='widgetBox') |
|
722 | + if ($javascript_mode && $widget == 'widgetBox') |
|
723 | 723 | { |
724 | 724 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
725 | 725 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | $oWidgetModel = getModel('widget'); |
744 | 744 | $widget_info = $oWidgetModel->getWidgetInfo($widget); |
745 | 745 | |
746 | - if(!$vars) |
|
746 | + if (!$vars) |
|
747 | 747 | { |
748 | 748 | $vars = new stdClass(); |
749 | 749 | } |
@@ -754,31 +754,31 @@ discard block |
||
754 | 754 | |
755 | 755 | $vars->skin = trim($request_vars->skin); |
756 | 756 | $vars->colorset = trim($request_vars->colorset); |
757 | - $vars->widget_sequence = (int)($request_vars->widget_sequence); |
|
758 | - $vars->widget_cache = (int)($request_vars->widget_cache); |
|
757 | + $vars->widget_sequence = (int) ($request_vars->widget_sequence); |
|
758 | + $vars->widget_cache = (int) ($request_vars->widget_cache); |
|
759 | 759 | $vars->style = trim($request_vars->style); |
760 | 760 | $vars->widget_padding_left = trim($request_vars->widget_padding_left); |
761 | 761 | $vars->widget_padding_right = trim($request_vars->widget_padding_right); |
762 | 762 | $vars->widget_padding_top = trim($request_vars->widget_padding_top); |
763 | 763 | $vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom); |
764 | - $vars->document_srl= trim($request_vars->document_srl); |
|
764 | + $vars->document_srl = trim($request_vars->document_srl); |
|
765 | 765 | |
766 | - if(count($widget_info->extra_var)) |
|
766 | + if (count($widget_info->extra_var)) |
|
767 | 767 | { |
768 | - foreach($widget_info->extra_var as $key=>$val) |
|
768 | + foreach ($widget_info->extra_var as $key=>$val) |
|
769 | 769 | { |
770 | 770 | $vars->{$key} = trim($request_vars->{$key}); |
771 | 771 | } |
772 | 772 | } |
773 | 773 | // If the widget style |
774 | - if($request_vars->widgetstyle) |
|
774 | + if ($request_vars->widgetstyle) |
|
775 | 775 | { |
776 | 776 | $widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle); |
777 | - if(count($widgetStyle_info->extra_var)) |
|
777 | + if (count($widgetStyle_info->extra_var)) |
|
778 | 778 | { |
779 | - foreach($widgetStyle_info->extra_var as $key=>$val) |
|
779 | + foreach ($widgetStyle_info->extra_var as $key=>$val) |
|
780 | 780 | { |
781 | - if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea') |
|
781 | + if ($val->type == 'color' || $val->type == 'text' || $val->type == 'select' || $val->type == 'filebox' || $val->type == 'textarea') |
|
782 | 782 | { |
783 | 783 | $vars->{$key} = trim($request_vars->{$key}); |
784 | 784 | } |
@@ -786,23 +786,23 @@ discard block |
||
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
789 | - if($vars->widget_sequence) |
|
789 | + if ($vars->widget_sequence) |
|
790 | 790 | { |
791 | 791 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $vars->widget_sequence, Context::getLangType()); |
792 | 792 | FileHandler::removeFile($cache_file); |
793 | 793 | } |
794 | 794 | |
795 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
795 | + if ($vars->widget_cache > 0) $vars->widget_sequence = getNextSequence(); |
|
796 | 796 | |
797 | 797 | $attribute = array(); |
798 | - foreach($vars as $key => $val) |
|
798 | + foreach ($vars as $key => $val) |
|
799 | 799 | { |
800 | - if(!$val) |
|
800 | + if (!$val) |
|
801 | 801 | { |
802 | 802 | unset($vars->{$key}); |
803 | 803 | continue; |
804 | 804 | } |
805 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
805 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
806 | 806 | $vars->{$key} = Context::convertEncodingStr($val); |
807 | 807 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
808 | 808 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | $colorset_list[] = $colorset; |
41 | 41 | } |
42 | 42 | |
43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
43 | + if(count($colorset_list)) { |
|
44 | + $colorsets = implode("\n", $colorset_list); |
|
45 | + } |
|
44 | 46 | $this->add('colorset_list', $colorsets); |
45 | 47 | } |
46 | 48 | |
@@ -50,8 +52,12 @@ discard block |
||
50 | 52 | function procWidgetGenerateCode() |
51 | 53 | { |
52 | 54 | $widget = Context::get('selected_widget'); |
53 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
54 | - if(!Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
55 | + if(!$widget) { |
|
56 | + return new Object(-1,'msg_invalid_request'); |
|
57 | + } |
|
58 | + if(!Context::get('skin')) { |
|
59 | + return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
60 | + } |
|
55 | 61 | |
56 | 62 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
57 | 63 | |
@@ -66,9 +72,13 @@ discard block |
||
66 | 72 | function procWidgetGenerateCodeInPage() |
67 | 73 | { |
68 | 74 | $widget = Context::get('selected_widget'); |
69 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
75 | + if(!$widget) { |
|
76 | + return new Object(-1,'msg_invalid_request'); |
|
77 | + } |
|
70 | 78 | |
71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
79 | + if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) { |
|
80 | + return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
81 | + } |
|
72 | 82 | |
73 | 83 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
74 | 84 | // Wanted results |
@@ -107,15 +117,21 @@ discard block |
||
107 | 117 | $err = 0; |
108 | 118 | $oLayoutModel = getModel('layout'); |
109 | 119 | $layout_info = $oLayoutModel->getLayout($module_srl); |
110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
120 | + if(!$layout_info || $layout_info->type != 'faceoff') { |
|
121 | + $err++; |
|
122 | + } |
|
111 | 123 | |
112 | 124 | // Destination Information Wanted page module |
113 | 125 | $oModuleModel = getModel('module'); |
114 | 126 | $columnList = array('module_srl', 'module'); |
115 | 127 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
116 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
128 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
129 | + $err++; |
|
130 | + } |
|
117 | 131 | |
118 | - if($err > 1) return new Object(-1,'msg_invalid_request'); |
|
132 | + if($err > 1) { |
|
133 | + return new Object(-1,'msg_invalid_request'); |
|
134 | + } |
|
119 | 135 | |
120 | 136 | // Check permissions |
121 | 137 | $logged_info = Context::get('logged_info'); |
@@ -142,15 +158,16 @@ discard block |
||
142 | 158 | if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
143 | 159 | { |
144 | 160 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
145 | - } |
|
146 | - else |
|
161 | + } else |
|
147 | 162 | { |
148 | 163 | $output = $oDocumentController->insertDocument($obj); |
149 | 164 | $obj->document_srl = $output->get('document_srl'); |
150 | 165 | } |
151 | 166 | |
152 | 167 | // Stop when an error occurs |
153 | - if(!$output->toBool()) return $output; |
|
168 | + if(!$output->toBool()) { |
|
169 | + return $output; |
|
170 | + } |
|
154 | 171 | |
155 | 172 | // Return results |
156 | 173 | $this->add('document_srl', $obj->document_srl); |
@@ -169,14 +186,18 @@ discard block |
||
169 | 186 | $oDocumentAdminController = getAdminController('document'); |
170 | 187 | |
171 | 188 | $oDocument = $oDocumentModel->getDocument($document_srl); |
172 | - if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request'); |
|
189 | + if(!$oDocument->isExists()) { |
|
190 | + return new Object(-1,'msg_invalid_request'); |
|
191 | + } |
|
173 | 192 | $module_srl = $oDocument->get('module_srl'); |
174 | 193 | |
175 | 194 | // Destination Information Wanted page module |
176 | 195 | $oModuleModel = getModel('module'); |
177 | 196 | $columnList = array('module_srl', 'module'); |
178 | 197 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
179 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
198 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
199 | + return new Object(-1,'msg_invalid_request'); |
|
200 | + } |
|
180 | 201 | |
181 | 202 | // Check permissions |
182 | 203 | $logged_info = Context::get('logged_info'); |
@@ -191,7 +212,9 @@ discard block |
||
191 | 212 | } |
192 | 213 | |
193 | 214 | $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
194 | - if(!$output->toBool()) return $output; |
|
215 | + if(!$output->toBool()) { |
|
216 | + return $output; |
|
217 | + } |
|
195 | 218 | |
196 | 219 | // Return results |
197 | 220 | $copied_srls = $output->get('copied_srls'); |
@@ -210,13 +233,17 @@ discard block |
||
210 | 233 | $oDocumentController = getController('document'); |
211 | 234 | |
212 | 235 | $oDocument = $oDocumentModel->getDocument($document_srl); |
213 | - if(!$oDocument->isExists()) return new Object(); |
|
236 | + if(!$oDocument->isExists()) { |
|
237 | + return new Object(); |
|
238 | + } |
|
214 | 239 | $module_srl = $oDocument->get('module_srl'); |
215 | 240 | |
216 | 241 | // Destination Information Wanted page module |
217 | 242 | $oModuleModel = getModel('module'); |
218 | 243 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
219 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
244 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
245 | + return new Object(-1,'msg_invalid_request'); |
|
246 | + } |
|
220 | 247 | |
221 | 248 | // Check permissions |
222 | 249 | $logged_info = Context::get('logged_info'); |
@@ -231,7 +258,9 @@ discard block |
||
231 | 258 | } |
232 | 259 | |
233 | 260 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl')); |
234 | - if(!$output->toBool()) return $output; |
|
261 | + if(!$output->toBool()) { |
|
262 | + return $output; |
|
263 | + } |
|
235 | 264 | } |
236 | 265 | |
237 | 266 | /** |
@@ -248,7 +277,9 @@ discard block |
||
248 | 277 | */ |
249 | 278 | function triggerWidgetCompile(&$content) |
250 | 279 | { |
251 | - if(Context::getResponseMethod()!='HTML') return new Object(); |
|
280 | + if(Context::getResponseMethod()!='HTML') { |
|
281 | + return new Object(); |
|
282 | + } |
|
252 | 283 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
253 | 284 | return new Object(); |
254 | 285 | } |
@@ -281,11 +312,16 @@ discard block |
||
281 | 312 | $oXmlParser = new XmlParser(); |
282 | 313 | $xml_doc = $oXmlParser->parse(trim($buff)); |
283 | 314 | |
284 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
285 | - else $vars = $xml_doc->attrs; |
|
315 | + if($xml_doc->img) { |
|
316 | + $vars = $xml_doc->img->attrs; |
|
317 | + } else { |
|
318 | + $vars = $xml_doc->attrs; |
|
319 | + } |
|
286 | 320 | |
287 | 321 | $widget = $vars->widget; |
288 | - if(!$widget) return $matches[0]; |
|
322 | + if(!$widget) { |
|
323 | + return $matches[0]; |
|
324 | + } |
|
289 | 325 | unset($vars->widget); |
290 | 326 | |
291 | 327 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -302,7 +338,9 @@ discard block |
||
302 | 338 | |
303 | 339 | $vars = $xml_doc->div->attrs; |
304 | 340 | $widget = $vars->widget; |
305 | - if(!$widget) return $matches[0]; |
|
341 | + if(!$widget) { |
|
342 | + return $matches[0]; |
|
343 | + } |
|
306 | 344 | unset($vars->widget); |
307 | 345 | |
308 | 346 | $vars->widgetbox_content = $matches[3]; |
@@ -329,22 +367,30 @@ discard block |
||
329 | 367 | $xml_doc = $oXmlParser->parse(trim($buff)); |
330 | 368 | |
331 | 369 | $args = $xml_doc->img->attrs; |
332 | - if(!$args) continue; |
|
370 | + if(!$args) { |
|
371 | + continue; |
|
372 | + } |
|
333 | 373 | // If you are not caching path |
334 | 374 | $widget = $args->widget; |
335 | 375 | $sequence = $args->widget_sequence; |
336 | 376 | $cache = $args->widget_cache; |
337 | - if(!$sequence || !$cache) continue; |
|
377 | + if(!$sequence || !$cache) { |
|
378 | + continue; |
|
379 | + } |
|
338 | 380 | |
339 | 381 | if(count($args)) |
340 | 382 | { |
341 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
383 | + foreach($args as $k => $v) { |
|
384 | + $args->{$k} = urldecode($v); |
|
385 | + } |
|
342 | 386 | } |
343 | 387 | // If the cache file for each language widget regeneration |
344 | 388 | foreach($lang_list as $lang_type => $val) |
345 | 389 | { |
346 | 390 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
347 | - if(!file_exists($cache_file)) continue; |
|
391 | + if(!file_exists($cache_file)) { |
|
392 | + continue; |
|
393 | + } |
|
348 | 394 | $this->getCache($widget, $args, $lang_type, true); |
349 | 395 | } |
350 | 396 | } |
@@ -356,7 +402,9 @@ discard block |
||
356 | 402 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
357 | 403 | { |
358 | 404 | // If the specified language specifies the current language |
359 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
405 | + if(!$lang_type) { |
|
406 | + $lang_type = Context::getLangType(); |
|
407 | + } |
|
360 | 408 | // widget, the cache number and cache values are set |
361 | 409 | $widget_sequence = $args->widget_sequence; |
362 | 410 | $widget_cache = $args->widget_cache; |
@@ -367,7 +415,9 @@ discard block |
||
367 | 415 | if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
368 | 416 | { |
369 | 417 | $oWidget = $this->getWidgetObject($widget); |
370 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
418 | + if(!$oWidget || !method_exists($oWidget, 'proc')) { |
|
419 | + return; |
|
420 | + } |
|
371 | 421 | |
372 | 422 | $widget_content = $oWidget->proc($args); |
373 | 423 | $oModuleController = getController('module'); |
@@ -387,8 +437,7 @@ discard block |
||
387 | 437 | if($cache_body) |
388 | 438 | { |
389 | 439 | return $cache_body; |
390 | - } |
|
391 | - else |
|
440 | + } else |
|
392 | 441 | { |
393 | 442 | /** |
394 | 443 | * Cache number and cache values are set so that the cache file should call |
@@ -416,7 +465,9 @@ discard block |
||
416 | 465 | } |
417 | 466 | |
418 | 467 | $oWidget = $this->getWidgetObject($widget); |
419 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
468 | + if(!$oWidget || !method_exists($oWidget,'proc')) { |
|
469 | + return; |
|
470 | + } |
|
420 | 471 | |
421 | 472 | $widget_content = $oWidget->proc($args); |
422 | 473 | $oModuleController = getController('module'); |
@@ -424,8 +475,7 @@ discard block |
||
424 | 475 | if($oCacheHandler->isSupport()) |
425 | 476 | { |
426 | 477 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
427 | - } |
|
428 | - else |
|
478 | + } else |
|
429 | 479 | { |
430 | 480 | FileHandler::writeFile($cache_file, $widget_content); |
431 | 481 | } |
@@ -443,7 +493,9 @@ discard block |
||
443 | 493 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
444 | 494 | { |
445 | 495 | // Save for debug run-time widget |
446 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
496 | + if(__DEBUG__==3) { |
|
497 | + $start = getMicroTime(); |
|
498 | + } |
|
447 | 499 | $before = microtime(true); |
448 | 500 | // urldecode the value of args haejum |
449 | 501 | $object_vars = get_object_vars($args); |
@@ -451,8 +503,12 @@ discard block |
||
451 | 503 | { |
452 | 504 | foreach($object_vars as $key => $val) |
453 | 505 | { |
454 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
455 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
506 | + if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) { |
|
507 | + continue; |
|
508 | + } |
|
509 | + if($escaped) { |
|
510 | + $args->{$key} = utf8RawUrlDecode($val); |
|
511 | + } |
|
456 | 512 | } |
457 | 513 | } |
458 | 514 | |
@@ -463,7 +519,9 @@ discard block |
||
463 | 519 | $widget_content = ''; |
464 | 520 | if($widget != 'widgetContent' && $widget != 'widgetBox') |
465 | 521 | { |
466 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
522 | + if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) { |
|
523 | + return; |
|
524 | + } |
|
467 | 525 | // Hold the contents of the widget parameter |
468 | 526 | $widget_content = $this->getCache($widget, $args); |
469 | 527 | } |
@@ -495,7 +553,9 @@ discard block |
||
495 | 553 | // If general call is given on page styles should return immediately dreamin ' |
496 | 554 | if(!$javascript_mode) |
497 | 555 | { |
498 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
556 | + if($args->id) { |
|
557 | + $args->id = ' id="'.$args->id.'" '; |
|
558 | + } |
|
499 | 559 | switch($widget) |
500 | 560 | { |
501 | 561 | // If a direct orthogonal addition information |
@@ -505,8 +565,7 @@ discard block |
||
505 | 565 | $oDocumentModel = getModel('document'); |
506 | 566 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
507 | 567 | $body = $oDocument->getContent(false,false,false, false); |
508 | - } |
|
509 | - else |
|
568 | + } else |
|
510 | 569 | { |
511 | 570 | $body = base64_decode($args->body); |
512 | 571 | } |
@@ -533,8 +592,7 @@ discard block |
||
533 | 592 | break; |
534 | 593 | } |
535 | 594 | // Edit page is called when a widget if you add the code for handling |
536 | - } |
|
537 | - else |
|
595 | + } else |
|
538 | 596 | { |
539 | 597 | switch($widget) |
540 | 598 | { |
@@ -545,8 +603,7 @@ discard block |
||
545 | 603 | $oDocumentModel = getModel('document'); |
546 | 604 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
547 | 605 | $body = $oDocument->getContent(false,false,false); |
548 | - } |
|
549 | - else |
|
606 | + } else |
|
550 | 607 | { |
551 | 608 | $body = base64_decode($args->body); |
552 | 609 | } |
@@ -556,8 +613,12 @@ discard block |
||
556 | 613 | { |
557 | 614 | foreach($args as $key => $val) |
558 | 615 | { |
559 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
560 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
616 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
617 | + continue; |
|
618 | + } |
|
619 | + if(strpos($val,'|@|')>0) { |
|
620 | + $val = str_replace('|@|',',',$val); |
|
621 | + } |
|
561 | 622 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
562 | 623 | } |
563 | 624 | } |
@@ -591,9 +652,15 @@ discard block |
||
591 | 652 | { |
592 | 653 | foreach($args as $key => $val) |
593 | 654 | { |
594 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
595 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
596 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
655 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
656 | + continue; |
|
657 | + } |
|
658 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
659 | + continue; |
|
660 | + } |
|
661 | + if(strpos($val,'|@|')>0) { |
|
662 | + $val = str_replace('|@|',',',$val); |
|
663 | + } |
|
597 | 664 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
598 | 665 | } |
599 | 666 | } |
@@ -616,9 +683,15 @@ discard block |
||
616 | 683 | $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
617 | 684 | foreach($args as $key => $val) |
618 | 685 | { |
619 | - if(in_array($key, $allowed_key)) continue; |
|
620 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
621 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
686 | + if(in_array($key, $allowed_key)) { |
|
687 | + continue; |
|
688 | + } |
|
689 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
690 | + continue; |
|
691 | + } |
|
692 | + if(strpos($val,'|@|')>0) { |
|
693 | + $val = str_replace('|@|',',',$val); |
|
694 | + } |
|
622 | 695 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
623 | 696 | } |
624 | 697 | } |
@@ -638,11 +711,15 @@ discard block |
||
638 | 711 | } |
639 | 712 | } |
640 | 713 | // Compile the widget style. |
641 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
714 | + if($args->widgetstyle) { |
|
715 | + $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
716 | + } |
|
642 | 717 | |
643 | 718 | $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
644 | 719 | // Debug widget creation time information added to the results |
645 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
720 | + if(__DEBUG__==3) { |
|
721 | + $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
722 | + } |
|
646 | 723 | |
647 | 724 | $after = microtime(true); |
648 | 725 | |
@@ -675,7 +752,9 @@ discard block |
||
675 | 752 | $path = $oWidgetModel->getWidgetPath($widget); |
676 | 753 | // If you do not find the class file error output widget (html output) |
677 | 754 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
678 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
755 | + if(!file_exists($class_file)) { |
|
756 | + return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
757 | + } |
|
679 | 758 | // Widget classes include |
680 | 759 | require_once($class_file); |
681 | 760 | |
@@ -686,9 +765,13 @@ discard block |
||
686 | 765 | } |
687 | 766 | |
688 | 767 | $oWidget = new $widget(); |
689 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
768 | + if(!is_object($oWidget)) { |
|
769 | + return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
770 | + } |
|
690 | 771 | |
691 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
772 | + if(!method_exists($oWidget, 'proc')) { |
|
773 | + return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
774 | + } |
|
692 | 775 | |
693 | 776 | $oWidget->widget_path = $path; |
694 | 777 | |
@@ -699,12 +782,16 @@ discard block |
||
699 | 782 | |
700 | 783 | function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
701 | 784 | { |
702 | - if(!$widgetStyle) return $widget_content_body; |
|
785 | + if(!$widgetStyle) { |
|
786 | + return $widget_content_body; |
|
787 | + } |
|
703 | 788 | |
704 | 789 | $oWidgetModel = getModel('widget'); |
705 | 790 | // Bring extra_var widget style tie |
706 | 791 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
707 | - if(!$widgetstyle_info) return $widget_content_body; |
|
792 | + if(!$widgetstyle_info) { |
|
793 | + return $widget_content_body; |
|
794 | + } |
|
708 | 795 | |
709 | 796 | $widgetstyle_extra_var = new stdClass(); |
710 | 797 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
@@ -722,8 +809,7 @@ discard block |
||
722 | 809 | if($javascript_mode && $widget=='widgetBox') |
723 | 810 | { |
724 | 811 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
725 | - } |
|
726 | - else |
|
812 | + } else |
|
727 | 813 | { |
728 | 814 | Context::set('widget_content', $widget_content_body); |
729 | 815 | } |
@@ -792,7 +878,9 @@ discard block |
||
792 | 878 | FileHandler::removeFile($cache_file); |
793 | 879 | } |
794 | 880 | |
795 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
881 | + if($vars->widget_cache>0) { |
|
882 | + $vars->widget_sequence = getNextSequence(); |
|
883 | + } |
|
796 | 884 | |
797 | 885 | $attribute = array(); |
798 | 886 | foreach($vars as $key => $val) |
@@ -802,7 +890,9 @@ discard block |
||
802 | 890 | unset($vars->{$key}); |
803 | 891 | continue; |
804 | 892 | } |
805 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
893 | + if(strpos($val,'|@|') > 0) { |
|
894 | + $val = str_replace('|@|', ',', $val); |
|
895 | + } |
|
806 | 896 | $vars->{$key} = Context::convertEncodingStr($val); |
807 | 897 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
808 | 898 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $point = $config->signup_point; |
32 | 32 | // Increase the point |
33 | 33 | $cur_point += $point; |
34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
35 | 35 | |
36 | 36 | return new Object(); |
37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new Object(); |
|
45 | + if (!$member_srl) return new Object(); |
|
46 | 46 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new Object(); |
|
48 | 48 | // Get the point module information |
49 | 49 | $oModuleModel = getModel('module'); |
50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $point = $config->login_point; |
56 | 56 | // Increase the point |
57 | 57 | $cur_point += $point; |
58 | - $this->setPoint($member_srl,$cur_point); |
|
58 | + $this->setPoint($member_srl, $cur_point); |
|
59 | 59 | |
60 | 60 | return new Object(); |
61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | function triggerInsertDocument(&$obj) |
67 | 67 | { |
68 | 68 | $oDocumentModel = getModel('document'); |
69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
70 | 70 | { |
71 | 71 | $module_srl = $obj->module_srl; |
72 | 72 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
73 | + if (!$module_srl || !$member_srl) return new Object(); |
|
74 | 74 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new Object(); |
|
75 | + if ($module_srl == $member_srl) return new Object(); |
|
76 | 76 | // Get the point module information |
77 | 77 | $oModuleModel = getModel('module'); |
78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
80 | 80 | // Get the points of the member |
81 | 81 | $oPointModel = getModel('point'); |
82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 83 | |
84 | 84 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
86 | 86 | $cur_point += $point; |
87 | 87 | // Add points for attaching a file |
88 | 88 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
91 | 91 | // Increase the point |
92 | - $this->setPoint($member_srl,$cur_point); |
|
92 | + $this->setPoint($member_srl, $cur_point); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return new Object(); |
@@ -106,24 +106,24 @@ discard block |
||
106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
107 | 107 | |
108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
110 | 110 | { |
111 | 111 | $oModuleModel = getModel('module'); |
112 | 112 | |
113 | 113 | // Get the point module information |
114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
116 | 116 | // Get the points of the member |
117 | 117 | $oPointModel = getModel('point'); |
118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 119 | |
120 | 120 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
122 | 122 | $cur_point += $point; |
123 | 123 | // Add points for attaching a file |
124 | 124 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
127 | 127 | // Increase the point |
128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
141 | 141 | |
142 | 142 | $oDocumentModel = getModel('document'); |
143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new Object(); |
|
144 | + if (!$oDocument->isExists()) return new Object(); |
|
145 | 145 | // Get the point module information |
146 | 146 | $oModuleModel = getModel('module'); |
147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
149 | 149 | // The process related to clearing the post comments |
150 | 150 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
152 | 152 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new Object(); |
|
153 | + if ($comment_point > 0) return new Object(); |
|
154 | 154 | // Get all the comments related to this post |
155 | 155 | $cp_args = new stdClass(); |
156 | 156 | $cp_args->document_srl = $document_srl; |
157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 158 | // Return if there is no object |
159 | - if(!$output->data) return new Object(); |
|
159 | + if (!$output->data) return new Object(); |
|
160 | 160 | // Organize the member number |
161 | 161 | $member_srls = array(); |
162 | 162 | $cnt = count($output->data); |
163 | - for($i=0;$i<$cnt;$i++) |
|
163 | + for ($i = 0; $i < $cnt; $i++) |
|
164 | 164 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 167 | } |
168 | 168 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new Object(); |
|
169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | + if (!count($member_srls)) return new Object(); |
|
171 | 171 | // Remove all the points for each member |
172 | 172 | $oPointModel = getModel('point'); |
173 | 173 | // Get the points |
174 | 174 | $point = $module_config['download_file']; |
175 | - foreach($member_srls as $member_srl => $cnt) |
|
175 | + foreach ($member_srls as $member_srl => $cnt) |
|
176 | 176 | { |
177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
178 | 178 | $cur_point -= $cnt * $comment_point; |
179 | - $this->setPoint($member_srl,$cur_point); |
|
179 | + $this->setPoint($member_srl, $cur_point); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return new Object(); |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | { |
190 | 190 | $oDocumentModel = getModel('document'); |
191 | 191 | |
192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
193 | 193 | { |
194 | 194 | $module_srl = $obj->module_srl; |
195 | 195 | $member_srl = $obj->member_srl; |
196 | 196 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
197 | + if (!$module_srl || !$member_srl) return new Object(); |
|
198 | 198 | // Run only when logged in |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new Object(); |
|
200 | + if (!$logged_info->member_srl) return new Object(); |
|
201 | 201 | // Get the points of the member |
202 | 202 | $oPointModel = getModel('point'); |
203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 208 | |
209 | 209 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new Object(); |
|
212 | + if ($point < 0) return new Object(); |
|
213 | 213 | $cur_point -= $point; |
214 | 214 | // Add points related to deleting an attachment |
215 | 215 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
216 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | + if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
218 | 218 | // Increase the point |
219 | - $this->setPoint($member_srl,$cur_point); |
|
219 | + $this->setPoint($member_srl, $cur_point); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return new Object(); |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | { |
230 | 230 | $module_srl = $obj->module_srl; |
231 | 231 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
232 | + if (!$module_srl || !$member_srl) return new Object(); |
|
233 | 233 | // Do not increase the points if the member is the author of the post |
234 | 234 | $document_srl = $obj->document_srl; |
235 | 235 | $oDocumentModel = getModel('document'); |
236 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object(); |
|
238 | 238 | // Get the point module information |
239 | 239 | $oModuleModel = getModel('module'); |
240 | 240 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 245 | |
246 | 246 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
247 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
248 | 248 | // Increase the point |
249 | 249 | $cur_point += $point; |
250 | - $this->setPoint($member_srl,$cur_point); |
|
250 | + $this->setPoint($member_srl, $cur_point); |
|
251 | 251 | |
252 | 252 | return new Object(); |
253 | 253 | } |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $module_srl = $obj->module_srl; |
265 | 265 | $member_srl = abs($obj->member_srl); |
266 | 266 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
267 | + if (!$module_srl || !$member_srl) return new Object(); |
|
268 | 268 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new Object(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
270 | + if (!$oDocument->isExists()) return new Object(); |
|
271 | + if ($oDocument->get('member_srl') == $member_srl) return new Object(); |
|
272 | 272 | // Get the point module information |
273 | 273 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 274 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 277 | |
278 | 278 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
279 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
280 | 280 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new Object(); |
|
281 | + if ($point < 0) return new Object(); |
|
282 | 282 | // Increase the point |
283 | 283 | $cur_point -= $point; |
284 | - $this->setPoint($member_srl,$cur_point); |
|
284 | + $this->setPoint($member_srl, $cur_point); |
|
285 | 285 | |
286 | 286 | return new Object(); |
287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function triggerDeleteFile(&$obj) |
303 | 303 | { |
304 | - if($obj->isvalid != 'Y') return new Object(); |
|
304 | + if ($obj->isvalid != 'Y') return new Object(); |
|
305 | 305 | |
306 | 306 | $module_srl = $obj->module_srl; |
307 | 307 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
308 | + if (!$module_srl || !$member_srl) return new Object(); |
|
309 | 309 | // Get the point module information |
310 | 310 | $oModuleModel = getModel('module'); |
311 | 311 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 316 | |
317 | 317 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
318 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
319 | 319 | // Increase the point |
320 | 320 | $cur_point -= $point; |
321 | - $this->setPoint($member_srl,$cur_point); |
|
321 | + $this->setPoint($member_srl, $cur_point); |
|
322 | 322 | |
323 | 323 | return new Object(); |
324 | 324 | } |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | $logged_info = Context::get('logged_info'); |
332 | 332 | $member_srl = $logged_info->member_srl; |
333 | 333 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new Object(); |
|
334 | + if (!$module_srl) return new Object(); |
|
335 | 335 | |
336 | 336 | // Pass if it is your file |
337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
337 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
338 | 338 | $oModuleModel = getModel('module'); |
339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | // If the user is not logged in and download requires points, deny access. |
351 | - if(!Context::get('is_logged')) |
|
351 | + if (!Context::get('is_logged')) |
|
352 | 352 | { |
353 | - if($config->disable_download == 'Y' && $point) |
|
353 | + if ($config->disable_download == 'Y' && $point) |
|
354 | 354 | { |
355 | - return new Object(-1,'msg_not_permitted_download'); |
|
355 | + return new Object(-1, 'msg_not_permitted_download'); |
|
356 | 356 | } |
357 | 357 | else |
358 | 358 | { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // If the member does not have enough points, deny access. |
368 | 368 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
369 | 369 | { |
370 | - return new Object(-1,'msg_cannot_download'); |
|
370 | + return new Object(-1, 'msg_cannot_download'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -381,13 +381,13 @@ discard block |
||
381 | 381 | { |
382 | 382 | // Run only when logged in |
383 | 383 | $logged_info = Context::get('logged_info'); |
384 | - if(!$logged_info->member_srl) return new Object(); |
|
384 | + if (!$logged_info->member_srl) return new Object(); |
|
385 | 385 | $module_srl = $obj->module_srl; |
386 | 386 | $member_srl = $logged_info->member_srl; |
387 | - if(!$module_srl) return new Object(); |
|
387 | + if (!$module_srl) return new Object(); |
|
388 | 388 | |
389 | 389 | // Pass if it is your file |
390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
390 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
391 | 391 | |
392 | 392 | // Get the point module information |
393 | 393 | $oModuleModel = getModel('module'); |
@@ -428,22 +428,22 @@ discard block |
||
428 | 428 | // Get the original author number |
429 | 429 | $target_member_srl = abs($obj->get('member_srl')); |
430 | 430 | // Pass without increasing the hits if the viewer is the same as the author |
431 | - if($target_member_srl == $member_srl) return new Object(); |
|
431 | + if ($target_member_srl == $member_srl) return new Object(); |
|
432 | 432 | // Get the point information for each module |
433 | 433 | $config = $oModuleModel->getModuleConfig('point'); |
434 | 434 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
435 | 435 | // Get hits points |
436 | 436 | $point = $module_config['read_document']; |
437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
437 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
438 | 438 | // Pass if there are no requested points |
439 | - if(!$point) return new Object(); |
|
439 | + if (!$point) return new Object(); |
|
440 | 440 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
441 | - if($member_srl) |
|
441 | + if ($member_srl) |
|
442 | 442 | { |
443 | 443 | $args->member_srl = $member_srl; |
444 | 444 | $args->document_srl = $obj->document_srl; |
445 | 445 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
446 | - if($output->data->count) return new Object(); |
|
446 | + if ($output->data->count) return new Object(); |
|
447 | 447 | $cur_point = $oPointModel->getPoint($member_srl, true); |
448 | 448 | } |
449 | 449 | else |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $config = $oModuleModel->getModuleConfig('point'); |
455 | 455 | // When the requested points are negative, compared it with the current point |
456 | 456 | $_SESSION['banned_document'][$obj->document_srl] = false; |
457 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
457 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
458 | 458 | { |
459 | 459 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
460 | 460 | $obj->add('content', $message); |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | return new Object(-1, $message); |
463 | 463 | } |
464 | 464 | // If not logged in, pass |
465 | - if(!$logged_info->member_srl) return new Object(); |
|
465 | + if (!$logged_info->member_srl) return new Object(); |
|
466 | 466 | // Pass, if there are no requested points |
467 | - if(!$point) return new Object(); |
|
467 | + if (!$point) return new Object(); |
|
468 | 468 | // If the read record is missing, leave it |
469 | 469 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
470 | 470 | // Increase the point |
471 | 471 | $cur_point += $point; |
472 | - $this->setPoint($member_srl,$cur_point); |
|
472 | + $this->setPoint($member_srl, $cur_point); |
|
473 | 473 | |
474 | 474 | return new Object(); |
475 | 475 | } |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | { |
482 | 482 | $module_srl = $obj->module_srl; |
483 | 483 | $member_srl = $obj->member_srl; |
484 | - if(!$module_srl || !$member_srl) return new Object(); |
|
484 | + if (!$module_srl || !$member_srl) return new Object(); |
|
485 | 485 | |
486 | 486 | $oModuleModel = getModel('module'); |
487 | 487 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -490,21 +490,21 @@ discard block |
||
490 | 490 | $oPointModel = getModel('point'); |
491 | 491 | $cur_point = $oPointModel->getPoint($member_srl, true); |
492 | 492 | |
493 | - if( $obj->point > 0 ) |
|
493 | + if ($obj->point > 0) |
|
494 | 494 | { |
495 | 495 | $point = $module_config['voted']; |
496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
496 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
497 | 497 | } |
498 | 498 | else |
499 | 499 | { |
500 | 500 | $point = $module_config['blamed']; |
501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
501 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
502 | 502 | } |
503 | 503 | |
504 | - if(!$point) return new Object(); |
|
504 | + if (!$point) return new Object(); |
|
505 | 505 | // Increase the point |
506 | 506 | $cur_point += $point; |
507 | - $this->setPoint($member_srl,$cur_point); |
|
507 | + $this->setPoint($member_srl, $cur_point); |
|
508 | 508 | |
509 | 509 | return new Object(); |
510 | 510 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | { |
517 | 517 | $member_srl = abs($member_srl); |
518 | 518 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
519 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
520 | 520 | |
521 | 521 | // Get configuration information |
522 | 522 | $oMemberModel = getModel('member'); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $args->member_srl = $member_srl; |
534 | 534 | $args->point = $current_point; |
535 | 535 | |
536 | - switch($mode) |
|
536 | + switch ($mode) |
|
537 | 537 | { |
538 | 538 | case 'add' : |
539 | 539 | $args->point += $point; |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $args->point = $point; |
547 | 547 | break; |
548 | 548 | } |
549 | - if($args->point < 0) $args->point = 0; |
|
549 | + if ($args->point < 0) $args->point = 0; |
|
550 | 550 | $point = $args->point; |
551 | 551 | |
552 | 552 | // Call a trigger (before) |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $trigger_obj->current_level = $current_level; |
558 | 558 | $trigger_obj->set_point = $point; |
559 | 559 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
560 | - if(!$trigger_output->toBool()) |
|
560 | + if (!$trigger_output->toBool()) |
|
561 | 561 | { |
562 | 562 | return $trigger_output; |
563 | 563 | } |
@@ -568,19 +568,19 @@ discard block |
||
568 | 568 | |
569 | 569 | // If there are points, update, if no, insert |
570 | 570 | $oPointModel = getModel('point'); |
571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
571 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
572 | 572 | else executeQuery("point.insertPoint", $args); |
573 | 573 | |
574 | 574 | // Get a new level |
575 | 575 | $level = $oPointModel->getLevel($point, $config->level_step); |
576 | 576 | |
577 | 577 | // If existing level and a new one are different attempt to set a point group |
578 | - if($level != $current_level) |
|
578 | + if ($level != $current_level) |
|
579 | 579 | { |
580 | 580 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
581 | 581 | $point_group = $config->point_group; |
582 | 582 | // If the point group exists |
583 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
583 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
584 | 584 | { |
585 | 585 | // Get the default group |
586 | 586 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -590,29 +590,29 @@ discard block |
||
590 | 590 | |
591 | 591 | asort($point_group); |
592 | 592 | // Reset group after initialization |
593 | - if($config->group_reset != 'N') |
|
593 | + if ($config->group_reset != 'N') |
|
594 | 594 | { |
595 | 595 | // If the new level is in the right group |
596 | - if(in_array($level, $point_group)) |
|
596 | + if (in_array($level, $point_group)) |
|
597 | 597 | { |
598 | 598 | // Delete all groups except the one which the current level belongs to |
599 | - foreach($point_group as $group_srl => $target_level) |
|
599 | + foreach ($point_group as $group_srl => $target_level) |
|
600 | 600 | { |
601 | 601 | $del_group_list[] = $group_srl; |
602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
602 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | // Otherwise, in case the level is reduced, add the recent group |
606 | 606 | else |
607 | 607 | { |
608 | 608 | $i = $level; |
609 | - while($i > 0) |
|
609 | + while ($i > 0) |
|
610 | 610 | { |
611 | - if(in_array($i, $point_group)) |
|
611 | + if (in_array($i, $point_group)) |
|
612 | 612 | { |
613 | - foreach($point_group as $group_srl => $target_level) |
|
613 | + foreach ($point_group as $group_srl => $target_level) |
|
614 | 614 | { |
615 | - if($target_level == $i) |
|
615 | + if ($target_level == $i) |
|
616 | 616 | { |
617 | 617 | $new_group_list[] = $group_srl; |
618 | 618 | } |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | } |
624 | 624 | } |
625 | 625 | // Delete the group of a level which is higher than the current level |
626 | - foreach($point_group as $group_srl => $target_level) |
|
626 | + foreach ($point_group as $group_srl => $target_level) |
|
627 | 627 | { |
628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
628 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
629 | 629 | } |
630 | 630 | $del_group_list[] = $default_group->group_srl; |
631 | 631 | } |
@@ -633,16 +633,16 @@ discard block |
||
633 | 633 | else |
634 | 634 | { |
635 | 635 | // Check until the current level by rotating setting the configurations of the point groups |
636 | - foreach($point_group as $group_srl => $target_level) |
|
636 | + foreach ($point_group as $group_srl => $target_level) |
|
637 | 637 | { |
638 | 638 | $del_group_list[] = $group_srl; |
639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
639 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
640 | 640 | } |
641 | 641 | } |
642 | 642 | // If there is no a new group, granted the default group |
643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
643 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
644 | 644 | // Remove linkage group |
645 | - if($del_group_list && count($del_group_list)) |
|
645 | + if ($del_group_list && count($del_group_list)) |
|
646 | 646 | { |
647 | 647 | $del_group_args = new stdClass; |
648 | 648 | $del_group_args->member_srl = $member_srl; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
651 | 651 | } |
652 | 652 | // Grant a new group |
653 | - foreach($new_group_list as $group_srl) |
|
653 | + foreach ($new_group_list as $group_srl) |
|
654 | 654 | { |
655 | 655 | $new_group_args = new stdClass; |
656 | 656 | $new_group_args->member_srl = $member_srl; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $trigger_obj->del_group_list = $del_group_list; |
666 | 666 | $trigger_obj->new_level = $level; |
667 | 667 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
668 | - if(!$trigger_output->toBool()) |
|
668 | + if (!$trigger_output->toBool()) |
|
669 | 669 | { |
670 | 670 | $oDB->rollback(); |
671 | 671 | return $trigger_output; |
@@ -681,17 +681,17 @@ discard block |
||
681 | 681 | FileHandler::writeFile($cache_filename, $point); |
682 | 682 | |
683 | 683 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
684 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
684 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
685 | 685 | { |
686 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
686 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
687 | 687 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
688 | 688 | $oCacheHandler->delete($cache_key); |
689 | 689 | } |
690 | 690 | |
691 | 691 | $oCacheHandler = CacheHandler::getInstance('object'); |
692 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
692 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
693 | 693 | { |
694 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
694 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
695 | 695 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
696 | 696 | $oCacheHandler->delete($cache_key); |
697 | 697 | } |
@@ -705,9 +705,9 @@ discard block |
||
705 | 705 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
706 | 706 | |
707 | 707 | $oModuleController = getController('module'); |
708 | - if(is_array($obj->moduleSrlList)) |
|
708 | + if (is_array($obj->moduleSrlList)) |
|
709 | 709 | { |
710 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
710 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
711 | 711 | { |
712 | 712 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
713 | 713 | } |
@@ -42,9 +42,13 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new Object(); |
|
45 | + if(!$member_srl) { |
|
46 | + return new Object(); |
|
47 | + } |
|
46 | 48 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
50 | + return new Object(); |
|
51 | + } |
|
48 | 52 | // Get the point module information |
49 | 53 | $oModuleModel = getModel('module'); |
50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
70 | 74 | { |
71 | 75 | $module_srl = $obj->module_srl; |
72 | 76 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
77 | + if(!$module_srl || !$member_srl) { |
|
78 | + return new Object(); |
|
79 | + } |
|
74 | 80 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new Object(); |
|
81 | + if($module_srl == $member_srl) { |
|
82 | + return new Object(); |
|
83 | + } |
|
76 | 84 | // Get the point module information |
77 | 85 | $oModuleModel = getModel('module'); |
78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 91 | |
84 | 92 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
94 | + $point = $config->insert_document; |
|
95 | + } |
|
86 | 96 | $cur_point += $point; |
87 | 97 | // Add points for attaching a file |
88 | 98 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
100 | + $point = $config->upload_file; |
|
101 | + } |
|
102 | + if($obj->uploaded_count) { |
|
103 | + $cur_point += $point * $obj->uploaded_count; |
|
104 | + } |
|
91 | 105 | // Increase the point |
92 | 106 | $this->setPoint($member_srl,$cur_point); |
93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 133 | |
120 | 134 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
136 | + $point = $config->insert_document; |
|
137 | + } |
|
122 | 138 | $cur_point += $point; |
123 | 139 | // Add points for attaching a file |
124 | 140 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
142 | + $point = $config->upload_file; |
|
143 | + } |
|
144 | + if($obj->uploaded_count) { |
|
145 | + $cur_point += $point * $obj->uploaded_count; |
|
146 | + } |
|
127 | 147 | // Increase the point |
128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
141 | 161 | |
142 | 162 | $oDocumentModel = getModel('document'); |
143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new Object(); |
|
164 | + if(!$oDocument->isExists()) { |
|
165 | + return new Object(); |
|
166 | + } |
|
145 | 167 | // Get the point module information |
146 | 168 | $oModuleModel = getModel('module'); |
147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
149 | 171 | // The process related to clearing the post comments |
150 | 172 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
174 | + $comment_point = $config->insert_comment; |
|
175 | + } |
|
152 | 176 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new Object(); |
|
177 | + if($comment_point>0) { |
|
178 | + return new Object(); |
|
179 | + } |
|
154 | 180 | // Get all the comments related to this post |
155 | 181 | $cp_args = new stdClass(); |
156 | 182 | $cp_args->document_srl = $document_srl; |
157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 184 | // Return if there is no object |
159 | - if(!$output->data) return new Object(); |
|
185 | + if(!$output->data) { |
|
186 | + return new Object(); |
|
187 | + } |
|
160 | 188 | // Organize the member number |
161 | 189 | $member_srls = array(); |
162 | 190 | $cnt = count($output->data); |
163 | 191 | for($i=0;$i<$cnt;$i++) |
164 | 192 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
193 | + if($output->data[$i]->member_srl<1) { |
|
194 | + continue; |
|
195 | + } |
|
166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 197 | } |
168 | 198 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new Object(); |
|
199 | + if($member_srl) { |
|
200 | + unset($member_srls[abs($member_srl)]); |
|
201 | + } |
|
202 | + if(!count($member_srls)) { |
|
203 | + return new Object(); |
|
204 | + } |
|
171 | 205 | // Remove all the points for each member |
172 | 206 | $oPointModel = getModel('point'); |
173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
194 | 228 | $module_srl = $obj->module_srl; |
195 | 229 | $member_srl = $obj->member_srl; |
196 | 230 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
231 | + if(!$module_srl || !$member_srl) { |
|
232 | + return new Object(); |
|
233 | + } |
|
198 | 234 | // Run only when logged in |
199 | 235 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new Object(); |
|
236 | + if(!$logged_info->member_srl) { |
|
237 | + return new Object(); |
|
238 | + } |
|
201 | 239 | // Get the points of the member |
202 | 240 | $oPointModel = getModel('point'); |
203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,14 +245,22 @@ discard block |
||
207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 246 | |
209 | 247 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
249 | + $point = $config->insert_document; |
|
250 | + } |
|
211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new Object(); |
|
252 | + if($point < 0) { |
|
253 | + return new Object(); |
|
254 | + } |
|
213 | 255 | $cur_point -= $point; |
214 | 256 | // Add points related to deleting an attachment |
215 | 257 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
258 | + if(strlen($point) == 0 && !is_int($point)) { |
|
259 | + $point = $config->upload_file; |
|
260 | + } |
|
261 | + if($obj->uploaded_count) { |
|
262 | + $cur_point -= $point * $obj->uploaded_count; |
|
263 | + } |
|
218 | 264 | // Increase the point |
219 | 265 | $this->setPoint($member_srl,$cur_point); |
220 | 266 | } |
@@ -229,12 +275,16 @@ discard block |
||
229 | 275 | { |
230 | 276 | $module_srl = $obj->module_srl; |
231 | 277 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
278 | + if(!$module_srl || !$member_srl) { |
|
279 | + return new Object(); |
|
280 | + } |
|
233 | 281 | // Do not increase the points if the member is the author of the post |
234 | 282 | $document_srl = $obj->document_srl; |
235 | 283 | $oDocumentModel = getModel('document'); |
236 | 284 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
286 | + return new Object(); |
|
287 | + } |
|
238 | 288 | // Get the point module information |
239 | 289 | $oModuleModel = getModel('module'); |
240 | 290 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,7 +294,9 @@ discard block |
||
244 | 294 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 295 | |
246 | 296 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
297 | + if(strlen($point) == 0 && !is_int($point)) { |
|
298 | + $point = $config->insert_comment; |
|
299 | + } |
|
248 | 300 | // Increase the point |
249 | 301 | $cur_point += $point; |
250 | 302 | $this->setPoint($member_srl,$cur_point); |
@@ -264,11 +316,17 @@ discard block |
||
264 | 316 | $module_srl = $obj->module_srl; |
265 | 317 | $member_srl = abs($obj->member_srl); |
266 | 318 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
319 | + if(!$module_srl || !$member_srl) { |
|
320 | + return new Object(); |
|
321 | + } |
|
268 | 322 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 323 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new Object(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
324 | + if(!$oDocument->isExists()) { |
|
325 | + return new Object(); |
|
326 | + } |
|
327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
328 | + return new Object(); |
|
329 | + } |
|
272 | 330 | // Get the point module information |
273 | 331 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 332 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,9 +334,13 @@ discard block |
||
276 | 334 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 335 | |
278 | 336 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
337 | + if(strlen($point) == 0 && !is_int($point)) { |
|
338 | + $point = $config->insert_comment; |
|
339 | + } |
|
280 | 340 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new Object(); |
|
341 | + if($point < 0) { |
|
342 | + return new Object(); |
|
343 | + } |
|
282 | 344 | // Increase the point |
283 | 345 | $cur_point -= $point; |
284 | 346 | $this->setPoint($member_srl,$cur_point); |
@@ -301,11 +363,15 @@ discard block |
||
301 | 363 | */ |
302 | 364 | function triggerDeleteFile(&$obj) |
303 | 365 | { |
304 | - if($obj->isvalid != 'Y') return new Object(); |
|
366 | + if($obj->isvalid != 'Y') { |
|
367 | + return new Object(); |
|
368 | + } |
|
305 | 369 | |
306 | 370 | $module_srl = $obj->module_srl; |
307 | 371 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
372 | + if(!$module_srl || !$member_srl) { |
|
373 | + return new Object(); |
|
374 | + } |
|
309 | 375 | // Get the point module information |
310 | 376 | $oModuleModel = getModel('module'); |
311 | 377 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,7 +381,9 @@ discard block |
||
315 | 381 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 382 | |
317 | 383 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
384 | + if(strlen($point) == 0 && !is_int($point)) { |
|
385 | + $point = $config->upload_file; |
|
386 | + } |
|
319 | 387 | // Increase the point |
320 | 388 | $cur_point -= $point; |
321 | 389 | $this->setPoint($member_srl,$cur_point); |
@@ -331,18 +399,21 @@ discard block |
||
331 | 399 | $logged_info = Context::get('logged_info'); |
332 | 400 | $member_srl = $logged_info->member_srl; |
333 | 401 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new Object(); |
|
402 | + if(!$module_srl) { |
|
403 | + return new Object(); |
|
404 | + } |
|
335 | 405 | |
336 | 406 | // Pass if it is your file |
337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
407 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
408 | + return new Object(); |
|
409 | + } |
|
338 | 410 | $oModuleModel = getModel('module'); |
339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 412 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
341 | 413 | if (isset($module_config['download_file'])) |
342 | 414 | { |
343 | 415 | $point = intval($module_config['download_file']); |
344 | - } |
|
345 | - else |
|
416 | + } else |
|
346 | 417 | { |
347 | 418 | $point = intval($config->download_file); |
348 | 419 | } |
@@ -353,8 +424,7 @@ discard block |
||
353 | 424 | if($config->disable_download == 'Y' && $point) |
354 | 425 | { |
355 | 426 | return new Object(-1,'msg_not_permitted_download'); |
356 | - } |
|
357 | - else |
|
427 | + } else |
|
358 | 428 | { |
359 | 429 | return new Object(); |
360 | 430 | } |
@@ -381,13 +451,19 @@ discard block |
||
381 | 451 | { |
382 | 452 | // Run only when logged in |
383 | 453 | $logged_info = Context::get('logged_info'); |
384 | - if(!$logged_info->member_srl) return new Object(); |
|
454 | + if(!$logged_info->member_srl) { |
|
455 | + return new Object(); |
|
456 | + } |
|
385 | 457 | $module_srl = $obj->module_srl; |
386 | 458 | $member_srl = $logged_info->member_srl; |
387 | - if(!$module_srl) return new Object(); |
|
459 | + if(!$module_srl) { |
|
460 | + return new Object(); |
|
461 | + } |
|
388 | 462 | |
389 | 463 | // Pass if it is your file |
390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
464 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
465 | + return new Object(); |
|
466 | + } |
|
391 | 467 | |
392 | 468 | // Get the point module information |
393 | 469 | $oModuleModel = getModel('module'); |
@@ -396,8 +472,7 @@ discard block |
||
396 | 472 | if (isset($module_config['download_file'])) |
397 | 473 | { |
398 | 474 | $point = intval($module_config['download_file']); |
399 | - } |
|
400 | - else |
|
475 | + } else |
|
401 | 476 | { |
402 | 477 | $point = intval($config->download_file); |
403 | 478 | } |
@@ -428,25 +503,32 @@ discard block |
||
428 | 503 | // Get the original author number |
429 | 504 | $target_member_srl = abs($obj->get('member_srl')); |
430 | 505 | // Pass without increasing the hits if the viewer is the same as the author |
431 | - if($target_member_srl == $member_srl) return new Object(); |
|
506 | + if($target_member_srl == $member_srl) { |
|
507 | + return new Object(); |
|
508 | + } |
|
432 | 509 | // Get the point information for each module |
433 | 510 | $config = $oModuleModel->getModuleConfig('point'); |
434 | 511 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
435 | 512 | // Get hits points |
436 | 513 | $point = $module_config['read_document']; |
437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
514 | + if(strlen($point) == 0 && !is_int($point)) { |
|
515 | + $point = $config->read_document; |
|
516 | + } |
|
438 | 517 | // Pass if there are no requested points |
439 | - if(!$point) return new Object(); |
|
518 | + if(!$point) { |
|
519 | + return new Object(); |
|
520 | + } |
|
440 | 521 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
441 | 522 | if($member_srl) |
442 | 523 | { |
443 | 524 | $args->member_srl = $member_srl; |
444 | 525 | $args->document_srl = $obj->document_srl; |
445 | 526 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
446 | - if($output->data->count) return new Object(); |
|
527 | + if($output->data->count) { |
|
528 | + return new Object(); |
|
529 | + } |
|
447 | 530 | $cur_point = $oPointModel->getPoint($member_srl, true); |
448 | - } |
|
449 | - else |
|
531 | + } else |
|
450 | 532 | { |
451 | 533 | $cur_point = 0; |
452 | 534 | } |
@@ -462,9 +544,13 @@ discard block |
||
462 | 544 | return new Object(-1, $message); |
463 | 545 | } |
464 | 546 | // If not logged in, pass |
465 | - if(!$logged_info->member_srl) return new Object(); |
|
547 | + if(!$logged_info->member_srl) { |
|
548 | + return new Object(); |
|
549 | + } |
|
466 | 550 | // Pass, if there are no requested points |
467 | - if(!$point) return new Object(); |
|
551 | + if(!$point) { |
|
552 | + return new Object(); |
|
553 | + } |
|
468 | 554 | // If the read record is missing, leave it |
469 | 555 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
470 | 556 | // Increase the point |
@@ -481,7 +567,9 @@ discard block |
||
481 | 567 | { |
482 | 568 | $module_srl = $obj->module_srl; |
483 | 569 | $member_srl = $obj->member_srl; |
484 | - if(!$module_srl || !$member_srl) return new Object(); |
|
570 | + if(!$module_srl || !$member_srl) { |
|
571 | + return new Object(); |
|
572 | + } |
|
485 | 573 | |
486 | 574 | $oModuleModel = getModel('module'); |
487 | 575 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -493,15 +581,20 @@ discard block |
||
493 | 581 | if( $obj->point > 0 ) |
494 | 582 | { |
495 | 583 | $point = $module_config['voted']; |
496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
497 | - } |
|
498 | - else |
|
584 | + if(strlen($point) == 0 && !is_int($point)) { |
|
585 | + $point = $config->voted; |
|
586 | + } |
|
587 | + } else |
|
499 | 588 | { |
500 | 589 | $point = $module_config['blamed']; |
501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
590 | + if(strlen($point) == 0 && !is_int($point)) { |
|
591 | + $point = $config->blamed; |
|
592 | + } |
|
502 | 593 | } |
503 | 594 | |
504 | - if(!$point) return new Object(); |
|
595 | + if(!$point) { |
|
596 | + return new Object(); |
|
597 | + } |
|
505 | 598 | // Increase the point |
506 | 599 | $cur_point += $point; |
507 | 600 | $this->setPoint($member_srl,$cur_point); |
@@ -516,7 +609,9 @@ discard block |
||
516 | 609 | { |
517 | 610 | $member_srl = abs($member_srl); |
518 | 611 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
612 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
613 | + $mode = 'update'; |
|
614 | + } |
|
520 | 615 | |
521 | 616 | // Get configuration information |
522 | 617 | $oMemberModel = getModel('member'); |
@@ -546,7 +641,9 @@ discard block |
||
546 | 641 | $args->point = $point; |
547 | 642 | break; |
548 | 643 | } |
549 | - if($args->point < 0) $args->point = 0; |
|
644 | + if($args->point < 0) { |
|
645 | + $args->point = 0; |
|
646 | + } |
|
550 | 647 | $point = $args->point; |
551 | 648 | |
552 | 649 | // Call a trigger (before) |
@@ -568,8 +665,11 @@ discard block |
||
568 | 665 | |
569 | 666 | // If there are points, update, if no, insert |
570 | 667 | $oPointModel = getModel('point'); |
571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
572 | - else executeQuery("point.insertPoint", $args); |
|
668 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
669 | + executeQuery("point.updatePoint", $args); |
|
670 | + } else { |
|
671 | + executeQuery("point.insertPoint", $args); |
|
672 | + } |
|
573 | 673 | |
574 | 674 | // Get a new level |
575 | 675 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -599,7 +699,9 @@ discard block |
||
599 | 699 | foreach($point_group as $group_srl => $target_level) |
600 | 700 | { |
601 | 701 | $del_group_list[] = $group_srl; |
602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
702 | + if($target_level == $level) { |
|
703 | + $new_group_list[] = $group_srl; |
|
704 | + } |
|
603 | 705 | } |
604 | 706 | } |
605 | 707 | // Otherwise, in case the level is reduced, add the recent group |
@@ -625,7 +727,9 @@ discard block |
||
625 | 727 | // Delete the group of a level which is higher than the current level |
626 | 728 | foreach($point_group as $group_srl => $target_level) |
627 | 729 | { |
628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
730 | + if($target_level > $level) { |
|
731 | + $del_group_list[] = $group_srl; |
|
732 | + } |
|
629 | 733 | } |
630 | 734 | $del_group_list[] = $default_group->group_srl; |
631 | 735 | } |
@@ -636,11 +740,15 @@ discard block |
||
636 | 740 | foreach($point_group as $group_srl => $target_level) |
637 | 741 | { |
638 | 742 | $del_group_list[] = $group_srl; |
639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
743 | + if($target_level <= $level) { |
|
744 | + $new_group_list[] = $group_srl; |
|
745 | + } |
|
640 | 746 | } |
641 | 747 | } |
642 | 748 | // If there is no a new group, granted the default group |
643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
749 | + if(!$new_group_list[0]) { |
|
750 | + $new_group_list[0] = $default_group->group_srl; |
|
751 | + } |
|
644 | 752 | // Remove linkage group |
645 | 753 | if($del_group_list && count($del_group_list)) |
646 | 754 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function init() |
18 | 18 | { |
19 | 19 | // Error occurs if already installed |
20 | - if(Context::isInstalled()) |
|
20 | + if (Context::isInstalled()) |
|
21 | 21 | { |
22 | 22 | $this->stop('msg_already_installed'); |
23 | 23 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | function _procDBSetting() |
87 | 87 | { |
88 | 88 | // Get DB-related variables |
89 | - $con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix'); |
|
89 | + $con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix'); |
|
90 | 90 | |
91 | 91 | $db_info = new stdClass(); |
92 | 92 | $db_info->master_db = get_object_vars($con_string); |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | // Check if available to connect to the DB |
102 | 102 | $oDB = &DB::getInstance(); |
103 | 103 | $output = $oDB->getError(); |
104 | - if(!$output->toBool()) return $output; |
|
105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
104 | + if (!$output->toBool()) return $output; |
|
105 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
106 | 106 | |
107 | 107 | // Create a db temp config file |
108 | - if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
108 | + if (!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
109 | 109 | |
110 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
110 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
111 | 111 | { |
112 | 112 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm'); |
113 | 113 | header('location:'.$returnUrl); |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | function procConfigSetting() |
122 | 122 | { |
123 | 123 | // Get variables |
124 | - $config_info = Context::gets('use_rewrite','time_zone'); |
|
125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
124 | + $config_info = Context::gets('use_rewrite', 'time_zone'); |
|
125 | + if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N'; |
|
126 | 126 | |
127 | 127 | // Create a db temp config file |
128 | - if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
128 | + if (!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
129 | 129 | |
130 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
130 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
131 | 131 | { |
132 | 132 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm'); |
133 | 133 | header('location:'.$returnUrl); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | function procInstall() |
142 | 142 | { |
143 | 143 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
144 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
145 | 145 | |
146 | 146 | // Assign a temporary administrator when installing |
147 | 147 | $logged_info = new stdClass(); |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | Context::set('logged_info', $logged_info); |
150 | 150 | |
151 | 151 | // check install config |
152 | - if(Context::get('install_config')) |
|
152 | + if (Context::get('install_config')) |
|
153 | 153 | { |
154 | 154 | $db_info = $this->_makeDbInfoByInstallConfig(); |
155 | 155 | } |
156 | 156 | // install by default XE UI |
157 | 157 | else |
158 | 158 | { |
159 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
159 | + if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | + if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // Set DB type and information |
@@ -165,30 +165,30 @@ discard block |
||
165 | 165 | // Create DB Instance |
166 | 166 | $oDB = &DB::getInstance(); |
167 | 167 | // Check if available to connect to the DB |
168 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
168 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
169 | 169 | |
170 | 170 | // Install all the modules |
171 | 171 | try { |
172 | 172 | $oDB->begin(); |
173 | 173 | $this->installDownloadedModule(); |
174 | 174 | $oDB->commit(); |
175 | - } catch(Exception $e) { |
|
175 | + } catch (Exception $e) { |
|
176 | 176 | $oDB->rollback(); |
177 | 177 | return new Object(-1, $e->getMessage()); |
178 | 178 | } |
179 | 179 | |
180 | 180 | // Create a config file |
181 | - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
181 | + if (!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
182 | 182 | |
183 | 183 | // load script |
184 | - $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
|
185 | - if(count($scripts)>0) |
|
184 | + $scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/'); |
|
185 | + if (count($scripts) > 0) |
|
186 | 186 | { |
187 | 187 | sort($scripts); |
188 | - foreach($scripts as $script) |
|
188 | + foreach ($scripts as $script) |
|
189 | 189 | { |
190 | 190 | $script_path = FileHandler::getRealPath('./modules/install/script/'); |
191 | - $output = include($script_path . $script); |
|
191 | + $output = include($script_path.$script); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | unset($_SESSION['use_rewrite']); |
203 | 203 | |
204 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
204 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
205 | 205 | { |
206 | 206 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); |
207 | 207 | header('location:'.$returnUrl); |
@@ -239,57 +239,57 @@ discard block |
||
239 | 239 | */ |
240 | 240 | function procInstallFTP() |
241 | 241 | { |
242 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
243 | - $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
|
244 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
245 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
242 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
243 | + $ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path'); |
|
244 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
245 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | + if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | + if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
248 | 248 | |
249 | 249 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
250 | 250 | $buff[] = "\$ftp_info = new stdClass();"; |
251 | - foreach($ftp_info as $key => $val) |
|
251 | + foreach ($ftp_info as $key => $val) |
|
252 | 252 | { |
253 | - $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val)); |
|
253 | + $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val)); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // If safe_mode |
257 | - if(ini_get('safe_mode')) |
|
257 | + if (ini_get('safe_mode')) |
|
258 | 258 | { |
259 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
259 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
260 | 260 | |
261 | 261 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
262 | 262 | $oFtp = new ftp(); |
263 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
263 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
264 | 264 | |
265 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
265 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
266 | 266 | { |
267 | 267 | $oFtp->ftp_quit(); |
268 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
268 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
269 | 269 | } |
270 | 270 | |
271 | - if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
271 | + if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
272 | 272 | { |
273 | 273 | $oFtp->ftp_quit(); |
274 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
274 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
275 | 275 | } |
276 | 276 | |
277 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
277 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
278 | 278 | { |
279 | 279 | $oFtp->ftp_quit(); |
280 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
280 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
281 | 281 | } |
282 | 282 | |
283 | - if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
283 | + if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
284 | 284 | { |
285 | 285 | $oFtp->ftp_quit(); |
286 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
286 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
287 | 287 | } |
288 | 288 | |
289 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
289 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
290 | 290 | { |
291 | 291 | $oFtp->ftp_quit(); |
292 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
292 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $oFtp->ftp_quit(); |
@@ -300,31 +300,31 @@ discard block |
||
300 | 300 | |
301 | 301 | function procInstallCheckFtp() |
302 | 302 | { |
303 | - $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
|
304 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
305 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
303 | + $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); |
|
304 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
305 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | + if (!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
307 | 307 | |
308 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
308 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
309 | 309 | |
310 | - if($ftp_info->sftp == 'Y') |
|
310 | + if ($ftp_info->sftp == 'Y') |
|
311 | 311 | { |
312 | 312 | $connection = ssh2_connect('localhost', $ftp_info->ftp_port); |
313 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
313 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
314 | 314 | { |
315 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
315 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | else |
319 | 319 | { |
320 | 320 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
321 | 321 | $oFtp = new ftp(); |
322 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
322 | + if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
323 | 323 | |
324 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
324 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
325 | 325 | { |
326 | 326 | $oFtp->ftp_quit(); |
327 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
327 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
328 | 328 | } |
329 | 329 | $oFtp->ftp_quit(); |
330 | 330 | } |
@@ -341,36 +341,36 @@ discard block |
||
341 | 341 | $checklist = array(); |
342 | 342 | // 0. check your version of php (5.2.4 or higher) |
343 | 343 | $checklist['php_version'] = true; |
344 | - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
344 | + if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
345 | 345 | { |
346 | 346 | $checklist['php_version'] = false; |
347 | 347 | } |
348 | 348 | |
349 | - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
349 | + if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
350 | 350 | { |
351 | 351 | Context::set('phpversion_warning', true); |
352 | 352 | } |
353 | 353 | |
354 | 354 | // 1. Check permission |
355 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
355 | + if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true; |
|
356 | 356 | else $checklist['permission'] = false; |
357 | 357 | // 2. Check if xml_parser_create exists |
358 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
358 | + if (function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
359 | 359 | else $checklist['xml'] = false; |
360 | 360 | // 3. Check if ini_get (session.auto_start) == 1 |
361 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
361 | + if (ini_get('session.auto_start') != 1) $checklist['session'] = true; |
|
362 | 362 | else $checklist['session'] = false; |
363 | 363 | // 4. Check if iconv exists |
364 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
364 | + if (function_exists('iconv')) $checklist['iconv'] = true; |
|
365 | 365 | else $checklist['iconv'] = false; |
366 | 366 | // 5. Check gd(imagecreatefromgif function) |
367 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
367 | + if (function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
368 | 368 | else $checklist['gd'] = false; |
369 | 369 | // 6. Check DB |
370 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
370 | + if (DB::getEnableList()) $checklist['db'] = true; |
|
371 | 371 | else $checklist['db'] = false; |
372 | 372 | |
373 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
373 | + if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
374 | 374 | else $install_enable = true; |
375 | 375 | |
376 | 376 | // Save the checked result to the Context |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | $license_agreement = ($vars->license_agreement == 'Y') ? true : false; |
392 | 392 | |
393 | - if($license_agreement) |
|
393 | + if ($license_agreement) |
|
394 | 394 | { |
395 | 395 | $currentTime = $_SERVER['REQUEST_TIME']; |
396 | 396 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | return new Object(-1, 'msg_must_accept_license_agreement'); |
402 | 402 | } |
403 | 403 | |
404 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
404 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
405 | 405 | { |
406 | 406 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); |
407 | 407 | $this->setRedirectUrl($returnUrl); |
@@ -424,25 +424,25 @@ discard block |
||
424 | 424 | $hostname = $_SERVER['SERVER_NAME']; |
425 | 425 | $port = $_SERVER['SERVER_PORT']; |
426 | 426 | $str_port = ''; |
427 | - if($port) |
|
427 | + if ($port) |
|
428 | 428 | { |
429 | - $str_port = ':' . $port; |
|
429 | + $str_port = ':'.$port; |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $tmpPath = $_SERVER['DOCUMENT_ROOT']; |
433 | 433 | |
434 | 434 | //if DIRECTORY_SEPARATOR is not /(IIS) |
435 | - if(DIRECTORY_SEPARATOR !== '/') |
|
435 | + if (DIRECTORY_SEPARATOR !== '/') |
|
436 | 436 | { |
437 | 437 | //change to slash for compare |
438 | 438 | $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']); |
439 | 439 | } |
440 | 440 | |
441 | - $query = "/JUST/CHECK/REWRITE/" . $checkFilePath; |
|
441 | + $query = "/JUST/CHECK/REWRITE/".$checkFilePath; |
|
442 | 442 | $currentPath = str_replace($tmpPath, "", _XE_PATH_); |
443 | - if($currentPath != "") |
|
443 | + if ($currentPath != "") |
|
444 | 444 | { |
445 | - $query = $currentPath . $query; |
|
445 | + $query = $currentPath.$query; |
|
446 | 446 | } |
447 | 447 | $requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query); |
448 | 448 | $requestConfig = array(); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | './files/cache/template_compiled', |
468 | 468 | ); |
469 | 469 | |
470 | - foreach($directory_list as $dir) |
|
470 | + foreach ($directory_list as $dir) |
|
471 | 471 | { |
472 | 472 | FileHandler::makeDir($dir); |
473 | 473 | } |
@@ -483,57 +483,57 @@ discard block |
||
483 | 483 | $oModuleModel = getModel('module'); |
484 | 484 | // Create a table ny finding schemas/*.xml file in each module |
485 | 485 | $module_list = FileHandler::readDir('./modules/', NULL, false, true); |
486 | - foreach($module_list as $module_path) |
|
486 | + foreach ($module_list as $module_path) |
|
487 | 487 | { |
488 | 488 | // Get module name |
489 | - $tmp_arr = explode('/',$module_path); |
|
490 | - $module = $tmp_arr[count($tmp_arr)-1]; |
|
489 | + $tmp_arr = explode('/', $module_path); |
|
490 | + $module = $tmp_arr[count($tmp_arr) - 1]; |
|
491 | 491 | |
492 | 492 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
493 | - if(!$xml_info) continue; |
|
493 | + if (!$xml_info) continue; |
|
494 | 494 | $modules[$xml_info->category][] = $module; |
495 | 495 | } |
496 | 496 | // Install "module" module in advance |
497 | - $this->installModule('module','./modules/module'); |
|
497 | + $this->installModule('module', './modules/module'); |
|
498 | 498 | $oModule = getClass('module'); |
499 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
499 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
500 | 500 | // Determine the order of module installation depending on category |
501 | - $install_step = array('system','content','member'); |
|
501 | + $install_step = array('system', 'content', 'member'); |
|
502 | 502 | // Install all the remaining modules |
503 | - foreach($install_step as $category) |
|
503 | + foreach ($install_step as $category) |
|
504 | 504 | { |
505 | - if(count($modules[$category])) |
|
505 | + if (count($modules[$category])) |
|
506 | 506 | { |
507 | - foreach($modules[$category] as $module) |
|
507 | + foreach ($modules[$category] as $module) |
|
508 | 508 | { |
509 | - if($module == 'module') continue; |
|
509 | + if ($module == 'module') continue; |
|
510 | 510 | $this->installModule($module, sprintf('./modules/%s', $module)); |
511 | 511 | |
512 | 512 | $oModule = getClass($module); |
513 | - if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
513 | + if (is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
514 | 514 | { |
515 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
515 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | unset($modules[$category]); |
519 | 519 | } |
520 | 520 | } |
521 | 521 | // Install all the remaining modules |
522 | - if(count($modules)) |
|
522 | + if (count($modules)) |
|
523 | 523 | { |
524 | - foreach($modules as $category => $module_list) |
|
524 | + foreach ($modules as $category => $module_list) |
|
525 | 525 | { |
526 | - if(count($module_list)) |
|
526 | + if (count($module_list)) |
|
527 | 527 | { |
528 | - foreach($module_list as $module) |
|
528 | + foreach ($module_list as $module) |
|
529 | 529 | { |
530 | - if($module == 'module') continue; |
|
530 | + if ($module == 'module') continue; |
|
531 | 531 | $this->installModule($module, sprintf('./modules/%s', $module)); |
532 | 532 | |
533 | 533 | $oModule = getClass($module); |
534 | - if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
534 | + if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
535 | 535 | { |
536 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
536 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | } |
@@ -555,31 +555,31 @@ discard block |
||
555 | 555 | $schema_files = FileHandler::readDir($schema_dir, NULL, false, true); |
556 | 556 | |
557 | 557 | $file_cnt = count($schema_files); |
558 | - for($i=0;$i<$file_cnt;$i++) |
|
558 | + for ($i = 0; $i < $file_cnt; $i++) |
|
559 | 559 | { |
560 | 560 | $file = trim($schema_files[$i]); |
561 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
561 | + if (!$file || substr($file, -4) != '.xml') continue; |
|
562 | 562 | $output = $oDB->createTableByXmlFile($file); |
563 | - if($output === false) |
|
563 | + if ($output === false) |
|
564 | 564 | throw new Exception('msg_create_table_failed'); |
565 | 565 | } |
566 | 566 | // Create a table and module instance and then execute install() method |
567 | 567 | unset($oModule); |
568 | 568 | $oModule = getClass($module); |
569 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
569 | + if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
570 | 570 | return new Object(); |
571 | 571 | } |
572 | 572 | |
573 | 573 | function _getDBConfigFileContents($db_info) |
574 | 574 | { |
575 | - if(substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
575 | + if (substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
576 | 576 | { |
577 | 577 | $db_info->master_db['db_table_prefix'] .= '_'; |
578 | 578 | } |
579 | 579 | |
580 | - foreach($db_info->slave_db as &$slave) |
|
580 | + foreach ($db_info->slave_db as &$slave) |
|
581 | 581 | { |
582 | - if(substr($slave['db_table_prefix'], -1) != '_') |
|
582 | + if (substr($slave['db_table_prefix'], -1) != '_') |
|
583 | 583 | { |
584 | 584 | $slave['db_table_prefix'] .= '_'; |
585 | 585 | } |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | |
588 | 588 | $buff = array(); |
589 | 589 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
590 | - $buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';'; |
|
590 | + $buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';'; |
|
591 | 591 | |
592 | 592 | return implode(PHP_EOL, $buff); |
593 | 593 | } |
@@ -601,13 +601,13 @@ discard block |
||
601 | 601 | $db_tmp_config_file = $this->db_tmp_config_file; |
602 | 602 | |
603 | 603 | $db_info = Context::getDBInfo(); |
604 | - if(!$db_info) return; |
|
604 | + if (!$db_info) return; |
|
605 | 605 | |
606 | 606 | $buff = $this->_getDBConfigFileContents($db_info); |
607 | 607 | |
608 | 608 | FileHandler::writeFile($db_tmp_config_file, $buff); |
609 | 609 | |
610 | - if(@file_exists($db_tmp_config_file)) return true; |
|
610 | + if (@file_exists($db_tmp_config_file)) return true; |
|
611 | 611 | return false; |
612 | 612 | } |
613 | 613 | |
@@ -620,14 +620,14 @@ discard block |
||
620 | 620 | $etc_tmp_config_file = $this->etc_tmp_config_file; |
621 | 621 | |
622 | 622 | $buff = '<?php if(!defined("__XE__")) exit();'."\n"; |
623 | - foreach($config_info as $key => $val) |
|
623 | + foreach ($config_info as $key => $val) |
|
624 | 624 | { |
625 | - $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
625 | + $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
629 | 629 | |
630 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
630 | + if (@file_exists($etc_tmp_config_file)) return true; |
|
631 | 631 | return false; |
632 | 632 | } |
633 | 633 | |
@@ -642,13 +642,13 @@ discard block |
||
642 | 642 | //if(file_exists($config_file)) return; |
643 | 643 | |
644 | 644 | $db_info = Context::getDBInfo(); |
645 | - if(!$db_info) return; |
|
645 | + if (!$db_info) return; |
|
646 | 646 | |
647 | 647 | $buff = $this->_getDBConfigFileContents($db_info); |
648 | 648 | |
649 | 649 | FileHandler::writeFile($config_file, $buff); |
650 | 650 | |
651 | - if(@file_exists($config_file)) |
|
651 | + if (@file_exists($config_file)) |
|
652 | 652 | { |
653 | 653 | FileHandler::removeFile($this->db_tmp_config_file); |
654 | 654 | FileHandler::removeFile($this->etc_tmp_config_file); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | function installByConfig($install_config_file) |
664 | 664 | { |
665 | 665 | include $install_config_file; |
666 | - if(!is_array($auto_config)) return false; |
|
666 | + if (!is_array($auto_config)) return false; |
|
667 | 667 | |
668 | 668 | $auto_config['module'] = 'install'; |
669 | 669 | $auto_config['act'] = 'procInstall'; |
@@ -671,22 +671,22 @@ discard block |
||
671 | 671 | $fstr = "<%s><![CDATA[%s]]></%s>\r\n"; |
672 | 672 | $fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n"; |
673 | 673 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
674 | - foreach($auto_config as $k => $v) |
|
674 | + foreach ($auto_config as $k => $v) |
|
675 | 675 | { |
676 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
676 | + if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k); |
|
677 | 677 | } |
678 | 678 | $body .= "</params>\r\n</methodCall>"; |
679 | 679 | |
680 | - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body); |
|
680 | + $header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body); |
|
681 | 681 | $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5); |
682 | 682 | |
683 | - if($fp) |
|
683 | + if ($fp) |
|
684 | 684 | { |
685 | 685 | fputs($fp, $header); |
686 | - while(!feof($fp)) |
|
686 | + while (!feof($fp)) |
|
687 | 687 | { |
688 | 688 | $line = trim(fgets($fp, 4096)); |
689 | - if(strncmp('<error>', $line, 7) === 0) |
|
689 | + if (strncmp('<error>', $line, 7) === 0) |
|
690 | 690 | { |
691 | 691 | fclose($fp); |
692 | 692 | return false; |