@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param string $module_name The module name to get a instance |
| 75 | 75 | * @param string $type disp, proc, controller, class |
| 76 | 76 | * @param string $kind admin, null |
| 77 | - * @return mixed Module instance |
|
| 77 | + * @return ModuleObject Module instance |
|
| 78 | 78 | */ |
| 79 | 79 | function getModule($module_name, $type = 'view', $kind = '') |
| 80 | 80 | { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * Create a controller instance of the module |
| 86 | 86 | * |
| 87 | 87 | * @param string $module_name The module name to get a controller instance |
| 88 | - * @return mixed Module controller instance |
|
| 88 | + * @return ModuleObject Module controller instance |
|
| 89 | 89 | */ |
| 90 | 90 | function getController($module_name) |
| 91 | 91 | { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * Create a admin controller instance of the module |
| 97 | 97 | * |
| 98 | 98 | * @param string $module_name The module name to get a admin controller instance |
| 99 | - * @return mixed Module admin controller instance |
|
| 99 | + * @return ModuleObject Module admin controller instance |
|
| 100 | 100 | */ |
| 101 | 101 | function getAdminController($module_name) |
| 102 | 102 | { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * Create a view instance of the module |
| 108 | 108 | * |
| 109 | 109 | * @param string $module_name The module name to get a view instance |
| 110 | - * @return mixed Module view instance |
|
| 110 | + * @return ModuleObject Module view instance |
|
| 111 | 111 | */ |
| 112 | 112 | function getView($module_name) |
| 113 | 113 | { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * Create a mobile instance of the module |
| 119 | 119 | * |
| 120 | 120 | * @param string $module_name The module name to get a mobile instance |
| 121 | - * @return mixed Module mobile instance |
|
| 121 | + * @return ModuleObject Module mobile instance |
|
| 122 | 122 | */ |
| 123 | 123 | function &getMobile($module_name) |
| 124 | 124 | { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * Create a admin view instance of the module |
| 130 | 130 | * |
| 131 | 131 | * @param string $module_name The module name to get a admin view instance |
| 132 | - * @return mixed Module admin view instance |
|
| 132 | + * @return ModuleObject Module admin view instance |
|
| 133 | 133 | */ |
| 134 | 134 | function getAdminView($module_name) |
| 135 | 135 | { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * Create a model instance of the module |
| 141 | 141 | * |
| 142 | 142 | * @param string $module_name The module name to get a model instance |
| 143 | - * @return mixed Module model instance |
|
| 143 | + * @return ModuleObject Module model instance |
|
| 144 | 144 | */ |
| 145 | 145 | function getModel($module_name) |
| 146 | 146 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * Create an admin model instance of the module |
| 152 | 152 | * |
| 153 | 153 | * @param string $module_name The module name to get a admin model instance |
| 154 | - * @return mixed Module admin model instance |
|
| 154 | + * @return ModuleObject Module admin model instance |
|
| 155 | 155 | */ |
| 156 | 156 | function getAdminModel($module_name) |
| 157 | 157 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * Create an api instance of the module |
| 163 | 163 | * |
| 164 | 164 | * @param string $module_name The module name to get a api instance |
| 165 | - * @return mixed Module api class instance |
|
| 165 | + * @return ModuleObject Module api class instance |
|
| 166 | 166 | */ |
| 167 | 167 | function getAPI($module_name) |
| 168 | 168 | { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * Create a wap instance of the module |
| 174 | 174 | * |
| 175 | 175 | * @param string $module_name The module name to get a wap instance |
| 176 | - * @return mixed Module wap class instance |
|
| 176 | + * @return ModuleObject Module wap class instance |
|
| 177 | 177 | */ |
| 178 | 178 | function getWAP($module_name) |
| 179 | 179 | { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * Create a class instance of the module |
| 185 | 185 | * |
| 186 | 186 | * @param string $module_name The module name to get a class instance |
| 187 | - * @return mixed Module class instance |
|
| 187 | + * @return ModuleObject Module class instance |
|
| 188 | 188 | */ |
| 189 | 189 | function getClass($module_name) |
| 190 | 190 | { |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * Return if domain of the virtual site is url type or id type |
| 488 | 488 | * |
| 489 | 489 | * @param string $domain |
| 490 | - * @return bool |
|
| 490 | + * @return integer |
|
| 491 | 491 | */ |
| 492 | 492 | function isSiteID($domain) |
| 493 | 493 | { |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | /** |
| 557 | 557 | * Get a time gap between server's timezone and XE's timezone |
| 558 | 558 | * |
| 559 | - * @return int |
|
| 559 | + * @return double |
|
| 560 | 560 | */ |
| 561 | 561 | function zgap() |
| 562 | 562 | { |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | * YYYYMMDDHHIISS format changed to unix time value |
| 598 | 598 | * |
| 599 | 599 | * @param string $str Time value in format of YYYYMMDDHHIISS |
| 600 | - * @return int |
|
| 600 | + * @return null|double |
|
| 601 | 601 | */ |
| 602 | 602 | function ztime($str) |
| 603 | 603 | { |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | * Display $buff contents into the file ./files/_debug_message.php. |
| 791 | 791 | * You can see the file on your prompt by command: tail-f./files/_debug_message.php |
| 792 | 792 | * |
| 793 | - * @param mixed $debug_output Target object to be printed |
|
| 793 | + * @param string $debug_output Target object to be printed |
|
| 794 | 794 | * @param bool $display_option boolean Flag whether to print seperator (default:true) |
| 795 | 795 | * @param string $file Target file name |
| 796 | 796 | * @return void |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | /** |
| 885 | 885 | * @param string $type query, trigger |
| 886 | 886 | * @param float $elapsed_time |
| 887 | - * @param object $obj |
|
| 887 | + * @param stdClass $obj |
|
| 888 | 888 | */ |
| 889 | 889 | function writeSlowlog($type, $elapsed_time, $obj) |
| 890 | 890 | { |
@@ -1631,6 +1631,9 @@ discard block |
||
| 1631 | 1631 | } |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | +/** |
|
| 1635 | + * @param string $key |
|
| 1636 | + */ |
|
| 1634 | 1637 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
| 1635 | 1638 | { |
| 1636 | 1639 | if($requestKey != $dbKey) |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param string $target_dir Path of target dir |
| 35 | 35 | * @param string $filter Regex to filter files. If file matches this regex, the file is not copied. |
| 36 | 36 | * @param string $type If set as 'force'. Even if the file exists in target, the file is copied. |
| 37 | - * @return void |
|
| 37 | + * @return false|null |
|
| 38 | 38 | */ |
| 39 | 39 | function copyDir($source_dir, $target_dir, $filter = null, $type = null) |
| 40 | 40 | { |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * This function creates directories recursively, which means that if ancestors of the target directory does not exist, they will be created too. |
| 278 | 278 | * |
| 279 | 279 | * @param string $path_string Path of target directory |
| 280 | - * @return bool TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed. |
|
| 280 | + * @return boolean|null TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed. |
|
| 281 | 281 | */ |
| 282 | 282 | function makeDir($path_string) |
| 283 | 283 | { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | * @param string $url The address of the target file |
| 668 | 668 | * @param string $target_filename The location to store |
| 669 | 669 | * @param string $body HTTP request body |
| 670 | - * @param string $timeout Connection timeout |
|
| 670 | + * @param integer $timeout Connection timeout |
|
| 671 | 671 | * @param string $method GET/POST |
| 672 | 672 | * @param string $content_type Content type header of HTTP request |
| 673 | 673 | * @param string[] $headers Headers key value array. |
@@ -700,8 +700,8 @@ discard block |
||
| 700 | 700 | * Convert size in string into numeric value |
| 701 | 701 | * |
| 702 | 702 | * @see self::filesize() |
| 703 | - * @param $val Size in string (ex., 10, 10K, 10M, 10G ) |
|
| 704 | - * @return int converted size |
|
| 703 | + * @param string $val Size in string (ex., 10, 10K, 10M, 10G ) |
|
| 704 | + * @return double converted size |
|
| 705 | 705 | */ |
| 706 | 706 | function returnBytes($val) |
| 707 | 707 | { |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | * @param string $target_type If $target_type is set (gif, jpg, png, bmp), result image will be saved as target type |
| 753 | 753 | * @param string $thumbnail_type Thumbnail type(crop, ratio) |
| 754 | 754 | * @param bool $thumbnail_transparent If $target_type is png, set background set transparent color |
| 755 | - * @return bool TRUE: success, FALSE: failed |
|
| 755 | + * @return null|boolean TRUE: success, FALSE: failed |
|
| 756 | 756 | */ |
| 757 | 757 | function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop', $thumbnail_transparent = FALSE) |
| 758 | 758 | { |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | * Check file exists. |
| 1083 | 1083 | * |
| 1084 | 1084 | * @param string $filename Target file name |
| 1085 | - * @return bool Returns FALSE if the file does not exists, or Returns full path file(string). |
|
| 1085 | + * @return string|false Returns FALSE if the file does not exists, or Returns full path file(string). |
|
| 1086 | 1086 | */ |
| 1087 | 1087 | function exists($filename) |
| 1088 | 1088 | { |
@@ -1093,8 +1093,8 @@ discard block |
||
| 1093 | 1093 | /** |
| 1094 | 1094 | * Check it is dir |
| 1095 | 1095 | * |
| 1096 | - * @param string $dir Target dir path |
|
| 1097 | - * @return bool Returns FALSE if the dir is not dir, or Returns full path of dir(string). |
|
| 1096 | + * @param string $path |
|
| 1097 | + * @return string|false Returns FALSE if the dir is not dir, or Returns full path of dir(string). |
|
| 1098 | 1098 | */ |
| 1099 | 1099 | function isDir($path) |
| 1100 | 1100 | { |
@@ -74,14 +74,12 @@ discard block |
||
| 74 | 74 | if(is_dir($source_dir . $file)) |
| 75 | 75 | { |
| 76 | 76 | self::copyDir($source_dir . $file, $target_dir . $file, $type); |
| 77 | - } |
|
| 78 | - else |
|
| 77 | + } else |
|
| 79 | 78 | { |
| 80 | 79 | if($type == 'force') |
| 81 | 80 | { |
| 82 | 81 | @unlink($target_dir . $file); |
| 83 | - } |
|
| 84 | - else |
|
| 82 | + } else |
|
| 85 | 83 | { |
| 86 | 84 | if(!file_exists($target_dir . $file)) |
| 87 | 85 | { |
@@ -381,15 +379,13 @@ discard block |
||
| 381 | 379 | if(is_dir($target)) |
| 382 | 380 | { |
| 383 | 381 | self::removeDir($target); |
| 384 | - } |
|
| 385 | - else |
|
| 382 | + } else |
|
| 386 | 383 | { |
| 387 | 384 | unlink($target); |
| 388 | 385 | } |
| 389 | 386 | } |
| 390 | 387 | rmdir($path); |
| 391 | - } |
|
| 392 | - else |
|
| 388 | + } else |
|
| 393 | 389 | { |
| 394 | 390 | unlink($path); |
| 395 | 391 | } |
@@ -456,16 +452,16 @@ discard block |
||
| 456 | 452 | if(is_dir($target)) |
| 457 | 453 | { |
| 458 | 454 | self::removeFilesInDir($target); |
| 459 | - } |
|
| 460 | - else |
|
| 455 | + } else |
|
| 461 | 456 | { |
| 462 | 457 | unlink($target); |
| 463 | 458 | } |
| 464 | 459 | } |
| 465 | - } |
|
| 466 | - else |
|
| 460 | + } else |
|
| 467 | 461 | { |
| 468 | - if(self::exists($path)) unlink($path); |
|
| 462 | + if(self::exists($path)) { |
|
| 463 | + unlink($path); |
|
| 464 | + } |
|
| 469 | 465 | } |
| 470 | 466 | |
| 471 | 467 | } |
@@ -535,8 +531,7 @@ discard block |
||
| 535 | 531 | $oRequest = new HTTP_Request(__PROXY_SERVER__); |
| 536 | 532 | $oRequest->setMethod('POST'); |
| 537 | 533 | $oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers, "post_data" => $post_data))); |
| 538 | - } |
|
| 539 | - else |
|
| 534 | + } else |
|
| 540 | 535 | { |
| 541 | 536 | $oRequest = new HTTP_Request($url); |
| 542 | 537 | |
@@ -560,8 +555,7 @@ discard block |
||
| 560 | 555 | { |
| 561 | 556 | $oRequest->attach($observer); |
| 562 | 557 | } |
| 563 | - } |
|
| 564 | - else |
|
| 558 | + } else |
|
| 565 | 559 | { |
| 566 | 560 | $oRequest->setConfig($key, $val); |
| 567 | 561 | } |
@@ -572,8 +566,7 @@ discard block |
||
| 572 | 566 | if(extension_loaded('curl')) |
| 573 | 567 | { |
| 574 | 568 | $oRequest->setConfig('adapter', 'curl'); |
| 575 | - } |
|
| 576 | - elseif(version_compare(PHP_VERSION, '5.6', '<')) |
|
| 569 | + } elseif(version_compare(PHP_VERSION, '5.6', '<')) |
|
| 577 | 570 | { |
| 578 | 571 | $oRequest->setConfig('ssl_verify_host', false); |
| 579 | 572 | } |
@@ -605,20 +598,21 @@ discard block |
||
| 605 | 598 | $oRequest->addPostData($key, $val); |
| 606 | 599 | } |
| 607 | 600 | } |
| 608 | - if(!$content_type) |
|
| 609 | - $oRequest->addHeader('Content-Type', 'text/html'); |
|
| 610 | - else |
|
| 611 | - $oRequest->addHeader('Content-Type', $content_type); |
|
| 601 | + if(!$content_type) { |
|
| 602 | + $oRequest->addHeader('Content-Type', 'text/html'); |
|
| 603 | + } else { |
|
| 604 | + $oRequest->addHeader('Content-Type', $content_type); |
|
| 605 | + } |
|
| 612 | 606 | $oRequest->setMethod($method); |
| 613 | - if($body) |
|
| 614 | - $oRequest->setBody($body); |
|
| 607 | + if($body) { |
|
| 608 | + $oRequest->setBody($body); |
|
| 609 | + } |
|
| 615 | 610 | } |
| 616 | 611 | |
| 617 | 612 | if(method_exists($oRequest, 'setConfig')) |
| 618 | 613 | { |
| 619 | 614 | $oRequest->setConfig('timeout', $timeout); |
| 620 | - } |
|
| 621 | - elseif(property_exists($oRequest, '_timeout')) |
|
| 615 | + } elseif(property_exists($oRequest, '_timeout')) |
|
| 622 | 616 | { |
| 623 | 617 | $oRequest->_timeout = $timeout; |
| 624 | 618 | } |
@@ -649,13 +643,11 @@ discard block |
||
| 649 | 643 | if(isset($request_config['store_body']) && !$request_config['store_body']) |
| 650 | 644 | { |
| 651 | 645 | return TRUE; |
| 652 | - } |
|
| 653 | - else |
|
| 646 | + } else |
|
| 654 | 647 | { |
| 655 | 648 | return $response; |
| 656 | 649 | } |
| 657 | - } |
|
| 658 | - catch(Exception $e) |
|
| 650 | + } catch(Exception $e) |
|
| 659 | 651 | { |
| 660 | 652 | return NULL; |
| 661 | 653 | } |
@@ -688,8 +680,7 @@ discard block |
||
| 688 | 680 | $result = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config); |
| 689 | 681 | self::clearStatCache($target_filename); |
| 690 | 682 | self::invalidateOpcache($target_filename); |
| 691 | - } |
|
| 692 | - catch(Exception $e) |
|
| 683 | + } catch(Exception $e) |
|
| 693 | 684 | { |
| 694 | 685 | return FALSE; |
| 695 | 686 | } |
@@ -820,8 +811,7 @@ discard block |
||
| 820 | 811 | $per = ($width_per > $height_per) ? $height_per : $width_per; |
| 821 | 812 | $resize_width = $width * $per; |
| 822 | 813 | $resize_height = $height * $per; |
| 823 | - } |
|
| 824 | - else |
|
| 814 | + } else |
|
| 825 | 815 | { |
| 826 | 816 | $per = ($width_per < $height_per) ? $height_per : $width_per; |
| 827 | 817 | } |
@@ -831,8 +821,7 @@ discard block |
||
| 831 | 821 | if(function_exists('imagecreateTRUEcolor')) |
| 832 | 822 | { |
| 833 | 823 | $thumb = imagecreateTRUEcolor($resize_width, $resize_height); |
| 834 | - } |
|
| 835 | - else if(function_exists('imagecreate')) |
|
| 824 | + } else if(function_exists('imagecreate')) |
|
| 836 | 825 | { |
| 837 | 826 | $thumb = imagecreate($resize_width, $resize_height); |
| 838 | 827 | } |
@@ -855,8 +844,7 @@ discard block |
||
| 855 | 844 | { |
| 856 | 845 | imagealphablending($thumb, TRUE); |
| 857 | 846 | } |
| 858 | - } |
|
| 859 | - else |
|
| 847 | + } else |
|
| 860 | 848 | { |
| 861 | 849 | imagefilledrectangle($thumb, 0, 0, $resize_width - 1, $resize_height - 1, imagecolorallocate($thumb, 255, 255, 255)); |
| 862 | 850 | } |
@@ -914,8 +902,7 @@ discard block |
||
| 914 | 902 | if(function_exists('imagecopyresampled')) |
| 915 | 903 | { |
| 916 | 904 | imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); |
| 917 | - } |
|
| 918 | - else |
|
| 905 | + } else |
|
| 919 | 906 | { |
| 920 | 907 | imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); |
| 921 | 908 | } |
@@ -984,8 +971,7 @@ discard block |
||
| 984 | 971 | if(is_array($arr) && count($arr) > 0) |
| 985 | 972 | { |
| 986 | 973 | return $arr; |
| 987 | - } |
|
| 988 | - else |
|
| 974 | + } else |
|
| 989 | 975 | { |
| 990 | 976 | return array(); |
| 991 | 977 | } |
@@ -1035,12 +1021,10 @@ discard block |
||
| 1035 | 1021 | $return[] = sprintf("%s=\"%s\"", $k, $v); |
| 1036 | 1022 | } |
| 1037 | 1023 | // value |
| 1038 | - } |
|
| 1039 | - else if(is_object($val)) |
|
| 1024 | + } else if(is_object($val)) |
|
| 1040 | 1025 | { |
| 1041 | 1026 | continue; |
| 1042 | - } |
|
| 1043 | - else |
|
| 1027 | + } else |
|
| 1044 | 1028 | { |
| 1045 | 1029 | $return[] = sprintf("%s=\"%s\"", $key, $val); |
| 1046 | 1030 | } |
@@ -1182,8 +1166,7 @@ discard block |
||
| 1182 | 1166 | if(substr($target, -4) === '.php') |
| 1183 | 1167 | { |
| 1184 | 1168 | opcache_invalidate(self::getRealPath($target), $force); |
| 1185 | - } |
|
| 1186 | - else if($path = self::isDir($target)) |
|
| 1169 | + } else if($path = self::isDir($target)) |
|
| 1187 | 1170 | { |
| 1188 | 1171 | self::invalidateOpcache(self::readDir($path, '', false, true)); |
| 1189 | 1172 | } |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function getRealPath($source) |
| 19 | 19 | { |
| 20 | - if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0) |
|
| 20 | + if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0) |
|
| 21 | 21 | { |
| 22 | - return _XE_PATH_ . substr($source, 2); |
|
| 22 | + return _XE_PATH_.substr($source, 2); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | return $source; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $source_dir = self::getRealPath($source_dir); |
| 42 | 42 | $target_dir = self::getRealPath($target_dir); |
| 43 | - if(!is_dir($source_dir)) |
|
| 43 | + if (!is_dir($source_dir)) |
|
| 44 | 44 | { |
| 45 | 45 | return FALSE; |
| 46 | 46 | } |
@@ -48,44 +48,44 @@ discard block |
||
| 48 | 48 | // generate when no target exists |
| 49 | 49 | self::makeDir($target_dir); |
| 50 | 50 | |
| 51 | - if(substr($source_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 51 | + if (substr($source_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 52 | 52 | { |
| 53 | 53 | $source_dir .= DIRECTORY_SEPARATOR; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(substr($target_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 56 | + if (substr($target_dir, -1) != DIRECTORY_SEPARATOR) |
|
| 57 | 57 | { |
| 58 | 58 | $target_dir .= DIRECTORY_SEPARATOR; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $oDir = dir($source_dir); |
| 62 | - while($file = $oDir->read()) |
|
| 62 | + while ($file = $oDir->read()) |
|
| 63 | 63 | { |
| 64 | - if($file{0} == '.') |
|
| 64 | + if ($file{0} == '.') |
|
| 65 | 65 | { |
| 66 | 66 | continue; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if($filter && preg_match($filter, $file)) |
|
| 69 | + if ($filter && preg_match($filter, $file)) |
|
| 70 | 70 | { |
| 71 | 71 | continue; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if(is_dir($source_dir . $file)) |
|
| 74 | + if (is_dir($source_dir.$file)) |
|
| 75 | 75 | { |
| 76 | - self::copyDir($source_dir . $file, $target_dir . $file, $type); |
|
| 76 | + self::copyDir($source_dir.$file, $target_dir.$file, $type); |
|
| 77 | 77 | } |
| 78 | 78 | else |
| 79 | 79 | { |
| 80 | - if($type == 'force') |
|
| 80 | + if ($type == 'force') |
|
| 81 | 81 | { |
| 82 | - @unlink($target_dir . $file); |
|
| 82 | + @unlink($target_dir.$file); |
|
| 83 | 83 | } |
| 84 | 84 | else |
| 85 | 85 | { |
| 86 | - if(!file_exists($target_dir . $file)) |
|
| 86 | + if (!file_exists($target_dir.$file)) |
|
| 87 | 87 | { |
| 88 | - @copy($source_dir . $file, $target_dir . $file); |
|
| 88 | + @copy($source_dir.$file, $target_dir.$file); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | self::makeDir($target_dir); |
| 112 | 112 | |
| 113 | - if($force == 'Y') |
|
| 113 | + if ($force == 'Y') |
|
| 114 | 114 | { |
| 115 | - @unlink($target_dir . DIRECTORY_SEPARATOR . $target); |
|
| 115 | + @unlink($target_dir.DIRECTORY_SEPARATOR.$target); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - @copy($source, $target_dir . DIRECTORY_SEPARATOR . $target); |
|
| 118 | + @copy($source, $target_dir.DIRECTORY_SEPARATOR.$target); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | function readFile($filename) |
| 128 | 128 | { |
| 129 | - if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1) |
|
| 129 | + if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1) |
|
| 130 | 130 | { |
| 131 | 131 | return; |
| 132 | 132 | } |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | self::makeDir($pathinfo['dirname']); |
| 150 | 150 | |
| 151 | 151 | $flags = 0; |
| 152 | - if(strtolower($mode) == 'a') |
|
| 152 | + if (strtolower($mode) == 'a') |
|
| 153 | 153 | { |
| 154 | 154 | $flags = FILE_APPEND; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - @file_put_contents($filename, $buff, $flags|LOCK_EX); |
|
| 157 | + @file_put_contents($filename, $buff, $flags | LOCK_EX); |
|
| 158 | 158 | @chmod($filename, 0644); |
| 159 | 159 | self::clearStatCache($filename); |
| 160 | 160 | self::invalidateOpcache($filename); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | function moveFile($source, $target) |
| 196 | 196 | { |
| 197 | - if(($source = self::exists($source)) !== FALSE) |
|
| 197 | + if (($source = self::exists($source)) !== FALSE) |
|
| 198 | 198 | { |
| 199 | 199 | self::removeFile($target); |
| 200 | 200 | return self::rename($source, $target); |
@@ -232,35 +232,35 @@ discard block |
||
| 232 | 232 | $path = self::getRealPath($path); |
| 233 | 233 | $output = array(); |
| 234 | 234 | |
| 235 | - if(substr($path, -1) != '/') |
|
| 235 | + if (substr($path, -1) != '/') |
|
| 236 | 236 | { |
| 237 | 237 | $path .= '/'; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if(!is_dir($path)) |
|
| 240 | + if (!is_dir($path)) |
|
| 241 | 241 | { |
| 242 | 242 | return $output; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | $files = scandir($path); |
| 246 | - foreach($files as $file) |
|
| 246 | + foreach ($files as $file) |
|
| 247 | 247 | { |
| 248 | - if($file{0} == '.' || ($filter && !preg_match($filter, $file))) |
|
| 248 | + if ($file{0} == '.' || ($filter && !preg_match($filter, $file))) |
|
| 249 | 249 | { |
| 250 | 250 | continue; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if($to_lower) |
|
| 253 | + if ($to_lower) |
|
| 254 | 254 | { |
| 255 | 255 | $file = strtolower($file); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if($filter) |
|
| 258 | + if ($filter) |
|
| 259 | 259 | { |
| 260 | 260 | $file = preg_replace($filter, '$1', $file); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - if($concat_prefix) |
|
| 263 | + if ($concat_prefix) |
|
| 264 | 264 | { |
| 265 | 265 | $file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file); |
| 266 | 266 | } |
@@ -281,12 +281,12 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | function makeDir($path_string) |
| 283 | 283 | { |
| 284 | - if(self::exists($path_string) !== FALSE) |
|
| 284 | + if (self::exists($path_string) !== FALSE) |
|
| 285 | 285 | { |
| 286 | 286 | return TRUE; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if(!ini_get('safe_mode')) |
|
| 289 | + if (!ini_get('safe_mode')) |
|
| 290 | 290 | { |
| 291 | 291 | @mkdir($path_string, 0755, TRUE); |
| 292 | 292 | @chmod($path_string, 0755); |
@@ -297,35 +297,35 @@ discard block |
||
| 297 | 297 | static $oFtp = NULL; |
| 298 | 298 | |
| 299 | 299 | $ftp_info = Context::getFTPInfo(); |
| 300 | - if($oFtp == NULL) |
|
| 300 | + if ($oFtp == NULL) |
|
| 301 | 301 | { |
| 302 | - if(!Context::isFTPRegisted()) |
|
| 302 | + if (!Context::isFTPRegisted()) |
|
| 303 | 303 | { |
| 304 | 304 | return; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
| 307 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
| 308 | 308 | $oFtp = new ftp(); |
| 309 | - if(!$ftp_info->ftp_host) |
|
| 309 | + if (!$ftp_info->ftp_host) |
|
| 310 | 310 | { |
| 311 | 311 | $ftp_info->ftp_host = "127.0.0.1"; |
| 312 | 312 | } |
| 313 | - if(!$ftp_info->ftp_port) |
|
| 313 | + if (!$ftp_info->ftp_port) |
|
| 314 | 314 | { |
| 315 | 315 | $ftp_info->ftp_port = 21; |
| 316 | 316 | } |
| 317 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
| 317 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
| 318 | 318 | { |
| 319 | 319 | return; |
| 320 | 320 | } |
| 321 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 321 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 322 | 322 | { |
| 323 | 323 | $oFtp->ftp_quit(); |
| 324 | 324 | return; |
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - if(!($ftp_path = $ftp_info->ftp_root_path)) |
|
| 328 | + if (!($ftp_path = $ftp_info->ftp_root_path)) |
|
| 329 | 329 | { |
| 330 | 330 | $ftp_path = DIRECTORY_SEPARATOR; |
| 331 | 331 | } |
@@ -334,19 +334,19 @@ discard block |
||
| 334 | 334 | $path_list = explode(DIRECTORY_SEPARATOR, $path_string); |
| 335 | 335 | |
| 336 | 336 | $path = _XE_PATH_; |
| 337 | - for($i = 0, $c = count($path_list); $i < $c; $i++) |
|
| 337 | + for ($i = 0, $c = count($path_list); $i < $c; $i++) |
|
| 338 | 338 | { |
| 339 | - if(!$path_list[$i]) |
|
| 339 | + if (!$path_list[$i]) |
|
| 340 | 340 | { |
| 341 | 341 | continue; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - $path .= $path_list[$i] . DIRECTORY_SEPARATOR; |
|
| 345 | - $ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR; |
|
| 346 | - if(!is_dir($path)) |
|
| 344 | + $path .= $path_list[$i].DIRECTORY_SEPARATOR; |
|
| 345 | + $ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR; |
|
| 346 | + if (!is_dir($path)) |
|
| 347 | 347 | { |
| 348 | 348 | $oFtp->ftp_mkdir($ftp_path); |
| 349 | - $oFtp->ftp_site("CHMOD 777 " . $ftp_path); |
|
| 349 | + $oFtp->ftp_site("CHMOD 777 ".$ftp_path); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | } |
@@ -362,23 +362,23 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | function removeDir($path) |
| 364 | 364 | { |
| 365 | - if(($path = self::isDir($path)) === FALSE) |
|
| 365 | + if (($path = self::isDir($path)) === FALSE) |
|
| 366 | 366 | { |
| 367 | 367 | return; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if(self::isDir($path)) |
|
| 370 | + if (self::isDir($path)) |
|
| 371 | 371 | { |
| 372 | 372 | $files = array_diff(scandir($path), array('..', '.')); |
| 373 | 373 | |
| 374 | - foreach($files as $file) |
|
| 374 | + foreach ($files as $file) |
|
| 375 | 375 | { |
| 376 | - if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE) |
|
| 376 | + if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE) |
|
| 377 | 377 | { |
| 378 | 378 | continue; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - if(is_dir($target)) |
|
| 381 | + if (is_dir($target)) |
|
| 382 | 382 | { |
| 383 | 383 | self::removeDir($target); |
| 384 | 384 | } |
@@ -403,22 +403,22 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | function removeBlankDir($path) |
| 405 | 405 | { |
| 406 | - if(($path = self::isDir($path)) === FALSE) |
|
| 406 | + if (($path = self::isDir($path)) === FALSE) |
|
| 407 | 407 | { |
| 408 | 408 | return; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | $files = array_diff(scandir($path), array('..', '.')); |
| 412 | 412 | |
| 413 | - if(count($files) < 1) |
|
| 413 | + if (count($files) < 1) |
|
| 414 | 414 | { |
| 415 | 415 | rmdir($path); |
| 416 | 416 | return; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - foreach($files as $file) |
|
| 419 | + foreach ($files as $file) |
|
| 420 | 420 | { |
| 421 | - if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE) |
|
| 421 | + if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE) |
|
| 422 | 422 | { |
| 423 | 423 | continue; |
| 424 | 424 | } |
@@ -437,23 +437,23 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | function removeFilesInDir($path) |
| 439 | 439 | { |
| 440 | - if(($path = self::getRealPath($path)) === FALSE) |
|
| 440 | + if (($path = self::getRealPath($path)) === FALSE) |
|
| 441 | 441 | { |
| 442 | 442 | return; |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if(is_dir($path)) |
|
| 445 | + if (is_dir($path)) |
|
| 446 | 446 | { |
| 447 | 447 | $files = array_diff(scandir($path), array('..', '.')); |
| 448 | 448 | |
| 449 | - foreach($files as $file) |
|
| 449 | + foreach ($files as $file) |
|
| 450 | 450 | { |
| 451 | - if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE) |
|
| 451 | + if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE) |
|
| 452 | 452 | { |
| 453 | 453 | continue; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - if(is_dir($target)) |
|
| 456 | + if (is_dir($target)) |
|
| 457 | 457 | { |
| 458 | 458 | self::removeFilesInDir($target); |
| 459 | 459 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | else |
| 467 | 467 | { |
| 468 | - if(self::exists($path)) unlink($path); |
|
| 468 | + if (self::exists($path)) unlink($path); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | } |
@@ -479,22 +479,22 @@ discard block |
||
| 479 | 479 | */ |
| 480 | 480 | function filesize($size) |
| 481 | 481 | { |
| 482 | - if(!$size) |
|
| 482 | + if (!$size) |
|
| 483 | 483 | { |
| 484 | 484 | return '0Byte'; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | - if($size === 1) |
|
| 487 | + if ($size === 1) |
|
| 488 | 488 | { |
| 489 | 489 | return '1Byte'; |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if($size < 1024) |
|
| 492 | + if ($size < 1024) |
|
| 493 | 493 | { |
| 494 | - return $size . 'Bytes'; |
|
| 494 | + return $size.'Bytes'; |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - if($size >= 1024 && $size < 1024 * 1024) |
|
| 497 | + if ($size >= 1024 && $size < 1024 * 1024) |
|
| 498 | 498 | { |
| 499 | 499 | return sprintf("%0.1fKB", $size / 1024); |
| 500 | 500 | } |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | */ |
| 520 | 520 | function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array()) |
| 521 | 521 | { |
| 522 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 522 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 523 | 523 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 524 | 524 | $url = $IDN->encode($url); |
| 525 | 525 | |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | require_once('HTTP/Request.php'); |
| 530 | 530 | |
| 531 | 531 | $parsed_url = parse_url(__PROXY_SERVER__); |
| 532 | - if($parsed_url["host"] && $parsed_url["path"]) |
|
| 532 | + if ($parsed_url["host"] && $parsed_url["path"]) |
|
| 533 | 533 | { |
| 534 | 534 | // Old style proxy server support (POST payload to proxy script) |
| 535 | 535 | $oRequest = new HTTP_Request(__PROXY_SERVER__); |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | $oRequest = new HTTP_Request($url); |
| 542 | 542 | |
| 543 | 543 | // New style proxy server support (Use HTTP_Request2 native config format) |
| 544 | - if($parsed_url['host']) |
|
| 544 | + if ($parsed_url['host']) |
|
| 545 | 545 | { |
| 546 | 546 | $request_config['proxy_host'] = $parsed_url['host']; |
| 547 | 547 | $request_config['proxy_port'] = $parsed_url['port'] ? $parsed_url['port'] : ''; |
@@ -550,13 +550,13 @@ discard block |
||
| 550 | 550 | $request_config['proxy_type'] = $parsed_url['scheme'] ? $parsed_url['scheme'] : 'http'; |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | - if(count($request_config) && method_exists($oRequest, 'setConfig')) |
|
| 553 | + if (count($request_config) && method_exists($oRequest, 'setConfig')) |
|
| 554 | 554 | { |
| 555 | - foreach($request_config as $key=>$val) |
|
| 555 | + foreach ($request_config as $key=>$val) |
|
| 556 | 556 | { |
| 557 | - if($key === 'observers') |
|
| 557 | + if ($key === 'observers') |
|
| 558 | 558 | { |
| 559 | - foreach($val as $observer) |
|
| 559 | + foreach ($val as $observer) |
|
| 560 | 560 | { |
| 561 | 561 | $oRequest->attach($observer); |
| 562 | 562 | } |
@@ -567,58 +567,58 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | - if(method_exists($oRequest, 'setConfig')) |
|
| 570 | + if (method_exists($oRequest, 'setConfig')) |
|
| 571 | 571 | { |
| 572 | - if(extension_loaded('curl')) |
|
| 572 | + if (extension_loaded('curl')) |
|
| 573 | 573 | { |
| 574 | 574 | $oRequest->setConfig('adapter', 'curl'); |
| 575 | 575 | } |
| 576 | - elseif(version_compare(PHP_VERSION, '5.6', '<')) |
|
| 576 | + elseif (version_compare(PHP_VERSION, '5.6', '<')) |
|
| 577 | 577 | { |
| 578 | 578 | $oRequest->setConfig('ssl_verify_host', false); |
| 579 | 579 | } |
| 580 | - if(file_exists(_XE_PATH_ . 'libs/cacert/cacert.pem')) |
|
| 580 | + if (file_exists(_XE_PATH_.'libs/cacert/cacert.pem')) |
|
| 581 | 581 | { |
| 582 | - $oRequest->setConfig('ssl_cafile', _XE_PATH_ . 'libs/cacert/cacert.pem'); |
|
| 582 | + $oRequest->setConfig('ssl_cafile', _XE_PATH_.'libs/cacert/cacert.pem'); |
|
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - if(count($headers) > 0) |
|
| 586 | + if (count($headers) > 0) |
|
| 587 | 587 | { |
| 588 | - foreach($headers as $key => $val) |
|
| 588 | + foreach ($headers as $key => $val) |
|
| 589 | 589 | { |
| 590 | 590 | $oRequest->addHeader($key, $val); |
| 591 | 591 | } |
| 592 | 592 | } |
| 593 | 593 | $host = parse_url($url, PHP_URL_HOST); |
| 594 | - if($cookies[$host]) |
|
| 594 | + if ($cookies[$host]) |
|
| 595 | 595 | { |
| 596 | - foreach($cookies[$host] as $key => $val) |
|
| 596 | + foreach ($cookies[$host] as $key => $val) |
|
| 597 | 597 | { |
| 598 | 598 | $oRequest->addCookie($key, $val); |
| 599 | 599 | } |
| 600 | 600 | } |
| 601 | - if(count($post_data) > 0) |
|
| 601 | + if (count($post_data) > 0) |
|
| 602 | 602 | { |
| 603 | - foreach($post_data as $key => $val) |
|
| 603 | + foreach ($post_data as $key => $val) |
|
| 604 | 604 | { |
| 605 | 605 | $oRequest->addPostData($key, $val); |
| 606 | 606 | } |
| 607 | 607 | } |
| 608 | - if(!$content_type) |
|
| 608 | + if (!$content_type) |
|
| 609 | 609 | $oRequest->addHeader('Content-Type', 'text/html'); |
| 610 | 610 | else |
| 611 | 611 | $oRequest->addHeader('Content-Type', $content_type); |
| 612 | 612 | $oRequest->setMethod($method); |
| 613 | - if($body) |
|
| 613 | + if ($body) |
|
| 614 | 614 | $oRequest->setBody($body); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - if(method_exists($oRequest, 'setConfig')) |
|
| 617 | + if (method_exists($oRequest, 'setConfig')) |
|
| 618 | 618 | { |
| 619 | 619 | $oRequest->setConfig('timeout', $timeout); |
| 620 | 620 | } |
| 621 | - elseif(property_exists($oRequest, '_timeout')) |
|
| 621 | + elseif (property_exists($oRequest, '_timeout')) |
|
| 622 | 622 | { |
| 623 | 623 | $oRequest->_timeout = $timeout; |
| 624 | 624 | } |
@@ -628,25 +628,25 @@ discard block |
||
| 628 | 628 | $code = $oRequest->getResponseCode(); |
| 629 | 629 | $header = $oRequest->getResponseHeader(); |
| 630 | 630 | $response = $oRequest->getResponseBody(); |
| 631 | - if($c = $oRequest->getResponseCookies()) |
|
| 631 | + if ($c = $oRequest->getResponseCookies()) |
|
| 632 | 632 | { |
| 633 | - foreach($c as $k => $v) |
|
| 633 | + foreach ($c as $k => $v) |
|
| 634 | 634 | { |
| 635 | 635 | $cookies[$host][$v['name']] = $v['value']; |
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | - if($code > 300 && $code < 399 && $header['location']) |
|
| 639 | + if ($code > 300 && $code < 399 && $header['location']) |
|
| 640 | 640 | { |
| 641 | 641 | return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data); |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - if($code != 200) |
|
| 644 | + if ($code != 200) |
|
| 645 | 645 | { |
| 646 | 646 | return; |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | - if(isset($request_config['store_body']) && !$request_config['store_body']) |
|
| 649 | + if (isset($request_config['store_body']) && !$request_config['store_body']) |
|
| 650 | 650 | { |
| 651 | 651 | return TRUE; |
| 652 | 652 | } |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | return $response; |
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | - catch(Exception $e) |
|
| 658 | + catch (Exception $e) |
|
| 659 | 659 | { |
| 660 | 660 | return NULL; |
| 661 | 661 | } |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | self::clearStatCache($target_filename); |
| 690 | 690 | self::invalidateOpcache($target_filename); |
| 691 | 691 | } |
| 692 | - catch(Exception $e) |
|
| 692 | + catch (Exception $e) |
|
| 693 | 693 | { |
| 694 | 694 | return FALSE; |
| 695 | 695 | } |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | function returnBytes($val) |
| 707 | 707 | { |
| 708 | 708 | $unit = strtoupper(substr($val, -1)); |
| 709 | - $val = (float)$val; |
|
| 709 | + $val = (float) $val; |
|
| 710 | 710 | |
| 711 | 711 | switch ($unit) |
| 712 | 712 | { |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | function checkMemoryLoadImage(&$imageInfo) |
| 728 | 728 | { |
| 729 | 729 | $memoryLimit = self::returnBytes(ini_get('memory_limit')); |
| 730 | - if($memoryLimit == -1) |
|
| 730 | + if ($memoryLimit == -1) |
|
| 731 | 731 | { |
| 732 | 732 | return true; |
| 733 | 733 | } |
@@ -735,14 +735,14 @@ discard block |
||
| 735 | 735 | $K64 = 65536; |
| 736 | 736 | $TWEAKFACTOR = 2.0; |
| 737 | 737 | $channels = $imageInfo['channels']; |
| 738 | - if(!$channels) |
|
| 738 | + if (!$channels) |
|
| 739 | 739 | { |
| 740 | 740 | $channels = 6; //for png |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | - $memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR); |
|
| 743 | + $memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR); |
|
| 744 | 744 | $availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage(); |
| 745 | - if($availableMemory < $memoryNeeded) |
|
| 745 | + if ($availableMemory < $memoryNeeded) |
|
| 746 | 746 | { |
| 747 | 747 | return FALSE; |
| 748 | 748 | } |
@@ -771,30 +771,30 @@ discard block |
||
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | $target_file = self::getRealPath($target_file); |
| 774 | - if(!$resize_width) |
|
| 774 | + if (!$resize_width) |
|
| 775 | 775 | { |
| 776 | 776 | $resize_width = 100; |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | - if(!$resize_height) |
|
| 779 | + if (!$resize_height) |
|
| 780 | 780 | { |
| 781 | 781 | $resize_height = $resize_width; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | // retrieve source image's information |
| 785 | 785 | $imageInfo = getimagesize($source_file); |
| 786 | - if(!self::checkMemoryLoadImage($imageInfo)) |
|
| 786 | + if (!self::checkMemoryLoadImage($imageInfo)) |
|
| 787 | 787 | { |
| 788 | 788 | return FALSE; |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | list($width, $height, $type, $attrs) = $imageInfo; |
| 792 | - if($width < 1 || $height < 1) |
|
| 792 | + if ($width < 1 || $height < 1) |
|
| 793 | 793 | { |
| 794 | 794 | return; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - switch($type) |
|
| 797 | + switch ($type) |
|
| 798 | 798 | { |
| 799 | 799 | case '1' : |
| 800 | 800 | $type = 'gif'; |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | return; |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | - if(!$target_type) |
|
| 815 | + if (!$target_type) |
|
| 816 | 816 | { |
| 817 | 817 | $target_type = $type; |
| 818 | 818 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1; |
| 824 | 824 | |
| 825 | 825 | $per = NULL; |
| 826 | - if($thumbnail_type == 'ratio') |
|
| 826 | + if ($thumbnail_type == 'ratio') |
|
| 827 | 827 | { |
| 828 | 828 | $per = ($width_per > $height_per) ? $height_per : $width_per; |
| 829 | 829 | $resize_width = $width * $per; |
@@ -836,30 +836,30 @@ discard block |
||
| 836 | 836 | |
| 837 | 837 | // create temporary image with target size |
| 838 | 838 | $thumb = NULL; |
| 839 | - if(function_exists('imagecreateTRUEcolor')) |
|
| 839 | + if (function_exists('imagecreateTRUEcolor')) |
|
| 840 | 840 | { |
| 841 | 841 | $thumb = imagecreateTRUEcolor($resize_width, $resize_height); |
| 842 | 842 | } |
| 843 | - else if(function_exists('imagecreate')) |
|
| 843 | + else if (function_exists('imagecreate')) |
|
| 844 | 844 | { |
| 845 | 845 | $thumb = imagecreate($resize_width, $resize_height); |
| 846 | 846 | } |
| 847 | 847 | |
| 848 | - if(!$thumb) |
|
| 848 | + if (!$thumb) |
|
| 849 | 849 | { |
| 850 | 850 | return FALSE; |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | - if(function_exists('imagecolorallocatealpha') && $target_type == 'png' && $thumbnail_transparent) |
|
| 853 | + if (function_exists('imagecolorallocatealpha') && $target_type == 'png' && $thumbnail_transparent) |
|
| 854 | 854 | { |
| 855 | 855 | imagefill($thumb, 0, 0, imagecolorallocatealpha($thumb, 0, 0, 0, 127)); |
| 856 | 856 | |
| 857 | - if(function_exists('imagesavealpha')) |
|
| 857 | + if (function_exists('imagesavealpha')) |
|
| 858 | 858 | { |
| 859 | 859 | imagesavealpha($thumb, TRUE); |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - if(function_exists('imagealphablending')) |
|
| 862 | + if (function_exists('imagealphablending')) |
|
| 863 | 863 | { |
| 864 | 864 | imagealphablending($thumb, TRUE); |
| 865 | 865 | } |
@@ -871,37 +871,37 @@ discard block |
||
| 871 | 871 | |
| 872 | 872 | // create temporary image having original type |
| 873 | 873 | $source = NULL; |
| 874 | - switch($type) |
|
| 874 | + switch ($type) |
|
| 875 | 875 | { |
| 876 | 876 | case 'gif' : |
| 877 | - if(function_exists('imagecreatefromgif')) |
|
| 877 | + if (function_exists('imagecreatefromgif')) |
|
| 878 | 878 | { |
| 879 | 879 | $source = @imagecreatefromgif($source_file); |
| 880 | 880 | } |
| 881 | 881 | break; |
| 882 | 882 | case 'jpeg' : |
| 883 | 883 | case 'jpg' : |
| 884 | - if(function_exists('imagecreatefromjpeg')) |
|
| 884 | + if (function_exists('imagecreatefromjpeg')) |
|
| 885 | 885 | { |
| 886 | 886 | $source = @imagecreatefromjpeg($source_file); |
| 887 | 887 | } |
| 888 | 888 | break; |
| 889 | 889 | case 'png' : |
| 890 | - if(function_exists('imagecreatefrompng')) |
|
| 890 | + if (function_exists('imagecreatefrompng')) |
|
| 891 | 891 | { |
| 892 | 892 | $source = @imagecreatefrompng($source_file); |
| 893 | 893 | } |
| 894 | 894 | break; |
| 895 | 895 | case 'wbmp' : |
| 896 | 896 | case 'bmp' : |
| 897 | - if(function_exists('imagecreatefromwbmp')) |
|
| 897 | + if (function_exists('imagecreatefromwbmp')) |
|
| 898 | 898 | { |
| 899 | 899 | $source = @imagecreatefromwbmp($source_file); |
| 900 | 900 | } |
| 901 | 901 | break; |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | - if(!$source) |
|
| 904 | + if (!$source) |
|
| 905 | 905 | { |
| 906 | 906 | imagedestroy($thumb); |
| 907 | 907 | return FALSE; |
@@ -913,13 +913,13 @@ discard block |
||
| 913 | 913 | |
| 914 | 914 | $x = 0; |
| 915 | 915 | $y = 0; |
| 916 | - if($thumbnail_type == 'crop') |
|
| 916 | + if ($thumbnail_type == 'crop') |
|
| 917 | 917 | { |
| 918 | 918 | $x = (int) ($resize_width / 2 - $new_width / 2); |
| 919 | 919 | $y = (int) ($resize_height / 2 - $new_height / 2); |
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - if(function_exists('imagecopyresampled')) |
|
| 922 | + if (function_exists('imagecopyresampled')) |
|
| 923 | 923 | { |
| 924 | 924 | imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height); |
| 925 | 925 | } |
@@ -933,30 +933,30 @@ discard block |
||
| 933 | 933 | |
| 934 | 934 | // write into the file |
| 935 | 935 | $output = NULL; |
| 936 | - switch($target_type) |
|
| 936 | + switch ($target_type) |
|
| 937 | 937 | { |
| 938 | 938 | case 'gif' : |
| 939 | - if(function_exists('imagegif')) |
|
| 939 | + if (function_exists('imagegif')) |
|
| 940 | 940 | { |
| 941 | 941 | $output = imagegif($thumb, $target_file); |
| 942 | 942 | } |
| 943 | 943 | break; |
| 944 | 944 | case 'jpeg' : |
| 945 | 945 | case 'jpg' : |
| 946 | - if(function_exists('imagejpeg')) |
|
| 946 | + if (function_exists('imagejpeg')) |
|
| 947 | 947 | { |
| 948 | 948 | $output = imagejpeg($thumb, $target_file, 100); |
| 949 | 949 | } |
| 950 | 950 | break; |
| 951 | 951 | case 'png' : |
| 952 | - if(function_exists('imagepng')) |
|
| 952 | + if (function_exists('imagepng')) |
|
| 953 | 953 | { |
| 954 | 954 | $output = imagepng($thumb, $target_file, 9); |
| 955 | 955 | } |
| 956 | 956 | break; |
| 957 | 957 | case 'wbmp' : |
| 958 | 958 | case 'bmp' : |
| 959 | - if(function_exists('imagewbmp')) |
|
| 959 | + if (function_exists('imagewbmp')) |
|
| 960 | 960 | { |
| 961 | 961 | $output = imagewbmp($thumb, $target_file, 100); |
| 962 | 962 | } |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | imagedestroy($thumb); |
| 967 | 967 | imagedestroy($source); |
| 968 | 968 | |
| 969 | - if(!$output) |
|
| 969 | + if (!$output) |
|
| 970 | 970 | { |
| 971 | 971 | return FALSE; |
| 972 | 972 | } |
@@ -984,12 +984,12 @@ discard block |
||
| 984 | 984 | */ |
| 985 | 985 | function readIniFile($filename) |
| 986 | 986 | { |
| 987 | - if(($filename = self::exists($filename)) === FALSE) |
|
| 987 | + if (($filename = self::exists($filename)) === FALSE) |
|
| 988 | 988 | { |
| 989 | 989 | return FALSE; |
| 990 | 990 | } |
| 991 | 991 | $arr = parse_ini_file($filename, TRUE); |
| 992 | - if(is_array($arr) && count($arr) > 0) |
|
| 992 | + if (is_array($arr) && count($arr) > 0) |
|
| 993 | 993 | { |
| 994 | 994 | return $arr; |
| 995 | 995 | } |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | */ |
| 1016 | 1016 | function writeIniFile($filename, $arr) |
| 1017 | 1017 | { |
| 1018 | - if(!is_array($arr) || count($arr) == 0) |
|
| 1018 | + if (!is_array($arr) || count($arr) == 0) |
|
| 1019 | 1019 | { |
| 1020 | 1020 | return FALSE; |
| 1021 | 1021 | } |
@@ -1032,19 +1032,19 @@ discard block |
||
| 1032 | 1032 | function _makeIniBuff($arr) |
| 1033 | 1033 | { |
| 1034 | 1034 | $return = array(); |
| 1035 | - foreach($arr as $key => $val) |
|
| 1035 | + foreach ($arr as $key => $val) |
|
| 1036 | 1036 | { |
| 1037 | 1037 | // section |
| 1038 | - if(is_array($val)) |
|
| 1038 | + if (is_array($val)) |
|
| 1039 | 1039 | { |
| 1040 | 1040 | $return[] = sprintf("[%s]", $key); |
| 1041 | - foreach($val as $k => $v) |
|
| 1041 | + foreach ($val as $k => $v) |
|
| 1042 | 1042 | { |
| 1043 | 1043 | $return[] = sprintf("%s=\"%s\"", $k, $v); |
| 1044 | 1044 | } |
| 1045 | 1045 | // value |
| 1046 | 1046 | } |
| 1047 | - else if(is_object($val)) |
|
| 1047 | + else if (is_object($val)) |
|
| 1048 | 1048 | { |
| 1049 | 1049 | continue; |
| 1050 | 1050 | } |
@@ -1119,15 +1119,15 @@ discard block |
||
| 1119 | 1119 | function isWritableDir($path) |
| 1120 | 1120 | { |
| 1121 | 1121 | $path = self::getRealPath($path); |
| 1122 | - if(is_dir($path)==FALSE) |
|
| 1122 | + if (is_dir($path) == FALSE) |
|
| 1123 | 1123 | { |
| 1124 | 1124 | return FALSE; |
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | - $checkFile = $path . '/_CheckWritableDir'; |
|
| 1127 | + $checkFile = $path.'/_CheckWritableDir'; |
|
| 1128 | 1128 | |
| 1129 | 1129 | $fp = fopen($checkFile, 'w'); |
| 1130 | - if(!is_resource($fp)) |
|
| 1130 | + if (!is_resource($fp)) |
|
| 1131 | 1131 | { |
| 1132 | 1132 | return FALSE; |
| 1133 | 1133 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | **/ |
| 1146 | 1146 | static public function clearStatCache($target, $include = false) |
| 1147 | 1147 | { |
| 1148 | - if(is_array($target)) |
|
| 1148 | + if (is_array($target)) |
|
| 1149 | 1149 | { |
| 1150 | 1150 | array_map('self::clearStatCache', $target); |
| 1151 | 1151 | return; |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | |
| 1154 | 1154 | $target = self::getRealPath($target); |
| 1155 | 1155 | |
| 1156 | - if($include && self::isDir($target)) |
|
| 1156 | + if ($include && self::isDir($target)) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | self::clearStatCache(self::readDir($target, '', false, true), $include); |
| 1159 | 1159 | } |
@@ -1171,27 +1171,27 @@ discard block |
||
| 1171 | 1171 | { |
| 1172 | 1172 | static $opcache = null; |
| 1173 | 1173 | |
| 1174 | - if($opcache === null) |
|
| 1174 | + if ($opcache === null) |
|
| 1175 | 1175 | { |
| 1176 | 1176 | $opcache = (function_exists('opcache_get_status') && function_exists('opcache_invalidate')); |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | - if($opcache === false) |
|
| 1179 | + if ($opcache === false) |
|
| 1180 | 1180 | { |
| 1181 | 1181 | return; |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | - if(is_array($target)) |
|
| 1184 | + if (is_array($target)) |
|
| 1185 | 1185 | { |
| 1186 | 1186 | array_map('self::invalidateOpcache', $target); |
| 1187 | 1187 | return; |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | - if(substr($target, -4) === '.php') |
|
| 1190 | + if (substr($target, -4) === '.php') |
|
| 1191 | 1191 | { |
| 1192 | 1192 | opcache_invalidate(self::getRealPath($target), $force); |
| 1193 | 1193 | } |
| 1194 | - else if($path = self::isDir($target)) |
|
| 1194 | + else if ($path = self::isDir($target)) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | self::invalidateOpcache(self::readDir($path, '', false, true)); |
| 1197 | 1197 | } |
@@ -47,28 +47,28 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if (!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 51 | 51 | |
| 52 | 52 | $oEditorModel = getModel('editor'); |
| 53 | 53 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 54 | + if (!$oComponent->toBool()) return $oComponent; |
|
| 55 | 55 | |
| 56 | - if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 56 | + if (!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 57 | 57 | |
| 58 | 58 | //$output = call_user_method($method, $oComponent); |
| 59 | 59 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 60 | + if (method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | + else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
| 62 | 62 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 63 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 64 | 64 | |
| 65 | 65 | $this->setError($oComponent->getError()); |
| 66 | 66 | $this->setMessage($oComponent->getMessage()); |
| 67 | 67 | |
| 68 | 68 | $vars = $oComponent->getVariables(); |
| 69 | - if(count($vars)) |
|
| 69 | + if (count($vars)) |
|
| 70 | 70 | { |
| 71 | - foreach($vars as $key => $val) |
|
| 71 | + foreach ($vars as $key => $val) |
|
| 72 | 72 | { |
| 73 | 73 | $this->add($key, $val); |
| 74 | 74 | } |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | $module_srl = array(); |
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | |
| 89 | - foreach($target_module_srl as $srl) |
|
| 89 | + foreach ($target_module_srl as $srl) |
|
| 90 | 90 | { |
| 91 | - if(!$srl) continue; |
|
| 91 | + if (!$srl) continue; |
|
| 92 | 92 | |
| 93 | 93 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | - if(!$module_info->module_srl) |
|
| 94 | + if (!$module_info->module_srl) |
|
| 95 | 95 | { |
| 96 | 96 | return new BaseObject(-1, 'msg_invalid_request'); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $module_grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 100 | - if(!$module_grant->manager) |
|
| 100 | + if (!$module_grant->manager) |
|
| 101 | 101 | { |
| 102 | 102 | return new BaseObject(-1, 'msg_not_permitted'); |
| 103 | 103 | } |
@@ -111,32 +111,32 @@ discard block |
||
| 111 | 111 | $editor_config->content_style = Context::get('content_style'); |
| 112 | 112 | $editor_config->comment_content_style = Context::get('comment_content_style'); |
| 113 | 113 | $editor_config->content_font = Context::get('content_font'); |
| 114 | - if($editor_config->content_font) |
|
| 114 | + if ($editor_config->content_font) |
|
| 115 | 115 | { |
| 116 | 116 | $font_list = array(); |
| 117 | - $fonts = explode(',',$editor_config->content_font); |
|
| 118 | - for($i=0,$c=count($fonts);$i<$c;$i++) |
|
| 117 | + $fonts = explode(',', $editor_config->content_font); |
|
| 118 | + for ($i = 0, $c = count($fonts); $i < $c; $i++) |
|
| 119 | 119 | { |
| 120 | - $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
|
| 121 | - if(!$font) continue; |
|
| 120 | + $font = trim(str_replace(array('"', '\''), '', $fonts[$i])); |
|
| 121 | + if (!$font) continue; |
|
| 122 | 122 | $font_list[] = $font; |
| 123 | 123 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 124 | + if (count($font_list)) $editor_config->content_font = '"'.implode('","', $font_list).'"'; |
|
| 125 | 125 | } |
| 126 | 126 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 127 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
| 128 | 128 | $editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset'); |
| 129 | 129 | |
| 130 | - $grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant'); |
|
| 130 | + $grants = array('enable_html_grant', 'enable_comment_html_grant', 'upload_file_grant', 'comment_upload_file_grant', 'enable_default_component_grant', 'enable_comment_default_component_grant', 'enable_component_grant', 'enable_comment_component_grant'); |
|
| 131 | 131 | |
| 132 | - foreach($grants as $key) |
|
| 132 | + foreach ($grants as $key) |
|
| 133 | 133 | { |
| 134 | 134 | $grant = Context::get($key); |
| 135 | - if(!$grant) |
|
| 135 | + if (!$grant) |
|
| 136 | 136 | { |
| 137 | 137 | $editor_config->{$key} = array(); |
| 138 | 138 | } |
| 139 | - else if(is_array($grant)) |
|
| 139 | + else if (is_array($grant)) |
|
| 140 | 140 | { |
| 141 | 141 | $editor_config->{$key} = $grant; |
| 142 | 142 | } |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $editor_config->editor_height = (int)Context::get('editor_height'); |
|
| 150 | - $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
|
| 149 | + $editor_config->editor_height = (int) Context::get('editor_height'); |
|
| 150 | + $editor_config->comment_editor_height = (int) Context::get('comment_editor_height'); |
|
| 151 | 151 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 152 | + if ($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 153 | 153 | |
| 154 | 154 | $oModuleController = getController('module'); |
| 155 | - foreach($module_srl as $srl) |
|
| 155 | + foreach ($module_srl as $srl) |
|
| 156 | 156 | { |
| 157 | 157 | $oModuleController->insertModulePartConfig('editor', $srl, $editor_config); |
| 158 | 158 | } |
@@ -169,31 +169,31 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function triggerEditorComponentCompile(&$content) |
| 171 | 171 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 172 | + if (Context::getResponseMethod() != 'HTML') return new BaseObject(); |
|
| 173 | 173 | |
| 174 | 174 | $module_info = Context::get('module_info'); |
| 175 | 175 | $module_srl = $module_info->module_srl; |
| 176 | - if($module_srl) |
|
| 176 | + if ($module_srl) |
|
| 177 | 177 | { |
| 178 | 178 | $oEditorModel = getModel('editor'); |
| 179 | 179 | $editor_config = $oEditorModel->getEditorConfig($module_srl); |
| 180 | 180 | $content_style = $editor_config->content_style; |
| 181 | - if($content_style) |
|
| 181 | + if ($content_style) |
|
| 182 | 182 | { |
| 183 | - $path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | - if(is_dir($path) && file_exists($path . 'style.ini')) |
|
| 183 | + $path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | + if (is_dir($path) && file_exists($path.'style.ini')) |
|
| 185 | 185 | { |
| 186 | 186 | $ini = file($path.'style.ini'); |
| 187 | - for($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 187 | + for ($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 188 | 188 | { |
| 189 | 189 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 190 | + if (!$file) continue; |
|
| 191 | 191 | |
| 192 | - if(substr_compare($file, '.css', -4) === 0) |
|
| 192 | + if (substr_compare($file, '.css', -4) === 0) |
|
| 193 | 193 | { |
| 194 | 194 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | 195 | } |
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 196 | + elseif (substr_compare($file, '.js', -3) === 0) |
|
| 197 | 197 | { |
| 198 | 198 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 199 | } |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | $content_font = $editor_config->content_font; |
| 204 | 204 | $content_font_size = $editor_config->content_font_size; |
| 205 | - if($content_font || $content_font_size) |
|
| 205 | + if ($content_font || $content_font_size) |
|
| 206 | 206 | { |
| 207 | 207 | $buff = array(); |
| 208 | 208 | $buff[] = '<style> .xe_content { '; |
| 209 | - if($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | - if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 209 | + if ($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | + if ($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 211 | 211 | $buff[] = ' }</style>'; |
| 212 | 212 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 213 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | function transComponent($content) |
| 224 | 224 | { |
| 225 | - $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content); |
|
| 225 | + $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this, 'transEditorComponent'), $content); |
|
| 226 | 226 | return $content; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -237,19 +237,19 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $xml_obj = new stdClass; |
| 239 | 239 | $xml_obj->attrs = new stdClass; |
| 240 | - for($i=0,$c=count($m[0]);$i<$c;$i++) |
|
| 240 | + for ($i = 0, $c = count($m[0]); $i < $c; $i++) |
|
| 241 | 241 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 242 | + if (!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 243 | 243 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 244 | } |
| 245 | 245 | $xml_obj->body = $match[4]; |
| 246 | 246 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 247 | + if (!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 248 | 248 | |
| 249 | 249 | // Get converted codes by using component::transHTML() |
| 250 | 250 | $oEditorModel = getModel('editor'); |
| 251 | 251 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 252 | + if (!is_object($oComponent) || !method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 253 | 253 | |
| 254 | 254 | return $oComponent->transHTML($xml_obj); |
| 255 | 255 | } |
@@ -259,26 +259,26 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function doSaveDoc($args) |
| 261 | 261 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 262 | + if (!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 263 | 263 | |
| 264 | 264 | // Get the current module if module_srl doesn't exist |
| 265 | - if(!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 266 | - if(!$args->module_srl) |
|
| 265 | + if (!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 266 | + if (!$args->module_srl) |
|
| 267 | 267 | { |
| 268 | 268 | $current_module_info = Context::get('current_module_info'); |
| 269 | 269 | $args->module_srl = $current_module_info->module_srl; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if(Context::get('is_logged')) |
|
| 272 | + if (Context::get('is_logged')) |
|
| 273 | 273 | { |
| 274 | 274 | $logged_info = Context::get('logged_info'); |
| 275 | 275 | $args->member_srl = $logged_info->member_srl; |
| 276 | 276 | } |
| 277 | 277 | else |
| 278 | 278 | { |
| 279 | - $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
|
| 280 | - if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 281 | - setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
|
| 279 | + $args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl]; |
|
| 280 | + if (!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 281 | + setcookie('autosave_certify_key_'.$args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return executeQuery('editor.insertSavedDoc', $args); |
@@ -324,22 +324,22 @@ discard block |
||
| 324 | 324 | $args->module_srl = Context::get('module_srl'); |
| 325 | 325 | |
| 326 | 326 | // Get the current module if module_srl doesn't exist |
| 327 | - if(!$args->module_srl) |
|
| 327 | + if (!$args->module_srl) |
|
| 328 | 328 | { |
| 329 | 329 | $current_module_info = Context::get('current_module_info'); |
| 330 | 330 | $args->module_srl = $current_module_info->module_srl; |
| 331 | 331 | } |
| 332 | - if(Context::get('is_logged')) |
|
| 332 | + if (Context::get('is_logged')) |
|
| 333 | 333 | { |
| 334 | 334 | $logged_info = Context::get('logged_info'); |
| 335 | 335 | $args->member_srl = $logged_info->member_srl; |
| 336 | 336 | } |
| 337 | 337 | else |
| 338 | 338 | { |
| 339 | - $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
|
| 339 | + $args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl]; |
|
| 340 | 340 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
| 341 | 341 | // 변경 이전에 작성된 게시물 호환성 유지 |
| 342 | - if(!$args->certify_key) { |
|
| 342 | + if (!$args->certify_key) { |
|
| 343 | 343 | unset($args->certify_key); |
| 344 | 344 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 345 | 345 | } |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | // Check if the auto-saved document already exists |
| 348 | 348 | $output = executeQuery('editor.getSavedDocument', $args); |
| 349 | 349 | $saved_doc = $output->data; |
| 350 | - if(!$saved_doc) return; |
|
| 350 | + if (!$saved_doc) return; |
|
| 351 | 351 | |
| 352 | 352 | $oDocumentModel = getModel('document'); |
| 353 | 353 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 354 | - if(!$oSaved->isExists()) |
|
| 354 | + if (!$oSaved->isExists()) |
|
| 355 | 355 | { |
| 356 | - if($mode) |
|
| 356 | + if ($mode) |
|
| 357 | 357 | { |
| 358 | 358 | $output = executeQuery('editor.getSavedDocument', $args); |
| 359 | 359 | $output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc); |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | $oEditorModel = getModel('editor'); |
| 383 | 383 | $args = new stdClass; |
| 384 | 384 | |
| 385 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 385 | + if ($filter_enabled) $args->enabled = "Y"; |
|
| 386 | 386 | |
| 387 | - if($site_srl) |
|
| 387 | + if ($site_srl) |
|
| 388 | 388 | { |
| 389 | 389 | $args->site_srl = $site_srl; |
| 390 | 390 | $output = executeQuery('editor.getSiteComponentList', $args); |
@@ -397,10 +397,10 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | // Get information about log-in status and its group |
| 399 | 399 | $is_logged = Context::get('is_logged'); |
| 400 | - if($is_logged) |
|
| 400 | + if ($is_logged) |
|
| 401 | 401 | { |
| 402 | 402 | $logged_info = Context::get('logged_info'); |
| 403 | - if($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 403 | + if ($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 404 | 404 | { |
| 405 | 405 | $group_list = array_keys($logged_info->group_list); |
| 406 | 406 | } |
@@ -408,30 +408,30 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | // Get xml information for looping DB list |
| 411 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 411 | + if (!is_array($db_list)) $db_list = array($db_list); |
|
| 412 | 412 | $component_list = new stdClass(); |
| 413 | - foreach($db_list as $component) |
|
| 413 | + foreach ($db_list as $component) |
|
| 414 | 414 | { |
| 415 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 415 | + if (in_array($component->component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 416 | 416 | |
| 417 | 417 | $component_name = $component->component_name; |
| 418 | - if(!$component_name) continue; |
|
| 418 | + if (!$component_name) continue; |
|
| 419 | 419 | |
| 420 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 420 | + if (!in_array($component_name, $downloaded_list)) continue; |
|
| 421 | 421 | |
| 422 | 422 | unset($xml_info); |
| 423 | 423 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
| 424 | 424 | $xml_info->enabled = $component->enabled; |
| 425 | 425 | |
| 426 | - if($component->extra_vars) |
|
| 426 | + if ($component->extra_vars) |
|
| 427 | 427 | { |
| 428 | 428 | $extra_vars = unserialize($component->extra_vars); |
| 429 | - if($extra_vars->target_group) |
|
| 429 | + if ($extra_vars->target_group) |
|
| 430 | 430 | { |
| 431 | 431 | $xml_info->target_group = $extra_vars->target_group; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - if($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 434 | + if ($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 435 | 435 | { |
| 436 | 436 | $xml_info->mid_list = $extra_vars->mid_list; |
| 437 | 437 | } |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue; |
| 459 | 459 | }*/ |
| 460 | 460 | // Check the configuration of the editor component |
| 461 | - if($xml_info->extra_vars) |
|
| 461 | + if ($xml_info->extra_vars) |
|
| 462 | 462 | { |
| 463 | - foreach($xml_info->extra_vars as $key => $val) |
|
| 463 | + foreach ($xml_info->extra_vars as $key => $val) |
|
| 464 | 464 | { |
| 465 | 465 | $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; |
| 466 | 466 | } |
@@ -471,26 +471,26 @@ discard block |
||
| 471 | 471 | // Get buttons, icons, images |
| 472 | 472 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 473 | 473 | $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; |
| 474 | - if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 475 | - if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 474 | + if (file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 475 | + if (file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Return if it checks enabled only |
| 479 | - if($filter_enabled) |
|
| 479 | + if ($filter_enabled) |
|
| 480 | 480 | { |
| 481 | 481 | $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); |
| 482 | - $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list))); |
|
| 482 | + $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list))); |
|
| 483 | 483 | FileHandler::writeFile($cache_file, $buff); |
| 484 | 484 | return $component_list; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | // Get xml_info of downloaded list |
| 488 | - foreach($downloaded_list as $component_name) |
|
| 488 | + foreach ($downloaded_list as $component_name) |
|
| 489 | 489 | { |
| 490 | - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; |
|
| 491 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 490 | + if (!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; |
|
| 491 | + if (in_array($component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 492 | 492 | // Pass if configured |
| 493 | - if($component_list->{$component_name}) continue; |
|
| 493 | + if ($component_list->{$component_name}) continue; |
|
| 494 | 494 | // Insert data into the DB |
| 495 | 495 | $oEditorController = getAdminController('editor'); |
| 496 | 496 | $oEditorController->insertComponent($component_name, false, $site_srl); |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); |
| 506 | - $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list))); |
|
| 506 | + $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list))); |
|
| 507 | 507 | FileHandler::writeFile($cache_file, $buff); |
| 508 | 508 | |
| 509 | 509 | return $component_list; |
@@ -525,9 +525,9 @@ discard block |
||
| 525 | 525 | $editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl); |
| 526 | 526 | |
| 527 | 527 | $oModuleController = getController('module'); |
| 528 | - if(is_array($obj->moduleSrlList)) |
|
| 528 | + if (is_array($obj->moduleSrlList)) |
|
| 529 | 529 | { |
| 530 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 530 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 531 | 531 | { |
| 532 | 532 | $oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig); |
| 533 | 533 | } |
@@ -47,20 +47,31 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if(!$component) { |
|
| 51 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | $oEditorModel = getModel('editor'); |
| 53 | 55 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 56 | + if(!$oComponent->toBool()) { |
|
| 57 | + return $oComponent; |
|
| 58 | + } |
|
| 55 | 59 | |
| 56 | - if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 60 | + if(!method_exists($oComponent, $method)) { |
|
| 61 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 62 | + } |
|
| 57 | 63 | |
| 58 | 64 | //$output = call_user_method($method, $oComponent); |
| 59 | 65 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 66 | + if(method_exists($oComponent, $method)) { |
|
| 67 | + $output = $oComponent->{$method}(); |
|
| 68 | + } else { |
|
| 69 | + return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 70 | + } |
|
| 62 | 71 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 72 | + if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) { |
|
| 73 | + return $output; |
|
| 74 | + } |
|
| 64 | 75 | |
| 65 | 76 | $this->setError($oComponent->getError()); |
| 66 | 77 | $this->setMessage($oComponent->getMessage()); |
@@ -88,7 +99,9 @@ discard block |
||
| 88 | 99 | |
| 89 | 100 | foreach($target_module_srl as $srl) |
| 90 | 101 | { |
| 91 | - if(!$srl) continue; |
|
| 102 | + if(!$srl) { |
|
| 103 | + continue; |
|
| 104 | + } |
|
| 92 | 105 | |
| 93 | 106 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | 107 | if(!$module_info->module_srl) |
@@ -118,10 +131,14 @@ discard block |
||
| 118 | 131 | for($i=0,$c=count($fonts);$i<$c;$i++) |
| 119 | 132 | { |
| 120 | 133 | $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
| 121 | - if(!$font) continue; |
|
| 134 | + if(!$font) { |
|
| 135 | + continue; |
|
| 136 | + } |
|
| 122 | 137 | $font_list[] = $font; |
| 123 | 138 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 139 | + if(count($font_list)) { |
|
| 140 | + $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 141 | + } |
|
| 125 | 142 | } |
| 126 | 143 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 144 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
@@ -135,12 +152,10 @@ discard block |
||
| 135 | 152 | if(!$grant) |
| 136 | 153 | { |
| 137 | 154 | $editor_config->{$key} = array(); |
| 138 | - } |
|
| 139 | - else if(is_array($grant)) |
|
| 155 | + } else if(is_array($grant)) |
|
| 140 | 156 | { |
| 141 | 157 | $editor_config->{$key} = $grant; |
| 142 | - } |
|
| 143 | - else |
|
| 158 | + } else |
|
| 144 | 159 | { |
| 145 | 160 | $editor_config->{$key} = explode('|@|', $grant); |
| 146 | 161 | } |
@@ -149,7 +164,9 @@ discard block |
||
| 149 | 164 | $editor_config->editor_height = (int)Context::get('editor_height'); |
| 150 | 165 | $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
| 151 | 166 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 167 | + if($editor_config->enable_autosave != 'Y') { |
|
| 168 | + $editor_config->enable_autosave = 'N'; |
|
| 169 | + } |
|
| 153 | 170 | |
| 154 | 171 | $oModuleController = getController('module'); |
| 155 | 172 | foreach($module_srl as $srl) |
@@ -169,7 +186,9 @@ discard block |
||
| 169 | 186 | */ |
| 170 | 187 | function triggerEditorComponentCompile(&$content) |
| 171 | 188 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 189 | + if(Context::getResponseMethod()!='HTML') { |
|
| 190 | + return new BaseObject(); |
|
| 191 | + } |
|
| 173 | 192 | |
| 174 | 193 | $module_info = Context::get('module_info'); |
| 175 | 194 | $module_srl = $module_info->module_srl; |
@@ -187,13 +206,14 @@ discard block |
||
| 187 | 206 | for($i = 0, $c = count($ini); $i < $c; $i++) |
| 188 | 207 | { |
| 189 | 208 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 209 | + if(!$file) { |
|
| 210 | + continue; |
|
| 211 | + } |
|
| 191 | 212 | |
| 192 | 213 | if(substr_compare($file, '.css', -4) === 0) |
| 193 | 214 | { |
| 194 | 215 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | - } |
|
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 216 | + } elseif(substr_compare($file, '.js', -3) === 0) |
|
| 197 | 217 | { |
| 198 | 218 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 219 | } |
@@ -206,8 +226,12 @@ discard block |
||
| 206 | 226 | { |
| 207 | 227 | $buff = array(); |
| 208 | 228 | $buff[] = '<style> .xe_content { '; |
| 209 | - if($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | - if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 229 | + if($content_font) { |
|
| 230 | + $buff[] = 'font-family:'.$content_font.';'; |
|
| 231 | + } |
|
| 232 | + if($content_font_size) { |
|
| 233 | + $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 234 | + } |
|
| 211 | 235 | $buff[] = ' }</style>'; |
| 212 | 236 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 237 | } |
@@ -239,17 +263,23 @@ discard block |
||
| 239 | 263 | $xml_obj->attrs = new stdClass; |
| 240 | 264 | for($i=0,$c=count($m[0]);$i<$c;$i++) |
| 241 | 265 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 266 | + if(!isset($xml_obj->attrs)) { |
|
| 267 | + $xml_obj->attrs = new stdClass; |
|
| 268 | + } |
|
| 243 | 269 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 270 | } |
| 245 | 271 | $xml_obj->body = $match[4]; |
| 246 | 272 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 273 | + if(!$xml_obj->attrs->editor_component) { |
|
| 274 | + return $match[0]; |
|
| 275 | + } |
|
| 248 | 276 | |
| 249 | 277 | // Get converted codes by using component::transHTML() |
| 250 | 278 | $oEditorModel = getModel('editor'); |
| 251 | 279 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 280 | + if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) { |
|
| 281 | + return $match[0]; |
|
| 282 | + } |
|
| 253 | 283 | |
| 254 | 284 | return $oComponent->transHTML($xml_obj); |
| 255 | 285 | } |
@@ -259,10 +289,14 @@ discard block |
||
| 259 | 289 | */ |
| 260 | 290 | function doSaveDoc($args) |
| 261 | 291 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 292 | + if(!$args->document_srl) { |
|
| 293 | + $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 294 | + } |
|
| 263 | 295 | |
| 264 | 296 | // Get the current module if module_srl doesn't exist |
| 265 | - if(!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 297 | + if(!$args->module_srl) { |
|
| 298 | + $args->module_srl = Context::get('module_srl'); |
|
| 299 | + } |
|
| 266 | 300 | if(!$args->module_srl) |
| 267 | 301 | { |
| 268 | 302 | $current_module_info = Context::get('current_module_info'); |
@@ -273,11 +307,12 @@ discard block |
||
| 273 | 307 | { |
| 274 | 308 | $logged_info = Context::get('logged_info'); |
| 275 | 309 | $args->member_srl = $logged_info->member_srl; |
| 276 | - } |
|
| 277 | - else |
|
| 310 | + } else |
|
| 278 | 311 | { |
| 279 | 312 | $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
| 280 | - if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 313 | + if(!$args->certify_key) { |
|
| 314 | + $args->certify_key = Password::createSecureSalt(40); |
|
| 315 | + } |
|
| 281 | 316 | setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
| 282 | 317 | } |
| 283 | 318 | |
@@ -333,8 +368,7 @@ discard block |
||
| 333 | 368 | { |
| 334 | 369 | $logged_info = Context::get('logged_info'); |
| 335 | 370 | $args->member_srl = $logged_info->member_srl; |
| 336 | - } |
|
| 337 | - else |
|
| 371 | + } else |
|
| 338 | 372 | { |
| 339 | 373 | $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
| 340 | 374 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
@@ -347,7 +381,9 @@ discard block |
||
| 347 | 381 | // Check if the auto-saved document already exists |
| 348 | 382 | $output = executeQuery('editor.getSavedDocument', $args); |
| 349 | 383 | $saved_doc = $output->data; |
| 350 | - if(!$saved_doc) return; |
|
| 384 | + if(!$saved_doc) { |
|
| 385 | + return; |
|
| 386 | + } |
|
| 351 | 387 | |
| 352 | 388 | $oDocumentModel = getModel('document'); |
| 353 | 389 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
@@ -382,14 +418,17 @@ discard block |
||
| 382 | 418 | $oEditorModel = getModel('editor'); |
| 383 | 419 | $args = new stdClass; |
| 384 | 420 | |
| 385 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 421 | + if($filter_enabled) { |
|
| 422 | + $args->enabled = "Y"; |
|
| 423 | + } |
|
| 386 | 424 | |
| 387 | 425 | if($site_srl) |
| 388 | 426 | { |
| 389 | 427 | $args->site_srl = $site_srl; |
| 390 | 428 | $output = executeQuery('editor.getSiteComponentList', $args); |
| 429 | + } else { |
|
| 430 | + $output = executeQuery('editor.getComponentList', $args); |
|
| 391 | 431 | } |
| 392 | - else $output = executeQuery('editor.getComponentList', $args); |
|
| 393 | 432 | $db_list = $output->data; |
| 394 | 433 | |
| 395 | 434 | // Get a list of files |
@@ -403,21 +442,30 @@ discard block |
||
| 403 | 442 | if($logged_info->group_list && is_array($logged_info->group_list)) |
| 404 | 443 | { |
| 405 | 444 | $group_list = array_keys($logged_info->group_list); |
| 445 | + } else { |
|
| 446 | + $group_list = array(); |
|
| 406 | 447 | } |
| 407 | - else $group_list = array(); |
|
| 408 | 448 | } |
| 409 | 449 | |
| 410 | 450 | // Get xml information for looping DB list |
| 411 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 451 | + if(!is_array($db_list)) { |
|
| 452 | + $db_list = array($db_list); |
|
| 453 | + } |
|
| 412 | 454 | $component_list = new stdClass(); |
| 413 | 455 | foreach($db_list as $component) |
| 414 | 456 | { |
| 415 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 457 | + if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 458 | + continue; |
|
| 459 | + } |
|
| 416 | 460 | |
| 417 | 461 | $component_name = $component->component_name; |
| 418 | - if(!$component_name) continue; |
|
| 462 | + if(!$component_name) { |
|
| 463 | + continue; |
|
| 464 | + } |
|
| 419 | 465 | |
| 420 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 466 | + if(!in_array($component_name, $downloaded_list)) { |
|
| 467 | + continue; |
|
| 468 | + } |
|
| 421 | 469 | |
| 422 | 470 | unset($xml_info); |
| 423 | 471 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
@@ -471,8 +519,12 @@ discard block |
||
| 471 | 519 | // Get buttons, icons, images |
| 472 | 520 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 473 | 521 | $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; |
| 474 | - if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 475 | - if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 522 | + if(file_exists($icon_file)) { |
|
| 523 | + $component_list->{$component_name}->icon = true; |
|
| 524 | + } |
|
| 525 | + if(file_exists($component_icon_file)) { |
|
| 526 | + $component_list->{$component_name}->component_icon = true; |
|
| 527 | + } |
|
| 476 | 528 | } |
| 477 | 529 | |
| 478 | 530 | // Return if it checks enabled only |
@@ -487,10 +539,16 @@ discard block |
||
| 487 | 539 | // Get xml_info of downloaded list |
| 488 | 540 | foreach($downloaded_list as $component_name) |
| 489 | 541 | { |
| 490 | - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; |
|
| 491 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 542 | + if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) { |
|
| 543 | + continue; |
|
| 544 | + } |
|
| 545 | + if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 546 | + continue; |
|
| 547 | + } |
|
| 492 | 548 | // Pass if configured |
| 493 | - if($component_list->{$component_name}) continue; |
|
| 549 | + if($component_list->{$component_name}) { |
|
| 550 | + continue; |
|
| 551 | + } |
|
| 494 | 552 | // Insert data into the DB |
| 495 | 553 | $oEditorController = getAdminController('editor'); |
| 496 | 554 | $oEditorController->insertComponent($component_name, false, $site_srl); |
@@ -34,25 +34,25 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | function procMemberLogin($user_id = null, $password = null, $keep_signed = null) |
| 36 | 36 | { |
| 37 | - if(!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
| 37 | + if (!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
| 38 | 38 | { |
| 39 | 39 | $this->setRedirectUrl(getNotEncodedUrl('')); |
| 40 | 40 | return new BaseObject(-1, 'null_user_id'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Variables |
| 44 | - if(!$user_id) $user_id = Context::get('user_id'); |
|
| 44 | + if (!$user_id) $user_id = Context::get('user_id'); |
|
| 45 | 45 | $user_id = trim($user_id); |
| 46 | 46 | |
| 47 | - if(!$password) $password = Context::get('password'); |
|
| 47 | + if (!$password) $password = Context::get('password'); |
|
| 48 | 48 | $password = trim($password); |
| 49 | 49 | |
| 50 | - if(!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
| 50 | + if (!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
| 51 | 51 | // Return an error when id and password doesn't exist |
| 52 | - if(!$user_id) return new BaseObject(-1,'null_user_id'); |
|
| 53 | - if(!$password) return new BaseObject(-1,'null_password'); |
|
| 52 | + if (!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 53 | + if (!$password) return new BaseObject(-1, 'null_password'); |
|
| 54 | 54 | |
| 55 | - $output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false); |
|
| 55 | + $output = $this->doLogin($user_id, $password, $keep_signed == 'Y' ?true:false); |
|
| 56 | 56 | if (!$output->toBool()) return $output; |
| 57 | 57 | |
| 58 | 58 | $oModuleModel = getModel('module'); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | $limit_date = $config->change_password_date; |
| 63 | 63 | |
| 64 | 64 | // Check if change_password_date is set |
| 65 | - if($limit_date > 0) |
|
| 65 | + if ($limit_date > 0) |
|
| 66 | 66 | { |
| 67 | 67 | $oMemberModel = getModel('member'); |
| 68 | - if($this->memberInfo->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day'))) |
|
| 68 | + if ($this->memberInfo->change_password_date < date('YmdHis', strtotime('-'.$limit_date.' day'))) |
|
| 69 | 69 | { |
| 70 | 70 | $msg = sprintf(Context::getLang('msg_change_password_date'), $limit_date); |
| 71 | - return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new BaseObject(-1, $msg)); |
|
| 71 | + return $this->setRedirectUrl(getNotEncodedUrl('', 'vid', Context::get('vid'), 'mid', Context::get('mid'), 'act', 'dispMemberModifyPassword'), new BaseObject(-1, $msg)); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $args->member_srl = $this->memberInfo->member_srl; |
| 78 | 78 | executeQuery('member.deleteAuthMail', $args); |
| 79 | 79 | |
| 80 | - if(!$config->after_login_url) |
|
| 80 | + if (!$config->after_login_url) |
|
| 81 | 81 | { |
| 82 | 82 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 83 | 83 | } |
@@ -98,18 +98,18 @@ discard block |
||
| 98 | 98 | // Call a trigger before log-out (before) |
| 99 | 99 | $logged_info = Context::get('logged_info'); |
| 100 | 100 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); |
| 101 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 101 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 102 | 102 | // Destroy session information |
| 103 | 103 | $this->destroySessionInfo(); |
| 104 | 104 | // Call a trigger after log-out (after) |
| 105 | 105 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); |
| 106 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 106 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 107 | 107 | |
| 108 | 108 | $output = new BaseObject(); |
| 109 | 109 | |
| 110 | 110 | $oModuleModel = getModel('module'); |
| 111 | 111 | $config = $oModuleModel->getModuleConfig('member'); |
| 112 | - if($config->after_logout_url) |
|
| 112 | + if ($config->after_logout_url) |
|
| 113 | 113 | $output->redirect_url = $config->after_logout_url; |
| 114 | 114 | |
| 115 | 115 | $this->_clearMemberCache($logged_info->member_srl); |
@@ -127,18 +127,18 @@ discard block |
||
| 127 | 127 | $oModuleModel = &getModel('module'); |
| 128 | 128 | |
| 129 | 129 | // Check login information |
| 130 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 130 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 131 | 131 | $logged_info = Context::get('logged_info'); |
| 132 | 132 | |
| 133 | - $document_srl = (int)Context::get('document_srl'); |
|
| 134 | - if(!$document_srl) $document_srl = (int)Context::get('target_srl'); |
|
| 135 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 133 | + $document_srl = (int) Context::get('document_srl'); |
|
| 134 | + if (!$document_srl) $document_srl = (int) Context::get('target_srl'); |
|
| 135 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 136 | 136 | |
| 137 | 137 | // Get document |
| 138 | 138 | $oDocumentModel = getModel('document'); |
| 139 | 139 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 140 | 140 | |
| 141 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 141 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 142 | 142 | { |
| 143 | 143 | return new BaseObject(-1, 'msg_is_secret'); |
| 144 | 144 | } |
@@ -147,19 +147,19 @@ discard block |
||
| 147 | 147 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($oDocument->get('module_srl')); |
| 148 | 148 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 149 | 149 | |
| 150 | - if(!$grant->access) |
|
| 150 | + if (!$grant->access) |
|
| 151 | 151 | { |
| 152 | 152 | return new BaseObject(-1, 'msg_not_permitted'); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // 게시판 모듈에서 글 목록 보기 권한이 없으면 스크랩 제한 |
| 156 | - if($module_info->module === 'board' && isset($grant->list) && !$grant->list) |
|
| 156 | + if ($module_info->module === 'board' && isset($grant->list) && !$grant->list) |
|
| 157 | 157 | { |
| 158 | 158 | return new BaseObject(-1, 'msg_not_permitted'); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // 게시판 모듈에서 상담 기능 사용 시 권한이 없는 게시물(타인의 게시물) 스크랩 제한 |
| 162 | - if($module_info->module === 'board' && |
|
| 162 | + if ($module_info->module === 'board' && |
|
| 163 | 163 | $module_info->consultation === 'Y' && |
| 164 | 164 | isset($grant->consultation_read) && |
| 165 | 165 | !$grant->consultation_read && !$oDocument->isGranted() |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // Check if already scrapped |
| 182 | 182 | $output = executeQuery('member.getScrapDocument', $args); |
| 183 | - if($output->data->count) return new BaseObject(-1, 'msg_alreay_scrapped'); |
|
| 183 | + if ($output->data->count) return new BaseObject(-1, 'msg_alreay_scrapped'); |
|
| 184 | 184 | |
| 185 | 185 | // Insert |
| 186 | 186 | $output = executeQuery('member.addScrapDocument', $args); |
| 187 | - if(!$output->toBool()) return $output; |
|
| 187 | + if (!$output->toBool()) return $output; |
|
| 188 | 188 | |
| 189 | 189 | $this->setError(-1); |
| 190 | 190 | $this->setMessage('success_registed'); |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | function procMemberDeleteScrap() |
| 199 | 199 | { |
| 200 | 200 | // Check login information |
| 201 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 201 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 202 | 202 | $logged_info = Context::get('logged_info'); |
| 203 | 203 | |
| 204 | - $document_srl = (int)Context::get('document_srl'); |
|
| 205 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 204 | + $document_srl = (int) Context::get('document_srl'); |
|
| 205 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 206 | 206 | // Variables |
| 207 | 207 | $args = new stdClass; |
| 208 | 208 | $args->member_srl = $logged_info->member_srl; |
@@ -228,23 +228,23 @@ discard block |
||
| 228 | 228 | function procMemberDeleteSavedDocument() |
| 229 | 229 | { |
| 230 | 230 | // Check login information |
| 231 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 231 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 232 | 232 | $logged_info = Context::get('logged_info'); |
| 233 | 233 | |
| 234 | - $document_srl = (int)Context::get('document_srl'); |
|
| 235 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 234 | + $document_srl = (int) Context::get('document_srl'); |
|
| 235 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 236 | 236 | |
| 237 | 237 | $oDocumentModel = getModel('document'); |
| 238 | 238 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 239 | 239 | if ($oDocument->get('member_srl') != $logged_info->member_srl) |
| 240 | 240 | { |
| 241 | - return new BaseObject(-1,'msg_invalid_request'); |
|
| 241 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $configStatusList = $oDocumentModel->getStatusList(); |
| 245 | 245 | if ($oDocument->get('status') != $configStatusList['temp']) |
| 246 | 246 | { |
| 247 | - return new BaseObject(-1,'msg_invalid_request'); |
|
| 247 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $oDocumentController = getController('document'); |
@@ -260,37 +260,37 @@ discard block |
||
| 260 | 260 | { |
| 261 | 261 | $name = Context::get('name'); |
| 262 | 262 | $value = Context::get('value'); |
| 263 | - if(!$value) return; |
|
| 263 | + if (!$value) return; |
|
| 264 | 264 | |
| 265 | 265 | $oMemberModel = getModel('member'); |
| 266 | 266 | // Check if logged-in |
| 267 | 267 | $logged_info = Context::get('logged_info'); |
| 268 | 268 | |
| 269 | 269 | |
| 270 | - switch($name) |
|
| 270 | + switch ($name) |
|
| 271 | 271 | { |
| 272 | 272 | case 'user_id' : |
| 273 | 273 | // Check denied ID |
| 274 | - if($oMemberModel->isDeniedID($value)) return new BaseObject(0,'denied_user_id'); |
|
| 274 | + if ($oMemberModel->isDeniedID($value)) return new BaseObject(0, 'denied_user_id'); |
|
| 275 | 275 | // Check if duplicated |
| 276 | 276 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
| 277 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_user_id'); |
|
| 277 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new BaseObject(0, 'msg_exists_user_id'); |
|
| 278 | 278 | break; |
| 279 | 279 | case 'nick_name' : |
| 280 | 280 | // Check denied ID |
| 281 | - if($oMemberModel->isDeniedNickName($value)) |
|
| 281 | + if ($oMemberModel->isDeniedNickName($value)) |
|
| 282 | 282 | { |
| 283 | - return new BaseObject(0,'denied_nick_name'); |
|
| 283 | + return new BaseObject(0, 'denied_nick_name'); |
|
| 284 | 284 | } |
| 285 | 285 | // Check if duplicated |
| 286 | 286 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
| 287 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_nick_name'); |
|
| 287 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new BaseObject(0, 'msg_exists_nick_name'); |
|
| 288 | 288 | |
| 289 | 289 | break; |
| 290 | 290 | case 'email_address' : |
| 291 | 291 | // Check if duplicated |
| 292 | 292 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
| 293 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_email_address'); |
|
| 293 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new BaseObject(0, 'msg_exists_email_address'); |
|
| 294 | 294 | break; |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -302,25 +302,25 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | function procMemberInsert() |
| 304 | 304 | { |
| 305 | - if (Context::getRequestMethod () == "GET") return new BaseObject(-1, "msg_invalid_request"); |
|
| 306 | - $oMemberModel = &getModel ('member'); |
|
| 305 | + if (Context::getRequestMethod() == "GET") return new BaseObject(-1, "msg_invalid_request"); |
|
| 306 | + $oMemberModel = &getModel('member'); |
|
| 307 | 307 | $config = $oMemberModel->getMemberConfig(); |
| 308 | 308 | |
| 309 | 309 | // call a trigger (before) |
| 310 | - $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
|
| 311 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
| 310 | + $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config); |
|
| 311 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 312 | 312 | // Check if an administrator allows a membership |
| 313 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
| 313 | + if ($config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 314 | 314 | // Check if the user accept the license terms (only if terms exist) |
| 315 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
| 315 | + if ($config->agreement && Context::get('accept_agreement') != 'Y') return $this->stop('msg_accept_agreement'); |
|
| 316 | 316 | |
| 317 | 317 | // Extract the necessary information in advance |
| 318 | 318 | $getVars = array(); |
| 319 | - if($config->signupForm) |
|
| 319 | + if ($config->signupForm) |
|
| 320 | 320 | { |
| 321 | - foreach($config->signupForm as $formInfo) |
|
| 321 | + foreach ($config->signupForm as $formInfo) |
|
| 322 | 322 | { |
| 323 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 323 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 324 | 324 | { |
| 325 | 325 | $getVars[] = $formInfo->name; |
| 326 | 326 | } |
@@ -328,22 +328,22 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $args = new stdClass; |
| 331 | - foreach($getVars as $val) |
|
| 331 | + foreach ($getVars as $val) |
|
| 332 | 332 | { |
| 333 | 333 | $args->{$val} = Context::get($val); |
| 334 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 334 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 335 | 335 | } |
| 336 | 336 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 337 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 337 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 338 | 338 | |
| 339 | 339 | $args->find_account_answer = Context::get('find_account_answer'); |
| 340 | 340 | $args->allow_mailing = Context::get('allow_mailing'); |
| 341 | 341 | $args->allow_message = Context::get('allow_message'); |
| 342 | 342 | |
| 343 | - if($args->password1) $args->password = $args->password1; |
|
| 343 | + if ($args->password1) $args->password = $args->password1; |
|
| 344 | 344 | |
| 345 | 345 | // check password strength |
| 346 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 346 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 347 | 347 | { |
| 348 | 348 | $message = Context::getLang('about_password_strength'); |
| 349 | 349 | return new BaseObject(-1, $message[$config->password_strength]); |
@@ -369,58 +369,58 @@ discard block |
||
| 369 | 369 | unset($all_args->secret_text); |
| 370 | 370 | |
| 371 | 371 | // Set the user state as "denied" when using mail authentication |
| 372 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 372 | + if ($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 373 | 373 | // Add extra vars after excluding necessary information from all the requested arguments |
| 374 | 374 | $extra_vars = delObjectVars($all_args, $args); |
| 375 | 375 | $args->extra_vars = serialize($extra_vars); |
| 376 | 376 | |
| 377 | 377 | // remove whitespace |
| 378 | 378 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
| 379 | - foreach($checkInfos as $val) |
|
| 379 | + foreach ($checkInfos as $val) |
|
| 380 | 380 | { |
| 381 | - if(isset($args->{$val})) |
|
| 381 | + if (isset($args->{$val})) |
|
| 382 | 382 | { |
| 383 | 383 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | $output = $this->insertMember($args); |
| 387 | - if(!$output->toBool()) return $output; |
|
| 387 | + if (!$output->toBool()) return $output; |
|
| 388 | 388 | |
| 389 | 389 | // insert ProfileImage, ImageName, ImageMark |
| 390 | 390 | $profile_image = $_FILES['profile_image']; |
| 391 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 391 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 392 | 392 | { |
| 393 | 393 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | $image_mark = $_FILES['image_mark']; |
| 397 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 397 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 398 | 398 | { |
| 399 | 399 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | $image_name = $_FILES['image_name']; |
| 403 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
| 403 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
| 404 | 404 | { |
| 405 | 405 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // If a virtual site, join the site |
| 409 | 409 | $site_module_info = Context::get('site_module_info'); |
| 410 | - if($site_module_info->site_srl > 0) |
|
| 410 | + if ($site_module_info->site_srl > 0) |
|
| 411 | 411 | { |
| 412 | 412 | $columnList = array('site_srl', 'group_srl'); |
| 413 | 413 | $default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl, $columnList); |
| 414 | - if($default_group->group_srl) |
|
| 414 | + if ($default_group->group_srl) |
|
| 415 | 415 | { |
| 416 | 416 | $this->addMemberToGroup($args->member_srl, $default_group->group_srl, $site_module_info->site_srl); |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | } |
| 420 | 420 | // Log-in |
| 421 | - if($config->enable_confirm != 'Y') |
|
| 421 | + if ($config->enable_confirm != 'Y') |
|
| 422 | 422 | { |
| 423 | - if($config->identifier == 'email_address') |
|
| 423 | + if ($config->identifier == 'email_address') |
|
| 424 | 424 | { |
| 425 | 425 | $output = $this->doLogin($args->email_address); |
| 426 | 426 | } |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | { |
| 429 | 429 | $output = $this->doLogin($args->user_id); |
| 430 | 430 | } |
| 431 | - if(!$output->toBool()) { |
|
| 432 | - if($output->error == -9) |
|
| 431 | + if (!$output->toBool()) { |
|
| 432 | + if ($output->error == -9) |
|
| 433 | 433 | $output->error = -11; |
| 434 | 434 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
| 435 | 435 | } |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | // Results |
| 439 | 439 | $this->add('member_srl', $args->member_srl); |
| 440 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 441 | - if($config->enable_confirm == 'Y') |
|
| 440 | + if ($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 441 | + if ($config->enable_confirm == 'Y') |
|
| 442 | 442 | { |
| 443 | 443 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
| 444 | 444 | $this->setMessage($msg); |
@@ -447,19 +447,19 @@ discard block |
||
| 447 | 447 | else $this->setMessage('success_registed'); |
| 448 | 448 | // Call a trigger (after) |
| 449 | 449 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
| 450 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 450 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 451 | 451 | |
| 452 | - if($config->redirect_url) |
|
| 452 | + if ($config->redirect_url) |
|
| 453 | 453 | { |
| 454 | 454 | $returnUrl = $config->redirect_url; |
| 455 | 455 | } |
| 456 | 456 | else |
| 457 | 457 | { |
| 458 | - if(Context::get('success_return_url')) |
|
| 458 | + if (Context::get('success_return_url')) |
|
| 459 | 459 | { |
| 460 | 460 | $returnUrl = Context::get('success_return_url'); |
| 461 | 461 | } |
| 462 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 462 | + else if ($_COOKIE['XE_REDIRECT_URL']) |
|
| 463 | 463 | { |
| 464 | 464 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
| 465 | 465 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -473,26 +473,26 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | function procMemberModifyInfoBefore() |
| 475 | 475 | { |
| 476 | - if($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
| 476 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
| 477 | 477 | { |
| 478 | 478 | return $this->stop('msg_invalid_request'); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - if(!Context::get('is_logged')) |
|
| 481 | + if (!Context::get('is_logged')) |
|
| 482 | 482 | { |
| 483 | 483 | return $this->stop('msg_not_logged'); |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | $password = Context::get('password'); |
| 487 | 487 | |
| 488 | - if(!$password) |
|
| 488 | + if (!$password) |
|
| 489 | 489 | { |
| 490 | 490 | return $this->stop('msg_invalid_request'); |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | $oMemberModel = getModel('member'); |
| 494 | 494 | |
| 495 | - if(!$this->memberInfo->password) |
|
| 495 | + if (!$this->memberInfo->password) |
|
| 496 | 496 | { |
| 497 | 497 | // Get information of logged-in user |
| 498 | 498 | $logged_info = Context::get('logged_info'); |
@@ -503,14 +503,14 @@ discard block |
||
| 503 | 503 | $this->memberInfo->password = $memberInfo->password; |
| 504 | 504 | } |
| 505 | 505 | // Verify the current password |
| 506 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
| 506 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
| 507 | 507 | { |
| 508 | 508 | return new BaseObject(-1, 'invalid_password'); |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | $_SESSION['rechecked_password_step'] = 'VALIDATE_PASSWORD'; |
| 512 | 512 | |
| 513 | - if(Context::get('success_return_url')) |
|
| 513 | + if (Context::get('success_return_url')) |
|
| 514 | 514 | { |
| 515 | 515 | $redirectUrl = Context::get('success_return_url'); |
| 516 | 516 | } |
@@ -528,12 +528,12 @@ discard block |
||
| 528 | 528 | */ |
| 529 | 529 | function procMemberModifyInfo() |
| 530 | 530 | { |
| 531 | - if(!Context::get('is_logged')) |
|
| 531 | + if (!Context::get('is_logged')) |
|
| 532 | 532 | { |
| 533 | 533 | return $this->stop('msg_not_logged'); |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 536 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 537 | 537 | { |
| 538 | 538 | return $this->stop('msg_invalid_request'); |
| 539 | 539 | } |
@@ -541,13 +541,13 @@ discard block |
||
| 541 | 541 | |
| 542 | 542 | // Extract the necessary information in advance |
| 543 | 543 | $oMemberModel = getModel('member'); |
| 544 | - $config = $oMemberModel->getMemberConfig (); |
|
| 545 | - $getVars = array('find_account_answer','allow_mailing','allow_message'); |
|
| 546 | - if($config->signupForm) |
|
| 544 | + $config = $oMemberModel->getMemberConfig(); |
|
| 545 | + $getVars = array('find_account_answer', 'allow_mailing', 'allow_message'); |
|
| 546 | + if ($config->signupForm) |
|
| 547 | 547 | { |
| 548 | - foreach($config->signupForm as $formInfo) |
|
| 548 | + foreach ($config->signupForm as $formInfo) |
|
| 549 | 549 | { |
| 550 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 550 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 551 | 551 | { |
| 552 | 552 | $getVars[] = $formInfo->name; |
| 553 | 553 | } |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | $args = new stdClass; |
| 558 | - foreach($getVars as $val) |
|
| 558 | + foreach ($getVars as $val) |
|
| 559 | 559 | { |
| 560 | 560 | $args->{$val} = Context::get($val); |
| 561 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 562 | - if($val == 'find_account_answer' && !Context::get($val)) { |
|
| 561 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 562 | + if ($val == 'find_account_answer' && !Context::get($val)) { |
|
| 563 | 563 | unset($args->{$val}); |
| 564 | 564 | } |
| 565 | 565 | } |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | $logged_info = Context::get('logged_info'); |
| 569 | 569 | $args->member_srl = $logged_info->member_srl; |
| 570 | 570 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 571 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 571 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 572 | 572 | |
| 573 | 573 | // Remove some unnecessary variables from all the vars |
| 574 | 574 | $all_args = Context::getRequestVars(); |
@@ -593,9 +593,9 @@ discard block |
||
| 593 | 593 | |
| 594 | 594 | // remove whitespace |
| 595 | 595 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
| 596 | - foreach($checkInfos as $val) |
|
| 596 | + foreach ($checkInfos as $val) |
|
| 597 | 597 | { |
| 598 | - if(isset($args->{$val})) |
|
| 598 | + if (isset($args->{$val})) |
|
| 599 | 599 | { |
| 600 | 600 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
| 601 | 601 | } |
@@ -603,22 +603,22 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | // Execute insert or update depending on the value of member_srl |
| 605 | 605 | $output = $this->updateMember($args); |
| 606 | - if(!$output->toBool()) return $output; |
|
| 606 | + if (!$output->toBool()) return $output; |
|
| 607 | 607 | |
| 608 | 608 | $profile_image = $_FILES['profile_image']; |
| 609 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 609 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 610 | 610 | { |
| 611 | 611 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | $image_mark = $_FILES['image_mark']; |
| 615 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 615 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 616 | 616 | { |
| 617 | 617 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | $image_name = $_FILES['image_name']; |
| 621 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
| 621 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
| 622 | 622 | { |
| 623 | 623 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 624 | 624 | } |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | // Call a trigger after successfully log-in (after) |
| 635 | 635 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
| 636 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 636 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 637 | 637 | |
| 638 | 638 | $this->setSessionInfo(); |
| 639 | 639 | // Return result |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | */ |
| 655 | 655 | function procMemberModifyPassword() |
| 656 | 656 | { |
| 657 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 657 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 658 | 658 | // Extract the necessary information in advance |
| 659 | 659 | $current_password = trim(Context::get('current_password')); |
| 660 | 660 | $password = trim(Context::get('password1')); |
@@ -668,17 +668,17 @@ discard block |
||
| 668 | 668 | |
| 669 | 669 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 670 | 670 | // Verify the cuttent password |
| 671 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new BaseObject(-1, 'invalid_password'); |
|
| 671 | + if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new BaseObject(-1, 'invalid_password'); |
|
| 672 | 672 | |
| 673 | 673 | // Check if a new password is as same as the previous password |
| 674 | - if($current_password == $password) return new BaseObject(-1, 'invalid_new_password'); |
|
| 674 | + if ($current_password == $password) return new BaseObject(-1, 'invalid_new_password'); |
|
| 675 | 675 | |
| 676 | 676 | // Execute insert or update depending on the value of member_srl |
| 677 | 677 | $args = new stdClass; |
| 678 | 678 | $args->member_srl = $member_srl; |
| 679 | 679 | $args->password = $password; |
| 680 | 680 | $output = $this->updateMemberPassword($args); |
| 681 | - if(!$output->toBool()) return $output; |
|
| 681 | + if (!$output->toBool()) return $output; |
|
| 682 | 682 | |
| 683 | 683 | $this->add('member_srl', $args->member_srl); |
| 684 | 684 | $this->setMessage('success_updated'); |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | function procMemberLeave() |
| 696 | 696 | { |
| 697 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 697 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 698 | 698 | // Extract the necessary information in advance |
| 699 | 699 | $password = trim(Context::get('password')); |
| 700 | 700 | // Get information of logged-in user |
@@ -703,17 +703,17 @@ discard block |
||
| 703 | 703 | // Create a member model object |
| 704 | 704 | $oMemberModel = getModel('member'); |
| 705 | 705 | // Get information of member_srl |
| 706 | - if(!$this->memberInfo->password) |
|
| 706 | + if (!$this->memberInfo->password) |
|
| 707 | 707 | { |
| 708 | 708 | $columnList = array('member_srl', 'password'); |
| 709 | 709 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 710 | 710 | $this->memberInfo->password = $memberInfo->password; |
| 711 | 711 | } |
| 712 | 712 | // Verify the cuttent password |
| 713 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new BaseObject(-1, 'invalid_password'); |
|
| 713 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new BaseObject(-1, 'invalid_password'); |
|
| 714 | 714 | |
| 715 | 715 | $output = $this->deleteMember($member_srl); |
| 716 | - if(!$output->toBool()) return $output; |
|
| 716 | + if (!$output->toBool()) return $output; |
|
| 717 | 717 | // Destroy all session information |
| 718 | 718 | $this->destroySessionInfo(); |
| 719 | 719 | // Return success message |
@@ -732,20 +732,20 @@ discard block |
||
| 732 | 732 | { |
| 733 | 733 | // Check if the file is successfully uploaded |
| 734 | 734 | $file = $_FILES['profile_image']; |
| 735 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 735 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 736 | 736 | // Ignore if member_srl is invalid or doesn't exist. |
| 737 | 737 | $member_srl = Context::get('member_srl'); |
| 738 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 738 | + if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 739 | 739 | |
| 740 | 740 | $logged_info = Context::get('logged_info'); |
| 741 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 741 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 742 | 742 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 743 | 743 | $oMemberModel = getModel('member'); |
| 744 | 744 | $config = $oMemberModel->getMemberConfig(); |
| 745 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 745 | + if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 746 | 746 | |
| 747 | 747 | $output = $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 748 | - if(!$output->toBool()) return $output; |
|
| 748 | + if (!$output->toBool()) return $output; |
|
| 749 | 749 | |
| 750 | 750 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 751 | 751 | $this->setRedirectUrl($returnUrl); |
@@ -766,20 +766,20 @@ discard block |
||
| 766 | 766 | $max_width = $config->profile_image_max_width; |
| 767 | 767 | $max_height = $config->profile_image_max_height; |
| 768 | 768 | $max_filesize = $config->profile_image_max_filesize; |
| 769 | - foreach($config->signupForm as $val) |
|
| 769 | + foreach ($config->signupForm as $val) |
|
| 770 | 770 | { |
| 771 | - if($val->name == "profile_image") |
|
| 771 | + if ($val->name == "profile_image") |
|
| 772 | 772 | $allow_transparent = $val->allow_transparent_thumbnail == 'Y'; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
| 775 | + Context::loadLang(_XE_PATH_.'modules/file/lang'); |
|
| 776 | 776 | |
| 777 | 777 | // Get file information |
| 778 | 778 | FileHandler::clearStatCache($target_file); |
| 779 | 779 | list($width, $height, $type) = @getimagesize($target_file); |
| 780 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 781 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 782 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 780 | + if (IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 781 | + elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 782 | + elseif (IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 783 | 783 | else |
| 784 | 784 | { |
| 785 | 785 | return $this->stop('msg_not_uploaded_profile_image'); |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); |
| 792 | 792 | |
| 793 | 793 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 794 | - if(($width > $max_width || $height > $max_height ) && $type != 1) |
|
| 794 | + if (($width > $max_width || $height > $max_height) && $type != 1) |
|
| 795 | 795 | { |
| 796 | 796 | $temp_filename = sprintf('files/cache/tmp/profile_image_%d.%s', $member_srl, $ext); |
| 797 | 797 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, $ext, 'crop', $allow_transparent); |
@@ -799,10 +799,10 @@ discard block |
||
| 799 | 799 | // 파일 용량 제한 |
| 800 | 800 | FileHandler::clearStatCache($temp_filename); |
| 801 | 801 | $filesize = filesize($temp_filename); |
| 802 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 802 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 803 | 803 | { |
| 804 | 804 | FileHandler::removeFile($temp_filename); |
| 805 | - return $this->stop(implode(' ' , array( |
|
| 805 | + return $this->stop(implode(' ', array( |
|
| 806 | 806 | Context::getLang('msg_not_uploaded_profile_image'), |
| 807 | 807 | Context::getLang('msg_exceeds_limit_size') |
| 808 | 808 | ))); |
@@ -816,9 +816,9 @@ discard block |
||
| 816 | 816 | { |
| 817 | 817 | // 파일 용량 제한 |
| 818 | 818 | $filesize = filesize($target_file); |
| 819 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 819 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 820 | 820 | { |
| 821 | - return $this->stop(implode(' ' , array( |
|
| 821 | + return $this->stop(implode(' ', array( |
|
| 822 | 822 | Context::getLang('msg_not_uploaded_profile_image'), |
| 823 | 823 | Context::getLang('msg_exceeds_limit_size') |
| 824 | 824 | ))); |
@@ -841,20 +841,20 @@ discard block |
||
| 841 | 841 | { |
| 842 | 842 | // Check if the file is successfully uploaded |
| 843 | 843 | $file = $_FILES['image_name']; |
| 844 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 844 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 845 | 845 | // Ignore if member_srl is invalid or doesn't exist. |
| 846 | 846 | $member_srl = Context::get('member_srl'); |
| 847 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 847 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 848 | 848 | |
| 849 | 849 | $logged_info = Context::get('logged_info'); |
| 850 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 850 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 851 | 851 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 852 | 852 | $oMemberModel = getModel('member'); |
| 853 | 853 | $config = $oMemberModel->getMemberConfig(); |
| 854 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 854 | + if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 855 | 855 | |
| 856 | 856 | $output = $this->insertImageName($member_srl, $file['tmp_name']); |
| 857 | - if(!$output->toBool()) return $output; |
|
| 857 | + if (!$output->toBool()) return $output; |
|
| 858 | 858 | |
| 859 | 859 | // Page refresh |
| 860 | 860 | //$this->setRefreshPage(); |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | $max_height = $config->image_name_max_height; |
| 880 | 880 | $max_filesize = $config->image_name_max_filesize; |
| 881 | 881 | |
| 882 | - Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
| 882 | + Context::loadLang(_XE_PATH_.'modules/file/lang'); |
|
| 883 | 883 | |
| 884 | 884 | // Get a target path to save |
| 885 | 885 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | // Get file information |
| 890 | 890 | list($width, $height, $type) = @getimagesize($target_file); |
| 891 | 891 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 892 | - if($width > $max_width || $height > $max_height || $type!=1) |
|
| 892 | + if ($width > $max_width || $height > $max_height || $type != 1) |
|
| 893 | 893 | { |
| 894 | 894 | $temp_filename = sprintf('files/cache/tmp/image_name_%d.gif', $member_srl, $ext); |
| 895 | 895 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, 'gif'); |
@@ -897,10 +897,10 @@ discard block |
||
| 897 | 897 | // 파일 용량 제한 |
| 898 | 898 | FileHandler::clearStatCache($temp_filename); |
| 899 | 899 | $filesize = filesize($temp_filename); |
| 900 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 900 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 901 | 901 | { |
| 902 | 902 | FileHandler::removeFile($temp_filename); |
| 903 | - return $this->stop(implode(' ' , array( |
|
| 903 | + return $this->stop(implode(' ', array( |
|
| 904 | 904 | Context::getLang('msg_not_uploaded_image_name'), |
| 905 | 905 | Context::getLang('msg_exceeds_limit_size') |
| 906 | 906 | ))); |
@@ -914,9 +914,9 @@ discard block |
||
| 914 | 914 | { |
| 915 | 915 | // 파일 용량 제한 |
| 916 | 916 | $filesize = filesize($target_file); |
| 917 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 917 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 918 | 918 | { |
| 919 | - return $this->stop(implode(' ' , array( |
|
| 919 | + return $this->stop(implode(' ', array( |
|
| 920 | 920 | Context::getLang('msg_not_uploaded_image_name'), |
| 921 | 921 | Context::getLang('msg_exceeds_limit_size') |
| 922 | 922 | ))); |
@@ -938,20 +938,20 @@ discard block |
||
| 938 | 938 | function procMemberDeleteProfileImage($_memberSrl = 0) |
| 939 | 939 | { |
| 940 | 940 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 941 | - if(!$member_srl) |
|
| 941 | + if (!$member_srl) |
|
| 942 | 942 | { |
| 943 | - return new BaseObject(0,'success'); |
|
| 943 | + return new BaseObject(0, 'success'); |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | $logged_info = Context::get('logged_info'); |
| 947 | 947 | |
| 948 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 948 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 949 | 949 | { |
| 950 | 950 | $oMemberModel = getModel('member'); |
| 951 | 951 | $profile_image = $oMemberModel->getProfileImage($member_srl); |
| 952 | 952 | FileHandler::removeFile($profile_image->file); |
| 953 | 953 | } |
| 954 | - return new BaseObject(0,'success'); |
|
| 954 | + return new BaseObject(0, 'success'); |
|
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | /** |
@@ -962,20 +962,20 @@ discard block |
||
| 962 | 962 | function procMemberDeleteImageName($_memberSrl = 0) |
| 963 | 963 | { |
| 964 | 964 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 965 | - if(!$member_srl) |
|
| 965 | + if (!$member_srl) |
|
| 966 | 966 | { |
| 967 | - return new BaseObject(0,'success'); |
|
| 967 | + return new BaseObject(0, 'success'); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | $logged_info = Context::get('logged_info'); |
| 971 | 971 | |
| 972 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 972 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 973 | 973 | { |
| 974 | 974 | $oMemberModel = getModel('member'); |
| 975 | 975 | $image_name = $oMemberModel->getImageName($member_srl); |
| 976 | 976 | FileHandler::removeFile($image_name->file); |
| 977 | 977 | } |
| 978 | - return new BaseObject(0,'success'); |
|
| 978 | + return new BaseObject(0, 'success'); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | /** |
@@ -987,20 +987,20 @@ discard block |
||
| 987 | 987 | { |
| 988 | 988 | // Check if the file is successfully uploaded |
| 989 | 989 | $file = $_FILES['image_mark']; |
| 990 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 990 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 991 | 991 | // Ignore if member_srl is invalid or doesn't exist. |
| 992 | 992 | $member_srl = Context::get('member_srl'); |
| 993 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 993 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 994 | 994 | |
| 995 | 995 | $logged_info = Context::get('logged_info'); |
| 996 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 996 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 997 | 997 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 998 | 998 | $oMemberModel = getModel('member'); |
| 999 | 999 | $config = $oMemberModel->getMemberConfig(); |
| 1000 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1000 | + if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1001 | 1001 | |
| 1002 | 1002 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 1003 | - if(!$output->toBool()) return $output; |
|
| 1003 | + if (!$output->toBool()) return $output; |
|
| 1004 | 1004 | |
| 1005 | 1005 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 1006 | 1006 | $this->setRedirectUrl($returnUrl); |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | $max_height = $config->image_mark_max_height; |
| 1023 | 1023 | $max_filesize = $config->image_mark_max_filesize; |
| 1024 | 1024 | |
| 1025 | - Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
| 1025 | + Context::loadLang(_XE_PATH_.'modules/file/lang'); |
|
| 1026 | 1026 | |
| 1027 | 1027 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
| 1028 | 1028 | FileHandler::makeDir($target_path); |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | // Get file information |
| 1032 | 1032 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 1033 | 1033 | |
| 1034 | - if($width > $max_width || $height > $max_height || $type!=1) |
|
| 1034 | + if ($width > $max_width || $height > $max_height || $type != 1) |
|
| 1035 | 1035 | { |
| 1036 | 1036 | $temp_filename = sprintf('files/cache/tmp/image_mark_%d.gif', $member_srl); |
| 1037 | 1037 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, 'gif'); |
@@ -1039,10 +1039,10 @@ discard block |
||
| 1039 | 1039 | // 파일 용량 제한 |
| 1040 | 1040 | FileHandler::clearStatCache($temp_filename); |
| 1041 | 1041 | $filesize = filesize($temp_filename); |
| 1042 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1042 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1043 | 1043 | { |
| 1044 | 1044 | FileHandler::removeFile($temp_filename); |
| 1045 | - return $this->stop(implode(' ' , array( |
|
| 1045 | + return $this->stop(implode(' ', array( |
|
| 1046 | 1046 | Context::getLang('msg_not_uploaded_group_image_mark'), |
| 1047 | 1047 | Context::getLang('msg_exceeds_limit_size') |
| 1048 | 1048 | ))); |
@@ -1055,10 +1055,10 @@ discard block |
||
| 1055 | 1055 | else |
| 1056 | 1056 | { |
| 1057 | 1057 | $filesize = filesize($target_file); |
| 1058 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1058 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | FileHandler::removeFile($target_file); |
| 1061 | - return $this->stop(implode(' ' , array( |
|
| 1061 | + return $this->stop(implode(' ', array( |
|
| 1062 | 1062 | Context::getLang('msg_not_uploaded_group_image_mark'), |
| 1063 | 1063 | Context::getLang('msg_exceeds_limit_size') |
| 1064 | 1064 | ))); |
@@ -1080,20 +1080,20 @@ discard block |
||
| 1080 | 1080 | function procMemberDeleteImageMark($_memberSrl = 0) |
| 1081 | 1081 | { |
| 1082 | 1082 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 1083 | - if(!$member_srl) |
|
| 1083 | + if (!$member_srl) |
|
| 1084 | 1084 | { |
| 1085 | - return new BaseObject(0,'success'); |
|
| 1085 | + return new BaseObject(0, 'success'); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | $logged_info = Context::get('logged_info'); |
| 1089 | 1089 | |
| 1090 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 1090 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 1091 | 1091 | { |
| 1092 | 1092 | $oMemberModel = getModel('member'); |
| 1093 | 1093 | $image_mark = $oMemberModel->getImageMark($member_srl); |
| 1094 | 1094 | FileHandler::removeFile($image_mark->file); |
| 1095 | 1095 | } |
| 1096 | - return new BaseObject(0,'success'); |
|
| 1096 | + return new BaseObject(0, 'success'); |
|
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | /** |
@@ -1104,26 +1104,26 @@ discard block |
||
| 1104 | 1104 | function procMemberFindAccount() |
| 1105 | 1105 | { |
| 1106 | 1106 | $email_address = Context::get('email_address'); |
| 1107 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1107 | + if (!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1108 | 1108 | |
| 1109 | 1109 | $oMemberModel = getModel('member'); |
| 1110 | 1110 | $oModuleModel = getModel('module'); |
| 1111 | 1111 | |
| 1112 | 1112 | // Check if a member having the same email address exists |
| 1113 | 1113 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1114 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1114 | + if (!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1115 | 1115 | |
| 1116 | 1116 | // Get information of the member |
| 1117 | 1117 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
| 1118 | 1118 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1119 | 1119 | |
| 1120 | 1120 | // Check if possible to find member's ID and password |
| 1121 | - if($member_info->denied == 'Y') |
|
| 1121 | + if ($member_info->denied == 'Y') |
|
| 1122 | 1122 | { |
| 1123 | 1123 | $chk_args = new stdClass; |
| 1124 | 1124 | $chk_args->member_srl = $member_info->member_srl; |
| 1125 | 1125 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1126 | - if($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1126 | + if ($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | // Insert data into the authentication DB |
@@ -1136,19 +1136,19 @@ discard block |
||
| 1136 | 1136 | $args->is_register = 'N'; |
| 1137 | 1137 | |
| 1138 | 1138 | $output = executeQuery('member.insertAuthMail', $args); |
| 1139 | - if(!$output->toBool()) return $output; |
|
| 1139 | + if (!$output->toBool()) return $output; |
|
| 1140 | 1140 | // Get content of the email to send a member |
| 1141 | 1141 | Context::set('auth_args', $args); |
| 1142 | 1142 | |
| 1143 | 1143 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1144 | 1144 | $memberInfo = array(); |
| 1145 | 1145 | global $lang; |
| 1146 | - if(is_array($member_config->signupForm)) |
|
| 1146 | + if (is_array($member_config->signupForm)) |
|
| 1147 | 1147 | { |
| 1148 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1149 | - foreach($member_config->signupForm as $form) |
|
| 1148 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1149 | + foreach ($member_config->signupForm as $form) |
|
| 1150 | 1150 | { |
| 1151 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1151 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1152 | 1152 | { |
| 1153 | 1153 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1154 | 1154 | } |
@@ -1163,15 +1163,15 @@ discard block |
||
| 1163 | 1163 | } |
| 1164 | 1164 | Context::set('memberInfo', $memberInfo); |
| 1165 | 1165 | |
| 1166 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1167 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1166 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1167 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1168 | 1168 | |
| 1169 | 1169 | Context::set('member_config', $member_config); |
| 1170 | 1170 | |
| 1171 | 1171 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1172 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1172 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1173 | 1173 | |
| 1174 | - $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1174 | + $find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1175 | 1175 | Context::set('find_url', $find_url); |
| 1176 | 1176 | |
| 1177 | 1177 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -1181,19 +1181,19 @@ discard block |
||
| 1181 | 1181 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1182 | 1182 | // Send a mail |
| 1183 | 1183 | $oMail = new Mail(); |
| 1184 | - $oMail->setTitle( Context::getLang('msg_find_account_title') ); |
|
| 1184 | + $oMail->setTitle(Context::getLang('msg_find_account_title')); |
|
| 1185 | 1185 | $oMail->setContent($content); |
| 1186 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1187 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1186 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1187 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1188 | 1188 | $oMail->send(); |
| 1189 | 1189 | // Return message |
| 1190 | 1190 | $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); |
| 1191 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 1191 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 1192 | 1192 | { |
| 1193 | 1193 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount'); |
| 1194 | 1194 | $this->setRedirectUrl($returnUrl); |
| 1195 | 1195 | } |
| 1196 | - return new BaseObject(0,$msg); |
|
| 1196 | + return new BaseObject(0, $msg); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | /** |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | function procMemberFindAccountByQuestion() |
| 1205 | 1205 | { |
| 1206 | 1206 | $oMemberModel = getModel('member'); |
| 1207 | - $oPassword = new Password(); |
|
| 1207 | + $oPassword = new Password(); |
|
| 1208 | 1208 | $config = $oMemberModel->getMemberConfig(); |
| 1209 | 1209 | |
| 1210 | 1210 | $email_address = Context::get('email_address'); |
@@ -1212,49 +1212,49 @@ discard block |
||
| 1212 | 1212 | $find_account_question = trim(Context::get('find_account_question')); |
| 1213 | 1213 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1214 | 1214 | |
| 1215 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1215 | + if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1216 | 1216 | |
| 1217 | 1217 | $oModuleModel = getModel('module'); |
| 1218 | 1218 | // Check if a member having the same email address exists |
| 1219 | 1219 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1220 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1220 | + if (!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1221 | 1221 | |
| 1222 | 1222 | // Get information of the member |
| 1223 | 1223 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1224 | 1224 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1225 | 1225 | |
| 1226 | 1226 | // Display a message if no answer is entered |
| 1227 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1227 | + if (!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1228 | 1228 | |
| 1229 | 1229 | // 답변 확인 |
| 1230 | 1230 | $hashed = $oPassword->checkAlgorithm($member_info->find_account_answer); |
| 1231 | 1231 | $authed = true; |
| 1232 | 1232 | $member_info->find_account_question = trim($member_info->find_account_question); |
| 1233 | - if($member_info->find_account_question != $find_account_question) |
|
| 1233 | + if ($member_info->find_account_question != $find_account_question) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $authed = false; |
| 1236 | 1236 | } |
| 1237 | - else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1237 | + else if ($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1238 | 1238 | { |
| 1239 | 1239 | $authed = false; |
| 1240 | 1240 | } |
| 1241 | - else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1241 | + else if (!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1242 | 1242 | { |
| 1243 | 1243 | $authed = false; |
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | - if(!$authed) |
|
| 1246 | + if (!$authed) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | return new BaseObject(-1, 'msg_answer_not_matches'); |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | // answer가 동일하고 hash 되지 않았으면 hash 값으로 저장 |
| 1252 | - if($authed && !$hashed) |
|
| 1252 | + if ($authed && !$hashed) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $this->updateFindAccountAnswer($member_srl, $find_account_answer); |
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | - if($config->identifier == 'email_address') |
|
| 1257 | + if ($config->identifier == 'email_address') |
|
| 1258 | 1258 | { |
| 1259 | 1259 | $user_id = $email_address; |
| 1260 | 1260 | } |
@@ -1267,11 +1267,11 @@ discard block |
||
| 1267 | 1267 | $args->password = $temp_password; |
| 1268 | 1268 | $args->change_password_date = '1'; |
| 1269 | 1269 | $output = $this->updateMemberPassword($args); |
| 1270 | - if(!$output->toBool()) return $output; |
|
| 1270 | + if (!$output->toBool()) return $output; |
|
| 1271 | 1271 | |
| 1272 | - $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
|
| 1272 | + $_SESSION['xe_temp_password_'.$user_id] = $temp_password; |
|
| 1273 | 1273 | |
| 1274 | - $this->add('user_id',$user_id); |
|
| 1274 | + $this->add('user_id', $user_id); |
|
| 1275 | 1275 | |
| 1276 | 1276 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 1277 | 1277 | $this->setRedirectUrl($returnUrl.'&user_id='.$user_id); |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | $member_srl = Context::get('member_srl'); |
| 1292 | 1292 | $auth_key = Context::get('auth_key'); |
| 1293 | 1293 | |
| 1294 | - if(!$member_srl || !$auth_key) |
|
| 1294 | + if (!$member_srl || !$auth_key) |
|
| 1295 | 1295 | { |
| 1296 | 1296 | return $this->stop('msg_invalid_request'); |
| 1297 | 1297 | } |
@@ -1302,9 +1302,9 @@ discard block |
||
| 1302 | 1302 | $args->auth_key = $auth_key; |
| 1303 | 1303 | $output = executeQuery('member.getAuthMail', $args); |
| 1304 | 1304 | |
| 1305 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1305 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1306 | 1306 | { |
| 1307 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1307 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1308 | 1308 | { |
| 1309 | 1309 | executeQuery('member.deleteAuthMail', $args); |
| 1310 | 1310 | } |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | return $this->stop('msg_invalid_auth_key'); |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1315 | + if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1316 | 1316 | { |
| 1317 | 1317 | executeQuery('member.deleteAuthMail', $args); |
| 1318 | 1318 | return $this->stop('msg_invalid_auth_key'); |
@@ -1321,7 +1321,7 @@ discard block |
||
| 1321 | 1321 | $args->password = $output->data->new_password; |
| 1322 | 1322 | |
| 1323 | 1323 | // If credentials are correct, change the password to a new one |
| 1324 | - if($output->data->is_register == 'Y') |
|
| 1324 | + if ($output->data->is_register == 'Y') |
|
| 1325 | 1325 | { |
| 1326 | 1326 | $args->denied = 'N'; |
| 1327 | 1327 | } |
@@ -1334,13 +1334,13 @@ discard block |
||
| 1334 | 1334 | $is_register = $output->data->is_register; |
| 1335 | 1335 | |
| 1336 | 1336 | $output = executeQuery('member.updateMemberPassword', $args); |
| 1337 | - if(!$output->toBool()) |
|
| 1337 | + if (!$output->toBool()) |
|
| 1338 | 1338 | { |
| 1339 | 1339 | return $this->stop($output->getMessage()); |
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | 1342 | // Remove all values having the member_srl from authentication table |
| 1343 | - executeQuery('member.deleteAuthMail',$args); |
|
| 1343 | + executeQuery('member.deleteAuthMail', $args); |
|
| 1344 | 1344 | |
| 1345 | 1345 | $this->_clearMemberCache($args->member_srl); |
| 1346 | 1346 | |
@@ -1359,33 +1359,33 @@ discard block |
||
| 1359 | 1359 | { |
| 1360 | 1360 | // Get an email_address |
| 1361 | 1361 | $email_address = Context::get('email_address'); |
| 1362 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1362 | + if (!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1363 | 1363 | // Log test by using email_address |
| 1364 | 1364 | $oMemberModel = getModel('member'); |
| 1365 | 1365 | |
| 1366 | 1366 | $args = new stdClass; |
| 1367 | 1367 | $args->email_address = $email_address; |
| 1368 | 1368 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1369 | - if(!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1369 | + if (!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1370 | 1370 | |
| 1371 | 1371 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1372 | 1372 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1373 | 1373 | |
| 1374 | 1374 | $oModuleModel = getModel('module'); |
| 1375 | 1375 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1376 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1377 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1376 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1377 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1378 | 1378 | |
| 1379 | 1379 | // Check if a authentication mail has been sent previously |
| 1380 | 1380 | $chk_args = new stdClass; |
| 1381 | 1381 | $chk_args->member_srl = $member_info->member_srl; |
| 1382 | 1382 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1383 | - if($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1383 | + if ($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1384 | 1384 | |
| 1385 | 1385 | $auth_args = new stdClass; |
| 1386 | 1386 | $auth_args->member_srl = $member_info->member_srl; |
| 1387 | 1387 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1388 | - if(!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1388 | + if (!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1389 | 1389 | $auth_info = $output->data[0]; |
| 1390 | 1390 | |
| 1391 | 1391 | // Update the regdate of authmail entry |
@@ -1396,12 +1396,12 @@ discard block |
||
| 1396 | 1396 | |
| 1397 | 1397 | $memberInfo = array(); |
| 1398 | 1398 | global $lang; |
| 1399 | - if(is_array($member_config->signupForm)) |
|
| 1399 | + if (is_array($member_config->signupForm)) |
|
| 1400 | 1400 | { |
| 1401 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1402 | - foreach($member_config->signupForm as $form) |
|
| 1401 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1402 | + foreach ($member_config->signupForm as $form) |
|
| 1403 | 1403 | { |
| 1404 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1404 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1405 | 1405 | { |
| 1406 | 1406 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1407 | 1407 | } |
@@ -1420,19 +1420,19 @@ discard block |
||
| 1420 | 1420 | Context::set('member_config', $member_config); |
| 1421 | 1421 | |
| 1422 | 1422 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1423 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1423 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1424 | 1424 | |
| 1425 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
|
| 1425 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key); |
|
| 1426 | 1426 | Context::set('auth_url', $auth_url); |
| 1427 | 1427 | |
| 1428 | 1428 | $oTemplate = &TemplateHandler::getInstance(); |
| 1429 | 1429 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1430 | 1430 | // Send a mail |
| 1431 | 1431 | $oMail = new Mail(); |
| 1432 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1432 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1433 | 1433 | $oMail->setContent($content); |
| 1434 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1435 | - $oMail->setReceiptor( $args->user_name, $args->email_address ); |
|
| 1434 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1435 | + $oMail->setReceiptor($args->user_name, $args->email_address); |
|
| 1436 | 1436 | $oMail->send(); |
| 1437 | 1437 | |
| 1438 | 1438 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
@@ -1447,23 +1447,23 @@ discard block |
||
| 1447 | 1447 | $memberInfo = $_SESSION['auth_member_info']; |
| 1448 | 1448 | unset($_SESSION['auth_member_info']); |
| 1449 | 1449 | |
| 1450 | - if(!$memberInfo) |
|
| 1450 | + if (!$memberInfo) |
|
| 1451 | 1451 | { |
| 1452 | 1452 | return $this->stop('msg_invalid_request'); |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | 1455 | $newEmail = Context::get('email_address'); |
| 1456 | 1456 | |
| 1457 | - if(!$newEmail) |
|
| 1457 | + if (!$newEmail) |
|
| 1458 | 1458 | { |
| 1459 | 1459 | return $this->stop('msg_invalid_request'); |
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | 1462 | $oMemberModel = getModel('member'); |
| 1463 | 1463 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 1464 | - if($member_srl) |
|
| 1464 | + if ($member_srl) |
|
| 1465 | 1465 | { |
| 1466 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 1466 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | // remove all key by member_srl |
@@ -1471,7 +1471,7 @@ discard block |
||
| 1471 | 1471 | $args->member_srl = $memberInfo->member_srl; |
| 1472 | 1472 | $output = executeQuery('member.deleteAuthMail', $args); |
| 1473 | 1473 | |
| 1474 | - if(!$output->toBool()) |
|
| 1474 | + if (!$output->toBool()) |
|
| 1475 | 1475 | { |
| 1476 | 1476 | return $output; |
| 1477 | 1477 | } |
@@ -1481,7 +1481,7 @@ discard block |
||
| 1481 | 1481 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 1482 | 1482 | |
| 1483 | 1483 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 1484 | - if(!$output->toBool()) |
|
| 1484 | + if (!$output->toBool()) |
|
| 1485 | 1485 | { |
| 1486 | 1486 | return $this->stop($output->getMessage()); |
| 1487 | 1487 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | $auth_args->is_register = 'Y'; |
| 1499 | 1499 | |
| 1500 | 1500 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1501 | - if(!$output->toBool()) return $output; |
|
| 1501 | + if (!$output->toBool()) return $output; |
|
| 1502 | 1502 | |
| 1503 | 1503 | $memberInfo->email_address = $newEmail; |
| 1504 | 1504 | |
@@ -1522,12 +1522,12 @@ discard block |
||
| 1522 | 1522 | $memberInfo = array(); |
| 1523 | 1523 | |
| 1524 | 1524 | global $lang; |
| 1525 | - if(is_array($member_config->signupForm)) |
|
| 1525 | + if (is_array($member_config->signupForm)) |
|
| 1526 | 1526 | { |
| 1527 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1528 | - foreach($member_config->signupForm as $form) |
|
| 1527 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1528 | + foreach ($member_config->signupForm as $form) |
|
| 1529 | 1529 | { |
| 1530 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1530 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1531 | 1531 | { |
| 1532 | 1532 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1533 | 1533 | } |
@@ -1542,25 +1542,25 @@ discard block |
||
| 1542 | 1542 | } |
| 1543 | 1543 | Context::set('memberInfo', $memberInfo); |
| 1544 | 1544 | |
| 1545 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1546 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1545 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1546 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1547 | 1547 | |
| 1548 | 1548 | Context::set('member_config', $member_config); |
| 1549 | 1549 | |
| 1550 | 1550 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1551 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1551 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1552 | 1552 | |
| 1553 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 1553 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 1554 | 1554 | Context::set('auth_url', $auth_url); |
| 1555 | 1555 | |
| 1556 | 1556 | $oTemplate = &TemplateHandler::getInstance(); |
| 1557 | 1557 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1558 | 1558 | // Send a mail |
| 1559 | 1559 | $oMail = new Mail(); |
| 1560 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1560 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1561 | 1561 | $oMail->setContent($content); |
| 1562 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1563 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1562 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1563 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1564 | 1564 | $oMail->send(); |
| 1565 | 1565 | } |
| 1566 | 1566 | |
@@ -1573,7 +1573,7 @@ discard block |
||
| 1573 | 1573 | { |
| 1574 | 1574 | $site_module_info = Context::get('site_module_info'); |
| 1575 | 1575 | $logged_info = Context::get('logged_info'); |
| 1576 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1576 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1577 | 1577 | |
| 1578 | 1578 | $oMemberModel = getModel('member'); |
| 1579 | 1579 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1592,13 +1592,13 @@ discard block |
||
| 1592 | 1592 | { |
| 1593 | 1593 | $site_module_info = Context::get('site_module_info'); |
| 1594 | 1594 | $logged_info = Context::get('logged_info'); |
| 1595 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1595 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1596 | 1596 | |
| 1597 | 1597 | $args = new stdClass; |
| 1598 | - $args->site_srl= $site_module_info->site_srl; |
|
| 1598 | + $args->site_srl = $site_module_info->site_srl; |
|
| 1599 | 1599 | $args->member_srl = $logged_info->member_srl; |
| 1600 | 1600 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1601 | - if(!$output->toBool()) return $output; |
|
| 1601 | + if (!$output->toBool()) return $output; |
|
| 1602 | 1602 | $this->setMessage('success_deleted'); |
| 1603 | 1603 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1604 | 1604 | } |
@@ -1612,25 +1612,25 @@ discard block |
||
| 1612 | 1612 | */ |
| 1613 | 1613 | function setMemberConfig($args) |
| 1614 | 1614 | { |
| 1615 | - if(!$args->skin) $args->skin = "default"; |
|
| 1616 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1617 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1618 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1619 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1620 | - $args->enable_openid= 'N'; |
|
| 1621 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1622 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1623 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1624 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1625 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1626 | - $args->limit_day = (int)$args->limit_day; |
|
| 1615 | + if (!$args->skin) $args->skin = "default"; |
|
| 1616 | + if (!$args->colorset) $args->colorset = "white"; |
|
| 1617 | + if (!$args->editor_skin) $args->editor_skin = "ckeditor"; |
|
| 1618 | + if (!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1619 | + if ($args->enable_join != 'Y') $args->enable_join = 'N'; |
|
| 1620 | + $args->enable_openid = 'N'; |
|
| 1621 | + if ($args->profile_image != 'Y') $args->profile_image = 'N'; |
|
| 1622 | + if ($args->image_name != 'Y') $args->image_name = 'N'; |
|
| 1623 | + if ($args->image_mark != 'Y') $args->image_mark = 'N'; |
|
| 1624 | + if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N'; |
|
| 1625 | + if (!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1626 | + $args->limit_day = (int) $args->limit_day; |
|
| 1627 | 1627 | |
| 1628 | 1628 | $agreement = trim($args->agreement); |
| 1629 | 1629 | unset($args->agreement); |
| 1630 | 1630 | |
| 1631 | 1631 | $oModuleController = getController('module'); |
| 1632 | - $output = $oModuleController->insertModuleConfig('member',$args); |
|
| 1633 | - if(!$output->toBool()) return $output; |
|
| 1632 | + $output = $oModuleController->insertModuleConfig('member', $args); |
|
| 1633 | + if (!$output->toBool()) return $output; |
|
| 1634 | 1634 | |
| 1635 | 1635 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1636 | 1636 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1651,11 +1651,11 @@ discard block |
||
| 1651 | 1651 | $signature = trim(removeHackTag($signature)); |
| 1652 | 1652 | $signature = preg_replace('/<(\/?)(embed|object|param)/is', '<$1$2', $signature); |
| 1653 | 1653 | |
| 1654 | - $check_signature = trim(str_replace(array(' ',"\n","\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1654 | + $check_signature = trim(str_replace(array(' ', "\n", "\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1655 | 1655 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1656 | 1656 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1657 | 1657 | |
| 1658 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1658 | + if (!$check_signature) return FileHandler::removeFile($filename); |
|
| 1659 | 1659 | |
| 1660 | 1660 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1661 | 1661 | FileHandler::makeDir($path); |
@@ -1684,15 +1684,15 @@ discard block |
||
| 1684 | 1684 | * |
| 1685 | 1685 | * @return BaseObject |
| 1686 | 1686 | */ |
| 1687 | - function addMemberToGroup($member_srl, $group_srl, $site_srl=0) |
|
| 1687 | + function addMemberToGroup($member_srl, $group_srl, $site_srl = 0) |
|
| 1688 | 1688 | { |
| 1689 | 1689 | $args = new stdClass(); |
| 1690 | 1690 | $args->member_srl = $member_srl; |
| 1691 | 1691 | $args->group_srl = $group_srl; |
| 1692 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1692 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1693 | 1693 | |
| 1694 | 1694 | // Add |
| 1695 | - $output = executeQuery('member.addMemberToGroup',$args); |
|
| 1695 | + $output = executeQuery('member.addMemberToGroup', $args); |
|
| 1696 | 1696 | $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); |
| 1697 | 1697 | |
| 1698 | 1698 | $this->_clearMemberCache($member_srl, $site_srl); |
@@ -1712,18 +1712,18 @@ discard block |
||
| 1712 | 1712 | { |
| 1713 | 1713 | $obj = new stdClass; |
| 1714 | 1714 | $obj->site_srl = $args->site_srl; |
| 1715 | - $obj->member_srl = implode(',',$args->member_srl); |
|
| 1715 | + $obj->member_srl = implode(',', $args->member_srl); |
|
| 1716 | 1716 | |
| 1717 | 1717 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1718 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1718 | + if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1719 | 1719 | |
| 1720 | 1720 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1721 | - if(!$output->toBool()) return $output; |
|
| 1721 | + if (!$output->toBool()) return $output; |
|
| 1722 | 1722 | |
| 1723 | 1723 | $inserted_members = array(); |
| 1724 | - foreach($args->member_srl as $key => $val) |
|
| 1724 | + foreach ($args->member_srl as $key => $val) |
|
| 1725 | 1725 | { |
| 1726 | - if($inserted_members[$val]) continue; |
|
| 1726 | + if ($inserted_members[$val]) continue; |
|
| 1727 | 1727 | $inserted_members[$val] = true; |
| 1728 | 1728 | |
| 1729 | 1729 | unset($obj); |
@@ -1733,7 +1733,7 @@ discard block |
||
| 1733 | 1733 | $obj->site_srl = $args->site_srl; |
| 1734 | 1734 | $obj->regdate = $date[$obj->member_srl]; |
| 1735 | 1735 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1736 | - if(!$output->toBool()) return $output; |
|
| 1736 | + if (!$output->toBool()) return $output; |
|
| 1737 | 1737 | |
| 1738 | 1738 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1739 | 1739 | } |
@@ -1755,9 +1755,9 @@ discard block |
||
| 1755 | 1755 | // Get information of the key |
| 1756 | 1756 | $output = executeQuery('member.getAutologin', $args); |
| 1757 | 1757 | // If no information exists, delete a cookie |
| 1758 | - if(!$output->toBool() || !$output->data) |
|
| 1758 | + if (!$output->toBool() || !$output->data) |
|
| 1759 | 1759 | { |
| 1760 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1760 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1761 | 1761 | return; |
| 1762 | 1762 | } |
| 1763 | 1763 | |
@@ -1767,9 +1767,9 @@ discard block |
||
| 1767 | 1767 | $user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address; |
| 1768 | 1768 | $password = $output->data->password; |
| 1769 | 1769 | |
| 1770 | - if(!$user_id || !$password) |
|
| 1770 | + if (!$user_id || !$password) |
|
| 1771 | 1771 | { |
| 1772 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1772 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1773 | 1773 | return; |
| 1774 | 1774 | } |
| 1775 | 1775 | |
@@ -1779,7 +1779,7 @@ discard block |
||
| 1779 | 1779 | $check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT']; |
| 1780 | 1780 | $check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32); |
| 1781 | 1781 | |
| 1782 | - if($check_key === substr($args->autologin_key, 32)) |
|
| 1782 | + if ($check_key === substr($args->autologin_key, 32)) |
|
| 1783 | 1783 | { |
| 1784 | 1784 | // Check change_password_date |
| 1785 | 1785 | $oModuleModel = getModel('module'); |
@@ -1787,12 +1787,12 @@ discard block |
||
| 1787 | 1787 | $limit_date = $member_config->change_password_date; |
| 1788 | 1788 | |
| 1789 | 1789 | // Check if change_password_date is set |
| 1790 | - if($limit_date > 0) |
|
| 1790 | + if ($limit_date > 0) |
|
| 1791 | 1791 | { |
| 1792 | 1792 | $oMemberModel = getModel('member'); |
| 1793 | 1793 | $columnList = array('member_srl', 'change_password_date'); |
| 1794 | 1794 | |
| 1795 | - if($config->identifier == 'user_id') |
|
| 1795 | + if ($config->identifier == 'user_id') |
|
| 1796 | 1796 | { |
| 1797 | 1797 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1798 | 1798 | } |
@@ -1801,7 +1801,7 @@ discard block |
||
| 1801 | 1801 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1802 | 1802 | } |
| 1803 | 1803 | |
| 1804 | - if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){ |
|
| 1804 | + if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) { |
|
| 1805 | 1805 | $do_auto_login = true; |
| 1806 | 1806 | } |
| 1807 | 1807 | |
@@ -1812,14 +1812,14 @@ discard block |
||
| 1812 | 1812 | } |
| 1813 | 1813 | } |
| 1814 | 1814 | |
| 1815 | - if($do_auto_login) |
|
| 1815 | + if ($do_auto_login) |
|
| 1816 | 1816 | { |
| 1817 | 1817 | $output = $this->doLogin($user_id); |
| 1818 | 1818 | } |
| 1819 | 1819 | else |
| 1820 | 1820 | { |
| 1821 | 1821 | executeQuery('member.deleteAutologin', $args); |
| 1822 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1822 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1823 | 1823 | } |
| 1824 | 1824 | } |
| 1825 | 1825 | |
@@ -1835,13 +1835,13 @@ discard block |
||
| 1835 | 1835 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1836 | 1836 | { |
| 1837 | 1837 | $user_id = strtolower($user_id); |
| 1838 | - if(!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 1838 | + if (!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 1839 | 1839 | // Call a trigger before log-in (before) |
| 1840 | 1840 | $trigger_obj = new stdClass(); |
| 1841 | 1841 | $trigger_obj->user_id = $user_id; |
| 1842 | 1842 | $trigger_obj->password = $password; |
| 1843 | 1843 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1844 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1844 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1845 | 1845 | // Create a member model object |
| 1846 | 1846 | $oMemberModel = getModel('member'); |
| 1847 | 1847 | |
@@ -1851,12 +1851,12 @@ discard block |
||
| 1851 | 1851 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1852 | 1852 | |
| 1853 | 1853 | // check identifier |
| 1854 | - if($config->identifier == 'email_address') |
|
| 1854 | + if ($config->identifier == 'email_address') |
|
| 1855 | 1855 | { |
| 1856 | 1856 | // Get user_id information |
| 1857 | 1857 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1858 | 1858 | // Set an invalid user if no value returned |
| 1859 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1859 | + if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1860 | 1860 | |
| 1861 | 1861 | } |
| 1862 | 1862 | else |
@@ -1864,24 +1864,24 @@ discard block |
||
| 1864 | 1864 | // Get user_id information |
| 1865 | 1865 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1866 | 1866 | // Set an invalid user if no value returned |
| 1867 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1867 | + if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1868 | 1868 | } |
| 1869 | 1869 | |
| 1870 | 1870 | $output = executeQuery('member.getLoginCountByIp', $args); |
| 1871 | 1871 | $errorCount = $output->data->count; |
| 1872 | - if($errorCount >= $config->max_error_count) |
|
| 1872 | + if ($errorCount >= $config->max_error_count) |
|
| 1873 | 1873 | { |
| 1874 | 1874 | $last_update = strtotime($output->data->last_update); |
| 1875 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
| 1876 | - if($term < $config->max_error_count_time) |
|
| 1875 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
| 1876 | + if ($term < $config->max_error_count_time) |
|
| 1877 | 1877 | { |
| 1878 | 1878 | $term = $config->max_error_count_time - $term; |
| 1879 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1880 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1881 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1882 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1879 | + if ($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1880 | + elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min'); |
|
| 1881 | + elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour'); |
|
| 1882 | + else $term = intval($term / 86400).Context::getLang('unit_day'); |
|
| 1883 | 1883 | |
| 1884 | - return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
|
| 1884 | + return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'), $term)); |
|
| 1885 | 1885 | } |
| 1886 | 1886 | else |
| 1887 | 1887 | { |
@@ -1891,13 +1891,13 @@ discard block |
||
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | 1893 | // Password Check |
| 1894 | - if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1894 | + if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1895 | 1895 | { |
| 1896 | - return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo); |
|
| 1896 | + return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo); |
|
| 1897 | 1897 | } |
| 1898 | 1898 | |
| 1899 | 1899 | // If denied == 'Y', notify |
| 1900 | - if($this->memberInfo->denied == 'Y') |
|
| 1900 | + if ($this->memberInfo->denied == 'Y') |
|
| 1901 | 1901 | { |
| 1902 | 1902 | $args->member_srl = $this->memberInfo->member_srl; |
| 1903 | 1903 | $output = executeQuery('member.chkAuthMail', $args); |
@@ -1905,12 +1905,12 @@ discard block |
||
| 1905 | 1905 | { |
| 1906 | 1906 | $_SESSION['auth_member_srl'] = $this->memberInfo->member_srl; |
| 1907 | 1907 | $redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail'); |
| 1908 | - return $this->setRedirectUrl($redirectUrl, new BaseObject(-1,'msg_user_not_confirmed')); |
|
| 1908 | + return $this->setRedirectUrl($redirectUrl, new BaseObject(-1, 'msg_user_not_confirmed')); |
|
| 1909 | 1909 | } |
| 1910 | - return new BaseObject(-1,'msg_user_denied'); |
|
| 1910 | + return new BaseObject(-1, 'msg_user_denied'); |
|
| 1911 | 1911 | } |
| 1912 | 1912 | // Notify if denied_date is less than the current time |
| 1913 | - if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new BaseObject(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
| 1913 | + if ($this->memberInfo->limit_date && substr($this->memberInfo->limit_date, 0, 8) >= date("Ymd")) return new BaseObject(-9, sprintf(Context::getLang('msg_user_limited'), zdate($this->memberInfo->limit_date, "Y-m-d"))); |
|
| 1914 | 1914 | // Update the latest login time |
| 1915 | 1915 | $args->member_srl = $this->memberInfo->member_srl; |
| 1916 | 1916 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1920,36 +1920,36 @@ discard block |
||
| 1920 | 1920 | |
| 1921 | 1921 | // Check if there is recoding table. |
| 1922 | 1922 | $oDB = &DB::getInstance(); |
| 1923 | - if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1923 | + if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1924 | 1924 | { |
| 1925 | 1925 | // check if there is login fail records. |
| 1926 | 1926 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
| 1927 | - if($output->data && $output->data->content) |
|
| 1927 | + if ($output->data && $output->data->content) |
|
| 1928 | 1928 | { |
| 1929 | 1929 | $title = Context::getLang('login_fail_report'); |
| 1930 | 1930 | $message = '<ul>'; |
| 1931 | 1931 | $content = unserialize($output->data->content); |
| 1932 | - if(count($content) > $config->max_error_count) |
|
| 1932 | + if (count($content) > $config->max_error_count) |
|
| 1933 | 1933 | { |
| 1934 | - foreach($content as $val) |
|
| 1934 | + foreach ($content as $val) |
|
| 1935 | 1935 | { |
| 1936 | - $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa',$val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
| 1936 | + $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa', $val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
| 1937 | 1937 | } |
| 1938 | 1938 | $message .= '</ul>'; |
| 1939 | - $content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa')); |
|
| 1939 | + $content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa')); |
|
| 1940 | 1940 | |
| 1941 | 1941 | //send message |
| 1942 | 1942 | $oCommunicationController = getController('communication'); |
| 1943 | 1943 | $oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true); |
| 1944 | 1944 | |
| 1945 | - if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1945 | + if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1946 | 1946 | { |
| 1947 | 1947 | $view_url = Context::getRequestUri(); |
| 1948 | - $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
| 1948 | + $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>", $content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
| 1949 | 1949 | $oMail = new Mail(); |
| 1950 | 1950 | $oMail->setTitle($title); |
| 1951 | 1951 | $oMail->setContent($content); |
| 1952 | - $oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email); |
|
| 1952 | + $oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email); |
|
| 1953 | 1953 | $oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address); |
| 1954 | 1954 | $oMail->send(); |
| 1955 | 1955 | } |
@@ -1959,9 +1959,9 @@ discard block |
||
| 1959 | 1959 | } |
| 1960 | 1960 | // Call a trigger after successfully log-in (after) |
| 1961 | 1961 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1962 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1962 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1963 | 1963 | // When user checked to use auto-login |
| 1964 | - if($keep_signed) |
|
| 1964 | + if ($keep_signed) |
|
| 1965 | 1965 | { |
| 1966 | 1966 | // Key generate for auto login |
| 1967 | 1967 | $oPassword = new Password(); |
@@ -1973,12 +1973,12 @@ discard block |
||
| 1973 | 1973 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1974 | 1974 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1975 | 1975 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1976 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 1976 | + if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000); |
|
| 1977 | 1977 | } |
| 1978 | - if($this->memberInfo->is_admin == 'Y') |
|
| 1978 | + if ($this->memberInfo->is_admin == 'Y') |
|
| 1979 | 1979 | { |
| 1980 | 1980 | $oMemberAdminModel = getAdminModel('member'); |
| 1981 | - if(!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1981 | + if (!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1982 | 1982 | { |
| 1983 | 1983 | $_SESSION['denied_admin'] = 'Y'; |
| 1984 | 1984 | } |
@@ -1996,18 +1996,18 @@ discard block |
||
| 1996 | 1996 | { |
| 1997 | 1997 | $oMemberModel = getModel('member'); |
| 1998 | 1998 | // If your information came through the current session information to extract information from the users |
| 1999 | - if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) |
|
| 1999 | + if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged()) |
|
| 2000 | 2000 | { |
| 2001 | 2001 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); |
| 2002 | 2002 | // If you do not destroy the session Profile |
| 2003 | - if($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 2003 | + if ($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 2004 | 2004 | { |
| 2005 | 2005 | $this->destroySessionInfo(); |
| 2006 | 2006 | return; |
| 2007 | 2007 | } |
| 2008 | 2008 | } |
| 2009 | 2009 | // Stop using the session id is destroyed |
| 2010 | - if($this->memberInfo->denied=='Y') |
|
| 2010 | + if ($this->memberInfo->denied == 'Y') |
|
| 2011 | 2011 | { |
| 2012 | 2012 | $this->destroySessionInfo(); |
| 2013 | 2013 | return; |
@@ -2037,10 +2037,10 @@ discard block |
||
| 2037 | 2037 | Context::set('logged_info', $this->memberInfo); |
| 2038 | 2038 | |
| 2039 | 2039 | // Only the menu configuration of the user (such as an add-on to the menu can be changed) |
| 2040 | - $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); |
|
| 2041 | - $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 2042 | - $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 2043 | - $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 2040 | + $this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info'); |
|
| 2041 | + $this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 2042 | + $this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 2043 | + $this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 2044 | 2044 | } |
| 2045 | 2045 | |
| 2046 | 2046 | /** |
@@ -2062,7 +2062,7 @@ discard block |
||
| 2062 | 2062 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 2063 | 2063 | { |
| 2064 | 2064 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 2065 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2065 | + if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2066 | 2066 | |
| 2067 | 2067 | $obj = new stdClass; |
| 2068 | 2068 | $obj->url = $url; |
@@ -2081,33 +2081,33 @@ discard block |
||
| 2081 | 2081 | { |
| 2082 | 2082 | // Call a trigger (before) |
| 2083 | 2083 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 2084 | - if(!$output->toBool()) return $output; |
|
| 2084 | + if (!$output->toBool()) return $output; |
|
| 2085 | 2085 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 2086 | 2086 | $oModuleModel = getModel('module'); |
| 2087 | 2087 | $config = $oModuleModel->getModuleConfig('member'); |
| 2088 | 2088 | |
| 2089 | 2089 | $logged_info = Context::get('logged_info'); |
| 2090 | 2090 | // If the date of the temporary restrictions limit further information on the date of |
| 2091 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2091 | + if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24); |
|
| 2092 | 2092 | |
| 2093 | 2093 | $args->member_srl = getNextSequence(); |
| 2094 | 2094 | $args->list_order = -1 * $args->member_srl; |
| 2095 | 2095 | |
| 2096 | 2096 | // Execute insert or update depending on the value of member_srl |
| 2097 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2097 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2098 | 2098 | // Enter the user's identity changed to lowercase |
| 2099 | 2099 | else $args->user_id = strtolower($args->user_id); |
| 2100 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2101 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2100 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2101 | + if (!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2102 | 2102 | |
| 2103 | 2103 | // Control of essential parameters |
| 2104 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2105 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2106 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 2104 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2105 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2106 | + if (!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F')))) $args->allow_message = 'Y'; |
|
| 2107 | 2107 | |
| 2108 | - if($logged_info->is_admin == 'Y') |
|
| 2108 | + if ($logged_info->is_admin == 'Y') |
|
| 2109 | 2109 | { |
| 2110 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 2110 | + if ($args->is_admin != 'Y') $args->is_admin = 'N'; |
|
| 2111 | 2111 | } |
| 2112 | 2112 | else |
| 2113 | 2113 | { |
@@ -2122,97 +2122,97 @@ discard block |
||
| 2122 | 2122 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2123 | 2123 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2124 | 2124 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2125 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2126 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2125 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2126 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2127 | 2127 | |
| 2128 | 2128 | // Create a model object |
| 2129 | 2129 | $oMemberModel = getModel('member'); |
| 2130 | 2130 | |
| 2131 | 2131 | // Check password strength |
| 2132 | - if($args->password && !$password_is_hashed) |
|
| 2132 | + if ($args->password && !$password_is_hashed) |
|
| 2133 | 2133 | { |
| 2134 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2134 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2135 | 2135 | { |
| 2136 | 2136 | $message = Context::getLang('about_password_strength'); |
| 2137 | 2137 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2138 | 2138 | } |
| 2139 | 2139 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2140 | 2140 | } |
| 2141 | - elseif(!$args->password) |
|
| 2141 | + elseif (!$args->password) |
|
| 2142 | 2142 | { |
| 2143 | 2143 | unset($args->password); |
| 2144 | 2144 | } |
| 2145 | 2145 | |
| 2146 | - if($args->find_account_answer && !$password_is_hashed) |
|
| 2146 | + if ($args->find_account_answer && !$password_is_hashed) |
|
| 2147 | 2147 | { |
| 2148 | 2148 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2149 | 2149 | } |
| 2150 | - elseif(!$args->find_account_answer) |
|
| 2150 | + elseif (!$args->find_account_answer) |
|
| 2151 | 2151 | { |
| 2152 | 2152 | unset($args->find_account_answer); |
| 2153 | 2153 | } |
| 2154 | 2154 | |
| 2155 | 2155 | // Check if ID is prohibited |
| 2156 | - if($oMemberModel->isDeniedID($args->user_id)) |
|
| 2156 | + if ($oMemberModel->isDeniedID($args->user_id)) |
|
| 2157 | 2157 | { |
| 2158 | - return new BaseObject(-1,'denied_user_id'); |
|
| 2158 | + return new BaseObject(-1, 'denied_user_id'); |
|
| 2159 | 2159 | } |
| 2160 | 2160 | |
| 2161 | 2161 | // Check if ID is duplicate |
| 2162 | 2162 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2163 | - if($member_srl) |
|
| 2163 | + if ($member_srl) |
|
| 2164 | 2164 | { |
| 2165 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2165 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2166 | 2166 | } |
| 2167 | 2167 | |
| 2168 | 2168 | // Check if nickname is prohibited |
| 2169 | - if($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2169 | + if ($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2170 | 2170 | { |
| 2171 | - return new BaseObject(-1,'denied_nick_name'); |
|
| 2171 | + return new BaseObject(-1, 'denied_nick_name'); |
|
| 2172 | 2172 | } |
| 2173 | 2173 | |
| 2174 | 2174 | // Check if nickname is duplicate |
| 2175 | 2175 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2176 | - if($member_srl) |
|
| 2176 | + if ($member_srl) |
|
| 2177 | 2177 | { |
| 2178 | - return new BaseObject(-1,'msg_exists_nick_name'); |
|
| 2178 | + return new BaseObject(-1, 'msg_exists_nick_name'); |
|
| 2179 | 2179 | } |
| 2180 | 2180 | |
| 2181 | 2181 | // Check if email address is duplicate |
| 2182 | 2182 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2183 | - if($member_srl) |
|
| 2183 | + if ($member_srl) |
|
| 2184 | 2184 | { |
| 2185 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2185 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2186 | 2186 | } |
| 2187 | 2187 | |
| 2188 | 2188 | // Insert data into the DB |
| 2189 | 2189 | $args->list_order = -1 * $args->member_srl; |
| 2190 | 2190 | |
| 2191 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2192 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2191 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2192 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2193 | 2193 | |
| 2194 | 2194 | $oDB = &DB::getInstance(); |
| 2195 | 2195 | $oDB->begin(); |
| 2196 | 2196 | |
| 2197 | 2197 | $output = executeQuery('member.insertMember', $args); |
| 2198 | - if(!$output->toBool()) |
|
| 2198 | + if (!$output->toBool()) |
|
| 2199 | 2199 | { |
| 2200 | 2200 | $oDB->rollback(); |
| 2201 | 2201 | return $output; |
| 2202 | 2202 | } |
| 2203 | 2203 | |
| 2204 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2204 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2205 | 2205 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2206 | 2206 | // If no value is entered the default group, the value of group registration |
| 2207 | - if(!$args->group_srl_list) |
|
| 2207 | + if (!$args->group_srl_list) |
|
| 2208 | 2208 | { |
| 2209 | 2209 | $columnList = array('site_srl', 'group_srl'); |
| 2210 | 2210 | $default_group = $oMemberModel->getDefaultGroup(0, $columnList); |
| 2211 | - if($default_group) |
|
| 2211 | + if ($default_group) |
|
| 2212 | 2212 | { |
| 2213 | 2213 | // Add to the default group |
| 2214 | - $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); |
|
| 2215 | - if(!$output->toBool()) |
|
| 2214 | + $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); |
|
| 2215 | + if (!$output->toBool()) |
|
| 2216 | 2216 | { |
| 2217 | 2217 | $oDB->rollback(); |
| 2218 | 2218 | return $output; |
@@ -2222,11 +2222,11 @@ discard block |
||
| 2222 | 2222 | } |
| 2223 | 2223 | else |
| 2224 | 2224 | { |
| 2225 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2225 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2226 | 2226 | { |
| 2227 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2227 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2228 | 2228 | |
| 2229 | - if(!$output->toBool()) |
|
| 2229 | + if (!$output->toBool()) |
|
| 2230 | 2230 | { |
| 2231 | 2231 | $oDB->rollback(); |
| 2232 | 2232 | return $output; |
@@ -2236,7 +2236,7 @@ discard block |
||
| 2236 | 2236 | |
| 2237 | 2237 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2238 | 2238 | // When using email authentication mode (when you subscribed members denied a) certified mail sent |
| 2239 | - if($args->denied == 'Y') |
|
| 2239 | + if ($args->denied == 'Y') |
|
| 2240 | 2240 | { |
| 2241 | 2241 | // Insert data into the authentication DB |
| 2242 | 2242 | $oPassword = new Password(); |
@@ -2248,7 +2248,7 @@ discard block |
||
| 2248 | 2248 | $auth_args->is_register = 'Y'; |
| 2249 | 2249 | |
| 2250 | 2250 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2251 | - if(!$output->toBool()) |
|
| 2251 | + if (!$output->toBool()) |
|
| 2252 | 2252 | { |
| 2253 | 2253 | $oDB->rollback(); |
| 2254 | 2254 | return $output; |
@@ -2256,10 +2256,10 @@ discard block |
||
| 2256 | 2256 | $this->_sendAuthMail($auth_args, $args); |
| 2257 | 2257 | } |
| 2258 | 2258 | // Call a trigger (after) |
| 2259 | - if($output->toBool()) |
|
| 2259 | + if ($output->toBool()) |
|
| 2260 | 2260 | { |
| 2261 | 2261 | $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); |
| 2262 | - if(!$trigger_output->toBool()) |
|
| 2262 | + if (!$trigger_output->toBool()) |
|
| 2263 | 2263 | { |
| 2264 | 2264 | $oDB->rollback(); |
| 2265 | 2265 | return $trigger_output; |
@@ -2281,41 +2281,41 @@ discard block |
||
| 2281 | 2281 | { |
| 2282 | 2282 | // Call a trigger (before) |
| 2283 | 2283 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2284 | - if(!$output->toBool()) return $output; |
|
| 2284 | + if (!$output->toBool()) return $output; |
|
| 2285 | 2285 | // Create a model object |
| 2286 | 2286 | $oMemberModel = getModel('member'); |
| 2287 | 2287 | |
| 2288 | 2288 | $logged_info = Context::get('logged_info'); |
| 2289 | 2289 | // Get what you want to modify the original information |
| 2290 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2290 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2291 | 2291 | // Control of essential parameters |
| 2292 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2293 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2292 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2293 | + if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y'; |
|
| 2294 | 2294 | |
| 2295 | - if($logged_info->is_admin == 'Y') |
|
| 2295 | + if ($logged_info->is_admin == 'Y') |
|
| 2296 | 2296 | { |
| 2297 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2298 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2297 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2298 | + if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2299 | 2299 | } |
| 2300 | 2300 | else |
| 2301 | 2301 | { |
| 2302 | 2302 | unset($args->is_admin); |
| 2303 | - if($is_admin == false) |
|
| 2303 | + if ($is_admin == false) |
|
| 2304 | 2304 | unset($args->denied); |
| 2305 | - if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2305 | + if ($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2306 | 2306 | { |
| 2307 | 2307 | return $this->stop('msg_invalid_request'); |
| 2308 | 2308 | } |
| 2309 | 2309 | } |
| 2310 | 2310 | |
| 2311 | 2311 | // Sanitize user ID, username, nickname, homepage, blog |
| 2312 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2312 | + if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2313 | 2313 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2314 | 2314 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2315 | 2315 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2316 | 2316 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2317 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2318 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2317 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2318 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2319 | 2319 | |
| 2320 | 2320 | // check member identifier form |
| 2321 | 2321 | $config = $oMemberModel->getMemberConfig(); |
@@ -2324,56 +2324,56 @@ discard block |
||
| 2324 | 2324 | $orgMemberInfo = $output->data; |
| 2325 | 2325 | |
| 2326 | 2326 | // Check if email address or user ID is duplicate |
| 2327 | - if($config->identifier == 'email_address') |
|
| 2327 | + if ($config->identifier == 'email_address') |
|
| 2328 | 2328 | { |
| 2329 | 2329 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2330 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2330 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2331 | 2331 | { |
| 2332 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2332 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2333 | 2333 | } |
| 2334 | 2334 | $args->email_address = $orgMemberInfo->email_address; |
| 2335 | 2335 | } |
| 2336 | 2336 | else |
| 2337 | 2337 | { |
| 2338 | 2338 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2339 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2339 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2340 | 2340 | { |
| 2341 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2341 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2342 | 2342 | } |
| 2343 | 2343 | |
| 2344 | 2344 | $args->user_id = $orgMemberInfo->user_id; |
| 2345 | 2345 | } |
| 2346 | 2346 | |
| 2347 | - if($logged_info->is_admin !== 'Y') |
|
| 2347 | + if ($logged_info->is_admin !== 'Y') |
|
| 2348 | 2348 | { |
| 2349 | 2349 | // Check if ID is prohibited |
| 2350 | - if($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2350 | + if ($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2351 | 2351 | { |
| 2352 | - return new BaseObject(-1,'denied_user_id'); |
|
| 2352 | + return new BaseObject(-1, 'denied_user_id'); |
|
| 2353 | 2353 | } |
| 2354 | 2354 | |
| 2355 | 2355 | // Check if nickname is prohibited |
| 2356 | - if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2356 | + if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2357 | 2357 | { |
| 2358 | 2358 | return new BaseObject(-1, 'denied_nick_name'); |
| 2359 | 2359 | } |
| 2360 | 2360 | } |
| 2361 | 2361 | |
| 2362 | 2362 | // Check if ID is duplicate |
| 2363 | - if($args->user_id) |
|
| 2363 | + if ($args->user_id) |
|
| 2364 | 2364 | { |
| 2365 | 2365 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2366 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2366 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2367 | 2367 | { |
| 2368 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2368 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2369 | 2369 | } |
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | // Check if nickname is duplicate |
| 2373 | 2373 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2374 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2374 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2375 | 2375 | { |
| 2376 | - return new BaseObject(-1,'msg_exists_nick_name'); |
|
| 2376 | + return new BaseObject(-1, 'msg_exists_nick_name'); |
|
| 2377 | 2377 | } |
| 2378 | 2378 | |
| 2379 | 2379 | list($args->email_id, $args->email_host) = explode('@', $args->email_address); |
@@ -2382,9 +2382,9 @@ discard block |
||
| 2382 | 2382 | $oDB->begin(); |
| 2383 | 2383 | |
| 2384 | 2384 | // Check password strength |
| 2385 | - if($args->password) |
|
| 2385 | + if ($args->password) |
|
| 2386 | 2386 | { |
| 2387 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2387 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2388 | 2388 | { |
| 2389 | 2389 | $message = Context::getLang('about_password_strength'); |
| 2390 | 2390 | return new BaseObject(-1, $message[$config->password_strength]); |
@@ -2396,55 +2396,55 @@ discard block |
||
| 2396 | 2396 | $args->password = $orgMemberInfo->password; |
| 2397 | 2397 | } |
| 2398 | 2398 | |
| 2399 | - if($args->find_account_answer) { |
|
| 2399 | + if ($args->find_account_answer) { |
|
| 2400 | 2400 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2401 | 2401 | } |
| 2402 | 2402 | else |
| 2403 | 2403 | { |
| 2404 | - $oPassword = new Password(); |
|
| 2404 | + $oPassword = new Password(); |
|
| 2405 | 2405 | $hashed = $oPassword->checkAlgorithm($orgMemberInfo->find_account_answer); |
| 2406 | 2406 | |
| 2407 | - if($hashed) { |
|
| 2407 | + if ($hashed) { |
|
| 2408 | 2408 | $args->find_account_answer = $orgMemberInfo->find_account_answer; |
| 2409 | 2409 | } else { |
| 2410 | 2410 | $args->find_account_answer = $oPassword->createHash($orgMemberInfo->find_account_answer); |
| 2411 | 2411 | } |
| 2412 | 2412 | } |
| 2413 | 2413 | |
| 2414 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2415 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2416 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2417 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2418 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2414 | + if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2415 | + if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2416 | + if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2417 | + if (!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2418 | + if (!$args->birthday) $args->birthday = ''; |
|
| 2419 | 2419 | |
| 2420 | 2420 | $output = executeQuery('member.updateMember', $args); |
| 2421 | 2421 | |
| 2422 | - if(!$output->toBool()) |
|
| 2422 | + if (!$output->toBool()) |
|
| 2423 | 2423 | { |
| 2424 | 2424 | $oDB->rollback(); |
| 2425 | 2425 | return $output; |
| 2426 | 2426 | } |
| 2427 | 2427 | |
| 2428 | - if($args->group_srl_list) |
|
| 2428 | + if ($args->group_srl_list) |
|
| 2429 | 2429 | { |
| 2430 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2430 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2431 | 2431 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2432 | 2432 | // If the group information, group information changes |
| 2433 | - if(count($group_srl_list) > 0) |
|
| 2433 | + if (count($group_srl_list) > 0) |
|
| 2434 | 2434 | { |
| 2435 | 2435 | $args->site_srl = 0; |
| 2436 | 2436 | // One of its members to delete all the group |
| 2437 | 2437 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2438 | - if(!$output->toBool()) |
|
| 2438 | + if (!$output->toBool()) |
|
| 2439 | 2439 | { |
| 2440 | 2440 | $oDB->rollback(); |
| 2441 | 2441 | return $output; |
| 2442 | 2442 | } |
| 2443 | 2443 | // Enter one of the loop a |
| 2444 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2444 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2445 | 2445 | { |
| 2446 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2447 | - if(!$output->toBool()) |
|
| 2446 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2447 | + if (!$output->toBool()) |
|
| 2448 | 2448 | { |
| 2449 | 2449 | $oDB->rollback(); |
| 2450 | 2450 | return $output; |
@@ -2456,9 +2456,9 @@ discard block |
||
| 2456 | 2456 | } |
| 2457 | 2457 | } |
| 2458 | 2458 | // Call a trigger (after) |
| 2459 | - if($output->toBool()) { |
|
| 2459 | + if ($output->toBool()) { |
|
| 2460 | 2460 | $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); |
| 2461 | - if(!$trigger_output->toBool()) |
|
| 2461 | + if (!$trigger_output->toBool()) |
|
| 2462 | 2462 | { |
| 2463 | 2463 | $oDB->rollback(); |
| 2464 | 2464 | return $trigger_output; |
@@ -2471,7 +2471,7 @@ discard block |
||
| 2471 | 2471 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2472 | 2472 | |
| 2473 | 2473 | // Save Session |
| 2474 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2474 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2475 | 2475 | $logged_info = Context::get('logged_info'); |
| 2476 | 2476 | |
| 2477 | 2477 | $output->add('member_srl', $args->member_srl); |
@@ -2483,14 +2483,14 @@ discard block |
||
| 2483 | 2483 | */ |
| 2484 | 2484 | function updateMemberPassword($args) |
| 2485 | 2485 | { |
| 2486 | - if($args->password) |
|
| 2486 | + if ($args->password) |
|
| 2487 | 2487 | { |
| 2488 | 2488 | |
| 2489 | 2489 | // check password strength |
| 2490 | 2490 | $oMemberModel = getModel('member'); |
| 2491 | 2491 | $config = $oMemberModel->getMemberConfig(); |
| 2492 | 2492 | |
| 2493 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2493 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2494 | 2494 | { |
| 2495 | 2495 | $message = Context::getLang('about_password_strength'); |
| 2496 | 2496 | return new BaseObject(-1, $message[$config->password_strength]); |
@@ -2498,13 +2498,13 @@ discard block |
||
| 2498 | 2498 | |
| 2499 | 2499 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2500 | 2500 | } |
| 2501 | - else if($args->hashed_password) |
|
| 2501 | + else if ($args->hashed_password) |
|
| 2502 | 2502 | { |
| 2503 | 2503 | $args->password = $args->hashed_password; |
| 2504 | 2504 | } |
| 2505 | 2505 | |
| 2506 | 2506 | $output = executeQuery('member.updateMemberPassword', $args); |
| 2507 | - if($output->toBool()) |
|
| 2507 | + if ($output->toBool()) |
|
| 2508 | 2508 | { |
| 2509 | 2509 | $result = executeQuery('member.updateChangePasswordDate', $args); |
| 2510 | 2510 | } |
@@ -2516,7 +2516,7 @@ discard block |
||
| 2516 | 2516 | |
| 2517 | 2517 | function updateFindAccountAnswer($member_srl, $answer) |
| 2518 | 2518 | { |
| 2519 | - $oPassword = new Password(); |
|
| 2519 | + $oPassword = new Password(); |
|
| 2520 | 2520 | |
| 2521 | 2521 | $args = new stdClass(); |
| 2522 | 2522 | $args->member_srl = $member_srl; |
@@ -2533,18 +2533,18 @@ discard block |
||
| 2533 | 2533 | $trigger_obj = new stdClass(); |
| 2534 | 2534 | $trigger_obj->member_srl = $member_srl; |
| 2535 | 2535 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2536 | - if(!$output->toBool()) return $output; |
|
| 2536 | + if (!$output->toBool()) return $output; |
|
| 2537 | 2537 | // Create a model object |
| 2538 | 2538 | $oMemberModel = getModel('member'); |
| 2539 | 2539 | // Bringing the user's information |
| 2540 | - if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2540 | + if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2541 | 2541 | { |
| 2542 | 2542 | $columnList = array('member_srl', 'is_admin'); |
| 2543 | 2543 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2544 | 2544 | } |
| 2545 | - if(!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2545 | + if (!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2546 | 2546 | // If managers can not be deleted |
| 2547 | - if($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2547 | + if ($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2548 | 2548 | |
| 2549 | 2549 | $oDB = &DB::getInstance(); |
| 2550 | 2550 | $oDB->begin(); |
@@ -2553,7 +2553,7 @@ discard block |
||
| 2553 | 2553 | $args->member_srl = $member_srl; |
| 2554 | 2554 | // Delete the entries in member_auth_mail |
| 2555 | 2555 | $output = executeQuery('member.deleteAuthMail', $args); |
| 2556 | - if(!$output->toBool()) |
|
| 2556 | + if (!$output->toBool()) |
|
| 2557 | 2557 | { |
| 2558 | 2558 | $oDB->rollback(); |
| 2559 | 2559 | return $output; |
@@ -2568,23 +2568,23 @@ discard block |
||
| 2568 | 2568 | */ |
| 2569 | 2569 | // Delete the entries in member_group_member |
| 2570 | 2570 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2571 | - if(!$output->toBool()) |
|
| 2571 | + if (!$output->toBool()) |
|
| 2572 | 2572 | { |
| 2573 | 2573 | $oDB->rollback(); |
| 2574 | 2574 | return $output; |
| 2575 | 2575 | } |
| 2576 | 2576 | // member removed from the table |
| 2577 | 2577 | $output = executeQuery('member.deleteMember', $args); |
| 2578 | - if(!$output->toBool()) |
|
| 2578 | + if (!$output->toBool()) |
|
| 2579 | 2579 | { |
| 2580 | 2580 | $oDB->rollback(); |
| 2581 | 2581 | return $output; |
| 2582 | 2582 | } |
| 2583 | 2583 | // Call a trigger (after) |
| 2584 | - if($output->toBool()) |
|
| 2584 | + if ($output->toBool()) |
|
| 2585 | 2585 | { |
| 2586 | 2586 | $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); |
| 2587 | - if(!$trigger_output->toBool()) |
|
| 2587 | + if (!$trigger_output->toBool()) |
|
| 2588 | 2588 | { |
| 2589 | 2589 | $oDB->rollback(); |
| 2590 | 2590 | return $trigger_output; |
@@ -2608,23 +2608,23 @@ discard block |
||
| 2608 | 2608 | */ |
| 2609 | 2609 | function destroySessionInfo() |
| 2610 | 2610 | { |
| 2611 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2611 | + if (!$_SESSION || !is_array($_SESSION)) return; |
|
| 2612 | 2612 | |
| 2613 | 2613 | $memberInfo = Context::get('logged_info'); |
| 2614 | 2614 | $memberSrl = $memberInfo->member_srl; |
| 2615 | 2615 | |
| 2616 | - foreach($_SESSION as $key => $val) |
|
| 2616 | + foreach ($_SESSION as $key => $val) |
|
| 2617 | 2617 | { |
| 2618 | 2618 | $_SESSION[$key] = ''; |
| 2619 | 2619 | } |
| 2620 | 2620 | |
| 2621 | 2621 | session_destroy(); |
| 2622 | - setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000); |
|
| 2623 | - setcookie('sso','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2624 | - setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2622 | + setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2623 | + setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2624 | + setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2625 | 2625 | setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000); |
| 2626 | 2626 | |
| 2627 | - if($memberSrl || $_COOKIE['xeak']) |
|
| 2627 | + if ($memberSrl || $_COOKIE['xeak']) |
|
| 2628 | 2628 | { |
| 2629 | 2629 | $args = new stdClass(); |
| 2630 | 2630 | $args->member_srl = $memberSrl; |
@@ -2640,22 +2640,22 @@ discard block |
||
| 2640 | 2640 | $pointGroup = $pointModuleConfig->point_group; |
| 2641 | 2641 | |
| 2642 | 2642 | $levelGroup = array(); |
| 2643 | - if(is_array($pointGroup) && count($pointGroup)>0) |
|
| 2643 | + if (is_array($pointGroup) && count($pointGroup) > 0) |
|
| 2644 | 2644 | { |
| 2645 | 2645 | $levelGroup = array_flip($pointGroup); |
| 2646 | 2646 | ksort($levelGroup); |
| 2647 | 2647 | } |
| 2648 | 2648 | $maxLevel = 0; |
| 2649 | 2649 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2650 | - if(count($resultGroup) > 0) |
|
| 2650 | + if (count($resultGroup) > 0) |
|
| 2651 | 2651 | $maxLevel = max(array_flip($resultGroup)); |
| 2652 | 2652 | |
| 2653 | - if($maxLevel > 0) |
|
| 2653 | + if ($maxLevel > 0) |
|
| 2654 | 2654 | { |
| 2655 | 2655 | $oPointModel = getModel('point'); |
| 2656 | 2656 | $originPoint = $oPointModel->getPoint($memberSrl); |
| 2657 | 2657 | |
| 2658 | - if($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2658 | + if ($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2659 | 2659 | { |
| 2660 | 2660 | $oPointController = getController('point'); |
| 2661 | 2661 | $oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update'); |
@@ -2665,18 +2665,18 @@ discard block |
||
| 2665 | 2665 | |
| 2666 | 2666 | function procMemberModifyEmailAddress() |
| 2667 | 2667 | { |
| 2668 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2668 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2669 | 2669 | |
| 2670 | 2670 | $member_info = Context::get('logged_info'); |
| 2671 | 2671 | $newEmail = Context::get('email_address'); |
| 2672 | 2672 | |
| 2673 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2673 | + if (!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2674 | 2674 | |
| 2675 | 2675 | $oMemberModel = getModel('member'); |
| 2676 | 2676 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2677 | - if($member_srl) return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2677 | + if ($member_srl) return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2678 | 2678 | |
| 2679 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2679 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2680 | 2680 | { |
| 2681 | 2681 | return $this->stop('msg_invalid_request'); |
| 2682 | 2682 | } |
@@ -2692,7 +2692,7 @@ discard block |
||
| 2692 | 2692 | $oDB = &DB::getInstance(); |
| 2693 | 2693 | $oDB->begin(); |
| 2694 | 2694 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2695 | - if(!$output->toBool()) |
|
| 2695 | + if (!$output->toBool()) |
|
| 2696 | 2696 | { |
| 2697 | 2697 | $oDB->rollback(); |
| 2698 | 2698 | return $output; |
@@ -2702,7 +2702,7 @@ discard block |
||
| 2702 | 2702 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2703 | 2703 | |
| 2704 | 2704 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2705 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2705 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2706 | 2706 | |
| 2707 | 2707 | global $lang; |
| 2708 | 2708 | |
@@ -2714,17 +2714,17 @@ discard block |
||
| 2714 | 2714 | |
| 2715 | 2715 | Context::set('newEmail', $newEmail); |
| 2716 | 2716 | |
| 2717 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 2717 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 2718 | 2718 | Context::set('auth_url', $auth_url); |
| 2719 | 2719 | |
| 2720 | 2720 | $oTemplate = &TemplateHandler::getInstance(); |
| 2721 | 2721 | $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); |
| 2722 | 2722 | |
| 2723 | 2723 | $oMail = new Mail(); |
| 2724 | - $oMail->setTitle( Context::getLang('title_modify_email_address') ); |
|
| 2724 | + $oMail->setTitle(Context::getLang('title_modify_email_address')); |
|
| 2725 | 2725 | $oMail->setContent($content); |
| 2726 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 2727 | - $oMail->setReceiptor( $member_info->nick_name, $newEmail ); |
|
| 2726 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 2727 | + $oMail->setReceiptor($member_info->nick_name, $newEmail); |
|
| 2728 | 2728 | $result = $oMail->send(); |
| 2729 | 2729 | |
| 2730 | 2730 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); |
@@ -2738,16 +2738,16 @@ discard block |
||
| 2738 | 2738 | { |
| 2739 | 2739 | $member_srl = Context::get('member_srl'); |
| 2740 | 2740 | $auth_key = Context::get('auth_key'); |
| 2741 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2741 | + if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2742 | 2742 | |
| 2743 | 2743 | // Test logs for finding password by user_id and authkey |
| 2744 | 2744 | $args = new stdClass; |
| 2745 | 2745 | $args->member_srl = $member_srl; |
| 2746 | 2746 | $args->auth_key = $auth_key; |
| 2747 | 2747 | $output = executeQuery('member.getAuthMail', $args); |
| 2748 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2748 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2749 | 2749 | { |
| 2750 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2750 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2751 | 2751 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2752 | 2752 | } |
| 2753 | 2753 | |
@@ -2756,10 +2756,10 @@ discard block |
||
| 2756 | 2756 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2757 | 2757 | |
| 2758 | 2758 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2759 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2759 | + if (!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2760 | 2760 | |
| 2761 | 2761 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2762 | - executeQuery('member.deleteAuthChangeEmailAddress',$args); |
|
| 2762 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2763 | 2763 | |
| 2764 | 2764 | $this->_clearMemberCache($args->member_srl); |
| 2765 | 2765 | |
@@ -2777,7 +2777,7 @@ discard block |
||
| 2777 | 2777 | **/ |
| 2778 | 2778 | function triggerGetDocumentMenu(&$menu_list) |
| 2779 | 2779 | { |
| 2780 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 2780 | + if (!Context::get('is_logged')) return new BaseObject(); |
|
| 2781 | 2781 | |
| 2782 | 2782 | $logged_info = Context::get('logged_info'); |
| 2783 | 2783 | $document_srl = Context::get('target_srl'); |
@@ -2788,12 +2788,12 @@ discard block |
||
| 2788 | 2788 | $member_srl = $oDocument->get('member_srl'); |
| 2789 | 2789 | $module_srl = $oDocument->get('module_srl'); |
| 2790 | 2790 | |
| 2791 | - if(!$member_srl) return new BaseObject(); |
|
| 2792 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 2791 | + if (!$member_srl) return new BaseObject(); |
|
| 2792 | + if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new BaseObject(); |
|
| 2793 | 2793 | |
| 2794 | 2794 | $oDocumentController = getController('document'); |
| 2795 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2796 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2795 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2796 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2797 | 2797 | |
| 2798 | 2798 | return new BaseObject(); |
| 2799 | 2799 | } |
@@ -2807,7 +2807,7 @@ discard block |
||
| 2807 | 2807 | **/ |
| 2808 | 2808 | function triggerGetCommentMenu(&$menu_list) |
| 2809 | 2809 | { |
| 2810 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 2810 | + if (!Context::get('is_logged')) return new BaseObject(); |
|
| 2811 | 2811 | |
| 2812 | 2812 | $logged_info = Context::get('logged_info'); |
| 2813 | 2813 | $comment_srl = Context::get('target_srl'); |
@@ -2818,12 +2818,12 @@ discard block |
||
| 2818 | 2818 | $module_srl = $oComment->get('module_srl'); |
| 2819 | 2819 | $member_srl = $oComment->get('member_srl'); |
| 2820 | 2820 | |
| 2821 | - if(!$member_srl) return new BaseObject(); |
|
| 2822 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 2821 | + if (!$member_srl) return new BaseObject(); |
|
| 2822 | + if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new BaseObject(); |
|
| 2823 | 2823 | |
| 2824 | 2824 | $oCommentController = getController('comment'); |
| 2825 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2826 | - $oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2825 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2826 | + $oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2827 | 2827 | |
| 2828 | 2828 | return new BaseObject(); |
| 2829 | 2829 | } |
@@ -2835,7 +2835,7 @@ discard block |
||
| 2835 | 2835 | **/ |
| 2836 | 2836 | function procMemberSpammerManage() |
| 2837 | 2837 | { |
| 2838 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2838 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2839 | 2839 | |
| 2840 | 2840 | $logged_info = Context::get('logged_info'); |
| 2841 | 2841 | $member_srl = Context::get('member_srl'); |
@@ -2843,7 +2843,7 @@ discard block |
||
| 2843 | 2843 | $cnt_loop = Context::get('cnt_loop'); |
| 2844 | 2844 | $proc_type = Context::get('proc_type'); |
| 2845 | 2845 | $isMoveToTrash = true; |
| 2846 | - if($proc_type == "delete") |
|
| 2846 | + if ($proc_type == "delete") |
|
| 2847 | 2847 | $isMoveToTrash = false; |
| 2848 | 2848 | |
| 2849 | 2849 | // check grant |
@@ -2852,7 +2852,7 @@ discard block |
||
| 2852 | 2852 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2853 | 2853 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2854 | 2854 | |
| 2855 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2855 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2856 | 2856 | |
| 2857 | 2857 | $proc_msg = ""; |
| 2858 | 2858 | |
@@ -2861,10 +2861,10 @@ discard block |
||
| 2861 | 2861 | |
| 2862 | 2862 | // delete or trash destination |
| 2863 | 2863 | // proc member |
| 2864 | - if($cnt_loop == 1) |
|
| 2864 | + if ($cnt_loop == 1) |
|
| 2865 | 2865 | $this->_spammerMember($member_srl); |
| 2866 | 2866 | // proc document and comment |
| 2867 | - elseif($cnt_loop>1) |
|
| 2867 | + elseif ($cnt_loop > 1) |
|
| 2868 | 2868 | $this->_spammerDocuments($member_srl, $isMoveToTrash); |
| 2869 | 2869 | |
| 2870 | 2870 | // get destination count |
@@ -2873,11 +2873,11 @@ discard block |
||
| 2873 | 2873 | |
| 2874 | 2874 | $total_count = Context::get('total_count'); |
| 2875 | 2875 | $remain_count = $cnt_document + $cnt_comment; |
| 2876 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 2876 | + if ($cnt_loop == 1) $total_count = $remain_count; |
|
| 2877 | 2877 | |
| 2878 | 2878 | // get progress percent |
| 2879 | - if($total_count > 0) |
|
| 2880 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2879 | + if ($total_count > 0) |
|
| 2880 | + $progress = intval((($total_count - $remain_count) / $total_count) * 100); |
|
| 2881 | 2881 | else |
| 2882 | 2882 | $progress = 100; |
| 2883 | 2883 | |
@@ -2901,7 +2901,7 @@ discard block |
||
| 2901 | 2901 | **/ |
| 2902 | 2902 | private function _spammerMember($member_srl) { |
| 2903 | 2903 | $logged_info = Context::get('logged_info'); |
| 2904 | - $spam_description = trim( Context::get('spam_description') ); |
|
| 2904 | + $spam_description = trim(Context::get('spam_description')); |
|
| 2905 | 2905 | |
| 2906 | 2906 | $oMemberModel = getModel('member'); |
| 2907 | 2907 | $columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description'); |
@@ -2920,10 +2920,10 @@ discard block |
||
| 2920 | 2920 | $args->user_id = $member_info->user_id; |
| 2921 | 2921 | $args->nick_name = $member_info->nick_name; |
| 2922 | 2922 | $args->denied = "Y"; |
| 2923 | - $args->description = trim( $member_info->description ); |
|
| 2924 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 2923 | + $args->description = trim($member_info->description); |
|
| 2924 | + if ($args->description != "") $args->description .= "\n"; // add new line |
|
| 2925 | 2925 | |
| 2926 | - $args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]"; |
|
| 2926 | + $args->description .= Context::getLang('cmd_spammer')."[".date("Y-m-d H:i:s")." from:".$logged_info->user_id." info:".$spam_description." docuemnts count:".$total_count."]"; |
|
| 2927 | 2927 | |
| 2928 | 2928 | $output = $this->updateMember($args, true); |
| 2929 | 2929 | |
@@ -2952,21 +2952,21 @@ discard block |
||
| 2952 | 2952 | // 1. proc comment, 2. proc document |
| 2953 | 2953 | $cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl); |
| 2954 | 2954 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
| 2955 | - if($cnt_comment > 0) |
|
| 2955 | + if ($cnt_comment > 0) |
|
| 2956 | 2956 | { |
| 2957 | 2957 | $columnList = array(); |
| 2958 | 2958 | $commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2959 | - if($commentList) { |
|
| 2960 | - foreach($commentList as $v) { |
|
| 2959 | + if ($commentList) { |
|
| 2960 | + foreach ($commentList as $v) { |
|
| 2961 | 2961 | $oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash); |
| 2962 | 2962 | } |
| 2963 | 2963 | } |
| 2964 | - } elseif($cnt_document > 0) { |
|
| 2964 | + } elseif ($cnt_document > 0) { |
|
| 2965 | 2965 | $columnList = array(); |
| 2966 | 2966 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2967 | - if($documentList) { |
|
| 2968 | - foreach($documentList as $v) { |
|
| 2969 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2967 | + if ($documentList) { |
|
| 2968 | + foreach ($documentList as $v) { |
|
| 2969 | + if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2970 | 2970 | else $oDocumentController->deleteDocument($v->document_srl); |
| 2971 | 2971 | } |
| 2972 | 2972 | } |
@@ -2978,24 +2978,24 @@ discard block |
||
| 2978 | 2978 | function _clearMemberCache($member_srl, $site_srl = 0) |
| 2979 | 2979 | { |
| 2980 | 2980 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 2981 | - if($oCacheHandler->isSupport()) |
|
| 2981 | + if ($oCacheHandler->isSupport()) |
|
| 2982 | 2982 | { |
| 2983 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl; |
|
| 2983 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
| 2984 | 2984 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2985 | 2985 | $oCacheHandler->delete($cache_key); |
| 2986 | 2986 | |
| 2987 | - if($site_srl !== 0) |
|
| 2987 | + if ($site_srl !== 0) |
|
| 2988 | 2988 | { |
| 2989 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 2989 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 2990 | 2990 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2991 | 2991 | $oCacheHandler->delete($cache_key); |
| 2992 | 2992 | } |
| 2993 | 2993 | } |
| 2994 | 2994 | |
| 2995 | 2995 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 2996 | - if($oCacheHandler->isSupport()) |
|
| 2996 | + if ($oCacheHandler->isSupport()) |
|
| 2997 | 2997 | { |
| 2998 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 2998 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 2999 | 2999 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 3000 | 3000 | $oCacheHandler->delete($cache_key); |
| 3001 | 3001 | } |
@@ -41,19 +41,31 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Variables |
| 44 | - if(!$user_id) $user_id = Context::get('user_id'); |
|
| 44 | + if(!$user_id) { |
|
| 45 | + $user_id = Context::get('user_id'); |
|
| 46 | + } |
|
| 45 | 47 | $user_id = trim($user_id); |
| 46 | 48 | |
| 47 | - if(!$password) $password = Context::get('password'); |
|
| 49 | + if(!$password) { |
|
| 50 | + $password = Context::get('password'); |
|
| 51 | + } |
|
| 48 | 52 | $password = trim($password); |
| 49 | 53 | |
| 50 | - if(!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
| 54 | + if(!$keep_signed) { |
|
| 55 | + $keep_signed = Context::get('keep_signed'); |
|
| 56 | + } |
|
| 51 | 57 | // Return an error when id and password doesn't exist |
| 52 | - if(!$user_id) return new BaseObject(-1,'null_user_id'); |
|
| 53 | - if(!$password) return new BaseObject(-1,'null_password'); |
|
| 58 | + if(!$user_id) { |
|
| 59 | + return new BaseObject(-1,'null_user_id'); |
|
| 60 | + } |
|
| 61 | + if(!$password) { |
|
| 62 | + return new BaseObject(-1,'null_password'); |
|
| 63 | + } |
|
| 54 | 64 | |
| 55 | 65 | $output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false); |
| 56 | - if (!$output->toBool()) return $output; |
|
| 66 | + if (!$output->toBool()) { |
|
| 67 | + return $output; |
|
| 68 | + } |
|
| 57 | 69 | |
| 58 | 70 | $oModuleModel = getModel('module'); |
| 59 | 71 | $config = $oModuleModel->getModuleConfig('member'); |
@@ -80,8 +92,7 @@ discard block |
||
| 80 | 92 | if(!$config->after_login_url) |
| 81 | 93 | { |
| 82 | 94 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 83 | - } |
|
| 84 | - else |
|
| 95 | + } else |
|
| 85 | 96 | { |
| 86 | 97 | $returnUrl = $config->after_login_url; |
| 87 | 98 | } |
@@ -98,19 +109,24 @@ discard block |
||
| 98 | 109 | // Call a trigger before log-out (before) |
| 99 | 110 | $logged_info = Context::get('logged_info'); |
| 100 | 111 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); |
| 101 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 112 | + if(!$trigger_output->toBool()) { |
|
| 113 | + return $trigger_output; |
|
| 114 | + } |
|
| 102 | 115 | // Destroy session information |
| 103 | 116 | $this->destroySessionInfo(); |
| 104 | 117 | // Call a trigger after log-out (after) |
| 105 | 118 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); |
| 106 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 119 | + if(!$trigger_output->toBool()) { |
|
| 120 | + return $trigger_output; |
|
| 121 | + } |
|
| 107 | 122 | |
| 108 | 123 | $output = new BaseObject(); |
| 109 | 124 | |
| 110 | 125 | $oModuleModel = getModel('module'); |
| 111 | 126 | $config = $oModuleModel->getModuleConfig('member'); |
| 112 | - if($config->after_logout_url) |
|
| 113 | - $output->redirect_url = $config->after_logout_url; |
|
| 127 | + if($config->after_logout_url) { |
|
| 128 | + $output->redirect_url = $config->after_logout_url; |
|
| 129 | + } |
|
| 114 | 130 | |
| 115 | 131 | $this->_clearMemberCache($logged_info->member_srl); |
| 116 | 132 | |
@@ -127,12 +143,18 @@ discard block |
||
| 127 | 143 | $oModuleModel = &getModel('module'); |
| 128 | 144 | |
| 129 | 145 | // Check login information |
| 130 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 146 | + if(!Context::get('is_logged')) { |
|
| 147 | + return new BaseObject(-1, 'msg_not_logged'); |
|
| 148 | + } |
|
| 131 | 149 | $logged_info = Context::get('logged_info'); |
| 132 | 150 | |
| 133 | 151 | $document_srl = (int)Context::get('document_srl'); |
| 134 | - if(!$document_srl) $document_srl = (int)Context::get('target_srl'); |
|
| 135 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 152 | + if(!$document_srl) { |
|
| 153 | + $document_srl = (int)Context::get('target_srl'); |
|
| 154 | + } |
|
| 155 | + if(!$document_srl) { |
|
| 156 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 157 | + } |
|
| 136 | 158 | |
| 137 | 159 | // Get document |
| 138 | 160 | $oDocumentModel = getModel('document'); |
@@ -180,11 +202,15 @@ discard block |
||
| 180 | 202 | |
| 181 | 203 | // Check if already scrapped |
| 182 | 204 | $output = executeQuery('member.getScrapDocument', $args); |
| 183 | - if($output->data->count) return new BaseObject(-1, 'msg_alreay_scrapped'); |
|
| 205 | + if($output->data->count) { |
|
| 206 | + return new BaseObject(-1, 'msg_alreay_scrapped'); |
|
| 207 | + } |
|
| 184 | 208 | |
| 185 | 209 | // Insert |
| 186 | 210 | $output = executeQuery('member.addScrapDocument', $args); |
| 187 | - if(!$output->toBool()) return $output; |
|
| 211 | + if(!$output->toBool()) { |
|
| 212 | + return $output; |
|
| 213 | + } |
|
| 188 | 214 | |
| 189 | 215 | $this->setError(-1); |
| 190 | 216 | $this->setMessage('success_registed'); |
@@ -198,11 +224,15 @@ discard block |
||
| 198 | 224 | function procMemberDeleteScrap() |
| 199 | 225 | { |
| 200 | 226 | // Check login information |
| 201 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 227 | + if(!Context::get('is_logged')) { |
|
| 228 | + return new BaseObject(-1, 'msg_not_logged'); |
|
| 229 | + } |
|
| 202 | 230 | $logged_info = Context::get('logged_info'); |
| 203 | 231 | |
| 204 | 232 | $document_srl = (int)Context::get('document_srl'); |
| 205 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 233 | + if(!$document_srl) { |
|
| 234 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 235 | + } |
|
| 206 | 236 | // Variables |
| 207 | 237 | $args = new stdClass; |
| 208 | 238 | $args->member_srl = $logged_info->member_srl; |
@@ -228,11 +258,15 @@ discard block |
||
| 228 | 258 | function procMemberDeleteSavedDocument() |
| 229 | 259 | { |
| 230 | 260 | // Check login information |
| 231 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 261 | + if(!Context::get('is_logged')) { |
|
| 262 | + return new BaseObject(-1, 'msg_not_logged'); |
|
| 263 | + } |
|
| 232 | 264 | $logged_info = Context::get('logged_info'); |
| 233 | 265 | |
| 234 | 266 | $document_srl = (int)Context::get('document_srl'); |
| 235 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 267 | + if(!$document_srl) { |
|
| 268 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 269 | + } |
|
| 236 | 270 | |
| 237 | 271 | $oDocumentModel = getModel('document'); |
| 238 | 272 | $oDocument = $oDocumentModel->getDocument($document_srl); |
@@ -260,7 +294,9 @@ discard block |
||
| 260 | 294 | { |
| 261 | 295 | $name = Context::get('name'); |
| 262 | 296 | $value = Context::get('value'); |
| 263 | - if(!$value) return; |
|
| 297 | + if(!$value) { |
|
| 298 | + return; |
|
| 299 | + } |
|
| 264 | 300 | |
| 265 | 301 | $oMemberModel = getModel('member'); |
| 266 | 302 | // Check if logged-in |
@@ -271,10 +307,14 @@ discard block |
||
| 271 | 307 | { |
| 272 | 308 | case 'user_id' : |
| 273 | 309 | // Check denied ID |
| 274 | - if($oMemberModel->isDeniedID($value)) return new BaseObject(0,'denied_user_id'); |
|
| 310 | + if($oMemberModel->isDeniedID($value)) { |
|
| 311 | + return new BaseObject(0,'denied_user_id'); |
|
| 312 | + } |
|
| 275 | 313 | // Check if duplicated |
| 276 | 314 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
| 277 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_user_id'); |
|
| 315 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 316 | + return new BaseObject(0,'msg_exists_user_id'); |
|
| 317 | + } |
|
| 278 | 318 | break; |
| 279 | 319 | case 'nick_name' : |
| 280 | 320 | // Check denied ID |
@@ -284,13 +324,17 @@ discard block |
||
| 284 | 324 | } |
| 285 | 325 | // Check if duplicated |
| 286 | 326 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
| 287 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_nick_name'); |
|
| 327 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 328 | + return new BaseObject(0,'msg_exists_nick_name'); |
|
| 329 | + } |
|
| 288 | 330 | |
| 289 | 331 | break; |
| 290 | 332 | case 'email_address' : |
| 291 | 333 | // Check if duplicated |
| 292 | 334 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
| 293 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_email_address'); |
|
| 335 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 336 | + return new BaseObject(0,'msg_exists_email_address'); |
|
| 337 | + } |
|
| 294 | 338 | break; |
| 295 | 339 | } |
| 296 | 340 | } |
@@ -302,17 +346,25 @@ discard block |
||
| 302 | 346 | */ |
| 303 | 347 | function procMemberInsert() |
| 304 | 348 | { |
| 305 | - if (Context::getRequestMethod () == "GET") return new BaseObject(-1, "msg_invalid_request"); |
|
| 349 | + if (Context::getRequestMethod () == "GET") { |
|
| 350 | + return new BaseObject(-1, "msg_invalid_request"); |
|
| 351 | + } |
|
| 306 | 352 | $oMemberModel = &getModel ('member'); |
| 307 | 353 | $config = $oMemberModel->getMemberConfig(); |
| 308 | 354 | |
| 309 | 355 | // call a trigger (before) |
| 310 | 356 | $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
| 311 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
| 357 | + if(!$trigger_output->toBool ()) { |
|
| 358 | + return $trigger_output; |
|
| 359 | + } |
|
| 312 | 360 | // Check if an administrator allows a membership |
| 313 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
| 361 | + if($config->enable_join != 'Y') { |
|
| 362 | + return $this->stop ('msg_signup_disabled'); |
|
| 363 | + } |
|
| 314 | 364 | // Check if the user accept the license terms (only if terms exist) |
| 315 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
| 365 | + if($config->agreement && Context::get('accept_agreement')!='Y') { |
|
| 366 | + return $this->stop('msg_accept_agreement'); |
|
| 367 | + } |
|
| 316 | 368 | |
| 317 | 369 | // Extract the necessary information in advance |
| 318 | 370 | $getVars = array(); |
@@ -331,16 +383,22 @@ discard block |
||
| 331 | 383 | foreach($getVars as $val) |
| 332 | 384 | { |
| 333 | 385 | $args->{$val} = Context::get($val); |
| 334 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 386 | + if($val == 'birthday') { |
|
| 387 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
| 388 | + } |
|
| 335 | 389 | } |
| 336 | 390 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 337 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 391 | + if(!$args->birthday && $args->birthday_ui) { |
|
| 392 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 393 | + } |
|
| 338 | 394 | |
| 339 | 395 | $args->find_account_answer = Context::get('find_account_answer'); |
| 340 | 396 | $args->allow_mailing = Context::get('allow_mailing'); |
| 341 | 397 | $args->allow_message = Context::get('allow_message'); |
| 342 | 398 | |
| 343 | - if($args->password1) $args->password = $args->password1; |
|
| 399 | + if($args->password1) { |
|
| 400 | + $args->password = $args->password1; |
|
| 401 | + } |
|
| 344 | 402 | |
| 345 | 403 | // check password strength |
| 346 | 404 | if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
@@ -369,7 +427,9 @@ discard block |
||
| 369 | 427 | unset($all_args->secret_text); |
| 370 | 428 | |
| 371 | 429 | // Set the user state as "denied" when using mail authentication |
| 372 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 430 | + if($config->enable_confirm == 'Y') { |
|
| 431 | + $args->denied = 'Y'; |
|
| 432 | + } |
|
| 373 | 433 | // Add extra vars after excluding necessary information from all the requested arguments |
| 374 | 434 | $extra_vars = delObjectVars($all_args, $args); |
| 375 | 435 | $args->extra_vars = serialize($extra_vars); |
@@ -384,7 +444,9 @@ discard block |
||
| 384 | 444 | } |
| 385 | 445 | } |
| 386 | 446 | $output = $this->insertMember($args); |
| 387 | - if(!$output->toBool()) return $output; |
|
| 447 | + if(!$output->toBool()) { |
|
| 448 | + return $output; |
|
| 449 | + } |
|
| 388 | 450 | |
| 389 | 451 | // insert ProfileImage, ImageName, ImageMark |
| 390 | 452 | $profile_image = $_FILES['profile_image']; |
@@ -423,43 +485,46 @@ discard block |
||
| 423 | 485 | if($config->identifier == 'email_address') |
| 424 | 486 | { |
| 425 | 487 | $output = $this->doLogin($args->email_address); |
| 426 | - } |
|
| 427 | - else |
|
| 488 | + } else |
|
| 428 | 489 | { |
| 429 | 490 | $output = $this->doLogin($args->user_id); |
| 430 | 491 | } |
| 431 | 492 | if(!$output->toBool()) { |
| 432 | - if($output->error == -9) |
|
| 433 | - $output->error = -11; |
|
| 493 | + if($output->error == -9) { |
|
| 494 | + $output->error = -11; |
|
| 495 | + } |
|
| 434 | 496 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
| 435 | 497 | } |
| 436 | 498 | } |
| 437 | 499 | |
| 438 | 500 | // Results |
| 439 | 501 | $this->add('member_srl', $args->member_srl); |
| 440 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 502 | + if($config->redirect_url) { |
|
| 503 | + $this->add('redirect_url', $config->redirect_url); |
|
| 504 | + } |
|
| 441 | 505 | if($config->enable_confirm == 'Y') |
| 442 | 506 | { |
| 443 | 507 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
| 444 | 508 | $this->setMessage($msg); |
| 445 | 509 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), new BaseObject(-12, $msg)); |
| 510 | + } else { |
|
| 511 | + $this->setMessage('success_registed'); |
|
| 446 | 512 | } |
| 447 | - else $this->setMessage('success_registed'); |
|
| 448 | 513 | // Call a trigger (after) |
| 449 | 514 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
| 450 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 515 | + if(!$trigger_output->toBool()) { |
|
| 516 | + return $trigger_output; |
|
| 517 | + } |
|
| 451 | 518 | |
| 452 | 519 | if($config->redirect_url) |
| 453 | 520 | { |
| 454 | 521 | $returnUrl = $config->redirect_url; |
| 455 | - } |
|
| 456 | - else |
|
| 522 | + } else |
|
| 457 | 523 | { |
| 458 | 524 | if(Context::get('success_return_url')) |
| 459 | 525 | { |
| 460 | 526 | $returnUrl = Context::get('success_return_url'); |
| 461 | - } |
|
| 462 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 527 | + } else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 463 | 528 | { |
| 464 | 529 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
| 465 | 530 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -513,8 +578,7 @@ discard block |
||
| 513 | 578 | if(Context::get('success_return_url')) |
| 514 | 579 | { |
| 515 | 580 | $redirectUrl = Context::get('success_return_url'); |
| 516 | - } |
|
| 517 | - else |
|
| 581 | + } else |
|
| 518 | 582 | { |
| 519 | 583 | $redirectUrl = getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 520 | 584 | } |
@@ -558,7 +622,9 @@ discard block |
||
| 558 | 622 | foreach($getVars as $val) |
| 559 | 623 | { |
| 560 | 624 | $args->{$val} = Context::get($val); |
| 561 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 625 | + if($val == 'birthday') { |
|
| 626 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
| 627 | + } |
|
| 562 | 628 | if($val == 'find_account_answer' && !Context::get($val)) { |
| 563 | 629 | unset($args->{$val}); |
| 564 | 630 | } |
@@ -568,7 +634,9 @@ discard block |
||
| 568 | 634 | $logged_info = Context::get('logged_info'); |
| 569 | 635 | $args->member_srl = $logged_info->member_srl; |
| 570 | 636 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 571 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 637 | + if(!$args->birthday && $args->birthday_ui) { |
|
| 638 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 639 | + } |
|
| 572 | 640 | |
| 573 | 641 | // Remove some unnecessary variables from all the vars |
| 574 | 642 | $all_args = Context::getRequestVars(); |
@@ -603,7 +671,9 @@ discard block |
||
| 603 | 671 | |
| 604 | 672 | // Execute insert or update depending on the value of member_srl |
| 605 | 673 | $output = $this->updateMember($args); |
| 606 | - if(!$output->toBool()) return $output; |
|
| 674 | + if(!$output->toBool()) { |
|
| 675 | + return $output; |
|
| 676 | + } |
|
| 607 | 677 | |
| 608 | 678 | $profile_image = $_FILES['profile_image']; |
| 609 | 679 | if(is_uploaded_file($profile_image['tmp_name'])) |
@@ -633,7 +703,9 @@ discard block |
||
| 633 | 703 | |
| 634 | 704 | // Call a trigger after successfully log-in (after) |
| 635 | 705 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
| 636 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 706 | + if(!$trigger_output->toBool()) { |
|
| 707 | + return $trigger_output; |
|
| 708 | + } |
|
| 637 | 709 | |
| 638 | 710 | $this->setSessionInfo(); |
| 639 | 711 | // Return result |
@@ -654,7 +726,9 @@ discard block |
||
| 654 | 726 | */ |
| 655 | 727 | function procMemberModifyPassword() |
| 656 | 728 | { |
| 657 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 729 | + if(!Context::get('is_logged')) { |
|
| 730 | + return $this->stop('msg_not_logged'); |
|
| 731 | + } |
|
| 658 | 732 | // Extract the necessary information in advance |
| 659 | 733 | $current_password = trim(Context::get('current_password')); |
| 660 | 734 | $password = trim(Context::get('password1')); |
@@ -668,17 +742,23 @@ discard block |
||
| 668 | 742 | |
| 669 | 743 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 670 | 744 | // Verify the cuttent password |
| 671 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new BaseObject(-1, 'invalid_password'); |
|
| 745 | + if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) { |
|
| 746 | + return new BaseObject(-1, 'invalid_password'); |
|
| 747 | + } |
|
| 672 | 748 | |
| 673 | 749 | // Check if a new password is as same as the previous password |
| 674 | - if($current_password == $password) return new BaseObject(-1, 'invalid_new_password'); |
|
| 750 | + if($current_password == $password) { |
|
| 751 | + return new BaseObject(-1, 'invalid_new_password'); |
|
| 752 | + } |
|
| 675 | 753 | |
| 676 | 754 | // Execute insert or update depending on the value of member_srl |
| 677 | 755 | $args = new stdClass; |
| 678 | 756 | $args->member_srl = $member_srl; |
| 679 | 757 | $args->password = $password; |
| 680 | 758 | $output = $this->updateMemberPassword($args); |
| 681 | - if(!$output->toBool()) return $output; |
|
| 759 | + if(!$output->toBool()) { |
|
| 760 | + return $output; |
|
| 761 | + } |
|
| 682 | 762 | |
| 683 | 763 | $this->add('member_srl', $args->member_srl); |
| 684 | 764 | $this->setMessage('success_updated'); |
@@ -694,7 +774,9 @@ discard block |
||
| 694 | 774 | */ |
| 695 | 775 | function procMemberLeave() |
| 696 | 776 | { |
| 697 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 777 | + if(!Context::get('is_logged')) { |
|
| 778 | + return $this->stop('msg_not_logged'); |
|
| 779 | + } |
|
| 698 | 780 | // Extract the necessary information in advance |
| 699 | 781 | $password = trim(Context::get('password')); |
| 700 | 782 | // Get information of logged-in user |
@@ -710,10 +792,14 @@ discard block |
||
| 710 | 792 | $this->memberInfo->password = $memberInfo->password; |
| 711 | 793 | } |
| 712 | 794 | // Verify the cuttent password |
| 713 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new BaseObject(-1, 'invalid_password'); |
|
| 795 | + if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) { |
|
| 796 | + return new BaseObject(-1, 'invalid_password'); |
|
| 797 | + } |
|
| 714 | 798 | |
| 715 | 799 | $output = $this->deleteMember($member_srl); |
| 716 | - if(!$output->toBool()) return $output; |
|
| 800 | + if(!$output->toBool()) { |
|
| 801 | + return $output; |
|
| 802 | + } |
|
| 717 | 803 | // Destroy all session information |
| 718 | 804 | $this->destroySessionInfo(); |
| 719 | 805 | // Return success message |
@@ -732,20 +818,30 @@ discard block |
||
| 732 | 818 | { |
| 733 | 819 | // Check if the file is successfully uploaded |
| 734 | 820 | $file = $_FILES['profile_image']; |
| 735 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 821 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 822 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 823 | + } |
|
| 736 | 824 | // Ignore if member_srl is invalid or doesn't exist. |
| 737 | 825 | $member_srl = Context::get('member_srl'); |
| 738 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 826 | + if(!$member_srl) { |
|
| 827 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 828 | + } |
|
| 739 | 829 | |
| 740 | 830 | $logged_info = Context::get('logged_info'); |
| 741 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 831 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 832 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 833 | + } |
|
| 742 | 834 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 743 | 835 | $oMemberModel = getModel('member'); |
| 744 | 836 | $config = $oMemberModel->getMemberConfig(); |
| 745 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 837 | + if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') { |
|
| 838 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 839 | + } |
|
| 746 | 840 | |
| 747 | 841 | $output = $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 748 | - if(!$output->toBool()) return $output; |
|
| 842 | + if(!$output->toBool()) { |
|
| 843 | + return $output; |
|
| 844 | + } |
|
| 749 | 845 | |
| 750 | 846 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 751 | 847 | $this->setRedirectUrl($returnUrl); |
@@ -768,8 +864,9 @@ discard block |
||
| 768 | 864 | $max_filesize = $config->profile_image_max_filesize; |
| 769 | 865 | foreach($config->signupForm as $val) |
| 770 | 866 | { |
| 771 | - if($val->name == "profile_image") |
|
| 772 | - $allow_transparent = $val->allow_transparent_thumbnail == 'Y'; |
|
| 867 | + if($val->name == "profile_image") { |
|
| 868 | + $allow_transparent = $val->allow_transparent_thumbnail == 'Y'; |
|
| 869 | + } |
|
| 773 | 870 | } |
| 774 | 871 | |
| 775 | 872 | Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
@@ -777,10 +874,13 @@ discard block |
||
| 777 | 874 | // Get file information |
| 778 | 875 | FileHandler::clearStatCache($target_file); |
| 779 | 876 | list($width, $height, $type) = @getimagesize($target_file); |
| 780 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 781 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 782 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 783 | - else |
|
| 877 | + if(IMAGETYPE_PNG == $type) { |
|
| 878 | + $ext = 'png'; |
|
| 879 | + } elseif(IMAGETYPE_JPEG == $type) { |
|
| 880 | + $ext = 'jpg'; |
|
| 881 | + } elseif(IMAGETYPE_GIF == $type) { |
|
| 882 | + $ext = 'gif'; |
|
| 883 | + } else |
|
| 784 | 884 | { |
| 785 | 885 | return $this->stop('msg_not_uploaded_profile_image'); |
| 786 | 886 | } |
@@ -811,8 +911,7 @@ discard block |
||
| 811 | 911 | FileHandler::removeFilesInDir($target_path); |
| 812 | 912 | FileHandler::moveFile($temp_filename, $target_filename); |
| 813 | 913 | FileHandler::clearStatCache($target_filename); |
| 814 | - } |
|
| 815 | - else |
|
| 914 | + } else |
|
| 816 | 915 | { |
| 817 | 916 | // 파일 용량 제한 |
| 818 | 917 | $filesize = filesize($target_file); |
@@ -841,20 +940,30 @@ discard block |
||
| 841 | 940 | { |
| 842 | 941 | // Check if the file is successfully uploaded |
| 843 | 942 | $file = $_FILES['image_name']; |
| 844 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 943 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 944 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 945 | + } |
|
| 845 | 946 | // Ignore if member_srl is invalid or doesn't exist. |
| 846 | 947 | $member_srl = Context::get('member_srl'); |
| 847 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 948 | + if(!$member_srl) { |
|
| 949 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 950 | + } |
|
| 848 | 951 | |
| 849 | 952 | $logged_info = Context::get('logged_info'); |
| 850 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 953 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 954 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 955 | + } |
|
| 851 | 956 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 852 | 957 | $oMemberModel = getModel('member'); |
| 853 | 958 | $config = $oMemberModel->getMemberConfig(); |
| 854 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 959 | + if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') { |
|
| 960 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 961 | + } |
|
| 855 | 962 | |
| 856 | 963 | $output = $this->insertImageName($member_srl, $file['tmp_name']); |
| 857 | - if(!$output->toBool()) return $output; |
|
| 964 | + if(!$output->toBool()) { |
|
| 965 | + return $output; |
|
| 966 | + } |
|
| 858 | 967 | |
| 859 | 968 | // Page refresh |
| 860 | 969 | //$this->setRefreshPage(); |
@@ -909,8 +1018,7 @@ discard block |
||
| 909 | 1018 | FileHandler::removeFilesInDir($target_path); |
| 910 | 1019 | FileHandler::moveFile($temp_filename, $target_filename); |
| 911 | 1020 | FileHandler::clearStatCache($target_filename); |
| 912 | - } |
|
| 913 | - else |
|
| 1021 | + } else |
|
| 914 | 1022 | { |
| 915 | 1023 | // 파일 용량 제한 |
| 916 | 1024 | $filesize = filesize($target_file); |
@@ -987,20 +1095,30 @@ discard block |
||
| 987 | 1095 | { |
| 988 | 1096 | // Check if the file is successfully uploaded |
| 989 | 1097 | $file = $_FILES['image_mark']; |
| 990 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1098 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 1099 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1100 | + } |
|
| 991 | 1101 | // Ignore if member_srl is invalid or doesn't exist. |
| 992 | 1102 | $member_srl = Context::get('member_srl'); |
| 993 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1103 | + if(!$member_srl) { |
|
| 1104 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1105 | + } |
|
| 994 | 1106 | |
| 995 | 1107 | $logged_info = Context::get('logged_info'); |
| 996 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1108 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 1109 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1110 | + } |
|
| 997 | 1111 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 998 | 1112 | $oMemberModel = getModel('member'); |
| 999 | 1113 | $config = $oMemberModel->getMemberConfig(); |
| 1000 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1114 | + if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') { |
|
| 1115 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1116 | + } |
|
| 1001 | 1117 | |
| 1002 | 1118 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 1003 | - if(!$output->toBool()) return $output; |
|
| 1119 | + if(!$output->toBool()) { |
|
| 1120 | + return $output; |
|
| 1121 | + } |
|
| 1004 | 1122 | |
| 1005 | 1123 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 1006 | 1124 | $this->setRedirectUrl($returnUrl); |
@@ -1051,8 +1169,7 @@ discard block |
||
| 1051 | 1169 | FileHandler::removeFilesInDir($target_path); |
| 1052 | 1170 | FileHandler::moveFile($temp_filename, $target_filename); |
| 1053 | 1171 | FileHandler::clearStatCache($target_filename); |
| 1054 | - } |
|
| 1055 | - else |
|
| 1172 | + } else |
|
| 1056 | 1173 | { |
| 1057 | 1174 | $filesize = filesize($target_file); |
| 1058 | 1175 | if($max_filesize && $filesize > ($max_filesize * 1024)) |
@@ -1104,14 +1221,18 @@ discard block |
||
| 1104 | 1221 | function procMemberFindAccount() |
| 1105 | 1222 | { |
| 1106 | 1223 | $email_address = Context::get('email_address'); |
| 1107 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1224 | + if(!$email_address) { |
|
| 1225 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1226 | + } |
|
| 1108 | 1227 | |
| 1109 | 1228 | $oMemberModel = getModel('member'); |
| 1110 | 1229 | $oModuleModel = getModel('module'); |
| 1111 | 1230 | |
| 1112 | 1231 | // Check if a member having the same email address exists |
| 1113 | 1232 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1114 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1233 | + if(!$member_srl) { |
|
| 1234 | + return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1235 | + } |
|
| 1115 | 1236 | |
| 1116 | 1237 | // Get information of the member |
| 1117 | 1238 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
@@ -1123,7 +1244,9 @@ discard block |
||
| 1123 | 1244 | $chk_args = new stdClass; |
| 1124 | 1245 | $chk_args->member_srl = $member_info->member_srl; |
| 1125 | 1246 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1126 | - if($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1247 | + if($output->toBool() && $output->data->count != '0') { |
|
| 1248 | + return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1249 | + } |
|
| 1127 | 1250 | } |
| 1128 | 1251 | |
| 1129 | 1252 | // Insert data into the authentication DB |
@@ -1136,7 +1259,9 @@ discard block |
||
| 1136 | 1259 | $args->is_register = 'N'; |
| 1137 | 1260 | |
| 1138 | 1261 | $output = executeQuery('member.insertAuthMail', $args); |
| 1139 | - if(!$output->toBool()) return $output; |
|
| 1262 | + if(!$output->toBool()) { |
|
| 1263 | + return $output; |
|
| 1264 | + } |
|
| 1140 | 1265 | // Get content of the email to send a member |
| 1141 | 1266 | Context::set('auth_args', $args); |
| 1142 | 1267 | |
@@ -1153,8 +1278,7 @@ discard block |
||
| 1153 | 1278 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1154 | 1279 | } |
| 1155 | 1280 | } |
| 1156 | - } |
|
| 1157 | - else |
|
| 1281 | + } else |
|
| 1158 | 1282 | { |
| 1159 | 1283 | $memberInfo[$lang->user_id] = $args->user_id; |
| 1160 | 1284 | $memberInfo[$lang->user_name] = $args->user_name; |
@@ -1163,13 +1287,19 @@ discard block |
||
| 1163 | 1287 | } |
| 1164 | 1288 | Context::set('memberInfo', $memberInfo); |
| 1165 | 1289 | |
| 1166 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1167 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1290 | + if(!$member_config->skin) { |
|
| 1291 | + $member_config->skin = "default"; |
|
| 1292 | + } |
|
| 1293 | + if(!$member_config->colorset) { |
|
| 1294 | + $member_config->colorset = "white"; |
|
| 1295 | + } |
|
| 1168 | 1296 | |
| 1169 | 1297 | Context::set('member_config', $member_config); |
| 1170 | 1298 | |
| 1171 | 1299 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1172 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1300 | + if(!is_dir($tpl_path)) { |
|
| 1301 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1302 | + } |
|
| 1173 | 1303 | |
| 1174 | 1304 | $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
| 1175 | 1305 | Context::set('find_url', $find_url); |
@@ -1212,19 +1342,25 @@ discard block |
||
| 1212 | 1342 | $find_account_question = trim(Context::get('find_account_question')); |
| 1213 | 1343 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1214 | 1344 | |
| 1215 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1345 | + if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) { |
|
| 1346 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1347 | + } |
|
| 1216 | 1348 | |
| 1217 | 1349 | $oModuleModel = getModel('module'); |
| 1218 | 1350 | // Check if a member having the same email address exists |
| 1219 | 1351 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1220 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1352 | + if(!$member_srl) { |
|
| 1353 | + return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1354 | + } |
|
| 1221 | 1355 | |
| 1222 | 1356 | // Get information of the member |
| 1223 | 1357 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1224 | 1358 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1225 | 1359 | |
| 1226 | 1360 | // Display a message if no answer is entered |
| 1227 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1361 | + if(!$member_info->find_account_question || !$member_info->find_account_answer) { |
|
| 1362 | + return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1363 | + } |
|
| 1228 | 1364 | |
| 1229 | 1365 | // 답변 확인 |
| 1230 | 1366 | $hashed = $oPassword->checkAlgorithm($member_info->find_account_answer); |
@@ -1233,12 +1369,10 @@ discard block |
||
| 1233 | 1369 | if($member_info->find_account_question != $find_account_question) |
| 1234 | 1370 | { |
| 1235 | 1371 | $authed = false; |
| 1236 | - } |
|
| 1237 | - else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1372 | + } else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1238 | 1373 | { |
| 1239 | 1374 | $authed = false; |
| 1240 | - } |
|
| 1241 | - else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1375 | + } else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1242 | 1376 | { |
| 1243 | 1377 | $authed = false; |
| 1244 | 1378 | } |
@@ -1267,7 +1401,9 @@ discard block |
||
| 1267 | 1401 | $args->password = $temp_password; |
| 1268 | 1402 | $args->change_password_date = '1'; |
| 1269 | 1403 | $output = $this->updateMemberPassword($args); |
| 1270 | - if(!$output->toBool()) return $output; |
|
| 1404 | + if(!$output->toBool()) { |
|
| 1405 | + return $output; |
|
| 1406 | + } |
|
| 1271 | 1407 | |
| 1272 | 1408 | $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
| 1273 | 1409 | |
@@ -1324,8 +1460,7 @@ discard block |
||
| 1324 | 1460 | if($output->data->is_register == 'Y') |
| 1325 | 1461 | { |
| 1326 | 1462 | $args->denied = 'N'; |
| 1327 | - } |
|
| 1328 | - else |
|
| 1463 | + } else |
|
| 1329 | 1464 | { |
| 1330 | 1465 | $args->password = $oMemberModel->hashPassword($args->password); |
| 1331 | 1466 | } |
@@ -1359,33 +1494,45 @@ discard block |
||
| 1359 | 1494 | { |
| 1360 | 1495 | // Get an email_address |
| 1361 | 1496 | $email_address = Context::get('email_address'); |
| 1362 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1497 | + if(!$email_address) { |
|
| 1498 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1499 | + } |
|
| 1363 | 1500 | // Log test by using email_address |
| 1364 | 1501 | $oMemberModel = getModel('member'); |
| 1365 | 1502 | |
| 1366 | 1503 | $args = new stdClass; |
| 1367 | 1504 | $args->email_address = $email_address; |
| 1368 | 1505 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1369 | - if(!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1506 | + if(!$memberSrl) { |
|
| 1507 | + return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1508 | + } |
|
| 1370 | 1509 | |
| 1371 | 1510 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1372 | 1511 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1373 | 1512 | |
| 1374 | 1513 | $oModuleModel = getModel('module'); |
| 1375 | 1514 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1376 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1377 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1515 | + if(!$member_config->skin) { |
|
| 1516 | + $member_config->skin = "default"; |
|
| 1517 | + } |
|
| 1518 | + if(!$member_config->colorset) { |
|
| 1519 | + $member_config->colorset = "white"; |
|
| 1520 | + } |
|
| 1378 | 1521 | |
| 1379 | 1522 | // Check if a authentication mail has been sent previously |
| 1380 | 1523 | $chk_args = new stdClass; |
| 1381 | 1524 | $chk_args->member_srl = $member_info->member_srl; |
| 1382 | 1525 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1383 | - if($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1526 | + if($output->toBool() && $output->data->count == '0') { |
|
| 1527 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1528 | + } |
|
| 1384 | 1529 | |
| 1385 | 1530 | $auth_args = new stdClass; |
| 1386 | 1531 | $auth_args->member_srl = $member_info->member_srl; |
| 1387 | 1532 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1388 | - if(!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1533 | + if(!$output->data || !$output->data[0]->auth_key) { |
|
| 1534 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1535 | + } |
|
| 1389 | 1536 | $auth_info = $output->data[0]; |
| 1390 | 1537 | |
| 1391 | 1538 | // Update the regdate of authmail entry |
@@ -1406,8 +1553,7 @@ discard block |
||
| 1406 | 1553 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1407 | 1554 | } |
| 1408 | 1555 | } |
| 1409 | - } |
|
| 1410 | - else |
|
| 1556 | + } else |
|
| 1411 | 1557 | { |
| 1412 | 1558 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1413 | 1559 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1420,7 +1566,9 @@ discard block |
||
| 1420 | 1566 | Context::set('member_config', $member_config); |
| 1421 | 1567 | |
| 1422 | 1568 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1423 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1569 | + if(!is_dir($tpl_path)) { |
|
| 1570 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1571 | + } |
|
| 1424 | 1572 | |
| 1425 | 1573 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
| 1426 | 1574 | Context::set('auth_url', $auth_url); |
@@ -1498,7 +1646,9 @@ discard block |
||
| 1498 | 1646 | $auth_args->is_register = 'Y'; |
| 1499 | 1647 | |
| 1500 | 1648 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1501 | - if(!$output->toBool()) return $output; |
|
| 1649 | + if(!$output->toBool()) { |
|
| 1650 | + return $output; |
|
| 1651 | + } |
|
| 1502 | 1652 | |
| 1503 | 1653 | $memberInfo->email_address = $newEmail; |
| 1504 | 1654 | |
@@ -1532,8 +1682,7 @@ discard block |
||
| 1532 | 1682 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1533 | 1683 | } |
| 1534 | 1684 | } |
| 1535 | - } |
|
| 1536 | - else |
|
| 1685 | + } else |
|
| 1537 | 1686 | { |
| 1538 | 1687 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1539 | 1688 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1542,13 +1691,19 @@ discard block |
||
| 1542 | 1691 | } |
| 1543 | 1692 | Context::set('memberInfo', $memberInfo); |
| 1544 | 1693 | |
| 1545 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1546 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1694 | + if(!$member_config->skin) { |
|
| 1695 | + $member_config->skin = "default"; |
|
| 1696 | + } |
|
| 1697 | + if(!$member_config->colorset) { |
|
| 1698 | + $member_config->colorset = "white"; |
|
| 1699 | + } |
|
| 1547 | 1700 | |
| 1548 | 1701 | Context::set('member_config', $member_config); |
| 1549 | 1702 | |
| 1550 | 1703 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1551 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1704 | + if(!is_dir($tpl_path)) { |
|
| 1705 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1706 | + } |
|
| 1552 | 1707 | |
| 1553 | 1708 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
| 1554 | 1709 | Context::set('auth_url', $auth_url); |
@@ -1573,7 +1728,9 @@ discard block |
||
| 1573 | 1728 | { |
| 1574 | 1729 | $site_module_info = Context::get('site_module_info'); |
| 1575 | 1730 | $logged_info = Context::get('logged_info'); |
| 1576 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1731 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1732 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1733 | + } |
|
| 1577 | 1734 | |
| 1578 | 1735 | $oMemberModel = getModel('member'); |
| 1579 | 1736 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1592,13 +1749,17 @@ discard block |
||
| 1592 | 1749 | { |
| 1593 | 1750 | $site_module_info = Context::get('site_module_info'); |
| 1594 | 1751 | $logged_info = Context::get('logged_info'); |
| 1595 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1752 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1753 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1754 | + } |
|
| 1596 | 1755 | |
| 1597 | 1756 | $args = new stdClass; |
| 1598 | 1757 | $args->site_srl= $site_module_info->site_srl; |
| 1599 | 1758 | $args->member_srl = $logged_info->member_srl; |
| 1600 | 1759 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1601 | - if(!$output->toBool()) return $output; |
|
| 1760 | + if(!$output->toBool()) { |
|
| 1761 | + return $output; |
|
| 1762 | + } |
|
| 1602 | 1763 | $this->setMessage('success_deleted'); |
| 1603 | 1764 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1604 | 1765 | } |
@@ -1612,17 +1773,37 @@ discard block |
||
| 1612 | 1773 | */ |
| 1613 | 1774 | function setMemberConfig($args) |
| 1614 | 1775 | { |
| 1615 | - if(!$args->skin) $args->skin = "default"; |
|
| 1616 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1617 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1618 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1619 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1776 | + if(!$args->skin) { |
|
| 1777 | + $args->skin = "default"; |
|
| 1778 | + } |
|
| 1779 | + if(!$args->colorset) { |
|
| 1780 | + $args->colorset = "white"; |
|
| 1781 | + } |
|
| 1782 | + if(!$args->editor_skin) { |
|
| 1783 | + $args->editor_skin= "ckeditor"; |
|
| 1784 | + } |
|
| 1785 | + if(!$args->editor_colorset) { |
|
| 1786 | + $args->editor_colorset = "moono"; |
|
| 1787 | + } |
|
| 1788 | + if($args->enable_join!='Y') { |
|
| 1789 | + $args->enable_join = 'N'; |
|
| 1790 | + } |
|
| 1620 | 1791 | $args->enable_openid= 'N'; |
| 1621 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1622 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1623 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1624 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1625 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1792 | + if($args->profile_image !='Y') { |
|
| 1793 | + $args->profile_image = 'N'; |
|
| 1794 | + } |
|
| 1795 | + if($args->image_name!='Y') { |
|
| 1796 | + $args->image_name = 'N'; |
|
| 1797 | + } |
|
| 1798 | + if($args->image_mark!='Y') { |
|
| 1799 | + $args->image_mark = 'N'; |
|
| 1800 | + } |
|
| 1801 | + if($args->group_image_mark!='Y') { |
|
| 1802 | + $args->group_image_mark = 'N'; |
|
| 1803 | + } |
|
| 1804 | + if(!trim(strip_tags($args->agreement))) { |
|
| 1805 | + $args->agreement = null; |
|
| 1806 | + } |
|
| 1626 | 1807 | $args->limit_day = (int)$args->limit_day; |
| 1627 | 1808 | |
| 1628 | 1809 | $agreement = trim($args->agreement); |
@@ -1630,7 +1811,9 @@ discard block |
||
| 1630 | 1811 | |
| 1631 | 1812 | $oModuleController = getController('module'); |
| 1632 | 1813 | $output = $oModuleController->insertModuleConfig('member',$args); |
| 1633 | - if(!$output->toBool()) return $output; |
|
| 1814 | + if(!$output->toBool()) { |
|
| 1815 | + return $output; |
|
| 1816 | + } |
|
| 1634 | 1817 | |
| 1635 | 1818 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1636 | 1819 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1655,7 +1838,9 @@ discard block |
||
| 1655 | 1838 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1656 | 1839 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1657 | 1840 | |
| 1658 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1841 | + if(!$check_signature) { |
|
| 1842 | + return FileHandler::removeFile($filename); |
|
| 1843 | + } |
|
| 1659 | 1844 | |
| 1660 | 1845 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1661 | 1846 | FileHandler::makeDir($path); |
@@ -1689,7 +1874,9 @@ discard block |
||
| 1689 | 1874 | $args = new stdClass(); |
| 1690 | 1875 | $args->member_srl = $member_srl; |
| 1691 | 1876 | $args->group_srl = $group_srl; |
| 1692 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1877 | + if($site_srl) { |
|
| 1878 | + $args->site_srl = $site_srl; |
|
| 1879 | + } |
|
| 1693 | 1880 | |
| 1694 | 1881 | // Add |
| 1695 | 1882 | $output = executeQuery('member.addMemberToGroup',$args); |
@@ -1715,15 +1902,21 @@ discard block |
||
| 1715 | 1902 | $obj->member_srl = implode(',',$args->member_srl); |
| 1716 | 1903 | |
| 1717 | 1904 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1718 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1905 | + if($output->data) { |
|
| 1906 | + foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1907 | + } |
|
| 1719 | 1908 | |
| 1720 | 1909 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1721 | - if(!$output->toBool()) return $output; |
|
| 1910 | + if(!$output->toBool()) { |
|
| 1911 | + return $output; |
|
| 1912 | + } |
|
| 1722 | 1913 | |
| 1723 | 1914 | $inserted_members = array(); |
| 1724 | 1915 | foreach($args->member_srl as $key => $val) |
| 1725 | 1916 | { |
| 1726 | - if($inserted_members[$val]) continue; |
|
| 1917 | + if($inserted_members[$val]) { |
|
| 1918 | + continue; |
|
| 1919 | + } |
|
| 1727 | 1920 | $inserted_members[$val] = true; |
| 1728 | 1921 | |
| 1729 | 1922 | unset($obj); |
@@ -1733,7 +1926,9 @@ discard block |
||
| 1733 | 1926 | $obj->site_srl = $args->site_srl; |
| 1734 | 1927 | $obj->regdate = $date[$obj->member_srl]; |
| 1735 | 1928 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1736 | - if(!$output->toBool()) return $output; |
|
| 1929 | + if(!$output->toBool()) { |
|
| 1930 | + return $output; |
|
| 1931 | + } |
|
| 1737 | 1932 | |
| 1738 | 1933 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1739 | 1934 | } |
@@ -1795,8 +1990,7 @@ discard block |
||
| 1795 | 1990 | if($config->identifier == 'user_id') |
| 1796 | 1991 | { |
| 1797 | 1992 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1798 | - } |
|
| 1799 | - else |
|
| 1993 | + } else |
|
| 1800 | 1994 | { |
| 1801 | 1995 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1802 | 1996 | } |
@@ -1805,8 +1999,7 @@ discard block |
||
| 1805 | 1999 | $do_auto_login = true; |
| 1806 | 2000 | } |
| 1807 | 2001 | |
| 1808 | - } |
|
| 1809 | - else |
|
| 2002 | + } else |
|
| 1810 | 2003 | { |
| 1811 | 2004 | $do_auto_login = true; |
| 1812 | 2005 | } |
@@ -1815,8 +2008,7 @@ discard block |
||
| 1815 | 2008 | if($do_auto_login) |
| 1816 | 2009 | { |
| 1817 | 2010 | $output = $this->doLogin($user_id); |
| 1818 | - } |
|
| 1819 | - else |
|
| 2011 | + } else |
|
| 1820 | 2012 | { |
| 1821 | 2013 | executeQuery('member.deleteAutologin', $args); |
| 1822 | 2014 | setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
@@ -1835,13 +2027,17 @@ discard block |
||
| 1835 | 2027 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1836 | 2028 | { |
| 1837 | 2029 | $user_id = strtolower($user_id); |
| 1838 | - if(!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 2030 | + if(!$user_id) { |
|
| 2031 | + return new BaseObject(-1, 'null_user_id'); |
|
| 2032 | + } |
|
| 1839 | 2033 | // Call a trigger before log-in (before) |
| 1840 | 2034 | $trigger_obj = new stdClass(); |
| 1841 | 2035 | $trigger_obj->user_id = $user_id; |
| 1842 | 2036 | $trigger_obj->password = $password; |
| 1843 | 2037 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1844 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 2038 | + if(!$trigger_output->toBool()) { |
|
| 2039 | + return $trigger_output; |
|
| 2040 | + } |
|
| 1845 | 2041 | // Create a member model object |
| 1846 | 2042 | $oMemberModel = getModel('member'); |
| 1847 | 2043 | |
@@ -1856,15 +2052,18 @@ discard block |
||
| 1856 | 2052 | // Get user_id information |
| 1857 | 2053 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1858 | 2054 | // Set an invalid user if no value returned |
| 1859 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 2055 | + if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) { |
|
| 2056 | + return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 2057 | + } |
|
| 1860 | 2058 | |
| 1861 | - } |
|
| 1862 | - else |
|
| 2059 | + } else |
|
| 1863 | 2060 | { |
| 1864 | 2061 | // Get user_id information |
| 1865 | 2062 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1866 | 2063 | // Set an invalid user if no value returned |
| 1867 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 2064 | + if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) { |
|
| 2065 | + return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 2066 | + } |
|
| 1868 | 2067 | } |
| 1869 | 2068 | |
| 1870 | 2069 | $output = executeQuery('member.getLoginCountByIp', $args); |
@@ -1876,14 +2075,18 @@ discard block |
||
| 1876 | 2075 | if($term < $config->max_error_count_time) |
| 1877 | 2076 | { |
| 1878 | 2077 | $term = $config->max_error_count_time - $term; |
| 1879 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1880 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1881 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1882 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 2078 | + if($term < 60) { |
|
| 2079 | + $term = intval($term).Context::getLang('unit_sec'); |
|
| 2080 | + } elseif(60 <= $term && $term < 3600) { |
|
| 2081 | + $term = intval($term/60).Context::getLang('unit_min'); |
|
| 2082 | + } elseif(3600 <= $term && $term < 86400) { |
|
| 2083 | + $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 2084 | + } else { |
|
| 2085 | + $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 2086 | + } |
|
| 1883 | 2087 | |
| 1884 | 2088 | return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
| 1885 | - } |
|
| 1886 | - else |
|
| 2089 | + } else |
|
| 1887 | 2090 | { |
| 1888 | 2091 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1889 | 2092 | $output = executeQuery('member.deleteLoginCountByIp', $args); |
@@ -1910,7 +2113,9 @@ discard block |
||
| 1910 | 2113 | return new BaseObject(-1,'msg_user_denied'); |
| 1911 | 2114 | } |
| 1912 | 2115 | // Notify if denied_date is less than the current time |
| 1913 | - if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new BaseObject(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
| 2116 | + if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) { |
|
| 2117 | + return new BaseObject(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
| 2118 | + } |
|
| 1914 | 2119 | // Update the latest login time |
| 1915 | 2120 | $args->member_srl = $this->memberInfo->member_srl; |
| 1916 | 2121 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1959,7 +2164,9 @@ discard block |
||
| 1959 | 2164 | } |
| 1960 | 2165 | // Call a trigger after successfully log-in (after) |
| 1961 | 2166 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1962 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 2167 | + if(!$trigger_output->toBool()) { |
|
| 2168 | + return $trigger_output; |
|
| 2169 | + } |
|
| 1963 | 2170 | // When user checked to use auto-login |
| 1964 | 2171 | if($keep_signed) |
| 1965 | 2172 | { |
@@ -1973,7 +2180,9 @@ discard block |
||
| 1973 | 2180 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1974 | 2181 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1975 | 2182 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1976 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2183 | + if($autologin_output->toBool()) { |
|
| 2184 | + setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2185 | + } |
|
| 1977 | 2186 | } |
| 1978 | 2187 | if($this->memberInfo->is_admin == 'Y') |
| 1979 | 2188 | { |
@@ -2062,7 +2271,9 @@ discard block |
||
| 2062 | 2271 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 2063 | 2272 | { |
| 2064 | 2273 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 2065 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2274 | + if(!is_array($member_popup_menu_list)) { |
|
| 2275 | + $member_popup_menu_list = array(); |
|
| 2276 | + } |
|
| 2066 | 2277 | |
| 2067 | 2278 | $obj = new stdClass; |
| 2068 | 2279 | $obj->url = $url; |
@@ -2081,35 +2292,54 @@ discard block |
||
| 2081 | 2292 | { |
| 2082 | 2293 | // Call a trigger (before) |
| 2083 | 2294 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 2084 | - if(!$output->toBool()) return $output; |
|
| 2295 | + if(!$output->toBool()) { |
|
| 2296 | + return $output; |
|
| 2297 | + } |
|
| 2085 | 2298 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 2086 | 2299 | $oModuleModel = getModel('module'); |
| 2087 | 2300 | $config = $oModuleModel->getModuleConfig('member'); |
| 2088 | 2301 | |
| 2089 | 2302 | $logged_info = Context::get('logged_info'); |
| 2090 | 2303 | // If the date of the temporary restrictions limit further information on the date of |
| 2091 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2304 | + if($config->limit_day) { |
|
| 2305 | + $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2306 | + } |
|
| 2092 | 2307 | |
| 2093 | 2308 | $args->member_srl = getNextSequence(); |
| 2094 | 2309 | $args->list_order = -1 * $args->member_srl; |
| 2095 | 2310 | |
| 2096 | 2311 | // Execute insert or update depending on the value of member_srl |
| 2097 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2312 | + if(!$args->user_id) { |
|
| 2313 | + $args->user_id = 't'.$args->member_srl; |
|
| 2314 | + } |
|
| 2098 | 2315 | // Enter the user's identity changed to lowercase |
| 2099 | - else $args->user_id = strtolower($args->user_id); |
|
| 2100 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2101 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2316 | + else { |
|
| 2317 | + $args->user_id = strtolower($args->user_id); |
|
| 2318 | + } |
|
| 2319 | + if(!$args->user_name) { |
|
| 2320 | + $args->user_name = $args->member_srl; |
|
| 2321 | + } |
|
| 2322 | + if(!$args->nick_name) { |
|
| 2323 | + $args->nick_name = $args->member_srl; |
|
| 2324 | + } |
|
| 2102 | 2325 | |
| 2103 | 2326 | // Control of essential parameters |
| 2104 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2105 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2106 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 2327 | + if($args->allow_mailing!='Y') { |
|
| 2328 | + $args->allow_mailing = 'N'; |
|
| 2329 | + } |
|
| 2330 | + if($args->denied!='Y') { |
|
| 2331 | + $args->denied = 'N'; |
|
| 2332 | + } |
|
| 2333 | + if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) { |
|
| 2334 | + $args->allow_message = 'Y'; |
|
| 2335 | + } |
|
| 2107 | 2336 | |
| 2108 | 2337 | if($logged_info->is_admin == 'Y') |
| 2109 | 2338 | { |
| 2110 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 2111 | - } |
|
| 2112 | - else |
|
| 2339 | + if($args->is_admin!='Y') { |
|
| 2340 | + $args->is_admin = 'N'; |
|
| 2341 | + } |
|
| 2342 | + } else |
|
| 2113 | 2343 | { |
| 2114 | 2344 | unset($args->is_admin); |
| 2115 | 2345 | } |
@@ -2122,8 +2352,12 @@ discard block |
||
| 2122 | 2352 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2123 | 2353 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2124 | 2354 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2125 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2126 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2355 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) { |
|
| 2356 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2357 | + } |
|
| 2358 | + if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) { |
|
| 2359 | + $args->blog = 'http://'.$args->blog; |
|
| 2360 | + } |
|
| 2127 | 2361 | |
| 2128 | 2362 | // Create a model object |
| 2129 | 2363 | $oMemberModel = getModel('member'); |
@@ -2137,8 +2371,7 @@ discard block |
||
| 2137 | 2371 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2138 | 2372 | } |
| 2139 | 2373 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2140 | - } |
|
| 2141 | - elseif(!$args->password) |
|
| 2374 | + } elseif(!$args->password) |
|
| 2142 | 2375 | { |
| 2143 | 2376 | unset($args->password); |
| 2144 | 2377 | } |
@@ -2146,8 +2379,7 @@ discard block |
||
| 2146 | 2379 | if($args->find_account_answer && !$password_is_hashed) |
| 2147 | 2380 | { |
| 2148 | 2381 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2149 | - } |
|
| 2150 | - elseif(!$args->find_account_answer) |
|
| 2382 | + } elseif(!$args->find_account_answer) |
|
| 2151 | 2383 | { |
| 2152 | 2384 | unset($args->find_account_answer); |
| 2153 | 2385 | } |
@@ -2188,8 +2420,12 @@ discard block |
||
| 2188 | 2420 | // Insert data into the DB |
| 2189 | 2421 | $args->list_order = -1 * $args->member_srl; |
| 2190 | 2422 | |
| 2191 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2192 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2423 | + if(!$args->user_id) { |
|
| 2424 | + $args->user_id = 't'.$args->member_srl; |
|
| 2425 | + } |
|
| 2426 | + if(!$args->user_name) { |
|
| 2427 | + $args->user_name = $args->member_srl; |
|
| 2428 | + } |
|
| 2193 | 2429 | |
| 2194 | 2430 | $oDB = &DB::getInstance(); |
| 2195 | 2431 | $oDB->begin(); |
@@ -2201,8 +2437,11 @@ discard block |
||
| 2201 | 2437 | return $output; |
| 2202 | 2438 | } |
| 2203 | 2439 | |
| 2204 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2205 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2440 | + if(is_array($args->group_srl_list)) { |
|
| 2441 | + $group_srl_list = $args->group_srl_list; |
|
| 2442 | + } else { |
|
| 2443 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2444 | + } |
|
| 2206 | 2445 | // If no value is entered the default group, the value of group registration |
| 2207 | 2446 | if(!$args->group_srl_list) |
| 2208 | 2447 | { |
@@ -2219,8 +2458,7 @@ discard block |
||
| 2219 | 2458 | } |
| 2220 | 2459 | } |
| 2221 | 2460 | // If the value is the value of the group entered the group registration |
| 2222 | - } |
|
| 2223 | - else |
|
| 2461 | + } else |
|
| 2224 | 2462 | { |
| 2225 | 2463 | for($i=0;$i<count($group_srl_list);$i++) |
| 2226 | 2464 | { |
@@ -2281,27 +2519,39 @@ discard block |
||
| 2281 | 2519 | { |
| 2282 | 2520 | // Call a trigger (before) |
| 2283 | 2521 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2284 | - if(!$output->toBool()) return $output; |
|
| 2522 | + if(!$output->toBool()) { |
|
| 2523 | + return $output; |
|
| 2524 | + } |
|
| 2285 | 2525 | // Create a model object |
| 2286 | 2526 | $oMemberModel = getModel('member'); |
| 2287 | 2527 | |
| 2288 | 2528 | $logged_info = Context::get('logged_info'); |
| 2289 | 2529 | // Get what you want to modify the original information |
| 2290 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2530 | + if(!$this->memberInfo) { |
|
| 2531 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2532 | + } |
|
| 2291 | 2533 | // Control of essential parameters |
| 2292 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2293 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2534 | + if($args->allow_mailing!='Y') { |
|
| 2535 | + $args->allow_mailing = 'N'; |
|
| 2536 | + } |
|
| 2537 | + if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) { |
|
| 2538 | + $args->allow_message = 'Y'; |
|
| 2539 | + } |
|
| 2294 | 2540 | |
| 2295 | 2541 | if($logged_info->is_admin == 'Y') |
| 2296 | 2542 | { |
| 2297 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2298 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2299 | - } |
|
| 2300 | - else |
|
| 2543 | + if($args->denied!='Y') { |
|
| 2544 | + $args->denied = 'N'; |
|
| 2545 | + } |
|
| 2546 | + if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) { |
|
| 2547 | + $args->is_admin = 'N'; |
|
| 2548 | + } |
|
| 2549 | + } else |
|
| 2301 | 2550 | { |
| 2302 | 2551 | unset($args->is_admin); |
| 2303 | - if($is_admin == false) |
|
| 2304 | - unset($args->denied); |
|
| 2552 | + if($is_admin == false) { |
|
| 2553 | + unset($args->denied); |
|
| 2554 | + } |
|
| 2305 | 2555 | if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
| 2306 | 2556 | { |
| 2307 | 2557 | return $this->stop('msg_invalid_request'); |
@@ -2309,13 +2559,19 @@ discard block |
||
| 2309 | 2559 | } |
| 2310 | 2560 | |
| 2311 | 2561 | // Sanitize user ID, username, nickname, homepage, blog |
| 2312 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2562 | + if($args->user_id) { |
|
| 2563 | + $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2564 | + } |
|
| 2313 | 2565 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2314 | 2566 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2315 | 2567 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2316 | 2568 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2317 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2318 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2569 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) { |
|
| 2570 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2571 | + } |
|
| 2572 | + if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) { |
|
| 2573 | + $args->blog = 'http://'.$args->blog; |
|
| 2574 | + } |
|
| 2319 | 2575 | |
| 2320 | 2576 | // check member identifier form |
| 2321 | 2577 | $config = $oMemberModel->getMemberConfig(); |
@@ -2332,8 +2588,7 @@ discard block |
||
| 2332 | 2588 | return new BaseObject(-1,'msg_exists_email_address'); |
| 2333 | 2589 | } |
| 2334 | 2590 | $args->email_address = $orgMemberInfo->email_address; |
| 2335 | - } |
|
| 2336 | - else |
|
| 2591 | + } else |
|
| 2337 | 2592 | { |
| 2338 | 2593 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2339 | 2594 | if($member_srl && $args->member_srl != $member_srl) |
@@ -2390,16 +2645,14 @@ discard block |
||
| 2390 | 2645 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2391 | 2646 | } |
| 2392 | 2647 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2393 | - } |
|
| 2394 | - else |
|
| 2648 | + } else |
|
| 2395 | 2649 | { |
| 2396 | 2650 | $args->password = $orgMemberInfo->password; |
| 2397 | 2651 | } |
| 2398 | 2652 | |
| 2399 | 2653 | if($args->find_account_answer) { |
| 2400 | 2654 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2401 | - } |
|
| 2402 | - else |
|
| 2655 | + } else |
|
| 2403 | 2656 | { |
| 2404 | 2657 | $oPassword = new Password(); |
| 2405 | 2658 | $hashed = $oPassword->checkAlgorithm($orgMemberInfo->find_account_answer); |
@@ -2411,11 +2664,21 @@ discard block |
||
| 2411 | 2664 | } |
| 2412 | 2665 | } |
| 2413 | 2666 | |
| 2414 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2415 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2416 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2417 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2418 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2667 | + if(!$args->user_name) { |
|
| 2668 | + $args->user_name = $orgMemberInfo->user_name; |
|
| 2669 | + } |
|
| 2670 | + if(!$args->user_id) { |
|
| 2671 | + $args->user_id = $orgMemberInfo->user_id; |
|
| 2672 | + } |
|
| 2673 | + if(!$args->nick_name) { |
|
| 2674 | + $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2675 | + } |
|
| 2676 | + if(!$args->description) { |
|
| 2677 | + $args->description = $orgMemberInfo->description; |
|
| 2678 | + } |
|
| 2679 | + if(!$args->birthday) { |
|
| 2680 | + $args->birthday = ''; |
|
| 2681 | + } |
|
| 2419 | 2682 | |
| 2420 | 2683 | $output = executeQuery('member.updateMember', $args); |
| 2421 | 2684 | |
@@ -2427,8 +2690,11 @@ discard block |
||
| 2427 | 2690 | |
| 2428 | 2691 | if($args->group_srl_list) |
| 2429 | 2692 | { |
| 2430 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2431 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2693 | + if(is_array($args->group_srl_list)) { |
|
| 2694 | + $group_srl_list = $args->group_srl_list; |
|
| 2695 | + } else { |
|
| 2696 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2697 | + } |
|
| 2432 | 2698 | // If the group information, group information changes |
| 2433 | 2699 | if(count($group_srl_list) > 0) |
| 2434 | 2700 | { |
@@ -2471,7 +2737,9 @@ discard block |
||
| 2471 | 2737 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2472 | 2738 | |
| 2473 | 2739 | // Save Session |
| 2474 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2740 | + if(!$this->memberInfo) { |
|
| 2741 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2742 | + } |
|
| 2475 | 2743 | $logged_info = Context::get('logged_info'); |
| 2476 | 2744 | |
| 2477 | 2745 | $output->add('member_srl', $args->member_srl); |
@@ -2497,8 +2765,7 @@ discard block |
||
| 2497 | 2765 | } |
| 2498 | 2766 | |
| 2499 | 2767 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2500 | - } |
|
| 2501 | - else if($args->hashed_password) |
|
| 2768 | + } else if($args->hashed_password) |
|
| 2502 | 2769 | { |
| 2503 | 2770 | $args->password = $args->hashed_password; |
| 2504 | 2771 | } |
@@ -2533,7 +2800,9 @@ discard block |
||
| 2533 | 2800 | $trigger_obj = new stdClass(); |
| 2534 | 2801 | $trigger_obj->member_srl = $member_srl; |
| 2535 | 2802 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2536 | - if(!$output->toBool()) return $output; |
|
| 2803 | + if(!$output->toBool()) { |
|
| 2804 | + return $output; |
|
| 2805 | + } |
|
| 2537 | 2806 | // Create a model object |
| 2538 | 2807 | $oMemberModel = getModel('member'); |
| 2539 | 2808 | // Bringing the user's information |
@@ -2542,9 +2811,13 @@ discard block |
||
| 2542 | 2811 | $columnList = array('member_srl', 'is_admin'); |
| 2543 | 2812 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2544 | 2813 | } |
| 2545 | - if(!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2814 | + if(!$this->memberInfo) { |
|
| 2815 | + return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2816 | + } |
|
| 2546 | 2817 | // If managers can not be deleted |
| 2547 | - if($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2818 | + if($this->memberInfo->is_admin == 'Y') { |
|
| 2819 | + return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2820 | + } |
|
| 2548 | 2821 | |
| 2549 | 2822 | $oDB = &DB::getInstance(); |
| 2550 | 2823 | $oDB->begin(); |
@@ -2608,7 +2881,9 @@ discard block |
||
| 2608 | 2881 | */ |
| 2609 | 2882 | function destroySessionInfo() |
| 2610 | 2883 | { |
| 2611 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2884 | + if(!$_SESSION || !is_array($_SESSION)) { |
|
| 2885 | + return; |
|
| 2886 | + } |
|
| 2612 | 2887 | |
| 2613 | 2888 | $memberInfo = Context::get('logged_info'); |
| 2614 | 2889 | $memberSrl = $memberInfo->member_srl; |
@@ -2647,8 +2922,9 @@ discard block |
||
| 2647 | 2922 | } |
| 2648 | 2923 | $maxLevel = 0; |
| 2649 | 2924 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2650 | - if(count($resultGroup) > 0) |
|
| 2651 | - $maxLevel = max(array_flip($resultGroup)); |
|
| 2925 | + if(count($resultGroup) > 0) { |
|
| 2926 | + $maxLevel = max(array_flip($resultGroup)); |
|
| 2927 | + } |
|
| 2652 | 2928 | |
| 2653 | 2929 | if($maxLevel > 0) |
| 2654 | 2930 | { |
@@ -2665,16 +2941,22 @@ discard block |
||
| 2665 | 2941 | |
| 2666 | 2942 | function procMemberModifyEmailAddress() |
| 2667 | 2943 | { |
| 2668 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2944 | + if(!Context::get('is_logged')) { |
|
| 2945 | + return $this->stop('msg_not_logged'); |
|
| 2946 | + } |
|
| 2669 | 2947 | |
| 2670 | 2948 | $member_info = Context::get('logged_info'); |
| 2671 | 2949 | $newEmail = Context::get('email_address'); |
| 2672 | 2950 | |
| 2673 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2951 | + if(!$newEmail) { |
|
| 2952 | + return $this->stop('msg_invalid_request'); |
|
| 2953 | + } |
|
| 2674 | 2954 | |
| 2675 | 2955 | $oMemberModel = getModel('member'); |
| 2676 | 2956 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2677 | - if($member_srl) return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2957 | + if($member_srl) { |
|
| 2958 | + return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2959 | + } |
|
| 2678 | 2960 | |
| 2679 | 2961 | if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
| 2680 | 2962 | { |
@@ -2702,7 +2984,9 @@ discard block |
||
| 2702 | 2984 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2703 | 2985 | |
| 2704 | 2986 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2705 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2987 | + if(!is_dir($tpl_path)) { |
|
| 2988 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2989 | + } |
|
| 2706 | 2990 | |
| 2707 | 2991 | global $lang; |
| 2708 | 2992 | |
@@ -2738,7 +3022,9 @@ discard block |
||
| 2738 | 3022 | { |
| 2739 | 3023 | $member_srl = Context::get('member_srl'); |
| 2740 | 3024 | $auth_key = Context::get('auth_key'); |
| 2741 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 3025 | + if(!$member_srl || !$auth_key) { |
|
| 3026 | + return $this->stop('msg_invalid_request'); |
|
| 3027 | + } |
|
| 2742 | 3028 | |
| 2743 | 3029 | // Test logs for finding password by user_id and authkey |
| 2744 | 3030 | $args = new stdClass; |
@@ -2747,7 +3033,9 @@ discard block |
||
| 2747 | 3033 | $output = executeQuery('member.getAuthMail', $args); |
| 2748 | 3034 | if(!$output->toBool() || $output->data->auth_key != $auth_key) |
| 2749 | 3035 | { |
| 2750 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 3036 | + if(strlen($output->data->auth_key) !== strlen($auth_key)) { |
|
| 3037 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 3038 | + } |
|
| 2751 | 3039 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2752 | 3040 | } |
| 2753 | 3041 | |
@@ -2756,7 +3044,9 @@ discard block |
||
| 2756 | 3044 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2757 | 3045 | |
| 2758 | 3046 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2759 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 3047 | + if(!$output->toBool()) { |
|
| 3048 | + return $this->stop($output->getMessage()); |
|
| 3049 | + } |
|
| 2760 | 3050 | |
| 2761 | 3051 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2762 | 3052 | executeQuery('member.deleteAuthChangeEmailAddress',$args); |
@@ -2777,7 +3067,9 @@ discard block |
||
| 2777 | 3067 | **/ |
| 2778 | 3068 | function triggerGetDocumentMenu(&$menu_list) |
| 2779 | 3069 | { |
| 2780 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 3070 | + if(!Context::get('is_logged')) { |
|
| 3071 | + return new BaseObject(); |
|
| 3072 | + } |
|
| 2781 | 3073 | |
| 2782 | 3074 | $logged_info = Context::get('logged_info'); |
| 2783 | 3075 | $document_srl = Context::get('target_srl'); |
@@ -2788,8 +3080,12 @@ discard block |
||
| 2788 | 3080 | $member_srl = $oDocument->get('member_srl'); |
| 2789 | 3081 | $module_srl = $oDocument->get('module_srl'); |
| 2790 | 3082 | |
| 2791 | - if(!$member_srl) return new BaseObject(); |
|
| 2792 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 3083 | + if(!$member_srl) { |
|
| 3084 | + return new BaseObject(); |
|
| 3085 | + } |
|
| 3086 | + if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 3087 | + return new BaseObject(); |
|
| 3088 | + } |
|
| 2793 | 3089 | |
| 2794 | 3090 | $oDocumentController = getController('document'); |
| 2795 | 3091 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2807,7 +3103,9 @@ discard block |
||
| 2807 | 3103 | **/ |
| 2808 | 3104 | function triggerGetCommentMenu(&$menu_list) |
| 2809 | 3105 | { |
| 2810 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 3106 | + if(!Context::get('is_logged')) { |
|
| 3107 | + return new BaseObject(); |
|
| 3108 | + } |
|
| 2811 | 3109 | |
| 2812 | 3110 | $logged_info = Context::get('logged_info'); |
| 2813 | 3111 | $comment_srl = Context::get('target_srl'); |
@@ -2818,8 +3116,12 @@ discard block |
||
| 2818 | 3116 | $module_srl = $oComment->get('module_srl'); |
| 2819 | 3117 | $member_srl = $oComment->get('member_srl'); |
| 2820 | 3118 | |
| 2821 | - if(!$member_srl) return new BaseObject(); |
|
| 2822 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 3119 | + if(!$member_srl) { |
|
| 3120 | + return new BaseObject(); |
|
| 3121 | + } |
|
| 3122 | + if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 3123 | + return new BaseObject(); |
|
| 3124 | + } |
|
| 2823 | 3125 | |
| 2824 | 3126 | $oCommentController = getController('comment'); |
| 2825 | 3127 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2835,7 +3137,9 @@ discard block |
||
| 2835 | 3137 | **/ |
| 2836 | 3138 | function procMemberSpammerManage() |
| 2837 | 3139 | { |
| 2838 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 3140 | + if(!Context::get('is_logged')) { |
|
| 3141 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 3142 | + } |
|
| 2839 | 3143 | |
| 2840 | 3144 | $logged_info = Context::get('logged_info'); |
| 2841 | 3145 | $member_srl = Context::get('member_srl'); |
@@ -2843,8 +3147,9 @@ discard block |
||
| 2843 | 3147 | $cnt_loop = Context::get('cnt_loop'); |
| 2844 | 3148 | $proc_type = Context::get('proc_type'); |
| 2845 | 3149 | $isMoveToTrash = true; |
| 2846 | - if($proc_type == "delete") |
|
| 2847 | - $isMoveToTrash = false; |
|
| 3150 | + if($proc_type == "delete") { |
|
| 3151 | + $isMoveToTrash = false; |
|
| 3152 | + } |
|
| 2848 | 3153 | |
| 2849 | 3154 | // check grant |
| 2850 | 3155 | $oModuleModel = getModel('module'); |
@@ -2852,7 +3157,9 @@ discard block |
||
| 2852 | 3157 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2853 | 3158 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2854 | 3159 | |
| 2855 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 3160 | + if(!$grant->manager) { |
|
| 3161 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 3162 | + } |
|
| 2856 | 3163 | |
| 2857 | 3164 | $proc_msg = ""; |
| 2858 | 3165 | |
@@ -2861,11 +3168,13 @@ discard block |
||
| 2861 | 3168 | |
| 2862 | 3169 | // delete or trash destination |
| 2863 | 3170 | // proc member |
| 2864 | - if($cnt_loop == 1) |
|
| 2865 | - $this->_spammerMember($member_srl); |
|
| 3171 | + if($cnt_loop == 1) { |
|
| 3172 | + $this->_spammerMember($member_srl); |
|
| 3173 | + } |
|
| 2866 | 3174 | // proc document and comment |
| 2867 | - elseif($cnt_loop>1) |
|
| 2868 | - $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3175 | + elseif($cnt_loop>1) { |
|
| 3176 | + $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3177 | + } |
|
| 2869 | 3178 | |
| 2870 | 3179 | // get destination count |
| 2871 | 3180 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
@@ -2873,13 +3182,16 @@ discard block |
||
| 2873 | 3182 | |
| 2874 | 3183 | $total_count = Context::get('total_count'); |
| 2875 | 3184 | $remain_count = $cnt_document + $cnt_comment; |
| 2876 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 3185 | + if($cnt_loop == 1) { |
|
| 3186 | + $total_count = $remain_count; |
|
| 3187 | + } |
|
| 2877 | 3188 | |
| 2878 | 3189 | // get progress percent |
| 2879 | - if($total_count > 0) |
|
| 2880 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2881 | - else |
|
| 2882 | - $progress = 100; |
|
| 3190 | + if($total_count > 0) { |
|
| 3191 | + $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 3192 | + } else { |
|
| 3193 | + $progress = 100; |
|
| 3194 | + } |
|
| 2883 | 3195 | |
| 2884 | 3196 | $this->add('total_count', $total_count); |
| 2885 | 3197 | $this->add('remain_count', $remain_count); |
@@ -2921,7 +3233,10 @@ discard block |
||
| 2921 | 3233 | $args->nick_name = $member_info->nick_name; |
| 2922 | 3234 | $args->denied = "Y"; |
| 2923 | 3235 | $args->description = trim( $member_info->description ); |
| 2924 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 3236 | + if( $args->description != "" ) { |
|
| 3237 | + $args->description .= "\n"; |
|
| 3238 | + } |
|
| 3239 | + // add new line |
|
| 2925 | 3240 | |
| 2926 | 3241 | $args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]"; |
| 2927 | 3242 | |
@@ -2966,8 +3281,11 @@ discard block |
||
| 2966 | 3281 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2967 | 3282 | if($documentList) { |
| 2968 | 3283 | foreach($documentList as $v) { |
| 2969 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2970 | - else $oDocumentController->deleteDocument($v->document_srl); |
|
| 3284 | + if($isMoveToTrash) { |
|
| 3285 | + $oDocumentController->moveDocumentToTrash($v); |
|
| 3286 | + } else { |
|
| 3287 | + $oDocumentController->deleteDocument($v->document_srl); |
|
| 3288 | + } |
|
| 2971 | 3289 | } |
| 2972 | 3290 | } |
| 2973 | 3291 | } |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $oModuleController = getController('module'); |
| 17 | 17 | |
| 18 | 18 | $oDB = &DB::getInstance(); |
| 19 | - $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true); |
|
| 20 | - $oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
| 19 | + $oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true); |
|
| 20 | + $oDB->addIndex('sites', 'unique_domain', array('domain'), true); |
|
| 21 | 21 | // Create a directory to use in the module module |
| 22 | 22 | FileHandler::makeDir('./files/cache/module_info'); |
| 23 | 23 | FileHandler::makeDir('./files/cache/triggers'); |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | $args = new stdClass; |
| 28 | 28 | $args->site_srl = 0; |
| 29 | 29 | $output = $oDB->executeQuery('module.getSite', $args); |
| 30 | - if(!$output->data || !$output->data->index_module_srl) |
|
| 30 | + if (!$output->data || !$output->data->index_module_srl) |
|
| 31 | 31 | { |
| 32 | 32 | $db_info = Context::getDBInfo(); |
| 33 | 33 | $domain = Context::getDefaultUrl(); |
| 34 | 34 | $url_info = parse_url($domain); |
| 35 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
| 35 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
| 36 | 36 | |
| 37 | 37 | $site_args = new stdClass; |
| 38 | 38 | $site_args->site_srl = 0; |
| 39 | - $site_args->index_module_srl = 0; |
|
| 39 | + $site_args->index_module_srl = 0; |
|
| 40 | 40 | $site_args->domain = $domain; |
| 41 | 41 | $site_args->default_language = $db_info->lang_type; |
| 42 | 42 | |
| 43 | 43 | $output = executeQuery('module.insertSite', $site_args); |
| 44 | - if(!$output->toBool()) return $output; |
|
| 44 | + if (!$output->toBool()) return $output; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return new BaseObject(); |
@@ -56,68 +56,68 @@ discard block |
||
| 56 | 56 | $oModuleModel = getModel('module'); |
| 57 | 57 | $oModuleController = getController('module'); |
| 58 | 58 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 59 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 59 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 60 | 60 | { |
| 61 | 61 | // 2008. 10. 27 Add multi-index in the table, the module_part_config |
| 62 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; |
|
| 62 | + if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) return true; |
|
| 63 | 63 | // 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid |
| 64 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; |
|
| 64 | + if (!$oDB->isIndexExists('modules', "idx_site_mid")) return true; |
|
| 65 | 65 | // Move permissions/skin information of all modules to the table, grants. |
| 66 | - if($oDB->isColumnExists('modules', 'grants')) return true; |
|
| 66 | + if ($oDB->isColumnExists('modules', 'grants')) return true; |
|
| 67 | 67 | // Move permissions/skin information of all modules to the table, grants. |
| 68 | - if(!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
| 68 | + if (!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
| 69 | 69 | // Delete extra_vars* column |
| 70 | - for($i=1;$i<=20;$i++) |
|
| 70 | + for ($i = 1; $i <= 20; $i++) |
|
| 71 | 71 | { |
| 72 | - if($oDB->isColumnExists("documents","extra_vars".$i)) return true; |
|
| 72 | + if ($oDB->isColumnExists("documents", "extra_vars".$i)) return true; |
|
| 73 | 73 | } |
| 74 | 74 | // Insert site information to the table, sites |
| 75 | 75 | $args = new stdClass(); |
| 76 | 76 | $args->site_srl = 0; |
| 77 | 77 | $output = $oDB->executeQuery('module.getSite', $args); |
| 78 | - if(!$output->data) return true; |
|
| 78 | + if (!$output->data) return true; |
|
| 79 | 79 | |
| 80 | 80 | // If domain index is defined on the table, sites |
| 81 | - if($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
| 82 | - if(!$oDB->isIndexExists('sites','unique_domain')) return true; |
|
| 81 | + if ($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
| 82 | + if (!$oDB->isIndexExists('sites', 'unique_domain')) return true; |
|
| 83 | 83 | |
| 84 | - if(!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
| 86 | - if(!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
| 87 | - if(!$oDB->isColumnExists("modules", "mskin")) return true; |
|
| 84 | + if (!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
| 85 | + if (!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
| 86 | + if (!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
| 87 | + if (!$oDB->isColumnExists("modules", "mskin")) return true; |
|
| 88 | 88 | |
| 89 | 89 | // check fix skin |
| 90 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
| 90 | + if (!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
| 91 | 91 | |
| 92 | - if(!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
| 92 | + if (!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
| 93 | 93 | |
| 94 | 94 | $args->skin = '.'; |
| 95 | 95 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
| 96 | - if($output->data && count($output->data) > 0) |
|
| 96 | + if ($output->data && count($output->data) > 0) |
|
| 97 | 97 | { |
| 98 | - foreach($output->data as $item) |
|
| 98 | + foreach ($output->data as $item) |
|
| 99 | 99 | { |
| 100 | 100 | $skin_path = explode('.', $item->skin); |
| 101 | - if(count($skin_path) != 2) continue; |
|
| 102 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
| 101 | + if (count($skin_path) != 2) continue; |
|
| 102 | + if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // XE 1.7 |
| 107 | 107 | |
| 108 | 108 | // check fix mskin |
| 109 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
| 109 | + if (!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
| 110 | 110 | |
| 111 | - if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) return true; |
|
| 111 | + if (!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) return true; |
|
| 112 | 112 | |
| 113 | 113 | $oModuleModel = getModel('module'); |
| 114 | 114 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 115 | - if(!$moduleConfig->isUpdateFixedValue) return true; |
|
| 115 | + if (!$moduleConfig->isUpdateFixedValue) return true; |
|
| 116 | 116 | |
| 117 | 117 | $oModuleController->insertUpdatedLog($version_update_id); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if(!is_dir('./files/ruleset')) return true; |
|
| 120 | + if (!is_dir('./files/ruleset')) return true; |
|
| 121 | 121 | |
| 122 | 122 | return false; |
| 123 | 123 | } |
@@ -131,22 +131,22 @@ discard block |
||
| 131 | 131 | $oModuleModel = getModel('module'); |
| 132 | 132 | $oModuleController = getController('module'); |
| 133 | 133 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 134 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 134 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 135 | 135 | { |
| 136 | 136 | // 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg |
| 137 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) |
|
| 137 | + if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) |
|
| 138 | 138 | { |
| 139 | 139 | $oModuleModel = getModel('module'); |
| 140 | 140 | $oModuleController = getController('module'); |
| 141 | 141 | $modules = $oModuleModel->getModuleList(); |
| 142 | - foreach($modules as $key => $module_info) |
|
| 142 | + foreach ($modules as $key => $module_info) |
|
| 143 | 143 | { |
| 144 | 144 | $module = $module_info->module; |
| 145 | - if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue; |
|
| 145 | + if (!in_array($module, array('point', 'trackback', 'layout', 'rss', 'file', 'comment', 'editor'))) continue; |
|
| 146 | 146 | $config = $oModuleModel->getModuleConfig($module); |
| 147 | 147 | |
| 148 | 148 | $module_config = null; |
| 149 | - switch($module) |
|
| 149 | + switch ($module) |
|
| 150 | 150 | { |
| 151 | 151 | case 'point' : |
| 152 | 152 | $module_config = $config->module_point; |
@@ -159,21 +159,21 @@ discard block |
||
| 159 | 159 | case 'editor' : |
| 160 | 160 | $module_config = $config->module_config; |
| 161 | 161 | unset($config->module_config); |
| 162 | - if(is_array($module_config) && count($module_config)) |
|
| 162 | + if (is_array($module_config) && count($module_config)) |
|
| 163 | 163 | { |
| 164 | - foreach($module_config as $key => $val) |
|
| 164 | + foreach ($module_config as $key => $val) |
|
| 165 | 165 | { |
| 166 | - if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
| 166 | + if (isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | 170 | case 'layout' : |
| 171 | 171 | $tmp = $config->header_script; |
| 172 | - if(is_array($tmp) && count($tmp)) |
|
| 172 | + if (is_array($tmp) && count($tmp)) |
|
| 173 | 173 | { |
| 174 | - foreach($tmp as $k => $v) |
|
| 174 | + foreach ($tmp as $k => $v) |
|
| 175 | 175 | { |
| 176 | - if(!$v && !trim($v)) continue; |
|
| 176 | + if (!$v && !trim($v)) continue; |
|
| 177 | 177 | $module_config[$k]->header_script = $v; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -183,29 +183,29 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $oModuleController->insertModuleConfig($module, $config); |
| 185 | 185 | |
| 186 | - if(is_array($module_config) && count($module_config)) |
|
| 186 | + if (is_array($module_config) && count($module_config)) |
|
| 187 | 187 | { |
| 188 | - foreach($module_config as $module_srl => $module_part_config) |
|
| 188 | + foreach ($module_config as $module_srl => $module_part_config) |
|
| 189 | 189 | { |
| 190 | - $oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config); |
|
| 190 | + $oModuleController->insertModulePartConfig($module, $module_srl, $module_part_config); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | - $oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl")); |
|
| 194 | + $oDB->addIndex("module_part_config", "idx_module_part_config", array("module", "module_srl")); |
|
| 195 | 195 | } |
| 196 | 196 | // 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns |
| 197 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) |
|
| 197 | + if (!$oDB->isIndexExists('modules', "idx_site_mid")) |
|
| 198 | 198 | { |
| 199 | - $oDB->dropIndex("modules","unique_mid",true); |
|
| 200 | - $oDB->addColumn('modules','site_srl','number',11,0,true); |
|
| 201 | - $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); |
|
| 199 | + $oDB->dropIndex("modules", "unique_mid", true); |
|
| 200 | + $oDB->addColumn('modules', 'site_srl', 'number', 11, 0, true); |
|
| 201 | + $oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true); |
|
| 202 | 202 | } |
| 203 | 203 | // document extra vars |
| 204 | - if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 204 | + if (!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 205 | 205 | |
| 206 | - if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 206 | + if (!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 207 | 207 | // Move permission, skin info, extection info, admin ID of all modules to the table, grants |
| 208 | - if($oDB->isColumnExists('modules', 'grants')) |
|
| 208 | + if ($oDB->isColumnExists('modules', 'grants')) |
|
| 209 | 209 | { |
| 210 | 210 | $oModuleController = getController('module'); |
| 211 | 211 | $oDocumentController = getController('document'); |
@@ -213,26 +213,26 @@ discard block |
||
| 213 | 213 | $lang_code = Context::getLangType(); |
| 214 | 214 | // Get module_info of all modules |
| 215 | 215 | $output = executeQueryArray('module.getModuleInfos'); |
| 216 | - if(count($output->data)) |
|
| 216 | + if (count($output->data)) |
|
| 217 | 217 | { |
| 218 | - foreach($output->data as $module_info) |
|
| 218 | + foreach ($output->data as $module_info) |
|
| 219 | 219 | { |
| 220 | 220 | // Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority |
| 221 | 221 | $module_srl = trim($module_info->module_srl); |
| 222 | 222 | // grant an authority |
| 223 | 223 | $grants = unserialize($module_info->grants); |
| 224 | - if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 224 | + if ($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 225 | 225 | // Insert skin vars |
| 226 | 226 | $skin_vars = unserialize($module_info->skin_vars); |
| 227 | - if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 227 | + if ($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 228 | 228 | // Insert super admin's ID |
| 229 | 229 | $admin_id = trim($module_info->admin_id); |
| 230 | - if($admin_id && $admin_id != 'Array') |
|
| 230 | + if ($admin_id && $admin_id != 'Array') |
|
| 231 | 231 | { |
| 232 | - $admin_ids = explode(',',$admin_id); |
|
| 233 | - if(count($admin_id)) |
|
| 232 | + $admin_ids = explode(',', $admin_id); |
|
| 233 | + if (count($admin_id)) |
|
| 234 | 234 | { |
| 235 | - foreach($admin_ids as $admin_id) |
|
| 235 | + foreach ($admin_ids as $admin_id) |
|
| 236 | 236 | { |
| 237 | 237 | $oModuleController->insertAdminId($module_srl, $admin_id); |
| 238 | 238 | } |
@@ -241,20 +241,20 @@ discard block |
||
| 241 | 241 | // Save extra configurations for each module(column data which doesn't exist in the defaut modules) |
| 242 | 242 | $extra_vars = unserialize($module_info->extra_vars); |
| 243 | 243 | $document_extra_keys = null; |
| 244 | - if($extra_vars->extra_vars && count($extra_vars->extra_vars)) |
|
| 244 | + if ($extra_vars->extra_vars && count($extra_vars->extra_vars)) |
|
| 245 | 245 | { |
| 246 | 246 | $document_extra_keys = $extra_vars->extra_vars; |
| 247 | 247 | unset($extra_vars->extra_vars); |
| 248 | 248 | } |
| 249 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 249 | + if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) |
| 253 | 253 | */ |
| 254 | 254 | // Insert extra vars if planet module is |
| 255 | - if($module_info->module == 'planet') |
|
| 255 | + if ($module_info->module == 'planet') |
|
| 256 | 256 | { |
| 257 | - if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
| 257 | + if (!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
| 258 | 258 | $planet_extra_keys->name = 'postscript'; |
| 259 | 259 | $planet_extra_keys->type = 'text'; |
| 260 | 260 | $planet_extra_keys->is_required = 'N'; |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | $document_extra_keys[20] = $planet_extra_keys; |
| 265 | 265 | } |
| 266 | 266 | // Register keys for document extra vars |
| 267 | - if(count($document_extra_keys)) |
|
| 267 | + if (count($document_extra_keys)) |
|
| 268 | 268 | { |
| 269 | - foreach($document_extra_keys as $var_idx => $val) |
|
| 269 | + foreach ($document_extra_keys as $var_idx => $val) |
|
| 270 | 270 | { |
| 271 | 271 | $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx); |
| 272 | 272 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $oDocumentModel = getModel('document'); |
| 275 | 275 | $total_count = $oDocumentModel->getDocumentCount($module_srl); |
| 276 | 276 | |
| 277 | - if($total_count > 0) |
|
| 277 | + if ($total_count > 0) |
|
| 278 | 278 | { |
| 279 | 279 | $per_page = 100; |
| 280 | 280 | $total_pages = (int) (($total_count - 1) / $per_page) + 1; |
@@ -285,19 +285,19 @@ discard block |
||
| 285 | 285 | $doc_args->sort_index = 'list_order'; |
| 286 | 286 | $doc_args->order_type = 'asc'; |
| 287 | 287 | |
| 288 | - for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) |
|
| 288 | + for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) |
|
| 289 | 289 | { |
| 290 | 290 | $output = executeQueryArray('document.getDocumentList', $doc_args); |
| 291 | 291 | |
| 292 | - if($output->toBool() && $output->data && count($output->data)) |
|
| 292 | + if ($output->toBool() && $output->data && count($output->data)) |
|
| 293 | 293 | { |
| 294 | 294 | foreach ($output->data as $document) |
| 295 | 295 | { |
| 296 | - if(!$document) continue; |
|
| 296 | + if (!$document) continue; |
|
| 297 | 297 | foreach ($document as $key => $var) |
| 298 | 298 | { |
| 299 | 299 | if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue; |
| 300 | - $var_idx = str_replace('extra_vars','',$key); |
|
| 300 | + $var_idx = str_replace('extra_vars', '', $key); |
|
| 301 | 301 | $oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code); |
| 302 | 302 | } |
| 303 | 303 | } |
@@ -313,96 +313,96 @@ discard block |
||
| 313 | 313 | executeQuery('module.updateModule', $module_info); |
| 314 | 314 | |
| 315 | 315 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 316 | - if($oCacheHandler->isSupport()) |
|
| 316 | + if ($oCacheHandler->isSupport()) |
|
| 317 | 317 | { |
| 318 | 318 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | // Various column drop |
| 323 | - $oDB->dropColumn('modules','grants'); |
|
| 324 | - $oDB->dropColumn('modules','admin_id'); |
|
| 325 | - $oDB->dropColumn('modules','skin_vars'); |
|
| 326 | - $oDB->dropColumn('modules','extra_vars'); |
|
| 323 | + $oDB->dropColumn('modules', 'grants'); |
|
| 324 | + $oDB->dropColumn('modules', 'admin_id'); |
|
| 325 | + $oDB->dropColumn('modules', 'skin_vars'); |
|
| 326 | + $oDB->dropColumn('modules', 'extra_vars'); |
|
| 327 | 327 | } |
| 328 | 328 | // Rights of all modules/skins transferring the information into a table Update grants |
| 329 | - if(!$oDB->isColumnExists('sites', 'default_language')) |
|
| 329 | + if (!$oDB->isColumnExists('sites', 'default_language')) |
|
| 330 | 330 | { |
| 331 | - $oDB->addColumn('sites','default_language','varchar',255,0,false); |
|
| 331 | + $oDB->addColumn('sites', 'default_language', 'varchar', 255, 0, false); |
|
| 332 | 332 | } |
| 333 | 333 | // extra_vars * Remove Column |
| 334 | - for($i=1;$i<=20;$i++) |
|
| 334 | + for ($i = 1; $i <= 20; $i++) |
|
| 335 | 335 | { |
| 336 | - if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; |
|
| 337 | - $oDB->dropColumn('documents','extra_vars'.$i); |
|
| 336 | + if (!$oDB->isColumnExists("documents", "extra_vars".$i)) continue; |
|
| 337 | + $oDB->dropColumn('documents', 'extra_vars'.$i); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | // Enter the main site information sites on the table |
| 341 | 341 | $args = new stdClass; |
| 342 | 342 | $args->site_srl = 0; |
| 343 | 343 | $output = $oDB->executeQuery('module.getSite', $args); |
| 344 | - if(!$output->data) |
|
| 344 | + if (!$output->data) |
|
| 345 | 345 | { |
| 346 | 346 | // Basic mid, language Wanted |
| 347 | 347 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
| 348 | 348 | $db_info = Context::getDBInfo(); |
| 349 | 349 | $domain = Context::getDefaultUrl(); |
| 350 | 350 | $url_info = parse_url($domain); |
| 351 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
| 351 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
| 352 | 352 | $site_args->site_srl = 0; |
| 353 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 353 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 354 | 354 | $site_args->domain = $domain; |
| 355 | 355 | $site_args->default_language = $db_info->lang_type; |
| 356 | 356 | |
| 357 | 357 | $output = executeQuery('module.insertSite', $site_args); |
| 358 | - if(!$output->toBool()) return $output; |
|
| 358 | + if (!$output->toBool()) return $output; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if($oDB->isIndexExists('sites','idx_domain')) |
|
| 361 | + if ($oDB->isIndexExists('sites', 'idx_domain')) |
|
| 362 | 362 | { |
| 363 | - $oDB->dropIndex('sites','idx_domain'); |
|
| 363 | + $oDB->dropIndex('sites', 'idx_domain'); |
|
| 364 | 364 | } |
| 365 | - if(!$oDB->isIndexExists('sites','unique_domain')) |
|
| 365 | + if (!$oDB->isIndexExists('sites', 'unique_domain')) |
|
| 366 | 366 | { |
| 367 | 367 | $this->updateForUniqueSiteDomain(); |
| 368 | - $oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
| 368 | + $oDB->addIndex('sites', 'unique_domain', array('domain'), true); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - if(!$oDB->isColumnExists("modules", "use_mobile")) |
|
| 371 | + if (!$oDB->isColumnExists("modules", "use_mobile")) |
|
| 372 | 372 | { |
| 373 | - $oDB->addColumn('modules','use_mobile','char',1,'N'); |
|
| 373 | + $oDB->addColumn('modules', 'use_mobile', 'char', 1, 'N'); |
|
| 374 | 374 | } |
| 375 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) |
|
| 375 | + if (!$oDB->isColumnExists("modules", "mlayout_srl")) |
|
| 376 | 376 | { |
| 377 | - $oDB->addColumn('modules','mlayout_srl','number',11, 0); |
|
| 377 | + $oDB->addColumn('modules', 'mlayout_srl', 'number', 11, 0); |
|
| 378 | 378 | } |
| 379 | - if(!$oDB->isColumnExists("modules", "mcontent")) |
|
| 379 | + if (!$oDB->isColumnExists("modules", "mcontent")) |
|
| 380 | 380 | { |
| 381 | - $oDB->addColumn('modules','mcontent','bigtext'); |
|
| 381 | + $oDB->addColumn('modules', 'mcontent', 'bigtext'); |
|
| 382 | 382 | } |
| 383 | - if(!$oDB->isColumnExists("modules", "mskin")) |
|
| 383 | + if (!$oDB->isColumnExists("modules", "mskin")) |
|
| 384 | 384 | { |
| 385 | - $oDB->addColumn('modules','mskin','varchar',250); |
|
| 385 | + $oDB->addColumn('modules', 'mskin', 'varchar', 250); |
|
| 386 | 386 | } |
| 387 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) |
|
| 387 | + if (!$oDB->isColumnExists("modules", "is_skin_fix")) |
|
| 388 | 388 | { |
| 389 | 389 | $oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N'); |
| 390 | 390 | $output = executeQuery('module.updateSkinFixModules'); |
| 391 | 391 | } |
| 392 | - if(!$oDB->isColumnExists("module_config", "site_srl")) |
|
| 392 | + if (!$oDB->isColumnExists("module_config", "site_srl")) |
|
| 393 | 393 | { |
| 394 | 394 | $oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | $args->skin = '.'; |
| 398 | 398 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
| 399 | - if($output->data && count($output->data) > 0) |
|
| 399 | + if ($output->data && count($output->data) > 0) |
|
| 400 | 400 | { |
| 401 | - foreach($output->data as $item) |
|
| 401 | + foreach ($output->data as $item) |
|
| 402 | 402 | { |
| 403 | 403 | $skin_path = explode('.', $item->skin); |
| 404 | - if(count($skin_path) != 2) continue; |
|
| 405 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
|
| 404 | + if (count($skin_path) != 2) continue; |
|
| 405 | + if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
|
| 406 | 406 | { |
| 407 | 407 | unset($args); |
| 408 | 408 | $args->skin = $item->skin; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | // XE 1.7 |
| 416 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) |
|
| 416 | + if (!$oDB->isColumnExists("modules", "is_mskin_fix")) |
|
| 417 | 417 | { |
| 418 | 418 | $oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N'); |
| 419 | 419 | $output = executeQuery('module.updateMobileSkinFixModules'); |
@@ -421,18 +421,18 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | $oModuleModel = getModel('module'); |
| 423 | 423 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 424 | - if(!$moduleConfig->isUpdateFixedValue) |
|
| 424 | + if (!$moduleConfig->isUpdateFixedValue) |
|
| 425 | 425 | { |
| 426 | 426 | $output = executeQuery('module.updateSkinFixModules'); |
| 427 | 427 | $output = executeQuery('module.updateMobileSkinFixModules'); |
| 428 | 428 | |
| 429 | 429 | $oModuleController = getController('module'); |
| 430 | - if(!$moduleConfig) $moduleConfig = new stdClass; |
|
| 430 | + if (!$moduleConfig) $moduleConfig = new stdClass; |
|
| 431 | 431 | $moduleConfig->isUpdateFixedValue = TRUE; |
| 432 | 432 | $output = $oModuleController->updateModuleConfig('module', $moduleConfig); |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) |
|
| 435 | + if (!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) |
|
| 436 | 436 | { |
| 437 | 437 | $oDB->addIndex("module_part_config", "unique_module_part_config", array("module", "module_srl"), TRUE); |
| 438 | 438 | } |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | $oModuleController->insertUpdatedLog($version_update_id); |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset'); |
|
| 443 | + if (!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset'); |
|
| 444 | 444 | |
| 445 | 445 | return new BaseObject(0, 'success_updated'); |
| 446 | 446 | } |
@@ -448,18 +448,18 @@ discard block |
||
| 448 | 448 | function updateForUniqueSiteDomain() |
| 449 | 449 | { |
| 450 | 450 | $output = executeQueryArray("module.getNonuniqueDomains"); |
| 451 | - if(!$output->data) return; |
|
| 452 | - foreach($output->data as $data) |
|
| 451 | + if (!$output->data) return; |
|
| 452 | + foreach ($output->data as $data) |
|
| 453 | 453 | { |
| 454 | - if($data->count == 1) continue; |
|
| 454 | + if ($data->count == 1) continue; |
|
| 455 | 455 | $domain = $data->domain; |
| 456 | 456 | $args = new stdClass; |
| 457 | 457 | $args->domain = $domain; |
| 458 | 458 | $output2 = executeQueryArray("module.getSiteByDomain", $args); |
| 459 | 459 | $bFirst = true; |
| 460 | - foreach($output2->data as $site) |
|
| 460 | + foreach ($output2->data as $site) |
|
| 461 | 461 | { |
| 462 | - if($bFirst) |
|
| 462 | + if ($bFirst) |
|
| 463 | 463 | { |
| 464 | 464 | $bFirst = false; |
| 465 | 465 | continue; |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | $site_args->default_language = $db_info->lang_type; |
| 42 | 42 | |
| 43 | 43 | $output = executeQuery('module.insertSite', $site_args); |
| 44 | - if(!$output->toBool()) return $output; |
|
| 44 | + if(!$output->toBool()) { |
|
| 45 | + return $output; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | return new BaseObject(); |
@@ -59,37 +61,65 @@ discard block |
||
| 59 | 61 | if($oModuleModel->needUpdate($version_update_id)) |
| 60 | 62 | { |
| 61 | 63 | // 2008. 10. 27 Add multi-index in the table, the module_part_config |
| 62 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; |
|
| 64 | + if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) { |
|
| 65 | + return true; |
|
| 66 | + } |
|
| 63 | 67 | // 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid |
| 64 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; |
|
| 68 | + if(!$oDB->isIndexExists('modules',"idx_site_mid")) { |
|
| 69 | + return true; |
|
| 70 | + } |
|
| 65 | 71 | // Move permissions/skin information of all modules to the table, grants. |
| 66 | - if($oDB->isColumnExists('modules', 'grants')) return true; |
|
| 72 | + if($oDB->isColumnExists('modules', 'grants')) { |
|
| 73 | + return true; |
|
| 74 | + } |
|
| 67 | 75 | // Move permissions/skin information of all modules to the table, grants. |
| 68 | - if(!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
| 76 | + if(!$oDB->isColumnExists('sites', 'default_language')) { |
|
| 77 | + return true; |
|
| 78 | + } |
|
| 69 | 79 | // Delete extra_vars* column |
| 70 | 80 | for($i=1;$i<=20;$i++) |
| 71 | 81 | { |
| 72 | - if($oDB->isColumnExists("documents","extra_vars".$i)) return true; |
|
| 82 | + if($oDB->isColumnExists("documents","extra_vars".$i)) { |
|
| 83 | + return true; |
|
| 84 | + } |
|
| 73 | 85 | } |
| 74 | 86 | // Insert site information to the table, sites |
| 75 | 87 | $args = new stdClass(); |
| 76 | 88 | $args->site_srl = 0; |
| 77 | 89 | $output = $oDB->executeQuery('module.getSite', $args); |
| 78 | - if(!$output->data) return true; |
|
| 90 | + if(!$output->data) { |
|
| 91 | + return true; |
|
| 92 | + } |
|
| 79 | 93 | |
| 80 | 94 | // If domain index is defined on the table, sites |
| 81 | - if($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
| 82 | - if(!$oDB->isIndexExists('sites','unique_domain')) return true; |
|
| 95 | + if($oDB->isIndexExists('sites', 'idx_domain')) { |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 98 | + if(!$oDB->isIndexExists('sites','unique_domain')) { |
|
| 99 | + return true; |
|
| 100 | + } |
|
| 83 | 101 | |
| 84 | - if(!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
| 86 | - if(!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
| 87 | - if(!$oDB->isColumnExists("modules", "mskin")) return true; |
|
| 102 | + if(!$oDB->isColumnExists("modules", "use_mobile")) { |
|
| 103 | + return true; |
|
| 104 | + } |
|
| 105 | + if(!$oDB->isColumnExists("modules", "mlayout_srl")) { |
|
| 106 | + return true; |
|
| 107 | + } |
|
| 108 | + if(!$oDB->isColumnExists("modules", "mcontent")) { |
|
| 109 | + return true; |
|
| 110 | + } |
|
| 111 | + if(!$oDB->isColumnExists("modules", "mskin")) { |
|
| 112 | + return true; |
|
| 113 | + } |
|
| 88 | 114 | |
| 89 | 115 | // check fix skin |
| 90 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
| 116 | + if(!$oDB->isColumnExists("modules", "is_skin_fix")) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 91 | 119 | |
| 92 | - if(!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
| 120 | + if(!$oDB->isColumnExists("module_config", "site_srl")) { |
|
| 121 | + return true; |
|
| 122 | + } |
|
| 93 | 123 | |
| 94 | 124 | $args->skin = '.'; |
| 95 | 125 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
@@ -98,26 +128,38 @@ discard block |
||
| 98 | 128 | foreach($output->data as $item) |
| 99 | 129 | { |
| 100 | 130 | $skin_path = explode('.', $item->skin); |
| 101 | - if(count($skin_path) != 2) continue; |
|
| 102 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
| 131 | + if(count($skin_path) != 2) { |
|
| 132 | + continue; |
|
| 133 | + } |
|
| 134 | + if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) { |
|
| 135 | + return true; |
|
| 136 | + } |
|
| 103 | 137 | } |
| 104 | 138 | } |
| 105 | 139 | |
| 106 | 140 | // XE 1.7 |
| 107 | 141 | |
| 108 | 142 | // check fix mskin |
| 109 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
| 143 | + if(!$oDB->isColumnExists("modules", "is_mskin_fix")) { |
|
| 144 | + return true; |
|
| 145 | + } |
|
| 110 | 146 | |
| 111 | - if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) return true; |
|
| 147 | + if(!$oDB->isIndexExists("module_part_config", "unique_module_part_config")) { |
|
| 148 | + return true; |
|
| 149 | + } |
|
| 112 | 150 | |
| 113 | 151 | $oModuleModel = getModel('module'); |
| 114 | 152 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 115 | - if(!$moduleConfig->isUpdateFixedValue) return true; |
|
| 153 | + if(!$moduleConfig->isUpdateFixedValue) { |
|
| 154 | + return true; |
|
| 155 | + } |
|
| 116 | 156 | |
| 117 | 157 | $oModuleController->insertUpdatedLog($version_update_id); |
| 118 | 158 | } |
| 119 | 159 | |
| 120 | - if(!is_dir('./files/ruleset')) return true; |
|
| 160 | + if(!is_dir('./files/ruleset')) { |
|
| 161 | + return true; |
|
| 162 | + } |
|
| 121 | 163 | |
| 122 | 164 | return false; |
| 123 | 165 | } |
@@ -142,7 +184,9 @@ discard block |
||
| 142 | 184 | foreach($modules as $key => $module_info) |
| 143 | 185 | { |
| 144 | 186 | $module = $module_info->module; |
| 145 | - if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue; |
|
| 187 | + if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) { |
|
| 188 | + continue; |
|
| 189 | + } |
|
| 146 | 190 | $config = $oModuleModel->getModuleConfig($module); |
| 147 | 191 | |
| 148 | 192 | $module_config = null; |
@@ -163,7 +207,9 @@ discard block |
||
| 163 | 207 | { |
| 164 | 208 | foreach($module_config as $key => $val) |
| 165 | 209 | { |
| 166 | - if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
| 210 | + if(isset($module_config[$key]->module_srl)) { |
|
| 211 | + unset($module_config[$key]->module_srl); |
|
| 212 | + } |
|
| 167 | 213 | } |
| 168 | 214 | } |
| 169 | 215 | break; |
@@ -173,7 +219,9 @@ discard block |
||
| 173 | 219 | { |
| 174 | 220 | foreach($tmp as $k => $v) |
| 175 | 221 | { |
| 176 | - if(!$v && !trim($v)) continue; |
|
| 222 | + if(!$v && !trim($v)) { |
|
| 223 | + continue; |
|
| 224 | + } |
|
| 177 | 225 | $module_config[$k]->header_script = $v; |
| 178 | 226 | } |
| 179 | 227 | } |
@@ -201,9 +249,13 @@ discard block |
||
| 201 | 249 | $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); |
| 202 | 250 | } |
| 203 | 251 | // document extra vars |
| 204 | - if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 252 | + if(!$oDB->isTableExists('document_extra_vars')) { |
|
| 253 | + $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
| 254 | + } |
|
| 205 | 255 | |
| 206 | - if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 256 | + if(!$oDB->isTableExists('document_extra_keys')) { |
|
| 257 | + $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
| 258 | + } |
|
| 207 | 259 | // Move permission, skin info, extection info, admin ID of all modules to the table, grants |
| 208 | 260 | if($oDB->isColumnExists('modules', 'grants')) |
| 209 | 261 | { |
@@ -221,10 +273,14 @@ discard block |
||
| 221 | 273 | $module_srl = trim($module_info->module_srl); |
| 222 | 274 | // grant an authority |
| 223 | 275 | $grants = unserialize($module_info->grants); |
| 224 | - if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 276 | + if($grants) { |
|
| 277 | + $oModuleController->insertModuleGrants($module_srl, $grants); |
|
| 278 | + } |
|
| 225 | 279 | // Insert skin vars |
| 226 | 280 | $skin_vars = unserialize($module_info->skin_vars); |
| 227 | - if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 281 | + if($skin_vars) { |
|
| 282 | + $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
| 283 | + } |
|
| 228 | 284 | // Insert super admin's ID |
| 229 | 285 | $admin_id = trim($module_info->admin_id); |
| 230 | 286 | if($admin_id && $admin_id != 'Array') |
@@ -246,7 +302,9 @@ discard block |
||
| 246 | 302 | $document_extra_keys = $extra_vars->extra_vars; |
| 247 | 303 | unset($extra_vars->extra_vars); |
| 248 | 304 | } |
| 249 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 305 | + if($extra_vars) { |
|
| 306 | + $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 307 | + } |
|
| 250 | 308 | |
| 251 | 309 | /** |
| 252 | 310 | * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) |
@@ -254,7 +312,9 @@ discard block |
||
| 254 | 312 | // Insert extra vars if planet module is |
| 255 | 313 | if($module_info->module == 'planet') |
| 256 | 314 | { |
| 257 | - if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
| 315 | + if(!$document_extra_keys || !is_array($document_extra_keys)) { |
|
| 316 | + $document_extra_keys = array(); |
|
| 317 | + } |
|
| 258 | 318 | $planet_extra_keys->name = 'postscript'; |
| 259 | 319 | $planet_extra_keys->type = 'text'; |
| 260 | 320 | $planet_extra_keys->is_required = 'N'; |
@@ -293,10 +353,14 @@ discard block |
||
| 293 | 353 | { |
| 294 | 354 | foreach ($output->data as $document) |
| 295 | 355 | { |
| 296 | - if(!$document) continue; |
|
| 356 | + if(!$document) { |
|
| 357 | + continue; |
|
| 358 | + } |
|
| 297 | 359 | foreach ($document as $key => $var) |
| 298 | 360 | { |
| 299 | - if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue; |
|
| 361 | + if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') { |
|
| 362 | + continue; |
|
| 363 | + } |
|
| 300 | 364 | $var_idx = str_replace('extra_vars','',$key); |
| 301 | 365 | $oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code); |
| 302 | 366 | } |
@@ -333,7 +397,9 @@ discard block |
||
| 333 | 397 | // extra_vars * Remove Column |
| 334 | 398 | for($i=1;$i<=20;$i++) |
| 335 | 399 | { |
| 336 | - if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; |
|
| 400 | + if(!$oDB->isColumnExists("documents","extra_vars".$i)) { |
|
| 401 | + continue; |
|
| 402 | + } |
|
| 337 | 403 | $oDB->dropColumn('documents','extra_vars'.$i); |
| 338 | 404 | } |
| 339 | 405 | |
@@ -355,7 +421,9 @@ discard block |
||
| 355 | 421 | $site_args->default_language = $db_info->lang_type; |
| 356 | 422 | |
| 357 | 423 | $output = executeQuery('module.insertSite', $site_args); |
| 358 | - if(!$output->toBool()) return $output; |
|
| 424 | + if(!$output->toBool()) { |
|
| 425 | + return $output; |
|
| 426 | + } |
|
| 359 | 427 | } |
| 360 | 428 | |
| 361 | 429 | if($oDB->isIndexExists('sites','idx_domain')) |
@@ -401,7 +469,9 @@ discard block |
||
| 401 | 469 | foreach($output->data as $item) |
| 402 | 470 | { |
| 403 | 471 | $skin_path = explode('.', $item->skin); |
| 404 | - if(count($skin_path) != 2) continue; |
|
| 472 | + if(count($skin_path) != 2) { |
|
| 473 | + continue; |
|
| 474 | + } |
|
| 405 | 475 | if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
| 406 | 476 | { |
| 407 | 477 | unset($args); |
@@ -427,7 +497,9 @@ discard block |
||
| 427 | 497 | $output = executeQuery('module.updateMobileSkinFixModules'); |
| 428 | 498 | |
| 429 | 499 | $oModuleController = getController('module'); |
| 430 | - if(!$moduleConfig) $moduleConfig = new stdClass; |
|
| 500 | + if(!$moduleConfig) { |
|
| 501 | + $moduleConfig = new stdClass; |
|
| 502 | + } |
|
| 431 | 503 | $moduleConfig->isUpdateFixedValue = TRUE; |
| 432 | 504 | $output = $oModuleController->updateModuleConfig('module', $moduleConfig); |
| 433 | 505 | } |
@@ -440,7 +512,9 @@ discard block |
||
| 440 | 512 | $oModuleController->insertUpdatedLog($version_update_id); |
| 441 | 513 | } |
| 442 | 514 | |
| 443 | - if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset'); |
|
| 515 | + if(!is_dir('./files/ruleset')) { |
|
| 516 | + FileHandler::makeDir('./files/ruleset'); |
|
| 517 | + } |
|
| 444 | 518 | |
| 445 | 519 | return new BaseObject(0, 'success_updated'); |
| 446 | 520 | } |
@@ -448,10 +522,14 @@ discard block |
||
| 448 | 522 | function updateForUniqueSiteDomain() |
| 449 | 523 | { |
| 450 | 524 | $output = executeQueryArray("module.getNonuniqueDomains"); |
| 451 | - if(!$output->data) return; |
|
| 525 | + if(!$output->data) { |
|
| 526 | + return; |
|
| 527 | + } |
|
| 452 | 528 | foreach($output->data as $data) |
| 453 | 529 | { |
| 454 | - if($data->count == 1) continue; |
|
| 530 | + if($data->count == 1) { |
|
| 531 | + continue; |
|
| 532 | + } |
|
| 455 | 533 | $domain = $data->domain; |
| 456 | 534 | $args = new stdClass; |
| 457 | 535 | $args->domain = $domain; |
@@ -162,6 +162,9 @@ |
||
| 162 | 162 | $output = executeQuery('syndication.deleteLog', $args); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | + /** |
|
| 166 | + * @param string $type |
|
| 167 | + */ |
|
| 165 | 168 | function ping($id, $type, $page=1) { |
| 166 | 169 | $this->ping_message = ''; |
| 167 | 170 | $oSyndicationModel = getModel('syndication'); |
@@ -12,17 +12,17 @@ discard block |
||
| 12 | 12 | var $ping_message = ''; |
| 13 | 13 | |
| 14 | 14 | function triggerInsertDocument(&$obj) { |
| 15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 16 | - if($obj->status !== 'PUBLIC') return $this->makeObject(); |
|
| 15 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
| 16 | + if ($obj->status !== 'PUBLIC') return $this->makeObject(); |
|
| 17 | 17 | |
| 18 | 18 | $oSyndicationModel = getModel('syndication'); |
| 19 | 19 | $oModuleModel = getModel('module'); |
| 20 | 20 | |
| 21 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 21 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 22 | 22 | |
| 23 | 23 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 24 | 24 | |
| 25 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 25 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
| 26 | 26 | |
| 27 | 27 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
| 28 | 28 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -32,22 +32,22 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | function triggerUpdateDocument(&$obj) { |
| 35 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 35 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
| 36 | 36 | |
| 37 | 37 | $oSyndicationModel = getModel('syndication'); |
| 38 | 38 | $oModuleModel = getModel('module'); |
| 39 | 39 | |
| 40 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 40 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 41 | 41 | |
| 42 | 42 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 43 | 43 | |
| 44 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 44 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
| 45 | 45 | |
| 46 | 46 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
| 47 | 47 | $id = $oSyndicationModel->getID('article', $target_id); |
| 48 | 48 | |
| 49 | 49 | // PUBLIC 외 삭제 |
| 50 | - if($obj->status === 'PUBLIC') |
|
| 50 | + if ($obj->status === 'PUBLIC') |
|
| 51 | 51 | { |
| 52 | 52 | $this->ping($id, 'article'); |
| 53 | 53 | } |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | function triggerDeleteDocument(&$obj) { |
| 63 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 63 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
| 64 | 64 | |
| 65 | 65 | $oModuleModel = getModel('module'); |
| 66 | 66 | $oSyndicationModel = getModel('syndication'); |
| 67 | 67 | |
| 68 | 68 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 69 | - if($config->syndication_use != 'Y') return $this->makeObject(); |
|
| 70 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 69 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
| 70 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 71 | 71 | |
| 72 | 72 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
| 73 | 73 | |
@@ -85,25 +85,25 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | function triggerMoveDocumentModule(&$obj) |
| 87 | 87 | { |
| 88 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 88 | + if ($obj->module_srl < 1) return $this->makeObject(); |
|
| 89 | 89 | |
| 90 | 90 | $oSyndicationModel = getModel('syndication'); |
| 91 | 91 | $oModuleModel = getModel('module'); |
| 92 | 92 | |
| 93 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 93 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 94 | 94 | |
| 95 | 95 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 96 | 96 | |
| 97 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 97 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
| 98 | 98 | |
| 99 | 99 | $arr_document_srl = explode(',', $obj->document_srls); |
| 100 | - if(!$arr_document_srl) return $this->makeObject(); |
|
| 100 | + if (!$arr_document_srl) return $this->makeObject(); |
|
| 101 | 101 | |
| 102 | - foreach($arr_document_srl as $document_srl) |
|
| 102 | + foreach ($arr_document_srl as $document_srl) |
|
| 103 | 103 | { |
| 104 | 104 | // 기존 문서 삭제 |
| 105 | 105 | $source_module_srl = $obj->source_module_srl[$document_srl]; |
| 106 | - if(!!$source_module_srl) |
|
| 106 | + if (!!$source_module_srl) |
|
| 107 | 107 | { |
| 108 | 108 | $target_id = sprintf('%s-%s', $source_module_srl, $document_srl); |
| 109 | 109 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | $oSyndicationModel = getModel('syndication'); |
| 124 | 124 | $oModuleModel = getModel('module'); |
| 125 | 125 | |
| 126 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 126 | + if ($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 127 | 127 | |
| 128 | 128 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 129 | 129 | |
| 130 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 130 | + if ($config->syndication_use != 'Y') return $this->makeObject(); |
|
| 131 | 131 | |
| 132 | 132 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
| 133 | 133 | |
@@ -162,21 +162,21 @@ discard block |
||
| 162 | 162 | $output = executeQuery('syndication.deleteLog', $args); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - function ping($id, $type, $page=1) { |
|
| 165 | + function ping($id, $type, $page = 1) { |
|
| 166 | 166 | $this->ping_message = ''; |
| 167 | 167 | $oSyndicationModel = getModel('syndication'); |
| 168 | 168 | |
| 169 | 169 | $oModuleModel = getModel('module'); |
| 170 | 170 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 171 | 171 | |
| 172 | - if(!$config->syndication_token) |
|
| 172 | + if (!$config->syndication_token) |
|
| 173 | 173 | { |
| 174 | 174 | $this->ping_message = 'Syndication Token empty'; |
| 175 | 175 | $oSyndicationModel->setResentPingLog($this->ping_message); |
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if(!$this->checkOpenSSLSupport()) |
|
| 179 | + if (!$this->checkOpenSSLSupport()) |
|
| 180 | 180 | { |
| 181 | 181 | $lang = Context::get('lang'); |
| 182 | 182 | $this->ping_message = $lang->msg_need_openssl_support; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | return false; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if(substr($config->site_url,-1)!='/') |
|
| 187 | + if (substr($config->site_url, -1) != '/') |
|
| 188 | 188 | { |
| 189 | 189 | $config->site_url .= '/'; |
| 190 | 190 | } |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | $buff = FileHandler::getRemoteResource($ping_url, null, 10, 'POST', 'application/x-www-form-urlencoded', $ping_header, array(), array('ping_url'=>$ping_body), $request_config); |
| 205 | 205 | |
| 206 | 206 | $xml = new XmlParser(); |
| 207 | - $xmlDoc= $xml->parse($buff); |
|
| 207 | + $xmlDoc = $xml->parse($buff); |
|
| 208 | 208 | |
| 209 | - if($xmlDoc->result->error_code->body != '000') |
|
| 209 | + if ($xmlDoc->result->error_code->body != '000') |
|
| 210 | 210 | { |
| 211 | - if(!$buff) |
|
| 211 | + if (!$buff) |
|
| 212 | 212 | { |
| 213 | 213 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
| 214 | 214 | } |
@@ -12,17 +12,25 @@ discard block |
||
| 12 | 12 | var $ping_message = ''; |
| 13 | 13 | |
| 14 | 14 | function triggerInsertDocument(&$obj) { |
| 15 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 16 | - if($obj->status !== 'PUBLIC') return $this->makeObject(); |
|
| 15 | + if($obj->module_srl < 1) { |
|
| 16 | + return $this->makeObject(); |
|
| 17 | + } |
|
| 18 | + if($obj->status !== 'PUBLIC') { |
|
| 19 | + return $this->makeObject(); |
|
| 20 | + } |
|
| 17 | 21 | |
| 18 | 22 | $oSyndicationModel = getModel('syndication'); |
| 19 | 23 | $oModuleModel = getModel('module'); |
| 20 | 24 | |
| 21 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 25 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
| 26 | + return $this->makeObject(); |
|
| 27 | + } |
|
| 22 | 28 | |
| 23 | 29 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 24 | 30 | |
| 25 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 31 | + if($config->syndication_use!='Y') { |
|
| 32 | + return $this->makeObject(); |
|
| 33 | + } |
|
| 26 | 34 | |
| 27 | 35 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
| 28 | 36 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -32,16 +40,22 @@ discard block |
||
| 32 | 40 | } |
| 33 | 41 | |
| 34 | 42 | function triggerUpdateDocument(&$obj) { |
| 35 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 43 | + if($obj->module_srl < 1) { |
|
| 44 | + return $this->makeObject(); |
|
| 45 | + } |
|
| 36 | 46 | |
| 37 | 47 | $oSyndicationModel = getModel('syndication'); |
| 38 | 48 | $oModuleModel = getModel('module'); |
| 39 | 49 | |
| 40 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 50 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
| 51 | + return $this->makeObject(); |
|
| 52 | + } |
|
| 41 | 53 | |
| 42 | 54 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 43 | 55 | |
| 44 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 56 | + if($config->syndication_use!='Y') { |
|
| 57 | + return $this->makeObject(); |
|
| 58 | + } |
|
| 45 | 59 | |
| 46 | 60 | $target_id = sprintf('%s-%s', $obj->module_srl, $obj->document_srl); |
| 47 | 61 | $id = $oSyndicationModel->getID('article', $target_id); |
@@ -50,8 +64,7 @@ discard block |
||
| 50 | 64 | if($obj->status === 'PUBLIC') |
| 51 | 65 | { |
| 52 | 66 | $this->ping($id, 'article'); |
| 53 | - } |
|
| 54 | - else |
|
| 67 | + } else |
|
| 55 | 68 | { |
| 56 | 69 | $this->ping($id, 'deleted'); |
| 57 | 70 | } |
@@ -60,14 +73,20 @@ discard block |
||
| 60 | 73 | } |
| 61 | 74 | |
| 62 | 75 | function triggerDeleteDocument(&$obj) { |
| 63 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 76 | + if($obj->module_srl < 1) { |
|
| 77 | + return $this->makeObject(); |
|
| 78 | + } |
|
| 64 | 79 | |
| 65 | 80 | $oModuleModel = getModel('module'); |
| 66 | 81 | $oSyndicationModel = getModel('syndication'); |
| 67 | 82 | |
| 68 | 83 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 69 | - if($config->syndication_use != 'Y') return $this->makeObject(); |
|
| 70 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 84 | + if($config->syndication_use != 'Y') { |
|
| 85 | + return $this->makeObject(); |
|
| 86 | + } |
|
| 87 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
| 88 | + return $this->makeObject(); |
|
| 89 | + } |
|
| 71 | 90 | |
| 72 | 91 | $this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content); |
| 73 | 92 | |
@@ -85,19 +104,27 @@ discard block |
||
| 85 | 104 | |
| 86 | 105 | function triggerMoveDocumentModule(&$obj) |
| 87 | 106 | { |
| 88 | - if($obj->module_srl < 1) return $this->makeObject(); |
|
| 107 | + if($obj->module_srl < 1) { |
|
| 108 | + return $this->makeObject(); |
|
| 109 | + } |
|
| 89 | 110 | |
| 90 | 111 | $oSyndicationModel = getModel('syndication'); |
| 91 | 112 | $oModuleModel = getModel('module'); |
| 92 | 113 | |
| 93 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 114 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
| 115 | + return $this->makeObject(); |
|
| 116 | + } |
|
| 94 | 117 | |
| 95 | 118 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 96 | 119 | |
| 97 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 120 | + if($config->syndication_use!='Y') { |
|
| 121 | + return $this->makeObject(); |
|
| 122 | + } |
|
| 98 | 123 | |
| 99 | 124 | $arr_document_srl = explode(',', $obj->document_srls); |
| 100 | - if(!$arr_document_srl) return $this->makeObject(); |
|
| 125 | + if(!$arr_document_srl) { |
|
| 126 | + return $this->makeObject(); |
|
| 127 | + } |
|
| 101 | 128 | |
| 102 | 129 | foreach($arr_document_srl as $document_srl) |
| 103 | 130 | { |
@@ -123,11 +150,15 @@ discard block |
||
| 123 | 150 | $oSyndicationModel = getModel('syndication'); |
| 124 | 151 | $oModuleModel = getModel('module'); |
| 125 | 152 | |
| 126 | - if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject(); |
|
| 153 | + if($oSyndicationModel->isExceptedModules($obj->module_srl)) { |
|
| 154 | + return $this->makeObject(); |
|
| 155 | + } |
|
| 127 | 156 | |
| 128 | 157 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 129 | 158 | |
| 130 | - if($config->syndication_use!='Y') return $this->makeObject(); |
|
| 159 | + if($config->syndication_use!='Y') { |
|
| 160 | + return $this->makeObject(); |
|
| 161 | + } |
|
| 131 | 162 | |
| 132 | 163 | $this->insertLog($obj->module_srl, $obj->document_srl, '', ''); |
| 133 | 164 | |
@@ -211,8 +242,7 @@ discard block |
||
| 211 | 242 | if(!$buff) |
| 212 | 243 | { |
| 213 | 244 | $this->ping_message = 'Socket connection error. Check your Server Environment.'; |
| 214 | - } |
|
| 215 | - else |
|
| 245 | + } else |
|
| 216 | 246 | { |
| 217 | 247 | $this->ping_message = $xmlDoc->result->message->body; |
| 218 | 248 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
| 39 | 39 | |
| 40 | 40 | $oAddonAdminModel = getAdminModel('addon'); |
| 41 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
| 41 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
| 42 | 42 | $oAddonAdminController = &addonAdminController::getInstance(); |
| 43 | 43 | $oAddonAdminController->doActivate('catpcha'); |
| 44 | 44 | $oAddonAdminController->makeCacheFile(); |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | function checkUpdate() { |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
| 50 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
| 51 | 51 | // if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
| 52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
| 52 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
| 53 | 53 | |
| 54 | 54 | return false; |
| 55 | 55 | } |
@@ -58,18 +58,18 @@ discard block |
||
| 58 | 58 | $oModuleModel = getModel('module'); |
| 59 | 59 | $oModuleController = getController('module'); |
| 60 | 60 | |
| 61 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')){ |
|
| 61 | + if (!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
| 62 | 62 | $oModuleController->insertTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after'); |
| 63 | 63 | } |
| 64 | 64 | // if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')){ |
| 65 | 65 | // $oModuleController->insertTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after'); |
| 66 | 66 | // } |
| 67 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')){ |
|
| 67 | + if (!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
| 68 | 68 | $oModuleController->insertTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $oAddonAdminModel = getAdminModel('addon'); |
| 72 | - if($oAddonAdminModel->getAddonInfoXml('catpcha')){ |
|
| 72 | + if ($oAddonAdminModel->getAddonInfoXml('catpcha')) { |
|
| 73 | 73 | $oAddonAdminController = &addonAdminController::getInstance(); |
| 74 | 74 | $oAddonAdminController->doActivate('catpcha'); |
| 75 | 75 | $oAddonAdminController->makeCacheFile(); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | function checkOpenSSLSupport() |
| 83 | 83 | { |
| 84 | - if(!in_array('ssl', stream_get_transports())) { |
|
| 84 | + if (!in_array('ssl', stream_get_transports())) { |
|
| 85 | 85 | return FALSE; |
| 86 | 86 | } |
| 87 | 87 | return TRUE; |
@@ -47,9 +47,13 @@ |
||
| 47 | 47 | |
| 48 | 48 | function checkUpdate() { |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | - if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true; |
|
| 50 | + if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) { |
|
| 51 | + return true; |
|
| 52 | + } |
|
| 51 | 53 | // if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true; |
| 52 | - if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) return true; |
|
| 54 | + if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'syndication', 'controller', 'triggerMoveDocumentModule', 'after')) { |
|
| 55 | + return true; |
|
| 56 | + } |
|
| 53 | 57 | |
| 54 | 58 | return false; |
| 55 | 59 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | private $site_url = null; |
| 13 | 13 | private $uri_scheme = 'http://'; |
| 14 | - private $syndication_password= null; |
|
| 14 | + private $syndication_password = null; |
|
| 15 | 15 | private $year = null; |
| 16 | 16 | private $langs = array(); |
| 17 | 17 | private $granted_modules = array(); |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | function init() { |
| 21 | 21 | $oModuleModel = getModel('module'); |
| 22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
| 23 | + if (Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
| 24 | 24 | |
| 25 | 25 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
| 26 | 26 | $this->syndication_password = $config->syndication_password; |
| 27 | 27 | $this->year = $config->year; |
| 28 | 28 | |
| 29 | 29 | $output = executeQueryArray('syndication.getGrantedModules'); |
| 30 | - if($output->data) { |
|
| 31 | - foreach($output->data as $key => $val) { |
|
| 30 | + if ($output->data) { |
|
| 31 | + foreach ($output->data as $key => $val) { |
|
| 32 | 32 | $this->granted_modules[] = $val->module_srl; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | $args->module_srl = $module_srl; |
| 42 | 42 | |
| 43 | 43 | $output = executeQuery('syndication.getExceptModule', $args); |
| 44 | - if($output->data->count) return TRUE; |
|
| 44 | + if ($output->data->count) return TRUE; |
|
| 45 | 45 | |
| 46 | 46 | $output = executeQuery('syndication.getGrantedModule', $args); |
| 47 | - if($output->data->count) return TRUE; |
|
| 47 | + if ($output->data->count) return TRUE; |
|
| 48 | 48 | |
| 49 | 49 | return FALSE; |
| 50 | 50 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $module_srls = array(); |
| 56 | 56 | if (is_array($output->data)) |
| 57 | 57 | { |
| 58 | - foreach($output->data as $val) |
|
| 58 | + foreach ($output->data as $val) |
|
| 59 | 59 | { |
| 60 | 60 | $module_srls[] = $val->module_srl; |
| 61 | 61 | } |
@@ -65,21 +65,21 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | function getLang($key, $site_srl) |
| 67 | 67 | { |
| 68 | - if(!$this->langs[$site_srl]) |
|
| 68 | + if (!$this->langs[$site_srl]) |
|
| 69 | 69 | { |
| 70 | 70 | $this->langs[$site_srl] = array(); |
| 71 | 71 | $args = new stdClass; |
| 72 | 72 | $args->site_srl = $site_srl; |
| 73 | 73 | $args->lang_code = Context::getLangType(); |
| 74 | 74 | $output = executeQueryArray("syndication.getLang", $args); |
| 75 | - if(!$output->toBool() || !$output->data) return $key; |
|
| 75 | + if (!$output->toBool() || !$output->data) return $key; |
|
| 76 | 76 | |
| 77 | - foreach($output->data as $value) |
|
| 77 | + foreach ($output->data as $value) |
|
| 78 | 78 | { |
| 79 | 79 | $this->langs[$site_srl][$value->name] = $value->value; |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | - if($this->langs[$site_srl][$key]) |
|
| 82 | + if ($this->langs[$site_srl][$key]) |
|
| 83 | 83 | { |
| 84 | 84 | return $this->langs[$site_srl][$key]; |
| 85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | function handleLang($title, $site_srl) |
| 90 | 90 | { |
| 91 | 91 | $matches = NULL; |
| 92 | - if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
| 92 | + if (!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
|
| 93 | 93 | { |
| 94 | 94 | return $title; |
| 95 | 95 | } |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | function getSyndicationList() { |
| 103 | 103 | $oModuleModel = getModel('module'); |
| 104 | 104 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 105 | - if(!$config->year || !$config->site_url || !$config->syndication_token) |
|
| 105 | + if (!$config->year || !$config->site_url || !$config->syndication_token) |
|
| 106 | 106 | { |
| 107 | - return $this->makeObject(-1,'msg_check_syndication_config'); |
|
| 107 | + return $this->makeObject(-1, 'msg_check_syndication_config'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $id = Context::get('id'); |
@@ -114,49 +114,49 @@ discard block |
||
| 114 | 114 | $endTime = Context::get('end-time'); |
| 115 | 115 | |
| 116 | 116 | $page = Context::get('page'); |
| 117 | - if(!$page) |
|
| 117 | + if (!$page) |
|
| 118 | 118 | { |
| 119 | 119 | $page = 1; |
| 120 | 120 | } |
| 121 | 121 | $vars = Context::getRequestVars(); |
| 122 | - if(!$id || !$type) |
|
| 122 | + if (!$id || !$type) |
|
| 123 | 123 | { |
| 124 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
| 124 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if(!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i',$id,$matches)) |
|
| 127 | + if (!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i', $id, $matches)) |
|
| 128 | 128 | { |
| 129 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
| 129 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if($config->syndication_password != Context::get('syndication_password')) |
|
| 132 | + if ($config->syndication_password != Context::get('syndication_password')) |
|
| 133 | 133 | { |
| 134 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
| 134 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $url = $matches[1]; |
| 138 | 138 | $year = $matches[2]; |
| 139 | 139 | $target = $matches[3]; |
| 140 | 140 | $id = $matches[4]; |
| 141 | - if($id && $id{0}==':') |
|
| 141 | + if ($id && $id{0} == ':') |
|
| 142 | 142 | { |
| 143 | 143 | $id = substr($id, 1); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $module_srl = null; |
| 147 | 147 | $document_srl = null; |
| 148 | - if($id && strpos($id,'-')!==false) |
|
| 148 | + if ($id && strpos($id, '-') !== false) |
|
| 149 | 149 | { |
| 150 | 150 | list($module_srl, $document_srl) = explode('-', $id); |
| 151 | 151 | } |
| 152 | - elseif($id) |
|
| 152 | + elseif ($id) |
|
| 153 | 153 | { |
| 154 | 154 | $module_srl = $id; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if(!$url || !$year || !$target) |
|
| 157 | + if (!$url || !$year || !$target) |
|
| 158 | 158 | { |
| 159 | - return $this->makeObject(-1,'msg_invalid_request'); |
|
| 159 | + return $this->makeObject(-1, 'msg_invalid_request'); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $site_module_info = Context::get('site_module_info'); |
| 166 | 166 | |
| 167 | - if($target == 'channel' && !$module_srl) |
|
| 167 | + if ($target == 'channel' && !$module_srl) |
|
| 168 | 168 | { |
| 169 | 169 | $target = 'site'; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if($module_srl) |
|
| 172 | + if ($module_srl) |
|
| 173 | 173 | { |
| 174 | 174 | $args = new stdClass; |
| 175 | 175 | $args->module_srls = $module_srl; |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | self::$modules[$module_srl] = $output->data; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if($target == 'channel' && $module_srl) |
|
| 181 | + if ($target == 'channel' && $module_srl) |
|
| 182 | 182 | { |
| 183 | - if($module_info) |
|
| 183 | + if ($module_info) |
|
| 184 | 184 | { |
| 185 | 185 | $args->module_srl = $module_srl; |
| 186 | 186 | $output = executeQuery('syndication.getExceptModules', $args); |
| 187 | - if($output->data->count) |
|
| 187 | + if ($output->data->count) |
|
| 188 | 188 | { |
| 189 | 189 | $error = 'target is not founded'; |
| 190 | 190 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | unset($args); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if(!$error) |
|
| 200 | + if (!$error) |
|
| 201 | 201 | { |
| 202 | 202 | Context::set('target', $target); |
| 203 | 203 | Context::set('type', $type); |
@@ -208,20 +208,20 @@ discard block |
||
| 208 | 208 | $oModuleModel = getModel('module'); |
| 209 | 209 | $site_config = $oModuleModel->getModuleConfig('module'); |
| 210 | 210 | |
| 211 | - switch($target) |
|
| 211 | + switch ($target) |
|
| 212 | 212 | { |
| 213 | 213 | case 'site' : |
| 214 | 214 | $site_info = new stdClass; |
| 215 | 215 | $site_info->id = $this->getID('site'); |
| 216 | - $site_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
| 216 | + $site_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
| 217 | 217 | $site_info->site_title = $this->handleLang($site_module_info->browser_title, $site_module_info->site_srl); |
| 218 | 218 | $site_info->title = $site_info->site_title; |
| 219 | 219 | |
| 220 | - if($module_srl) |
|
| 220 | + if ($module_srl) |
|
| 221 | 221 | { |
| 222 | 222 | $args->module_srl = $module_srl; |
| 223 | 223 | $site_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
| 224 | - if(!$site_info->title) |
|
| 224 | + if (!$site_info->title) |
|
| 225 | 225 | { |
| 226 | 226 | $site_info->title = $site_info->site_title; |
| 227 | 227 | } |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | else |
| 230 | 230 | { |
| 231 | 231 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
| 232 | - if(is_array($except_module_output->data)) |
|
| 232 | + if (is_array($except_module_output->data)) |
|
| 233 | 233 | { |
| 234 | 234 | $except_module_srls = array(); |
| 235 | - foreach($except_module_output->data as $val) |
|
| 235 | + foreach ($except_module_output->data as $val) |
|
| 236 | 236 | { |
| 237 | 237 | $except_module_srls[] = $val->module_srl; |
| 238 | 238 | } |
@@ -242,25 +242,25 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
| 244 | 244 | |
| 245 | - if($output->data) |
|
| 245 | + if ($output->data) |
|
| 246 | 246 | { |
| 247 | 247 | $site_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $site_info->self_href = $this->getSelfHref($site_info->id,$type); |
|
| 250 | + $site_info->self_href = $this->getSelfHref($site_info->id, $type); |
|
| 251 | 251 | Context::set('site_info', $site_info); |
| 252 | 252 | |
| 253 | 253 | $this->setTemplateFile('site'); |
| 254 | - switch($type) { |
|
| 254 | + switch ($type) { |
|
| 255 | 255 | case 'article' : |
| 256 | 256 | // 문서 전체를 신디케이션에 추가 |
| 257 | - Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article',$site_info->id)); |
|
| 257 | + Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $site_info->id)); |
|
| 258 | 258 | $next_url = Context::get('articles')->next_url; |
| 259 | 259 | |
| 260 | 260 | break; |
| 261 | 261 | case 'deleted' : |
| 262 | 262 | // 문서 전체를 신디케이션에서 삭제 |
| 263 | - Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted',$site_info->id)); |
|
| 263 | + Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted', $site_info->id)); |
|
| 264 | 264 | $next_url = Context::get('deleted')->next_url; |
| 265 | 265 | break; |
| 266 | 266 | default : |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // 다음 페이지가 있다면 다시 신디케이션 호출 |
| 272 | - if($next_url) |
|
| 272 | + if ($next_url) |
|
| 273 | 273 | { |
| 274 | 274 | $oSyndicationController = getController('syndication'); |
| 275 | 275 | $oSyndicationController->ping(Context::get('id'), Context::get('type'), ++$page); |
@@ -282,10 +282,10 @@ discard block |
||
| 282 | 282 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
| 283 | 283 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
| 284 | 284 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
| 285 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
| 285 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
| 286 | 286 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
| 287 | 287 | $channel_info->summary = $module_info->description; |
| 288 | - if($module_info->module == "textyle") |
|
| 288 | + if ($module_info->module == "textyle") |
|
| 289 | 289 | { |
| 290 | 290 | $channel_info->type = "blog"; |
| 291 | 291 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | $channel_info->type = "web"; |
| 296 | 296 | } |
| 297 | 297 | $except_module_srls = $this->getExceptModuleSrls(); |
| 298 | - if($except_module_srls) |
|
| 298 | + if ($except_module_srls) |
|
| 299 | 299 | { |
| 300 | - $args->except_modules = implode(',',$except_module_srls); |
|
| 300 | + $args->except_modules = implode(',', $except_module_srls); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
| 304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 304 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 305 | 305 | Context::set('channel_info', $channel_info); |
| 306 | 306 | |
| 307 | 307 | $this->setTemplateFile('channel'); |
| 308 | - switch($type) { |
|
| 308 | + switch ($type) { |
|
| 309 | 309 | case 'article' : |
| 310 | 310 | Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $channel_info->id)); |
| 311 | 311 | break; |
@@ -323,29 +323,29 @@ discard block |
||
| 323 | 323 | $channel_info->id = $this->getID('channel', $module_info->module_srl); |
| 324 | 324 | $channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl); |
| 325 | 325 | $channel_info->site_title = $site_config->siteTitle; |
| 326 | - if(!$channel_info->site_title) { |
|
| 326 | + if (!$channel_info->site_title) { |
|
| 327 | 327 | $channel_info->site_title = $channel_info->title; |
| 328 | 328 | } |
| 329 | 329 | $channel_info->updated = date("Y-m-d\\TH:i:s").$time_zone; |
| 330 | 330 | $channel_info->self_href = $this->getSelfHref($channel_info->id, $type); |
| 331 | - $channel_info->site_url = getFullSiteUrl($this->uri_scheme . $this->site_url, ''); |
|
| 331 | + $channel_info->site_url = getFullSiteUrl($this->uri_scheme.$this->site_url, ''); |
|
| 332 | 332 | $channel_info->alternative_href = $this->getChannelAlternativeHref($module_info->module_srl); |
| 333 | 333 | $channel_info->webmaster_name = $member_config->webmaster_name; |
| 334 | 334 | $channel_info->webmaster_email = $member_config->webmaster_email; |
| 335 | 335 | |
| 336 | 336 | $except_module_srls = $this->getExceptModuleSrls(); |
| 337 | - if($except_module_srls) |
|
| 337 | + if ($except_module_srls) |
|
| 338 | 338 | { |
| 339 | - $args->except_modules = implode(',',$except_module_srls); |
|
| 339 | + $args->except_modules = implode(',', $except_module_srls); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
| 343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 343 | + if ($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 344 | 344 | Context::set('channel_info', $channel_info); |
| 345 | 345 | Context::set('member_config', $member_config); |
| 346 | 346 | |
| 347 | 347 | $this->setTemplateFile('channel'); |
| 348 | - switch($type) { |
|
| 348 | + switch ($type) { |
|
| 349 | 349 | case "article" : |
| 350 | 350 | $articles = new stdClass; |
| 351 | 351 | $articles->list = array($this->getArticle($document_srl)); |
@@ -371,15 +371,15 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | // @DEPRECATED |
| 373 | 373 | function getChannels() { |
| 374 | - if($module_srls) $args->module_srls = $module_srls; |
|
| 375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
| 374 | + if ($module_srls) $args->module_srls = $module_srls; |
|
| 375 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
| 376 | 376 | $output = executeQueryArray('syndication.getModules', $args); |
| 377 | 377 | |
| 378 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
| 378 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
| 379 | 379 | Context::set('time_zone', $time_zone); |
| 380 | 380 | |
| 381 | - if($output->data) { |
|
| 382 | - foreach($output->data as $module_info) { |
|
| 381 | + if ($output->data) { |
|
| 382 | + foreach ($output->data as $module_info) { |
|
| 383 | 383 | unset($obj); |
| 384 | 384 | $obj = new stdClass; |
| 385 | 385 | $obj->id = $this->getID('channel', $module_info->module_srl); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | $obj->self_href = $this->getSelfHref($obj->id, 'channel'); |
| 389 | 389 | $obj->alternative_href = $this->getChannelAlternativeHref($module_info); |
| 390 | 390 | $obj->summary = $module_info->description; |
| 391 | - if($module_info->module == "textyle") |
|
| 391 | + if ($module_info->module == "textyle") |
|
| 392 | 392 | { |
| 393 | 393 | $obj->type = "blog"; |
| 394 | 394 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
@@ -405,15 +405,15 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | function getArticle($document_srl) { |
| 408 | - if($this->site_url==null) $this->init(); |
|
| 408 | + if ($this->site_url == null) $this->init(); |
|
| 409 | 409 | |
| 410 | 410 | $oDocumentModel = getModel('document'); |
| 411 | - $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
|
| 412 | - if(!$oDocument->isExists()) return; |
|
| 411 | + $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
|
| 412 | + if (!$oDocument->isExists()) return; |
|
| 413 | 413 | |
| 414 | 414 | $val = $oDocument->getObjectVars(); |
| 415 | 415 | |
| 416 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
| 416 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
| 417 | 417 | Context::set('time_zone', $time_zone); |
| 418 | 418 | |
| 419 | 419 | $mdoule_info = self::$modules[$oDocument->get('module_srl')]; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $article->nick_name = (!$oDocument->get('nick_name')) ? $oDocument->get('user_name') : $oDocument->get('nick_name'); |
| 428 | 428 | $article->title = $oDocument->getTitle(); |
| 429 | 429 | $article->content = $oDocument->get('content'); |
| 430 | - if($val->category_srl) { |
|
| 430 | + if ($val->category_srl) { |
|
| 431 | 431 | $category = $oDocumentModel->getCategory($val->category_srl); |
| 432 | 432 | $category_title = $category->title; |
| 433 | 433 | $article->category = new stdClass(); |
@@ -438,14 +438,14 @@ discard block |
||
| 438 | 438 | return $article; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
| 442 | - if($this->site_url==null) $this->init(); |
|
| 441 | + function getArticles($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
|
| 442 | + if ($this->site_url == null) $this->init(); |
|
| 443 | 443 | |
| 444 | 444 | $args = new stdClass; |
| 445 | - if($module_srl) $args->module_srl = $module_srl; |
|
| 446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
| 447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
| 448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
| 445 | + if ($module_srl) $args->module_srl = $module_srl; |
|
| 446 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
| 447 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
| 448 | + if (count($this->granted_modules)) $args->except_module_srls = implode(',', $this->granted_modules); |
|
| 449 | 449 | $args->page = $page; |
| 450 | 450 | $output = executeQueryArray('syndication.getDocumentList', $args); |
| 451 | 451 | $cur_page = $output->page_navigation->cur_page; |
@@ -455,23 +455,23 @@ discard block |
||
| 455 | 455 | $result->next_url = null; |
| 456 | 456 | $result->list = array(); |
| 457 | 457 | |
| 458 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
| 458 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
| 459 | 459 | Context::set('time_zone', $time_zone); |
| 460 | 460 | |
| 461 | - if($cur_page<$total_page) { |
|
| 461 | + if ($cur_page < $total_page) { |
|
| 462 | 462 | $next_url = $this->getSelfHref($id, $type); |
| 463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
| 464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
| 465 | - $result->next_url = $next_url.'&page='.($cur_page+1); |
|
| 463 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
| 464 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
| 465 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - if($output->data) { |
|
| 469 | - foreach($output->data as $key => $val) { |
|
| 468 | + if ($output->data) { |
|
| 469 | + foreach ($output->data as $key => $val) { |
|
| 470 | 470 | $article = new stdClass(); |
| 471 | 471 | $article->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
| 472 | 472 | $article->updated = date("Y-m-d\\TH:i:s", ztime($val->last_update)).$time_zone; |
| 473 | 473 | $article->published = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
| 474 | - $article->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
| 474 | + $article->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
| 475 | 475 | $article->channel_alternative_href = $this->getChannelAlternativeHref($val->module_srl); |
| 476 | 476 | $article->nick_name = (!$val->nick_name) ? $val->user_name : $val->nick_name; |
| 477 | 477 | $article->content = $val->content; |
@@ -482,12 +482,12 @@ discard block |
||
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
| 485 | - if($this->site_url==null) $this->init(); |
|
| 485 | + if ($this->site_url == null) $this->init(); |
|
| 486 | 486 | |
| 487 | 487 | $args = new stdClass; |
| 488 | - if($module_srl) $args->module_srl= $module_srl; |
|
| 489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
| 490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
| 488 | + if ($module_srl) $args->module_srl = $module_srl; |
|
| 489 | + if ($startTime) $args->start_date = $this->getDate($startTime); |
|
| 490 | + if ($endTime) $args->end_date = $this->getDate($endTime); |
|
| 491 | 491 | $args->page = $page; |
| 492 | 492 | |
| 493 | 493 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -499,21 +499,21 @@ discard block |
||
| 499 | 499 | $result->next_url = null; |
| 500 | 500 | $result->list = array(); |
| 501 | 501 | |
| 502 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
| 502 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
| 503 | 503 | Context::set('time_zone', $time_zone); |
| 504 | 504 | |
| 505 | - if($cur_page<$total_page) { |
|
| 505 | + if ($cur_page < $total_page) { |
|
| 506 | 506 | $next_url = $this->getSelfHref($id, $type); |
| 507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
| 508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
| 509 | - $result->next_url = $next_url . '&page='.($cur_page+1); |
|
| 507 | + if ($startTime) $next_url .= '&startTime='.$startTime; |
|
| 508 | + if ($endTime) $next_url .= '&endTime='.$endTime; |
|
| 509 | + $result->next_url = $next_url.'&page='.($cur_page + 1); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if($output->data) { |
|
| 513 | - foreach($output->data as $key => $val) { |
|
| 512 | + if ($output->data) { |
|
| 513 | + foreach ($output->data as $key => $val) { |
|
| 514 | 514 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
| 515 | 515 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
| 516 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'document_srl', $val->document_srl); |
|
| 516 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'document_srl', $val->document_srl); |
|
| 517 | 517 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
| 518 | 518 | $output->data[$key] = $val; |
| 519 | 519 | } |
@@ -530,25 +530,25 @@ discard block |
||
| 530 | 530 | $args->document_srl = $document_srl; |
| 531 | 531 | $output = executeQueryArray('syndication.getDeletedList', $args); |
| 532 | 532 | |
| 533 | - $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
|
| 533 | + $time_zone = substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3); |
|
| 534 | 534 | Context::set('time_zone', $time_zone); |
| 535 | 535 | |
| 536 | - foreach($output->data as $key => $val) |
|
| 536 | + foreach ($output->data as $key => $val) |
|
| 537 | 537 | { |
| 538 | 538 | $module_srl = $val->module_srl; |
| 539 | 539 | |
| 540 | - if(!isset($module_info[$module_srl])) |
|
| 540 | + if (!isset($module_info[$module_srl])) |
|
| 541 | 541 | { |
| 542 | 542 | $args = new stdClass; |
| 543 | 543 | $args->module_srl = $module_srl; |
| 544 | 544 | $module_output = executeQuery('syndication.getModuleSiteInfo', $args); |
| 545 | - if($module_output->data) $module_info[$module_srl] = $module_output->data; |
|
| 545 | + if ($module_output->data) $module_info[$module_srl] = $module_output->data; |
|
| 546 | 546 | else $module_info[$module_srl] = null; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
| 550 | 550 | $val->deleted = date("Y-m-d\\TH:i:s", ztime($val->regdate)).$time_zone; |
| 551 | - $val->alternative_href = getFullSiteUrl($this->uri_scheme . $this->site_url, '', 'mid', $module_info[$module_srl]->mid, 'document_srl', $val->document_srl); |
|
| 551 | + $val->alternative_href = getFullSiteUrl($this->uri_scheme.$this->site_url, '', 'mid', $module_info[$module_srl]->mid, 'document_srl', $val->document_srl); |
|
| 552 | 552 | $val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl); |
| 553 | 553 | $output->data[$key] = $val; |
| 554 | 554 | } |
@@ -557,42 +557,42 @@ discard block |
||
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | function getID($type, $target_id = null) { |
| 560 | - if($this->site_url==null) $this->init(); |
|
| 560 | + if ($this->site_url == null) $this->init(); |
|
| 561 | 561 | |
| 562 | - return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
|
| 562 | + return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type).($target_id ? ':'.$target_id : ''); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | function getChannelAlternativeHref($module_srl) { |
| 566 | 566 | static $module_info = array(); |
| 567 | - if(!isset($module_info[$module_srl])) { |
|
| 567 | + if (!isset($module_info[$module_srl])) { |
|
| 568 | 568 | $args = new stdClass; |
| 569 | 569 | $args->module_srl = $module_srl; |
| 570 | 570 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
| 571 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
| 571 | + if ($output->data) $module_info[$module_srl] = $output->data; |
|
| 572 | 572 | else $module_info[$module_srl] = null; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
| 575 | + if (is_null($module_info[$module_srl])) return $this->site_url; |
|
| 576 | 576 | |
| 577 | 577 | $domain = $module_info[$module_srl]->domain; |
| 578 | 578 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
| 579 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
| 579 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
| 580 | 580 | return $url; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | function getSelfHref($id, $type = null) { |
| 584 | - if($this->site_url==null) $this->init(); |
|
| 584 | + if ($this->site_url == null) $this->init(); |
|
| 585 | 585 | |
| 586 | - return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
|
| 586 | + return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme.$this->site_url, $id, $type, $this->syndication_password); |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /** |
| 590 | 590 | * 문서의 고유 URL 반환 |
| 591 | 591 | */ |
| 592 | 592 | function getAlternativeHref($document_srl, $module_srl) { |
| 593 | - if($this->site_url==null) $this->init(); |
|
| 593 | + if ($this->site_url == null) $this->init(); |
|
| 594 | 594 | |
| 595 | - if(!self::$modules[$module_srl]) { |
|
| 595 | + if (!self::$modules[$module_srl]) { |
|
| 596 | 596 | $args = new stdClass; |
| 597 | 597 | $args->module_srls = $module_srl; |
| 598 | 598 | $output = executeQuery('syndication.getModules', $args); |
@@ -604,20 +604,20 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | $domain = $module_info->domain; |
| 606 | 606 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
| 607 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
| 607 | + if (substr($url, 0, 1) == '/') $domain = $this->uri_scheme.$this->site_url.$url; |
|
| 608 | 608 | return $url; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | function getDate($date) { |
| 612 | 612 | $time = strtotime($date); |
| 613 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
| 613 | + if ($time == -1) $time = ztime(str_replace(array('-', 'T', ':'), '', $date)); |
|
| 614 | 614 | return date('YmdHis', $time); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | function getResentPingLogPath() |
| 618 | 618 | { |
| 619 | 619 | $target_filename = _XE_PATH_.'files/cache/tmp/syndication_ping_log'; |
| 620 | - if(!file_exists($target_filename)) |
|
| 620 | + if (!file_exists($target_filename)) |
|
| 621 | 621 | { |
| 622 | 622 | FileHandler::writeFile($target_filename, ''); |
| 623 | 623 | } |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | $args->message = urlencode($msg); |
| 634 | 634 | |
| 635 | 635 | $list = $this->getResentPingLog(); |
| 636 | - if(count($list)>=10) |
|
| 636 | + if (count($list) >= 10) |
|
| 637 | 637 | { |
| 638 | 638 | array_pop($list); |
| 639 | 639 | } |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $file_path = $this->getResentPingLogPath(); |
| 649 | 649 | $str = FileHandler::readFile($file_path); |
| 650 | 650 | $list = array(); |
| 651 | - if($str) |
|
| 651 | + if ($str) |
|
| 652 | 652 | { |
| 653 | 653 | $list = unserialize($str); |
| 654 | 654 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | function init() { |
| 21 | 21 | $oModuleModel = getModel('module'); |
| 22 | 22 | $config = $oModuleModel->getModuleConfig('syndication'); |
| 23 | - if(Context::getSslStatus() == 'always') $this->uri_scheme = 'https://'; |
|
| 23 | + if(Context::getSslStatus() == 'always') { |
|
| 24 | + $this->uri_scheme = 'https://'; |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | 27 | $this->site_url = preg_replace('/\/+$/is', '', $config->site_url); |
| 26 | 28 | $this->syndication_password = $config->syndication_password; |
@@ -41,10 +43,14 @@ discard block |
||
| 41 | 43 | $args->module_srl = $module_srl; |
| 42 | 44 | |
| 43 | 45 | $output = executeQuery('syndication.getExceptModule', $args); |
| 44 | - if($output->data->count) return TRUE; |
|
| 46 | + if($output->data->count) { |
|
| 47 | + return TRUE; |
|
| 48 | + } |
|
| 45 | 49 | |
| 46 | 50 | $output = executeQuery('syndication.getGrantedModule', $args); |
| 47 | - if($output->data->count) return TRUE; |
|
| 51 | + if($output->data->count) { |
|
| 52 | + return TRUE; |
|
| 53 | + } |
|
| 48 | 54 | |
| 49 | 55 | return FALSE; |
| 50 | 56 | } |
@@ -72,7 +78,9 @@ discard block |
||
| 72 | 78 | $args->site_srl = $site_srl; |
| 73 | 79 | $args->lang_code = Context::getLangType(); |
| 74 | 80 | $output = executeQueryArray("syndication.getLang", $args); |
| 75 | - if(!$output->toBool() || !$output->data) return $key; |
|
| 81 | + if(!$output->toBool() || !$output->data) { |
|
| 82 | + return $key; |
|
| 83 | + } |
|
| 76 | 84 | |
| 77 | 85 | foreach($output->data as $value) |
| 78 | 86 | { |
@@ -82,8 +90,9 @@ discard block |
||
| 82 | 90 | if($this->langs[$site_srl][$key]) |
| 83 | 91 | { |
| 84 | 92 | return $this->langs[$site_srl][$key]; |
| 93 | + } else { |
|
| 94 | + return $key; |
|
| 85 | 95 | } |
| 86 | - else return $key; |
|
| 87 | 96 | } |
| 88 | 97 | |
| 89 | 98 | function handleLang($title, $site_srl) |
@@ -92,8 +101,7 @@ discard block |
||
| 92 | 101 | if(!preg_match("/\\\$user_lang->(.+)/", $title, $matches)) |
| 93 | 102 | { |
| 94 | 103 | return $title; |
| 95 | - } |
|
| 96 | - else |
|
| 104 | + } else |
|
| 97 | 105 | { |
| 98 | 106 | return $this->getLang($matches[1], $site_srl); |
| 99 | 107 | } |
@@ -148,8 +156,7 @@ discard block |
||
| 148 | 156 | if($id && strpos($id,'-')!==false) |
| 149 | 157 | { |
| 150 | 158 | list($module_srl, $document_srl) = explode('-', $id); |
| 151 | - } |
|
| 152 | - elseif($id) |
|
| 159 | + } elseif($id) |
|
| 153 | 160 | { |
| 154 | 161 | $module_srl = $id; |
| 155 | 162 | } |
@@ -188,8 +195,7 @@ discard block |
||
| 188 | 195 | { |
| 189 | 196 | $error = 'target is not founded'; |
| 190 | 197 | } |
| 191 | - } |
|
| 192 | - else |
|
| 198 | + } else |
|
| 193 | 199 | { |
| 194 | 200 | $error = 'target is not founded'; |
| 195 | 201 | } |
@@ -225,8 +231,7 @@ discard block |
||
| 225 | 231 | { |
| 226 | 232 | $site_info->title = $site_info->site_title; |
| 227 | 233 | } |
| 228 | - } |
|
| 229 | - else |
|
| 234 | + } else |
|
| 230 | 235 | { |
| 231 | 236 | $except_module_output = executeQueryArray('syndication.getExceptModuleSrls'); |
| 232 | 237 | if(is_array($except_module_output->data)) |
@@ -289,8 +294,7 @@ discard block |
||
| 289 | 294 | { |
| 290 | 295 | $channel_info->type = "blog"; |
| 291 | 296 | $channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
| 292 | - } |
|
| 293 | - else |
|
| 297 | + } else |
|
| 294 | 298 | { |
| 295 | 299 | $channel_info->type = "web"; |
| 296 | 300 | } |
@@ -301,7 +305,9 @@ discard block |
||
| 301 | 305 | } |
| 302 | 306 | |
| 303 | 307 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
| 304 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 308 | + if($output->data) { |
|
| 309 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 310 | + } |
|
| 305 | 311 | Context::set('channel_info', $channel_info); |
| 306 | 312 | |
| 307 | 313 | $this->setTemplateFile('channel'); |
@@ -340,7 +346,9 @@ discard block |
||
| 340 | 346 | } |
| 341 | 347 | |
| 342 | 348 | $output = executeQuery('syndication.getSiteUpdatedTime', $args); |
| 343 | - if($output->data) $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 349 | + if($output->data) { |
|
| 350 | + $channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)).$time_zone; |
|
| 351 | + } |
|
| 344 | 352 | Context::set('channel_info', $channel_info); |
| 345 | 353 | Context::set('member_config', $member_config); |
| 346 | 354 | |
@@ -371,8 +379,12 @@ discard block |
||
| 371 | 379 | |
| 372 | 380 | // @DEPRECATED |
| 373 | 381 | function getChannels() { |
| 374 | - if($module_srls) $args->module_srls = $module_srls; |
|
| 375 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
| 382 | + if($module_srls) { |
|
| 383 | + $args->module_srls = $module_srls; |
|
| 384 | + } |
|
| 385 | + if(count($this->granted_modules)) { |
|
| 386 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
| 387 | + } |
|
| 376 | 388 | $output = executeQueryArray('syndication.getModules', $args); |
| 377 | 389 | |
| 378 | 390 | $time_zone = substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3); |
@@ -392,8 +404,7 @@ discard block |
||
| 392 | 404 | { |
| 393 | 405 | $obj->type = "blog"; |
| 394 | 406 | $obj->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss'); |
| 395 | - } |
|
| 396 | - else |
|
| 407 | + } else |
|
| 397 | 408 | { |
| 398 | 409 | $obj->type = "web"; |
| 399 | 410 | } |
@@ -405,11 +416,15 @@ discard block |
||
| 405 | 416 | } |
| 406 | 417 | |
| 407 | 418 | function getArticle($document_srl) { |
| 408 | - if($this->site_url==null) $this->init(); |
|
| 419 | + if($this->site_url==null) { |
|
| 420 | + $this->init(); |
|
| 421 | + } |
|
| 409 | 422 | |
| 410 | 423 | $oDocumentModel = getModel('document'); |
| 411 | 424 | $oDocument = $oDocumentModel->getDocument($document_srl,false,false); |
| 412 | - if(!$oDocument->isExists()) return; |
|
| 425 | + if(!$oDocument->isExists()) { |
|
| 426 | + return; |
|
| 427 | + } |
|
| 413 | 428 | |
| 414 | 429 | $val = $oDocument->getObjectVars(); |
| 415 | 430 | |
@@ -439,13 +454,23 @@ discard block |
||
| 439 | 454 | } |
| 440 | 455 | |
| 441 | 456 | function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) { |
| 442 | - if($this->site_url==null) $this->init(); |
|
| 457 | + if($this->site_url==null) { |
|
| 458 | + $this->init(); |
|
| 459 | + } |
|
| 443 | 460 | |
| 444 | 461 | $args = new stdClass; |
| 445 | - if($module_srl) $args->module_srl = $module_srl; |
|
| 446 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
| 447 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
| 448 | - if(count($this->granted_modules)) $args->except_module_srls = implode(',',$this->granted_modules); |
|
| 462 | + if($module_srl) { |
|
| 463 | + $args->module_srl = $module_srl; |
|
| 464 | + } |
|
| 465 | + if($startTime) { |
|
| 466 | + $args->start_date = $this->getDate($startTime); |
|
| 467 | + } |
|
| 468 | + if($endTime) { |
|
| 469 | + $args->end_date = $this->getDate($endTime); |
|
| 470 | + } |
|
| 471 | + if(count($this->granted_modules)) { |
|
| 472 | + $args->except_module_srls = implode(',',$this->granted_modules); |
|
| 473 | + } |
|
| 449 | 474 | $args->page = $page; |
| 450 | 475 | $output = executeQueryArray('syndication.getDocumentList', $args); |
| 451 | 476 | $cur_page = $output->page_navigation->cur_page; |
@@ -460,8 +485,12 @@ discard block |
||
| 460 | 485 | |
| 461 | 486 | if($cur_page<$total_page) { |
| 462 | 487 | $next_url = $this->getSelfHref($id, $type); |
| 463 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
| 464 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
| 488 | + if($startTime) { |
|
| 489 | + $next_url .= '&startTime='.$startTime; |
|
| 490 | + } |
|
| 491 | + if($endTime) { |
|
| 492 | + $next_url .= '&endTime='.$endTime; |
|
| 493 | + } |
|
| 465 | 494 | $result->next_url = $next_url.'&page='.($cur_page+1); |
| 466 | 495 | } |
| 467 | 496 | |
@@ -482,12 +511,20 @@ discard block |
||
| 482 | 511 | } |
| 483 | 512 | |
| 484 | 513 | function getDeleted($module_srl = null, $page = 1, $startTime = null, $endTime = null, $type = null, $id = null) { |
| 485 | - if($this->site_url==null) $this->init(); |
|
| 514 | + if($this->site_url==null) { |
|
| 515 | + $this->init(); |
|
| 516 | + } |
|
| 486 | 517 | |
| 487 | 518 | $args = new stdClass; |
| 488 | - if($module_srl) $args->module_srl= $module_srl; |
|
| 489 | - if($startTime) $args->start_date = $this->getDate($startTime); |
|
| 490 | - if($endTime) $args->end_date = $this->getDate($endTime); |
|
| 519 | + if($module_srl) { |
|
| 520 | + $args->module_srl= $module_srl; |
|
| 521 | + } |
|
| 522 | + if($startTime) { |
|
| 523 | + $args->start_date = $this->getDate($startTime); |
|
| 524 | + } |
|
| 525 | + if($endTime) { |
|
| 526 | + $args->end_date = $this->getDate($endTime); |
|
| 527 | + } |
|
| 491 | 528 | $args->page = $page; |
| 492 | 529 | |
| 493 | 530 | $output = executeQueryArray('syndication.getDeletedList', $args); |
@@ -504,8 +541,12 @@ discard block |
||
| 504 | 541 | |
| 505 | 542 | if($cur_page<$total_page) { |
| 506 | 543 | $next_url = $this->getSelfHref($id, $type); |
| 507 | - if($startTime) $next_url .= '&startTime='.$startTime; |
|
| 508 | - if($endTime) $next_url .= '&endTime='.$endTime; |
|
| 544 | + if($startTime) { |
|
| 545 | + $next_url .= '&startTime='.$startTime; |
|
| 546 | + } |
|
| 547 | + if($endTime) { |
|
| 548 | + $next_url .= '&endTime='.$endTime; |
|
| 549 | + } |
|
| 509 | 550 | $result->next_url = $next_url . '&page='.($cur_page+1); |
| 510 | 551 | } |
| 511 | 552 | |
@@ -542,8 +583,11 @@ discard block |
||
| 542 | 583 | $args = new stdClass; |
| 543 | 584 | $args->module_srl = $module_srl; |
| 544 | 585 | $module_output = executeQuery('syndication.getModuleSiteInfo', $args); |
| 545 | - if($module_output->data) $module_info[$module_srl] = $module_output->data; |
|
| 546 | - else $module_info[$module_srl] = null; |
|
| 586 | + if($module_output->data) { |
|
| 587 | + $module_info[$module_srl] = $module_output->data; |
|
| 588 | + } else { |
|
| 589 | + $module_info[$module_srl] = null; |
|
| 590 | + } |
|
| 547 | 591 | } |
| 548 | 592 | |
| 549 | 593 | $val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl); |
@@ -557,7 +601,9 @@ discard block |
||
| 557 | 601 | } |
| 558 | 602 | |
| 559 | 603 | function getID($type, $target_id = null) { |
| 560 | - if($this->site_url==null) $this->init(); |
|
| 604 | + if($this->site_url==null) { |
|
| 605 | + $this->init(); |
|
| 606 | + } |
|
| 561 | 607 | |
| 562 | 608 | return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:''); |
| 563 | 609 | } |
@@ -568,20 +614,29 @@ discard block |
||
| 568 | 614 | $args = new stdClass; |
| 569 | 615 | $args->module_srl = $module_srl; |
| 570 | 616 | $output = executeQuery('syndication.getModuleSiteInfo', $args); |
| 571 | - if($output->data) $module_info[$module_srl] = $output->data; |
|
| 572 | - else $module_info[$module_srl] = null; |
|
| 617 | + if($output->data) { |
|
| 618 | + $module_info[$module_srl] = $output->data; |
|
| 619 | + } else { |
|
| 620 | + $module_info[$module_srl] = null; |
|
| 621 | + } |
|
| 573 | 622 | } |
| 574 | 623 | |
| 575 | - if(is_null($module_info[$module_srl])) return $this->site_url; |
|
| 624 | + if(is_null($module_info[$module_srl])) { |
|
| 625 | + return $this->site_url; |
|
| 626 | + } |
|
| 576 | 627 | |
| 577 | 628 | $domain = $module_info[$module_srl]->domain; |
| 578 | 629 | $url = getFullSiteUrl($domain, '', 'mid', $module_info[$module_srl]->mid); |
| 579 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url . $url; |
|
| 630 | + if(substr($url,0,1)=='/') { |
|
| 631 | + $domain = $this->uri_scheme . $this->site_url . $url; |
|
| 632 | + } |
|
| 580 | 633 | return $url; |
| 581 | 634 | } |
| 582 | 635 | |
| 583 | 636 | function getSelfHref($id, $type = null) { |
| 584 | - if($this->site_url==null) $this->init(); |
|
| 637 | + if($this->site_url==null) { |
|
| 638 | + $this->init(); |
|
| 639 | + } |
|
| 585 | 640 | |
| 586 | 641 | return sprintf('%s/?module=syndication&act=getSyndicationList&id=%s&type=%s&syndication_password=%s', $this->uri_scheme . $this->site_url, $id, $type, $this->syndication_password); |
| 587 | 642 | } |
@@ -590,7 +645,9 @@ discard block |
||
| 590 | 645 | * 문서의 고유 URL 반환 |
| 591 | 646 | */ |
| 592 | 647 | function getAlternativeHref($document_srl, $module_srl) { |
| 593 | - if($this->site_url==null) $this->init(); |
|
| 648 | + if($this->site_url==null) { |
|
| 649 | + $this->init(); |
|
| 650 | + } |
|
| 594 | 651 | |
| 595 | 652 | if(!self::$modules[$module_srl]) { |
| 596 | 653 | $args = new stdClass; |
@@ -604,13 +661,17 @@ discard block |
||
| 604 | 661 | |
| 605 | 662 | $domain = $module_info->domain; |
| 606 | 663 | $url = getFullSiteUrl($domain, '', 'mid', $module_info->mid, 'document_srl', $document_srl); |
| 607 | - if(substr($url,0,1)=='/') $domain = $this->uri_scheme . $this->site_url.$url; |
|
| 664 | + if(substr($url,0,1)=='/') { |
|
| 665 | + $domain = $this->uri_scheme . $this->site_url.$url; |
|
| 666 | + } |
|
| 608 | 667 | return $url; |
| 609 | 668 | } |
| 610 | 669 | |
| 611 | 670 | function getDate($date) { |
| 612 | 671 | $time = strtotime($date); |
| 613 | - if($time == -1) $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
| 672 | + if($time == -1) { |
|
| 673 | + $time = ztime(str_replace(array('-','T',':'),'',$date)); |
|
| 674 | + } |
|
| 614 | 675 | return date('YmdHis', $time); |
| 615 | 676 | } |
| 616 | 677 | |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | // error appears if no doc is selected |
| 29 | 29 | $cart = Context::get('cart'); |
| 30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
| 31 | - $document_srl_list= explode('|@|', $cart); |
|
| 30 | + if (!$cart) return $this->stop('msg_cart_is_null'); |
|
| 31 | + $document_srl_list = explode('|@|', $cart); |
|
| 32 | 32 | $document_count = count($document_srl_list); |
| 33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
| 33 | + if (!$document_count) return $this->stop('msg_cart_is_null'); |
|
| 34 | 34 | // Delete a doc |
| 35 | 35 | $oDocumentController = getController('document'); |
| 36 | - for($i=0;$i<$document_count;$i++) |
|
| 36 | + for ($i = 0; $i < $document_count; $i++) |
|
| 37 | 37 | { |
| 38 | 38 | $document_srl = trim($document_srl_list[$i]); |
| 39 | - if(!$document_srl) continue; |
|
| 39 | + if (!$document_srl) continue; |
|
| 40 | 40 | |
| 41 | 41 | $oDocumentController->deleteDocument($document_srl, true); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) ); |
|
| 44 | + $this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count)); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
| 55 | 55 | { |
| 56 | - if(!count($document_srl_list)) return; |
|
| 56 | + if (!count($document_srl_list)) return; |
|
| 57 | 57 | |
| 58 | 58 | $oDocumentModel = getModel('document'); |
| 59 | 59 | $oDocumentController = getController('document'); |
@@ -62,24 +62,24 @@ discard block |
||
| 62 | 62 | $oDB->begin(); |
| 63 | 63 | |
| 64 | 64 | $triggerObj = new stdClass(); |
| 65 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
| 65 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
| 66 | 66 | $triggerObj->module_srl = $module_srl; |
| 67 | 67 | $triggerObj->source_module_srl = array(); |
| 68 | 68 | $triggerObj->category_srl = $category_srl; |
| 69 | 69 | |
| 70 | 70 | // Call a trigger (before) |
| 71 | 71 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj); |
| 72 | - if(!$output->toBool()) |
|
| 72 | + if (!$output->toBool()) |
|
| 73 | 73 | { |
| 74 | 74 | $oDB->rollback(); |
| 75 | 75 | return $output; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
| 78 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
| 79 | 79 | { |
| 80 | 80 | $document_srl = $document_srl_list[$i]; |
| 81 | 81 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 82 | - if(!$oDocument->isExists()) continue; |
|
| 82 | + if (!$oDocument->isExists()) continue; |
|
| 83 | 83 | |
| 84 | 84 | $triggerObj->source_module_srl[$document_srl] = $oDocument->get('module_srl'); |
| 85 | 85 | |
@@ -94,27 +94,27 @@ discard block |
||
| 94 | 94 | $obj->content = $output_ori->data->content; |
| 95 | 95 | |
| 96 | 96 | // Move the attached file if the target module is different |
| 97 | - if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
| 97 | + if ($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) |
|
| 98 | 98 | { |
| 99 | 99 | $oFileController = getController('file'); |
| 100 | 100 | |
| 101 | 101 | $files = $oDocument->getUploadedFiles(); |
| 102 | 102 | $delete_file_srls = array(); |
| 103 | - if(is_array($files)) |
|
| 103 | + if (is_array($files)) |
|
| 104 | 104 | { |
| 105 | - foreach($files as $val) |
|
| 105 | + foreach ($files as $val) |
|
| 106 | 106 | { |
| 107 | 107 | $file_info = array(); |
| 108 | 108 | $file_info['tmp_name'] = $val->uploaded_filename; |
| 109 | 109 | $file_info['name'] = $val->source_filename; |
| 110 | 110 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true); |
| 111 | - if($inserted_file && $inserted_file->toBool()) |
|
| 111 | + if ($inserted_file && $inserted_file->toBool()) |
|
| 112 | 112 | { |
| 113 | 113 | // for image/video files |
| 114 | - if($val->direct_download == 'Y') |
|
| 114 | + if ($val->direct_download == 'Y') |
|
| 115 | 115 | { |
| 116 | - $source_filename = substr($val->uploaded_filename,2); |
|
| 117 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
| 116 | + $source_filename = substr($val->uploaded_filename, 2); |
|
| 117 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
| 118 | 118 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
| 119 | 119 | // For binary files |
| 120 | 120 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $oFileController->setFilesValid($obj->document_srl); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if($module_srl != $obj->module_srl) |
|
| 136 | + if ($module_srl != $obj->module_srl) |
|
| 137 | 137 | { |
| 138 | 138 | $oDocumentController->deleteDocumentAliasByDocument($obj->document_srl); |
| 139 | 139 | } |
@@ -141,48 +141,48 @@ discard block |
||
| 141 | 141 | $obj->module_srl = $module_srl; |
| 142 | 142 | $obj->category_srl = $category_srl; |
| 143 | 143 | $output = executeQuery('document.updateDocumentModule', $obj); |
| 144 | - if(!$output->toBool()) { |
|
| 144 | + if (!$output->toBool()) { |
|
| 145 | 145 | $oDB->rollback(); |
| 146 | 146 | return $output; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | //Move a module of the extra vars |
| 150 | 150 | $output = executeQuery('document.moveDocumentExtraVars', $obj); |
| 151 | - if(!$output->toBool()) { |
|
| 151 | + if (!$output->toBool()) { |
|
| 152 | 152 | $oDB->rollback(); |
| 153 | 153 | return $output; |
| 154 | 154 | } |
| 155 | 155 | // Set 0 if a new category doesn't exist after catergory change |
| 156 | - if($source_category_srl != $category_srl) |
|
| 156 | + if ($source_category_srl != $category_srl) |
|
| 157 | 157 | { |
| 158 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
| 159 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
| 158 | + if ($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
| 159 | + if ($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $args = new stdClass(); |
| 164 | - $args->document_srls = implode(',',$document_srl_list); |
|
| 164 | + $args->document_srls = implode(',', $document_srl_list); |
|
| 165 | 165 | $args->module_srl = $module_srl; |
| 166 | 166 | // move the comment |
| 167 | 167 | $output = executeQuery('comment.updateCommentModule', $args); |
| 168 | - if(!$output->toBool()) |
|
| 168 | + if (!$output->toBool()) |
|
| 169 | 169 | { |
| 170 | 170 | $oDB->rollback(); |
| 171 | 171 | return $output; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $output = executeQuery('comment.updateCommentListModule', $args); |
| 175 | - if(!$output->toBool()) |
|
| 175 | + if (!$output->toBool()) |
|
| 176 | 176 | { |
| 177 | 177 | $oDB->rollback(); |
| 178 | 178 | return $output; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // move the trackback |
| 182 | - if(getClass('trackback')) |
|
| 182 | + if (getClass('trackback')) |
|
| 183 | 183 | { |
| 184 | 184 | $output = executeQuery('trackback.updateTrackbackModule', $args); |
| 185 | - if(!$output->toBool()) |
|
| 185 | + if (!$output->toBool()) |
|
| 186 | 186 | { |
| 187 | 187 | $oDB->rollback(); |
| 188 | 188 | return $output; |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | // Tags |
| 193 | 193 | $output = executeQuery('tag.updateTagModule', $args); |
| 194 | - if(!$output->toBool()) |
|
| 194 | + if (!$output->toBool()) |
|
| 195 | 195 | { |
| 196 | 196 | $oDB->rollback(); |
| 197 | 197 | return $output; |
| 198 | 198 | } |
| 199 | 199 | // Call a trigger (before) |
| 200 | 200 | $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj); |
| 201 | - if(!$output->toBool()) |
|
| 201 | + if (!$output->toBool()) |
|
| 202 | 202 | { |
| 203 | 203 | $oDB->rollback(); |
| 204 | 204 | return $output; |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | $oDB->commit(); |
| 208 | 208 | //remove from cache |
| 209 | 209 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 210 | - if($oCacheHandler->isSupport()) |
|
| 210 | + if ($oCacheHandler->isSupport()) |
|
| 211 | 211 | { |
| 212 | - foreach($document_srl_list as $document_srl) |
|
| 212 | + foreach ($document_srl_list as $document_srl) |
|
| 213 | 213 | { |
| 214 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
| 214 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
| 215 | 215 | $oCacheHandler->delete($cache_key_item); |
| 216 | 216 | } |
| 217 | 217 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
| 229 | 229 | { |
| 230 | - if(count($document_srl_list) < 1) return; |
|
| 230 | + if (count($document_srl_list) < 1) return; |
|
| 231 | 231 | |
| 232 | 232 | $oDocumentModel = getModel('document'); |
| 233 | 233 | $oDocumentController = getController('document'); |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | $oDB->begin(); |
| 239 | 239 | |
| 240 | 240 | $triggerObj = new stdClass(); |
| 241 | - $triggerObj->document_srls = implode(',',$document_srl_list); |
|
| 241 | + $triggerObj->document_srls = implode(',', $document_srl_list); |
|
| 242 | 242 | $triggerObj->module_srl = $module_srl; |
| 243 | 243 | $triggerObj->category_srl = $category_srl; |
| 244 | 244 | // Call a trigger (before) |
| 245 | 245 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $triggerObj); |
| 246 | - if(!$output->toBool()) |
|
| 246 | + if (!$output->toBool()) |
|
| 247 | 247 | { |
| 248 | 248 | $oDB->rollback(); |
| 249 | 249 | return $output; |
@@ -251,11 +251,11 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $extraVarsList = $oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list); |
| 253 | 253 | $extraVarsListByDocumentSrl = array(); |
| 254 | - if(is_array($extraVarsList->data)) |
|
| 254 | + if (is_array($extraVarsList->data)) |
|
| 255 | 255 | { |
| 256 | - foreach($extraVarsList->data as $value) |
|
| 256 | + foreach ($extraVarsList->data as $value) |
|
| 257 | 257 | { |
| 258 | - if(!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
| 258 | + if (!isset($extraVarsListByDocumentSrl[$value->document_srl])) |
|
| 259 | 259 | { |
| 260 | 260 | $extraVarsListByDocumentSrl[$value->document_srl] = array(); |
| 261 | 261 | } |
@@ -264,22 +264,22 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - for($i=count($document_srl_list)-1;$i>=0;$i--) |
|
| 267 | + for ($i = count($document_srl_list) - 1; $i >= 0; $i--) |
|
| 268 | 268 | { |
| 269 | 269 | $document_srl = $document_srl_list[$i]; |
| 270 | 270 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 271 | - if(!$oDocument->isExists()) continue; |
|
| 271 | + if (!$oDocument->isExists()) continue; |
|
| 272 | 272 | |
| 273 | 273 | $obj = $oDocument->getObjectVars(); |
| 274 | 274 | |
| 275 | 275 | $extraVars = $extraVarsListByDocumentSrl[$document_srl]; |
| 276 | - if($module_srl == $obj->module_srl) |
|
| 276 | + if ($module_srl == $obj->module_srl) |
|
| 277 | 277 | { |
| 278 | - if(is_array($extraVars)) |
|
| 278 | + if (is_array($extraVars)) |
|
| 279 | 279 | { |
| 280 | - foreach($extraVars as $extraItem) |
|
| 280 | + foreach ($extraVars as $extraItem) |
|
| 281 | 281 | { |
| 282 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
| 282 | + if ($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -291,10 +291,10 @@ discard block |
||
| 291 | 291 | $obj->trackback_count = 0; |
| 292 | 292 | |
| 293 | 293 | // Pre-register the attachment |
| 294 | - if($oDocument->hasUploadedFiles()) |
|
| 294 | + if ($oDocument->hasUploadedFiles()) |
|
| 295 | 295 | { |
| 296 | 296 | $files = $oDocument->getUploadedFiles(); |
| 297 | - foreach($files as $val) |
|
| 297 | + foreach ($files as $val) |
|
| 298 | 298 | { |
| 299 | 299 | $file_info = array(); |
| 300 | 300 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -302,10 +302,10 @@ discard block |
||
| 302 | 302 | $oFileController = getController('file'); |
| 303 | 303 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true); |
| 304 | 304 | // if image/video files |
| 305 | - if($val->direct_download == 'Y') |
|
| 305 | + if ($val->direct_download == 'Y') |
|
| 306 | 306 | { |
| 307 | - $source_filename = substr($val->uploaded_filename,2); |
|
| 308 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
| 307 | + $source_filename = substr($val->uploaded_filename, 2); |
|
| 308 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
| 309 | 309 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
| 310 | 310 | // If binary file |
| 311 | 311 | } |
@@ -319,23 +319,23 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // Write a post |
| 321 | 321 | $output = $oDocumentController->insertDocument($obj, true, true); |
| 322 | - if(!$output->toBool()) |
|
| 322 | + if (!$output->toBool()) |
|
| 323 | 323 | { |
| 324 | 324 | $oDB->rollback(); |
| 325 | 325 | return $output; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | // copy multi language contents |
| 329 | - if(is_array($extraVars)) |
|
| 329 | + if (is_array($extraVars)) |
|
| 330 | 330 | { |
| 331 | - foreach($extraVars as $value) |
|
| 331 | + foreach ($extraVars as $value) |
|
| 332 | 332 | { |
| 333 | - if($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
| 333 | + if ($value->idx >= 0 && $value->lang_code == Context::getLangType()) |
|
| 334 | 334 | { |
| 335 | 335 | continue; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if( $value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0) ) |
|
| 338 | + if ($value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0)) |
|
| 339 | 339 | { |
| 340 | 340 | $oDocumentController->insertDocumentExtraVar($value->module_srl, $obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code); |
| 341 | 341 | } |
@@ -343,26 +343,26 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | // Move the comments |
| 346 | - if($oDocument->getCommentCount()) |
|
| 346 | + if ($oDocument->getCommentCount()) |
|
| 347 | 347 | { |
| 348 | 348 | $oCommentModel = getModel('comment'); |
| 349 | 349 | $comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999); |
| 350 | 350 | $comments = $comment_output->data; |
| 351 | - if(count($comments) > 0) |
|
| 351 | + if (count($comments) > 0) |
|
| 352 | 352 | { |
| 353 | 353 | $oCommentController = getController('comment'); |
| 354 | 354 | $success_count = 0; |
| 355 | 355 | $p_comment_srl = array(); |
| 356 | - foreach($comments as $comment_obj) |
|
| 356 | + foreach ($comments as $comment_obj) |
|
| 357 | 357 | { |
| 358 | 358 | $comment_srl = getNextSequence(); |
| 359 | 359 | $p_comment_srl[$comment_obj->comment_srl] = $comment_srl; |
| 360 | 360 | |
| 361 | 361 | // Pre-register the attachment |
| 362 | - if($comment_obj->uploaded_count) |
|
| 362 | + if ($comment_obj->uploaded_count) |
|
| 363 | 363 | { |
| 364 | 364 | $files = $oFileModel->getFiles($comment_obj->comment_srl, true); |
| 365 | - foreach($files as $val) |
|
| 365 | + foreach ($files as $val) |
|
| 366 | 366 | { |
| 367 | 367 | $file_info = array(); |
| 368 | 368 | $file_info['tmp_name'] = $val->uploaded_filename; |
@@ -370,10 +370,10 @@ discard block |
||
| 370 | 370 | $oFileController = getController('file'); |
| 371 | 371 | $inserted_file = $oFileController->insertFile($file_info, $module_srl, $comment_srl, 0, true); |
| 372 | 372 | // if image/video files |
| 373 | - if($val->direct_download == 'Y') |
|
| 373 | + if ($val->direct_download == 'Y') |
|
| 374 | 374 | { |
| 375 | - $source_filename = substr($val->uploaded_filename,2); |
|
| 376 | - $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
|
| 375 | + $source_filename = substr($val->uploaded_filename, 2); |
|
| 376 | + $target_filename = substr($inserted_file->get('uploaded_filename'), 2); |
|
| 377 | 377 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
| 378 | 378 | // If binary file |
| 379 | 379 | } |
@@ -389,10 +389,10 @@ discard block |
||
| 389 | 389 | $comment_obj->document_srl = $obj->document_srl; |
| 390 | 390 | $comment_obj->comment_srl = $comment_srl; |
| 391 | 391 | |
| 392 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
| 392 | + if ($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
| 393 | 393 | |
| 394 | 394 | $output = $oCommentController->insertComment($comment_obj, true); |
| 395 | - if($output->toBool()) $success_count ++; |
|
| 395 | + if ($output->toBool()) $success_count++; |
|
| 396 | 396 | } |
| 397 | 397 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
| 398 | 398 | } |
@@ -400,19 +400,19 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | // Move the trackbacks |
| 402 | 402 | $oTrackbackModel = getModel('trackback'); |
| 403 | - if($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
| 403 | + if ($oTrackbackModel && $oDocument->getTrackbackCount()) |
|
| 404 | 404 | { |
| 405 | 405 | $trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl); |
| 406 | - if(count($trackbacks)) |
|
| 406 | + if (count($trackbacks)) |
|
| 407 | 407 | { |
| 408 | 408 | $success_count = 0; |
| 409 | - foreach($trackbacks as $trackback_obj) |
|
| 409 | + foreach ($trackbacks as $trackback_obj) |
|
| 410 | 410 | { |
| 411 | 411 | $trackback_obj->trackback_srl = getNextSequence(); |
| 412 | 412 | $trackback_obj->module_srl = $obj->module_srl; |
| 413 | 413 | $trackback_obj->document_srl = $obj->document_srl; |
| 414 | 414 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
| 415 | - if($output->toBool()) $success_count++; |
|
| 415 | + if ($output->toBool()) $success_count++; |
|
| 416 | 416 | } |
| 417 | 417 | // Update the number of trackbacks |
| 418 | 418 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | // Call a trigger (before) |
| 426 | 426 | $triggerObj->copied_srls = $copied_srls; |
| 427 | 427 | $output = ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj); |
| 428 | - if(!$output->toBool()) |
|
| 428 | + if (!$output->toBool()) |
|
| 429 | 429 | { |
| 430 | 430 | $oDB->rollback(); |
| 431 | 431 | return $output; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $document_list = $oDocumentModel->getDocumentList($args); |
| 453 | 453 | $documents = $document_list->data; |
| 454 | 454 | $output = executeQuery('document.deleteModuleDocument', $args); |
| 455 | - if(is_array($documents)) |
|
| 455 | + if (is_array($documents)) |
|
| 456 | 456 | { |
| 457 | 457 | foreach ($documents as $oDocument) |
| 458 | 458 | { |
@@ -461,13 +461,13 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | //remove from cache |
| 463 | 463 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 464 | - if($oCacheHandler->isSupport()) |
|
| 464 | + if ($oCacheHandler->isSupport()) |
|
| 465 | 465 | { |
| 466 | - if(is_array($document_srl_list)) |
|
| 466 | + if (is_array($document_srl_list)) |
|
| 467 | 467 | { |
| 468 | - foreach($document_srl_list as $document_srl) |
|
| 468 | + foreach ($document_srl_list as $document_srl) |
|
| 469 | 469 | { |
| 470 | - $cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
| 470 | + $cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
| 471 | 471 | $oCacheHandler->delete($cache_key_item); |
| 472 | 472 | } |
| 473 | 473 | } |
@@ -486,8 +486,8 @@ discard block |
||
| 486 | 486 | $config = getModel('document')->getDocumentConfig(); |
| 487 | 487 | $config->icons = Context::get('icons'); |
| 488 | 488 | $config->micons = Context::get('micons'); |
| 489 | - $output = $oModuleController->insertModuleConfig('document',$config); |
|
| 490 | - if(!$output->toBool()) |
|
| 489 | + $output = $oModuleController->insertModuleConfig('document', $config); |
|
| 490 | + if (!$output->toBool()) |
|
| 491 | 491 | { |
| 492 | 492 | return $output; |
| 493 | 493 | } |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | { |
| 507 | 507 | $document_srl = trim(Context::get('document_srl')); |
| 508 | 508 | |
| 509 | - if($document_srl) |
|
| 509 | + if ($document_srl) |
|
| 510 | 510 | { |
| 511 | 511 | $args->document_srl = $document_srl; |
| 512 | 512 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
| 513 | - if(!$output->toBool()) return $output; |
|
| 513 | + if (!$output->toBool()) return $output; |
|
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | */ |
| 521 | 521 | function procDocumentAdminDeleteAllThumbnail() |
| 522 | 522 | { |
| 523 | - $temp_cache_dir = './files/thumbnails_' . $_SERVER['REQUEST_TIME']; |
|
| 523 | + $temp_cache_dir = './files/thumbnails_'.$_SERVER['REQUEST_TIME']; |
|
| 524 | 524 | FileHandler::rename('./files/thumbnails', $temp_cache_dir); |
| 525 | 525 | FileHandler::makeDir('./files/thumbnails'); |
| 526 | 526 | |
@@ -536,12 +536,12 @@ discard block |
||
| 536 | 536 | function deleteThumbnailFile($path) |
| 537 | 537 | { |
| 538 | 538 | $directory = dir($path); |
| 539 | - while($entry = $directory->read()) { |
|
| 539 | + while ($entry = $directory->read()) { |
|
| 540 | 540 | if ($entry != "." && $entry != "..") { |
| 541 | 541 | if (is_dir($path."/".$entry)) { |
| 542 | 542 | $this->deleteThumbnailFile($path."/".$entry); |
| 543 | 543 | } else { |
| 544 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
| 544 | + if (!preg_match('/^thumbnail_([^\.]*)\.jpg$/i', $entry)) continue; |
|
| 545 | 545 | FileHandler::removeFile($path.'/'.$entry); |
| 546 | 546 | } |
| 547 | 547 | } |
@@ -566,13 +566,13 @@ discard block |
||
| 566 | 566 | $eid = Context::get('eid'); |
| 567 | 567 | $obj = new stdClass(); |
| 568 | 568 | |
| 569 | - if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
| 569 | + if (!$module_srl || !$name || !$eid) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 570 | 570 | // set the max value if idx is not specified |
| 571 | - if(!$var_idx) |
|
| 571 | + if (!$var_idx) |
|
| 572 | 572 | { |
| 573 | 573 | $obj->module_srl = $module_srl; |
| 574 | 574 | $output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj); |
| 575 | - $var_idx = $output->data->var_idx+1; |
|
| 575 | + $var_idx = $output->data->var_idx + 1; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | // Check if the module name already exists |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | $obj->var_idx = $var_idx; |
| 581 | 581 | $obj->eid = $eid; |
| 582 | 582 | $output = executeQuery('document.isExistsExtraKey', $obj); |
| 583 | - if(!$output->toBool() || $output->data->count) |
|
| 583 | + if (!$output->toBool() || $output->data->count) |
|
| 584 | 584 | { |
| 585 | 585 | return new BaseObject(-1, 'msg_extra_name_exists'); |
| 586 | 586 | } |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | // insert or update |
| 589 | 589 | $oDocumentController = getController('document'); |
| 590 | 590 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
| 591 | - if(!$output->toBool()) return $output; |
|
| 591 | + if (!$output->toBool()) return $output; |
|
| 592 | 592 | |
| 593 | 593 | $this->setMessage('success_registed'); |
| 594 | 594 | |
@@ -604,11 +604,11 @@ discard block |
||
| 604 | 604 | { |
| 605 | 605 | $module_srl = Context::get('module_srl'); |
| 606 | 606 | $var_idx = Context::get('var_idx'); |
| 607 | - if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
| 607 | + if (!$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 608 | 608 | |
| 609 | 609 | $oDocumentController = getController('document'); |
| 610 | 610 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
| 611 | - if(!$output->toBool()) return $output; |
|
| 611 | + if (!$output->toBool()) return $output; |
|
| 612 | 612 | |
| 613 | 613 | $this->setMessage('success_deleted'); |
| 614 | 614 | } |
@@ -623,19 +623,19 @@ discard block |
||
| 623 | 623 | $module_srl = Context::get('module_srl'); |
| 624 | 624 | $var_idx = Context::get('var_idx'); |
| 625 | 625 | |
| 626 | - if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
| 626 | + if (!$type || !$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 627 | 627 | |
| 628 | 628 | $oModuleModel = getModel('module'); |
| 629 | 629 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 630 | - if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 630 | + if (!$module_info->module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 631 | 631 | |
| 632 | 632 | $oDocumentModel = getModel('document'); |
| 633 | 633 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
| 634 | - if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request'); |
|
| 634 | + if (!$extra_keys[$var_idx]) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 635 | 635 | |
| 636 | - if($type == 'up') $new_idx = $var_idx-1; |
|
| 637 | - else $new_idx = $var_idx+1; |
|
| 638 | - if($new_idx<1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 636 | + if ($type == 'up') $new_idx = $var_idx - 1; |
|
| 637 | + else $new_idx = $var_idx + 1; |
|
| 638 | + if ($new_idx < 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 639 | 639 | |
| 640 | 640 | $args = new stdClass(); |
| 641 | 641 | $args->module_srl = $module_srl; |
@@ -646,16 +646,16 @@ discard block |
||
| 646 | 646 | unset($args); |
| 647 | 647 | |
| 648 | 648 | // update immediately if there is no idx to change |
| 649 | - if(!$extra_keys[$new_idx]) |
|
| 649 | + if (!$extra_keys[$new_idx]) |
|
| 650 | 650 | { |
| 651 | 651 | $args = new stdClass(); |
| 652 | 652 | $args->module_srl = $module_srl; |
| 653 | 653 | $args->var_idx = $var_idx; |
| 654 | 654 | $args->new_idx = $new_idx; |
| 655 | 655 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 656 | - if(!$output->toBool()) return $output; |
|
| 656 | + if (!$output->toBool()) return $output; |
|
| 657 | 657 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 658 | - if(!$output->toBool()) return $output; |
|
| 658 | + if (!$output->toBool()) return $output; |
|
| 659 | 659 | // replace if exists |
| 660 | 660 | } |
| 661 | 661 | else |
@@ -665,27 +665,27 @@ discard block |
||
| 665 | 665 | $args->var_idx = $new_idx; |
| 666 | 666 | $args->new_idx = -10000; |
| 667 | 667 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 668 | - if(!$output->toBool()) return $output; |
|
| 668 | + if (!$output->toBool()) return $output; |
|
| 669 | 669 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 670 | - if(!$output->toBool()) return $output; |
|
| 670 | + if (!$output->toBool()) return $output; |
|
| 671 | 671 | |
| 672 | 672 | $args->var_idx = $var_idx; |
| 673 | 673 | $args->new_idx = $new_idx; |
| 674 | 674 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 675 | - if(!$output->toBool()) return $output; |
|
| 675 | + if (!$output->toBool()) return $output; |
|
| 676 | 676 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 677 | - if(!$output->toBool()) return $output; |
|
| 677 | + if (!$output->toBool()) return $output; |
|
| 678 | 678 | |
| 679 | 679 | $args->var_idx = -10000; |
| 680 | 680 | $args->new_idx = $var_idx; |
| 681 | 681 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 682 | - if(!$output->toBool()) return $output; |
|
| 682 | + if (!$output->toBool()) return $output; |
|
| 683 | 683 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 684 | - if(!$output->toBool()) return $output; |
|
| 684 | + if (!$output->toBool()) return $output; |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 688 | - if($oCacheHandler->isSupport()) |
|
| 688 | + if ($oCacheHandler->isSupport()) |
|
| 689 | 689 | { |
| 690 | 690 | $object_key = 'module_document_extra_keys:'.$module_srl; |
| 691 | 691 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -699,9 +699,9 @@ discard block |
||
| 699 | 699 | */ |
| 700 | 700 | function procDocumentAdminInsertAlias() |
| 701 | 701 | { |
| 702 | - $args = Context::gets('module_srl','document_srl', 'alias_title'); |
|
| 702 | + $args = Context::gets('module_srl', 'document_srl', 'alias_title'); |
|
| 703 | 703 | $alias_srl = Context::get('alias_srl'); |
| 704 | - if(!$alias_srl) |
|
| 704 | + if (!$alias_srl) |
|
| 705 | 705 | { |
| 706 | 706 | $args->alias_srl = getNextSequence(); |
| 707 | 707 | $query = "document.insertAlias"; |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $oDocumentModel = getModel('document'); |
| 745 | 745 | $oDocumentController = getController('document'); |
| 746 | 746 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 747 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 747 | + if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 748 | 748 | |
| 749 | 749 | $oModuleModel = getModel('module'); |
| 750 | 750 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -756,31 +756,31 @@ discard block |
||
| 756 | 756 | $oDocumentController->moveDocumentToTrash($args); |
| 757 | 757 | |
| 758 | 758 | $returnUrl = Context::get('success_return_url'); |
| 759 | - if(!$returnUrl) |
|
| 759 | + if (!$returnUrl) |
|
| 760 | 760 | { |
| 761 | 761 | $arrUrl = parse_url(Context::get('cur_url')); |
| 762 | 762 | $query = ""; |
| 763 | 763 | |
| 764 | - if($arrUrl['query']) |
|
| 764 | + if ($arrUrl['query']) |
|
| 765 | 765 | { |
| 766 | 766 | parse_str($arrUrl['query'], $arrQuery); |
| 767 | 767 | |
| 768 | 768 | // set query |
| 769 | - if(isset($arrQuery['document_srl'])) |
|
| 769 | + if (isset($arrQuery['document_srl'])) |
|
| 770 | 770 | unset($arrQuery['document_srl']); |
| 771 | 771 | |
| 772 | 772 | $searchArgs = new stdClass; |
| 773 | - foreach($arrQuery as $key=>$val) |
|
| 773 | + foreach ($arrQuery as $key=>$val) |
|
| 774 | 774 | { |
| 775 | 775 | $searchArgs->{$key} = $val; |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | - if(!isset($searchArgs->sort_index)) |
|
| 778 | + if (!isset($searchArgs->sort_index)) |
|
| 779 | 779 | $searchArgs->sort_index = $module_info->order_target; |
| 780 | 780 | |
| 781 | - foreach($module_info as $key=>$val) |
|
| 781 | + foreach ($module_info as $key=>$val) |
|
| 782 | 782 | { |
| 783 | - if(!isset($searchArgs->{$key})) |
|
| 783 | + if (!isset($searchArgs->{$key})) |
|
| 784 | 784 | $searchArgs->{$key} = $val; |
| 785 | 785 | } |
| 786 | 786 | |
@@ -788,20 +788,20 @@ discard block |
||
| 788 | 788 | $output = $oDocumentModel->getDocumentList($searchArgs, $module_info->except_notice, TRUE, array('document_srl')); |
| 789 | 789 | |
| 790 | 790 | $cur_page = 1; |
| 791 | - if(isset($arrQuery['page'])) { |
|
| 792 | - $cur_page = (int)$arrQuery['page']; |
|
| 791 | + if (isset($arrQuery['page'])) { |
|
| 792 | + $cur_page = (int) $arrQuery['page']; |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | |
| 796 | - if($cur_page>1 && count($output->data) == 0) |
|
| 796 | + if ($cur_page > 1 && count($output->data) == 0) |
|
| 797 | 797 | $arrQuery['page'] = $cur_page - 1; |
| 798 | 798 | |
| 799 | 799 | $query = "?"; |
| 800 | - foreach($arrQuery as $key=>$val) |
|
| 800 | + foreach ($arrQuery as $key=>$val) |
|
| 801 | 801 | $query .= sprintf("%s=%s&", $key, $val); |
| 802 | 802 | $query = substr($query, 0, -1); |
| 803 | 803 | } |
| 804 | - $returnUrl = $arrUrl['path'] . $query; |
|
| 804 | + $returnUrl = $arrUrl['path'].$query; |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | $this->add('redirect_url', $returnUrl); |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | */ |
| 879 | 879 | function restoreTrash($originObject) |
| 880 | 880 | { |
| 881 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
| 881 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
| 882 | 882 | |
| 883 | 883 | $oDocumentController = getController('document'); |
| 884 | 884 | $oDocumentModel = getModel('document'); |
@@ -888,12 +888,12 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | //DB restore |
| 890 | 890 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
| 891 | - if(!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
| 891 | + if (!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
| 892 | 892 | |
| 893 | 893 | //FILE restore |
| 894 | 894 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
| 895 | 895 | // If the post was not temorarily saved, set the attachment's status to be valid |
| 896 | - if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
| 896 | + if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) |
|
| 897 | 897 | { |
| 898 | 898 | $args = new stdClass(); |
| 899 | 899 | $args->upload_target_srl = $oDocument->document_srl; |
@@ -902,10 +902,10 @@ discard block |
||
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | // call a trigger (after) |
| 905 | - if($output->toBool()) |
|
| 905 | + if ($output->toBool()) |
|
| 906 | 906 | { |
| 907 | 907 | $trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject); |
| 908 | - if(!$trigger_output->toBool()) |
|
| 908 | + if (!$trigger_output->toBool()) |
|
| 909 | 909 | { |
| 910 | 910 | $oDB->rollback(); |
| 911 | 911 | return $trigger_output; |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | function emptyTrash($originObject) |
| 927 | 927 | { |
| 928 | 928 | $originObject = unserialize($originObject); |
| 929 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
| 929 | + if (is_array($originObject)) $originObject = (object) $originObject; |
|
| 930 | 930 | |
| 931 | 931 | $oDocument = new documentItem(); |
| 932 | 932 | $oDocument->setAttribute($originObject); |
@@ -27,16 +27,22 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | // error appears if no doc is selected |
| 29 | 29 | $cart = Context::get('cart'); |
| 30 | - if(!$cart) return $this->stop('msg_cart_is_null'); |
|
| 30 | + if(!$cart) { |
|
| 31 | + return $this->stop('msg_cart_is_null'); |
|
| 32 | + } |
|
| 31 | 33 | $document_srl_list= explode('|@|', $cart); |
| 32 | 34 | $document_count = count($document_srl_list); |
| 33 | - if(!$document_count) return $this->stop('msg_cart_is_null'); |
|
| 35 | + if(!$document_count) { |
|
| 36 | + return $this->stop('msg_cart_is_null'); |
|
| 37 | + } |
|
| 34 | 38 | // Delete a doc |
| 35 | 39 | $oDocumentController = getController('document'); |
| 36 | 40 | for($i=0;$i<$document_count;$i++) |
| 37 | 41 | { |
| 38 | 42 | $document_srl = trim($document_srl_list[$i]); |
| 39 | - if(!$document_srl) continue; |
|
| 43 | + if(!$document_srl) { |
|
| 44 | + continue; |
|
| 45 | + } |
|
| 40 | 46 | |
| 41 | 47 | $oDocumentController->deleteDocument($document_srl, true); |
| 42 | 48 | } |
@@ -53,7 +59,9 @@ discard block |
||
| 53 | 59 | */ |
| 54 | 60 | function moveDocumentModule($document_srl_list, $module_srl, $category_srl) |
| 55 | 61 | { |
| 56 | - if(!count($document_srl_list)) return; |
|
| 62 | + if(!count($document_srl_list)) { |
|
| 63 | + return; |
|
| 64 | + } |
|
| 57 | 65 | |
| 58 | 66 | $oDocumentModel = getModel('document'); |
| 59 | 67 | $oDocumentController = getController('document'); |
@@ -79,7 +87,9 @@ discard block |
||
| 79 | 87 | { |
| 80 | 88 | $document_srl = $document_srl_list[$i]; |
| 81 | 89 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 82 | - if(!$oDocument->isExists()) continue; |
|
| 90 | + if(!$oDocument->isExists()) { |
|
| 91 | + continue; |
|
| 92 | + } |
|
| 83 | 93 | |
| 84 | 94 | $triggerObj->source_module_srl[$document_srl] = $oDocument->get('module_srl'); |
| 85 | 95 | |
@@ -117,8 +127,7 @@ discard block |
||
| 117 | 127 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
| 118 | 128 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
| 119 | 129 | // For binary files |
| 120 | - } |
|
| 121 | - else |
|
| 130 | + } else |
|
| 122 | 131 | { |
| 123 | 132 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
| 124 | 133 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -155,8 +164,12 @@ discard block |
||
| 155 | 164 | // Set 0 if a new category doesn't exist after catergory change |
| 156 | 165 | if($source_category_srl != $category_srl) |
| 157 | 166 | { |
| 158 | - if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
| 159 | - if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
| 167 | + if($source_category_srl) { |
|
| 168 | + $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); |
|
| 169 | + } |
|
| 170 | + if($category_srl) { |
|
| 171 | + $oDocumentController->updateCategoryCount($module_srl, $category_srl); |
|
| 172 | + } |
|
| 160 | 173 | } |
| 161 | 174 | } |
| 162 | 175 | |
@@ -227,7 +240,9 @@ discard block |
||
| 227 | 240 | */ |
| 228 | 241 | function copyDocumentModule($document_srl_list, $module_srl, $category_srl) |
| 229 | 242 | { |
| 230 | - if(count($document_srl_list) < 1) return; |
|
| 243 | + if(count($document_srl_list) < 1) { |
|
| 244 | + return; |
|
| 245 | + } |
|
| 231 | 246 | |
| 232 | 247 | $oDocumentModel = getModel('document'); |
| 233 | 248 | $oDocumentController = getController('document'); |
@@ -268,7 +283,9 @@ discard block |
||
| 268 | 283 | { |
| 269 | 284 | $document_srl = $document_srl_list[$i]; |
| 270 | 285 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 271 | - if(!$oDocument->isExists()) continue; |
|
| 286 | + if(!$oDocument->isExists()) { |
|
| 287 | + continue; |
|
| 288 | + } |
|
| 272 | 289 | |
| 273 | 290 | $obj = $oDocument->getObjectVars(); |
| 274 | 291 | |
@@ -279,7 +296,9 @@ discard block |
||
| 279 | 296 | { |
| 280 | 297 | foreach($extraVars as $extraItem) |
| 281 | 298 | { |
| 282 | - if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
| 299 | + if($extraItem->var_idx >= 0) { |
|
| 300 | + $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value; |
|
| 301 | + } |
|
| 283 | 302 | } |
| 284 | 303 | } |
| 285 | 304 | } |
@@ -308,8 +327,7 @@ discard block |
||
| 308 | 327 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
| 309 | 328 | $obj->content = str_replace($source_filename, $target_filename, $obj->content); |
| 310 | 329 | // If binary file |
| 311 | - } |
|
| 312 | - else |
|
| 330 | + } else |
|
| 313 | 331 | { |
| 314 | 332 | $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); |
| 315 | 333 | $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); |
@@ -376,8 +394,7 @@ discard block |
||
| 376 | 394 | $target_filename = substr($inserted_file->get('uploaded_filename'),2); |
| 377 | 395 | $comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content); |
| 378 | 396 | // If binary file |
| 379 | - } |
|
| 380 | - else |
|
| 397 | + } else |
|
| 381 | 398 | { |
| 382 | 399 | $comment_obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $comment_obj->content); |
| 383 | 400 | $comment_obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $comment_obj->content); |
@@ -389,10 +406,14 @@ discard block |
||
| 389 | 406 | $comment_obj->document_srl = $obj->document_srl; |
| 390 | 407 | $comment_obj->comment_srl = $comment_srl; |
| 391 | 408 | |
| 392 | - if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
| 409 | + if($comment_obj->parent_srl) { |
|
| 410 | + $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl]; |
|
| 411 | + } |
|
| 393 | 412 | |
| 394 | 413 | $output = $oCommentController->insertComment($comment_obj, true); |
| 395 | - if($output->toBool()) $success_count ++; |
|
| 414 | + if($output->toBool()) { |
|
| 415 | + $success_count ++; |
|
| 416 | + } |
|
| 396 | 417 | } |
| 397 | 418 | $oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true); |
| 398 | 419 | } |
@@ -412,7 +433,9 @@ discard block |
||
| 412 | 433 | $trackback_obj->module_srl = $obj->module_srl; |
| 413 | 434 | $trackback_obj->document_srl = $obj->document_srl; |
| 414 | 435 | $output = executeQuery('trackback.insertTrackback', $trackback_obj); |
| 415 | - if($output->toBool()) $success_count++; |
|
| 436 | + if($output->toBool()) { |
|
| 437 | + $success_count++; |
|
| 438 | + } |
|
| 416 | 439 | } |
| 417 | 440 | // Update the number of trackbacks |
| 418 | 441 | $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); |
@@ -510,7 +533,9 @@ discard block |
||
| 510 | 533 | { |
| 511 | 534 | $args->document_srl = $document_srl; |
| 512 | 535 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
| 513 | - if(!$output->toBool()) return $output; |
|
| 536 | + if(!$output->toBool()) { |
|
| 537 | + return $output; |
|
| 538 | + } |
|
| 514 | 539 | } |
| 515 | 540 | } |
| 516 | 541 | |
@@ -541,7 +566,9 @@ discard block |
||
| 541 | 566 | if (is_dir($path."/".$entry)) { |
| 542 | 567 | $this->deleteThumbnailFile($path."/".$entry); |
| 543 | 568 | } else { |
| 544 | - if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; |
|
| 569 | + if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) { |
|
| 570 | + continue; |
|
| 571 | + } |
|
| 545 | 572 | FileHandler::removeFile($path.'/'.$entry); |
| 546 | 573 | } |
| 547 | 574 | } |
@@ -566,7 +593,9 @@ discard block |
||
| 566 | 593 | $eid = Context::get('eid'); |
| 567 | 594 | $obj = new stdClass(); |
| 568 | 595 | |
| 569 | - if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
| 596 | + if(!$module_srl || !$name || !$eid) { |
|
| 597 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 598 | + } |
|
| 570 | 599 | // set the max value if idx is not specified |
| 571 | 600 | if(!$var_idx) |
| 572 | 601 | { |
@@ -588,7 +617,9 @@ discard block |
||
| 588 | 617 | // insert or update |
| 589 | 618 | $oDocumentController = getController('document'); |
| 590 | 619 | $output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid); |
| 591 | - if(!$output->toBool()) return $output; |
|
| 620 | + if(!$output->toBool()) { |
|
| 621 | + return $output; |
|
| 622 | + } |
|
| 592 | 623 | |
| 593 | 624 | $this->setMessage('success_registed'); |
| 594 | 625 | |
@@ -604,11 +635,15 @@ discard block |
||
| 604 | 635 | { |
| 605 | 636 | $module_srl = Context::get('module_srl'); |
| 606 | 637 | $var_idx = Context::get('var_idx'); |
| 607 | - if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
| 638 | + if(!$module_srl || !$var_idx) { |
|
| 639 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 640 | + } |
|
| 608 | 641 | |
| 609 | 642 | $oDocumentController = getController('document'); |
| 610 | 643 | $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); |
| 611 | - if(!$output->toBool()) return $output; |
|
| 644 | + if(!$output->toBool()) { |
|
| 645 | + return $output; |
|
| 646 | + } |
|
| 612 | 647 | |
| 613 | 648 | $this->setMessage('success_deleted'); |
| 614 | 649 | } |
@@ -623,26 +658,41 @@ discard block |
||
| 623 | 658 | $module_srl = Context::get('module_srl'); |
| 624 | 659 | $var_idx = Context::get('var_idx'); |
| 625 | 660 | |
| 626 | - if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request'); |
|
| 661 | + if(!$type || !$module_srl || !$var_idx) { |
|
| 662 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 663 | + } |
|
| 627 | 664 | |
| 628 | 665 | $oModuleModel = getModel('module'); |
| 629 | 666 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 630 | - if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 667 | + if(!$module_info->module_srl) { |
|
| 668 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 669 | + } |
|
| 631 | 670 | |
| 632 | 671 | $oDocumentModel = getModel('document'); |
| 633 | 672 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
| 634 | - if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request'); |
|
| 673 | + if(!$extra_keys[$var_idx]) { |
|
| 674 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 675 | + } |
|
| 635 | 676 | |
| 636 | - if($type == 'up') $new_idx = $var_idx-1; |
|
| 637 | - else $new_idx = $var_idx+1; |
|
| 638 | - if($new_idx<1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 677 | + if($type == 'up') { |
|
| 678 | + $new_idx = $var_idx-1; |
|
| 679 | + } else { |
|
| 680 | + $new_idx = $var_idx+1; |
|
| 681 | + } |
|
| 682 | + if($new_idx<1) { |
|
| 683 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 684 | + } |
|
| 639 | 685 | |
| 640 | 686 | $args = new stdClass(); |
| 641 | 687 | $args->module_srl = $module_srl; |
| 642 | 688 | $args->var_idx = $new_idx; |
| 643 | 689 | $output = executeQuery('document.getDocumentExtraKeys', $args); |
| 644 | - if (!$output->toBool()) return $output; |
|
| 645 | - if (!$output->data) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 690 | + if (!$output->toBool()) { |
|
| 691 | + return $output; |
|
| 692 | + } |
|
| 693 | + if (!$output->data) { |
|
| 694 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 695 | + } |
|
| 646 | 696 | unset($args); |
| 647 | 697 | |
| 648 | 698 | // update immediately if there is no idx to change |
@@ -653,35 +703,50 @@ discard block |
||
| 653 | 703 | $args->var_idx = $var_idx; |
| 654 | 704 | $args->new_idx = $new_idx; |
| 655 | 705 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 656 | - if(!$output->toBool()) return $output; |
|
| 706 | + if(!$output->toBool()) { |
|
| 707 | + return $output; |
|
| 708 | + } |
|
| 657 | 709 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 658 | - if(!$output->toBool()) return $output; |
|
| 710 | + if(!$output->toBool()) { |
|
| 711 | + return $output; |
|
| 712 | + } |
|
| 659 | 713 | // replace if exists |
| 660 | - } |
|
| 661 | - else |
|
| 714 | + } else |
|
| 662 | 715 | { |
| 663 | 716 | $args = new stdClass(); |
| 664 | 717 | $args->module_srl = $module_srl; |
| 665 | 718 | $args->var_idx = $new_idx; |
| 666 | 719 | $args->new_idx = -10000; |
| 667 | 720 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 668 | - if(!$output->toBool()) return $output; |
|
| 721 | + if(!$output->toBool()) { |
|
| 722 | + return $output; |
|
| 723 | + } |
|
| 669 | 724 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 670 | - if(!$output->toBool()) return $output; |
|
| 725 | + if(!$output->toBool()) { |
|
| 726 | + return $output; |
|
| 727 | + } |
|
| 671 | 728 | |
| 672 | 729 | $args->var_idx = $var_idx; |
| 673 | 730 | $args->new_idx = $new_idx; |
| 674 | 731 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 675 | - if(!$output->toBool()) return $output; |
|
| 732 | + if(!$output->toBool()) { |
|
| 733 | + return $output; |
|
| 734 | + } |
|
| 676 | 735 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 677 | - if(!$output->toBool()) return $output; |
|
| 736 | + if(!$output->toBool()) { |
|
| 737 | + return $output; |
|
| 738 | + } |
|
| 678 | 739 | |
| 679 | 740 | $args->var_idx = -10000; |
| 680 | 741 | $args->new_idx = $var_idx; |
| 681 | 742 | $output = executeQuery('document.updateDocumentExtraKeyIdx', $args); |
| 682 | - if(!$output->toBool()) return $output; |
|
| 743 | + if(!$output->toBool()) { |
|
| 744 | + return $output; |
|
| 745 | + } |
|
| 683 | 746 | $output = executeQuery('document.updateDocumentExtraVarIdx', $args); |
| 684 | - if(!$output->toBool()) return $output; |
|
| 747 | + if(!$output->toBool()) { |
|
| 748 | + return $output; |
|
| 749 | + } |
|
| 685 | 750 | } |
| 686 | 751 | |
| 687 | 752 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
@@ -705,8 +770,7 @@ discard block |
||
| 705 | 770 | { |
| 706 | 771 | $args->alias_srl = getNextSequence(); |
| 707 | 772 | $query = "document.insertAlias"; |
| 708 | - } |
|
| 709 | - else |
|
| 773 | + } else |
|
| 710 | 774 | { |
| 711 | 775 | $args->alias_srl = $alias_srl; |
| 712 | 776 | $query = "document.updateAlias"; |
@@ -744,7 +808,9 @@ discard block |
||
| 744 | 808 | $oDocumentModel = getModel('document'); |
| 745 | 809 | $oDocumentController = getController('document'); |
| 746 | 810 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 747 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 811 | + if(!$oDocument->isGranted()) { |
|
| 812 | + return $this->stop('msg_not_permitted'); |
|
| 813 | + } |
|
| 748 | 814 | |
| 749 | 815 | $oModuleModel = getModel('module'); |
| 750 | 816 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); |
@@ -766,8 +832,9 @@ discard block |
||
| 766 | 832 | parse_str($arrUrl['query'], $arrQuery); |
| 767 | 833 | |
| 768 | 834 | // set query |
| 769 | - if(isset($arrQuery['document_srl'])) |
|
| 770 | - unset($arrQuery['document_srl']); |
|
| 835 | + if(isset($arrQuery['document_srl'])) { |
|
| 836 | + unset($arrQuery['document_srl']); |
|
| 837 | + } |
|
| 771 | 838 | |
| 772 | 839 | $searchArgs = new stdClass; |
| 773 | 840 | foreach($arrQuery as $key=>$val) |
@@ -775,13 +842,15 @@ discard block |
||
| 775 | 842 | $searchArgs->{$key} = $val; |
| 776 | 843 | } |
| 777 | 844 | |
| 778 | - if(!isset($searchArgs->sort_index)) |
|
| 779 | - $searchArgs->sort_index = $module_info->order_target; |
|
| 845 | + if(!isset($searchArgs->sort_index)) { |
|
| 846 | + $searchArgs->sort_index = $module_info->order_target; |
|
| 847 | + } |
|
| 780 | 848 | |
| 781 | 849 | foreach($module_info as $key=>$val) |
| 782 | 850 | { |
| 783 | - if(!isset($searchArgs->{$key})) |
|
| 784 | - $searchArgs->{$key} = $val; |
|
| 851 | + if(!isset($searchArgs->{$key})) { |
|
| 852 | + $searchArgs->{$key} = $val; |
|
| 853 | + } |
|
| 785 | 854 | } |
| 786 | 855 | |
| 787 | 856 | $oDocumentModel = getModel('document'); |
@@ -793,12 +862,14 @@ discard block |
||
| 793 | 862 | } |
| 794 | 863 | |
| 795 | 864 | |
| 796 | - if($cur_page>1 && count($output->data) == 0) |
|
| 797 | - $arrQuery['page'] = $cur_page - 1; |
|
| 865 | + if($cur_page>1 && count($output->data) == 0) { |
|
| 866 | + $arrQuery['page'] = $cur_page - 1; |
|
| 867 | + } |
|
| 798 | 868 | |
| 799 | 869 | $query = "?"; |
| 800 | - foreach($arrQuery as $key=>$val) |
|
| 801 | - $query .= sprintf("%s=%s&", $key, $val); |
|
| 870 | + foreach($arrQuery as $key=>$val) { |
|
| 871 | + $query .= sprintf("%s=%s&", $key, $val); |
|
| 872 | + } |
|
| 802 | 873 | $query = substr($query, 0, -1); |
| 803 | 874 | } |
| 804 | 875 | $returnUrl = $arrUrl['path'] . $query; |
@@ -878,7 +949,9 @@ discard block |
||
| 878 | 949 | */ |
| 879 | 950 | function restoreTrash($originObject) |
| 880 | 951 | { |
| 881 | - if(is_array($originObject)) $originObject = (object)$originObject; |
|
| 952 | + if(is_array($originObject)) { |
|
| 953 | + $originObject = (object)$originObject; |
|
| 954 | + } |
|
| 882 | 955 | |
| 883 | 956 | $oDocumentController = getController('document'); |
| 884 | 957 | $oDocumentModel = getModel('document'); |
@@ -888,7 +961,9 @@ discard block |
||
| 888 | 961 | |
| 889 | 962 | //DB restore |
| 890 | 963 | $output = $oDocumentController->insertDocument($originObject, false, true, false); |
| 891 | - if(!$output->toBool()) return new BaseObject(-1, $output->getMessage()); |
|
| 964 | + if(!$output->toBool()) { |
|
| 965 | + return new BaseObject(-1, $output->getMessage()); |
|
| 966 | + } |
|
| 892 | 967 | |
| 893 | 968 | //FILE restore |
| 894 | 969 | $oDocument = $oDocumentModel->getDocument($originObject->document_srl); |
@@ -926,7 +1001,9 @@ discard block |
||
| 926 | 1001 | function emptyTrash($originObject) |
| 927 | 1002 | { |
| 928 | 1003 | $originObject = unserialize($originObject); |
| 929 | - if(is_array($originObject)) $originObject = (object) $originObject; |
|
| 1004 | + if(is_array($originObject)) { |
|
| 1005 | + $originObject = (object) $originObject; |
|
| 1006 | + } |
|
| 930 | 1007 | |
| 931 | 1008 | $oDocument = new documentItem(); |
| 932 | 1009 | $oDocument->setAttribute($originObject); |