@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | /** |
| 727 | 727 | * Add a profile image |
| 728 | 728 | * |
| 729 | - * @return void|BaseObject (void : success, BaseObject : fail) |
|
| 729 | + * @return ModuleObject|null (void : success, BaseObject : fail) |
|
| 730 | 730 | */ |
| 731 | 731 | function procMemberInsertProfileImage() |
| 732 | 732 | { |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | /** |
| 806 | 806 | * Add an image name |
| 807 | 807 | * |
| 808 | - * @return void|BaseObject (void : success, BaseObject : fail) |
|
| 808 | + * @return ModuleObject|null (void : success, BaseObject : fail) |
|
| 809 | 809 | */ |
| 810 | 810 | function procMemberInsertImageName() |
| 811 | 811 | { |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | /** |
| 891 | 891 | * Delete Image name |
| 892 | 892 | * |
| 893 | - * @return void |
|
| 893 | + * @return BaseObject |
|
| 894 | 894 | */ |
| 895 | 895 | function procMemberDeleteImageName($_memberSrl = 0) |
| 896 | 896 | { |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | /** |
| 915 | 915 | * Add an image to mark |
| 916 | 916 | * |
| 917 | - * @return void|BaseObject (void : success, BaseObject : fail) |
|
| 917 | + * @return ModuleObject|null (void : success, BaseObject : fail) |
|
| 918 | 918 | */ |
| 919 | 919 | function procMemberInsertImageMark() |
| 920 | 920 | { |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | * Execute finding ID/Passoword |
| 1182 | 1182 | * When clicking the link in the verification email, a method is called to change the old password and to authenticate it |
| 1183 | 1183 | * |
| 1184 | - * @return void|BaseObject (void : success, BaseObject : fail) |
|
| 1184 | + * @return ModuleObject|null (void : success, BaseObject : fail) |
|
| 1185 | 1185 | */ |
| 1186 | 1186 | function procMemberAuthAccount() |
| 1187 | 1187 | { |
@@ -1412,6 +1412,9 @@ discard block |
||
| 1412 | 1412 | $this->setRedirectUrl($returnUrl); |
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | + /** |
|
| 1416 | + * @param stdClass $auth_args |
|
| 1417 | + */ |
|
| 1415 | 1418 | function _sendAuthMail($auth_args, $member_info) |
| 1416 | 1419 | { |
| 1417 | 1420 | $oMemberModel = getModel('member'); |
@@ -1544,7 +1547,7 @@ discard block |
||
| 1544 | 1547 | * @param int $member_srl |
| 1545 | 1548 | * @param string $signature |
| 1546 | 1549 | * |
| 1547 | - * @return void |
|
| 1550 | + * @return boolean|null |
|
| 1548 | 1551 | */ |
| 1549 | 1552 | function putSignature($member_srl, $signature) |
| 1550 | 1553 | { |
@@ -1946,6 +1949,8 @@ discard block |
||
| 1946 | 1949 | /** |
| 1947 | 1950 | * Logged method for providing a personalized menu |
| 1948 | 1951 | * Login information is used in the output widget, or personalized page |
| 1952 | + * @param string $act |
|
| 1953 | + * @param string $str |
|
| 1949 | 1954 | */ |
| 1950 | 1955 | function addMemberMenu($act, $str) |
| 1951 | 1956 | { |
@@ -1976,6 +1981,7 @@ discard block |
||
| 1976 | 1981 | |
| 1977 | 1982 | /** |
| 1978 | 1983 | * Add users to the member table |
| 1984 | + * @param stdClass $args |
|
| 1979 | 1985 | */ |
| 1980 | 1986 | function insertMember(&$args, $password_is_hashed = false) |
| 1981 | 1987 | { |
@@ -2176,6 +2182,7 @@ discard block |
||
| 2176 | 2182 | * Modify member information |
| 2177 | 2183 | * |
| 2178 | 2184 | * @param bool $is_admin , modified 2013-11-22 |
| 2185 | + * @param stdClass $args |
|
| 2179 | 2186 | */ |
| 2180 | 2187 | function updateMember($args, $is_admin = FALSE) |
| 2181 | 2188 | { |
@@ -2380,6 +2387,7 @@ discard block |
||
| 2380 | 2387 | |
| 2381 | 2388 | /** |
| 2382 | 2389 | * Modify member password |
| 2390 | + * @param stdClass $args |
|
| 2383 | 2391 | */ |
| 2384 | 2392 | function updateMemberPassword($args) |
| 2385 | 2393 | { |
@@ -2414,6 +2422,9 @@ discard block |
||
| 2414 | 2422 | return $output; |
| 2415 | 2423 | } |
| 2416 | 2424 | |
| 2425 | + /** |
|
| 2426 | + * @param string $answer |
|
| 2427 | + */ |
|
| 2417 | 2428 | function updateFindAccountAnswer($member_srl, $answer) |
| 2418 | 2429 | { |
| 2419 | 2430 | $oPassword = new Password(); |
@@ -2673,7 +2684,7 @@ discard block |
||
| 2673 | 2684 | * |
| 2674 | 2685 | * @param array &$menu_list |
| 2675 | 2686 | * |
| 2676 | - * @return object |
|
| 2687 | + * @return BaseObject |
|
| 2677 | 2688 | **/ |
| 2678 | 2689 | function triggerGetDocumentMenu(&$menu_list) |
| 2679 | 2690 | { |
@@ -2703,7 +2714,7 @@ discard block |
||
| 2703 | 2714 | * |
| 2704 | 2715 | * @param array &$menu_list |
| 2705 | 2716 | * |
| 2706 | - * @return object |
|
| 2717 | + * @return BaseObject |
|
| 2707 | 2718 | **/ |
| 2708 | 2719 | function triggerGetCommentMenu(&$menu_list) |
| 2709 | 2720 | { |
@@ -2731,7 +2742,7 @@ discard block |
||
| 2731 | 2742 | /** |
| 2732 | 2743 | * Spammer manage. Denied user login. And delete or trash all documents. Response Ajax string |
| 2733 | 2744 | * |
| 2734 | - * @return object |
|
| 2745 | + * @return BaseObject |
|
| 2735 | 2746 | **/ |
| 2736 | 2747 | function procMemberSpammerManage() |
| 2737 | 2748 | { |
@@ -2674,7 +2674,7 @@ discard block |
||
| 2674 | 2674 | * @param array &$menu_list |
| 2675 | 2675 | * |
| 2676 | 2676 | * @return object |
| 2677 | - **/ |
|
| 2677 | + **/ |
|
| 2678 | 2678 | function triggerGetDocumentMenu(&$menu_list) |
| 2679 | 2679 | { |
| 2680 | 2680 | if(!Context::get('is_logged')) return new BaseObject(); |
@@ -2704,7 +2704,7 @@ discard block |
||
| 2704 | 2704 | * @param array &$menu_list |
| 2705 | 2705 | * |
| 2706 | 2706 | * @return object |
| 2707 | - **/ |
|
| 2707 | + **/ |
|
| 2708 | 2708 | function triggerGetCommentMenu(&$menu_list) |
| 2709 | 2709 | { |
| 2710 | 2710 | if(!Context::get('is_logged')) return new BaseObject(); |
@@ -2732,7 +2732,7 @@ discard block |
||
| 2732 | 2732 | * Spammer manage. Denied user login. And delete or trash all documents. Response Ajax string |
| 2733 | 2733 | * |
| 2734 | 2734 | * @return object |
| 2735 | - **/ |
|
| 2735 | + **/ |
|
| 2736 | 2736 | function procMemberSpammerManage() |
| 2737 | 2737 | { |
| 2738 | 2738 | if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
@@ -2798,7 +2798,7 @@ discard block |
||
| 2798 | 2798 | * @param int $member_srl |
| 2799 | 2799 | * |
| 2800 | 2800 | * @return object |
| 2801 | - **/ |
|
| 2801 | + **/ |
|
| 2802 | 2802 | private function _spammerMember($member_srl) { |
| 2803 | 2803 | $logged_info = Context::get('logged_info'); |
| 2804 | 2804 | $spam_description = trim( Context::get('spam_description') ); |
@@ -2839,7 +2839,7 @@ discard block |
||
| 2839 | 2839 | * @param bool $isMoveToTrash |
| 2840 | 2840 | * |
| 2841 | 2841 | * @return object |
| 2842 | - **/ |
|
| 2842 | + **/ |
|
| 2843 | 2843 | private function _spammerDocuments($member_srl, $isMoveToTrash) { |
| 2844 | 2844 | $oDocumentController = getController('document'); |
| 2845 | 2845 | $oDocumentModel = getModel('document'); |
@@ -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,17 +732,17 @@ 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 | $oModuleModel = getModel('module'); |
| 744 | 744 | $config = $oModuleModel->getModuleConfig('member'); |
| 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 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 748 | 748 | // Page refresh |
@@ -764,25 +764,25 @@ discard block |
||
| 764 | 764 | { |
| 765 | 765 | |
| 766 | 766 | // Check uploaded file |
| 767 | - if(!checkUploadedFile($target_file)) return; |
|
| 767 | + if (!checkUploadedFile($target_file)) return; |
|
| 768 | 768 | |
| 769 | 769 | $oMemberModel = getModel('member'); |
| 770 | 770 | $config = $oMemberModel->getMemberConfig(); |
| 771 | 771 | |
| 772 | 772 | // Get an image size |
| 773 | 773 | $max_width = $config->profile_image_max_width; |
| 774 | - if(!$max_width) $max_width = "90"; |
|
| 774 | + if (!$max_width) $max_width = "90"; |
|
| 775 | 775 | $max_height = $config->profile_image_max_height; |
| 776 | - if(!$max_height) $max_height = "90"; |
|
| 776 | + if (!$max_height) $max_height = "90"; |
|
| 777 | 777 | // Get a target path to save |
| 778 | 778 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
| 779 | 779 | FileHandler::makeDir($target_path); |
| 780 | 780 | |
| 781 | 781 | // Get file information |
| 782 | 782 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 783 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 784 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 785 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 783 | + if (IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 784 | + elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 785 | + elseif (IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 786 | 786 | else |
| 787 | 787 | { |
| 788 | 788 | return; |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | |
| 793 | 793 | $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); |
| 794 | 794 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 795 | - if(($width > $max_width || $height > $max_height ) && $type != 1) |
|
| 795 | + if (($width > $max_width || $height > $max_height) && $type != 1) |
|
| 796 | 796 | { |
| 797 | 797 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
| 798 | 798 | } |
@@ -811,17 +811,17 @@ discard block |
||
| 811 | 811 | { |
| 812 | 812 | // Check if the file is successfully uploaded |
| 813 | 813 | $file = $_FILES['image_name']; |
| 814 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 814 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 815 | 815 | // Ignore if member_srl is invalid or doesn't exist. |
| 816 | 816 | $member_srl = Context::get('member_srl'); |
| 817 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 817 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 818 | 818 | |
| 819 | 819 | $logged_info = Context::get('logged_info'); |
| 820 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 820 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 821 | 821 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 822 | 822 | $oModuleModel = getModel('module'); |
| 823 | 823 | $config = $oModuleModel->getModuleConfig('member'); |
| 824 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 824 | + if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 825 | 825 | |
| 826 | 826 | $this->insertImageName($member_srl, $file['tmp_name']); |
| 827 | 827 | // Page refresh |
@@ -842,15 +842,15 @@ discard block |
||
| 842 | 842 | function insertImageName($member_srl, $target_file) |
| 843 | 843 | { |
| 844 | 844 | // Check uploaded file |
| 845 | - if(!checkUploadedFile($target_file)) return; |
|
| 845 | + if (!checkUploadedFile($target_file)) return; |
|
| 846 | 846 | |
| 847 | 847 | $oModuleModel = getModel('module'); |
| 848 | 848 | $config = $oModuleModel->getModuleConfig('member'); |
| 849 | 849 | // Get an image size |
| 850 | 850 | $max_width = $config->image_name_max_width; |
| 851 | - if(!$max_width) $max_width = "90"; |
|
| 851 | + if (!$max_width) $max_width = "90"; |
|
| 852 | 852 | $max_height = $config->image_name_max_height; |
| 853 | - if(!$max_height) $max_height = "20"; |
|
| 853 | + if (!$max_height) $max_height = "20"; |
|
| 854 | 854 | // Get a target path to save |
| 855 | 855 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
| 856 | 856 | FileHandler::makeDir($target_path); |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | // Get file information |
| 860 | 860 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 861 | 861 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 862 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 862 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 863 | 863 | else @copy($target_file, $target_filename); |
| 864 | 864 | } |
| 865 | 865 | |
@@ -871,20 +871,20 @@ discard block |
||
| 871 | 871 | function procMemberDeleteProfileImage($_memberSrl = 0) |
| 872 | 872 | { |
| 873 | 873 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 874 | - if(!$member_srl) |
|
| 874 | + if (!$member_srl) |
|
| 875 | 875 | { |
| 876 | - return new BaseObject(0,'success'); |
|
| 876 | + return new BaseObject(0, 'success'); |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | $logged_info = Context::get('logged_info'); |
| 880 | 880 | |
| 881 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 881 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 882 | 882 | { |
| 883 | 883 | $oMemberModel = getModel('member'); |
| 884 | 884 | $profile_image = $oMemberModel->getProfileImage($member_srl); |
| 885 | 885 | FileHandler::removeFile($profile_image->file); |
| 886 | 886 | } |
| 887 | - return new BaseObject(0,'success'); |
|
| 887 | + return new BaseObject(0, 'success'); |
|
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | /** |
@@ -895,20 +895,20 @@ discard block |
||
| 895 | 895 | function procMemberDeleteImageName($_memberSrl = 0) |
| 896 | 896 | { |
| 897 | 897 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 898 | - if(!$member_srl) |
|
| 898 | + if (!$member_srl) |
|
| 899 | 899 | { |
| 900 | - return new BaseObject(0,'success'); |
|
| 900 | + return new BaseObject(0, 'success'); |
|
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | $logged_info = Context::get('logged_info'); |
| 904 | 904 | |
| 905 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 905 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 906 | 906 | { |
| 907 | 907 | $oMemberModel = getModel('member'); |
| 908 | 908 | $image_name = $oMemberModel->getImageName($member_srl); |
| 909 | 909 | FileHandler::removeFile($image_name->file); |
| 910 | 910 | } |
| 911 | - return new BaseObject(0,'success'); |
|
| 911 | + return new BaseObject(0, 'success'); |
|
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | /** |
@@ -920,17 +920,17 @@ discard block |
||
| 920 | 920 | { |
| 921 | 921 | // Check if the file is successfully uploaded |
| 922 | 922 | $file = $_FILES['image_mark']; |
| 923 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 923 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 924 | 924 | // Ignore if member_srl is invalid or doesn't exist. |
| 925 | 925 | $member_srl = Context::get('member_srl'); |
| 926 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 926 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 927 | 927 | |
| 928 | 928 | $logged_info = Context::get('logged_info'); |
| 929 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 929 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 930 | 930 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 931 | 931 | $oModuleModel = getModel('module'); |
| 932 | 932 | $config = $oModuleModel->getModuleConfig('member'); |
| 933 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 933 | + if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 934 | 934 | |
| 935 | 935 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 936 | 936 | // Page refresh |
@@ -951,15 +951,15 @@ discard block |
||
| 951 | 951 | function insertImageMark($member_srl, $target_file) |
| 952 | 952 | { |
| 953 | 953 | // Check uploaded file |
| 954 | - if(!checkUploadedFile($target_file)) return; |
|
| 954 | + if (!checkUploadedFile($target_file)) return; |
|
| 955 | 955 | |
| 956 | 956 | $oModuleModel = getModel('module'); |
| 957 | 957 | $config = $oModuleModel->getModuleConfig('member'); |
| 958 | 958 | // Get an image size |
| 959 | 959 | $max_width = $config->image_mark_max_width; |
| 960 | - if(!$max_width) $max_width = "20"; |
|
| 960 | + if (!$max_width) $max_width = "20"; |
|
| 961 | 961 | $max_height = $config->image_mark_max_height; |
| 962 | - if(!$max_height) $max_height = "20"; |
|
| 962 | + if (!$max_height) $max_height = "20"; |
|
| 963 | 963 | |
| 964 | 964 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
| 965 | 965 | FileHandler::makeDir($target_path); |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | // Get file information |
| 969 | 969 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 970 | 970 | |
| 971 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 971 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 972 | 972 | else @copy($target_file, $target_filename); |
| 973 | 973 | } |
| 974 | 974 | |
@@ -980,20 +980,20 @@ discard block |
||
| 980 | 980 | function procMemberDeleteImageMark($_memberSrl = 0) |
| 981 | 981 | { |
| 982 | 982 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 983 | - if(!$member_srl) |
|
| 983 | + if (!$member_srl) |
|
| 984 | 984 | { |
| 985 | - return new BaseObject(0,'success'); |
|
| 985 | + return new BaseObject(0, 'success'); |
|
| 986 | 986 | } |
| 987 | 987 | |
| 988 | 988 | $logged_info = Context::get('logged_info'); |
| 989 | 989 | |
| 990 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 990 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 991 | 991 | { |
| 992 | 992 | $oMemberModel = getModel('member'); |
| 993 | 993 | $image_mark = $oMemberModel->getImageMark($member_srl); |
| 994 | 994 | FileHandler::removeFile($image_mark->file); |
| 995 | 995 | } |
| 996 | - return new BaseObject(0,'success'); |
|
| 996 | + return new BaseObject(0, 'success'); |
|
| 997 | 997 | } |
| 998 | 998 | |
| 999 | 999 | /** |
@@ -1004,26 +1004,26 @@ discard block |
||
| 1004 | 1004 | function procMemberFindAccount() |
| 1005 | 1005 | { |
| 1006 | 1006 | $email_address = Context::get('email_address'); |
| 1007 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1007 | + if (!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1008 | 1008 | |
| 1009 | 1009 | $oMemberModel = getModel('member'); |
| 1010 | 1010 | $oModuleModel = getModel('module'); |
| 1011 | 1011 | |
| 1012 | 1012 | // Check if a member having the same email address exists |
| 1013 | 1013 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1014 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1014 | + if (!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1015 | 1015 | |
| 1016 | 1016 | // Get information of the member |
| 1017 | 1017 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
| 1018 | 1018 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1019 | 1019 | |
| 1020 | 1020 | // Check if possible to find member's ID and password |
| 1021 | - if($member_info->denied == 'Y') |
|
| 1021 | + if ($member_info->denied == 'Y') |
|
| 1022 | 1022 | { |
| 1023 | 1023 | $chk_args = new stdClass; |
| 1024 | 1024 | $chk_args->member_srl = $member_info->member_srl; |
| 1025 | 1025 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1026 | - if($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1026 | + if ($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | // Insert data into the authentication DB |
@@ -1036,19 +1036,19 @@ discard block |
||
| 1036 | 1036 | $args->is_register = 'N'; |
| 1037 | 1037 | |
| 1038 | 1038 | $output = executeQuery('member.insertAuthMail', $args); |
| 1039 | - if(!$output->toBool()) return $output; |
|
| 1039 | + if (!$output->toBool()) return $output; |
|
| 1040 | 1040 | // Get content of the email to send a member |
| 1041 | 1041 | Context::set('auth_args', $args); |
| 1042 | 1042 | |
| 1043 | 1043 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1044 | 1044 | $memberInfo = array(); |
| 1045 | 1045 | global $lang; |
| 1046 | - if(is_array($member_config->signupForm)) |
|
| 1046 | + if (is_array($member_config->signupForm)) |
|
| 1047 | 1047 | { |
| 1048 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1049 | - foreach($member_config->signupForm as $form) |
|
| 1048 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1049 | + foreach ($member_config->signupForm as $form) |
|
| 1050 | 1050 | { |
| 1051 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1051 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1052 | 1052 | { |
| 1053 | 1053 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1054 | 1054 | } |
@@ -1063,15 +1063,15 @@ discard block |
||
| 1063 | 1063 | } |
| 1064 | 1064 | Context::set('memberInfo', $memberInfo); |
| 1065 | 1065 | |
| 1066 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1067 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1066 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1067 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1068 | 1068 | |
| 1069 | 1069 | Context::set('member_config', $member_config); |
| 1070 | 1070 | |
| 1071 | 1071 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1072 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1072 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1073 | 1073 | |
| 1074 | - $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1074 | + $find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1075 | 1075 | Context::set('find_url', $find_url); |
| 1076 | 1076 | |
| 1077 | 1077 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -1081,19 +1081,19 @@ discard block |
||
| 1081 | 1081 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1082 | 1082 | // Send a mail |
| 1083 | 1083 | $oMail = new Mail(); |
| 1084 | - $oMail->setTitle( Context::getLang('msg_find_account_title') ); |
|
| 1084 | + $oMail->setTitle(Context::getLang('msg_find_account_title')); |
|
| 1085 | 1085 | $oMail->setContent($content); |
| 1086 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1087 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1086 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1087 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1088 | 1088 | $oMail->send(); |
| 1089 | 1089 | // Return message |
| 1090 | 1090 | $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); |
| 1091 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 1091 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 1092 | 1092 | { |
| 1093 | 1093 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount'); |
| 1094 | 1094 | $this->setRedirectUrl($returnUrl); |
| 1095 | 1095 | } |
| 1096 | - return new BaseObject(0,$msg); |
|
| 1096 | + return new BaseObject(0, $msg); |
|
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | /** |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | function procMemberFindAccountByQuestion() |
| 1105 | 1105 | { |
| 1106 | 1106 | $oMemberModel = getModel('member'); |
| 1107 | - $oPassword = new Password(); |
|
| 1107 | + $oPassword = new Password(); |
|
| 1108 | 1108 | $config = $oMemberModel->getMemberConfig(); |
| 1109 | 1109 | |
| 1110 | 1110 | $email_address = Context::get('email_address'); |
@@ -1112,49 +1112,49 @@ discard block |
||
| 1112 | 1112 | $find_account_question = trim(Context::get('find_account_question')); |
| 1113 | 1113 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1114 | 1114 | |
| 1115 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1115 | + if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1116 | 1116 | |
| 1117 | 1117 | $oModuleModel = getModel('module'); |
| 1118 | 1118 | // Check if a member having the same email address exists |
| 1119 | 1119 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1120 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1120 | + if (!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1121 | 1121 | |
| 1122 | 1122 | // Get information of the member |
| 1123 | 1123 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1124 | 1124 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1125 | 1125 | |
| 1126 | 1126 | // Display a message if no answer is entered |
| 1127 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1127 | + if (!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1128 | 1128 | |
| 1129 | 1129 | // 답변 확인 |
| 1130 | 1130 | $hashed = $oPassword->checkAlgorithm($member_info->find_account_answer); |
| 1131 | 1131 | $authed = true; |
| 1132 | 1132 | $member_info->find_account_question = trim($member_info->find_account_question); |
| 1133 | - if($member_info->find_account_question != $find_account_question) |
|
| 1133 | + if ($member_info->find_account_question != $find_account_question) |
|
| 1134 | 1134 | { |
| 1135 | 1135 | $authed = false; |
| 1136 | 1136 | } |
| 1137 | - else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1137 | + else if ($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1138 | 1138 | { |
| 1139 | 1139 | $authed = false; |
| 1140 | 1140 | } |
| 1141 | - else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1141 | + else if (!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1142 | 1142 | { |
| 1143 | 1143 | $authed = false; |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | - if(!$authed) |
|
| 1146 | + if (!$authed) |
|
| 1147 | 1147 | { |
| 1148 | 1148 | return new BaseObject(-1, 'msg_answer_not_matches'); |
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | // answer가 동일하고 hash 되지 않았으면 hash 값으로 저장 |
| 1152 | - if($authed && !$hashed) |
|
| 1152 | + if ($authed && !$hashed) |
|
| 1153 | 1153 | { |
| 1154 | 1154 | $this->updateFindAccountAnswer($member_srl, $find_account_answer); |
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | - if($config->identifier == 'email_address') |
|
| 1157 | + if ($config->identifier == 'email_address') |
|
| 1158 | 1158 | { |
| 1159 | 1159 | $user_id = $email_address; |
| 1160 | 1160 | } |
@@ -1167,11 +1167,11 @@ discard block |
||
| 1167 | 1167 | $args->password = $temp_password; |
| 1168 | 1168 | $args->change_password_date = '1'; |
| 1169 | 1169 | $output = $this->updateMemberPassword($args); |
| 1170 | - if(!$output->toBool()) return $output; |
|
| 1170 | + if (!$output->toBool()) return $output; |
|
| 1171 | 1171 | |
| 1172 | - $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
|
| 1172 | + $_SESSION['xe_temp_password_'.$user_id] = $temp_password; |
|
| 1173 | 1173 | |
| 1174 | - $this->add('user_id',$user_id); |
|
| 1174 | + $this->add('user_id', $user_id); |
|
| 1175 | 1175 | |
| 1176 | 1176 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 1177 | 1177 | $this->setRedirectUrl($returnUrl.'&user_id='.$user_id); |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | $member_srl = Context::get('member_srl'); |
| 1192 | 1192 | $auth_key = Context::get('auth_key'); |
| 1193 | 1193 | |
| 1194 | - if(!$member_srl || !$auth_key) |
|
| 1194 | + if (!$member_srl || !$auth_key) |
|
| 1195 | 1195 | { |
| 1196 | 1196 | return $this->stop('msg_invalid_request'); |
| 1197 | 1197 | } |
@@ -1202,9 +1202,9 @@ discard block |
||
| 1202 | 1202 | $args->auth_key = $auth_key; |
| 1203 | 1203 | $output = executeQuery('member.getAuthMail', $args); |
| 1204 | 1204 | |
| 1205 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1205 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1206 | 1206 | { |
| 1207 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1207 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1208 | 1208 | { |
| 1209 | 1209 | executeQuery('member.deleteAuthMail', $args); |
| 1210 | 1210 | } |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | return $this->stop('msg_invalid_auth_key'); |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1215 | + if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1216 | 1216 | { |
| 1217 | 1217 | executeQuery('member.deleteAuthMail', $args); |
| 1218 | 1218 | return $this->stop('msg_invalid_auth_key'); |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | $args->password = $output->data->new_password; |
| 1222 | 1222 | |
| 1223 | 1223 | // If credentials are correct, change the password to a new one |
| 1224 | - if($output->data->is_register == 'Y') |
|
| 1224 | + if ($output->data->is_register == 'Y') |
|
| 1225 | 1225 | { |
| 1226 | 1226 | $args->denied = 'N'; |
| 1227 | 1227 | } |
@@ -1234,13 +1234,13 @@ discard block |
||
| 1234 | 1234 | $is_register = $output->data->is_register; |
| 1235 | 1235 | |
| 1236 | 1236 | $output = executeQuery('member.updateMemberPassword', $args); |
| 1237 | - if(!$output->toBool()) |
|
| 1237 | + if (!$output->toBool()) |
|
| 1238 | 1238 | { |
| 1239 | 1239 | return $this->stop($output->getMessage()); |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | // Remove all values having the member_srl from authentication table |
| 1243 | - executeQuery('member.deleteAuthMail',$args); |
|
| 1243 | + executeQuery('member.deleteAuthMail', $args); |
|
| 1244 | 1244 | |
| 1245 | 1245 | $this->_clearMemberCache($args->member_srl); |
| 1246 | 1246 | |
@@ -1259,33 +1259,33 @@ discard block |
||
| 1259 | 1259 | { |
| 1260 | 1260 | // Get an email_address |
| 1261 | 1261 | $email_address = Context::get('email_address'); |
| 1262 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1262 | + if (!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1263 | 1263 | // Log test by using email_address |
| 1264 | 1264 | $oMemberModel = getModel('member'); |
| 1265 | 1265 | |
| 1266 | 1266 | $args = new stdClass; |
| 1267 | 1267 | $args->email_address = $email_address; |
| 1268 | 1268 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1269 | - if(!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1269 | + if (!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1270 | 1270 | |
| 1271 | 1271 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1272 | 1272 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1273 | 1273 | |
| 1274 | 1274 | $oModuleModel = getModel('module'); |
| 1275 | 1275 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1276 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1277 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1276 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1277 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1278 | 1278 | |
| 1279 | 1279 | // Check if a authentication mail has been sent previously |
| 1280 | 1280 | $chk_args = new stdClass; |
| 1281 | 1281 | $chk_args->member_srl = $member_info->member_srl; |
| 1282 | 1282 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1283 | - if($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1283 | + if ($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1284 | 1284 | |
| 1285 | 1285 | $auth_args = new stdClass; |
| 1286 | 1286 | $auth_args->member_srl = $member_info->member_srl; |
| 1287 | 1287 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1288 | - if(!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1288 | + if (!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1289 | 1289 | $auth_info = $output->data[0]; |
| 1290 | 1290 | |
| 1291 | 1291 | // Update the regdate of authmail entry |
@@ -1296,12 +1296,12 @@ discard block |
||
| 1296 | 1296 | |
| 1297 | 1297 | $memberInfo = array(); |
| 1298 | 1298 | global $lang; |
| 1299 | - if(is_array($member_config->signupForm)) |
|
| 1299 | + if (is_array($member_config->signupForm)) |
|
| 1300 | 1300 | { |
| 1301 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1302 | - foreach($member_config->signupForm as $form) |
|
| 1301 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1302 | + foreach ($member_config->signupForm as $form) |
|
| 1303 | 1303 | { |
| 1304 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1304 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1305 | 1305 | { |
| 1306 | 1306 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1307 | 1307 | } |
@@ -1320,19 +1320,19 @@ discard block |
||
| 1320 | 1320 | Context::set('member_config', $member_config); |
| 1321 | 1321 | |
| 1322 | 1322 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1323 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1323 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1324 | 1324 | |
| 1325 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
|
| 1325 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key); |
|
| 1326 | 1326 | Context::set('auth_url', $auth_url); |
| 1327 | 1327 | |
| 1328 | 1328 | $oTemplate = &TemplateHandler::getInstance(); |
| 1329 | 1329 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1330 | 1330 | // Send a mail |
| 1331 | 1331 | $oMail = new Mail(); |
| 1332 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1332 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1333 | 1333 | $oMail->setContent($content); |
| 1334 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1335 | - $oMail->setReceiptor( $args->user_name, $args->email_address ); |
|
| 1334 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1335 | + $oMail->setReceiptor($args->user_name, $args->email_address); |
|
| 1336 | 1336 | $oMail->send(); |
| 1337 | 1337 | |
| 1338 | 1338 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
@@ -1347,23 +1347,23 @@ discard block |
||
| 1347 | 1347 | $memberInfo = $_SESSION['auth_member_info']; |
| 1348 | 1348 | unset($_SESSION['auth_member_info']); |
| 1349 | 1349 | |
| 1350 | - if(!$memberInfo) |
|
| 1350 | + if (!$memberInfo) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | return $this->stop('msg_invalid_request'); |
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | 1355 | $newEmail = Context::get('email_address'); |
| 1356 | 1356 | |
| 1357 | - if(!$newEmail) |
|
| 1357 | + if (!$newEmail) |
|
| 1358 | 1358 | { |
| 1359 | 1359 | return $this->stop('msg_invalid_request'); |
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | 1362 | $oMemberModel = getModel('member'); |
| 1363 | 1363 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 1364 | - if($member_srl) |
|
| 1364 | + if ($member_srl) |
|
| 1365 | 1365 | { |
| 1366 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 1366 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | // remove all key by member_srl |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | $args->member_srl = $memberInfo->member_srl; |
| 1372 | 1372 | $output = executeQuery('member.deleteAuthMail', $args); |
| 1373 | 1373 | |
| 1374 | - if(!$output->toBool()) |
|
| 1374 | + if (!$output->toBool()) |
|
| 1375 | 1375 | { |
| 1376 | 1376 | return $output; |
| 1377 | 1377 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 1382 | 1382 | |
| 1383 | 1383 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 1384 | - if(!$output->toBool()) |
|
| 1384 | + if (!$output->toBool()) |
|
| 1385 | 1385 | { |
| 1386 | 1386 | return $this->stop($output->getMessage()); |
| 1387 | 1387 | } |
@@ -1398,7 +1398,7 @@ discard block |
||
| 1398 | 1398 | $auth_args->is_register = 'Y'; |
| 1399 | 1399 | |
| 1400 | 1400 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1401 | - if(!$output->toBool()) return $output; |
|
| 1401 | + if (!$output->toBool()) return $output; |
|
| 1402 | 1402 | |
| 1403 | 1403 | $memberInfo->email_address = $newEmail; |
| 1404 | 1404 | |
@@ -1422,12 +1422,12 @@ discard block |
||
| 1422 | 1422 | $memberInfo = array(); |
| 1423 | 1423 | |
| 1424 | 1424 | global $lang; |
| 1425 | - if(is_array($member_config->signupForm)) |
|
| 1425 | + if (is_array($member_config->signupForm)) |
|
| 1426 | 1426 | { |
| 1427 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1428 | - foreach($member_config->signupForm as $form) |
|
| 1427 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1428 | + foreach ($member_config->signupForm as $form) |
|
| 1429 | 1429 | { |
| 1430 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1430 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1431 | 1431 | { |
| 1432 | 1432 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1433 | 1433 | } |
@@ -1442,25 +1442,25 @@ discard block |
||
| 1442 | 1442 | } |
| 1443 | 1443 | Context::set('memberInfo', $memberInfo); |
| 1444 | 1444 | |
| 1445 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1446 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1445 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1446 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1447 | 1447 | |
| 1448 | 1448 | Context::set('member_config', $member_config); |
| 1449 | 1449 | |
| 1450 | 1450 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1451 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1451 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1452 | 1452 | |
| 1453 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 1453 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 1454 | 1454 | Context::set('auth_url', $auth_url); |
| 1455 | 1455 | |
| 1456 | 1456 | $oTemplate = &TemplateHandler::getInstance(); |
| 1457 | 1457 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1458 | 1458 | // Send a mail |
| 1459 | 1459 | $oMail = new Mail(); |
| 1460 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1460 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1461 | 1461 | $oMail->setContent($content); |
| 1462 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1463 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1462 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1463 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1464 | 1464 | $oMail->send(); |
| 1465 | 1465 | } |
| 1466 | 1466 | |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | { |
| 1474 | 1474 | $site_module_info = Context::get('site_module_info'); |
| 1475 | 1475 | $logged_info = Context::get('logged_info'); |
| 1476 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1476 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1477 | 1477 | |
| 1478 | 1478 | $oMemberModel = getModel('member'); |
| 1479 | 1479 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1492,13 +1492,13 @@ discard block |
||
| 1492 | 1492 | { |
| 1493 | 1493 | $site_module_info = Context::get('site_module_info'); |
| 1494 | 1494 | $logged_info = Context::get('logged_info'); |
| 1495 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1495 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1496 | 1496 | |
| 1497 | 1497 | $args = new stdClass; |
| 1498 | - $args->site_srl= $site_module_info->site_srl; |
|
| 1498 | + $args->site_srl = $site_module_info->site_srl; |
|
| 1499 | 1499 | $args->member_srl = $logged_info->member_srl; |
| 1500 | 1500 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1501 | - if(!$output->toBool()) return $output; |
|
| 1501 | + if (!$output->toBool()) return $output; |
|
| 1502 | 1502 | $this->setMessage('success_deleted'); |
| 1503 | 1503 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1504 | 1504 | } |
@@ -1512,25 +1512,25 @@ discard block |
||
| 1512 | 1512 | */ |
| 1513 | 1513 | function setMemberConfig($args) |
| 1514 | 1514 | { |
| 1515 | - if(!$args->skin) $args->skin = "default"; |
|
| 1516 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1517 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1518 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1519 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1520 | - $args->enable_openid= 'N'; |
|
| 1521 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1522 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1523 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1524 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1525 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1526 | - $args->limit_day = (int)$args->limit_day; |
|
| 1515 | + if (!$args->skin) $args->skin = "default"; |
|
| 1516 | + if (!$args->colorset) $args->colorset = "white"; |
|
| 1517 | + if (!$args->editor_skin) $args->editor_skin = "ckeditor"; |
|
| 1518 | + if (!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1519 | + if ($args->enable_join != 'Y') $args->enable_join = 'N'; |
|
| 1520 | + $args->enable_openid = 'N'; |
|
| 1521 | + if ($args->profile_image != 'Y') $args->profile_image = 'N'; |
|
| 1522 | + if ($args->image_name != 'Y') $args->image_name = 'N'; |
|
| 1523 | + if ($args->image_mark != 'Y') $args->image_mark = 'N'; |
|
| 1524 | + if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N'; |
|
| 1525 | + if (!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1526 | + $args->limit_day = (int) $args->limit_day; |
|
| 1527 | 1527 | |
| 1528 | 1528 | $agreement = trim($args->agreement); |
| 1529 | 1529 | unset($args->agreement); |
| 1530 | 1530 | |
| 1531 | 1531 | $oModuleController = getController('module'); |
| 1532 | - $output = $oModuleController->insertModuleConfig('member',$args); |
|
| 1533 | - if(!$output->toBool()) return $output; |
|
| 1532 | + $output = $oModuleController->insertModuleConfig('member', $args); |
|
| 1533 | + if (!$output->toBool()) return $output; |
|
| 1534 | 1534 | |
| 1535 | 1535 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1536 | 1536 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1551,11 +1551,11 @@ discard block |
||
| 1551 | 1551 | $signature = trim(removeHackTag($signature)); |
| 1552 | 1552 | $signature = preg_replace('/<(\/?)(embed|object|param)/is', '<$1$2', $signature); |
| 1553 | 1553 | |
| 1554 | - $check_signature = trim(str_replace(array(' ',"\n","\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1554 | + $check_signature = trim(str_replace(array(' ', "\n", "\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1555 | 1555 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1556 | 1556 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1557 | 1557 | |
| 1558 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1558 | + if (!$check_signature) return FileHandler::removeFile($filename); |
|
| 1559 | 1559 | |
| 1560 | 1560 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1561 | 1561 | FileHandler::makeDir($path); |
@@ -1584,15 +1584,15 @@ discard block |
||
| 1584 | 1584 | * |
| 1585 | 1585 | * @return BaseObject |
| 1586 | 1586 | */ |
| 1587 | - function addMemberToGroup($member_srl, $group_srl, $site_srl=0) |
|
| 1587 | + function addMemberToGroup($member_srl, $group_srl, $site_srl = 0) |
|
| 1588 | 1588 | { |
| 1589 | 1589 | $args = new stdClass(); |
| 1590 | 1590 | $args->member_srl = $member_srl; |
| 1591 | 1591 | $args->group_srl = $group_srl; |
| 1592 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1592 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1593 | 1593 | |
| 1594 | 1594 | // Add |
| 1595 | - $output = executeQuery('member.addMemberToGroup',$args); |
|
| 1595 | + $output = executeQuery('member.addMemberToGroup', $args); |
|
| 1596 | 1596 | $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); |
| 1597 | 1597 | |
| 1598 | 1598 | $this->_clearMemberCache($member_srl, $site_srl); |
@@ -1612,18 +1612,18 @@ discard block |
||
| 1612 | 1612 | { |
| 1613 | 1613 | $obj = new stdClass; |
| 1614 | 1614 | $obj->site_srl = $args->site_srl; |
| 1615 | - $obj->member_srl = implode(',',$args->member_srl); |
|
| 1615 | + $obj->member_srl = implode(',', $args->member_srl); |
|
| 1616 | 1616 | |
| 1617 | 1617 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1618 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1618 | + if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1619 | 1619 | |
| 1620 | 1620 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1621 | - if(!$output->toBool()) return $output; |
|
| 1621 | + if (!$output->toBool()) return $output; |
|
| 1622 | 1622 | |
| 1623 | 1623 | $inserted_members = array(); |
| 1624 | - foreach($args->member_srl as $key => $val) |
|
| 1624 | + foreach ($args->member_srl as $key => $val) |
|
| 1625 | 1625 | { |
| 1626 | - if($inserted_members[$val]) continue; |
|
| 1626 | + if ($inserted_members[$val]) continue; |
|
| 1627 | 1627 | $inserted_members[$val] = true; |
| 1628 | 1628 | |
| 1629 | 1629 | unset($obj); |
@@ -1633,7 +1633,7 @@ discard block |
||
| 1633 | 1633 | $obj->site_srl = $args->site_srl; |
| 1634 | 1634 | $obj->regdate = $date[$obj->member_srl]; |
| 1635 | 1635 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1636 | - if(!$output->toBool()) return $output; |
|
| 1636 | + if (!$output->toBool()) return $output; |
|
| 1637 | 1637 | |
| 1638 | 1638 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1639 | 1639 | } |
@@ -1655,9 +1655,9 @@ discard block |
||
| 1655 | 1655 | // Get information of the key |
| 1656 | 1656 | $output = executeQuery('member.getAutologin', $args); |
| 1657 | 1657 | // If no information exists, delete a cookie |
| 1658 | - if(!$output->toBool() || !$output->data) |
|
| 1658 | + if (!$output->toBool() || !$output->data) |
|
| 1659 | 1659 | { |
| 1660 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1660 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1661 | 1661 | return; |
| 1662 | 1662 | } |
| 1663 | 1663 | |
@@ -1667,9 +1667,9 @@ discard block |
||
| 1667 | 1667 | $user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address; |
| 1668 | 1668 | $password = $output->data->password; |
| 1669 | 1669 | |
| 1670 | - if(!$user_id || !$password) |
|
| 1670 | + if (!$user_id || !$password) |
|
| 1671 | 1671 | { |
| 1672 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1672 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1673 | 1673 | return; |
| 1674 | 1674 | } |
| 1675 | 1675 | |
@@ -1679,7 +1679,7 @@ discard block |
||
| 1679 | 1679 | $check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT']; |
| 1680 | 1680 | $check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32); |
| 1681 | 1681 | |
| 1682 | - if($check_key === substr($args->autologin_key, 32)) |
|
| 1682 | + if ($check_key === substr($args->autologin_key, 32)) |
|
| 1683 | 1683 | { |
| 1684 | 1684 | // Check change_password_date |
| 1685 | 1685 | $oModuleModel = getModel('module'); |
@@ -1687,12 +1687,12 @@ discard block |
||
| 1687 | 1687 | $limit_date = $member_config->change_password_date; |
| 1688 | 1688 | |
| 1689 | 1689 | // Check if change_password_date is set |
| 1690 | - if($limit_date > 0) |
|
| 1690 | + if ($limit_date > 0) |
|
| 1691 | 1691 | { |
| 1692 | 1692 | $oMemberModel = getModel('member'); |
| 1693 | 1693 | $columnList = array('member_srl', 'change_password_date'); |
| 1694 | 1694 | |
| 1695 | - if($config->identifier == 'user_id') |
|
| 1695 | + if ($config->identifier == 'user_id') |
|
| 1696 | 1696 | { |
| 1697 | 1697 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1698 | 1698 | } |
@@ -1701,7 +1701,7 @@ discard block |
||
| 1701 | 1701 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | - if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){ |
|
| 1704 | + if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) { |
|
| 1705 | 1705 | $do_auto_login = true; |
| 1706 | 1706 | } |
| 1707 | 1707 | |
@@ -1712,14 +1712,14 @@ discard block |
||
| 1712 | 1712 | } |
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | - if($do_auto_login) |
|
| 1715 | + if ($do_auto_login) |
|
| 1716 | 1716 | { |
| 1717 | 1717 | $output = $this->doLogin($user_id); |
| 1718 | 1718 | } |
| 1719 | 1719 | else |
| 1720 | 1720 | { |
| 1721 | 1721 | executeQuery('member.deleteAutologin', $args); |
| 1722 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1722 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1723 | 1723 | } |
| 1724 | 1724 | } |
| 1725 | 1725 | |
@@ -1735,13 +1735,13 @@ discard block |
||
| 1735 | 1735 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1736 | 1736 | { |
| 1737 | 1737 | $user_id = strtolower($user_id); |
| 1738 | - if(!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 1738 | + if (!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 1739 | 1739 | // Call a trigger before log-in (before) |
| 1740 | 1740 | $trigger_obj = new stdClass(); |
| 1741 | 1741 | $trigger_obj->user_id = $user_id; |
| 1742 | 1742 | $trigger_obj->password = $password; |
| 1743 | 1743 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1744 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1744 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1745 | 1745 | // Create a member model object |
| 1746 | 1746 | $oMemberModel = getModel('member'); |
| 1747 | 1747 | |
@@ -1751,12 +1751,12 @@ discard block |
||
| 1751 | 1751 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1752 | 1752 | |
| 1753 | 1753 | // check identifier |
| 1754 | - if($config->identifier == 'email_address') |
|
| 1754 | + if ($config->identifier == 'email_address') |
|
| 1755 | 1755 | { |
| 1756 | 1756 | // Get user_id information |
| 1757 | 1757 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1758 | 1758 | // Set an invalid user if no value returned |
| 1759 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1759 | + if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1760 | 1760 | |
| 1761 | 1761 | } |
| 1762 | 1762 | else |
@@ -1764,24 +1764,24 @@ discard block |
||
| 1764 | 1764 | // Get user_id information |
| 1765 | 1765 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1766 | 1766 | // Set an invalid user if no value returned |
| 1767 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1767 | + if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1768 | 1768 | } |
| 1769 | 1769 | |
| 1770 | 1770 | $output = executeQuery('member.getLoginCountByIp', $args); |
| 1771 | 1771 | $errorCount = $output->data->count; |
| 1772 | - if($errorCount >= $config->max_error_count) |
|
| 1772 | + if ($errorCount >= $config->max_error_count) |
|
| 1773 | 1773 | { |
| 1774 | 1774 | $last_update = strtotime($output->data->last_update); |
| 1775 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
| 1776 | - if($term < $config->max_error_count_time) |
|
| 1775 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
| 1776 | + if ($term < $config->max_error_count_time) |
|
| 1777 | 1777 | { |
| 1778 | 1778 | $term = $config->max_error_count_time - $term; |
| 1779 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1780 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1781 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1782 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1779 | + if ($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1780 | + elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min'); |
|
| 1781 | + elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour'); |
|
| 1782 | + else $term = intval($term / 86400).Context::getLang('unit_day'); |
|
| 1783 | 1783 | |
| 1784 | - return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
|
| 1784 | + return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'), $term)); |
|
| 1785 | 1785 | } |
| 1786 | 1786 | else |
| 1787 | 1787 | { |
@@ -1791,13 +1791,13 @@ discard block |
||
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | 1793 | // Password Check |
| 1794 | - if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1794 | + if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1795 | 1795 | { |
| 1796 | - return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo); |
|
| 1796 | + return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo); |
|
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | // If denied == 'Y', notify |
| 1800 | - if($this->memberInfo->denied == 'Y') |
|
| 1800 | + if ($this->memberInfo->denied == 'Y') |
|
| 1801 | 1801 | { |
| 1802 | 1802 | $args->member_srl = $this->memberInfo->member_srl; |
| 1803 | 1803 | $output = executeQuery('member.chkAuthMail', $args); |
@@ -1805,12 +1805,12 @@ discard block |
||
| 1805 | 1805 | { |
| 1806 | 1806 | $_SESSION['auth_member_srl'] = $this->memberInfo->member_srl; |
| 1807 | 1807 | $redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail'); |
| 1808 | - return $this->setRedirectUrl($redirectUrl, new BaseObject(-1,'msg_user_not_confirmed')); |
|
| 1808 | + return $this->setRedirectUrl($redirectUrl, new BaseObject(-1, 'msg_user_not_confirmed')); |
|
| 1809 | 1809 | } |
| 1810 | - return new BaseObject(-1,'msg_user_denied'); |
|
| 1810 | + return new BaseObject(-1, 'msg_user_denied'); |
|
| 1811 | 1811 | } |
| 1812 | 1812 | // Notify if denied_date is less than the current time |
| 1813 | - 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"))); |
|
| 1813 | + 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"))); |
|
| 1814 | 1814 | // Update the latest login time |
| 1815 | 1815 | $args->member_srl = $this->memberInfo->member_srl; |
| 1816 | 1816 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1820,36 +1820,36 @@ discard block |
||
| 1820 | 1820 | |
| 1821 | 1821 | // Check if there is recoding table. |
| 1822 | 1822 | $oDB = &DB::getInstance(); |
| 1823 | - if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1823 | + if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1824 | 1824 | { |
| 1825 | 1825 | // check if there is login fail records. |
| 1826 | 1826 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
| 1827 | - if($output->data && $output->data->content) |
|
| 1827 | + if ($output->data && $output->data->content) |
|
| 1828 | 1828 | { |
| 1829 | 1829 | $title = Context::getLang('login_fail_report'); |
| 1830 | 1830 | $message = '<ul>'; |
| 1831 | 1831 | $content = unserialize($output->data->content); |
| 1832 | - if(count($content) > $config->max_error_count) |
|
| 1832 | + if (count($content) > $config->max_error_count) |
|
| 1833 | 1833 | { |
| 1834 | - foreach($content as $val) |
|
| 1834 | + foreach ($content as $val) |
|
| 1835 | 1835 | { |
| 1836 | - $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>'; |
|
| 1836 | + $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>'; |
|
| 1837 | 1837 | } |
| 1838 | 1838 | $message .= '</ul>'; |
| 1839 | - $content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa')); |
|
| 1839 | + $content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa')); |
|
| 1840 | 1840 | |
| 1841 | 1841 | //send message |
| 1842 | 1842 | $oCommunicationController = getController('communication'); |
| 1843 | 1843 | $oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true); |
| 1844 | 1844 | |
| 1845 | - if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1845 | + if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1846 | 1846 | { |
| 1847 | 1847 | $view_url = Context::getRequestUri(); |
| 1848 | - $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); |
|
| 1848 | + $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); |
|
| 1849 | 1849 | $oMail = new Mail(); |
| 1850 | 1850 | $oMail->setTitle($title); |
| 1851 | 1851 | $oMail->setContent($content); |
| 1852 | - $oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email); |
|
| 1852 | + $oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email); |
|
| 1853 | 1853 | $oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address); |
| 1854 | 1854 | $oMail->send(); |
| 1855 | 1855 | } |
@@ -1859,9 +1859,9 @@ discard block |
||
| 1859 | 1859 | } |
| 1860 | 1860 | // Call a trigger after successfully log-in (after) |
| 1861 | 1861 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1862 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1862 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1863 | 1863 | // When user checked to use auto-login |
| 1864 | - if($keep_signed) |
|
| 1864 | + if ($keep_signed) |
|
| 1865 | 1865 | { |
| 1866 | 1866 | // Key generate for auto login |
| 1867 | 1867 | $oPassword = new Password(); |
@@ -1873,12 +1873,12 @@ discard block |
||
| 1873 | 1873 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1874 | 1874 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1875 | 1875 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1876 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 1876 | + if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000); |
|
| 1877 | 1877 | } |
| 1878 | - if($this->memberInfo->is_admin == 'Y') |
|
| 1878 | + if ($this->memberInfo->is_admin == 'Y') |
|
| 1879 | 1879 | { |
| 1880 | 1880 | $oMemberAdminModel = getAdminModel('member'); |
| 1881 | - if(!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1881 | + if (!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1882 | 1882 | { |
| 1883 | 1883 | $_SESSION['denied_admin'] = 'Y'; |
| 1884 | 1884 | } |
@@ -1896,18 +1896,18 @@ discard block |
||
| 1896 | 1896 | { |
| 1897 | 1897 | $oMemberModel = getModel('member'); |
| 1898 | 1898 | // If your information came through the current session information to extract information from the users |
| 1899 | - if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) |
|
| 1899 | + if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged()) |
|
| 1900 | 1900 | { |
| 1901 | 1901 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); |
| 1902 | 1902 | // If you do not destroy the session Profile |
| 1903 | - if($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 1903 | + if ($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 1904 | 1904 | { |
| 1905 | 1905 | $this->destroySessionInfo(); |
| 1906 | 1906 | return; |
| 1907 | 1907 | } |
| 1908 | 1908 | } |
| 1909 | 1909 | // Stop using the session id is destroyed |
| 1910 | - if($this->memberInfo->denied=='Y') |
|
| 1910 | + if ($this->memberInfo->denied == 'Y') |
|
| 1911 | 1911 | { |
| 1912 | 1912 | $this->destroySessionInfo(); |
| 1913 | 1913 | return; |
@@ -1937,10 +1937,10 @@ discard block |
||
| 1937 | 1937 | Context::set('logged_info', $this->memberInfo); |
| 1938 | 1938 | |
| 1939 | 1939 | // Only the menu configuration of the user (such as an add-on to the menu can be changed) |
| 1940 | - $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); |
|
| 1941 | - $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 1942 | - $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 1943 | - $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 1940 | + $this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info'); |
|
| 1941 | + $this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 1942 | + $this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 1943 | + $this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 1944 | 1944 | } |
| 1945 | 1945 | |
| 1946 | 1946 | /** |
@@ -1962,7 +1962,7 @@ discard block |
||
| 1962 | 1962 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 1963 | 1963 | { |
| 1964 | 1964 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 1965 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 1965 | + if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 1966 | 1966 | |
| 1967 | 1967 | $obj = new stdClass; |
| 1968 | 1968 | $obj->url = $url; |
@@ -1981,33 +1981,33 @@ discard block |
||
| 1981 | 1981 | { |
| 1982 | 1982 | // Call a trigger (before) |
| 1983 | 1983 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 1984 | - if(!$output->toBool()) return $output; |
|
| 1984 | + if (!$output->toBool()) return $output; |
|
| 1985 | 1985 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 1986 | 1986 | $oModuleModel = getModel('module'); |
| 1987 | 1987 | $config = $oModuleModel->getModuleConfig('member'); |
| 1988 | 1988 | |
| 1989 | 1989 | $logged_info = Context::get('logged_info'); |
| 1990 | 1990 | // If the date of the temporary restrictions limit further information on the date of |
| 1991 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 1991 | + if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24); |
|
| 1992 | 1992 | |
| 1993 | 1993 | $args->member_srl = getNextSequence(); |
| 1994 | 1994 | $args->list_order = -1 * $args->member_srl; |
| 1995 | 1995 | |
| 1996 | 1996 | // Execute insert or update depending on the value of member_srl |
| 1997 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 1997 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 1998 | 1998 | // Enter the user's identity changed to lowercase |
| 1999 | 1999 | else $args->user_id = strtolower($args->user_id); |
| 2000 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2001 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2000 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2001 | + if (!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2002 | 2002 | |
| 2003 | 2003 | // Control of essential parameters |
| 2004 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2005 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2006 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 2004 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2005 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2006 | + if (!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F')))) $args->allow_message = 'Y'; |
|
| 2007 | 2007 | |
| 2008 | - if($logged_info->is_admin == 'Y') |
|
| 2008 | + if ($logged_info->is_admin == 'Y') |
|
| 2009 | 2009 | { |
| 2010 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 2010 | + if ($args->is_admin != 'Y') $args->is_admin = 'N'; |
|
| 2011 | 2011 | } |
| 2012 | 2012 | else |
| 2013 | 2013 | { |
@@ -2022,97 +2022,97 @@ discard block |
||
| 2022 | 2022 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2023 | 2023 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2024 | 2024 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2025 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2026 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2025 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2026 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2027 | 2027 | |
| 2028 | 2028 | // Create a model object |
| 2029 | 2029 | $oMemberModel = getModel('member'); |
| 2030 | 2030 | |
| 2031 | 2031 | // Check password strength |
| 2032 | - if($args->password && !$password_is_hashed) |
|
| 2032 | + if ($args->password && !$password_is_hashed) |
|
| 2033 | 2033 | { |
| 2034 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2034 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2035 | 2035 | { |
| 2036 | 2036 | $message = Context::getLang('about_password_strength'); |
| 2037 | 2037 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2038 | 2038 | } |
| 2039 | 2039 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2040 | 2040 | } |
| 2041 | - elseif(!$args->password) |
|
| 2041 | + elseif (!$args->password) |
|
| 2042 | 2042 | { |
| 2043 | 2043 | unset($args->password); |
| 2044 | 2044 | } |
| 2045 | 2045 | |
| 2046 | - if($args->find_account_answer && !$password_is_hashed) |
|
| 2046 | + if ($args->find_account_answer && !$password_is_hashed) |
|
| 2047 | 2047 | { |
| 2048 | 2048 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2049 | 2049 | } |
| 2050 | - elseif(!$args->find_account_answer) |
|
| 2050 | + elseif (!$args->find_account_answer) |
|
| 2051 | 2051 | { |
| 2052 | 2052 | unset($args->find_account_answer); |
| 2053 | 2053 | } |
| 2054 | 2054 | |
| 2055 | 2055 | // Check if ID is prohibited |
| 2056 | - if($oMemberModel->isDeniedID($args->user_id)) |
|
| 2056 | + if ($oMemberModel->isDeniedID($args->user_id)) |
|
| 2057 | 2057 | { |
| 2058 | - return new BaseObject(-1,'denied_user_id'); |
|
| 2058 | + return new BaseObject(-1, 'denied_user_id'); |
|
| 2059 | 2059 | } |
| 2060 | 2060 | |
| 2061 | 2061 | // Check if ID is duplicate |
| 2062 | 2062 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2063 | - if($member_srl) |
|
| 2063 | + if ($member_srl) |
|
| 2064 | 2064 | { |
| 2065 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2065 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2066 | 2066 | } |
| 2067 | 2067 | |
| 2068 | 2068 | // Check if nickname is prohibited |
| 2069 | - if($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2069 | + if ($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2070 | 2070 | { |
| 2071 | - return new BaseObject(-1,'denied_nick_name'); |
|
| 2071 | + return new BaseObject(-1, 'denied_nick_name'); |
|
| 2072 | 2072 | } |
| 2073 | 2073 | |
| 2074 | 2074 | // Check if nickname is duplicate |
| 2075 | 2075 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2076 | - if($member_srl) |
|
| 2076 | + if ($member_srl) |
|
| 2077 | 2077 | { |
| 2078 | - return new BaseObject(-1,'msg_exists_nick_name'); |
|
| 2078 | + return new BaseObject(-1, 'msg_exists_nick_name'); |
|
| 2079 | 2079 | } |
| 2080 | 2080 | |
| 2081 | 2081 | // Check if email address is duplicate |
| 2082 | 2082 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2083 | - if($member_srl) |
|
| 2083 | + if ($member_srl) |
|
| 2084 | 2084 | { |
| 2085 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2085 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2086 | 2086 | } |
| 2087 | 2087 | |
| 2088 | 2088 | // Insert data into the DB |
| 2089 | 2089 | $args->list_order = -1 * $args->member_srl; |
| 2090 | 2090 | |
| 2091 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2092 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2091 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2092 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2093 | 2093 | |
| 2094 | 2094 | $oDB = &DB::getInstance(); |
| 2095 | 2095 | $oDB->begin(); |
| 2096 | 2096 | |
| 2097 | 2097 | $output = executeQuery('member.insertMember', $args); |
| 2098 | - if(!$output->toBool()) |
|
| 2098 | + if (!$output->toBool()) |
|
| 2099 | 2099 | { |
| 2100 | 2100 | $oDB->rollback(); |
| 2101 | 2101 | return $output; |
| 2102 | 2102 | } |
| 2103 | 2103 | |
| 2104 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2104 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2105 | 2105 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2106 | 2106 | // If no value is entered the default group, the value of group registration |
| 2107 | - if(!$args->group_srl_list) |
|
| 2107 | + if (!$args->group_srl_list) |
|
| 2108 | 2108 | { |
| 2109 | 2109 | $columnList = array('site_srl', 'group_srl'); |
| 2110 | 2110 | $default_group = $oMemberModel->getDefaultGroup(0, $columnList); |
| 2111 | - if($default_group) |
|
| 2111 | + if ($default_group) |
|
| 2112 | 2112 | { |
| 2113 | 2113 | // Add to the default group |
| 2114 | - $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); |
|
| 2115 | - if(!$output->toBool()) |
|
| 2114 | + $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); |
|
| 2115 | + if (!$output->toBool()) |
|
| 2116 | 2116 | { |
| 2117 | 2117 | $oDB->rollback(); |
| 2118 | 2118 | return $output; |
@@ -2122,11 +2122,11 @@ discard block |
||
| 2122 | 2122 | } |
| 2123 | 2123 | else |
| 2124 | 2124 | { |
| 2125 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2125 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2126 | 2126 | { |
| 2127 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2127 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2128 | 2128 | |
| 2129 | - if(!$output->toBool()) |
|
| 2129 | + if (!$output->toBool()) |
|
| 2130 | 2130 | { |
| 2131 | 2131 | $oDB->rollback(); |
| 2132 | 2132 | return $output; |
@@ -2136,7 +2136,7 @@ discard block |
||
| 2136 | 2136 | |
| 2137 | 2137 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2138 | 2138 | // When using email authentication mode (when you subscribed members denied a) certified mail sent |
| 2139 | - if($args->denied == 'Y') |
|
| 2139 | + if ($args->denied == 'Y') |
|
| 2140 | 2140 | { |
| 2141 | 2141 | // Insert data into the authentication DB |
| 2142 | 2142 | $oPassword = new Password(); |
@@ -2148,7 +2148,7 @@ discard block |
||
| 2148 | 2148 | $auth_args->is_register = 'Y'; |
| 2149 | 2149 | |
| 2150 | 2150 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2151 | - if(!$output->toBool()) |
|
| 2151 | + if (!$output->toBool()) |
|
| 2152 | 2152 | { |
| 2153 | 2153 | $oDB->rollback(); |
| 2154 | 2154 | return $output; |
@@ -2156,10 +2156,10 @@ discard block |
||
| 2156 | 2156 | $this->_sendAuthMail($auth_args, $args); |
| 2157 | 2157 | } |
| 2158 | 2158 | // Call a trigger (after) |
| 2159 | - if($output->toBool()) |
|
| 2159 | + if ($output->toBool()) |
|
| 2160 | 2160 | { |
| 2161 | 2161 | $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); |
| 2162 | - if(!$trigger_output->toBool()) |
|
| 2162 | + if (!$trigger_output->toBool()) |
|
| 2163 | 2163 | { |
| 2164 | 2164 | $oDB->rollback(); |
| 2165 | 2165 | return $trigger_output; |
@@ -2181,41 +2181,41 @@ discard block |
||
| 2181 | 2181 | { |
| 2182 | 2182 | // Call a trigger (before) |
| 2183 | 2183 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2184 | - if(!$output->toBool()) return $output; |
|
| 2184 | + if (!$output->toBool()) return $output; |
|
| 2185 | 2185 | // Create a model object |
| 2186 | 2186 | $oMemberModel = getModel('member'); |
| 2187 | 2187 | |
| 2188 | 2188 | $logged_info = Context::get('logged_info'); |
| 2189 | 2189 | // Get what you want to modify the original information |
| 2190 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2190 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2191 | 2191 | // Control of essential parameters |
| 2192 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2193 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2192 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2193 | + if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y'; |
|
| 2194 | 2194 | |
| 2195 | - if($logged_info->is_admin == 'Y') |
|
| 2195 | + if ($logged_info->is_admin == 'Y') |
|
| 2196 | 2196 | { |
| 2197 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2198 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2197 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2198 | + if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2199 | 2199 | } |
| 2200 | 2200 | else |
| 2201 | 2201 | { |
| 2202 | 2202 | unset($args->is_admin); |
| 2203 | - if($is_admin == false) |
|
| 2203 | + if ($is_admin == false) |
|
| 2204 | 2204 | unset($args->denied); |
| 2205 | - if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2205 | + if ($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2206 | 2206 | { |
| 2207 | 2207 | return $this->stop('msg_invalid_request'); |
| 2208 | 2208 | } |
| 2209 | 2209 | } |
| 2210 | 2210 | |
| 2211 | 2211 | // Sanitize user ID, username, nickname, homepage, blog |
| 2212 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2212 | + if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2213 | 2213 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2214 | 2214 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2215 | 2215 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2216 | 2216 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2217 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2218 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2217 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2218 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2219 | 2219 | |
| 2220 | 2220 | // check member identifier form |
| 2221 | 2221 | $config = $oMemberModel->getMemberConfig(); |
@@ -2224,56 +2224,56 @@ discard block |
||
| 2224 | 2224 | $orgMemberInfo = $output->data; |
| 2225 | 2225 | |
| 2226 | 2226 | // Check if email address or user ID is duplicate |
| 2227 | - if($config->identifier == 'email_address') |
|
| 2227 | + if ($config->identifier == 'email_address') |
|
| 2228 | 2228 | { |
| 2229 | 2229 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2230 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2230 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2231 | 2231 | { |
| 2232 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2232 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2233 | 2233 | } |
| 2234 | 2234 | $args->email_address = $orgMemberInfo->email_address; |
| 2235 | 2235 | } |
| 2236 | 2236 | else |
| 2237 | 2237 | { |
| 2238 | 2238 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2239 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2239 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2240 | 2240 | { |
| 2241 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2241 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2242 | 2242 | } |
| 2243 | 2243 | |
| 2244 | 2244 | $args->user_id = $orgMemberInfo->user_id; |
| 2245 | 2245 | } |
| 2246 | 2246 | |
| 2247 | - if($logged_info->is_admin !== 'Y') |
|
| 2247 | + if ($logged_info->is_admin !== 'Y') |
|
| 2248 | 2248 | { |
| 2249 | 2249 | // Check if ID is prohibited |
| 2250 | - if($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2250 | + if ($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2251 | 2251 | { |
| 2252 | - return new BaseObject(-1,'denied_user_id'); |
|
| 2252 | + return new BaseObject(-1, 'denied_user_id'); |
|
| 2253 | 2253 | } |
| 2254 | 2254 | |
| 2255 | 2255 | // Check if nickname is prohibited |
| 2256 | - if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2256 | + if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2257 | 2257 | { |
| 2258 | 2258 | return new BaseObject(-1, 'denied_nick_name'); |
| 2259 | 2259 | } |
| 2260 | 2260 | } |
| 2261 | 2261 | |
| 2262 | 2262 | // Check if ID is duplicate |
| 2263 | - if($args->user_id) |
|
| 2263 | + if ($args->user_id) |
|
| 2264 | 2264 | { |
| 2265 | 2265 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2266 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2266 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2267 | 2267 | { |
| 2268 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2268 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2269 | 2269 | } |
| 2270 | 2270 | } |
| 2271 | 2271 | |
| 2272 | 2272 | // Check if nickname is duplicate |
| 2273 | 2273 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2274 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2274 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2275 | 2275 | { |
| 2276 | - return new BaseObject(-1,'msg_exists_nick_name'); |
|
| 2276 | + return new BaseObject(-1, 'msg_exists_nick_name'); |
|
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | 2279 | list($args->email_id, $args->email_host) = explode('@', $args->email_address); |
@@ -2282,9 +2282,9 @@ discard block |
||
| 2282 | 2282 | $oDB->begin(); |
| 2283 | 2283 | |
| 2284 | 2284 | // Check password strength |
| 2285 | - if($args->password) |
|
| 2285 | + if ($args->password) |
|
| 2286 | 2286 | { |
| 2287 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2287 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2288 | 2288 | { |
| 2289 | 2289 | $message = Context::getLang('about_password_strength'); |
| 2290 | 2290 | return new BaseObject(-1, $message[$config->password_strength]); |
@@ -2296,55 +2296,55 @@ discard block |
||
| 2296 | 2296 | $args->password = $orgMemberInfo->password; |
| 2297 | 2297 | } |
| 2298 | 2298 | |
| 2299 | - if($args->find_account_answer) { |
|
| 2299 | + if ($args->find_account_answer) { |
|
| 2300 | 2300 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2301 | 2301 | } |
| 2302 | 2302 | else |
| 2303 | 2303 | { |
| 2304 | - $oPassword = new Password(); |
|
| 2304 | + $oPassword = new Password(); |
|
| 2305 | 2305 | $hashed = $oPassword->checkAlgorithm($orgMemberInfo->find_account_answer); |
| 2306 | 2306 | |
| 2307 | - if($hashed) { |
|
| 2307 | + if ($hashed) { |
|
| 2308 | 2308 | $args->find_account_answer = $orgMemberInfo->find_account_answer; |
| 2309 | 2309 | } else { |
| 2310 | 2310 | $args->find_account_answer = $oPassword->createHash($orgMemberInfo->find_account_answer); |
| 2311 | 2311 | } |
| 2312 | 2312 | } |
| 2313 | 2313 | |
| 2314 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2315 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2316 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2317 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2318 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2314 | + if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2315 | + if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2316 | + if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2317 | + if (!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2318 | + if (!$args->birthday) $args->birthday = ''; |
|
| 2319 | 2319 | |
| 2320 | 2320 | $output = executeQuery('member.updateMember', $args); |
| 2321 | 2321 | |
| 2322 | - if(!$output->toBool()) |
|
| 2322 | + if (!$output->toBool()) |
|
| 2323 | 2323 | { |
| 2324 | 2324 | $oDB->rollback(); |
| 2325 | 2325 | return $output; |
| 2326 | 2326 | } |
| 2327 | 2327 | |
| 2328 | - if($args->group_srl_list) |
|
| 2328 | + if ($args->group_srl_list) |
|
| 2329 | 2329 | { |
| 2330 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2330 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2331 | 2331 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2332 | 2332 | // If the group information, group information changes |
| 2333 | - if(count($group_srl_list) > 0) |
|
| 2333 | + if (count($group_srl_list) > 0) |
|
| 2334 | 2334 | { |
| 2335 | 2335 | $args->site_srl = 0; |
| 2336 | 2336 | // One of its members to delete all the group |
| 2337 | 2337 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2338 | - if(!$output->toBool()) |
|
| 2338 | + if (!$output->toBool()) |
|
| 2339 | 2339 | { |
| 2340 | 2340 | $oDB->rollback(); |
| 2341 | 2341 | return $output; |
| 2342 | 2342 | } |
| 2343 | 2343 | // Enter one of the loop a |
| 2344 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2344 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2345 | 2345 | { |
| 2346 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2347 | - if(!$output->toBool()) |
|
| 2346 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2347 | + if (!$output->toBool()) |
|
| 2348 | 2348 | { |
| 2349 | 2349 | $oDB->rollback(); |
| 2350 | 2350 | return $output; |
@@ -2356,9 +2356,9 @@ discard block |
||
| 2356 | 2356 | } |
| 2357 | 2357 | } |
| 2358 | 2358 | // Call a trigger (after) |
| 2359 | - if($output->toBool()) { |
|
| 2359 | + if ($output->toBool()) { |
|
| 2360 | 2360 | $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); |
| 2361 | - if(!$trigger_output->toBool()) |
|
| 2361 | + if (!$trigger_output->toBool()) |
|
| 2362 | 2362 | { |
| 2363 | 2363 | $oDB->rollback(); |
| 2364 | 2364 | return $trigger_output; |
@@ -2371,7 +2371,7 @@ discard block |
||
| 2371 | 2371 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2372 | 2372 | |
| 2373 | 2373 | // Save Session |
| 2374 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2374 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2375 | 2375 | $logged_info = Context::get('logged_info'); |
| 2376 | 2376 | |
| 2377 | 2377 | $output->add('member_srl', $args->member_srl); |
@@ -2383,14 +2383,14 @@ discard block |
||
| 2383 | 2383 | */ |
| 2384 | 2384 | function updateMemberPassword($args) |
| 2385 | 2385 | { |
| 2386 | - if($args->password) |
|
| 2386 | + if ($args->password) |
|
| 2387 | 2387 | { |
| 2388 | 2388 | |
| 2389 | 2389 | // check password strength |
| 2390 | 2390 | $oMemberModel = getModel('member'); |
| 2391 | 2391 | $config = $oMemberModel->getMemberConfig(); |
| 2392 | 2392 | |
| 2393 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2393 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2394 | 2394 | { |
| 2395 | 2395 | $message = Context::getLang('about_password_strength'); |
| 2396 | 2396 | return new BaseObject(-1, $message[$config->password_strength]); |
@@ -2398,13 +2398,13 @@ discard block |
||
| 2398 | 2398 | |
| 2399 | 2399 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2400 | 2400 | } |
| 2401 | - else if($args->hashed_password) |
|
| 2401 | + else if ($args->hashed_password) |
|
| 2402 | 2402 | { |
| 2403 | 2403 | $args->password = $args->hashed_password; |
| 2404 | 2404 | } |
| 2405 | 2405 | |
| 2406 | 2406 | $output = executeQuery('member.updateMemberPassword', $args); |
| 2407 | - if($output->toBool()) |
|
| 2407 | + if ($output->toBool()) |
|
| 2408 | 2408 | { |
| 2409 | 2409 | $result = executeQuery('member.updateChangePasswordDate', $args); |
| 2410 | 2410 | } |
@@ -2416,7 +2416,7 @@ discard block |
||
| 2416 | 2416 | |
| 2417 | 2417 | function updateFindAccountAnswer($member_srl, $answer) |
| 2418 | 2418 | { |
| 2419 | - $oPassword = new Password(); |
|
| 2419 | + $oPassword = new Password(); |
|
| 2420 | 2420 | |
| 2421 | 2421 | $args = new stdClass(); |
| 2422 | 2422 | $args->member_srl = $member_srl; |
@@ -2433,18 +2433,18 @@ discard block |
||
| 2433 | 2433 | $trigger_obj = new stdClass(); |
| 2434 | 2434 | $trigger_obj->member_srl = $member_srl; |
| 2435 | 2435 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2436 | - if(!$output->toBool()) return $output; |
|
| 2436 | + if (!$output->toBool()) return $output; |
|
| 2437 | 2437 | // Create a model object |
| 2438 | 2438 | $oMemberModel = getModel('member'); |
| 2439 | 2439 | // Bringing the user's information |
| 2440 | - if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2440 | + if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2441 | 2441 | { |
| 2442 | 2442 | $columnList = array('member_srl', 'is_admin'); |
| 2443 | 2443 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2444 | 2444 | } |
| 2445 | - if(!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2445 | + if (!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2446 | 2446 | // If managers can not be deleted |
| 2447 | - if($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2447 | + if ($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2448 | 2448 | |
| 2449 | 2449 | $oDB = &DB::getInstance(); |
| 2450 | 2450 | $oDB->begin(); |
@@ -2453,7 +2453,7 @@ discard block |
||
| 2453 | 2453 | $args->member_srl = $member_srl; |
| 2454 | 2454 | // Delete the entries in member_auth_mail |
| 2455 | 2455 | $output = executeQuery('member.deleteAuthMail', $args); |
| 2456 | - if(!$output->toBool()) |
|
| 2456 | + if (!$output->toBool()) |
|
| 2457 | 2457 | { |
| 2458 | 2458 | $oDB->rollback(); |
| 2459 | 2459 | return $output; |
@@ -2468,23 +2468,23 @@ discard block |
||
| 2468 | 2468 | */ |
| 2469 | 2469 | // Delete the entries in member_group_member |
| 2470 | 2470 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2471 | - if(!$output->toBool()) |
|
| 2471 | + if (!$output->toBool()) |
|
| 2472 | 2472 | { |
| 2473 | 2473 | $oDB->rollback(); |
| 2474 | 2474 | return $output; |
| 2475 | 2475 | } |
| 2476 | 2476 | // member removed from the table |
| 2477 | 2477 | $output = executeQuery('member.deleteMember', $args); |
| 2478 | - if(!$output->toBool()) |
|
| 2478 | + if (!$output->toBool()) |
|
| 2479 | 2479 | { |
| 2480 | 2480 | $oDB->rollback(); |
| 2481 | 2481 | return $output; |
| 2482 | 2482 | } |
| 2483 | 2483 | // Call a trigger (after) |
| 2484 | - if($output->toBool()) |
|
| 2484 | + if ($output->toBool()) |
|
| 2485 | 2485 | { |
| 2486 | 2486 | $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); |
| 2487 | - if(!$trigger_output->toBool()) |
|
| 2487 | + if (!$trigger_output->toBool()) |
|
| 2488 | 2488 | { |
| 2489 | 2489 | $oDB->rollback(); |
| 2490 | 2490 | return $trigger_output; |
@@ -2508,23 +2508,23 @@ discard block |
||
| 2508 | 2508 | */ |
| 2509 | 2509 | function destroySessionInfo() |
| 2510 | 2510 | { |
| 2511 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2511 | + if (!$_SESSION || !is_array($_SESSION)) return; |
|
| 2512 | 2512 | |
| 2513 | 2513 | $memberInfo = Context::get('logged_info'); |
| 2514 | 2514 | $memberSrl = $memberInfo->member_srl; |
| 2515 | 2515 | |
| 2516 | - foreach($_SESSION as $key => $val) |
|
| 2516 | + foreach ($_SESSION as $key => $val) |
|
| 2517 | 2517 | { |
| 2518 | 2518 | $_SESSION[$key] = ''; |
| 2519 | 2519 | } |
| 2520 | 2520 | |
| 2521 | 2521 | session_destroy(); |
| 2522 | - setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000); |
|
| 2523 | - setcookie('sso','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2524 | - setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2522 | + setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2523 | + setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2524 | + setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2525 | 2525 | setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000); |
| 2526 | 2526 | |
| 2527 | - if($memberSrl || $_COOKIE['xeak']) |
|
| 2527 | + if ($memberSrl || $_COOKIE['xeak']) |
|
| 2528 | 2528 | { |
| 2529 | 2529 | $args = new stdClass(); |
| 2530 | 2530 | $args->member_srl = $memberSrl; |
@@ -2540,22 +2540,22 @@ discard block |
||
| 2540 | 2540 | $pointGroup = $pointModuleConfig->point_group; |
| 2541 | 2541 | |
| 2542 | 2542 | $levelGroup = array(); |
| 2543 | - if(is_array($pointGroup) && count($pointGroup)>0) |
|
| 2543 | + if (is_array($pointGroup) && count($pointGroup) > 0) |
|
| 2544 | 2544 | { |
| 2545 | 2545 | $levelGroup = array_flip($pointGroup); |
| 2546 | 2546 | ksort($levelGroup); |
| 2547 | 2547 | } |
| 2548 | 2548 | $maxLevel = 0; |
| 2549 | 2549 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2550 | - if(count($resultGroup) > 0) |
|
| 2550 | + if (count($resultGroup) > 0) |
|
| 2551 | 2551 | $maxLevel = max(array_flip($resultGroup)); |
| 2552 | 2552 | |
| 2553 | - if($maxLevel > 0) |
|
| 2553 | + if ($maxLevel > 0) |
|
| 2554 | 2554 | { |
| 2555 | 2555 | $oPointModel = getModel('point'); |
| 2556 | 2556 | $originPoint = $oPointModel->getPoint($memberSrl); |
| 2557 | 2557 | |
| 2558 | - if($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2558 | + if ($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2559 | 2559 | { |
| 2560 | 2560 | $oPointController = getController('point'); |
| 2561 | 2561 | $oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update'); |
@@ -2565,18 +2565,18 @@ discard block |
||
| 2565 | 2565 | |
| 2566 | 2566 | function procMemberModifyEmailAddress() |
| 2567 | 2567 | { |
| 2568 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2568 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2569 | 2569 | |
| 2570 | 2570 | $member_info = Context::get('logged_info'); |
| 2571 | 2571 | $newEmail = Context::get('email_address'); |
| 2572 | 2572 | |
| 2573 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2573 | + if (!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2574 | 2574 | |
| 2575 | 2575 | $oMemberModel = getModel('member'); |
| 2576 | 2576 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2577 | - if($member_srl) return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2577 | + if ($member_srl) return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2578 | 2578 | |
| 2579 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2579 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2580 | 2580 | { |
| 2581 | 2581 | return $this->stop('msg_invalid_request'); |
| 2582 | 2582 | } |
@@ -2592,7 +2592,7 @@ discard block |
||
| 2592 | 2592 | $oDB = &DB::getInstance(); |
| 2593 | 2593 | $oDB->begin(); |
| 2594 | 2594 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2595 | - if(!$output->toBool()) |
|
| 2595 | + if (!$output->toBool()) |
|
| 2596 | 2596 | { |
| 2597 | 2597 | $oDB->rollback(); |
| 2598 | 2598 | return $output; |
@@ -2602,7 +2602,7 @@ discard block |
||
| 2602 | 2602 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2603 | 2603 | |
| 2604 | 2604 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2605 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2605 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2606 | 2606 | |
| 2607 | 2607 | global $lang; |
| 2608 | 2608 | |
@@ -2614,17 +2614,17 @@ discard block |
||
| 2614 | 2614 | |
| 2615 | 2615 | Context::set('newEmail', $newEmail); |
| 2616 | 2616 | |
| 2617 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 2617 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 2618 | 2618 | Context::set('auth_url', $auth_url); |
| 2619 | 2619 | |
| 2620 | 2620 | $oTemplate = &TemplateHandler::getInstance(); |
| 2621 | 2621 | $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); |
| 2622 | 2622 | |
| 2623 | 2623 | $oMail = new Mail(); |
| 2624 | - $oMail->setTitle( Context::getLang('title_modify_email_address') ); |
|
| 2624 | + $oMail->setTitle(Context::getLang('title_modify_email_address')); |
|
| 2625 | 2625 | $oMail->setContent($content); |
| 2626 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 2627 | - $oMail->setReceiptor( $member_info->nick_name, $newEmail ); |
|
| 2626 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 2627 | + $oMail->setReceiptor($member_info->nick_name, $newEmail); |
|
| 2628 | 2628 | $result = $oMail->send(); |
| 2629 | 2629 | |
| 2630 | 2630 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); |
@@ -2638,16 +2638,16 @@ discard block |
||
| 2638 | 2638 | { |
| 2639 | 2639 | $member_srl = Context::get('member_srl'); |
| 2640 | 2640 | $auth_key = Context::get('auth_key'); |
| 2641 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2641 | + if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2642 | 2642 | |
| 2643 | 2643 | // Test logs for finding password by user_id and authkey |
| 2644 | 2644 | $args = new stdClass; |
| 2645 | 2645 | $args->member_srl = $member_srl; |
| 2646 | 2646 | $args->auth_key = $auth_key; |
| 2647 | 2647 | $output = executeQuery('member.getAuthMail', $args); |
| 2648 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2648 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2649 | 2649 | { |
| 2650 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2650 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2651 | 2651 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2652 | 2652 | } |
| 2653 | 2653 | |
@@ -2656,10 +2656,10 @@ discard block |
||
| 2656 | 2656 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2657 | 2657 | |
| 2658 | 2658 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2659 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2659 | + if (!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2660 | 2660 | |
| 2661 | 2661 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2662 | - executeQuery('member.deleteAuthChangeEmailAddress',$args); |
|
| 2662 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2663 | 2663 | |
| 2664 | 2664 | $this->_clearMemberCache($args->member_srl); |
| 2665 | 2665 | |
@@ -2677,7 +2677,7 @@ discard block |
||
| 2677 | 2677 | **/ |
| 2678 | 2678 | function triggerGetDocumentMenu(&$menu_list) |
| 2679 | 2679 | { |
| 2680 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 2680 | + if (!Context::get('is_logged')) return new BaseObject(); |
|
| 2681 | 2681 | |
| 2682 | 2682 | $logged_info = Context::get('logged_info'); |
| 2683 | 2683 | $document_srl = Context::get('target_srl'); |
@@ -2688,12 +2688,12 @@ discard block |
||
| 2688 | 2688 | $member_srl = $oDocument->get('member_srl'); |
| 2689 | 2689 | $module_srl = $oDocument->get('module_srl'); |
| 2690 | 2690 | |
| 2691 | - if(!$member_srl) return new BaseObject(); |
|
| 2692 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 2691 | + if (!$member_srl) return new BaseObject(); |
|
| 2692 | + if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new BaseObject(); |
|
| 2693 | 2693 | |
| 2694 | 2694 | $oDocumentController = getController('document'); |
| 2695 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2696 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2695 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2696 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2697 | 2697 | |
| 2698 | 2698 | return new BaseObject(); |
| 2699 | 2699 | } |
@@ -2707,7 +2707,7 @@ discard block |
||
| 2707 | 2707 | **/ |
| 2708 | 2708 | function triggerGetCommentMenu(&$menu_list) |
| 2709 | 2709 | { |
| 2710 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 2710 | + if (!Context::get('is_logged')) return new BaseObject(); |
|
| 2711 | 2711 | |
| 2712 | 2712 | $logged_info = Context::get('logged_info'); |
| 2713 | 2713 | $comment_srl = Context::get('target_srl'); |
@@ -2718,12 +2718,12 @@ discard block |
||
| 2718 | 2718 | $module_srl = $oComment->get('module_srl'); |
| 2719 | 2719 | $member_srl = $oComment->get('member_srl'); |
| 2720 | 2720 | |
| 2721 | - if(!$member_srl) return new BaseObject(); |
|
| 2722 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 2721 | + if (!$member_srl) return new BaseObject(); |
|
| 2722 | + if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new BaseObject(); |
|
| 2723 | 2723 | |
| 2724 | 2724 | $oCommentController = getController('comment'); |
| 2725 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2726 | - $oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2725 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2726 | + $oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2727 | 2727 | |
| 2728 | 2728 | return new BaseObject(); |
| 2729 | 2729 | } |
@@ -2735,7 +2735,7 @@ discard block |
||
| 2735 | 2735 | **/ |
| 2736 | 2736 | function procMemberSpammerManage() |
| 2737 | 2737 | { |
| 2738 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2738 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2739 | 2739 | |
| 2740 | 2740 | $logged_info = Context::get('logged_info'); |
| 2741 | 2741 | $member_srl = Context::get('member_srl'); |
@@ -2743,7 +2743,7 @@ discard block |
||
| 2743 | 2743 | $cnt_loop = Context::get('cnt_loop'); |
| 2744 | 2744 | $proc_type = Context::get('proc_type'); |
| 2745 | 2745 | $isMoveToTrash = true; |
| 2746 | - if($proc_type == "delete") |
|
| 2746 | + if ($proc_type == "delete") |
|
| 2747 | 2747 | $isMoveToTrash = false; |
| 2748 | 2748 | |
| 2749 | 2749 | // check grant |
@@ -2752,7 +2752,7 @@ discard block |
||
| 2752 | 2752 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2753 | 2753 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2754 | 2754 | |
| 2755 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2755 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2756 | 2756 | |
| 2757 | 2757 | $proc_msg = ""; |
| 2758 | 2758 | |
@@ -2761,10 +2761,10 @@ discard block |
||
| 2761 | 2761 | |
| 2762 | 2762 | // delete or trash destination |
| 2763 | 2763 | // proc member |
| 2764 | - if($cnt_loop == 1) |
|
| 2764 | + if ($cnt_loop == 1) |
|
| 2765 | 2765 | $this->_spammerMember($member_srl); |
| 2766 | 2766 | // proc document and comment |
| 2767 | - elseif($cnt_loop>1) |
|
| 2767 | + elseif ($cnt_loop > 1) |
|
| 2768 | 2768 | $this->_spammerDocuments($member_srl, $isMoveToTrash); |
| 2769 | 2769 | |
| 2770 | 2770 | // get destination count |
@@ -2773,11 +2773,11 @@ discard block |
||
| 2773 | 2773 | |
| 2774 | 2774 | $total_count = Context::get('total_count'); |
| 2775 | 2775 | $remain_count = $cnt_document + $cnt_comment; |
| 2776 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 2776 | + if ($cnt_loop == 1) $total_count = $remain_count; |
|
| 2777 | 2777 | |
| 2778 | 2778 | // get progress percent |
| 2779 | - if($total_count > 0) |
|
| 2780 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2779 | + if ($total_count > 0) |
|
| 2780 | + $progress = intval((($total_count - $remain_count) / $total_count) * 100); |
|
| 2781 | 2781 | else |
| 2782 | 2782 | $progress = 100; |
| 2783 | 2783 | |
@@ -2801,7 +2801,7 @@ discard block |
||
| 2801 | 2801 | **/ |
| 2802 | 2802 | private function _spammerMember($member_srl) { |
| 2803 | 2803 | $logged_info = Context::get('logged_info'); |
| 2804 | - $spam_description = trim( Context::get('spam_description') ); |
|
| 2804 | + $spam_description = trim(Context::get('spam_description')); |
|
| 2805 | 2805 | |
| 2806 | 2806 | $oMemberModel = getModel('member'); |
| 2807 | 2807 | $columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description'); |
@@ -2820,10 +2820,10 @@ discard block |
||
| 2820 | 2820 | $args->user_id = $member_info->user_id; |
| 2821 | 2821 | $args->nick_name = $member_info->nick_name; |
| 2822 | 2822 | $args->denied = "Y"; |
| 2823 | - $args->description = trim( $member_info->description ); |
|
| 2824 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 2823 | + $args->description = trim($member_info->description); |
|
| 2824 | + if ($args->description != "") $args->description .= "\n"; // add new line |
|
| 2825 | 2825 | |
| 2826 | - $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 . "]"; |
|
| 2826 | + $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."]"; |
|
| 2827 | 2827 | |
| 2828 | 2828 | $output = $this->updateMember($args, true); |
| 2829 | 2829 | |
@@ -2852,21 +2852,21 @@ discard block |
||
| 2852 | 2852 | // 1. proc comment, 2. proc document |
| 2853 | 2853 | $cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl); |
| 2854 | 2854 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
| 2855 | - if($cnt_comment > 0) |
|
| 2855 | + if ($cnt_comment > 0) |
|
| 2856 | 2856 | { |
| 2857 | 2857 | $columnList = array(); |
| 2858 | 2858 | $commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2859 | - if($commentList) { |
|
| 2860 | - foreach($commentList as $v) { |
|
| 2859 | + if ($commentList) { |
|
| 2860 | + foreach ($commentList as $v) { |
|
| 2861 | 2861 | $oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash); |
| 2862 | 2862 | } |
| 2863 | 2863 | } |
| 2864 | - } elseif($cnt_document > 0) { |
|
| 2864 | + } elseif ($cnt_document > 0) { |
|
| 2865 | 2865 | $columnList = array(); |
| 2866 | 2866 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2867 | - if($documentList) { |
|
| 2868 | - foreach($documentList as $v) { |
|
| 2869 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2867 | + if ($documentList) { |
|
| 2868 | + foreach ($documentList as $v) { |
|
| 2869 | + if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2870 | 2870 | else $oDocumentController->deleteDocument($v->document_srl); |
| 2871 | 2871 | } |
| 2872 | 2872 | } |
@@ -2878,24 +2878,24 @@ discard block |
||
| 2878 | 2878 | function _clearMemberCache($member_srl, $site_srl = 0) |
| 2879 | 2879 | { |
| 2880 | 2880 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 2881 | - if($oCacheHandler->isSupport()) |
|
| 2881 | + if ($oCacheHandler->isSupport()) |
|
| 2882 | 2882 | { |
| 2883 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl; |
|
| 2883 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
| 2884 | 2884 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2885 | 2885 | $oCacheHandler->delete($cache_key); |
| 2886 | 2886 | |
| 2887 | - if($site_srl !== 0) |
|
| 2887 | + if ($site_srl !== 0) |
|
| 2888 | 2888 | { |
| 2889 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 2889 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 2890 | 2890 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2891 | 2891 | $oCacheHandler->delete($cache_key); |
| 2892 | 2892 | } |
| 2893 | 2893 | } |
| 2894 | 2894 | |
| 2895 | 2895 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 2896 | - if($oCacheHandler->isSupport()) |
|
| 2896 | + if ($oCacheHandler->isSupport()) |
|
| 2897 | 2897 | { |
| 2898 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 2898 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 2899 | 2899 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2900 | 2900 | $oCacheHandler->delete($cache_key); |
| 2901 | 2901 | } |
@@ -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,17 +818,25 @@ 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 | $oModuleModel = getModel('module'); |
| 744 | 836 | $config = $oModuleModel->getModuleConfig('member'); |
| 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 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 748 | 842 | // Page refresh |
@@ -764,26 +858,35 @@ discard block |
||
| 764 | 858 | { |
| 765 | 859 | |
| 766 | 860 | // Check uploaded file |
| 767 | - if(!checkUploadedFile($target_file)) return; |
|
| 861 | + if(!checkUploadedFile($target_file)) { |
|
| 862 | + return; |
|
| 863 | + } |
|
| 768 | 864 | |
| 769 | 865 | $oMemberModel = getModel('member'); |
| 770 | 866 | $config = $oMemberModel->getMemberConfig(); |
| 771 | 867 | |
| 772 | 868 | // Get an image size |
| 773 | 869 | $max_width = $config->profile_image_max_width; |
| 774 | - if(!$max_width) $max_width = "90"; |
|
| 870 | + if(!$max_width) { |
|
| 871 | + $max_width = "90"; |
|
| 872 | + } |
|
| 775 | 873 | $max_height = $config->profile_image_max_height; |
| 776 | - if(!$max_height) $max_height = "90"; |
|
| 874 | + if(!$max_height) { |
|
| 875 | + $max_height = "90"; |
|
| 876 | + } |
|
| 777 | 877 | // Get a target path to save |
| 778 | 878 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
| 779 | 879 | FileHandler::makeDir($target_path); |
| 780 | 880 | |
| 781 | 881 | // Get file information |
| 782 | 882 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 783 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 784 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 785 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 786 | - else |
|
| 883 | + if(IMAGETYPE_PNG == $type) { |
|
| 884 | + $ext = 'png'; |
|
| 885 | + } elseif(IMAGETYPE_JPEG == $type) { |
|
| 886 | + $ext = 'jpg'; |
|
| 887 | + } elseif(IMAGETYPE_GIF == $type) { |
|
| 888 | + $ext = 'gif'; |
|
| 889 | + } else |
|
| 787 | 890 | { |
| 788 | 891 | return; |
| 789 | 892 | } |
@@ -795,8 +898,7 @@ discard block |
||
| 795 | 898 | if(($width > $max_width || $height > $max_height ) && $type != 1) |
| 796 | 899 | { |
| 797 | 900 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
| 798 | - } |
|
| 799 | - else |
|
| 901 | + } else |
|
| 800 | 902 | { |
| 801 | 903 | @copy($target_file, $target_filename); |
| 802 | 904 | } |
@@ -811,17 +913,25 @@ discard block |
||
| 811 | 913 | { |
| 812 | 914 | // Check if the file is successfully uploaded |
| 813 | 915 | $file = $_FILES['image_name']; |
| 814 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 916 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 917 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 918 | + } |
|
| 815 | 919 | // Ignore if member_srl is invalid or doesn't exist. |
| 816 | 920 | $member_srl = Context::get('member_srl'); |
| 817 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 921 | + if(!$member_srl) { |
|
| 922 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 923 | + } |
|
| 818 | 924 | |
| 819 | 925 | $logged_info = Context::get('logged_info'); |
| 820 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 926 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 927 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 928 | + } |
|
| 821 | 929 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 822 | 930 | $oModuleModel = getModel('module'); |
| 823 | 931 | $config = $oModuleModel->getModuleConfig('member'); |
| 824 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 932 | + if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') { |
|
| 933 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 934 | + } |
|
| 825 | 935 | |
| 826 | 936 | $this->insertImageName($member_srl, $file['tmp_name']); |
| 827 | 937 | // Page refresh |
@@ -842,15 +952,21 @@ discard block |
||
| 842 | 952 | function insertImageName($member_srl, $target_file) |
| 843 | 953 | { |
| 844 | 954 | // Check uploaded file |
| 845 | - if(!checkUploadedFile($target_file)) return; |
|
| 955 | + if(!checkUploadedFile($target_file)) { |
|
| 956 | + return; |
|
| 957 | + } |
|
| 846 | 958 | |
| 847 | 959 | $oModuleModel = getModel('module'); |
| 848 | 960 | $config = $oModuleModel->getModuleConfig('member'); |
| 849 | 961 | // Get an image size |
| 850 | 962 | $max_width = $config->image_name_max_width; |
| 851 | - if(!$max_width) $max_width = "90"; |
|
| 963 | + if(!$max_width) { |
|
| 964 | + $max_width = "90"; |
|
| 965 | + } |
|
| 852 | 966 | $max_height = $config->image_name_max_height; |
| 853 | - if(!$max_height) $max_height = "20"; |
|
| 967 | + if(!$max_height) { |
|
| 968 | + $max_height = "20"; |
|
| 969 | + } |
|
| 854 | 970 | // Get a target path to save |
| 855 | 971 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
| 856 | 972 | FileHandler::makeDir($target_path); |
@@ -859,8 +975,11 @@ discard block |
||
| 859 | 975 | // Get file information |
| 860 | 976 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 861 | 977 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 862 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 863 | - else @copy($target_file, $target_filename); |
|
| 978 | + if($width > $max_width || $height > $max_height || $type!=1) { |
|
| 979 | + FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 980 | + } else { |
|
| 981 | + @copy($target_file, $target_filename); |
|
| 982 | + } |
|
| 864 | 983 | } |
| 865 | 984 | |
| 866 | 985 | /** |
@@ -920,17 +1039,25 @@ discard block |
||
| 920 | 1039 | { |
| 921 | 1040 | // Check if the file is successfully uploaded |
| 922 | 1041 | $file = $_FILES['image_mark']; |
| 923 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1042 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 1043 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1044 | + } |
|
| 924 | 1045 | // Ignore if member_srl is invalid or doesn't exist. |
| 925 | 1046 | $member_srl = Context::get('member_srl'); |
| 926 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1047 | + if(!$member_srl) { |
|
| 1048 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1049 | + } |
|
| 927 | 1050 | |
| 928 | 1051 | $logged_info = Context::get('logged_info'); |
| 929 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1052 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 1053 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1054 | + } |
|
| 930 | 1055 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 931 | 1056 | $oModuleModel = getModel('module'); |
| 932 | 1057 | $config = $oModuleModel->getModuleConfig('member'); |
| 933 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1058 | + if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') { |
|
| 1059 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1060 | + } |
|
| 934 | 1061 | |
| 935 | 1062 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 936 | 1063 | // Page refresh |
@@ -951,15 +1078,21 @@ discard block |
||
| 951 | 1078 | function insertImageMark($member_srl, $target_file) |
| 952 | 1079 | { |
| 953 | 1080 | // Check uploaded file |
| 954 | - if(!checkUploadedFile($target_file)) return; |
|
| 1081 | + if(!checkUploadedFile($target_file)) { |
|
| 1082 | + return; |
|
| 1083 | + } |
|
| 955 | 1084 | |
| 956 | 1085 | $oModuleModel = getModel('module'); |
| 957 | 1086 | $config = $oModuleModel->getModuleConfig('member'); |
| 958 | 1087 | // Get an image size |
| 959 | 1088 | $max_width = $config->image_mark_max_width; |
| 960 | - if(!$max_width) $max_width = "20"; |
|
| 1089 | + if(!$max_width) { |
|
| 1090 | + $max_width = "20"; |
|
| 1091 | + } |
|
| 961 | 1092 | $max_height = $config->image_mark_max_height; |
| 962 | - if(!$max_height) $max_height = "20"; |
|
| 1093 | + if(!$max_height) { |
|
| 1094 | + $max_height = "20"; |
|
| 1095 | + } |
|
| 963 | 1096 | |
| 964 | 1097 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
| 965 | 1098 | FileHandler::makeDir($target_path); |
@@ -968,8 +1101,11 @@ discard block |
||
| 968 | 1101 | // Get file information |
| 969 | 1102 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 970 | 1103 | |
| 971 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 972 | - else @copy($target_file, $target_filename); |
|
| 1104 | + if($width > $max_width || $height > $max_height || $type!=1) { |
|
| 1105 | + FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 1106 | + } else { |
|
| 1107 | + @copy($target_file, $target_filename); |
|
| 1108 | + } |
|
| 973 | 1109 | } |
| 974 | 1110 | |
| 975 | 1111 | /** |
@@ -1004,14 +1140,18 @@ discard block |
||
| 1004 | 1140 | function procMemberFindAccount() |
| 1005 | 1141 | { |
| 1006 | 1142 | $email_address = Context::get('email_address'); |
| 1007 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1143 | + if(!$email_address) { |
|
| 1144 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1145 | + } |
|
| 1008 | 1146 | |
| 1009 | 1147 | $oMemberModel = getModel('member'); |
| 1010 | 1148 | $oModuleModel = getModel('module'); |
| 1011 | 1149 | |
| 1012 | 1150 | // Check if a member having the same email address exists |
| 1013 | 1151 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1014 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1152 | + if(!$member_srl) { |
|
| 1153 | + return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1154 | + } |
|
| 1015 | 1155 | |
| 1016 | 1156 | // Get information of the member |
| 1017 | 1157 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
@@ -1023,7 +1163,9 @@ discard block |
||
| 1023 | 1163 | $chk_args = new stdClass; |
| 1024 | 1164 | $chk_args->member_srl = $member_info->member_srl; |
| 1025 | 1165 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1026 | - if($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1166 | + if($output->toBool() && $output->data->count != '0') { |
|
| 1167 | + return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1168 | + } |
|
| 1027 | 1169 | } |
| 1028 | 1170 | |
| 1029 | 1171 | // Insert data into the authentication DB |
@@ -1036,7 +1178,9 @@ discard block |
||
| 1036 | 1178 | $args->is_register = 'N'; |
| 1037 | 1179 | |
| 1038 | 1180 | $output = executeQuery('member.insertAuthMail', $args); |
| 1039 | - if(!$output->toBool()) return $output; |
|
| 1181 | + if(!$output->toBool()) { |
|
| 1182 | + return $output; |
|
| 1183 | + } |
|
| 1040 | 1184 | // Get content of the email to send a member |
| 1041 | 1185 | Context::set('auth_args', $args); |
| 1042 | 1186 | |
@@ -1053,8 +1197,7 @@ discard block |
||
| 1053 | 1197 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1054 | 1198 | } |
| 1055 | 1199 | } |
| 1056 | - } |
|
| 1057 | - else |
|
| 1200 | + } else |
|
| 1058 | 1201 | { |
| 1059 | 1202 | $memberInfo[$lang->user_id] = $args->user_id; |
| 1060 | 1203 | $memberInfo[$lang->user_name] = $args->user_name; |
@@ -1063,13 +1206,19 @@ discard block |
||
| 1063 | 1206 | } |
| 1064 | 1207 | Context::set('memberInfo', $memberInfo); |
| 1065 | 1208 | |
| 1066 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1067 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1209 | + if(!$member_config->skin) { |
|
| 1210 | + $member_config->skin = "default"; |
|
| 1211 | + } |
|
| 1212 | + if(!$member_config->colorset) { |
|
| 1213 | + $member_config->colorset = "white"; |
|
| 1214 | + } |
|
| 1068 | 1215 | |
| 1069 | 1216 | Context::set('member_config', $member_config); |
| 1070 | 1217 | |
| 1071 | 1218 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1072 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1219 | + if(!is_dir($tpl_path)) { |
|
| 1220 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1221 | + } |
|
| 1073 | 1222 | |
| 1074 | 1223 | $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
| 1075 | 1224 | Context::set('find_url', $find_url); |
@@ -1112,19 +1261,25 @@ discard block |
||
| 1112 | 1261 | $find_account_question = trim(Context::get('find_account_question')); |
| 1113 | 1262 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1114 | 1263 | |
| 1115 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1264 | + if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) { |
|
| 1265 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1266 | + } |
|
| 1116 | 1267 | |
| 1117 | 1268 | $oModuleModel = getModel('module'); |
| 1118 | 1269 | // Check if a member having the same email address exists |
| 1119 | 1270 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1120 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1271 | + if(!$member_srl) { |
|
| 1272 | + return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1273 | + } |
|
| 1121 | 1274 | |
| 1122 | 1275 | // Get information of the member |
| 1123 | 1276 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1124 | 1277 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1125 | 1278 | |
| 1126 | 1279 | // Display a message if no answer is entered |
| 1127 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1280 | + if(!$member_info->find_account_question || !$member_info->find_account_answer) { |
|
| 1281 | + return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1282 | + } |
|
| 1128 | 1283 | |
| 1129 | 1284 | // 답변 확인 |
| 1130 | 1285 | $hashed = $oPassword->checkAlgorithm($member_info->find_account_answer); |
@@ -1133,12 +1288,10 @@ discard block |
||
| 1133 | 1288 | if($member_info->find_account_question != $find_account_question) |
| 1134 | 1289 | { |
| 1135 | 1290 | $authed = false; |
| 1136 | - } |
|
| 1137 | - else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1291 | + } else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1138 | 1292 | { |
| 1139 | 1293 | $authed = false; |
| 1140 | - } |
|
| 1141 | - else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1294 | + } else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1142 | 1295 | { |
| 1143 | 1296 | $authed = false; |
| 1144 | 1297 | } |
@@ -1167,7 +1320,9 @@ discard block |
||
| 1167 | 1320 | $args->password = $temp_password; |
| 1168 | 1321 | $args->change_password_date = '1'; |
| 1169 | 1322 | $output = $this->updateMemberPassword($args); |
| 1170 | - if(!$output->toBool()) return $output; |
|
| 1323 | + if(!$output->toBool()) { |
|
| 1324 | + return $output; |
|
| 1325 | + } |
|
| 1171 | 1326 | |
| 1172 | 1327 | $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
| 1173 | 1328 | |
@@ -1224,8 +1379,7 @@ discard block |
||
| 1224 | 1379 | if($output->data->is_register == 'Y') |
| 1225 | 1380 | { |
| 1226 | 1381 | $args->denied = 'N'; |
| 1227 | - } |
|
| 1228 | - else |
|
| 1382 | + } else |
|
| 1229 | 1383 | { |
| 1230 | 1384 | $args->password = $oMemberModel->hashPassword($args->password); |
| 1231 | 1385 | } |
@@ -1259,33 +1413,45 @@ discard block |
||
| 1259 | 1413 | { |
| 1260 | 1414 | // Get an email_address |
| 1261 | 1415 | $email_address = Context::get('email_address'); |
| 1262 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1416 | + if(!$email_address) { |
|
| 1417 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1418 | + } |
|
| 1263 | 1419 | // Log test by using email_address |
| 1264 | 1420 | $oMemberModel = getModel('member'); |
| 1265 | 1421 | |
| 1266 | 1422 | $args = new stdClass; |
| 1267 | 1423 | $args->email_address = $email_address; |
| 1268 | 1424 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1269 | - if(!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1425 | + if(!$memberSrl) { |
|
| 1426 | + return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1427 | + } |
|
| 1270 | 1428 | |
| 1271 | 1429 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1272 | 1430 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1273 | 1431 | |
| 1274 | 1432 | $oModuleModel = getModel('module'); |
| 1275 | 1433 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1276 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1277 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1434 | + if(!$member_config->skin) { |
|
| 1435 | + $member_config->skin = "default"; |
|
| 1436 | + } |
|
| 1437 | + if(!$member_config->colorset) { |
|
| 1438 | + $member_config->colorset = "white"; |
|
| 1439 | + } |
|
| 1278 | 1440 | |
| 1279 | 1441 | // Check if a authentication mail has been sent previously |
| 1280 | 1442 | $chk_args = new stdClass; |
| 1281 | 1443 | $chk_args->member_srl = $member_info->member_srl; |
| 1282 | 1444 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1283 | - if($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1445 | + if($output->toBool() && $output->data->count == '0') { |
|
| 1446 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1447 | + } |
|
| 1284 | 1448 | |
| 1285 | 1449 | $auth_args = new stdClass; |
| 1286 | 1450 | $auth_args->member_srl = $member_info->member_srl; |
| 1287 | 1451 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1288 | - if(!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1452 | + if(!$output->data || !$output->data[0]->auth_key) { |
|
| 1453 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1454 | + } |
|
| 1289 | 1455 | $auth_info = $output->data[0]; |
| 1290 | 1456 | |
| 1291 | 1457 | // Update the regdate of authmail entry |
@@ -1306,8 +1472,7 @@ discard block |
||
| 1306 | 1472 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1307 | 1473 | } |
| 1308 | 1474 | } |
| 1309 | - } |
|
| 1310 | - else |
|
| 1475 | + } else |
|
| 1311 | 1476 | { |
| 1312 | 1477 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1313 | 1478 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1320,7 +1485,9 @@ discard block |
||
| 1320 | 1485 | Context::set('member_config', $member_config); |
| 1321 | 1486 | |
| 1322 | 1487 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1323 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1488 | + if(!is_dir($tpl_path)) { |
|
| 1489 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1490 | + } |
|
| 1324 | 1491 | |
| 1325 | 1492 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
| 1326 | 1493 | Context::set('auth_url', $auth_url); |
@@ -1398,7 +1565,9 @@ discard block |
||
| 1398 | 1565 | $auth_args->is_register = 'Y'; |
| 1399 | 1566 | |
| 1400 | 1567 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1401 | - if(!$output->toBool()) return $output; |
|
| 1568 | + if(!$output->toBool()) { |
|
| 1569 | + return $output; |
|
| 1570 | + } |
|
| 1402 | 1571 | |
| 1403 | 1572 | $memberInfo->email_address = $newEmail; |
| 1404 | 1573 | |
@@ -1432,8 +1601,7 @@ discard block |
||
| 1432 | 1601 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1433 | 1602 | } |
| 1434 | 1603 | } |
| 1435 | - } |
|
| 1436 | - else |
|
| 1604 | + } else |
|
| 1437 | 1605 | { |
| 1438 | 1606 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1439 | 1607 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1442,13 +1610,19 @@ discard block |
||
| 1442 | 1610 | } |
| 1443 | 1611 | Context::set('memberInfo', $memberInfo); |
| 1444 | 1612 | |
| 1445 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1446 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1613 | + if(!$member_config->skin) { |
|
| 1614 | + $member_config->skin = "default"; |
|
| 1615 | + } |
|
| 1616 | + if(!$member_config->colorset) { |
|
| 1617 | + $member_config->colorset = "white"; |
|
| 1618 | + } |
|
| 1447 | 1619 | |
| 1448 | 1620 | Context::set('member_config', $member_config); |
| 1449 | 1621 | |
| 1450 | 1622 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1451 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1623 | + if(!is_dir($tpl_path)) { |
|
| 1624 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1625 | + } |
|
| 1452 | 1626 | |
| 1453 | 1627 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
| 1454 | 1628 | Context::set('auth_url', $auth_url); |
@@ -1473,7 +1647,9 @@ discard block |
||
| 1473 | 1647 | { |
| 1474 | 1648 | $site_module_info = Context::get('site_module_info'); |
| 1475 | 1649 | $logged_info = Context::get('logged_info'); |
| 1476 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1650 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1651 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1652 | + } |
|
| 1477 | 1653 | |
| 1478 | 1654 | $oMemberModel = getModel('member'); |
| 1479 | 1655 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1492,13 +1668,17 @@ discard block |
||
| 1492 | 1668 | { |
| 1493 | 1669 | $site_module_info = Context::get('site_module_info'); |
| 1494 | 1670 | $logged_info = Context::get('logged_info'); |
| 1495 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1671 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1672 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1673 | + } |
|
| 1496 | 1674 | |
| 1497 | 1675 | $args = new stdClass; |
| 1498 | 1676 | $args->site_srl= $site_module_info->site_srl; |
| 1499 | 1677 | $args->member_srl = $logged_info->member_srl; |
| 1500 | 1678 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1501 | - if(!$output->toBool()) return $output; |
|
| 1679 | + if(!$output->toBool()) { |
|
| 1680 | + return $output; |
|
| 1681 | + } |
|
| 1502 | 1682 | $this->setMessage('success_deleted'); |
| 1503 | 1683 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1504 | 1684 | } |
@@ -1512,17 +1692,37 @@ discard block |
||
| 1512 | 1692 | */ |
| 1513 | 1693 | function setMemberConfig($args) |
| 1514 | 1694 | { |
| 1515 | - if(!$args->skin) $args->skin = "default"; |
|
| 1516 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1517 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1518 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1519 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1695 | + if(!$args->skin) { |
|
| 1696 | + $args->skin = "default"; |
|
| 1697 | + } |
|
| 1698 | + if(!$args->colorset) { |
|
| 1699 | + $args->colorset = "white"; |
|
| 1700 | + } |
|
| 1701 | + if(!$args->editor_skin) { |
|
| 1702 | + $args->editor_skin= "ckeditor"; |
|
| 1703 | + } |
|
| 1704 | + if(!$args->editor_colorset) { |
|
| 1705 | + $args->editor_colorset = "moono"; |
|
| 1706 | + } |
|
| 1707 | + if($args->enable_join!='Y') { |
|
| 1708 | + $args->enable_join = 'N'; |
|
| 1709 | + } |
|
| 1520 | 1710 | $args->enable_openid= 'N'; |
| 1521 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1522 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1523 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1524 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1525 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1711 | + if($args->profile_image !='Y') { |
|
| 1712 | + $args->profile_image = 'N'; |
|
| 1713 | + } |
|
| 1714 | + if($args->image_name!='Y') { |
|
| 1715 | + $args->image_name = 'N'; |
|
| 1716 | + } |
|
| 1717 | + if($args->image_mark!='Y') { |
|
| 1718 | + $args->image_mark = 'N'; |
|
| 1719 | + } |
|
| 1720 | + if($args->group_image_mark!='Y') { |
|
| 1721 | + $args->group_image_mark = 'N'; |
|
| 1722 | + } |
|
| 1723 | + if(!trim(strip_tags($args->agreement))) { |
|
| 1724 | + $args->agreement = null; |
|
| 1725 | + } |
|
| 1526 | 1726 | $args->limit_day = (int)$args->limit_day; |
| 1527 | 1727 | |
| 1528 | 1728 | $agreement = trim($args->agreement); |
@@ -1530,7 +1730,9 @@ discard block |
||
| 1530 | 1730 | |
| 1531 | 1731 | $oModuleController = getController('module'); |
| 1532 | 1732 | $output = $oModuleController->insertModuleConfig('member',$args); |
| 1533 | - if(!$output->toBool()) return $output; |
|
| 1733 | + if(!$output->toBool()) { |
|
| 1734 | + return $output; |
|
| 1735 | + } |
|
| 1534 | 1736 | |
| 1535 | 1737 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1536 | 1738 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1555,7 +1757,9 @@ discard block |
||
| 1555 | 1757 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1556 | 1758 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1557 | 1759 | |
| 1558 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1760 | + if(!$check_signature) { |
|
| 1761 | + return FileHandler::removeFile($filename); |
|
| 1762 | + } |
|
| 1559 | 1763 | |
| 1560 | 1764 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1561 | 1765 | FileHandler::makeDir($path); |
@@ -1589,7 +1793,9 @@ discard block |
||
| 1589 | 1793 | $args = new stdClass(); |
| 1590 | 1794 | $args->member_srl = $member_srl; |
| 1591 | 1795 | $args->group_srl = $group_srl; |
| 1592 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1796 | + if($site_srl) { |
|
| 1797 | + $args->site_srl = $site_srl; |
|
| 1798 | + } |
|
| 1593 | 1799 | |
| 1594 | 1800 | // Add |
| 1595 | 1801 | $output = executeQuery('member.addMemberToGroup',$args); |
@@ -1615,15 +1821,21 @@ discard block |
||
| 1615 | 1821 | $obj->member_srl = implode(',',$args->member_srl); |
| 1616 | 1822 | |
| 1617 | 1823 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1618 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1824 | + if($output->data) { |
|
| 1825 | + foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1826 | + } |
|
| 1619 | 1827 | |
| 1620 | 1828 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1621 | - if(!$output->toBool()) return $output; |
|
| 1829 | + if(!$output->toBool()) { |
|
| 1830 | + return $output; |
|
| 1831 | + } |
|
| 1622 | 1832 | |
| 1623 | 1833 | $inserted_members = array(); |
| 1624 | 1834 | foreach($args->member_srl as $key => $val) |
| 1625 | 1835 | { |
| 1626 | - if($inserted_members[$val]) continue; |
|
| 1836 | + if($inserted_members[$val]) { |
|
| 1837 | + continue; |
|
| 1838 | + } |
|
| 1627 | 1839 | $inserted_members[$val] = true; |
| 1628 | 1840 | |
| 1629 | 1841 | unset($obj); |
@@ -1633,7 +1845,9 @@ discard block |
||
| 1633 | 1845 | $obj->site_srl = $args->site_srl; |
| 1634 | 1846 | $obj->regdate = $date[$obj->member_srl]; |
| 1635 | 1847 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1636 | - if(!$output->toBool()) return $output; |
|
| 1848 | + if(!$output->toBool()) { |
|
| 1849 | + return $output; |
|
| 1850 | + } |
|
| 1637 | 1851 | |
| 1638 | 1852 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1639 | 1853 | } |
@@ -1695,8 +1909,7 @@ discard block |
||
| 1695 | 1909 | if($config->identifier == 'user_id') |
| 1696 | 1910 | { |
| 1697 | 1911 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1698 | - } |
|
| 1699 | - else |
|
| 1912 | + } else |
|
| 1700 | 1913 | { |
| 1701 | 1914 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1702 | 1915 | } |
@@ -1705,8 +1918,7 @@ discard block |
||
| 1705 | 1918 | $do_auto_login = true; |
| 1706 | 1919 | } |
| 1707 | 1920 | |
| 1708 | - } |
|
| 1709 | - else |
|
| 1921 | + } else |
|
| 1710 | 1922 | { |
| 1711 | 1923 | $do_auto_login = true; |
| 1712 | 1924 | } |
@@ -1715,8 +1927,7 @@ discard block |
||
| 1715 | 1927 | if($do_auto_login) |
| 1716 | 1928 | { |
| 1717 | 1929 | $output = $this->doLogin($user_id); |
| 1718 | - } |
|
| 1719 | - else |
|
| 1930 | + } else |
|
| 1720 | 1931 | { |
| 1721 | 1932 | executeQuery('member.deleteAutologin', $args); |
| 1722 | 1933 | setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
@@ -1735,13 +1946,17 @@ discard block |
||
| 1735 | 1946 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1736 | 1947 | { |
| 1737 | 1948 | $user_id = strtolower($user_id); |
| 1738 | - if(!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 1949 | + if(!$user_id) { |
|
| 1950 | + return new BaseObject(-1, 'null_user_id'); |
|
| 1951 | + } |
|
| 1739 | 1952 | // Call a trigger before log-in (before) |
| 1740 | 1953 | $trigger_obj = new stdClass(); |
| 1741 | 1954 | $trigger_obj->user_id = $user_id; |
| 1742 | 1955 | $trigger_obj->password = $password; |
| 1743 | 1956 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1744 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1957 | + if(!$trigger_output->toBool()) { |
|
| 1958 | + return $trigger_output; |
|
| 1959 | + } |
|
| 1745 | 1960 | // Create a member model object |
| 1746 | 1961 | $oMemberModel = getModel('member'); |
| 1747 | 1962 | |
@@ -1756,15 +1971,18 @@ discard block |
||
| 1756 | 1971 | // Get user_id information |
| 1757 | 1972 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1758 | 1973 | // Set an invalid user if no value returned |
| 1759 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1974 | + if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) { |
|
| 1975 | + return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1976 | + } |
|
| 1760 | 1977 | |
| 1761 | - } |
|
| 1762 | - else |
|
| 1978 | + } else |
|
| 1763 | 1979 | { |
| 1764 | 1980 | // Get user_id information |
| 1765 | 1981 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1766 | 1982 | // Set an invalid user if no value returned |
| 1767 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1983 | + if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) { |
|
| 1984 | + return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1985 | + } |
|
| 1768 | 1986 | } |
| 1769 | 1987 | |
| 1770 | 1988 | $output = executeQuery('member.getLoginCountByIp', $args); |
@@ -1776,14 +1994,18 @@ discard block |
||
| 1776 | 1994 | if($term < $config->max_error_count_time) |
| 1777 | 1995 | { |
| 1778 | 1996 | $term = $config->max_error_count_time - $term; |
| 1779 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1780 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1781 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1782 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1997 | + if($term < 60) { |
|
| 1998 | + $term = intval($term).Context::getLang('unit_sec'); |
|
| 1999 | + } elseif(60 <= $term && $term < 3600) { |
|
| 2000 | + $term = intval($term/60).Context::getLang('unit_min'); |
|
| 2001 | + } elseif(3600 <= $term && $term < 86400) { |
|
| 2002 | + $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 2003 | + } else { |
|
| 2004 | + $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 2005 | + } |
|
| 1783 | 2006 | |
| 1784 | 2007 | return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
| 1785 | - } |
|
| 1786 | - else |
|
| 2008 | + } else |
|
| 1787 | 2009 | { |
| 1788 | 2010 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1789 | 2011 | $output = executeQuery('member.deleteLoginCountByIp', $args); |
@@ -1810,7 +2032,9 @@ discard block |
||
| 1810 | 2032 | return new BaseObject(-1,'msg_user_denied'); |
| 1811 | 2033 | } |
| 1812 | 2034 | // Notify if denied_date is less than the current time |
| 1813 | - 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"))); |
|
| 2035 | + if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) { |
|
| 2036 | + return new BaseObject(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
| 2037 | + } |
|
| 1814 | 2038 | // Update the latest login time |
| 1815 | 2039 | $args->member_srl = $this->memberInfo->member_srl; |
| 1816 | 2040 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1859,7 +2083,9 @@ discard block |
||
| 1859 | 2083 | } |
| 1860 | 2084 | // Call a trigger after successfully log-in (after) |
| 1861 | 2085 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1862 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 2086 | + if(!$trigger_output->toBool()) { |
|
| 2087 | + return $trigger_output; |
|
| 2088 | + } |
|
| 1863 | 2089 | // When user checked to use auto-login |
| 1864 | 2090 | if($keep_signed) |
| 1865 | 2091 | { |
@@ -1873,7 +2099,9 @@ discard block |
||
| 1873 | 2099 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1874 | 2100 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1875 | 2101 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1876 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2102 | + if($autologin_output->toBool()) { |
|
| 2103 | + setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2104 | + } |
|
| 1877 | 2105 | } |
| 1878 | 2106 | if($this->memberInfo->is_admin == 'Y') |
| 1879 | 2107 | { |
@@ -1962,7 +2190,9 @@ discard block |
||
| 1962 | 2190 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 1963 | 2191 | { |
| 1964 | 2192 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 1965 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2193 | + if(!is_array($member_popup_menu_list)) { |
|
| 2194 | + $member_popup_menu_list = array(); |
|
| 2195 | + } |
|
| 1966 | 2196 | |
| 1967 | 2197 | $obj = new stdClass; |
| 1968 | 2198 | $obj->url = $url; |
@@ -1981,35 +2211,54 @@ discard block |
||
| 1981 | 2211 | { |
| 1982 | 2212 | // Call a trigger (before) |
| 1983 | 2213 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 1984 | - if(!$output->toBool()) return $output; |
|
| 2214 | + if(!$output->toBool()) { |
|
| 2215 | + return $output; |
|
| 2216 | + } |
|
| 1985 | 2217 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 1986 | 2218 | $oModuleModel = getModel('module'); |
| 1987 | 2219 | $config = $oModuleModel->getModuleConfig('member'); |
| 1988 | 2220 | |
| 1989 | 2221 | $logged_info = Context::get('logged_info'); |
| 1990 | 2222 | // If the date of the temporary restrictions limit further information on the date of |
| 1991 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2223 | + if($config->limit_day) { |
|
| 2224 | + $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2225 | + } |
|
| 1992 | 2226 | |
| 1993 | 2227 | $args->member_srl = getNextSequence(); |
| 1994 | 2228 | $args->list_order = -1 * $args->member_srl; |
| 1995 | 2229 | |
| 1996 | 2230 | // Execute insert or update depending on the value of member_srl |
| 1997 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2231 | + if(!$args->user_id) { |
|
| 2232 | + $args->user_id = 't'.$args->member_srl; |
|
| 2233 | + } |
|
| 1998 | 2234 | // Enter the user's identity changed to lowercase |
| 1999 | - else $args->user_id = strtolower($args->user_id); |
|
| 2000 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2001 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2235 | + else { |
|
| 2236 | + $args->user_id = strtolower($args->user_id); |
|
| 2237 | + } |
|
| 2238 | + if(!$args->user_name) { |
|
| 2239 | + $args->user_name = $args->member_srl; |
|
| 2240 | + } |
|
| 2241 | + if(!$args->nick_name) { |
|
| 2242 | + $args->nick_name = $args->member_srl; |
|
| 2243 | + } |
|
| 2002 | 2244 | |
| 2003 | 2245 | // Control of essential parameters |
| 2004 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2005 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2006 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 2246 | + if($args->allow_mailing!='Y') { |
|
| 2247 | + $args->allow_mailing = 'N'; |
|
| 2248 | + } |
|
| 2249 | + if($args->denied!='Y') { |
|
| 2250 | + $args->denied = 'N'; |
|
| 2251 | + } |
|
| 2252 | + if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) { |
|
| 2253 | + $args->allow_message = 'Y'; |
|
| 2254 | + } |
|
| 2007 | 2255 | |
| 2008 | 2256 | if($logged_info->is_admin == 'Y') |
| 2009 | 2257 | { |
| 2010 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 2011 | - } |
|
| 2012 | - else |
|
| 2258 | + if($args->is_admin!='Y') { |
|
| 2259 | + $args->is_admin = 'N'; |
|
| 2260 | + } |
|
| 2261 | + } else |
|
| 2013 | 2262 | { |
| 2014 | 2263 | unset($args->is_admin); |
| 2015 | 2264 | } |
@@ -2022,8 +2271,12 @@ discard block |
||
| 2022 | 2271 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2023 | 2272 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2024 | 2273 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2025 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2026 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2274 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) { |
|
| 2275 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2276 | + } |
|
| 2277 | + if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) { |
|
| 2278 | + $args->blog = 'http://'.$args->blog; |
|
| 2279 | + } |
|
| 2027 | 2280 | |
| 2028 | 2281 | // Create a model object |
| 2029 | 2282 | $oMemberModel = getModel('member'); |
@@ -2037,8 +2290,7 @@ discard block |
||
| 2037 | 2290 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2038 | 2291 | } |
| 2039 | 2292 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2040 | - } |
|
| 2041 | - elseif(!$args->password) |
|
| 2293 | + } elseif(!$args->password) |
|
| 2042 | 2294 | { |
| 2043 | 2295 | unset($args->password); |
| 2044 | 2296 | } |
@@ -2046,8 +2298,7 @@ discard block |
||
| 2046 | 2298 | if($args->find_account_answer && !$password_is_hashed) |
| 2047 | 2299 | { |
| 2048 | 2300 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2049 | - } |
|
| 2050 | - elseif(!$args->find_account_answer) |
|
| 2301 | + } elseif(!$args->find_account_answer) |
|
| 2051 | 2302 | { |
| 2052 | 2303 | unset($args->find_account_answer); |
| 2053 | 2304 | } |
@@ -2088,8 +2339,12 @@ discard block |
||
| 2088 | 2339 | // Insert data into the DB |
| 2089 | 2340 | $args->list_order = -1 * $args->member_srl; |
| 2090 | 2341 | |
| 2091 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2092 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2342 | + if(!$args->user_id) { |
|
| 2343 | + $args->user_id = 't'.$args->member_srl; |
|
| 2344 | + } |
|
| 2345 | + if(!$args->user_name) { |
|
| 2346 | + $args->user_name = $args->member_srl; |
|
| 2347 | + } |
|
| 2093 | 2348 | |
| 2094 | 2349 | $oDB = &DB::getInstance(); |
| 2095 | 2350 | $oDB->begin(); |
@@ -2101,8 +2356,11 @@ discard block |
||
| 2101 | 2356 | return $output; |
| 2102 | 2357 | } |
| 2103 | 2358 | |
| 2104 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2105 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2359 | + if(is_array($args->group_srl_list)) { |
|
| 2360 | + $group_srl_list = $args->group_srl_list; |
|
| 2361 | + } else { |
|
| 2362 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2363 | + } |
|
| 2106 | 2364 | // If no value is entered the default group, the value of group registration |
| 2107 | 2365 | if(!$args->group_srl_list) |
| 2108 | 2366 | { |
@@ -2119,8 +2377,7 @@ discard block |
||
| 2119 | 2377 | } |
| 2120 | 2378 | } |
| 2121 | 2379 | // If the value is the value of the group entered the group registration |
| 2122 | - } |
|
| 2123 | - else |
|
| 2380 | + } else |
|
| 2124 | 2381 | { |
| 2125 | 2382 | for($i=0;$i<count($group_srl_list);$i++) |
| 2126 | 2383 | { |
@@ -2181,27 +2438,39 @@ discard block |
||
| 2181 | 2438 | { |
| 2182 | 2439 | // Call a trigger (before) |
| 2183 | 2440 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2184 | - if(!$output->toBool()) return $output; |
|
| 2441 | + if(!$output->toBool()) { |
|
| 2442 | + return $output; |
|
| 2443 | + } |
|
| 2185 | 2444 | // Create a model object |
| 2186 | 2445 | $oMemberModel = getModel('member'); |
| 2187 | 2446 | |
| 2188 | 2447 | $logged_info = Context::get('logged_info'); |
| 2189 | 2448 | // Get what you want to modify the original information |
| 2190 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2449 | + if(!$this->memberInfo) { |
|
| 2450 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2451 | + } |
|
| 2191 | 2452 | // Control of essential parameters |
| 2192 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2193 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2453 | + if($args->allow_mailing!='Y') { |
|
| 2454 | + $args->allow_mailing = 'N'; |
|
| 2455 | + } |
|
| 2456 | + if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) { |
|
| 2457 | + $args->allow_message = 'Y'; |
|
| 2458 | + } |
|
| 2194 | 2459 | |
| 2195 | 2460 | if($logged_info->is_admin == 'Y') |
| 2196 | 2461 | { |
| 2197 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2198 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2199 | - } |
|
| 2200 | - else |
|
| 2462 | + if($args->denied!='Y') { |
|
| 2463 | + $args->denied = 'N'; |
|
| 2464 | + } |
|
| 2465 | + if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) { |
|
| 2466 | + $args->is_admin = 'N'; |
|
| 2467 | + } |
|
| 2468 | + } else |
|
| 2201 | 2469 | { |
| 2202 | 2470 | unset($args->is_admin); |
| 2203 | - if($is_admin == false) |
|
| 2204 | - unset($args->denied); |
|
| 2471 | + if($is_admin == false) { |
|
| 2472 | + unset($args->denied); |
|
| 2473 | + } |
|
| 2205 | 2474 | if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
| 2206 | 2475 | { |
| 2207 | 2476 | return $this->stop('msg_invalid_request'); |
@@ -2209,13 +2478,19 @@ discard block |
||
| 2209 | 2478 | } |
| 2210 | 2479 | |
| 2211 | 2480 | // Sanitize user ID, username, nickname, homepage, blog |
| 2212 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2481 | + if($args->user_id) { |
|
| 2482 | + $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2483 | + } |
|
| 2213 | 2484 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2214 | 2485 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2215 | 2486 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2216 | 2487 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2217 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2218 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2488 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) { |
|
| 2489 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2490 | + } |
|
| 2491 | + if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) { |
|
| 2492 | + $args->blog = 'http://'.$args->blog; |
|
| 2493 | + } |
|
| 2219 | 2494 | |
| 2220 | 2495 | // check member identifier form |
| 2221 | 2496 | $config = $oMemberModel->getMemberConfig(); |
@@ -2232,8 +2507,7 @@ discard block |
||
| 2232 | 2507 | return new BaseObject(-1,'msg_exists_email_address'); |
| 2233 | 2508 | } |
| 2234 | 2509 | $args->email_address = $orgMemberInfo->email_address; |
| 2235 | - } |
|
| 2236 | - else |
|
| 2510 | + } else |
|
| 2237 | 2511 | { |
| 2238 | 2512 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2239 | 2513 | if($member_srl && $args->member_srl != $member_srl) |
@@ -2290,16 +2564,14 @@ discard block |
||
| 2290 | 2564 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2291 | 2565 | } |
| 2292 | 2566 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2293 | - } |
|
| 2294 | - else |
|
| 2567 | + } else |
|
| 2295 | 2568 | { |
| 2296 | 2569 | $args->password = $orgMemberInfo->password; |
| 2297 | 2570 | } |
| 2298 | 2571 | |
| 2299 | 2572 | if($args->find_account_answer) { |
| 2300 | 2573 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2301 | - } |
|
| 2302 | - else |
|
| 2574 | + } else |
|
| 2303 | 2575 | { |
| 2304 | 2576 | $oPassword = new Password(); |
| 2305 | 2577 | $hashed = $oPassword->checkAlgorithm($orgMemberInfo->find_account_answer); |
@@ -2311,11 +2583,21 @@ discard block |
||
| 2311 | 2583 | } |
| 2312 | 2584 | } |
| 2313 | 2585 | |
| 2314 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2315 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2316 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2317 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2318 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2586 | + if(!$args->user_name) { |
|
| 2587 | + $args->user_name = $orgMemberInfo->user_name; |
|
| 2588 | + } |
|
| 2589 | + if(!$args->user_id) { |
|
| 2590 | + $args->user_id = $orgMemberInfo->user_id; |
|
| 2591 | + } |
|
| 2592 | + if(!$args->nick_name) { |
|
| 2593 | + $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2594 | + } |
|
| 2595 | + if(!$args->description) { |
|
| 2596 | + $args->description = $orgMemberInfo->description; |
|
| 2597 | + } |
|
| 2598 | + if(!$args->birthday) { |
|
| 2599 | + $args->birthday = ''; |
|
| 2600 | + } |
|
| 2319 | 2601 | |
| 2320 | 2602 | $output = executeQuery('member.updateMember', $args); |
| 2321 | 2603 | |
@@ -2327,8 +2609,11 @@ discard block |
||
| 2327 | 2609 | |
| 2328 | 2610 | if($args->group_srl_list) |
| 2329 | 2611 | { |
| 2330 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2331 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2612 | + if(is_array($args->group_srl_list)) { |
|
| 2613 | + $group_srl_list = $args->group_srl_list; |
|
| 2614 | + } else { |
|
| 2615 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2616 | + } |
|
| 2332 | 2617 | // If the group information, group information changes |
| 2333 | 2618 | if(count($group_srl_list) > 0) |
| 2334 | 2619 | { |
@@ -2371,7 +2656,9 @@ discard block |
||
| 2371 | 2656 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2372 | 2657 | |
| 2373 | 2658 | // Save Session |
| 2374 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2659 | + if(!$this->memberInfo) { |
|
| 2660 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2661 | + } |
|
| 2375 | 2662 | $logged_info = Context::get('logged_info'); |
| 2376 | 2663 | |
| 2377 | 2664 | $output->add('member_srl', $args->member_srl); |
@@ -2397,8 +2684,7 @@ discard block |
||
| 2397 | 2684 | } |
| 2398 | 2685 | |
| 2399 | 2686 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2400 | - } |
|
| 2401 | - else if($args->hashed_password) |
|
| 2687 | + } else if($args->hashed_password) |
|
| 2402 | 2688 | { |
| 2403 | 2689 | $args->password = $args->hashed_password; |
| 2404 | 2690 | } |
@@ -2433,7 +2719,9 @@ discard block |
||
| 2433 | 2719 | $trigger_obj = new stdClass(); |
| 2434 | 2720 | $trigger_obj->member_srl = $member_srl; |
| 2435 | 2721 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2436 | - if(!$output->toBool()) return $output; |
|
| 2722 | + if(!$output->toBool()) { |
|
| 2723 | + return $output; |
|
| 2724 | + } |
|
| 2437 | 2725 | // Create a model object |
| 2438 | 2726 | $oMemberModel = getModel('member'); |
| 2439 | 2727 | // Bringing the user's information |
@@ -2442,9 +2730,13 @@ discard block |
||
| 2442 | 2730 | $columnList = array('member_srl', 'is_admin'); |
| 2443 | 2731 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2444 | 2732 | } |
| 2445 | - if(!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2733 | + if(!$this->memberInfo) { |
|
| 2734 | + return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2735 | + } |
|
| 2446 | 2736 | // If managers can not be deleted |
| 2447 | - if($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2737 | + if($this->memberInfo->is_admin == 'Y') { |
|
| 2738 | + return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2739 | + } |
|
| 2448 | 2740 | |
| 2449 | 2741 | $oDB = &DB::getInstance(); |
| 2450 | 2742 | $oDB->begin(); |
@@ -2508,7 +2800,9 @@ discard block |
||
| 2508 | 2800 | */ |
| 2509 | 2801 | function destroySessionInfo() |
| 2510 | 2802 | { |
| 2511 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2803 | + if(!$_SESSION || !is_array($_SESSION)) { |
|
| 2804 | + return; |
|
| 2805 | + } |
|
| 2512 | 2806 | |
| 2513 | 2807 | $memberInfo = Context::get('logged_info'); |
| 2514 | 2808 | $memberSrl = $memberInfo->member_srl; |
@@ -2547,8 +2841,9 @@ discard block |
||
| 2547 | 2841 | } |
| 2548 | 2842 | $maxLevel = 0; |
| 2549 | 2843 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2550 | - if(count($resultGroup) > 0) |
|
| 2551 | - $maxLevel = max(array_flip($resultGroup)); |
|
| 2844 | + if(count($resultGroup) > 0) { |
|
| 2845 | + $maxLevel = max(array_flip($resultGroup)); |
|
| 2846 | + } |
|
| 2552 | 2847 | |
| 2553 | 2848 | if($maxLevel > 0) |
| 2554 | 2849 | { |
@@ -2565,16 +2860,22 @@ discard block |
||
| 2565 | 2860 | |
| 2566 | 2861 | function procMemberModifyEmailAddress() |
| 2567 | 2862 | { |
| 2568 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2863 | + if(!Context::get('is_logged')) { |
|
| 2864 | + return $this->stop('msg_not_logged'); |
|
| 2865 | + } |
|
| 2569 | 2866 | |
| 2570 | 2867 | $member_info = Context::get('logged_info'); |
| 2571 | 2868 | $newEmail = Context::get('email_address'); |
| 2572 | 2869 | |
| 2573 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2870 | + if(!$newEmail) { |
|
| 2871 | + return $this->stop('msg_invalid_request'); |
|
| 2872 | + } |
|
| 2574 | 2873 | |
| 2575 | 2874 | $oMemberModel = getModel('member'); |
| 2576 | 2875 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2577 | - if($member_srl) return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2876 | + if($member_srl) { |
|
| 2877 | + return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2878 | + } |
|
| 2578 | 2879 | |
| 2579 | 2880 | if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
| 2580 | 2881 | { |
@@ -2602,7 +2903,9 @@ discard block |
||
| 2602 | 2903 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2603 | 2904 | |
| 2604 | 2905 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2605 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2906 | + if(!is_dir($tpl_path)) { |
|
| 2907 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2908 | + } |
|
| 2606 | 2909 | |
| 2607 | 2910 | global $lang; |
| 2608 | 2911 | |
@@ -2638,7 +2941,9 @@ discard block |
||
| 2638 | 2941 | { |
| 2639 | 2942 | $member_srl = Context::get('member_srl'); |
| 2640 | 2943 | $auth_key = Context::get('auth_key'); |
| 2641 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2944 | + if(!$member_srl || !$auth_key) { |
|
| 2945 | + return $this->stop('msg_invalid_request'); |
|
| 2946 | + } |
|
| 2642 | 2947 | |
| 2643 | 2948 | // Test logs for finding password by user_id and authkey |
| 2644 | 2949 | $args = new stdClass; |
@@ -2647,7 +2952,9 @@ discard block |
||
| 2647 | 2952 | $output = executeQuery('member.getAuthMail', $args); |
| 2648 | 2953 | if(!$output->toBool() || $output->data->auth_key != $auth_key) |
| 2649 | 2954 | { |
| 2650 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2955 | + if(strlen($output->data->auth_key) !== strlen($auth_key)) { |
|
| 2956 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2957 | + } |
|
| 2651 | 2958 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2652 | 2959 | } |
| 2653 | 2960 | |
@@ -2656,7 +2963,9 @@ discard block |
||
| 2656 | 2963 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2657 | 2964 | |
| 2658 | 2965 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2659 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2966 | + if(!$output->toBool()) { |
|
| 2967 | + return $this->stop($output->getMessage()); |
|
| 2968 | + } |
|
| 2660 | 2969 | |
| 2661 | 2970 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2662 | 2971 | executeQuery('member.deleteAuthChangeEmailAddress',$args); |
@@ -2677,7 +2986,9 @@ discard block |
||
| 2677 | 2986 | **/ |
| 2678 | 2987 | function triggerGetDocumentMenu(&$menu_list) |
| 2679 | 2988 | { |
| 2680 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 2989 | + if(!Context::get('is_logged')) { |
|
| 2990 | + return new BaseObject(); |
|
| 2991 | + } |
|
| 2681 | 2992 | |
| 2682 | 2993 | $logged_info = Context::get('logged_info'); |
| 2683 | 2994 | $document_srl = Context::get('target_srl'); |
@@ -2688,8 +2999,12 @@ discard block |
||
| 2688 | 2999 | $member_srl = $oDocument->get('member_srl'); |
| 2689 | 3000 | $module_srl = $oDocument->get('module_srl'); |
| 2690 | 3001 | |
| 2691 | - if(!$member_srl) return new BaseObject(); |
|
| 2692 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 3002 | + if(!$member_srl) { |
|
| 3003 | + return new BaseObject(); |
|
| 3004 | + } |
|
| 3005 | + if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 3006 | + return new BaseObject(); |
|
| 3007 | + } |
|
| 2693 | 3008 | |
| 2694 | 3009 | $oDocumentController = getController('document'); |
| 2695 | 3010 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2707,7 +3022,9 @@ discard block |
||
| 2707 | 3022 | **/ |
| 2708 | 3023 | function triggerGetCommentMenu(&$menu_list) |
| 2709 | 3024 | { |
| 2710 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 3025 | + if(!Context::get('is_logged')) { |
|
| 3026 | + return new BaseObject(); |
|
| 3027 | + } |
|
| 2711 | 3028 | |
| 2712 | 3029 | $logged_info = Context::get('logged_info'); |
| 2713 | 3030 | $comment_srl = Context::get('target_srl'); |
@@ -2718,8 +3035,12 @@ discard block |
||
| 2718 | 3035 | $module_srl = $oComment->get('module_srl'); |
| 2719 | 3036 | $member_srl = $oComment->get('member_srl'); |
| 2720 | 3037 | |
| 2721 | - if(!$member_srl) return new BaseObject(); |
|
| 2722 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 3038 | + if(!$member_srl) { |
|
| 3039 | + return new BaseObject(); |
|
| 3040 | + } |
|
| 3041 | + if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 3042 | + return new BaseObject(); |
|
| 3043 | + } |
|
| 2723 | 3044 | |
| 2724 | 3045 | $oCommentController = getController('comment'); |
| 2725 | 3046 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2735,7 +3056,9 @@ discard block |
||
| 2735 | 3056 | **/ |
| 2736 | 3057 | function procMemberSpammerManage() |
| 2737 | 3058 | { |
| 2738 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 3059 | + if(!Context::get('is_logged')) { |
|
| 3060 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 3061 | + } |
|
| 2739 | 3062 | |
| 2740 | 3063 | $logged_info = Context::get('logged_info'); |
| 2741 | 3064 | $member_srl = Context::get('member_srl'); |
@@ -2743,8 +3066,9 @@ discard block |
||
| 2743 | 3066 | $cnt_loop = Context::get('cnt_loop'); |
| 2744 | 3067 | $proc_type = Context::get('proc_type'); |
| 2745 | 3068 | $isMoveToTrash = true; |
| 2746 | - if($proc_type == "delete") |
|
| 2747 | - $isMoveToTrash = false; |
|
| 3069 | + if($proc_type == "delete") { |
|
| 3070 | + $isMoveToTrash = false; |
|
| 3071 | + } |
|
| 2748 | 3072 | |
| 2749 | 3073 | // check grant |
| 2750 | 3074 | $oModuleModel = getModel('module'); |
@@ -2752,7 +3076,9 @@ discard block |
||
| 2752 | 3076 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2753 | 3077 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2754 | 3078 | |
| 2755 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 3079 | + if(!$grant->manager) { |
|
| 3080 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 3081 | + } |
|
| 2756 | 3082 | |
| 2757 | 3083 | $proc_msg = ""; |
| 2758 | 3084 | |
@@ -2761,11 +3087,13 @@ discard block |
||
| 2761 | 3087 | |
| 2762 | 3088 | // delete or trash destination |
| 2763 | 3089 | // proc member |
| 2764 | - if($cnt_loop == 1) |
|
| 2765 | - $this->_spammerMember($member_srl); |
|
| 3090 | + if($cnt_loop == 1) { |
|
| 3091 | + $this->_spammerMember($member_srl); |
|
| 3092 | + } |
|
| 2766 | 3093 | // proc document and comment |
| 2767 | - elseif($cnt_loop>1) |
|
| 2768 | - $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3094 | + elseif($cnt_loop>1) { |
|
| 3095 | + $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3096 | + } |
|
| 2769 | 3097 | |
| 2770 | 3098 | // get destination count |
| 2771 | 3099 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
@@ -2773,13 +3101,16 @@ discard block |
||
| 2773 | 3101 | |
| 2774 | 3102 | $total_count = Context::get('total_count'); |
| 2775 | 3103 | $remain_count = $cnt_document + $cnt_comment; |
| 2776 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 3104 | + if($cnt_loop == 1) { |
|
| 3105 | + $total_count = $remain_count; |
|
| 3106 | + } |
|
| 2777 | 3107 | |
| 2778 | 3108 | // get progress percent |
| 2779 | - if($total_count > 0) |
|
| 2780 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2781 | - else |
|
| 2782 | - $progress = 100; |
|
| 3109 | + if($total_count > 0) { |
|
| 3110 | + $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 3111 | + } else { |
|
| 3112 | + $progress = 100; |
|
| 3113 | + } |
|
| 2783 | 3114 | |
| 2784 | 3115 | $this->add('total_count', $total_count); |
| 2785 | 3116 | $this->add('remain_count', $remain_count); |
@@ -2821,7 +3152,10 @@ discard block |
||
| 2821 | 3152 | $args->nick_name = $member_info->nick_name; |
| 2822 | 3153 | $args->denied = "Y"; |
| 2823 | 3154 | $args->description = trim( $member_info->description ); |
| 2824 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 3155 | + if( $args->description != "" ) { |
|
| 3156 | + $args->description .= "\n"; |
|
| 3157 | + } |
|
| 3158 | + // add new line |
|
| 2825 | 3159 | |
| 2826 | 3160 | $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 . "]"; |
| 2827 | 3161 | |
@@ -2866,8 +3200,11 @@ discard block |
||
| 2866 | 3200 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2867 | 3201 | if($documentList) { |
| 2868 | 3202 | foreach($documentList as $v) { |
| 2869 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2870 | - else $oDocumentController->deleteDocument($v->document_srl); |
|
| 3203 | + if($isMoveToTrash) { |
|
| 3204 | + $oDocumentController->moveDocumentToTrash($v); |
|
| 3205 | + } else { |
|
| 3206 | + $oDocumentController->deleteDocument($v->document_srl); |
|
| 3207 | + } |
|
| 2871 | 3208 | } |
| 2872 | 3209 | } |
| 2873 | 3210 | } |
@@ -637,7 +637,7 @@ |
||
| 637 | 637 | /** |
| 638 | 638 | * Spammer manage popup |
| 639 | 639 | * |
| 640 | - * @return void |
|
| 640 | + * @return BaseObject|null |
|
| 641 | 641 | **/ |
| 642 | 642 | function dispMemberSpammer() |
| 643 | 643 | { |
@@ -638,7 +638,7 @@ |
||
| 638 | 638 | * Spammer manage popup |
| 639 | 639 | * |
| 640 | 640 | * @return void |
| 641 | - **/ |
|
| 641 | + **/ |
|
| 642 | 642 | function dispMemberSpammer() |
| 643 | 643 | { |
| 644 | 644 | if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $skin = $this->member_config->skin; |
| 27 | 27 | // Set the template path |
| 28 | - if(!$skin) |
|
| 28 | + if (!$skin) |
|
| 29 | 29 | { |
| 30 | 30 | $skin = 'default'; |
| 31 | 31 | $template_path = sprintf('%sskins/%s', $this->module_path, $skin); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $oLayoutModel = getModel('layout'); |
| 50 | 50 | $layout_info = $oLayoutModel->getLayout($this->member_config->layout_srl); |
| 51 | - if($layout_info) |
|
| 51 | + if ($layout_info) |
|
| 52 | 52 | { |
| 53 | 53 | $this->module_info->layout_srl = $this->member_config->layout_srl; |
| 54 | 54 | $this->setLayoutPath($layout_info->path); |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | $oMemberModel = getModel('member'); |
| 64 | 64 | $logged_info = Context::get('logged_info'); |
| 65 | 65 | // Don't display member info to non-logged user |
| 66 | - if(!$logged_info->member_srl) return $this->stop('msg_not_permitted'); |
|
| 66 | + if (!$logged_info->member_srl) return $this->stop('msg_not_permitted'); |
|
| 67 | 67 | |
| 68 | 68 | $member_srl = Context::get('member_srl'); |
| 69 | - if(!$member_srl && Context::get('is_logged')) |
|
| 69 | + if (!$member_srl && Context::get('is_logged')) |
|
| 70 | 70 | { |
| 71 | 71 | $member_srl = $logged_info->member_srl; |
| 72 | 72 | } |
| 73 | - elseif(!$member_srl) |
|
| 73 | + elseif (!$member_srl) |
|
| 74 | 74 | { |
| 75 | 75 | return $this->dispMemberSignUpForm(); |
| 76 | 76 | } |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | unset($member_info->email_id); |
| 83 | 83 | unset($member_info->email_host); |
| 84 | 84 | |
| 85 | - if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl)) |
|
| 85 | + if ($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl)) |
|
| 86 | 86 | { |
| 87 | - $start = strpos($member_info->email_address, '@')+1; |
|
| 87 | + $start = strpos($member_info->email_address, '@') + 1; |
|
| 88 | 88 | $replaceStr = str_repeat('*', (strlen($member_info->email_address) - $start)); |
| 89 | 89 | $member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if(!$member_info->member_srl) return $this->dispMemberSignUpForm(); |
|
| 92 | + if (!$member_info->member_srl) return $this->dispMemberSignUpForm(); |
|
| 93 | 93 | |
| 94 | 94 | Context::set('memberInfo', get_object_vars($member_info)); |
| 95 | 95 | |
@@ -107,46 +107,46 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $logged_info = Context::get('logged_info'); |
| 109 | 109 | $displayDatas = array(); |
| 110 | - foreach($memberConfig->signupForm as $no=>$formInfo) |
|
| 110 | + foreach ($memberConfig->signupForm as $no=>$formInfo) |
|
| 111 | 111 | { |
| 112 | - if(!$formInfo->isUse) |
|
| 112 | + if (!$formInfo->isUse) |
|
| 113 | 113 | { |
| 114 | 114 | continue; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if($formInfo->name == 'password' || $formInfo->name == 'find_account_question') |
|
| 117 | + if ($formInfo->name == 'password' || $formInfo->name == 'find_account_question') |
|
| 118 | 118 | { |
| 119 | 119 | continue; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y') |
|
| 122 | + if ($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y') |
|
| 123 | 123 | { |
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $item = $formInfo; |
| 128 | 128 | |
| 129 | - if($formInfo->isDefaultForm) |
|
| 129 | + if ($formInfo->isDefaultForm) |
|
| 130 | 130 | { |
| 131 | 131 | $item->title = Context::getLang($formInfo->name); |
| 132 | 132 | $item->value = $memberInfo->{$formInfo->name}; |
| 133 | 133 | |
| 134 | - if($formInfo->name == 'profile_image' && $memberInfo->profile_image) |
|
| 134 | + if ($formInfo->name == 'profile_image' && $memberInfo->profile_image) |
|
| 135 | 135 | { |
| 136 | 136 | $target = $memberInfo->profile_image; |
| 137 | 137 | $item->value = '<img src="'.$target->src.'" />'; |
| 138 | 138 | } |
| 139 | - elseif($formInfo->name == 'image_name' && $memberInfo->image_name) |
|
| 139 | + elseif ($formInfo->name == 'image_name' && $memberInfo->image_name) |
|
| 140 | 140 | { |
| 141 | 141 | $target = $memberInfo->image_name; |
| 142 | 142 | $item->value = '<img src="'.$target->src.'" />'; |
| 143 | 143 | } |
| 144 | - elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark) |
|
| 144 | + elseif ($formInfo->name == 'image_mark' && $memberInfo->image_mark) |
|
| 145 | 145 | { |
| 146 | 146 | $target = $memberInfo->image_mark; |
| 147 | 147 | $item->value = '<img src="'.$target->src.'" />'; |
| 148 | 148 | } |
| 149 | - elseif($formInfo->name == 'birthday' && $memberInfo->birthday) |
|
| 149 | + elseif ($formInfo->name == 'birthday' && $memberInfo->birthday) |
|
| 150 | 150 | { |
| 151 | 151 | $item->value = zdate($item->value, 'Y-m-d'); |
| 152 | 152 | } |
@@ -155,19 +155,19 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | $item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title; |
| 157 | 157 | $orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value; |
| 158 | - if($formInfo->type=='tel' && is_array($orgValue)) |
|
| 158 | + if ($formInfo->type == 'tel' && is_array($orgValue)) |
|
| 159 | 159 | { |
| 160 | 160 | $item->value = implode('-', $orgValue); |
| 161 | 161 | } |
| 162 | - elseif($formInfo->type=='kr_zip' && is_array($orgValue)) |
|
| 162 | + elseif ($formInfo->type == 'kr_zip' && is_array($orgValue)) |
|
| 163 | 163 | { |
| 164 | 164 | $item->value = implode(' ', $orgValue); |
| 165 | 165 | } |
| 166 | - elseif($formInfo->type=='checkbox' && is_array($orgValue)) |
|
| 166 | + elseif ($formInfo->type == 'checkbox' && is_array($orgValue)) |
|
| 167 | 167 | { |
| 168 | - $item->value = implode(", ",$orgValue); |
|
| 168 | + $item->value = implode(", ", $orgValue); |
|
| 169 | 169 | } |
| 170 | - elseif($formInfo->type=='date') |
|
| 170 | + elseif ($formInfo->type == 'date') |
|
| 171 | 171 | { |
| 172 | 172 | $item->value = zdate($orgValue, "Y-m-d"); |
| 173 | 173 | } |
@@ -198,12 +198,12 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $oMemberModel = getModel('member'); |
| 200 | 200 | // Get the member information if logged-in |
| 201 | - if($oMemberModel->isLogged()) return $this->stop('msg_already_logged'); |
|
| 201 | + if ($oMemberModel->isLogged()) return $this->stop('msg_already_logged'); |
|
| 202 | 202 | // call a trigger (before) |
| 203 | 203 | $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config); |
| 204 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 204 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 205 | 205 | // Error appears if the member is not allowed to join |
| 206 | - if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 206 | + if ($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 207 | 207 | |
| 208 | 208 | $oMemberAdminView = getAdminView('member'); |
| 209 | 209 | $formTags = $oMemberAdminView->_getMemberInputTag($member_info); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | $logged_info = Context::get('logged_info'); |
| 228 | 228 | $oMemberModel = getModel('member'); |
| 229 | - if(!$oMemberModel->isLogged() || empty($logged_info)) |
|
| 229 | + if (!$oMemberModel->isLogged() || empty($logged_info)) |
|
| 230 | 230 | { |
| 231 | 231 | return $this->stop('msg_not_logged'); |
| 232 | 232 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $_SESSION['rechecked_password_step'] = 'INPUT_PASSWORD'; |
| 235 | 235 | |
| 236 | 236 | $templateFile = $this->getTemplatePath().'rechecked_password.html'; |
| 237 | - if(!is_readable($templateFile)) |
|
| 237 | + if (!is_readable($templateFile)) |
|
| 238 | 238 | { |
| 239 | 239 | $templatePath = sprintf('%sskins/default', $this->module_path); |
| 240 | 240 | $this->setTemplatePath($templatePath); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function dispMemberModifyInfo() |
| 261 | 261 | { |
| 262 | - if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 262 | + if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 263 | 263 | { |
| 264 | 264 | $this->dispMemberModifyInfoBefore(); |
| 265 | 265 | return; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | $oMemberModel = getModel('member'); |
| 273 | 273 | // A message appears if the user is not logged-in |
| 274 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 274 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 275 | 275 | |
| 276 | 276 | $logged_info = Context::get('logged_info'); |
| 277 | 277 | $member_srl = $logged_info->member_srl; |
@@ -279,13 +279,13 @@ discard block |
||
| 279 | 279 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address', 'find_account_answer', 'homepage', 'blog', 'birthday', 'allow_mailing'); |
| 280 | 280 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 281 | 281 | $member_info->signature = $oMemberModel->getSignature($member_srl); |
| 282 | - Context::set('member_info',$member_info); |
|
| 282 | + Context::set('member_info', $member_info); |
|
| 283 | 283 | |
| 284 | 284 | // Get a list of extend join form |
| 285 | 285 | Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info)); |
| 286 | 286 | |
| 287 | 287 | // Editor of the module set for signing by calling getEditor |
| 288 | - if($member_info->member_srl) |
|
| 288 | + if ($member_info->member_srl) |
|
| 289 | 289 | { |
| 290 | 290 | $oEditorModel = getModel('editor'); |
| 291 | 291 | $option = new stdClass(); |
@@ -330,15 +330,15 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | $oMemberModel = getModel('member'); |
| 332 | 332 | // A message appears if the user is not logged-in |
| 333 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 333 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 334 | 334 | |
| 335 | 335 | $logged_info = Context::get('logged_info'); |
| 336 | 336 | $member_srl = $logged_info->member_srl; |
| 337 | 337 | |
| 338 | 338 | $module_srl = Context::get('module_srl'); |
| 339 | - Context::set('module_srl',Context::get('selected_module_srl')); |
|
| 340 | - Context::set('search_target','member_srl'); |
|
| 341 | - Context::set('search_keyword',$member_srl); |
|
| 339 | + Context::set('module_srl', Context::get('selected_module_srl')); |
|
| 340 | + Context::set('search_target', 'member_srl'); |
|
| 341 | + Context::set('search_keyword', $member_srl); |
|
| 342 | 342 | |
| 343 | 343 | $oDocumentAdminView = getAdminView('document'); |
| 344 | 344 | $oDocumentAdminView->dispDocumentAdminList(); |
@@ -357,12 +357,12 @@ discard block |
||
| 357 | 357 | { |
| 358 | 358 | $oMemberModel = getModel('member'); |
| 359 | 359 | // A message appears if the user is not logged-in |
| 360 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 360 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 361 | 361 | |
| 362 | 362 | $logged_info = Context::get('logged_info'); |
| 363 | 363 | $args = new stdClass(); |
| 364 | 364 | $args->member_srl = $logged_info->member_srl; |
| 365 | - $args->page = (int)Context::get('page'); |
|
| 365 | + $args->page = (int) Context::get('page'); |
|
| 366 | 366 | |
| 367 | 367 | $output = executeQuery('member.getScrapDocumentList', $args); |
| 368 | 368 | Context::set('total_count', $output->total_count); |
@@ -384,12 +384,12 @@ discard block |
||
| 384 | 384 | { |
| 385 | 385 | $oMemberModel = getModel('member'); |
| 386 | 386 | // A message appears if the user is not logged-in |
| 387 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 387 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 388 | 388 | // Get the saved document(module_srl is set to member_srl instead) |
| 389 | 389 | $logged_info = Context::get('logged_info'); |
| 390 | 390 | $args = new stdClass(); |
| 391 | 391 | $args->member_srl = $logged_info->member_srl; |
| 392 | - $args->page = (int)Context::get('page'); |
|
| 392 | + $args->page = (int) Context::get('page'); |
|
| 393 | 393 | $args->statusList = array('TEMP'); |
| 394 | 394 | |
| 395 | 395 | $oDocumentModel = getModel('document'); |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | */ |
| 409 | 409 | function dispMemberLoginForm() |
| 410 | 410 | { |
| 411 | - if(Context::get('is_logged')) |
|
| 411 | + if (Context::get('is_logged')) |
|
| 412 | 412 | { |
| 413 | - Context::set('redirect_url', getNotEncodedUrl('act','')); |
|
| 413 | + Context::set('redirect_url', getNotEncodedUrl('act', '')); |
|
| 414 | 414 | $this->setTemplatePath($this->module_path.'tpl'); |
| 415 | 415 | $this->setTemplateFile('redirect.html'); |
| 416 | 416 | return; |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | $XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE'); |
| 425 | 425 | $XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR'); |
| 426 | - if($XE_VALIDATOR_ERROR == -11) |
|
| 427 | - Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description); |
|
| 426 | + if ($XE_VALIDATOR_ERROR == -11) |
|
| 427 | + Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE.$config->limit_day_description); |
|
| 428 | 428 | |
| 429 | - if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) |
|
| 429 | + if ($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) |
|
| 430 | 430 | Context::set('referer_url', getUrl('')); |
| 431 | 431 | else |
| 432 | 432 | Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | { |
| 443 | 443 | $oMemberModel = getModel('member'); |
| 444 | 444 | // A message appears if the user is not logged-in |
| 445 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 445 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 446 | 446 | |
| 447 | 447 | $memberConfig = $this->member_config; |
| 448 | 448 | |
@@ -451,9 +451,9 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | $columnList = array('member_srl', 'user_id'); |
| 453 | 453 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 454 | - Context::set('member_info',$member_info); |
|
| 454 | + Context::set('member_info', $member_info); |
|
| 455 | 455 | |
| 456 | - if($memberConfig->identifier == 'user_id') |
|
| 456 | + if ($memberConfig->identifier == 'user_id') |
|
| 457 | 457 | { |
| 458 | 458 | Context::set('identifier', 'user_id'); |
| 459 | 459 | Context::set('formValue', $member_info->user_id); |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | { |
| 475 | 475 | $oMemberModel = getModel('member'); |
| 476 | 476 | // A message appears if the user is not logged-in |
| 477 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 477 | + if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 478 | 478 | |
| 479 | 479 | $memberConfig = $this->member_config; |
| 480 | 480 | |
@@ -482,9 +482,9 @@ discard block |
||
| 482 | 482 | $member_srl = $logged_info->member_srl; |
| 483 | 483 | |
| 484 | 484 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
| 485 | - Context::set('member_info',$member_info); |
|
| 485 | + Context::set('member_info', $member_info); |
|
| 486 | 486 | |
| 487 | - if($memberConfig->identifier == 'user_id') |
|
| 487 | + if ($memberConfig->identifier == 'user_id') |
|
| 488 | 488 | { |
| 489 | 489 | Context::set('identifier', 'user_id'); |
| 490 | 490 | Context::set('formValue', $member_info->user_id); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | { |
| 506 | 506 | $oMemberController = getController('member'); |
| 507 | 507 | $output = $oMemberController->procMemberLogout(); |
| 508 | - if(!$output->redirect_url) |
|
| 508 | + if (!$output->redirect_url) |
|
| 509 | 509 | $this->setRedirectUrl(getNotEncodedUrl('act', '')); |
| 510 | 510 | else |
| 511 | 511 | $this->setRedirectUrl($output->redirect_url); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | function dispMemberFindAccount() |
| 529 | 529 | { |
| 530 | - if(Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 530 | + if (Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 531 | 531 | |
| 532 | 532 | $config = $this->member_config; |
| 533 | 533 | |
@@ -541,13 +541,13 @@ discard block |
||
| 541 | 541 | */ |
| 542 | 542 | function dispMemberGetTempPassword() |
| 543 | 543 | { |
| 544 | - if(Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 544 | + if (Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 545 | 545 | |
| 546 | 546 | $user_id = Context::get('user_id'); |
| 547 | 547 | $temp_password = $_SESSION['xe_temp_password_'.$user_id]; |
| 548 | 548 | unset($_SESSION['xe_temp_password_'.$user_id]); |
| 549 | 549 | |
| 550 | - if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request'); |
|
| 550 | + if (!$user_id || !$temp_password) return new BaseObject(-1, 'msg_invaild_request'); |
|
| 551 | 551 | |
| 552 | 552 | Context::set('temp_password', $temp_password); |
| 553 | 553 | |
@@ -562,12 +562,12 @@ discard block |
||
| 562 | 562 | $authMemberSrl = $_SESSION['auth_member_srl']; |
| 563 | 563 | unset($_SESSION['auth_member_srl']); |
| 564 | 564 | |
| 565 | - if(Context::get('is_logged')) |
|
| 565 | + if (Context::get('is_logged')) |
|
| 566 | 566 | { |
| 567 | 567 | return $this->stop('already_logged'); |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - if($authMemberSrl) |
|
| 570 | + if ($authMemberSrl) |
|
| 571 | 571 | { |
| 572 | 572 | $oMemberModel = getModel('member'); |
| 573 | 573 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($authMemberSrl); |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | function dispMemberModifyEmailAddress() |
| 586 | 586 | { |
| 587 | - if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 587 | + if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 588 | 588 | { |
| 589 | 589 | Context::set('success_return_url', getUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyEmailAddress')); |
| 590 | 590 | $this->dispMemberModifyInfoBefore(); |
@@ -612,10 +612,10 @@ discard block |
||
| 612 | 612 | $js_code[] = 'if(!validator) return false;'; |
| 613 | 613 | |
| 614 | 614 | $errorLang = array(); |
| 615 | - foreach($extraList as $val) |
|
| 615 | + foreach ($extraList as $val) |
|
| 616 | 616 | { |
| 617 | 617 | $title = str_ireplace(array('<script', '</script'), array('<scr"+"ipt', '</scr"+"ipt'), addslashes($val->column_title)); |
| 618 | - if($val->column_type == 'kr_zip' || $val->column_type == 'tel') |
|
| 618 | + if ($val->column_type == 'kr_zip' || $val->column_type == 'tel') |
|
| 619 | 619 | { |
| 620 | 620 | $js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title); |
| 621 | 621 | } |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | **/ |
| 642 | 642 | function dispMemberSpammer() |
| 643 | 643 | { |
| 644 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 644 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 645 | 645 | |
| 646 | 646 | $member_srl = Context::get('member_srl'); |
| 647 | 647 | $module_srl = Context::get('module_srl'); |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 653 | 653 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 654 | 654 | |
| 655 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 655 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 656 | 656 | |
| 657 | 657 | $oMemberModel = getModel('member'); |
| 658 | 658 | |
@@ -29,16 +29,14 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $skin = 'default'; |
| 31 | 31 | $template_path = sprintf('%sskins/%s', $this->module_path, $skin); |
| 32 | - } |
|
| 33 | - else |
|
| 32 | + } else |
|
| 34 | 33 | { |
| 35 | 34 | //check theme |
| 36 | 35 | $config_parse = explode('|@|', $skin); |
| 37 | 36 | if (count($config_parse) > 1) |
| 38 | 37 | { |
| 39 | 38 | $template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]); |
| 40 | - } |
|
| 41 | - else |
|
| 39 | + } else |
|
| 42 | 40 | { |
| 43 | 41 | $template_path = sprintf('%sskins/%s', $this->module_path, $skin); |
| 44 | 42 | } |
@@ -63,14 +61,15 @@ discard block |
||
| 63 | 61 | $oMemberModel = getModel('member'); |
| 64 | 62 | $logged_info = Context::get('logged_info'); |
| 65 | 63 | // Don't display member info to non-logged user |
| 66 | - if(!$logged_info->member_srl) return $this->stop('msg_not_permitted'); |
|
| 64 | + if(!$logged_info->member_srl) { |
|
| 65 | + return $this->stop('msg_not_permitted'); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | $member_srl = Context::get('member_srl'); |
| 69 | 69 | if(!$member_srl && Context::get('is_logged')) |
| 70 | 70 | { |
| 71 | 71 | $member_srl = $logged_info->member_srl; |
| 72 | - } |
|
| 73 | - elseif(!$member_srl) |
|
| 72 | + } elseif(!$member_srl) |
|
| 74 | 73 | { |
| 75 | 74 | return $this->dispMemberSignUpForm(); |
| 76 | 75 | } |
@@ -89,7 +88,9 @@ discard block |
||
| 89 | 88 | $member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start); |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | - if(!$member_info->member_srl) return $this->dispMemberSignUpForm(); |
|
| 91 | + if(!$member_info->member_srl) { |
|
| 92 | + return $this->dispMemberSignUpForm(); |
|
| 93 | + } |
|
| 93 | 94 | |
| 94 | 95 | Context::set('memberInfo', get_object_vars($member_info)); |
| 95 | 96 | |
@@ -135,43 +136,35 @@ discard block |
||
| 135 | 136 | { |
| 136 | 137 | $target = $memberInfo->profile_image; |
| 137 | 138 | $item->value = '<img src="'.$target->src.'" />'; |
| 138 | - } |
|
| 139 | - elseif($formInfo->name == 'image_name' && $memberInfo->image_name) |
|
| 139 | + } elseif($formInfo->name == 'image_name' && $memberInfo->image_name) |
|
| 140 | 140 | { |
| 141 | 141 | $target = $memberInfo->image_name; |
| 142 | 142 | $item->value = '<img src="'.$target->src.'" />'; |
| 143 | - } |
|
| 144 | - elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark) |
|
| 143 | + } elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark) |
|
| 145 | 144 | { |
| 146 | 145 | $target = $memberInfo->image_mark; |
| 147 | 146 | $item->value = '<img src="'.$target->src.'" />'; |
| 148 | - } |
|
| 149 | - elseif($formInfo->name == 'birthday' && $memberInfo->birthday) |
|
| 147 | + } elseif($formInfo->name == 'birthday' && $memberInfo->birthday) |
|
| 150 | 148 | { |
| 151 | 149 | $item->value = zdate($item->value, 'Y-m-d'); |
| 152 | 150 | } |
| 153 | - } |
|
| 154 | - else |
|
| 151 | + } else |
|
| 155 | 152 | { |
| 156 | 153 | $item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title; |
| 157 | 154 | $orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value; |
| 158 | 155 | if($formInfo->type=='tel' && is_array($orgValue)) |
| 159 | 156 | { |
| 160 | 157 | $item->value = implode('-', $orgValue); |
| 161 | - } |
|
| 162 | - elseif($formInfo->type=='kr_zip' && is_array($orgValue)) |
|
| 158 | + } elseif($formInfo->type=='kr_zip' && is_array($orgValue)) |
|
| 163 | 159 | { |
| 164 | 160 | $item->value = implode(' ', $orgValue); |
| 165 | - } |
|
| 166 | - elseif($formInfo->type=='checkbox' && is_array($orgValue)) |
|
| 161 | + } elseif($formInfo->type=='checkbox' && is_array($orgValue)) |
|
| 167 | 162 | { |
| 168 | 163 | $item->value = implode(", ",$orgValue); |
| 169 | - } |
|
| 170 | - elseif($formInfo->type=='date') |
|
| 164 | + } elseif($formInfo->type=='date') |
|
| 171 | 165 | { |
| 172 | 166 | $item->value = zdate($orgValue, "Y-m-d"); |
| 173 | - } |
|
| 174 | - else |
|
| 167 | + } else |
|
| 175 | 168 | { |
| 176 | 169 | $item->value = nl2br($orgValue); |
| 177 | 170 | } |
@@ -198,12 +191,18 @@ discard block |
||
| 198 | 191 | |
| 199 | 192 | $oMemberModel = getModel('member'); |
| 200 | 193 | // Get the member information if logged-in |
| 201 | - if($oMemberModel->isLogged()) return $this->stop('msg_already_logged'); |
|
| 194 | + if($oMemberModel->isLogged()) { |
|
| 195 | + return $this->stop('msg_already_logged'); |
|
| 196 | + } |
|
| 202 | 197 | // call a trigger (before) |
| 203 | 198 | $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config); |
| 204 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 199 | + if(!$trigger_output->toBool()) { |
|
| 200 | + return $trigger_output; |
|
| 201 | + } |
|
| 205 | 202 | // Error appears if the member is not allowed to join |
| 206 | - if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 203 | + if($member_config->enable_join != 'Y') { |
|
| 204 | + return $this->stop('msg_signup_disabled'); |
|
| 205 | + } |
|
| 207 | 206 | |
| 208 | 207 | $oMemberAdminView = getAdminView('member'); |
| 209 | 208 | $formTags = $oMemberAdminView->_getMemberInputTag($member_info); |
@@ -244,8 +243,7 @@ discard block |
||
| 244 | 243 | { |
| 245 | 244 | Context::set('identifierTitle', Context::getLang('email_address')); |
| 246 | 245 | Context::set('identifierValue', $logged_info->email_address); |
| 247 | - } |
|
| 248 | - else |
|
| 246 | + } else |
|
| 249 | 247 | { |
| 250 | 248 | Context::set('identifierTitle', Context::getLang('user_id')); |
| 251 | 249 | Context::set('identifierValue', $logged_info->user_id); |
@@ -271,7 +269,9 @@ discard block |
||
| 271 | 269 | |
| 272 | 270 | $oMemberModel = getModel('member'); |
| 273 | 271 | // A message appears if the user is not logged-in |
| 274 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 272 | + if(!$oMemberModel->isLogged()) { |
|
| 273 | + return $this->stop('msg_not_logged'); |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | 276 | $logged_info = Context::get('logged_info'); |
| 277 | 277 | $member_srl = $logged_info->member_srl; |
@@ -330,7 +330,9 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | $oMemberModel = getModel('member'); |
| 332 | 332 | // A message appears if the user is not logged-in |
| 333 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 333 | + if(!$oMemberModel->isLogged()) { |
|
| 334 | + return $this->stop('msg_not_logged'); |
|
| 335 | + } |
|
| 334 | 336 | |
| 335 | 337 | $logged_info = Context::get('logged_info'); |
| 336 | 338 | $member_srl = $logged_info->member_srl; |
@@ -357,7 +359,9 @@ discard block |
||
| 357 | 359 | { |
| 358 | 360 | $oMemberModel = getModel('member'); |
| 359 | 361 | // A message appears if the user is not logged-in |
| 360 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 362 | + if(!$oMemberModel->isLogged()) { |
|
| 363 | + return $this->stop('msg_not_logged'); |
|
| 364 | + } |
|
| 361 | 365 | |
| 362 | 366 | $logged_info = Context::get('logged_info'); |
| 363 | 367 | $args = new stdClass(); |
@@ -384,7 +388,9 @@ discard block |
||
| 384 | 388 | { |
| 385 | 389 | $oMemberModel = getModel('member'); |
| 386 | 390 | // A message appears if the user is not logged-in |
| 387 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 391 | + if(!$oMemberModel->isLogged()) { |
|
| 392 | + return $this->stop('msg_not_logged'); |
|
| 393 | + } |
|
| 388 | 394 | // Get the saved document(module_srl is set to member_srl instead) |
| 389 | 395 | $logged_info = Context::get('logged_info'); |
| 390 | 396 | $args = new stdClass(); |
@@ -423,13 +429,15 @@ discard block |
||
| 423 | 429 | |
| 424 | 430 | $XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE'); |
| 425 | 431 | $XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR'); |
| 426 | - if($XE_VALIDATOR_ERROR == -11) |
|
| 427 | - Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description); |
|
| 432 | + if($XE_VALIDATOR_ERROR == -11) { |
|
| 433 | + Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description); |
|
| 434 | + } |
|
| 428 | 435 | |
| 429 | - if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) |
|
| 430 | - Context::set('referer_url', getUrl('')); |
|
| 431 | - else |
|
| 432 | - Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 436 | + if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) { |
|
| 437 | + Context::set('referer_url', getUrl('')); |
|
| 438 | + } else { |
|
| 439 | + Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 440 | + } |
|
| 433 | 441 | |
| 434 | 442 | // Set a template file |
| 435 | 443 | $this->setTemplateFile('login_form'); |
@@ -442,7 +450,9 @@ discard block |
||
| 442 | 450 | { |
| 443 | 451 | $oMemberModel = getModel('member'); |
| 444 | 452 | // A message appears if the user is not logged-in |
| 445 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 453 | + if(!$oMemberModel->isLogged()) { |
|
| 454 | + return $this->stop('msg_not_logged'); |
|
| 455 | + } |
|
| 446 | 456 | |
| 447 | 457 | $memberConfig = $this->member_config; |
| 448 | 458 | |
@@ -457,8 +467,7 @@ discard block |
||
| 457 | 467 | { |
| 458 | 468 | Context::set('identifier', 'user_id'); |
| 459 | 469 | Context::set('formValue', $member_info->user_id); |
| 460 | - } |
|
| 461 | - else |
|
| 470 | + } else |
|
| 462 | 471 | { |
| 463 | 472 | Context::set('identifier', 'email_address'); |
| 464 | 473 | Context::set('formValue', $member_info->email_address); |
@@ -474,7 +483,9 @@ discard block |
||
| 474 | 483 | { |
| 475 | 484 | $oMemberModel = getModel('member'); |
| 476 | 485 | // A message appears if the user is not logged-in |
| 477 | - if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); |
|
| 486 | + if(!$oMemberModel->isLogged()) { |
|
| 487 | + return $this->stop('msg_not_logged'); |
|
| 488 | + } |
|
| 478 | 489 | |
| 479 | 490 | $memberConfig = $this->member_config; |
| 480 | 491 | |
@@ -488,8 +499,7 @@ discard block |
||
| 488 | 499 | { |
| 489 | 500 | Context::set('identifier', 'user_id'); |
| 490 | 501 | Context::set('formValue', $member_info->user_id); |
| 491 | - } |
|
| 492 | - else |
|
| 502 | + } else |
|
| 493 | 503 | { |
| 494 | 504 | Context::set('identifier', 'email_address'); |
| 495 | 505 | Context::set('formValue', $member_info->email_address); |
@@ -505,10 +515,11 @@ discard block |
||
| 505 | 515 | { |
| 506 | 516 | $oMemberController = getController('member'); |
| 507 | 517 | $output = $oMemberController->procMemberLogout(); |
| 508 | - if(!$output->redirect_url) |
|
| 509 | - $this->setRedirectUrl(getNotEncodedUrl('act', '')); |
|
| 510 | - else |
|
| 511 | - $this->setRedirectUrl($output->redirect_url); |
|
| 518 | + if(!$output->redirect_url) { |
|
| 519 | + $this->setRedirectUrl(getNotEncodedUrl('act', '')); |
|
| 520 | + } else { |
|
| 521 | + $this->setRedirectUrl($output->redirect_url); |
|
| 522 | + } |
|
| 512 | 523 | |
| 513 | 524 | return; |
| 514 | 525 | } |
@@ -527,7 +538,9 @@ discard block |
||
| 527 | 538 | */ |
| 528 | 539 | function dispMemberFindAccount() |
| 529 | 540 | { |
| 530 | - if(Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 541 | + if(Context::get('is_logged')) { |
|
| 542 | + return $this->stop('already_logged'); |
|
| 543 | + } |
|
| 531 | 544 | |
| 532 | 545 | $config = $this->member_config; |
| 533 | 546 | |
@@ -541,13 +554,17 @@ discard block |
||
| 541 | 554 | */ |
| 542 | 555 | function dispMemberGetTempPassword() |
| 543 | 556 | { |
| 544 | - if(Context::get('is_logged')) return $this->stop('already_logged'); |
|
| 557 | + if(Context::get('is_logged')) { |
|
| 558 | + return $this->stop('already_logged'); |
|
| 559 | + } |
|
| 545 | 560 | |
| 546 | 561 | $user_id = Context::get('user_id'); |
| 547 | 562 | $temp_password = $_SESSION['xe_temp_password_'.$user_id]; |
| 548 | 563 | unset($_SESSION['xe_temp_password_'.$user_id]); |
| 549 | 564 | |
| 550 | - if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request'); |
|
| 565 | + if(!$user_id||!$temp_password) { |
|
| 566 | + return new BaseObject(-1,'msg_invaild_request'); |
|
| 567 | + } |
|
| 551 | 568 | |
| 552 | 569 | Context::set('temp_password', $temp_password); |
| 553 | 570 | |
@@ -575,8 +592,7 @@ discard block |
||
| 575 | 592 | $_SESSION['auth_member_info'] = $memberInfo; |
| 576 | 593 | Context::set('memberInfo', $memberInfo); |
| 577 | 594 | $this->setTemplateFile('reset_mail'); |
| 578 | - } |
|
| 579 | - else |
|
| 595 | + } else |
|
| 580 | 596 | { |
| 581 | 597 | $this->setTemplateFile('resend_auth_mail'); |
| 582 | 598 | } |
@@ -618,8 +634,7 @@ discard block |
||
| 618 | 634 | if($val->column_type == 'kr_zip' || $val->column_type == 'tel') |
| 619 | 635 | { |
| 620 | 636 | $js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title); |
| 621 | - } |
|
| 622 | - else |
|
| 637 | + } else |
|
| 623 | 638 | { |
| 624 | 639 | $js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s","%s"]);', $val->column_name, $title); |
| 625 | 640 | } |
@@ -641,7 +656,9 @@ discard block |
||
| 641 | 656 | **/ |
| 642 | 657 | function dispMemberSpammer() |
| 643 | 658 | { |
| 644 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 659 | + if(!Context::get('is_logged')) { |
|
| 660 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 661 | + } |
|
| 645 | 662 | |
| 646 | 663 | $member_srl = Context::get('member_srl'); |
| 647 | 664 | $module_srl = Context::get('module_srl'); |
@@ -652,7 +669,9 @@ discard block |
||
| 652 | 669 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 653 | 670 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 654 | 671 | |
| 655 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 672 | + if(!$grant->manager) { |
|
| 673 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 674 | + } |
|
| 656 | 675 | |
| 657 | 676 | $oMemberModel = getModel('member'); |
| 658 | 677 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Add a menu |
| 64 | - * @return void|object |
|
| 64 | + * @return BaseObject|null |
|
| 65 | 65 | */ |
| 66 | 66 | function procMenuAdminInsert() |
| 67 | 67 | { |
@@ -304,6 +304,7 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * Delete menu |
| 306 | 306 | * Delete menu_item and xml cache files |
| 307 | + * @param string $menu_srl |
|
| 307 | 308 | * @return BaseObject |
| 308 | 309 | */ |
| 309 | 310 | function deleteMenu($menu_srl) |
@@ -380,6 +381,7 @@ discard block |
||
| 380 | 381 | |
| 381 | 382 | /** |
| 382 | 383 | * Add an item to the menu, simple version |
| 384 | + * @param stdClass $request |
|
| 383 | 385 | * @return void |
| 384 | 386 | */ |
| 385 | 387 | public function procMenuAdminInsertItem($request = NULL) |
@@ -518,6 +520,9 @@ discard block |
||
| 518 | 520 | $this->setMessage('success_registed', 'info'); |
| 519 | 521 | } |
| 520 | 522 | |
| 523 | + /** |
|
| 524 | + * @param boolean $isProc |
|
| 525 | + */ |
|
| 521 | 526 | private function _insertMenu(&$request, $isProc) |
| 522 | 527 | { |
| 523 | 528 | $oDB = DB::getInstance(); |
@@ -583,6 +588,7 @@ discard block |
||
| 583 | 588 | * insert module by men create value |
| 584 | 589 | * @request value of client request |
| 585 | 590 | * @args value for menu create |
| 591 | + * @param stdClass $args |
|
| 586 | 592 | * @return bool result of create module |
| 587 | 593 | */ |
| 588 | 594 | private function _insertModule(&$request, &$args) |
@@ -640,7 +646,7 @@ discard block |
||
| 640 | 646 | |
| 641 | 647 | /** |
| 642 | 648 | * Update an item to the menu, simple version |
| 643 | - * @return void |
|
| 649 | + * @return BaseObject|null |
|
| 644 | 650 | */ |
| 645 | 651 | public function procMenuAdminUpdateItem() |
| 646 | 652 | { |
@@ -841,6 +847,7 @@ discard block |
||
| 841 | 847 | /** |
| 842 | 848 | * Delete menu item ( Only include BO ) |
| 843 | 849 | * @args menu_srl, menu_item_srl, is_force |
| 850 | + * @param stdClass $args |
|
| 844 | 851 | * @return void|BaseObject |
| 845 | 852 | */ |
| 846 | 853 | public function deleteItem($args) |
@@ -989,6 +996,9 @@ discard block |
||
| 989 | 996 | return new BaseObject(0, 'success'); |
| 990 | 997 | } |
| 991 | 998 | |
| 999 | + /** |
|
| 1000 | + * @param DB $oDB |
|
| 1001 | + */ |
|
| 992 | 1002 | private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node) |
| 993 | 1003 | { |
| 994 | 1004 | $output = $this->_deleteMenuItem($oDB, $menuInfo, $node); |
@@ -1008,7 +1018,7 @@ discard block |
||
| 1008 | 1018 | |
| 1009 | 1019 | /** |
| 1010 | 1020 | * Move menu items |
| 1011 | - * @return void |
|
| 1021 | + * @return BaseObject|null |
|
| 1012 | 1022 | */ |
| 1013 | 1023 | function procMenuAdminMoveItem() |
| 1014 | 1024 | { |
@@ -1173,6 +1183,9 @@ discard block |
||
| 1173 | 1183 | } |
| 1174 | 1184 | } |
| 1175 | 1185 | |
| 1186 | + /** |
|
| 1187 | + * @param string $parentSrl |
|
| 1188 | + */ |
|
| 1176 | 1189 | private function _copyMenu($menuSrl, $parentSrl, &$originMenu) |
| 1177 | 1190 | { |
| 1178 | 1191 | $oMenuAdminModel = getAdminModel('menu'); |
@@ -2129,7 +2142,7 @@ discard block |
||
| 2129 | 2142 | |
| 2130 | 2143 | /** |
| 2131 | 2144 | * Register a menu image button |
| 2132 | - * @param object $args |
|
| 2145 | + * @param BaseObject $args |
|
| 2133 | 2146 | * @return array |
| 2134 | 2147 | */ |
| 2135 | 2148 | function _uploadButton($args) |
@@ -2204,6 +2217,7 @@ discard block |
||
| 2204 | 2217 | /** |
| 2205 | 2218 | * When copy a menu, button copied also. |
| 2206 | 2219 | * @param $args menuItemInfo with button values |
| 2220 | + * @param string $insertedMenuItemSrl |
|
| 2207 | 2221 | */ |
| 2208 | 2222 | private function _copyButton($insertedMenuItemSrl, $insertedMenuSrl, &$menuItemInfo) |
| 2209 | 2223 | { |
@@ -2244,6 +2258,9 @@ discard block |
||
| 2244 | 2258 | return $copied_info; |
| 2245 | 2259 | } |
| 2246 | 2260 | |
| 2261 | + /** |
|
| 2262 | + * @param string $mode |
|
| 2263 | + */ |
|
| 2247 | 2264 | private function _changeMenuItemSrlInButtonPath($buttonPath, $menuSrl, $menuItemSrl, $mode) |
| 2248 | 2265 | { |
| 2249 | 2266 | $path = sprintf('./files/attach/menu_button/%d/', $menuSrl); |
@@ -2253,6 +2270,9 @@ discard block |
||
| 2253 | 2270 | return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext); |
| 2254 | 2271 | } |
| 2255 | 2272 | |
| 2273 | + /** |
|
| 2274 | + * @param integer $menuSrl |
|
| 2275 | + */ |
|
| 2256 | 2276 | public function makeHomemenuCacheFile($menuSrl) |
| 2257 | 2277 | { |
| 2258 | 2278 | $cacheBuff .= sprintf('<?php if(!defined("__XE__")) exit();'); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | function __construct() { |
| 59 | - $this->homeMenuCacheFile = _XE_PATH_ . $this->homeMenuCacheFile; |
|
| 59 | + $this->homeMenuCacheFile = _XE_PATH_.$this->homeMenuCacheFile; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | // List variables |
| 69 | 69 | $site_module_info = Context::get('site_module_info'); |
| 70 | 70 | |
| 71 | - $output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl); |
|
| 72 | - if(!$output->toBool()) return $output; |
|
| 71 | + $output = $this->addMenu(Context::get('title'), (int) $site_module_info->site_srl); |
|
| 72 | + if (!$output->toBool()) return $output; |
|
| 73 | 73 | |
| 74 | 74 | $this->add('menu_srl', $output->get('menuSrl')); |
| 75 | 75 | $this->setMessage('success_registed'); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $args->listorder = $args->menu_srl * -1; |
| 96 | 96 | |
| 97 | 97 | $output = executeQuery('menu.insertMenu', $args); |
| 98 | - if(!$output->toBool()) |
|
| 98 | + if (!$output->toBool()) |
|
| 99 | 99 | { |
| 100 | 100 | return $output; |
| 101 | 101 | } |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | $unlinked_modules = false; |
| 110 | 110 | $args = new stdClass; |
| 111 | 111 | $args->site_srl = 0; |
| 112 | - $output = executeQueryArray('module.getNotLinkedModuleBySiteSrl',$args); |
|
| 113 | - if($output->toBool() && $output->data && count($output->data) > 0) |
|
| 112 | + $output = executeQueryArray('module.getNotLinkedModuleBySiteSrl', $args); |
|
| 113 | + if ($output->toBool() && $output->data && count($output->data) > 0) |
|
| 114 | 114 | { |
| 115 | 115 | $unlinked_modules = $output->data; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if($unlinked_modules) |
|
| 118 | + if ($unlinked_modules) |
|
| 119 | 119 | { |
| 120 | 120 | $unlinked_menu_srl = $this->getUnlinkedMenu(); |
| 121 | 121 | $output = $this->updateLinkModule($unlinked_modules, $unlinked_menu_srl); |
@@ -129,21 +129,21 @@ discard block |
||
| 129 | 129 | $oModuleModel = getModel('module'); |
| 130 | 130 | $moduleConfig = $oModuleModel->getModuleConfig('menu'); |
| 131 | 131 | |
| 132 | - if($moduleConfig->unlinked_menu_srl) |
|
| 132 | + if ($moduleConfig->unlinked_menu_srl) |
|
| 133 | 133 | { |
| 134 | 134 | $menuArgs = new stdClass; |
| 135 | 135 | $menuArgs->menu_srl = $moduleConfig->unlinked_menu_srl; |
| 136 | 136 | $menuOutput = executeQuery('menu.getMenu', $menuArgs); |
| 137 | - if(!$menuOutput->data) |
|
| 137 | + if (!$menuOutput->data) |
|
| 138 | 138 | { |
| 139 | 139 | unset($moduleConfig->unlinked_menu_srl); |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if(!$moduleConfig->unlinked_menu_srl) |
|
| 143 | + if (!$moduleConfig->unlinked_menu_srl) |
|
| 144 | 144 | { |
| 145 | 145 | $output = $this->addMenu('unlinked', 0); |
| 146 | - if($output->toBool()) |
|
| 146 | + if ($output->toBool()) |
|
| 147 | 147 | { |
| 148 | 148 | $moduleConfig->unlinked_menu_srl = $output->get('menuSrl'); |
| 149 | 149 | $oModuleController = getController('module'); |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | function updateLinkModule($moduleInfos, $menuSrl) |
| 170 | 170 | { |
| 171 | - if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0) |
|
| 171 | + if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0) |
|
| 172 | 172 | { |
| 173 | 173 | return new BaseObject(-1, 'msg_invalid_request'); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - foreach($moduleInfos as $moduleInfo) |
|
| 176 | + foreach ($moduleInfos as $moduleInfo) |
|
| 177 | 177 | { |
| 178 | 178 | // search menu. |
| 179 | 179 | $args = new stdClass; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
| 185 | 185 | |
| 186 | - if($output->toBool() && $output->data) |
|
| 186 | + if ($output->toBool() && $output->data) |
|
| 187 | 187 | { |
| 188 | 188 | $moduleInfo->menu_srl = $output->data->menu_srl; |
| 189 | 189 | } |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | $item_args->url = $moduleInfo->mid; |
| 195 | 195 | $item_args->name = $moduleInfo->mid; |
| 196 | 196 | $item_args->menu_item_srl = getNextSequence(); |
| 197 | - $item_args->listorder = -1*$item_args->menu_item_srl; |
|
| 197 | + $item_args->listorder = -1 * $item_args->menu_item_srl; |
|
| 198 | 198 | |
| 199 | 199 | $output = executeQuery('menu.insertMenuItem', $item_args); |
| 200 | - if(!$output->toBool()) |
|
| 200 | + if (!$output->toBool()) |
|
| 201 | 201 | { |
| 202 | 202 | return $output; |
| 203 | 203 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 213 | - if($oCacheHandler->isSupport()) |
|
| 213 | + if ($oCacheHandler->isSupport()) |
|
| 214 | 214 | { |
| 215 | 215 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 216 | 216 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $args->menu_srl = Context::get('menu_srl'); |
| 236 | 236 | |
| 237 | 237 | $output = executeQuery('menu.updateMenu', $args); |
| 238 | - if(!$output->toBool()) return $output; |
|
| 238 | + if (!$output->toBool()) return $output; |
|
| 239 | 239 | |
| 240 | 240 | $this->setMessage('success_registed'); |
| 241 | 241 | |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | $menuInfo = $oMenuAdminModel->getMenu($menu_srl); |
| 256 | 256 | |
| 257 | 257 | $oAdmin = getClass('admin'); |
| 258 | - if($menuInfo->title == $oAdmin->getAdminMenuName()) |
|
| 258 | + if ($menuInfo->title == $oAdmin->getAdminMenuName()) |
|
| 259 | 259 | return new BaseObject(-1, 'msg_adminmenu_cannot_delete'); |
| 260 | 260 | |
| 261 | 261 | // get menu properies with child menu |
| 262 | 262 | $phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl); |
| 263 | 263 | $originMenu = NULL; |
| 264 | 264 | |
| 265 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
| 265 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
| 266 | 266 | { |
| 267 | 267 | include(FileHandler::getRealPath($phpFile)); |
| 268 | 268 | } |
@@ -273,25 +273,25 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | $isStartmenuInclude = false; |
| 275 | 275 | |
| 276 | - if(is_array($menu->list)) |
|
| 276 | + if (is_array($menu->list)) |
|
| 277 | 277 | { |
| 278 | - foreach($menu->list AS $key=>$value) |
|
| 278 | + foreach ($menu->list AS $key=>$value) |
|
| 279 | 279 | { |
| 280 | 280 | $originMenu = $value; |
| 281 | 281 | $this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude); |
| 282 | 282 | |
| 283 | - if($isStartmenuInclude) |
|
| 283 | + if ($isStartmenuInclude) |
|
| 284 | 284 | break; |
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - if($isStartmenuInclude) |
|
| 288 | + if ($isStartmenuInclude) |
|
| 289 | 289 | { |
| 290 | 290 | return new BaseObject(-1, 'msg_cannot_delete_homemenu'); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | $output = $this->deleteMenu($menu_srl); |
| 294 | - if(!$output->toBool()) |
|
| 294 | + if (!$output->toBool()) |
|
| 295 | 295 | { |
| 296 | 296 | return new BaseObject(-1, $output->message); |
| 297 | 297 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // Delete modules |
| 321 | 321 | $output = executeQueryArray('menu.getMenuItems', $args); |
| 322 | - if(!$output->toBool()) |
|
| 322 | + if (!$output->toBool()) |
|
| 323 | 323 | { |
| 324 | 324 | return $output; |
| 325 | 325 | } |
@@ -327,15 +327,15 @@ discard block |
||
| 327 | 327 | $oModuleController = getController('module'); |
| 328 | 328 | $oModuleModel = getModel('module'); |
| 329 | 329 | |
| 330 | - foreach($output->data as $itemInfo) |
|
| 330 | + foreach ($output->data as $itemInfo) |
|
| 331 | 331 | { |
| 332 | - if($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0) |
|
| 332 | + if ($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0) |
|
| 333 | 333 | { |
| 334 | 334 | $moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl); |
| 335 | - if($moduleInfo->module_srl) |
|
| 335 | + if ($moduleInfo->module_srl) |
|
| 336 | 336 | { |
| 337 | 337 | $output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl); |
| 338 | - if(!$output->toBool()) |
|
| 338 | + if (!$output->toBool()) |
|
| 339 | 339 | { |
| 340 | 340 | $oDB->rollback(); |
| 341 | 341 | return $output; |
@@ -346,27 +346,27 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | // Delete menu items |
| 348 | 348 | $output = executeQuery("menu.deleteMenuItems", $args); |
| 349 | - if(!$output->toBool()) |
|
| 349 | + if (!$output->toBool()) |
|
| 350 | 350 | { |
| 351 | 351 | $oDB->rollback(); |
| 352 | 352 | return $output; |
| 353 | 353 | } |
| 354 | 354 | // Delete the menu |
| 355 | 355 | $output = executeQuery("menu.deleteMenu", $args); |
| 356 | - if(!$output->toBool()) |
|
| 356 | + if (!$output->toBool()) |
|
| 357 | 357 | { |
| 358 | 358 | $oDB->rollback(); |
| 359 | 359 | return $output; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | // Delete cache files |
| 363 | - $cache_list = FileHandler::readDir("./files/cache/menu","",false,true); |
|
| 364 | - if(count($cache_list)) |
|
| 363 | + $cache_list = FileHandler::readDir("./files/cache/menu", "", false, true); |
|
| 364 | + if (count($cache_list)) |
|
| 365 | 365 | { |
| 366 | - foreach($cache_list as $cache_file) |
|
| 366 | + foreach ($cache_list as $cache_file) |
|
| 367 | 367 | { |
| 368 | 368 | $pos = strpos($cache_file, $menu_srl.'.'); |
| 369 | - if($pos>0)FileHandler::removeFile($cache_file); |
|
| 369 | + if ($pos > 0)FileHandler::removeFile($cache_file); |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | // Delete images of menu buttons |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | $oDB->commit(); |
| 377 | 377 | |
| 378 | - return new BaseObject(0,'success_deleted'); |
|
| 378 | + return new BaseObject(0, 'success_deleted'); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -385,24 +385,24 @@ discard block |
||
| 385 | 385 | public function procMenuAdminInsertItem($request = NULL) |
| 386 | 386 | { |
| 387 | 387 | $isProc = false; |
| 388 | - if(!$request) |
|
| 388 | + if (!$request) |
|
| 389 | 389 | { |
| 390 | 390 | $isProc = true; |
| 391 | 391 | $request = Context::getRequestVars(); |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if(!$request->parent_srl || !$request->menu_name) |
|
| 394 | + if (!$request->parent_srl || !$request->menu_name) |
|
| 395 | 395 | { |
| 396 | 396 | return new BaseObject(-1, 'msg_invalid_request'); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $this->_setMenuSrl($request->parent_srl, $request->menu_srl); |
| 400 | - if(!$request->menu_srl) |
|
| 400 | + if (!$request->menu_srl) |
|
| 401 | 401 | { |
| 402 | 402 | return new BaseObject(-1, 'msg_invalid_request'); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - if($request->is_shortcut == 'Y') |
|
| 405 | + if ($request->is_shortcut == 'Y') |
|
| 406 | 406 | { |
| 407 | 407 | $result = $this->_insertShortcut($request); |
| 408 | 408 | } |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $result = $this->_insertMenu($request, $isProc); |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - if($result->error < 0) |
|
| 414 | + if ($result->error < 0) |
|
| 415 | 415 | { |
| 416 | 416 | return new BaseObject($result->error, $result->message); |
| 417 | 417 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | // recreate menu cache file |
| 420 | 420 | $this->makeXmlFile($request->menu_srl); |
| 421 | 421 | |
| 422 | - if(!$isProc) |
|
| 422 | + if (!$isProc) |
|
| 423 | 423 | { |
| 424 | 424 | return $this->get('menu_item_srl'); |
| 425 | 425 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $oMenuAdminModel = getAdminModel('menu'); |
| 432 | 432 | $itemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl); |
| 433 | 433 | // parent_srl is parent menu item's srl |
| 434 | - if($itemInfo->menu_srl) |
|
| 434 | + if ($itemInfo->menu_srl) |
|
| 435 | 435 | { |
| 436 | 436 | $menu_srl = $itemInfo->menu_srl; |
| 437 | 437 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | else |
| 440 | 440 | { |
| 441 | 441 | $output = $oMenuAdminModel->getMenu($parent_srl); |
| 442 | - if($output->menu_srl == $parent_srl) |
|
| 442 | + if ($output->menu_srl == $parent_srl) |
|
| 443 | 443 | { |
| 444 | 444 | $menu_srl = $output->menu_srl; |
| 445 | 445 | $parent_srl = 0; |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $oDB->begin(); |
| 454 | 454 | |
| 455 | 455 | // type is url |
| 456 | - if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
| 456 | + if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
| 457 | 457 | { |
| 458 | 458 | // set menu variable |
| 459 | 459 | $args = new stdClass(); |
@@ -464,27 +464,27 @@ discard block |
||
| 464 | 464 | $args->is_shortcut = $request->is_shortcut; |
| 465 | 465 | $args->url = $request->shortcut_target; |
| 466 | 466 | |
| 467 | - if(!$args->open_window) $args->open_window = 'N'; |
|
| 468 | - if(!$args->expand) $args->expand = 'N'; |
|
| 469 | - if(!$args->is_shortcut) $args->is_shortcut = 'Y'; |
|
| 467 | + if (!$args->open_window) $args->open_window = 'N'; |
|
| 468 | + if (!$args->expand) $args->expand = 'N'; |
|
| 469 | + if (!$args->is_shortcut) $args->is_shortcut = 'Y'; |
|
| 470 | 470 | |
| 471 | - if($request->menu_name_key) $args->name = $request->menu_name_key; |
|
| 471 | + if ($request->menu_name_key) $args->name = $request->menu_name_key; |
|
| 472 | 472 | else $args->name = $request->menu_name; |
| 473 | 473 | } |
| 474 | 474 | // type is module short cut |
| 475 | - else if(is_numeric($request->shortcut_target)) |
|
| 475 | + else if (is_numeric($request->shortcut_target)) |
|
| 476 | 476 | { |
| 477 | 477 | // Get original information |
| 478 | 478 | $oMenuAdminModel = getAdminModel('menu'); |
| 479 | 479 | $itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target); |
| 480 | - if(!$itemInfo->menu_item_srl) |
|
| 480 | + if (!$itemInfo->menu_item_srl) |
|
| 481 | 481 | { |
| 482 | 482 | return new BaseObject(-1, 'msg_invalid_request'); |
| 483 | 483 | } |
| 484 | 484 | unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn); |
| 485 | 485 | |
| 486 | 486 | $args = $itemInfo; |
| 487 | - if(count($args->group_srls) == 0) |
|
| 487 | + if (count($args->group_srls) == 0) |
|
| 488 | 488 | { |
| 489 | 489 | unset($args->group_srls); |
| 490 | 490 | } |
@@ -504,13 +504,13 @@ discard block |
||
| 504 | 504 | $args->url = '#'; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 507 | + if ($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 508 | 508 | else $args->desc = ''; |
| 509 | 509 | |
| 510 | 510 | $args->menu_item_srl = getNextSequence(); |
| 511 | - $args->listorder = -1*$args->menu_item_srl; |
|
| 511 | + $args->listorder = -1 * $args->menu_item_srl; |
|
| 512 | 512 | $output = executeQuery('menu.insertMenuItem', $args); |
| 513 | - if(!$output->toBool()) return $output; |
|
| 513 | + if (!$output->toBool()) return $output; |
|
| 514 | 514 | |
| 515 | 515 | $oDB->commit(); |
| 516 | 516 | |
@@ -532,46 +532,46 @@ discard block |
||
| 532 | 532 | $args->expand = $request->menu_expand; |
| 533 | 533 | $args->is_shortcut = $request->is_shortcut; |
| 534 | 534 | |
| 535 | - if(!$args->open_window) $args->open_window = 'N'; |
|
| 536 | - if(!$args->expand) $args->expand = 'N'; |
|
| 537 | - if(!$args->is_shortcut) $args->is_shortcut = 'N'; |
|
| 535 | + if (!$args->open_window) $args->open_window = 'N'; |
|
| 536 | + if (!$args->expand) $args->expand = 'N'; |
|
| 537 | + if (!$args->is_shortcut) $args->is_shortcut = 'N'; |
|
| 538 | 538 | |
| 539 | - if($request->menu_name_key) $args->name = $request->menu_name_key; |
|
| 539 | + if ($request->menu_name_key) $args->name = $request->menu_name_key; |
|
| 540 | 540 | else $args->name = $request->menu_name; |
| 541 | 541 | |
| 542 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 542 | + if ($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 543 | 543 | else $args->desc = ''; |
| 544 | 544 | |
| 545 | - if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0) |
|
| 545 | + if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0) |
|
| 546 | 546 | { |
| 547 | 547 | return new BaseObject(-1, 'msg_invalid_request'); |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | // when menu copy, module already copied |
| 551 | - if($isProc) |
|
| 551 | + if ($isProc) |
|
| 552 | 552 | { |
| 553 | 553 | $result = $this->_insertModule($request, $args); |
| 554 | - if(!$result->toBool()) |
|
| 554 | + if (!$result->toBool()) |
|
| 555 | 555 | { |
| 556 | 556 | return new BaseObject(-1, $result->message); |
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | // if setting button variables, set argument button variables for db insert. but not upload in this method |
| 561 | - if($request->normal_btn) $args->normal_btn = $request->normal_btn; |
|
| 562 | - if($request->hover_btn) $args->hover_btn = $request->hover_btn; |
|
| 563 | - if($request->active_btn) $args->active_btn = $request->active_btn; |
|
| 561 | + if ($request->normal_btn) $args->normal_btn = $request->normal_btn; |
|
| 562 | + if ($request->hover_btn) $args->hover_btn = $request->hover_btn; |
|
| 563 | + if ($request->active_btn) $args->active_btn = $request->active_btn; |
|
| 564 | 564 | |
| 565 | - if(!$request->module_id) |
|
| 565 | + if (!$request->module_id) |
|
| 566 | 566 | { |
| 567 | 567 | return new BaseObject(-1, 'msg_invalid_request'); |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | $args->url = $request->module_id; |
| 571 | 571 | $args->menu_item_srl = getNextSequence(); |
| 572 | - $args->listorder = -1*$args->menu_item_srl; |
|
| 572 | + $args->listorder = -1 * $args->menu_item_srl; |
|
| 573 | 573 | $output = executeQuery('menu.insertMenuItem', $args); |
| 574 | - if(!$output->toBool()) return $output; |
|
| 574 | + if (!$output->toBool()) return $output; |
|
| 575 | 575 | |
| 576 | 576 | $oDB->commit(); |
| 577 | 577 | |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | //module create |
| 605 | 605 | $site_module_info = Context::get('site_module_info'); |
| 606 | - $cmArgs->site_srl = (int)$site_module_info->site_srl; |
|
| 606 | + $cmArgs->site_srl = (int) $site_module_info->site_srl; |
|
| 607 | 607 | $cmArgs->browser_title = $args->name; |
| 608 | 608 | $cmArgs->menu_srl = $request->menu_srl; |
| 609 | 609 | $cmArgs->layout_srl = -1; |
@@ -611,13 +611,13 @@ discard block |
||
| 611 | 611 | $cmArgs->is_skin_fix = 'N'; |
| 612 | 612 | $cmArgs->is_mskin_fix = 'N'; |
| 613 | 613 | |
| 614 | - if(Mobile::isMobileEnabled() === true) |
|
| 614 | + if (Mobile::isMobileEnabled() === true) |
|
| 615 | 615 | { |
| 616 | 616 | $cmArgs->use_mobile = 'Y'; |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | 619 | // if mid is empty, auto create mid |
| 620 | - if(!$request->module_id) |
|
| 620 | + if (!$request->module_id) |
|
| 621 | 621 | { |
| 622 | 622 | $randomMid = $this->_makeRandomMid(); |
| 623 | 623 | $request->module_id = $cmArgs->module.'_'.$randomMid; |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | // check already created module instance |
| 628 | 628 | $oModuleModel = getModel('module'); |
| 629 | 629 | $output = $oModuleModel->getModuleInfoByMid($request->module_id); |
| 630 | - if($output->module_srl) |
|
| 630 | + if ($output->module_srl) |
|
| 631 | 631 | { |
| 632 | 632 | return new BaseObject(-1, 'msg_module_name_exists'); |
| 633 | 633 | } |
@@ -646,14 +646,14 @@ discard block |
||
| 646 | 646 | { |
| 647 | 647 | $request = Context::getRequestVars(); |
| 648 | 648 | |
| 649 | - if(!$request->menu_item_srl || !$request->menu_name) |
|
| 649 | + if (!$request->menu_item_srl || !$request->menu_name) |
|
| 650 | 650 | { |
| 651 | 651 | return new BaseObject(-1, 'msg_invalid_request'); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | // variables set |
| 655 | - if($request->menu_open_window != "Y") $request->menu_open_window = "N"; |
|
| 656 | - if($request->menu_expand != "Y") $request->menu_expand = "N"; |
|
| 655 | + if ($request->menu_open_window != "Y") $request->menu_open_window = "N"; |
|
| 656 | + if ($request->menu_expand != "Y") $request->menu_expand = "N"; |
|
| 657 | 657 | |
| 658 | 658 | // Get original information |
| 659 | 659 | $oMenuAdminModel = getAdminModel('menu'); |
@@ -661,19 +661,19 @@ discard block |
||
| 661 | 661 | $args = $itemInfo; |
| 662 | 662 | |
| 663 | 663 | // if menu type is module, check exists module and update |
| 664 | - if($itemInfo->is_shortcut == 'Y') |
|
| 664 | + if ($itemInfo->is_shortcut == 'Y') |
|
| 665 | 665 | { |
| 666 | 666 | // type is url |
| 667 | - if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
| 667 | + if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target)) |
|
| 668 | 668 | { |
| 669 | 669 | $args->url = $request->shortcut_target; |
| 670 | 670 | } |
| 671 | 671 | // type is module short cut |
| 672 | - else if(is_numeric($request->shortcut_target)) |
|
| 672 | + else if (is_numeric($request->shortcut_target)) |
|
| 673 | 673 | { |
| 674 | 674 | // Get new original information |
| 675 | 675 | $newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target); |
| 676 | - if(!$newItemInfo->menu_item_srl) |
|
| 676 | + if (!$newItemInfo->menu_item_srl) |
|
| 677 | 677 | { |
| 678 | 678 | return new BaseObject(-1, 'msg_invalid_request'); |
| 679 | 679 | } |
@@ -690,10 +690,10 @@ discard block |
||
| 690 | 690 | { |
| 691 | 691 | // check already created module instance |
| 692 | 692 | $oModuleModel = getModel('module'); |
| 693 | - if($request->module_id != $itemInfo->url) |
|
| 693 | + if ($request->module_id != $itemInfo->url) |
|
| 694 | 694 | { |
| 695 | 695 | $output = $oModuleModel->getModuleInfoByMid($request->module_id); |
| 696 | - if($output->module_srl) |
|
| 696 | + if ($output->module_srl) |
|
| 697 | 697 | { |
| 698 | 698 | return new BaseObject(-1, 'msg_module_name_exists'); |
| 699 | 699 | } |
@@ -701,13 +701,13 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | // if not exist module, return error |
| 703 | 703 | $moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url); |
| 704 | - if(!$moduleInfo) |
|
| 704 | + if (!$moduleInfo) |
|
| 705 | 705 | { |
| 706 | 706 | return new BaseObject(-1, 'msg_invalid_request'); |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | $moduleInfo->mid = $request->module_id; |
| 710 | - if($request->browser_title) |
|
| 710 | + if ($request->browser_title) |
|
| 711 | 711 | { |
| 712 | 712 | $moduleInfo->browser_title = $request->browser_title; |
| 713 | 713 | } |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | $args->url = $request->module_id; |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | - if($request->menu_name_key) |
|
| 719 | + if ($request->menu_name_key) |
|
| 720 | 720 | { |
| 721 | 721 | $args->name = $request->menu_name_key; |
| 722 | 722 | } |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | $args->name = $request->menu_name; |
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 728 | + if ($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 729 | 729 | else $args->desc = ''; |
| 730 | 730 | |
| 731 | 731 | unset($args->group_srls); |
@@ -753,38 +753,38 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | $btnOutput = $this->_uploadButton($args); |
| 755 | 755 | |
| 756 | - if($btnOutput['normal_btn']) |
|
| 756 | + if ($btnOutput['normal_btn']) |
|
| 757 | 757 | { |
| 758 | 758 | $this->add('normal_btn', $btnOutput['normal_btn']); |
| 759 | 759 | $item_info->normal_btn = $btnOutput['normal_btn']; |
| 760 | 760 | } |
| 761 | - if($btnOutput['hover_btn']) |
|
| 761 | + if ($btnOutput['hover_btn']) |
|
| 762 | 762 | { |
| 763 | 763 | $this->add('hover_btn', $btnOutput['hover_btn']); |
| 764 | 764 | $item_info->hover_btn = $btnOutput['hover_btn']; |
| 765 | 765 | } |
| 766 | - if($btnOutput['active_btn']) |
|
| 766 | + if ($btnOutput['active_btn']) |
|
| 767 | 767 | { |
| 768 | 768 | $this->add('active_btn', $btnOutput['active_btn']); |
| 769 | 769 | $item_info->active_btn = $btnOutput['active_btn']; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | // group_srls check |
| 773 | - if(count($item_info->group_srls) == 0) |
|
| 773 | + if (count($item_info->group_srls) == 0) |
|
| 774 | 774 | { |
| 775 | 775 | unset($item_info->group_srls); |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | // Button delete check |
| 779 | - if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y') |
|
| 779 | + if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y') |
|
| 780 | 780 | { |
| 781 | 781 | $item_info->normal_btn = ''; |
| 782 | 782 | } |
| 783 | - if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y') |
|
| 783 | + if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y') |
|
| 784 | 784 | { |
| 785 | 785 | $item_info->hover_btn = ''; |
| 786 | 786 | } |
| 787 | - if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y') |
|
| 787 | + if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y') |
|
| 788 | 788 | { |
| 789 | 789 | $item_info->active_btn = ''; |
| 790 | 790 | } |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | $args->is_force = Context::get('is_force'); |
| 825 | 825 | |
| 826 | 826 | $returnObj = $this->deleteItem($args); |
| 827 | - if(is_object($returnObj)) |
|
| 827 | + if (is_object($returnObj)) |
|
| 828 | 828 | { |
| 829 | 829 | $this->setError($returnObj->error); |
| 830 | 830 | $this->setMessage($returnObj->message); |
@@ -853,11 +853,11 @@ discard block |
||
| 853 | 853 | $args->menu_srl = $itemInfo->menu_srl; |
| 854 | 854 | |
| 855 | 855 | // Display an error that the category cannot be deleted if it has a child node 603 |
| 856 | - if($args->is_force != 'Y') |
|
| 856 | + if ($args->is_force != 'Y') |
|
| 857 | 857 | { |
| 858 | 858 | $output = executeQuery('menu.getChildMenuCount', $args); |
| 859 | - if(!$output->toBool()) return $output; |
|
| 860 | - if($output->data->count > 0) |
|
| 859 | + if (!$output->toBool()) return $output; |
|
| 860 | + if ($output->data->count > 0) |
|
| 861 | 861 | { |
| 862 | 862 | return new BaseObject(-1001, 'msg_cannot_delete_for_child'); |
| 863 | 863 | } |
@@ -869,22 +869,22 @@ discard block |
||
| 869 | 869 | |
| 870 | 870 | // check admin menu delete |
| 871 | 871 | $oAdmin = getClass('admin'); |
| 872 | - if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0) |
|
| 872 | + if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0) |
|
| 873 | 873 | { |
| 874 | 874 | return $this->stop('msg_cannot_delete_for_admin_topmenu'); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl; |
|
| 877 | + if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl; |
|
| 878 | 878 | |
| 879 | 879 | // get menu properies with child menu |
| 880 | 880 | $phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl); |
| 881 | 881 | $originMenu = NULL; |
| 882 | 882 | |
| 883 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
| 883 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
| 884 | 884 | { |
| 885 | 885 | include(FileHandler::getRealPath($phpFile)); |
| 886 | 886 | |
| 887 | - if(is_array($menu->list)) |
|
| 887 | + if (is_array($menu->list)) |
|
| 888 | 888 | { |
| 889 | 889 | $this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu); |
| 890 | 890 | } |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | $siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl); |
| 895 | 895 | $isStartmenuInclude = false; |
| 896 | 896 | $this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude); |
| 897 | - if($isStartmenuInclude) |
|
| 897 | + if ($isStartmenuInclude) |
|
| 898 | 898 | { |
| 899 | 899 | return new BaseObject(-1, 'msg_cannot_delete_homemenu'); |
| 900 | 900 | } |
@@ -918,14 +918,14 @@ discard block |
||
| 918 | 918 | |
| 919 | 919 | private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude) |
| 920 | 920 | { |
| 921 | - if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid) |
|
| 921 | + if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid) |
|
| 922 | 922 | { |
| 923 | 923 | $isStartmenuInclude = true; |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | - if(!$isStartmenuInclude && is_array($originMenu['list'])) |
|
| 926 | + if (!$isStartmenuInclude && is_array($originMenu['list'])) |
|
| 927 | 927 | { |
| 928 | - foreach($originMenu['list'] AS $key=>$value) |
|
| 928 | + foreach ($originMenu['list'] AS $key=>$value) |
|
| 929 | 929 | { |
| 930 | 930 | $this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude); |
| 931 | 931 | } |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | $args->menu_srl = $menuSrl; |
| 940 | 940 | $args->menu_item_srl = $node['node_srl']; |
| 941 | 941 | $output = executeQuery("menu.deleteMenuItem", $args); |
| 942 | - if(!$output->toBool()) |
|
| 942 | + if (!$output->toBool()) |
|
| 943 | 943 | { |
| 944 | 944 | $oDB->rollback(); |
| 945 | 945 | return $output; |
@@ -948,12 +948,12 @@ discard block |
||
| 948 | 948 | // Update the xml file and get its location |
| 949 | 949 | $xml_file = $this->makeXmlFile($args->menu_srl); |
| 950 | 950 | // Delete all of image buttons |
| 951 | - if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']); |
|
| 952 | - if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']); |
|
| 953 | - if($node['active_btn']) FileHandler::removeFile($node['active_btn']); |
|
| 951 | + if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']); |
|
| 952 | + if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']); |
|
| 953 | + if ($node['active_btn']) FileHandler::removeFile($node['active_btn']); |
|
| 954 | 954 | |
| 955 | 955 | // Delete module |
| 956 | - if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0) |
|
| 956 | + if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0) |
|
| 957 | 957 | { |
| 958 | 958 | $oModuleController = getController('module'); |
| 959 | 959 | $oModuleModel = getModel('module'); |
@@ -963,12 +963,12 @@ discard block |
||
| 963 | 963 | $args->site_srl = $menuInfo->site_srl; |
| 964 | 964 | $args->is_shortcut = 'Y'; |
| 965 | 965 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
| 966 | - if($output->data->menu_item_srl) |
|
| 966 | + if ($output->data->menu_item_srl) |
|
| 967 | 967 | { |
| 968 | 968 | $output->data->url = ''; |
| 969 | 969 | $referenceItem = $output->data; |
| 970 | 970 | $output = $this->_updateMenuItem($referenceItem); |
| 971 | - if(!$output->toBool()) |
|
| 971 | + if (!$output->toBool()) |
|
| 972 | 972 | { |
| 973 | 973 | $oDB->rollback(); |
| 974 | 974 | return $output; |
@@ -976,10 +976,10 @@ discard block |
||
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | $moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl); |
| 979 | - if($moduleInfo->module_srl) |
|
| 979 | + if ($moduleInfo->module_srl) |
|
| 980 | 980 | { |
| 981 | 981 | $output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl); |
| 982 | - if(!$output->toBool()) |
|
| 982 | + if (!$output->toBool()) |
|
| 983 | 983 | { |
| 984 | 984 | $oDB->rollback(); |
| 985 | 985 | return $output; |
@@ -992,14 +992,14 @@ discard block |
||
| 992 | 992 | private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node) |
| 993 | 993 | { |
| 994 | 994 | $output = $this->_deleteMenuItem($oDB, $menuInfo, $node); |
| 995 | - if(!$output->toBool()) |
|
| 995 | + if (!$output->toBool()) |
|
| 996 | 996 | { |
| 997 | 997 | return new BaseObject(-1, $output->message); |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | - if(is_array($node['list'])) |
|
| 1000 | + if (is_array($node['list'])) |
|
| 1001 | 1001 | { |
| 1002 | - foreach($node['list'] AS $key=>$value) |
|
| 1002 | + foreach ($node['list'] AS $key=>$value) |
|
| 1003 | 1003 | { |
| 1004 | 1004 | $this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value); |
| 1005 | 1005 | } |
@@ -1012,31 +1012,31 @@ discard block |
||
| 1012 | 1012 | */ |
| 1013 | 1013 | function procMenuAdminMoveItem() |
| 1014 | 1014 | { |
| 1015 | - $mode = Context::get('mode'); //move |
|
| 1016 | - $parent_srl = Context::get('parent_srl'); // Parent menu item serial number |
|
| 1017 | - $source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number |
|
| 1018 | - $target_srl = Context::get('target_srl'); // Self menu item serial number |
|
| 1015 | + $mode = Context::get('mode'); //move |
|
| 1016 | + $parent_srl = Context::get('parent_srl'); // Parent menu item serial number |
|
| 1017 | + $source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number |
|
| 1018 | + $target_srl = Context::get('target_srl'); // Self menu item serial number |
|
| 1019 | 1019 | |
| 1020 | - if(!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1020 | + if (!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1021 | 1021 | |
| 1022 | 1022 | $oMenuAdminModel = getAdminModel('menu'); |
| 1023 | 1023 | |
| 1024 | 1024 | // get original menu item info for cache file recreate |
| 1025 | 1025 | $originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl); |
| 1026 | - if(!$originalItemInfo->menu_item_srl) |
|
| 1026 | + if (!$originalItemInfo->menu_item_srl) |
|
| 1027 | 1027 | { |
| 1028 | 1028 | return new BaseObject(-1, 'msg_empty_menu_item'); |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | // get menu properies with child menu |
| 1032 | - $phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl); |
|
| 1032 | + $phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $originalItemInfo->menu_srl); |
|
| 1033 | 1033 | $originMenu = NULL; |
| 1034 | 1034 | |
| 1035 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
| 1035 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
| 1036 | 1036 | { |
| 1037 | 1037 | include(FileHandler::getRealPath($phpFile)); |
| 1038 | 1038 | |
| 1039 | - if(is_array($menu->list)) |
|
| 1039 | + if (is_array($menu->list)) |
|
| 1040 | 1040 | { |
| 1041 | 1041 | $this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu); |
| 1042 | 1042 | } |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | // get target menu info for move |
| 1046 | 1046 | $targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl); |
| 1047 | 1047 | // if move in same sitemap |
| 1048 | - if($targetMenuItemInfo->menu_item_srl) |
|
| 1048 | + if ($targetMenuItemInfo->menu_item_srl) |
|
| 1049 | 1049 | { |
| 1050 | 1050 | $menu_srl = $targetMenuItemInfo->menu_srl; |
| 1051 | 1051 | } |
@@ -1057,20 +1057,20 @@ discard block |
||
| 1057 | 1057 | $parent_srl = 0; |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | - if(!$this->homeModuleMid) |
|
| 1060 | + if (!$this->homeModuleMid) |
|
| 1061 | 1061 | { |
| 1062 | 1062 | $oModuleModel = getModel('module'); |
| 1063 | 1063 | $oMenuAdminController = getAdminController('menu'); |
| 1064 | 1064 | $columnList = array('modules.mid',); |
| 1065 | 1065 | $output = $oModuleModel->getSiteInfo(0, $columnList); |
| 1066 | - if($output->mid) |
|
| 1066 | + if ($output->mid) |
|
| 1067 | 1067 | { |
| 1068 | 1068 | $this->homeModuleMid = $output->mid; |
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | $this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']); |
| 1073 | - if(count($originMenu['list']) > 0) |
|
| 1073 | + if (count($originMenu['list']) > 0) |
|
| 1074 | 1074 | { |
| 1075 | 1075 | $this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl); |
| 1076 | 1076 | } |
@@ -1084,9 +1084,9 @@ discard block |
||
| 1084 | 1084 | |
| 1085 | 1085 | private function _recursiveUpdateMenuItem($node, $menu_srl) |
| 1086 | 1086 | { |
| 1087 | - if(is_array($node)) |
|
| 1087 | + if (is_array($node)) |
|
| 1088 | 1088 | { |
| 1089 | - foreach($node AS $key=>$node) |
|
| 1089 | + foreach ($node AS $key=>$node) |
|
| 1090 | 1090 | { |
| 1091 | 1091 | $args = new stdClass(); |
| 1092 | 1092 | $args->menu_srl = $menu_srl; |
@@ -1094,11 +1094,11 @@ discard block |
||
| 1094 | 1094 | $output = $this->_updateMenuItem($args); |
| 1095 | 1095 | |
| 1096 | 1096 | //module's menu_srl move also |
| 1097 | - if($node['is_shortcut'] == 'N' && !empty($node['url'])) |
|
| 1097 | + if ($node['is_shortcut'] == 'N' && !empty($node['url'])) |
|
| 1098 | 1098 | { |
| 1099 | 1099 | $oModuleModel = getModel('module'); |
| 1100 | 1100 | $moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']); |
| 1101 | - if($menu_srl != $moduleInfo->menu_srl) |
|
| 1101 | + if ($menu_srl != $moduleInfo->menu_srl) |
|
| 1102 | 1102 | { |
| 1103 | 1103 | $moduleInfo->menu_srl = $menu_srl; |
| 1104 | 1104 | $oModuleController = getController('module'); |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | } |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | - if(count($node['list']) > 0) |
|
| 1109 | + if (count($node['list']) > 0) |
|
| 1110 | 1110 | { |
| 1111 | 1111 | $this->_recursiveUpdateMenuItem($node['list'], $menu_srl); |
| 1112 | 1112 | } |
@@ -1128,21 +1128,21 @@ discard block |
||
| 1128 | 1128 | $menuSrl = $itemInfo->menu_srl; |
| 1129 | 1129 | |
| 1130 | 1130 | // get menu properies with child menu |
| 1131 | - $phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl); |
|
| 1131 | + $phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menuSrl); |
|
| 1132 | 1132 | $originMenu = NULL; |
| 1133 | 1133 | |
| 1134 | - if(is_readable(FileHandler::getRealPath($phpFile))) |
|
| 1134 | + if (is_readable(FileHandler::getRealPath($phpFile))) |
|
| 1135 | 1135 | { |
| 1136 | 1136 | include(FileHandler::getRealPath($phpFile)); |
| 1137 | 1137 | |
| 1138 | - if(is_array($menu->list)) |
|
| 1138 | + if (is_array($menu->list)) |
|
| 1139 | 1139 | { |
| 1140 | 1140 | $this->_searchMenu($menu->list, $menuItemSrl, $originMenu); |
| 1141 | 1141 | } |
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | 1144 | // copy the menu item with recursively |
| 1145 | - if(is_array($originMenu)) |
|
| 1145 | + if (is_array($originMenu)) |
|
| 1146 | 1146 | { |
| 1147 | 1147 | $this->_copyMenu($menuSrl, $parentSrl, $originMenu); |
| 1148 | 1148 | } |
@@ -1158,15 +1158,15 @@ discard block |
||
| 1158 | 1158 | */ |
| 1159 | 1159 | private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu) |
| 1160 | 1160 | { |
| 1161 | - if(array_key_exists($menuItemSrl, $menuList)) |
|
| 1161 | + if (array_key_exists($menuItemSrl, $menuList)) |
|
| 1162 | 1162 | { |
| 1163 | 1163 | $originMenu = $menuList[$menuItemSrl]; |
| 1164 | 1164 | return; |
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | - foreach($menuList AS $key=>$value) |
|
| 1167 | + foreach ($menuList AS $key=>$value) |
|
| 1168 | 1168 | { |
| 1169 | - if(count($value['list']) > 0) |
|
| 1169 | + if (count($value['list']) > 0) |
|
| 1170 | 1170 | { |
| 1171 | 1171 | $this->_searchMenu($value['list'], $menuItemSrl, $originMenu); |
| 1172 | 1172 | } |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | // default argument setting |
| 1182 | 1182 | $args = new stdClass(); |
| 1183 | 1183 | $args->menu_srl = $menuSrl; |
| 1184 | - if($parentSrl == 0) $args->parent_srl = $menuSrl; |
|
| 1184 | + if ($parentSrl == 0) $args->parent_srl = $menuSrl; |
|
| 1185 | 1185 | else $args->parent_srl = $parentSrl; |
| 1186 | 1186 | $args->menu_name_key = $originMenu['text']; |
| 1187 | 1187 | $args->menu_name = $originMenu['text']; |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | |
| 1195 | 1195 | $isModuleCopySuccess = false; |
| 1196 | 1196 | // if menu have a reference of module instance |
| 1197 | - if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 ) |
|
| 1197 | + if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0) |
|
| 1198 | 1198 | { |
| 1199 | 1199 | $oModuleModel = getModel('module'); |
| 1200 | 1200 | $moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']); |
@@ -1214,22 +1214,22 @@ discard block |
||
| 1214 | 1214 | |
| 1215 | 1215 | $args->module_srl = $copiedModuleSrl; |
| 1216 | 1216 | |
| 1217 | - if($copiedModuleSrl) |
|
| 1217 | + if ($copiedModuleSrl) |
|
| 1218 | 1218 | { |
| 1219 | 1219 | $isModuleCopySuccess = true; |
| 1220 | 1220 | } |
| 1221 | 1221 | } |
| 1222 | 1222 | // if menu type is shortcut |
| 1223 | - else if($menuItemInfo->is_shortcut == 'Y') |
|
| 1223 | + else if ($menuItemInfo->is_shortcut == 'Y') |
|
| 1224 | 1224 | { |
| 1225 | 1225 | $args->shortcut_target = $originMenu['url']; |
| 1226 | 1226 | $isModuleCopySuccess = true; |
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | - if($isModuleCopySuccess) |
|
| 1229 | + if ($isModuleCopySuccess) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | // if have a group permission |
| 1232 | - if($menuItemInfo->group_srls) |
|
| 1232 | + if ($menuItemInfo->group_srls) |
|
| 1233 | 1233 | { |
| 1234 | 1234 | $args->group_srls = $menuItemInfo->group_srls; |
| 1235 | 1235 | } |
@@ -1243,12 +1243,12 @@ discard block |
||
| 1243 | 1243 | |
| 1244 | 1244 | // if have a button, copy a button image also |
| 1245 | 1245 | $insertedMenuItemSrl = $this->get('menu_item_srl'); |
| 1246 | - if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn) |
|
| 1246 | + if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | // copy & upate |
| 1249 | 1249 | $update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl); |
| 1250 | - $copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo); |
|
| 1251 | - if(count($update_item_info->group_srls) == 0) |
|
| 1250 | + $copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo); |
|
| 1251 | + if (count($update_item_info->group_srls) == 0) |
|
| 1252 | 1252 | { |
| 1253 | 1253 | unset($update_item_info->group_srls); |
| 1254 | 1254 | } |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | |
| 1263 | 1263 | // if have a child menu, copy child menu also |
| 1264 | 1264 | $childMenu = array_shift($originMenu['list']); |
| 1265 | - if(count($childMenu) > 0) |
|
| 1265 | + if (count($childMenu) > 0) |
|
| 1266 | 1266 | { |
| 1267 | 1267 | $this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu); |
| 1268 | 1268 | } |
@@ -1272,10 +1272,10 @@ discard block |
||
| 1272 | 1272 | { |
| 1273 | 1273 | $time = $_SERVER['REQUEST_TIME']; |
| 1274 | 1274 | $randomString = ""; |
| 1275 | - for($i=0;$i<4;$i++) |
|
| 1275 | + for ($i = 0; $i < 4; $i++) |
|
| 1276 | 1276 | { |
| 1277 | 1277 | $case = rand(0, 1); |
| 1278 | - if($case) $doc = rand(65, 90); |
|
| 1278 | + if ($case) $doc = rand(65, 90); |
|
| 1279 | 1279 | else $doc = rand(97, 122); |
| 1280 | 1280 | |
| 1281 | 1281 | $randomString .= chr($doc); |
@@ -1299,32 +1299,32 @@ discard block |
||
| 1299 | 1299 | // menu name update |
| 1300 | 1300 | $args->menu_srl = $this->menuSrl; |
| 1301 | 1301 | $output = executeQuery('menu.updateMenu', $args); |
| 1302 | - if(!$output->toBool()) return $output; |
|
| 1302 | + if (!$output->toBool()) return $output; |
|
| 1303 | 1303 | |
| 1304 | 1304 | $this->map = array(); |
| 1305 | - if(is_array($parentKeyList)) |
|
| 1305 | + if (is_array($parentKeyList)) |
|
| 1306 | 1306 | { |
| 1307 | - foreach($parentKeyList as $no=>$srl) |
|
| 1307 | + foreach ($parentKeyList as $no=>$srl) |
|
| 1308 | 1308 | { |
| 1309 | - if($srl === 0) continue; |
|
| 1310 | - if(!is_array($this->map[$srl]))$this->map[$srl] = array(); |
|
| 1309 | + if ($srl === 0) continue; |
|
| 1310 | + if (!is_array($this->map[$srl]))$this->map[$srl] = array(); |
|
| 1311 | 1311 | $this->map[$srl][] = $no; |
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | $result = array(); |
| 1316 | - if(is_array($this->itemKeyList)) |
|
| 1316 | + if (is_array($this->itemKeyList)) |
|
| 1317 | 1317 | { |
| 1318 | - foreach($this->itemKeyList as $srl) |
|
| 1318 | + foreach ($this->itemKeyList as $srl) |
|
| 1319 | 1319 | { |
| 1320 | - if(!$this->checked[$srl]) |
|
| 1320 | + if (!$this->checked[$srl]) |
|
| 1321 | 1321 | { |
| 1322 | 1322 | $target = new stdClass(); |
| 1323 | 1323 | $this->checked[$srl] = 1; |
| 1324 | 1324 | $target->node = $srl; |
| 1325 | - $target->child= array(); |
|
| 1325 | + $target->child = array(); |
|
| 1326 | 1326 | |
| 1327 | - while(count($this->map[$srl])) |
|
| 1327 | + while (count($this->map[$srl])) |
|
| 1328 | 1328 | { |
| 1329 | 1329 | $this->_setParent($srl, array_shift($this->map[$srl]), $target); |
| 1330 | 1330 | } |
@@ -1333,13 +1333,13 @@ discard block |
||
| 1333 | 1333 | } |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | - if(is_array($result)) |
|
| 1336 | + if (is_array($result)) |
|
| 1337 | 1337 | { |
| 1338 | 1338 | $i = 0; |
| 1339 | - foreach($result AS $key=>$node) |
|
| 1339 | + foreach ($result AS $key=>$node) |
|
| 1340 | 1340 | { |
| 1341 | - $this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node |
|
| 1342 | - $this->_recursiveMoveMenuItem($node); //move child node |
|
| 1341 | + $this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node |
|
| 1342 | + $this->_recursiveMoveMenuItem($node); //move child node |
|
| 1343 | 1343 | $i = $node->node; |
| 1344 | 1344 | } |
| 1345 | 1345 | } |
@@ -1368,7 +1368,7 @@ discard block |
||
| 1368 | 1368 | $child_node->child = array(); |
| 1369 | 1369 | $target->child[] = $child_node; |
| 1370 | 1370 | |
| 1371 | - while(count($this->map[$child_srl])) |
|
| 1371 | + while (count($this->map[$child_srl])) |
|
| 1372 | 1372 | { |
| 1373 | 1373 | $this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node); |
| 1374 | 1374 | } |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | function _recursiveMoveMenuItem($result) |
| 1384 | 1384 | { |
| 1385 | 1385 | $i = 0; |
| 1386 | - while(count($result->child)) |
|
| 1386 | + while (count($result->child)) |
|
| 1387 | 1387 | { |
| 1388 | 1388 | unset($node); |
| 1389 | 1389 | $node = array_shift($result->child); |
@@ -1403,48 +1403,48 @@ discard block |
||
| 1403 | 1403 | * @param string $mode 'move' or 'insert' |
| 1404 | 1404 | * @return void |
| 1405 | 1405 | */ |
| 1406 | - function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL) |
|
| 1406 | + function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL) |
|
| 1407 | 1407 | { |
| 1408 | 1408 | // Get the original menus |
| 1409 | 1409 | $oMenuAdminModel = getAdminModel('menu'); |
| 1410 | 1410 | |
| 1411 | 1411 | $target_item = $oMenuAdminModel->getMenuItemInfo($target_srl); |
| 1412 | - if($target_item->menu_item_srl != $target_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1412 | + if ($target_item->menu_item_srl != $target_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1413 | 1413 | // Move the menu location(change the order menu appears) |
| 1414 | - if($mode == 'move') |
|
| 1414 | + if ($mode == 'move') |
|
| 1415 | 1415 | { |
| 1416 | 1416 | $args = new stdClass(); |
| 1417 | 1417 | $args->parent_srl = $parent_srl; |
| 1418 | 1418 | $args->menu_srl = $menu_srl; |
| 1419 | 1419 | |
| 1420 | - if($source_srl) |
|
| 1420 | + if ($source_srl) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | $source_item = $oMenuAdminModel->getMenuItemInfo($source_srl); |
| 1423 | - if($source_item->menu_item_srl != $source_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1424 | - $args->listorder = $source_item->listorder-1; |
|
| 1423 | + if ($source_item->menu_item_srl != $source_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1424 | + $args->listorder = $source_item->listorder - 1; |
|
| 1425 | 1425 | } |
| 1426 | 1426 | else |
| 1427 | 1427 | { |
| 1428 | 1428 | $output = executeQuery('menu.getMaxListorder', $args); |
| 1429 | - if(!$output->toBool()) return $output; |
|
| 1430 | - $args->listorder = (int)$output->data->listorder; |
|
| 1431 | - if(!$args->listorder) $args->listorder= 0; |
|
| 1429 | + if (!$output->toBool()) return $output; |
|
| 1430 | + $args->listorder = (int) $output->data->listorder; |
|
| 1431 | + if (!$args->listorder) $args->listorder = 0; |
|
| 1432 | 1432 | } |
| 1433 | 1433 | $args->parent_srl = $parent_srl; |
| 1434 | 1434 | $output = executeQuery('menu.updateMenuItemListorder', $args); |
| 1435 | - if(!$output->toBool()) return $output; |
|
| 1435 | + if (!$output->toBool()) return $output; |
|
| 1436 | 1436 | |
| 1437 | 1437 | $args->parent_srl = $parent_srl; |
| 1438 | 1438 | $args->menu_item_srl = $target_srl; |
| 1439 | 1439 | $output = executeQuery('menu.updateMenuItemNode', $args); |
| 1440 | - if(!$output->toBool()) return $output; |
|
| 1440 | + if (!$output->toBool()) return $output; |
|
| 1441 | 1441 | |
| 1442 | 1442 | //module's menu_srl move also |
| 1443 | - if($isShortcut == 'N' && !empty($url)) |
|
| 1443 | + if ($isShortcut == 'N' && !empty($url)) |
|
| 1444 | 1444 | { |
| 1445 | 1445 | $oModuleModel = getModel('module'); |
| 1446 | 1446 | $moduleInfo = $oModuleModel->getModuleInfoByMid($url); |
| 1447 | - if($menu_srl != $moduleInfo->menu_srl) |
|
| 1447 | + if ($menu_srl != $moduleInfo->menu_srl) |
|
| 1448 | 1448 | { |
| 1449 | 1449 | $moduleInfo->menu_srl = $menu_srl; |
| 1450 | 1450 | $oModuleController = getController('module'); |
@@ -1452,13 +1452,13 @@ discard block |
||
| 1452 | 1452 | } |
| 1453 | 1453 | |
| 1454 | 1454 | // change home menu cache file |
| 1455 | - if($url == $this->homeModuleMid) |
|
| 1455 | + if ($url == $this->homeModuleMid) |
|
| 1456 | 1456 | { |
| 1457 | - if(file_exists($this->homeMenuCacheFile)) |
|
| 1457 | + if (file_exists($this->homeMenuCacheFile)) |
|
| 1458 | 1458 | { |
| 1459 | 1459 | include($this->homeMenuCacheFile); |
| 1460 | 1460 | } |
| 1461 | - if(!$homeMenuSrl || $homeMenuSrl != $menu_srl) |
|
| 1461 | + if (!$homeMenuSrl || $homeMenuSrl != $menu_srl) |
|
| 1462 | 1462 | { |
| 1463 | 1463 | $this->makeHomemenuCacheFile($menu_srl); |
| 1464 | 1464 | } |
@@ -1466,13 +1466,13 @@ discard block |
||
| 1466 | 1466 | } |
| 1467 | 1467 | // Add a child |
| 1468 | 1468 | } |
| 1469 | - elseif($mode == 'insert') |
|
| 1469 | + elseif ($mode == 'insert') |
|
| 1470 | 1470 | { |
| 1471 | 1471 | $args->menu_item_srl = $target_srl; |
| 1472 | 1472 | $args->parent_srl = $parent_srl; |
| 1473 | - $args->listorder = -1*getNextSequence(); |
|
| 1473 | + $args->listorder = -1 * getNextSequence(); |
|
| 1474 | 1474 | $output = executeQuery('menu.updateMenuItemNode', $args); |
| 1475 | - if(!$output->toBool()) return $output; |
|
| 1475 | + if (!$output->toBool()) return $output; |
|
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | 1478 | $xml_file = $this->makeXmlFile($menu_srl); |
@@ -1497,8 +1497,8 @@ discard block |
||
| 1497 | 1497 | // Re-generate the xml file |
| 1498 | 1498 | $xml_file = $this->makeXmlFile($menu_srl); |
| 1499 | 1499 | // Set return value |
| 1500 | - $this->add('menu_title',$menu_title); |
|
| 1501 | - $this->add('xml_file',$xml_file); |
|
| 1500 | + $this->add('menu_title', $menu_title); |
|
| 1501 | + $this->add('xml_file', $xml_file); |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | /** |
@@ -1512,12 +1512,12 @@ discard block |
||
| 1512 | 1512 | $target = Context::get('target'); |
| 1513 | 1513 | $target_file = Context::get($target); |
| 1514 | 1514 | // Error occurs when the target is neither a uploaded file nor a valid file |
| 1515 | - if(!$menu_srl || !$menu_item_srl) |
|
| 1515 | + if (!$menu_srl || !$menu_item_srl) |
|
| 1516 | 1516 | { |
| 1517 | 1517 | Context::set('error_messge', Context::getLang('msg_invalid_request')); |
| 1518 | 1518 | |
| 1519 | 1519 | } |
| 1520 | - else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name']) || !checkUploadedFile($target_file['tmp_name'])) |
|
| 1520 | + else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name'])) |
|
| 1521 | 1521 | { |
| 1522 | 1522 | Context::set('error_messge', Context::getLang('msg_invalid_request')); |
| 1523 | 1523 | } |
@@ -1525,13 +1525,13 @@ discard block |
||
| 1525 | 1525 | // Move the file to a specific director if the uploaded file meets requirement |
| 1526 | 1526 | else |
| 1527 | 1527 | { |
| 1528 | - $tmp_arr = explode('.',$target_file['name']); |
|
| 1529 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
| 1528 | + $tmp_arr = explode('.', $target_file['name']); |
|
| 1529 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
| 1530 | 1530 | |
| 1531 | 1531 | $path = sprintf('./files/attach/menu_button/%d/', $menu_srl); |
| 1532 | 1532 | $filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext); |
| 1533 | 1533 | |
| 1534 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
| 1534 | + if (!is_dir($path)) FileHandler::makeDir($path); |
|
| 1535 | 1535 | |
| 1536 | 1536 | move_uploaded_file($target_file['tmp_name'], $filename); |
| 1537 | 1537 | Context::set('filename', $filename); |
@@ -1564,14 +1564,14 @@ discard block |
||
| 1564 | 1564 | { |
| 1565 | 1565 | $oModuleModel = getModel('module'); |
| 1566 | 1566 | $installed_module_list = $oModuleModel->getModulesXmlInfo(); |
| 1567 | - if(is_array($installed_module_list)) |
|
| 1567 | + if (is_array($installed_module_list)) |
|
| 1568 | 1568 | { |
| 1569 | 1569 | $currentLang = Context::getLangType(); |
| 1570 | 1570 | $menuList = array(); |
| 1571 | - foreach($installed_module_list AS $key=>$value) |
|
| 1571 | + foreach ($installed_module_list AS $key=>$value) |
|
| 1572 | 1572 | { |
| 1573 | 1573 | $info = $oModuleModel->getModuleActionXml($value->module); |
| 1574 | - if($info->menu) $menuList[$value->module] = $info->menu; |
|
| 1574 | + if ($info->menu) $menuList[$value->module] = $info->menu; |
|
| 1575 | 1575 | unset($info->menu); |
| 1576 | 1576 | } |
| 1577 | 1577 | } |
@@ -1603,8 +1603,8 @@ discard block |
||
| 1603 | 1603 | $info = $oModuleModel->getModuleActionXml($moduleName); |
| 1604 | 1604 | |
| 1605 | 1605 | $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index); |
| 1606 | - if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act); |
|
| 1607 | - if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin'); |
|
| 1606 | + if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act); |
|
| 1607 | + if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin'); |
|
| 1608 | 1608 | $dbInfo = Context::getDBInfo(); |
| 1609 | 1609 | |
| 1610 | 1610 | $args = new stdClass(); |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | $args->menu_srl = $requestArgs->menu_srl; |
| 1614 | 1614 | $args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName); |
| 1615 | 1615 | //if now page is https... |
| 1616 | - if(strpos($url, 'https') !== false) |
|
| 1616 | + if (strpos($url, 'https') !== false) |
|
| 1617 | 1617 | { |
| 1618 | 1618 | $args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url); |
| 1619 | 1619 | } |
@@ -1627,23 +1627,23 @@ discard block |
||
| 1627 | 1627 | $args->hover_btn = ''; |
| 1628 | 1628 | $args->active_btn = ''; |
| 1629 | 1629 | $args->group_srls = implode(',', array_keys($groupSrlList)); |
| 1630 | - $args->listorder = -1*$args->menu_item_srl; |
|
| 1630 | + $args->listorder = -1 * $args->menu_item_srl; |
|
| 1631 | 1631 | |
| 1632 | 1632 | // Check if already exists |
| 1633 | 1633 | $oMenuModel = getAdminModel('menu'); |
| 1634 | 1634 | $item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl); |
| 1635 | 1635 | // Update if exists |
| 1636 | - if($item_info->menu_item_srl == $args->menu_item_srl) |
|
| 1636 | + if ($item_info->menu_item_srl == $args->menu_item_srl) |
|
| 1637 | 1637 | { |
| 1638 | 1638 | $output = $this->_updateMenuItem($args); |
| 1639 | - if(!$output->toBool()) return $output; |
|
| 1639 | + if (!$output->toBool()) return $output; |
|
| 1640 | 1640 | } |
| 1641 | 1641 | // Insert if not exist |
| 1642 | 1642 | else |
| 1643 | 1643 | { |
| 1644 | - $args->listorder = -1*$args->menu_item_srl; |
|
| 1644 | + $args->listorder = -1 * $args->menu_item_srl; |
|
| 1645 | 1645 | $output = executeQuery('menu.insertMenuItem', $args); |
| 1646 | - if(!$output->toBool()) return $output; |
|
| 1646 | + if (!$output->toBool()) return $output; |
|
| 1647 | 1647 | } |
| 1648 | 1648 | // Get information of the menu |
| 1649 | 1649 | $menu_info = $oMenuModel->getMenu($args->menu_srl); |
@@ -1671,23 +1671,23 @@ discard block |
||
| 1671 | 1671 | |
| 1672 | 1672 | // Menu Exposure update |
| 1673 | 1673 | // if exposure target is only login user... |
| 1674 | - if(!$exposure) |
|
| 1674 | + if (!$exposure) |
|
| 1675 | 1675 | { |
| 1676 | 1676 | $args->group_srls = ''; |
| 1677 | 1677 | } |
| 1678 | 1678 | else |
| 1679 | 1679 | { |
| 1680 | 1680 | $exposure = explode(',', $exposure); |
| 1681 | - if(in_array($exposure, array('-1','-3'))) |
|
| 1681 | + if (in_array($exposure, array('-1', '-3'))) |
|
| 1682 | 1682 | { |
| 1683 | 1683 | $args->group_srls = $exposure; |
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | - if($exposure) $args->group_srls = implode(',', $exposure); |
|
| 1686 | + if ($exposure) $args->group_srls = implode(',', $exposure); |
|
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | 1689 | $output = $this->_updateMenuItem($args); |
| 1690 | - if(!$output->toBool()) |
|
| 1690 | + if (!$output->toBool()) |
|
| 1691 | 1691 | { |
| 1692 | 1692 | return $output; |
| 1693 | 1693 | } |
@@ -1701,21 +1701,21 @@ discard block |
||
| 1701 | 1701 | $moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl); |
| 1702 | 1702 | $xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module); |
| 1703 | 1703 | |
| 1704 | - if($itemInfo->is_shortcut === 'Y') |
|
| 1704 | + if ($itemInfo->is_shortcut === 'Y') |
|
| 1705 | 1705 | { |
| 1706 | 1706 | $moduleGrnatsArgs = new stdClass; |
| 1707 | 1707 | $moduleGrnatsArgs->module_srl = $moduleInfo->module_srl; |
| 1708 | 1708 | $output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs); |
| 1709 | - if(!$output->data) $output->data = array(); |
|
| 1709 | + if (!$output->data) $output->data = array(); |
|
| 1710 | 1710 | $moduleGrnats = new stdClass(); |
| 1711 | - foreach($output->data as $grant) |
|
| 1711 | + foreach ($output->data as $grant) |
|
| 1712 | 1712 | { |
| 1713 | 1713 | $moduleGrnats->{$grant->name}[] = $grant->group_srl; |
| 1714 | 1714 | } |
| 1715 | 1715 | } |
| 1716 | 1716 | |
| 1717 | 1717 | $grantList = $xml_info->grant; |
| 1718 | - if(!$grantList) $grantList = new stdClass; |
|
| 1718 | + if (!$grantList) $grantList = new stdClass; |
|
| 1719 | 1719 | |
| 1720 | 1720 | $grantList->access = new stdClass(); |
| 1721 | 1721 | $grantList->access->default = 'guest'; |
@@ -1723,14 +1723,14 @@ discard block |
||
| 1723 | 1723 | $grantList->manager->default = 'manager'; |
| 1724 | 1724 | |
| 1725 | 1725 | $grant = new stdClass(); |
| 1726 | - foreach($grantList AS $grantName=>$grantInfo) |
|
| 1726 | + foreach ($grantList AS $grantName=>$grantInfo) |
|
| 1727 | 1727 | { |
| 1728 | - if($htPerm[$grantName]) |
|
| 1728 | + if ($htPerm[$grantName]) |
|
| 1729 | 1729 | { |
| 1730 | 1730 | $htPerm[$grantName] = explode(',', $htPerm[$grantName]); |
| 1731 | 1731 | |
| 1732 | 1732 | // users in a particular group |
| 1733 | - if(is_array($htPerm[$grantName])) |
|
| 1733 | + if (is_array($htPerm[$grantName])) |
|
| 1734 | 1734 | { |
| 1735 | 1735 | $grant->{$grantName} = $htPerm[$grantName]; |
| 1736 | 1736 | continue; |
@@ -1742,13 +1742,13 @@ discard block |
||
| 1742 | 1742 | continue; |
| 1743 | 1743 | } |
| 1744 | 1744 | } |
| 1745 | - else if($itemInfo->is_shortcut === 'Y') |
|
| 1745 | + else if ($itemInfo->is_shortcut === 'Y') |
|
| 1746 | 1746 | { |
| 1747 | - if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName}; |
|
| 1747 | + if (isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName}; |
|
| 1748 | 1748 | } |
| 1749 | 1749 | } |
| 1750 | 1750 | |
| 1751 | - if(count($grant)) |
|
| 1751 | + if (count($grant)) |
|
| 1752 | 1752 | { |
| 1753 | 1753 | $oModuleController = getController('module'); |
| 1754 | 1754 | $oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant); |
@@ -1766,15 +1766,15 @@ discard block |
||
| 1766 | 1766 | function makeXmlFile($menu_srl) |
| 1767 | 1767 | { |
| 1768 | 1768 | // Return if there is no information when creating the xml file |
| 1769 | - if(!$menu_srl) return; |
|
| 1769 | + if (!$menu_srl) return; |
|
| 1770 | 1770 | // Get menu informaton |
| 1771 | 1771 | $args = new stdClass(); |
| 1772 | 1772 | $args->menu_srl = $menu_srl; |
| 1773 | 1773 | $output = executeQuery('menu.getMenu', $args); |
| 1774 | - if(!$output->toBool() || !$output->data) return $output; |
|
| 1775 | - $site_srl = (int)$output->data->site_srl; |
|
| 1774 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 1775 | + $site_srl = (int) $output->data->site_srl; |
|
| 1776 | 1776 | |
| 1777 | - if($site_srl) |
|
| 1777 | + if ($site_srl) |
|
| 1778 | 1778 | { |
| 1779 | 1779 | $oModuleModel = getModel('module'); |
| 1780 | 1780 | $columnList = array('sites.domain'); |
@@ -1785,13 +1785,13 @@ discard block |
||
| 1785 | 1785 | $args->menu_srl = $menu_srl; |
| 1786 | 1786 | $args->sort_index = 'listorder'; |
| 1787 | 1787 | $output = executeQuery('menu.getMenuItems', $args); |
| 1788 | - if(!$output->toBool()) return; |
|
| 1788 | + if (!$output->toBool()) return; |
|
| 1789 | 1789 | // Specify the name of the cache file |
| 1790 | - $xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl); |
|
| 1791 | - $php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl); |
|
| 1790 | + $xml_file = sprintf(_XE_PATH_."files/cache/menu/%s.xml.php", $menu_srl); |
|
| 1791 | + $php_file = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menu_srl); |
|
| 1792 | 1792 | // If no data found, generate an XML file without node data |
| 1793 | 1793 | $list = $output->data; |
| 1794 | - if(!$list) |
|
| 1794 | + if (!$list) |
|
| 1795 | 1795 | { |
| 1796 | 1796 | $xml_buff = "<root />"; |
| 1797 | 1797 | FileHandler::writeFile($xml_file, $xml_buff); |
@@ -1799,10 +1799,10 @@ discard block |
||
| 1799 | 1799 | return $xml_file; |
| 1800 | 1800 | } |
| 1801 | 1801 | // Change to an array if only a single data is obtained |
| 1802 | - if(!is_array($list)) $list = array($list); |
|
| 1802 | + if (!is_array($list)) $list = array($list); |
|
| 1803 | 1803 | // Create a tree for loop |
| 1804 | 1804 | $list_count = count($list); |
| 1805 | - for($i=0;$i<$list_count;$i++) |
|
| 1805 | + for ($i = 0; $i < $list_count; $i++) |
|
| 1806 | 1806 | { |
| 1807 | 1807 | $node = $list[$i]; |
| 1808 | 1808 | $menu_item_srl = $node->menu_item_srl; |
@@ -1858,7 +1858,7 @@ discard block |
||
| 1858 | 1858 | $php_buff = sprintf( |
| 1859 | 1859 | '<?php '. |
| 1860 | 1860 | 'if(!defined("__XE__")) exit(); '. |
| 1861 | - '$menu = new stdClass();' . |
|
| 1861 | + '$menu = new stdClass();'. |
|
| 1862 | 1862 | '%s; '. |
| 1863 | 1863 | '%s; '. |
| 1864 | 1864 | '$menu->list = array(%s); '. |
@@ -1887,26 +1887,26 @@ discard block |
||
| 1887 | 1887 | */ |
| 1888 | 1888 | function getXmlTree($source_node, $tree, $site_srl, $domain) |
| 1889 | 1889 | { |
| 1890 | - if(!$source_node) return; |
|
| 1890 | + if (!$source_node) return; |
|
| 1891 | 1891 | |
| 1892 | 1892 | $oMenuAdminModel = getAdminModel('menu'); |
| 1893 | 1893 | |
| 1894 | - foreach($source_node as $menu_item_srl => $node) |
|
| 1894 | + foreach ($source_node as $menu_item_srl => $node) |
|
| 1895 | 1895 | { |
| 1896 | 1896 | $child_buff = ""; |
| 1897 | 1897 | // Get data of the child nodes |
| 1898 | - if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 1898 | + if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 1899 | 1899 | // List variables |
| 1900 | 1900 | $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); |
| 1901 | - foreach($names as $key => $val) |
|
| 1901 | + foreach ($names as $key => $val) |
|
| 1902 | 1902 | { |
| 1903 | - $name_arr_str .= sprintf('"%s"=>%s,',$key, var_export($val, true)); |
|
| 1903 | + $name_arr_str .= sprintf('"%s"=>%s,', $key, var_export($val, true)); |
|
| 1904 | 1904 | } |
| 1905 | 1905 | $name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str); |
| 1906 | 1906 | |
| 1907 | - $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); |
|
| 1908 | - $desc = str_replace(array('&','"',"'"),array('&','"','\\\''),$node->desc); |
|
| 1909 | - if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url)) |
|
| 1907 | + $url = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->url); |
|
| 1908 | + $desc = str_replace(array('&', '"', "'"), array('&', '"', '\\\''), $node->desc); |
|
| 1909 | + if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url)) |
|
| 1910 | 1910 | { |
| 1911 | 1911 | $href = "getSiteUrl('$domain', '','mid','$node->url')"; |
| 1912 | 1912 | } |
@@ -1916,21 +1916,21 @@ discard block |
||
| 1916 | 1916 | $expand = $node->expand; |
| 1917 | 1917 | |
| 1918 | 1918 | $normal_btn = $node->normal_btn; |
| 1919 | - if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
| 1919 | + if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $normal_btn); |
|
| 1920 | 1920 | else $normal_btn = ''; |
| 1921 | 1921 | $hover_btn = $node->hover_btn; |
| 1922 | - if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
| 1922 | + if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $hover_btn); |
|
| 1923 | 1923 | else $hover_btn = ''; |
| 1924 | 1924 | $active_btn = $node->active_btn; |
| 1925 | - if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
| 1925 | + if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $active_btn); |
|
| 1926 | 1926 | else $active_btn = ''; |
| 1927 | 1927 | |
| 1928 | 1928 | $group_srls = $node->group_srls; |
| 1929 | 1929 | |
| 1930 | - if($normal_btn) |
|
| 1930 | + if ($normal_btn) |
|
| 1931 | 1931 | { |
| 1932 | - if($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
| 1933 | - if($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
| 1932 | + if ($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
| 1933 | + if ($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
| 1934 | 1934 | $link = sprintf('<img src="%s" onmouseout="this.src=\'%s\'" alt="<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" %s %s />', $normal_btn, $normal_btn, $hover_str, $active_str); |
| 1935 | 1935 | } |
| 1936 | 1936 | else |
@@ -1938,7 +1938,7 @@ discard block |
||
| 1938 | 1938 | $link = '<?php print $_names[$lang_type]; ?>'; |
| 1939 | 1939 | } |
| 1940 | 1940 | // If the value of node->group_srls exists |
| 1941 | - if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0); |
|
| 1941 | + if ($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0); |
|
| 1942 | 1942 | else $group_check_code = "true"; |
| 1943 | 1943 | $attribute = sprintf( |
| 1944 | 1944 | 'node_srl="%d" parent_srl="%d" menu_name_key=%s text="<?php if(%s) { %s }?>" url="<?php print(%s?%s:"")?>" href="<?php print(%s?%s:"")?>" is_shortcut=%s desc=%s open_window=%s expand=%s normal_btn=%s hover_btn=%s active_btn=%s link="<?php if(%s) {?>%s<?php }?>"', |
@@ -1962,8 +1962,8 @@ discard block |
||
| 1962 | 1962 | $link |
| 1963 | 1963 | ); |
| 1964 | 1964 | |
| 1965 | - if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 1966 | - else $buff .= sprintf('<node %s />', $attribute); |
|
| 1965 | + if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 1966 | + else $buff .= sprintf('<node %s />', $attribute); |
|
| 1967 | 1967 | } |
| 1968 | 1968 | return $buff; |
| 1969 | 1969 | } |
@@ -1982,84 +1982,84 @@ discard block |
||
| 1982 | 1982 | function getPhpCacheCode($source_node, $tree, $site_srl, $domain) |
| 1983 | 1983 | { |
| 1984 | 1984 | $output = array("buff"=>"", "url_list"=>array()); |
| 1985 | - if(!$source_node) return $output; |
|
| 1985 | + if (!$source_node) return $output; |
|
| 1986 | 1986 | |
| 1987 | 1987 | $oMenuAdminModel = getAdminModel('menu'); |
| 1988 | 1988 | |
| 1989 | - foreach($source_node as $menu_item_srl => $node) |
|
| 1989 | + foreach ($source_node as $menu_item_srl => $node) |
|
| 1990 | 1990 | { |
| 1991 | 1991 | // Get data from child nodes if exist. |
| 1992 | - if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 1992 | + if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 1993 | 1993 | else $child_output = array("buff"=>"", "url_list"=>array()); |
| 1994 | 1994 | |
| 1995 | 1995 | // List variables |
| 1996 | 1996 | $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); |
| 1997 | 1997 | unset($name_arr_str); |
| 1998 | - foreach($names as $key => $val) |
|
| 1998 | + foreach ($names as $key => $val) |
|
| 1999 | 1999 | { |
| 2000 | - if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1) |
|
| 2000 | + if (preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1) |
|
| 2001 | 2001 | { |
| 2002 | 2002 | $name_arr_str .= sprintf('"%s"=>"%s",', $key, $val); |
| 2003 | 2003 | } |
| 2004 | 2004 | else |
| 2005 | 2005 | { |
| 2006 | - $name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val))); |
|
| 2006 | + $name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), removeHackTag($val))); |
|
| 2007 | 2007 | } |
| 2008 | 2008 | } |
| 2009 | 2009 | $name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']); |
| 2010 | 2010 | |
| 2011 | 2011 | // If url value is not empty in the current node, put the value into an array url_list |
| 2012 | - if($node->url) $child_output['url_list'][] = $node->url; |
|
| 2012 | + if ($node->url) $child_output['url_list'][] = $node->url; |
|
| 2013 | 2013 | $output['url_list'] = array_merge($output['url_list'], $child_output['url_list']); |
| 2014 | 2014 | // If node->group_srls value exists |
| 2015 | - if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0); |
|
| 2015 | + if ($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))', $node->group_srls, $node->group_srls == -1 ? 1 : 0); |
|
| 2016 | 2016 | else $group_check_code = "true"; |
| 2017 | 2017 | |
| 2018 | 2018 | // List variables |
| 2019 | - $href = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href); |
|
| 2020 | - $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); |
|
| 2021 | - $desc = str_replace(array('&','"',"'"),array('&','"','\\\''),$node->desc); |
|
| 2022 | - if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) |
|
| 2019 | + $href = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->href); |
|
| 2020 | + $url = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->url); |
|
| 2021 | + $desc = str_replace(array('&', '"', "'"), array('&', '"', '\\\''), $node->desc); |
|
| 2022 | + if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) |
|
| 2023 | 2023 | { |
| 2024 | 2024 | $href = "getSiteUrl('$domain', '','mid','$node->url')"; |
| 2025 | 2025 | } |
| 2026 | 2026 | else $href = var_export($url, true); |
| 2027 | 2027 | $is_shortcut = $node->is_shortcut; |
| 2028 | 2028 | $open_window = $node->open_window; |
| 2029 | - $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn); |
|
| 2030 | - $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn); |
|
| 2031 | - $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->active_btn); |
|
| 2029 | + $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->normal_btn); |
|
| 2030 | + $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->hover_btn); |
|
| 2031 | + $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $node->active_btn); |
|
| 2032 | 2032 | |
| 2033 | - foreach($child_output['url_list'] as $key =>$val) |
|
| 2033 | + foreach ($child_output['url_list'] as $key =>$val) |
|
| 2034 | 2034 | { |
| 2035 | 2035 | $child_output['url_list'][$key] = addslashes($val); |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | - $selected = '"'.implode('","',$child_output['url_list']).'"'; |
|
| 2038 | + $selected = '"'.implode('","', $child_output['url_list']).'"'; |
|
| 2039 | 2039 | $child_buff = $child_output['buff']; |
| 2040 | 2040 | $expand = $node->expand; |
| 2041 | 2041 | |
| 2042 | 2042 | $normal_btn = $node->normal_btn; |
| 2043 | - if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
| 2043 | + if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $normal_btn); |
|
| 2044 | 2044 | else $normal_btn = ''; |
| 2045 | 2045 | |
| 2046 | 2046 | $hover_btn = $node->hover_btn; |
| 2047 | - if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
| 2047 | + if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $hover_btn); |
|
| 2048 | 2048 | else $hover_btn = ''; |
| 2049 | 2049 | |
| 2050 | 2050 | $active_btn = $node->active_btn; |
| 2051 | - if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
| 2051 | + if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&', '"', '<', '>'), $active_btn); |
|
| 2052 | 2052 | else $active_btn = ''; |
| 2053 | 2053 | |
| 2054 | 2054 | |
| 2055 | 2055 | $group_srls = $node->group_srls; |
| 2056 | 2056 | |
| 2057 | - if($normal_btn) |
|
| 2057 | + if ($normal_btn) |
|
| 2058 | 2058 | { |
| 2059 | - if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = ''; |
|
| 2060 | - if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = ''; |
|
| 2059 | + if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = ''; |
|
| 2060 | + if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = ''; |
|
| 2061 | 2061 | $link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str); |
| 2062 | - if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str); |
|
| 2062 | + if ($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str); |
|
| 2063 | 2063 | else $link_active = $link; |
| 2064 | 2064 | } |
| 2065 | 2065 | else |
@@ -2097,7 +2097,7 @@ discard block |
||
| 2097 | 2097 | ); |
| 2098 | 2098 | |
| 2099 | 2099 | // Generate buff data |
| 2100 | - $output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute); |
|
| 2100 | + $output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute); |
|
| 2101 | 2101 | $output['name'] .= $name_str; |
| 2102 | 2102 | } |
| 2103 | 2103 | return $output; |
@@ -2111,19 +2111,19 @@ discard block |
||
| 2111 | 2111 | */ |
| 2112 | 2112 | function updateMenuLayout($layout_srl, $menu_srl_list) |
| 2113 | 2113 | { |
| 2114 | - if(!count($menu_srl_list)) return; |
|
| 2114 | + if (!count($menu_srl_list)) return; |
|
| 2115 | 2115 | // Delete the value of menu_srls |
| 2116 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
| 2116 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
| 2117 | 2117 | $output = executeQuery('menu.deleteMenuLayout', $args); |
| 2118 | - if(!$output->toBool()) return $output; |
|
| 2118 | + if (!$output->toBool()) return $output; |
|
| 2119 | 2119 | |
| 2120 | 2120 | $args->layout_srl = $layout_srl; |
| 2121 | 2121 | // Mapping menu_srls, layout_srl |
| 2122 | - for($i=0;$i<count($menu_srl_list);$i++) |
|
| 2122 | + for ($i = 0; $i < count($menu_srl_list); $i++) |
|
| 2123 | 2123 | { |
| 2124 | 2124 | $args->menu_srl = $menu_srl_list[$i]; |
| 2125 | 2125 | $output = executeQuery('menu.insertMenuLayout', $args); |
| 2126 | - if(!$output->toBool()) return $output; |
|
| 2126 | + if (!$output->toBool()) return $output; |
|
| 2127 | 2127 | } |
| 2128 | 2128 | } |
| 2129 | 2129 | |
@@ -2136,47 +2136,47 @@ discard block |
||
| 2136 | 2136 | { |
| 2137 | 2137 | // path setting |
| 2138 | 2138 | $path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl); |
| 2139 | - if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path)) |
|
| 2139 | + if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path)) |
|
| 2140 | 2140 | { |
| 2141 | 2141 | FileHandler::makeDir($path); |
| 2142 | 2142 | } |
| 2143 | 2143 | |
| 2144 | - if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y') |
|
| 2144 | + if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y') |
|
| 2145 | 2145 | { |
| 2146 | 2146 | $oMenuModel = getAdminModel('menu'); |
| 2147 | 2147 | $itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl); |
| 2148 | 2148 | |
| 2149 | - if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn); |
|
| 2150 | - if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn); |
|
| 2151 | - if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn); |
|
| 2149 | + if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn); |
|
| 2150 | + if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn); |
|
| 2151 | + if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn); |
|
| 2152 | 2152 | } |
| 2153 | 2153 | |
| 2154 | 2154 | $returnArray = array(); |
| 2155 | 2155 | $date = date('YmdHis'); |
| 2156 | 2156 | // normal button |
| 2157 | - if($args->menu_normal_btn) |
|
| 2157 | + if ($args->menu_normal_btn) |
|
| 2158 | 2158 | { |
| 2159 | - $tmp_arr = explode('.',$args->menu_normal_btn['name']); |
|
| 2160 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
| 2159 | + $tmp_arr = explode('.', $args->menu_normal_btn['name']); |
|
| 2160 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
| 2161 | 2161 | |
| 2162 | 2162 | $filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext); |
| 2163 | 2163 | |
| 2164 | - if(checkUploadedFile($args->menu_normal_btn['tmp_name'])) |
|
| 2164 | + if (checkUploadedFile($args->menu_normal_btn['tmp_name'])) |
|
| 2165 | 2165 | { |
| 2166 | - move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename ); |
|
| 2166 | + move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename); |
|
| 2167 | 2167 | $returnArray ['normal_btn'] = $filename; |
| 2168 | 2168 | } |
| 2169 | 2169 | } |
| 2170 | 2170 | |
| 2171 | 2171 | // hover button |
| 2172 | - if($args->menu_hover_btn) |
|
| 2172 | + if ($args->menu_hover_btn) |
|
| 2173 | 2173 | { |
| 2174 | - $tmp_arr = explode('.',$args->menu_hover_btn['name']); |
|
| 2175 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
| 2174 | + $tmp_arr = explode('.', $args->menu_hover_btn['name']); |
|
| 2175 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
| 2176 | 2176 | |
| 2177 | 2177 | $filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext); |
| 2178 | 2178 | |
| 2179 | - if(checkUploadedFile($args->menu_hover_btn['tmp_name'])) |
|
| 2179 | + if (checkUploadedFile($args->menu_hover_btn['tmp_name'])) |
|
| 2180 | 2180 | { |
| 2181 | 2181 | move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename); |
| 2182 | 2182 | $returnArray['hover_btn'] = $filename; |
@@ -2184,14 +2184,14 @@ discard block |
||
| 2184 | 2184 | } |
| 2185 | 2185 | |
| 2186 | 2186 | // active button |
| 2187 | - if($args->menu_active_btn) |
|
| 2187 | + if ($args->menu_active_btn) |
|
| 2188 | 2188 | { |
| 2189 | - $tmp_arr = explode('.',$args->menu_active_btn['name']); |
|
| 2190 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
| 2189 | + $tmp_arr = explode('.', $args->menu_active_btn['name']); |
|
| 2190 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
| 2191 | 2191 | |
| 2192 | 2192 | $filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext); |
| 2193 | 2193 | |
| 2194 | - if(checkUploadedFile($args->menu_active_btn['tmp_name'])) |
|
| 2194 | + if (checkUploadedFile($args->menu_active_btn['tmp_name'])) |
|
| 2195 | 2195 | { |
| 2196 | 2196 | move_uploaded_file($args->menu_active_btn['tmp_name'], $filename); |
| 2197 | 2197 | $returnArray['active_btn'] = $filename; |
@@ -2213,7 +2213,7 @@ discard block |
||
| 2213 | 2213 | "active_btn"=>"", |
| 2214 | 2214 | ); |
| 2215 | 2215 | //normal_btn |
| 2216 | - if($menuItemInfo->normal_btn) |
|
| 2216 | + if ($menuItemInfo->normal_btn) |
|
| 2217 | 2217 | { |
| 2218 | 2218 | $originFile = FileHandler::getRealPath($menuItemInfo->normal_btn); |
| 2219 | 2219 | $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal'); |
@@ -2223,7 +2223,7 @@ discard block |
||
| 2223 | 2223 | } |
| 2224 | 2224 | |
| 2225 | 2225 | //hover_btn |
| 2226 | - if($menuItemInfo->hover_btn) |
|
| 2226 | + if ($menuItemInfo->hover_btn) |
|
| 2227 | 2227 | { |
| 2228 | 2228 | $originFile = FileHandler::getRealPath($menuItemInfo->hover_btn); |
| 2229 | 2229 | $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover'); |
@@ -2233,7 +2233,7 @@ discard block |
||
| 2233 | 2233 | } |
| 2234 | 2234 | |
| 2235 | 2235 | //active_btn |
| 2236 | - if($menuItemInfo->active_btn) |
|
| 2236 | + if ($menuItemInfo->active_btn) |
|
| 2237 | 2237 | { |
| 2238 | 2238 | $originFile = FileHandler::getRealPath($menuItemInfo->active_btn); |
| 2239 | 2239 | $targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active'); |
@@ -2248,9 +2248,9 @@ discard block |
||
| 2248 | 2248 | { |
| 2249 | 2249 | $path = sprintf('./files/attach/menu_button/%d/', $menuSrl); |
| 2250 | 2250 | $tmp_arr = explode('.', $buttonPath); |
| 2251 | - $ext = $tmp_arr[count($tmp_arr)-1]; |
|
| 2251 | + $ext = $tmp_arr[count($tmp_arr) - 1]; |
|
| 2252 | 2252 | $date = date("YmdHis"); |
| 2253 | - return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext); |
|
| 2253 | + return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext); |
|
| 2254 | 2254 | } |
| 2255 | 2255 | |
| 2256 | 2256 | public function makeHomemenuCacheFile($menuSrl) |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $site_module_info = Context::get('site_module_info'); |
| 70 | 70 | |
| 71 | 71 | $output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl); |
| 72 | - if(!$output->toBool()) return $output; |
|
| 72 | + if(!$output->toBool()) { |
|
| 73 | + return $output; |
|
| 74 | + } |
|
| 73 | 75 | |
| 74 | 76 | $this->add('menu_srl', $output->get('menuSrl')); |
| 75 | 77 | $this->setMessage('success_registed'); |
@@ -148,8 +150,7 @@ discard block |
||
| 148 | 150 | $moduleConfig->unlinked_menu_srl = $output->get('menuSrl'); |
| 149 | 151 | $oModuleController = getController('module'); |
| 150 | 152 | $oModuleController->updateModuleConfig('menu', $moduleConfig); |
| 151 | - } |
|
| 152 | - else |
|
| 153 | + } else |
|
| 153 | 154 | { |
| 154 | 155 | return false; |
| 155 | 156 | } |
@@ -186,8 +187,7 @@ discard block |
||
| 186 | 187 | if($output->toBool() && $output->data) |
| 187 | 188 | { |
| 188 | 189 | $moduleInfo->menu_srl = $output->data->menu_srl; |
| 189 | - } |
|
| 190 | - else |
|
| 190 | + } else |
|
| 191 | 191 | { |
| 192 | 192 | // create menu item. |
| 193 | 193 | $item_args->menu_srl = $menuSrl; |
@@ -235,7 +235,9 @@ discard block |
||
| 235 | 235 | $args->menu_srl = Context::get('menu_srl'); |
| 236 | 236 | |
| 237 | 237 | $output = executeQuery('menu.updateMenu', $args); |
| 238 | - if(!$output->toBool()) return $output; |
|
| 238 | + if(!$output->toBool()) { |
|
| 239 | + return $output; |
|
| 240 | + } |
|
| 239 | 241 | |
| 240 | 242 | $this->setMessage('success_registed'); |
| 241 | 243 | |
@@ -255,8 +257,9 @@ discard block |
||
| 255 | 257 | $menuInfo = $oMenuAdminModel->getMenu($menu_srl); |
| 256 | 258 | |
| 257 | 259 | $oAdmin = getClass('admin'); |
| 258 | - if($menuInfo->title == $oAdmin->getAdminMenuName()) |
|
| 259 | - return new BaseObject(-1, 'msg_adminmenu_cannot_delete'); |
|
| 260 | + if($menuInfo->title == $oAdmin->getAdminMenuName()) { |
|
| 261 | + return new BaseObject(-1, 'msg_adminmenu_cannot_delete'); |
|
| 262 | + } |
|
| 260 | 263 | |
| 261 | 264 | // get menu properies with child menu |
| 262 | 265 | $phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl); |
@@ -280,8 +283,9 @@ discard block |
||
| 280 | 283 | $originMenu = $value; |
| 281 | 284 | $this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude); |
| 282 | 285 | |
| 283 | - if($isStartmenuInclude) |
|
| 284 | - break; |
|
| 286 | + if($isStartmenuInclude) { |
|
| 287 | + break; |
|
| 288 | + } |
|
| 285 | 289 | } |
| 286 | 290 | } |
| 287 | 291 | |
@@ -366,7 +370,9 @@ discard block |
||
| 366 | 370 | foreach($cache_list as $cache_file) |
| 367 | 371 | { |
| 368 | 372 | $pos = strpos($cache_file, $menu_srl.'.'); |
| 369 | - if($pos>0)FileHandler::removeFile($cache_file); |
|
| 373 | + if($pos>0) { |
|
| 374 | + FileHandler::removeFile($cache_file); |
|
| 375 | + } |
|
| 370 | 376 | } |
| 371 | 377 | } |
| 372 | 378 | // Delete images of menu buttons |
@@ -405,8 +411,7 @@ discard block |
||
| 405 | 411 | if($request->is_shortcut == 'Y') |
| 406 | 412 | { |
| 407 | 413 | $result = $this->_insertShortcut($request); |
| 408 | - } |
|
| 409 | - else |
|
| 414 | + } else |
|
| 410 | 415 | { |
| 411 | 416 | $result = $this->_insertMenu($request, $isProc); |
| 412 | 417 | } |
@@ -464,12 +469,21 @@ discard block |
||
| 464 | 469 | $args->is_shortcut = $request->is_shortcut; |
| 465 | 470 | $args->url = $request->shortcut_target; |
| 466 | 471 | |
| 467 | - if(!$args->open_window) $args->open_window = 'N'; |
|
| 468 | - if(!$args->expand) $args->expand = 'N'; |
|
| 469 | - if(!$args->is_shortcut) $args->is_shortcut = 'Y'; |
|
| 472 | + if(!$args->open_window) { |
|
| 473 | + $args->open_window = 'N'; |
|
| 474 | + } |
|
| 475 | + if(!$args->expand) { |
|
| 476 | + $args->expand = 'N'; |
|
| 477 | + } |
|
| 478 | + if(!$args->is_shortcut) { |
|
| 479 | + $args->is_shortcut = 'Y'; |
|
| 480 | + } |
|
| 470 | 481 | |
| 471 | - if($request->menu_name_key) $args->name = $request->menu_name_key; |
|
| 472 | - else $args->name = $request->menu_name; |
|
| 482 | + if($request->menu_name_key) { |
|
| 483 | + $args->name = $request->menu_name_key; |
|
| 484 | + } else { |
|
| 485 | + $args->name = $request->menu_name; |
|
| 486 | + } |
|
| 473 | 487 | } |
| 474 | 488 | // type is module short cut |
| 475 | 489 | else if(is_numeric($request->shortcut_target)) |
@@ -504,13 +518,18 @@ discard block |
||
| 504 | 518 | $args->url = '#'; |
| 505 | 519 | } |
| 506 | 520 | |
| 507 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 508 | - else $args->desc = ''; |
|
| 521 | + if($request->menu_desc) { |
|
| 522 | + $args->desc = $request->menu_desc; |
|
| 523 | + } else { |
|
| 524 | + $args->desc = ''; |
|
| 525 | + } |
|
| 509 | 526 | |
| 510 | 527 | $args->menu_item_srl = getNextSequence(); |
| 511 | 528 | $args->listorder = -1*$args->menu_item_srl; |
| 512 | 529 | $output = executeQuery('menu.insertMenuItem', $args); |
| 513 | - if(!$output->toBool()) return $output; |
|
| 530 | + if(!$output->toBool()) { |
|
| 531 | + return $output; |
|
| 532 | + } |
|
| 514 | 533 | |
| 515 | 534 | $oDB->commit(); |
| 516 | 535 | |
@@ -532,15 +551,27 @@ discard block |
||
| 532 | 551 | $args->expand = $request->menu_expand; |
| 533 | 552 | $args->is_shortcut = $request->is_shortcut; |
| 534 | 553 | |
| 535 | - if(!$args->open_window) $args->open_window = 'N'; |
|
| 536 | - if(!$args->expand) $args->expand = 'N'; |
|
| 537 | - if(!$args->is_shortcut) $args->is_shortcut = 'N'; |
|
| 554 | + if(!$args->open_window) { |
|
| 555 | + $args->open_window = 'N'; |
|
| 556 | + } |
|
| 557 | + if(!$args->expand) { |
|
| 558 | + $args->expand = 'N'; |
|
| 559 | + } |
|
| 560 | + if(!$args->is_shortcut) { |
|
| 561 | + $args->is_shortcut = 'N'; |
|
| 562 | + } |
|
| 538 | 563 | |
| 539 | - if($request->menu_name_key) $args->name = $request->menu_name_key; |
|
| 540 | - else $args->name = $request->menu_name; |
|
| 564 | + if($request->menu_name_key) { |
|
| 565 | + $args->name = $request->menu_name_key; |
|
| 566 | + } else { |
|
| 567 | + $args->name = $request->menu_name; |
|
| 568 | + } |
|
| 541 | 569 | |
| 542 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 543 | - else $args->desc = ''; |
|
| 570 | + if($request->menu_desc) { |
|
| 571 | + $args->desc = $request->menu_desc; |
|
| 572 | + } else { |
|
| 573 | + $args->desc = ''; |
|
| 574 | + } |
|
| 544 | 575 | |
| 545 | 576 | if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0) |
| 546 | 577 | { |
@@ -558,9 +589,15 @@ discard block |
||
| 558 | 589 | } |
| 559 | 590 | |
| 560 | 591 | // if setting button variables, set argument button variables for db insert. but not upload in this method |
| 561 | - if($request->normal_btn) $args->normal_btn = $request->normal_btn; |
|
| 562 | - if($request->hover_btn) $args->hover_btn = $request->hover_btn; |
|
| 563 | - if($request->active_btn) $args->active_btn = $request->active_btn; |
|
| 592 | + if($request->normal_btn) { |
|
| 593 | + $args->normal_btn = $request->normal_btn; |
|
| 594 | + } |
|
| 595 | + if($request->hover_btn) { |
|
| 596 | + $args->hover_btn = $request->hover_btn; |
|
| 597 | + } |
|
| 598 | + if($request->active_btn) { |
|
| 599 | + $args->active_btn = $request->active_btn; |
|
| 600 | + } |
|
| 564 | 601 | |
| 565 | 602 | if(!$request->module_id) |
| 566 | 603 | { |
@@ -571,7 +608,9 @@ discard block |
||
| 571 | 608 | $args->menu_item_srl = getNextSequence(); |
| 572 | 609 | $args->listorder = -1*$args->menu_item_srl; |
| 573 | 610 | $output = executeQuery('menu.insertMenuItem', $args); |
| 574 | - if(!$output->toBool()) return $output; |
|
| 611 | + if(!$output->toBool()) { |
|
| 612 | + return $output; |
|
| 613 | + } |
|
| 575 | 614 | |
| 576 | 615 | $oDB->commit(); |
| 577 | 616 | |
@@ -652,8 +691,12 @@ discard block |
||
| 652 | 691 | } |
| 653 | 692 | |
| 654 | 693 | // variables set |
| 655 | - if($request->menu_open_window != "Y") $request->menu_open_window = "N"; |
|
| 656 | - if($request->menu_expand != "Y") $request->menu_expand = "N"; |
|
| 694 | + if($request->menu_open_window != "Y") { |
|
| 695 | + $request->menu_open_window = "N"; |
|
| 696 | + } |
|
| 697 | + if($request->menu_expand != "Y") { |
|
| 698 | + $request->menu_expand = "N"; |
|
| 699 | + } |
|
| 657 | 700 | |
| 658 | 701 | // Get original information |
| 659 | 702 | $oMenuAdminModel = getAdminModel('menu'); |
@@ -680,13 +723,11 @@ discard block |
||
| 680 | 723 | |
| 681 | 724 | $args->url = $newItemInfo->url; |
| 682 | 725 | $args->is_shortcut = 'Y'; |
| 683 | - } |
|
| 684 | - else |
|
| 726 | + } else |
|
| 685 | 727 | { |
| 686 | 728 | $args->url = '#'; |
| 687 | 729 | } |
| 688 | - } |
|
| 689 | - else |
|
| 730 | + } else |
|
| 690 | 731 | { |
| 691 | 732 | // check already created module instance |
| 692 | 733 | $oModuleModel = getModel('module'); |
@@ -719,14 +760,16 @@ discard block |
||
| 719 | 760 | if($request->menu_name_key) |
| 720 | 761 | { |
| 721 | 762 | $args->name = $request->menu_name_key; |
| 722 | - } |
|
| 723 | - else |
|
| 763 | + } else |
|
| 724 | 764 | { |
| 725 | 765 | $args->name = $request->menu_name; |
| 726 | 766 | } |
| 727 | 767 | |
| 728 | - if($request->menu_desc) $args->desc = $request->menu_desc; |
|
| 729 | - else $args->desc = ''; |
|
| 768 | + if($request->menu_desc) { |
|
| 769 | + $args->desc = $request->menu_desc; |
|
| 770 | + } else { |
|
| 771 | + $args->desc = ''; |
|
| 772 | + } |
|
| 730 | 773 | |
| 731 | 774 | unset($args->group_srls); |
| 732 | 775 | $args->open_window = $request->menu_open_window; |
@@ -828,8 +871,7 @@ discard block |
||
| 828 | 871 | { |
| 829 | 872 | $this->setError($returnObj->error); |
| 830 | 873 | $this->setMessage($returnObj->message); |
| 831 | - } |
|
| 832 | - else |
|
| 874 | + } else |
|
| 833 | 875 | { |
| 834 | 876 | $this->setMessage('success_deleted'); |
| 835 | 877 | } |
@@ -856,7 +898,9 @@ discard block |
||
| 856 | 898 | if($args->is_force != 'Y') |
| 857 | 899 | { |
| 858 | 900 | $output = executeQuery('menu.getChildMenuCount', $args); |
| 859 | - if(!$output->toBool()) return $output; |
|
| 901 | + if(!$output->toBool()) { |
|
| 902 | + return $output; |
|
| 903 | + } |
|
| 860 | 904 | if($output->data->count > 0) |
| 861 | 905 | { |
| 862 | 906 | return new BaseObject(-1001, 'msg_cannot_delete_for_child'); |
@@ -874,7 +918,9 @@ discard block |
||
| 874 | 918 | return $this->stop('msg_cannot_delete_for_admin_topmenu'); |
| 875 | 919 | } |
| 876 | 920 | |
| 877 | - if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl; |
|
| 921 | + if($itemInfo->parent_srl) { |
|
| 922 | + $parent_srl = $itemInfo->parent_srl; |
|
| 923 | + } |
|
| 878 | 924 | |
| 879 | 925 | // get menu properies with child menu |
| 880 | 926 | $phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl); |
@@ -948,9 +994,15 @@ discard block |
||
| 948 | 994 | // Update the xml file and get its location |
| 949 | 995 | $xml_file = $this->makeXmlFile($args->menu_srl); |
| 950 | 996 | // Delete all of image buttons |
| 951 | - if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']); |
|
| 952 | - if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']); |
|
| 953 | - if($node['active_btn']) FileHandler::removeFile($node['active_btn']); |
|
| 997 | + if($node['normal_btn']) { |
|
| 998 | + FileHandler::removeFile($node['normal_btn']); |
|
| 999 | + } |
|
| 1000 | + if($node['hover_btn']) { |
|
| 1001 | + FileHandler::removeFile($node['hover_btn']); |
|
| 1002 | + } |
|
| 1003 | + if($node['active_btn']) { |
|
| 1004 | + FileHandler::removeFile($node['active_btn']); |
|
| 1005 | + } |
|
| 954 | 1006 | |
| 955 | 1007 | // Delete module |
| 956 | 1008 | if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0) |
@@ -1017,7 +1069,9 @@ discard block |
||
| 1017 | 1069 | $source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number |
| 1018 | 1070 | $target_srl = Context::get('target_srl'); // Self menu item serial number |
| 1019 | 1071 | |
| 1020 | - if(!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1072 | + if(!$mode || !$parent_srl || !$target_srl) { |
|
| 1073 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1074 | + } |
|
| 1021 | 1075 | |
| 1022 | 1076 | $oMenuAdminModel = getAdminModel('menu'); |
| 1023 | 1077 | |
@@ -1181,8 +1235,11 @@ discard block |
||
| 1181 | 1235 | // default argument setting |
| 1182 | 1236 | $args = new stdClass(); |
| 1183 | 1237 | $args->menu_srl = $menuSrl; |
| 1184 | - if($parentSrl == 0) $args->parent_srl = $menuSrl; |
|
| 1185 | - else $args->parent_srl = $parentSrl; |
|
| 1238 | + if($parentSrl == 0) { |
|
| 1239 | + $args->parent_srl = $menuSrl; |
|
| 1240 | + } else { |
|
| 1241 | + $args->parent_srl = $parentSrl; |
|
| 1242 | + } |
|
| 1186 | 1243 | $args->menu_name_key = $originMenu['text']; |
| 1187 | 1244 | $args->menu_name = $originMenu['text']; |
| 1188 | 1245 | $args->menu_open_window = $originMenu['open_window']; |
@@ -1275,8 +1332,11 @@ discard block |
||
| 1275 | 1332 | for($i=0;$i<4;$i++) |
| 1276 | 1333 | { |
| 1277 | 1334 | $case = rand(0, 1); |
| 1278 | - if($case) $doc = rand(65, 90); |
|
| 1279 | - else $doc = rand(97, 122); |
|
| 1335 | + if($case) { |
|
| 1336 | + $doc = rand(65, 90); |
|
| 1337 | + } else { |
|
| 1338 | + $doc = rand(97, 122); |
|
| 1339 | + } |
|
| 1280 | 1340 | |
| 1281 | 1341 | $randomString .= chr($doc); |
| 1282 | 1342 | } |
@@ -1299,15 +1359,21 @@ discard block |
||
| 1299 | 1359 | // menu name update |
| 1300 | 1360 | $args->menu_srl = $this->menuSrl; |
| 1301 | 1361 | $output = executeQuery('menu.updateMenu', $args); |
| 1302 | - if(!$output->toBool()) return $output; |
|
| 1362 | + if(!$output->toBool()) { |
|
| 1363 | + return $output; |
|
| 1364 | + } |
|
| 1303 | 1365 | |
| 1304 | 1366 | $this->map = array(); |
| 1305 | 1367 | if(is_array($parentKeyList)) |
| 1306 | 1368 | { |
| 1307 | 1369 | foreach($parentKeyList as $no=>$srl) |
| 1308 | 1370 | { |
| 1309 | - if($srl === 0) continue; |
|
| 1310 | - if(!is_array($this->map[$srl]))$this->map[$srl] = array(); |
|
| 1371 | + if($srl === 0) { |
|
| 1372 | + continue; |
|
| 1373 | + } |
|
| 1374 | + if(!is_array($this->map[$srl])) { |
|
| 1375 | + $this->map[$srl] = array(); |
|
| 1376 | + } |
|
| 1311 | 1377 | $this->map[$srl][] = $no; |
| 1312 | 1378 | } |
| 1313 | 1379 | } |
@@ -1409,7 +1475,9 @@ discard block |
||
| 1409 | 1475 | $oMenuAdminModel = getAdminModel('menu'); |
| 1410 | 1476 | |
| 1411 | 1477 | $target_item = $oMenuAdminModel->getMenuItemInfo($target_srl); |
| 1412 | - if($target_item->menu_item_srl != $target_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1478 | + if($target_item->menu_item_srl != $target_srl) { |
|
| 1479 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1480 | + } |
|
| 1413 | 1481 | // Move the menu location(change the order menu appears) |
| 1414 | 1482 | if($mode == 'move') |
| 1415 | 1483 | { |
@@ -1420,24 +1488,33 @@ discard block |
||
| 1420 | 1488 | if($source_srl) |
| 1421 | 1489 | { |
| 1422 | 1490 | $source_item = $oMenuAdminModel->getMenuItemInfo($source_srl); |
| 1423 | - if($source_item->menu_item_srl != $source_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1491 | + if($source_item->menu_item_srl != $source_srl) { |
|
| 1492 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1493 | + } |
|
| 1424 | 1494 | $args->listorder = $source_item->listorder-1; |
| 1425 | - } |
|
| 1426 | - else |
|
| 1495 | + } else |
|
| 1427 | 1496 | { |
| 1428 | 1497 | $output = executeQuery('menu.getMaxListorder', $args); |
| 1429 | - if(!$output->toBool()) return $output; |
|
| 1498 | + if(!$output->toBool()) { |
|
| 1499 | + return $output; |
|
| 1500 | + } |
|
| 1430 | 1501 | $args->listorder = (int)$output->data->listorder; |
| 1431 | - if(!$args->listorder) $args->listorder= 0; |
|
| 1502 | + if(!$args->listorder) { |
|
| 1503 | + $args->listorder= 0; |
|
| 1504 | + } |
|
| 1432 | 1505 | } |
| 1433 | 1506 | $args->parent_srl = $parent_srl; |
| 1434 | 1507 | $output = executeQuery('menu.updateMenuItemListorder', $args); |
| 1435 | - if(!$output->toBool()) return $output; |
|
| 1508 | + if(!$output->toBool()) { |
|
| 1509 | + return $output; |
|
| 1510 | + } |
|
| 1436 | 1511 | |
| 1437 | 1512 | $args->parent_srl = $parent_srl; |
| 1438 | 1513 | $args->menu_item_srl = $target_srl; |
| 1439 | 1514 | $output = executeQuery('menu.updateMenuItemNode', $args); |
| 1440 | - if(!$output->toBool()) return $output; |
|
| 1515 | + if(!$output->toBool()) { |
|
| 1516 | + return $output; |
|
| 1517 | + } |
|
| 1441 | 1518 | |
| 1442 | 1519 | //module's menu_srl move also |
| 1443 | 1520 | if($isShortcut == 'N' && !empty($url)) |
@@ -1465,14 +1542,15 @@ discard block |
||
| 1465 | 1542 | } |
| 1466 | 1543 | } |
| 1467 | 1544 | // Add a child |
| 1468 | - } |
|
| 1469 | - elseif($mode == 'insert') |
|
| 1545 | + } elseif($mode == 'insert') |
|
| 1470 | 1546 | { |
| 1471 | 1547 | $args->menu_item_srl = $target_srl; |
| 1472 | 1548 | $args->parent_srl = $parent_srl; |
| 1473 | 1549 | $args->listorder = -1*getNextSequence(); |
| 1474 | 1550 | $output = executeQuery('menu.updateMenuItemNode', $args); |
| 1475 | - if(!$output->toBool()) return $output; |
|
| 1551 | + if(!$output->toBool()) { |
|
| 1552 | + return $output; |
|
| 1553 | + } |
|
| 1476 | 1554 | } |
| 1477 | 1555 | |
| 1478 | 1556 | $xml_file = $this->makeXmlFile($menu_srl); |
@@ -1516,8 +1594,7 @@ discard block |
||
| 1516 | 1594 | { |
| 1517 | 1595 | Context::set('error_messge', Context::getLang('msg_invalid_request')); |
| 1518 | 1596 | |
| 1519 | - } |
|
| 1520 | - else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name']) || !checkUploadedFile($target_file['tmp_name'])) |
|
| 1597 | + } else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name']) || !checkUploadedFile($target_file['tmp_name'])) |
|
| 1521 | 1598 | { |
| 1522 | 1599 | Context::set('error_messge', Context::getLang('msg_invalid_request')); |
| 1523 | 1600 | } |
@@ -1531,7 +1608,9 @@ discard block |
||
| 1531 | 1608 | $path = sprintf('./files/attach/menu_button/%d/', $menu_srl); |
| 1532 | 1609 | $filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext); |
| 1533 | 1610 | |
| 1534 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
| 1611 | + if(!is_dir($path)) { |
|
| 1612 | + FileHandler::makeDir($path); |
|
| 1613 | + } |
|
| 1535 | 1614 | |
| 1536 | 1615 | move_uploaded_file($target_file['tmp_name'], $filename); |
| 1537 | 1616 | Context::set('filename', $filename); |
@@ -1571,7 +1650,9 @@ discard block |
||
| 1571 | 1650 | foreach($installed_module_list AS $key=>$value) |
| 1572 | 1651 | { |
| 1573 | 1652 | $info = $oModuleModel->getModuleActionXml($value->module); |
| 1574 | - if($info->menu) $menuList[$value->module] = $info->menu; |
|
| 1653 | + if($info->menu) { |
|
| 1654 | + $menuList[$value->module] = $info->menu; |
|
| 1655 | + } |
|
| 1575 | 1656 | unset($info->menu); |
| 1576 | 1657 | } |
| 1577 | 1658 | } |
@@ -1603,8 +1684,12 @@ discard block |
||
| 1603 | 1684 | $info = $oModuleModel->getModuleActionXml($moduleName); |
| 1604 | 1685 | |
| 1605 | 1686 | $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index); |
| 1606 | - if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act); |
|
| 1607 | - if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin'); |
|
| 1687 | + if(empty($url)) { |
|
| 1688 | + $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act); |
|
| 1689 | + } |
|
| 1690 | + if(empty($url)) { |
|
| 1691 | + $url = getNotEncodedFullUrl('', 'module', 'admin'); |
|
| 1692 | + } |
|
| 1608 | 1693 | $dbInfo = Context::getDBInfo(); |
| 1609 | 1694 | |
| 1610 | 1695 | $args = new stdClass(); |
@@ -1616,8 +1701,7 @@ discard block |
||
| 1616 | 1701 | if(strpos($url, 'https') !== false) |
| 1617 | 1702 | { |
| 1618 | 1703 | $args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url); |
| 1619 | - } |
|
| 1620 | - else |
|
| 1704 | + } else |
|
| 1621 | 1705 | { |
| 1622 | 1706 | $args->url = str_replace($dbInfo->default_url, '', $url); |
| 1623 | 1707 | } |
@@ -1636,14 +1720,18 @@ discard block |
||
| 1636 | 1720 | if($item_info->menu_item_srl == $args->menu_item_srl) |
| 1637 | 1721 | { |
| 1638 | 1722 | $output = $this->_updateMenuItem($args); |
| 1639 | - if(!$output->toBool()) return $output; |
|
| 1723 | + if(!$output->toBool()) { |
|
| 1724 | + return $output; |
|
| 1725 | + } |
|
| 1640 | 1726 | } |
| 1641 | 1727 | // Insert if not exist |
| 1642 | 1728 | else |
| 1643 | 1729 | { |
| 1644 | 1730 | $args->listorder = -1*$args->menu_item_srl; |
| 1645 | 1731 | $output = executeQuery('menu.insertMenuItem', $args); |
| 1646 | - if(!$output->toBool()) return $output; |
|
| 1732 | + if(!$output->toBool()) { |
|
| 1733 | + return $output; |
|
| 1734 | + } |
|
| 1647 | 1735 | } |
| 1648 | 1736 | // Get information of the menu |
| 1649 | 1737 | $menu_info = $oMenuModel->getMenu($args->menu_srl); |
@@ -1674,8 +1762,7 @@ discard block |
||
| 1674 | 1762 | if(!$exposure) |
| 1675 | 1763 | { |
| 1676 | 1764 | $args->group_srls = ''; |
| 1677 | - } |
|
| 1678 | - else |
|
| 1765 | + } else |
|
| 1679 | 1766 | { |
| 1680 | 1767 | $exposure = explode(',', $exposure); |
| 1681 | 1768 | if(in_array($exposure, array('-1','-3'))) |
@@ -1683,7 +1770,9 @@ discard block |
||
| 1683 | 1770 | $args->group_srls = $exposure; |
| 1684 | 1771 | } |
| 1685 | 1772 | |
| 1686 | - if($exposure) $args->group_srls = implode(',', $exposure); |
|
| 1773 | + if($exposure) { |
|
| 1774 | + $args->group_srls = implode(',', $exposure); |
|
| 1775 | + } |
|
| 1687 | 1776 | } |
| 1688 | 1777 | |
| 1689 | 1778 | $output = $this->_updateMenuItem($args); |
@@ -1706,7 +1795,9 @@ discard block |
||
| 1706 | 1795 | $moduleGrnatsArgs = new stdClass; |
| 1707 | 1796 | $moduleGrnatsArgs->module_srl = $moduleInfo->module_srl; |
| 1708 | 1797 | $output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs); |
| 1709 | - if(!$output->data) $output->data = array(); |
|
| 1798 | + if(!$output->data) { |
|
| 1799 | + $output->data = array(); |
|
| 1800 | + } |
|
| 1710 | 1801 | $moduleGrnats = new stdClass(); |
| 1711 | 1802 | foreach($output->data as $grant) |
| 1712 | 1803 | { |
@@ -1715,7 +1806,9 @@ discard block |
||
| 1715 | 1806 | } |
| 1716 | 1807 | |
| 1717 | 1808 | $grantList = $xml_info->grant; |
| 1718 | - if(!$grantList) $grantList = new stdClass; |
|
| 1809 | + if(!$grantList) { |
|
| 1810 | + $grantList = new stdClass; |
|
| 1811 | + } |
|
| 1719 | 1812 | |
| 1720 | 1813 | $grantList->access = new stdClass(); |
| 1721 | 1814 | $grantList->access->default = 'guest'; |
@@ -1741,10 +1834,11 @@ discard block |
||
| 1741 | 1834 | $grant->{$grantName}[] = $htPerm[$grantName]; |
| 1742 | 1835 | continue; |
| 1743 | 1836 | } |
| 1744 | - } |
|
| 1745 | - else if($itemInfo->is_shortcut === 'Y') |
|
| 1837 | + } else if($itemInfo->is_shortcut === 'Y') |
|
| 1746 | 1838 | { |
| 1747 | - if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName}; |
|
| 1839 | + if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) { |
|
| 1840 | + $grant->{$grantName} = $moduleGrnats->{$grantName}; |
|
| 1841 | + } |
|
| 1748 | 1842 | } |
| 1749 | 1843 | } |
| 1750 | 1844 | |
@@ -1766,12 +1860,16 @@ discard block |
||
| 1766 | 1860 | function makeXmlFile($menu_srl) |
| 1767 | 1861 | { |
| 1768 | 1862 | // Return if there is no information when creating the xml file |
| 1769 | - if(!$menu_srl) return; |
|
| 1863 | + if(!$menu_srl) { |
|
| 1864 | + return; |
|
| 1865 | + } |
|
| 1770 | 1866 | // Get menu informaton |
| 1771 | 1867 | $args = new stdClass(); |
| 1772 | 1868 | $args->menu_srl = $menu_srl; |
| 1773 | 1869 | $output = executeQuery('menu.getMenu', $args); |
| 1774 | - if(!$output->toBool() || !$output->data) return $output; |
|
| 1870 | + if(!$output->toBool() || !$output->data) { |
|
| 1871 | + return $output; |
|
| 1872 | + } |
|
| 1775 | 1873 | $site_srl = (int)$output->data->site_srl; |
| 1776 | 1874 | |
| 1777 | 1875 | if($site_srl) |
@@ -1785,7 +1883,9 @@ discard block |
||
| 1785 | 1883 | $args->menu_srl = $menu_srl; |
| 1786 | 1884 | $args->sort_index = 'listorder'; |
| 1787 | 1885 | $output = executeQuery('menu.getMenuItems', $args); |
| 1788 | - if(!$output->toBool()) return; |
|
| 1886 | + if(!$output->toBool()) { |
|
| 1887 | + return; |
|
| 1888 | + } |
|
| 1789 | 1889 | // Specify the name of the cache file |
| 1790 | 1890 | $xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl); |
| 1791 | 1891 | $php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl); |
@@ -1799,7 +1899,9 @@ discard block |
||
| 1799 | 1899 | return $xml_file; |
| 1800 | 1900 | } |
| 1801 | 1901 | // Change to an array if only a single data is obtained |
| 1802 | - if(!is_array($list)) $list = array($list); |
|
| 1902 | + if(!is_array($list)) { |
|
| 1903 | + $list = array($list); |
|
| 1904 | + } |
|
| 1803 | 1905 | // Create a tree for loop |
| 1804 | 1906 | $list_count = count($list); |
| 1805 | 1907 | for($i=0;$i<$list_count;$i++) |
@@ -1887,7 +1989,9 @@ discard block |
||
| 1887 | 1989 | */ |
| 1888 | 1990 | function getXmlTree($source_node, $tree, $site_srl, $domain) |
| 1889 | 1991 | { |
| 1890 | - if(!$source_node) return; |
|
| 1992 | + if(!$source_node) { |
|
| 1993 | + return; |
|
| 1994 | + } |
|
| 1891 | 1995 | |
| 1892 | 1996 | $oMenuAdminModel = getAdminModel('menu'); |
| 1893 | 1997 | |
@@ -1895,7 +1999,9 @@ discard block |
||
| 1895 | 1999 | { |
| 1896 | 2000 | $child_buff = ""; |
| 1897 | 2001 | // Get data of the child nodes |
| 1898 | - if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 2002 | + if($menu_item_srl&&$tree[$menu_item_srl]) { |
|
| 2003 | + $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 2004 | + } |
|
| 1899 | 2005 | // List variables |
| 1900 | 2006 | $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); |
| 1901 | 2007 | foreach($names as $key => $val) |
@@ -1909,37 +2015,57 @@ discard block |
||
| 1909 | 2015 | if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url)) |
| 1910 | 2016 | { |
| 1911 | 2017 | $href = "getSiteUrl('$domain', '','mid','$node->url')"; |
| 2018 | + } else { |
|
| 2019 | + $href = var_export($url, true); |
|
| 1912 | 2020 | } |
| 1913 | - else $href = var_export($url, true); |
|
| 1914 | 2021 | $is_shortcut = $node->is_shortcut; |
| 1915 | 2022 | $open_window = $node->open_window; |
| 1916 | 2023 | $expand = $node->expand; |
| 1917 | 2024 | |
| 1918 | 2025 | $normal_btn = $node->normal_btn; |
| 1919 | - if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
| 1920 | - else $normal_btn = ''; |
|
| 2026 | + if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) { |
|
| 2027 | + $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
| 2028 | + } else { |
|
| 2029 | + $normal_btn = ''; |
|
| 2030 | + } |
|
| 1921 | 2031 | $hover_btn = $node->hover_btn; |
| 1922 | - if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
| 1923 | - else $hover_btn = ''; |
|
| 2032 | + if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) { |
|
| 2033 | + $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
| 2034 | + } else { |
|
| 2035 | + $hover_btn = ''; |
|
| 2036 | + } |
|
| 1924 | 2037 | $active_btn = $node->active_btn; |
| 1925 | - if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
| 1926 | - else $active_btn = ''; |
|
| 2038 | + if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) { |
|
| 2039 | + $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
| 2040 | + } else { |
|
| 2041 | + $active_btn = ''; |
|
| 2042 | + } |
|
| 1927 | 2043 | |
| 1928 | 2044 | $group_srls = $node->group_srls; |
| 1929 | 2045 | |
| 1930 | 2046 | if($normal_btn) |
| 1931 | 2047 | { |
| 1932 | - if($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = ''; |
|
| 1933 | - if($active_btn) $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); else $active_str = ''; |
|
| 2048 | + if($hover_btn) { |
|
| 2049 | + $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); |
|
| 2050 | + } else { |
|
| 2051 | + $hover_str = ''; |
|
| 2052 | + } |
|
| 2053 | + if($active_btn) { |
|
| 2054 | + $active_str = sprintf('onmousedown="this.src=\'%s\'"', $active_btn); |
|
| 2055 | + } else { |
|
| 2056 | + $active_str = ''; |
|
| 2057 | + } |
|
| 1934 | 2058 | $link = sprintf('<img src="%s" onmouseout="this.src=\'%s\'" alt="<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>" %s %s />', $normal_btn, $normal_btn, $hover_str, $active_str); |
| 1935 | - } |
|
| 1936 | - else |
|
| 2059 | + } else |
|
| 1937 | 2060 | { |
| 1938 | 2061 | $link = '<?php print $_names[$lang_type]; ?>'; |
| 1939 | 2062 | } |
| 1940 | 2063 | // If the value of node->group_srls exists |
| 1941 | - if($group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0); |
|
| 1942 | - else $group_check_code = "true"; |
|
| 2064 | + if($group_srls) { |
|
| 2065 | + $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0); |
|
| 2066 | + } else { |
|
| 2067 | + $group_check_code = "true"; |
|
| 2068 | + } |
|
| 1943 | 2069 | $attribute = sprintf( |
| 1944 | 2070 | 'node_srl="%d" parent_srl="%d" menu_name_key=%s text="<?php if(%s) { %s }?>" url="<?php print(%s?%s:"")?>" href="<?php print(%s?%s:"")?>" is_shortcut=%s desc=%s open_window=%s expand=%s normal_btn=%s hover_btn=%s active_btn=%s link="<?php if(%s) {?>%s<?php }?>"', |
| 1945 | 2071 | $menu_item_srl, |
@@ -1962,8 +2088,11 @@ discard block |
||
| 1962 | 2088 | $link |
| 1963 | 2089 | ); |
| 1964 | 2090 | |
| 1965 | - if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 1966 | - else $buff .= sprintf('<node %s />', $attribute); |
|
| 2091 | + if($child_buff) { |
|
| 2092 | + $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 2093 | + } else { |
|
| 2094 | + $buff .= sprintf('<node %s />', $attribute); |
|
| 2095 | + } |
|
| 1967 | 2096 | } |
| 1968 | 2097 | return $buff; |
| 1969 | 2098 | } |
@@ -1982,15 +2111,20 @@ discard block |
||
| 1982 | 2111 | function getPhpCacheCode($source_node, $tree, $site_srl, $domain) |
| 1983 | 2112 | { |
| 1984 | 2113 | $output = array("buff"=>"", "url_list"=>array()); |
| 1985 | - if(!$source_node) return $output; |
|
| 2114 | + if(!$source_node) { |
|
| 2115 | + return $output; |
|
| 2116 | + } |
|
| 1986 | 2117 | |
| 1987 | 2118 | $oMenuAdminModel = getAdminModel('menu'); |
| 1988 | 2119 | |
| 1989 | 2120 | foreach($source_node as $menu_item_srl => $node) |
| 1990 | 2121 | { |
| 1991 | 2122 | // Get data from child nodes if exist. |
| 1992 | - if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 1993 | - else $child_output = array("buff"=>"", "url_list"=>array()); |
|
| 2123 | + if($menu_item_srl&&$tree[$menu_item_srl]) { |
|
| 2124 | + $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain); |
|
| 2125 | + } else { |
|
| 2126 | + $child_output = array("buff"=>"", "url_list"=>array()); |
|
| 2127 | + } |
|
| 1994 | 2128 | |
| 1995 | 2129 | // List variables |
| 1996 | 2130 | $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); |
@@ -2000,8 +2134,7 @@ discard block |
||
| 2000 | 2134 | if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1) |
| 2001 | 2135 | { |
| 2002 | 2136 | $name_arr_str .= sprintf('"%s"=>"%s",', $key, $val); |
| 2003 | - } |
|
| 2004 | - else |
|
| 2137 | + } else |
|
| 2005 | 2138 | { |
| 2006 | 2139 | $name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val))); |
| 2007 | 2140 | } |
@@ -2009,11 +2142,16 @@ discard block |
||
| 2009 | 2142 | $name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']); |
| 2010 | 2143 | |
| 2011 | 2144 | // If url value is not empty in the current node, put the value into an array url_list |
| 2012 | - if($node->url) $child_output['url_list'][] = $node->url; |
|
| 2145 | + if($node->url) { |
|
| 2146 | + $child_output['url_list'][] = $node->url; |
|
| 2147 | + } |
|
| 2013 | 2148 | $output['url_list'] = array_merge($output['url_list'], $child_output['url_list']); |
| 2014 | 2149 | // If node->group_srls value exists |
| 2015 | - if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0); |
|
| 2016 | - else $group_check_code = "true"; |
|
| 2150 | + if($node->group_srls) { |
|
| 2151 | + $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0); |
|
| 2152 | + } else { |
|
| 2153 | + $group_check_code = "true"; |
|
| 2154 | + } |
|
| 2017 | 2155 | |
| 2018 | 2156 | // List variables |
| 2019 | 2157 | $href = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href); |
@@ -2022,8 +2160,9 @@ discard block |
||
| 2022 | 2160 | if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) |
| 2023 | 2161 | { |
| 2024 | 2162 | $href = "getSiteUrl('$domain', '','mid','$node->url')"; |
| 2163 | + } else { |
|
| 2164 | + $href = var_export($url, true); |
|
| 2025 | 2165 | } |
| 2026 | - else $href = var_export($url, true); |
|
| 2027 | 2166 | $is_shortcut = $node->is_shortcut; |
| 2028 | 2167 | $open_window = $node->open_window; |
| 2029 | 2168 | $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn); |
@@ -2040,29 +2179,48 @@ discard block |
||
| 2040 | 2179 | $expand = $node->expand; |
| 2041 | 2180 | |
| 2042 | 2181 | $normal_btn = $node->normal_btn; |
| 2043 | - if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
| 2044 | - else $normal_btn = ''; |
|
| 2182 | + if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) { |
|
| 2183 | + $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$normal_btn); |
|
| 2184 | + } else { |
|
| 2185 | + $normal_btn = ''; |
|
| 2186 | + } |
|
| 2045 | 2187 | |
| 2046 | 2188 | $hover_btn = $node->hover_btn; |
| 2047 | - if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
| 2048 | - else $hover_btn = ''; |
|
| 2189 | + if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) { |
|
| 2190 | + $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$hover_btn); |
|
| 2191 | + } else { |
|
| 2192 | + $hover_btn = ''; |
|
| 2193 | + } |
|
| 2049 | 2194 | |
| 2050 | 2195 | $active_btn = $node->active_btn; |
| 2051 | - if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
| 2052 | - else $active_btn = ''; |
|
| 2196 | + if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) { |
|
| 2197 | + $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$active_btn); |
|
| 2198 | + } else { |
|
| 2199 | + $active_btn = ''; |
|
| 2200 | + } |
|
| 2053 | 2201 | |
| 2054 | 2202 | |
| 2055 | 2203 | $group_srls = $node->group_srls; |
| 2056 | 2204 | |
| 2057 | 2205 | if($normal_btn) |
| 2058 | 2206 | { |
| 2059 | - if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = ''; |
|
| 2060 | - if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = ''; |
|
| 2207 | + if($hover_btn) { |
|
| 2208 | + $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); |
|
| 2209 | + } else { |
|
| 2210 | + $hover_str = ''; |
|
| 2211 | + } |
|
| 2212 | + if($active_btn) { |
|
| 2213 | + $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); |
|
| 2214 | + } else { |
|
| 2215 | + $active_str = ''; |
|
| 2216 | + } |
|
| 2061 | 2217 | $link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str); |
| 2062 | - if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str); |
|
| 2063 | - else $link_active = $link; |
|
| 2064 | - } |
|
| 2065 | - else |
|
| 2218 | + if($active_btn) { |
|
| 2219 | + $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str); |
|
| 2220 | + } else { |
|
| 2221 | + $link_active = $link; |
|
| 2222 | + } |
|
| 2223 | + } else |
|
| 2066 | 2224 | { |
| 2067 | 2225 | $link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl); |
| 2068 | 2226 | } |
@@ -2111,11 +2269,15 @@ discard block |
||
| 2111 | 2269 | */ |
| 2112 | 2270 | function updateMenuLayout($layout_srl, $menu_srl_list) |
| 2113 | 2271 | { |
| 2114 | - if(!count($menu_srl_list)) return; |
|
| 2272 | + if(!count($menu_srl_list)) { |
|
| 2273 | + return; |
|
| 2274 | + } |
|
| 2115 | 2275 | // Delete the value of menu_srls |
| 2116 | 2276 | $args->menu_srls = implode(',',$menu_srl_list); |
| 2117 | 2277 | $output = executeQuery('menu.deleteMenuLayout', $args); |
| 2118 | - if(!$output->toBool()) return $output; |
|
| 2278 | + if(!$output->toBool()) { |
|
| 2279 | + return $output; |
|
| 2280 | + } |
|
| 2119 | 2281 | |
| 2120 | 2282 | $args->layout_srl = $layout_srl; |
| 2121 | 2283 | // Mapping menu_srls, layout_srl |
@@ -2123,7 +2285,9 @@ discard block |
||
| 2123 | 2285 | { |
| 2124 | 2286 | $args->menu_srl = $menu_srl_list[$i]; |
| 2125 | 2287 | $output = executeQuery('menu.insertMenuLayout', $args); |
| 2126 | - if(!$output->toBool()) return $output; |
|
| 2288 | + if(!$output->toBool()) { |
|
| 2289 | + return $output; |
|
| 2290 | + } |
|
| 2127 | 2291 | } |
| 2128 | 2292 | } |
| 2129 | 2293 | |
@@ -2146,9 +2310,15 @@ discard block |
||
| 2146 | 2310 | $oMenuModel = getAdminModel('menu'); |
| 2147 | 2311 | $itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl); |
| 2148 | 2312 | |
| 2149 | - if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn); |
|
| 2150 | - if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn); |
|
| 2151 | - if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn); |
|
| 2313 | + if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) { |
|
| 2314 | + FileHandler::removeFile($itemInfo->normal_btn); |
|
| 2315 | + } |
|
| 2316 | + if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) { |
|
| 2317 | + FileHandler::removeFile($itemInfo->hover_btn); |
|
| 2318 | + } |
|
| 2319 | + if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) { |
|
| 2320 | + FileHandler::removeFile($itemInfo->active_btn); |
|
| 2321 | + } |
|
| 2152 | 2322 | } |
| 2153 | 2323 | |
| 2154 | 2324 | $returnArray = array(); |
@@ -579,7 +579,7 @@ |
||
| 579 | 579 | |
| 580 | 580 | /** |
| 581 | 581 | * Get module's detail setup contents |
| 582 | - * @return void |
|
| 582 | + * @return BaseObject|null |
|
| 583 | 583 | */ |
| 584 | 584 | public function getMenuAdminDetailSetup() |
| 585 | 585 | { |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function getMenuList($obj) |
| 29 | 29 | { |
| 30 | - if(!$obj->site_srl) |
|
| 30 | + if (!$obj->site_srl) |
|
| 31 | 31 | { |
| 32 | 32 | $site_module_info = Context::get('site_module_info'); |
| 33 | - $obj->site_srl = (int)$site_module_info->site_srl; |
|
| 33 | + $obj->site_srl = (int) $site_module_info->site_srl; |
|
| 34 | 34 | } |
| 35 | 35 | $args = new stdClass; |
| 36 | 36 | $args->site_srl = $obj->site_srl; |
| 37 | 37 | $args->sort_index = $obj->sort_index; |
| 38 | - $args->page = $obj->page?$obj->page:1; |
|
| 39 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
| 40 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
| 38 | + $args->page = $obj->page ? $obj->page : 1; |
|
| 39 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
| 40 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
| 41 | 41 | // document.getDocumentList query execution |
| 42 | 42 | $output = executeQuery('menu.getMenuList', $args); |
| 43 | 43 | // Return if no result or an error occurs |
| 44 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 44 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 45 | 45 | |
| 46 | 46 | return $output; |
| 47 | 47 | } |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function getMenus($site_srl = null) |
| 55 | 55 | { |
| 56 | - if(!isset($site_srl)) |
|
| 56 | + if (!isset($site_srl)) |
|
| 57 | 57 | { |
| 58 | 58 | $site_module_info = Context::get('site_module_info'); |
| 59 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 59 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 60 | 60 | } |
| 61 | 61 | // Get information from the DB |
| 62 | 62 | $args = new stdClass(); |
| 63 | - $args->site_srl = $site_srl ; |
|
| 63 | + $args->site_srl = $site_srl; |
|
| 64 | 64 | $args->menu_srl = $menu_srl; |
| 65 | 65 | $output = executeQueryArray('menu.getMenus', $args); |
| 66 | - if(!$output->data) return; |
|
| 66 | + if (!$output->data) return; |
|
| 67 | 67 | $menus = $output->data; |
| 68 | 68 | return $menus; |
| 69 | 69 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | $args = new stdClass(); |
| 81 | 81 | $args->menu_srl = $menu_srl; |
| 82 | 82 | $output = executeQuery('menu.getMenu', $args); |
| 83 | - if(!$output->data) return; |
|
| 83 | + if (!$output->data) return; |
|
| 84 | 84 | |
| 85 | 85 | $menu_info = $output->data; |
| 86 | - $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php',$menu_srl); |
|
| 87 | - $menu_info->php_file = sprintf('./files/cache/menu/%s.php',$menu_srl); |
|
| 86 | + $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php', $menu_srl); |
|
| 87 | + $menu_info->php_file = sprintf('./files/cache/menu/%s.php', $menu_srl); |
|
| 88 | 88 | return $menu_info; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | function getMenuByTitle($title, $site_srl = 0) |
| 98 | 98 | { |
| 99 | 99 | // Get information from the DB |
| 100 | - if(!is_array($title)) |
|
| 100 | + if (!is_array($title)) |
|
| 101 | 101 | { |
| 102 | 102 | $title = array($title); |
| 103 | 103 | } |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | $args->title = $title; |
| 106 | 106 | $args->site_srl = $site_srl; |
| 107 | 107 | $output = executeQuery('menu.getMenuByTitle', $args); |
| 108 | - if(!$output->data) return; |
|
| 108 | + if (!$output->data) return; |
|
| 109 | 109 | |
| 110 | - if(is_array($output->data)) $menu_info = $output->data[0]; |
|
| 110 | + if (is_array($output->data)) $menu_info = $output->data[0]; |
|
| 111 | 111 | else $menu_info = $output->data; |
| 112 | 112 | |
| 113 | - if($menu_info->menu_srl) |
|
| 113 | + if ($menu_info->menu_srl) |
|
| 114 | 114 | { |
| 115 | - $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php',$menu_info->menu_srl); |
|
| 116 | - $menu_info->php_file = sprintf('./files/cache/menu/%s.php',$menu_info->menu_srl); |
|
| 115 | + $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php', $menu_info->menu_srl); |
|
| 116 | + $menu_info->php_file = sprintf('./files/cache/menu/%s.php', $menu_info->menu_srl); |
|
| 117 | 117 | } |
| 118 | 118 | return $menu_info; |
| 119 | 119 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $args = new stdClass(); |
| 131 | 131 | $args->title = $title; |
| 132 | 132 | $output = executeQueryArray('menu.getMenuByTitle', $args); |
| 133 | - if(!$output->data) |
|
| 133 | + if (!$output->data) |
|
| 134 | 134 | { |
| 135 | 135 | return array(); |
| 136 | 136 | } |
@@ -151,16 +151,16 @@ discard block |
||
| 151 | 151 | $args->menu_item_srl = $menu_item_srl; |
| 152 | 152 | $output = executeQuery('menu.getMenuItem', $args); |
| 153 | 153 | $node = $output->data; |
| 154 | - settype($node,'object'); |
|
| 155 | - if($node->group_srls) $node->group_srls = explode(',',$node->group_srls); |
|
| 154 | + settype($node, 'object'); |
|
| 155 | + if ($node->group_srls) $node->group_srls = explode(',', $node->group_srls); |
|
| 156 | 156 | else $node->group_srls = array(); |
| 157 | 157 | |
| 158 | 158 | $tmp_name = unserialize($node->name); |
| 159 | - if($tmp_name && count($tmp_name)) |
|
| 159 | + if ($tmp_name && count($tmp_name)) |
|
| 160 | 160 | { |
| 161 | 161 | $selected_lang = array(); |
| 162 | 162 | $rand_name = $tmp_name[Context::getLangType()]; |
| 163 | - if(!$rand_name) $rand_name = array_shift($tmp_name); |
|
| 163 | + if (!$rand_name) $rand_name = array_shift($tmp_name); |
|
| 164 | 164 | $node->name = $rand_name; |
| 165 | 165 | } |
| 166 | 166 | return $node; |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | $menuItemSrl = Context::get('menu_item_srl'); |
| 176 | 176 | $menuItem = $this->getMenuItemInfo($menuItemSrl); |
| 177 | 177 | |
| 178 | - if(!$menuItem->url) |
|
| 178 | + if (!$menuItem->url) |
|
| 179 | 179 | { |
| 180 | 180 | $menuItem->moduleType = null; |
| 181 | 181 | } |
| 182 | - else if(strncasecmp('http', $menuItem->url, 4) !== 0) |
|
| 182 | + else if (strncasecmp('http', $menuItem->url, 4) !== 0) |
|
| 183 | 183 | { |
| 184 | 184 | $oModuleModel = getModel('module'); |
| 185 | 185 | $moduleInfo = $oModuleModel->getModuleInfoByMid($menuItem->url, 0); |
| 186 | - if(!$moduleInfo) $menuItem->moduleType = 'url'; |
|
| 186 | + if (!$moduleInfo) $menuItem->moduleType = 'url'; |
|
| 187 | 187 | else |
| 188 | 188 | { |
| 189 | - if($moduleInfo->mid == $menuItem->url) |
|
| 189 | + if ($moduleInfo->mid == $menuItem->url) |
|
| 190 | 190 | { |
| 191 | 191 | $menuItem->moduleType = $moduleInfo->module; |
| 192 | 192 | $menuItem->pageType = $moduleInfo->page_type; |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | else $menuItem->moduleType = 'url'; |
| 198 | 198 | |
| 199 | 199 | // grant setting |
| 200 | - if(is_array($menuItem->group_srls) && count($menuItem->group_srls) > 0) |
|
| 200 | + if (is_array($menuItem->group_srls) && count($menuItem->group_srls) > 0) |
|
| 201 | 201 | { |
| 202 | - if($menuItem->group_srls[0] == -1) |
|
| 202 | + if ($menuItem->group_srls[0] == -1) |
|
| 203 | 203 | { |
| 204 | 204 | $menuItem->grant = 'member'; |
| 205 | 205 | } |
| 206 | - else if($menuItem->group_srls[0] == -3) |
|
| 206 | + else if ($menuItem->group_srls[0] == -3) |
|
| 207 | 207 | { |
| 208 | 208 | $menuItem->grant = 'manager'; |
| 209 | 209 | } |
@@ -217,21 +217,21 @@ discard block |
||
| 217 | 217 | $oMemberModel = getModel('member'); |
| 218 | 218 | $oModuleAdminModel = getAdminModel('module'); |
| 219 | 219 | $output = $oMemberModel->getGroups(); |
| 220 | - if(is_array($output)) |
|
| 220 | + if (is_array($output)) |
|
| 221 | 221 | { |
| 222 | 222 | $groupList = array(); |
| 223 | - foreach($output AS $key=>$value) |
|
| 223 | + foreach ($output AS $key=>$value) |
|
| 224 | 224 | { |
| 225 | 225 | $groupList[$value->group_srl] = new stdClass(); |
| 226 | 226 | $groupList[$value->group_srl]->group_srl = $value->group_srl; |
| 227 | - if(substr($value->title,0,12)=='$user_lang->') |
|
| 227 | + if (substr($value->title, 0, 12) == '$user_lang->') |
|
| 228 | 228 | { |
| 229 | 229 | $tmp = $oModuleAdminModel->getLangCode(0, $value->title); |
| 230 | 230 | $groupList[$value->group_srl]->title = $tmp[Context::getLangType()]; |
| 231 | 231 | } |
| 232 | 232 | else $groupList[$value->group_srl]->title = $value->title; |
| 233 | 233 | |
| 234 | - if(in_array($key, $menuItem->group_srls)) $groupList[$value->group_srl]->isChecked = true; |
|
| 234 | + if (in_array($key, $menuItem->group_srls)) $groupList[$value->group_srl]->isChecked = true; |
|
| 235 | 235 | else $groupList[$value->group_srl]->isChecked = false; |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -269,10 +269,10 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | function getMenuItemNames($source_name, $site_srl = null) |
| 271 | 271 | { |
| 272 | - if(!$site_srl) |
|
| 272 | + if (!$site_srl) |
|
| 273 | 273 | { |
| 274 | 274 | $site_module_info = Context::get('site_module_info'); |
| 275 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 275 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 276 | 276 | } |
| 277 | 277 | // Get language code |
| 278 | 278 | $oModuleAdminModel = getAdminModel('module'); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | // Add a sub-menu if there is parent_srl but not menu_item_srl |
| 298 | 298 | $item_info = new stdClass; |
| 299 | - if(!$menu_item_srl && $parent_srl) |
|
| 299 | + if (!$menu_item_srl && $parent_srl) |
|
| 300 | 300 | { |
| 301 | 301 | // Get information of the parent menu |
| 302 | 302 | $parent_info = $this->getMenuItemInfo($parent_srl); |
@@ -309,9 +309,9 @@ discard block |
||
| 309 | 309 | else |
| 310 | 310 | { |
| 311 | 311 | // Get information of the menu if menu_item_srl exists |
| 312 | - if($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl); |
|
| 312 | + if ($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl); |
|
| 313 | 313 | // Get only menu_item_srl if no values found, considering it as adding a new menu |
| 314 | - if(!$item_info->menu_item_srl) |
|
| 314 | + if (!$item_info->menu_item_srl) |
|
| 315 | 315 | { |
| 316 | 316 | $item_info->menu_item_srl = getNextSequence(); |
| 317 | 317 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $oTemplate = &TemplateHandler::getInstance(); |
| 328 | 328 | $tpl = $oTemplate->compile($this->module_path.'tpl', 'menu_item_info'); |
| 329 | 329 | |
| 330 | - $this->add('tpl', str_replace("\n"," ",$tpl)); |
|
| 330 | + $this->add('tpl', str_replace("\n", " ", $tpl)); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -346,10 +346,10 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | Context::loadLang('modules/page/lang'); |
| 348 | 348 | |
| 349 | - foreach($_allModules as $module_name) |
|
| 349 | + foreach ($_allModules as $module_name) |
|
| 350 | 350 | { |
| 351 | 351 | $module = $oModuleModel->getModuleInfoXml($module_name); |
| 352 | - if(!isset($module)) continue; |
|
| 352 | + if (!isset($module)) continue; |
|
| 353 | 353 | $defaultSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'P'); |
| 354 | 354 | $defaultMobileSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'M'); |
| 355 | 355 | $skinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultSkin); |
@@ -361,10 +361,10 @@ discard block |
||
| 361 | 361 | $module->defaultMobileSkin->skin = $defaultMobileSkin; |
| 362 | 362 | $module->defaultMobileSkin->title = $mobileSkinInfo->title ? $mobileSkinInfo->title : $defaultMobileSkin; |
| 363 | 363 | |
| 364 | - $module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/' . $module_name); |
|
| 365 | - $module->url = _XE_LOCATION_SITE_ . '?mid=download&package_srl=' . $module->package_srl; |
|
| 364 | + $module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/'.$module_name); |
|
| 365 | + $module->url = _XE_LOCATION_SITE_.'?mid=download&package_srl='.$module->package_srl; |
|
| 366 | 366 | |
| 367 | - if($module_name == 'page') |
|
| 367 | + if ($module_name == 'page') |
|
| 368 | 368 | { |
| 369 | 369 | $pageTypeName = Context::getLang('page_type_name'); |
| 370 | 370 | $module->title = $pageTypeName['ARTICLE']; |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | $moduleList = array('page'); |
| 402 | 402 | |
| 403 | 403 | $output = $oModuleModel->getModuleListByInstance($site_srl); |
| 404 | - if(is_array($output->data)) |
|
| 404 | + if (is_array($output->data)) |
|
| 405 | 405 | { |
| 406 | - foreach($output->data as $value) |
|
| 406 | + foreach ($output->data as $value) |
|
| 407 | 407 | { |
| 408 | - if($value->instanceCount > 1) |
|
| 408 | + if ($value->instanceCount > 1) |
|
| 409 | 409 | { |
| 410 | 410 | $moduleList[] = $value->module; |
| 411 | 411 | } |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | // after trigger |
| 416 | 416 | $output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList); |
| 417 | - if(!$output->toBool()) return $output; |
|
| 417 | + if (!$output->toBool()) return $output; |
|
| 418 | 418 | |
| 419 | 419 | $localModuleList = array_unique($moduleList); |
| 420 | 420 | |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | // get have instance |
| 424 | 424 | $remotePackageList = $oAutoinstallModel->getHaveInstance(array('path')); |
| 425 | 425 | $remoteModuleList = array(); |
| 426 | - foreach($remotePackageList as $package) |
|
| 426 | + foreach ($remotePackageList as $package) |
|
| 427 | 427 | { |
| 428 | - if(strpos($package->path, './modules/') !== 0) continue; |
|
| 428 | + if (strpos($package->path, './modules/') !== 0) continue; |
|
| 429 | 429 | |
| 430 | 430 | $pathInfo = explode('/', $package->path); |
| 431 | 431 | $remoteModuleList[] = $pathInfo[2]; |
@@ -443,13 +443,13 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $moduleInfoList = array(); |
| 445 | 445 | Context::loadLang('modules/page/lang'); |
| 446 | - if(is_array($moduleList)) |
|
| 446 | + if (is_array($moduleList)) |
|
| 447 | 447 | { |
| 448 | - foreach($moduleList as $value) |
|
| 448 | + foreach ($moduleList as $value) |
|
| 449 | 449 | { |
| 450 | 450 | $moduleInfo = $oModuleModel->getModuleInfoXml($value); |
| 451 | 451 | |
| 452 | - if($value == 'page') |
|
| 452 | + if ($value == 'page') |
|
| 453 | 453 | { |
| 454 | 454 | $pageTypeName = Context::getLang('page_type_name'); |
| 455 | 455 | $moduleInfo->title = $pageTypeName['ARTICLE']; |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | $siteSrl = Context::get('site_srl'); |
| 481 | 481 | $menuSrl = Context::get('menu_srl'); |
| 482 | 482 | |
| 483 | - if(!isset($siteSrl)) |
|
| 483 | + if (!isset($siteSrl)) |
|
| 484 | 484 | { |
| 485 | 485 | $site_module_info = Context::get('site_module_info'); |
| 486 | - $siteSrl = (int)$site_module_info->site_srl; |
|
| 486 | + $siteSrl = (int) $site_module_info->site_srl; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $oModuleModel = getModel('module'); |
@@ -492,24 +492,24 @@ discard block |
||
| 492 | 492 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
| 493 | 493 | |
| 494 | 494 | $menuList = array(); |
| 495 | - if($menuSrl) |
|
| 495 | + if ($menuSrl) |
|
| 496 | 496 | { |
| 497 | 497 | $isMenuFixed = false; |
| 498 | 498 | $output = $this->getMenu($menuSrl); |
| 499 | - $php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$output->menu_srl); |
|
| 500 | - if(file_exists($php_file)) include($php_file); |
|
| 499 | + $php_file = sprintf(_XE_PATH_.'files/cache/menu/%s.php', $output->menu_srl); |
|
| 500 | + if (file_exists($php_file)) include($php_file); |
|
| 501 | 501 | else $oMenuAdminController->makeXmlFile($menuSrl); |
| 502 | 502 | |
| 503 | - if(count($menu->list)>0) |
|
| 503 | + if (count($menu->list) > 0) |
|
| 504 | 504 | { |
| 505 | - foreach($menu->list AS $key=>$value) |
|
| 505 | + foreach ($menu->list AS $key=>$value) |
|
| 506 | 506 | { |
| 507 | - $this->_menuInfoSetting($menu->list[$key], $start_module, $isMenuFixed, $menuSrl,$siteSrl); |
|
| 507 | + $this->_menuInfoSetting($menu->list[$key], $start_module, $isMenuFixed, $menuSrl, $siteSrl); |
|
| 508 | 508 | } |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | // menu recreate |
| 512 | - if($isMenuFixed) |
|
| 512 | + if ($isMenuFixed) |
|
| 513 | 513 | { |
| 514 | 514 | $oMenuAdminController->makeXmlFile($menuSrl); |
| 515 | 515 | } |
@@ -522,18 +522,18 @@ discard block |
||
| 522 | 522 | else |
| 523 | 523 | { |
| 524 | 524 | $menuListFromDB = $this->getMenus($siteSrl); |
| 525 | - if(is_array($menuListFromDB)) |
|
| 525 | + if (is_array($menuListFromDB)) |
|
| 526 | 526 | { |
| 527 | 527 | $oAdmin = getClass('admin'); |
| 528 | - foreach($menuListFromDB AS $key=>$value) |
|
| 528 | + foreach ($menuListFromDB AS $key=>$value) |
|
| 529 | 529 | { |
| 530 | - if($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]); |
|
| 530 | + if ($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]); |
|
| 531 | 531 | else |
| 532 | 532 | { |
| 533 | 533 | unset($menu); |
| 534 | 534 | unset($menuItems); |
| 535 | - $value->php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$value->menu_srl); |
|
| 536 | - if(!file_exists($value->php_file)) |
|
| 535 | + $value->php_file = sprintf(_XE_PATH_.'files/cache/menu/%s.php', $value->menu_srl); |
|
| 536 | + if (!file_exists($value->php_file)) |
|
| 537 | 537 | { |
| 538 | 538 | $oMenuAdminController->makeXmlFile($value->menu_srl); |
| 539 | 539 | } |
@@ -541,16 +541,16 @@ discard block |
||
| 541 | 541 | include($value->php_file); |
| 542 | 542 | |
| 543 | 543 | $isMenuFixed = false; |
| 544 | - if(count($menu->list) > 0) |
|
| 544 | + if (count($menu->list) > 0) |
|
| 545 | 545 | { |
| 546 | - foreach($menu->list AS $key2=>$value2) |
|
| 546 | + foreach ($menu->list AS $key2=>$value2) |
|
| 547 | 547 | { |
| 548 | - $this->_menuInfoSetting($menu->list[$key2], $start_module, $isMenuFixed, $value->menu_srl,$siteSrl); |
|
| 548 | + $this->_menuInfoSetting($menu->list[$key2], $start_module, $isMenuFixed, $value->menu_srl, $siteSrl); |
|
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // menu recreate |
| 553 | - if($isMenuFixed) |
|
| 553 | + if ($isMenuFixed) |
|
| 554 | 554 | { |
| 555 | 555 | $oMenuAdminController->makeXmlFile($value->menu_srl); |
| 556 | 556 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | $menuItems->menuItems = $menu; |
| 562 | 562 | |
| 563 | 563 | // If include home menu, move first |
| 564 | - if($value->menu_srl == $this->menuSrlWithinHome) |
|
| 564 | + if ($value->menu_srl == $this->menuSrlWithinHome) |
|
| 565 | 565 | { |
| 566 | 566 | $menuList[-1] = $menuItems; |
| 567 | 567 | } |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | public function getMenuAdminDetailSetup() |
| 585 | 585 | { |
| 586 | 586 | $menuItemSrl = Context::get('menu_item_srl'); |
| 587 | - if(!$menuItemSrl) |
|
| 587 | + if (!$menuItemSrl) |
|
| 588 | 588 | { |
| 589 | 589 | return new BaseObject(-1, 'msg_invalid_request'); |
| 590 | 590 | } |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | $menuItemInfo = $this->getMenuItemInfo($menuItemSrl); |
| 593 | 593 | |
| 594 | 594 | // if menu is shortcut |
| 595 | - if($menuItemInfo->is_shortcut == 'Y') |
|
| 595 | + if ($menuItemInfo->is_shortcut == 'Y') |
|
| 596 | 596 | { |
| 597 | 597 | return new BaseObject(-1, 'msg_invalid_request'); |
| 598 | 598 | } |
@@ -604,18 +604,18 @@ discard block |
||
| 604 | 604 | // get xml info |
| 605 | 605 | $moduleConfInfo = $oModuleModel->getModuleInfoXml($moduleInfo->module); |
| 606 | 606 | |
| 607 | - if($moduleConfInfo->setup_index_act) |
|
| 607 | + if ($moduleConfInfo->setup_index_act) |
|
| 608 | 608 | { |
| 609 | 609 | $setupUrl = getNotEncodedUrl('', 'module', 'admin', 'act', $moduleConfInfo->setup_index_act, 'module_srl', $moduleInfo->module_srl, 'isLayoutDrop', '1'); |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | - if($moduleConfInfo->simple_setup_index_act) |
|
| 612 | + if ($moduleConfInfo->simple_setup_index_act) |
|
| 613 | 613 | { |
| 614 | 614 | $oTargetmoduleAdminModel = getAdminModel($moduleInfo->module); |
| 615 | 615 | $advancedSetupUrl = getUrl('', 'module', 'admin', 'act', $moduleConfInfo->setup_index_act, 'module_srl', $moduleInfo->module_srl); |
| 616 | 616 | $simpleSetupHtml = $oTargetmoduleAdminModel->{$moduleConfInfo->simple_setup_index_act}($moduleInfo->module_srl, $advancedSetupUrl); |
| 617 | 617 | |
| 618 | - if($simpleSetupHtml) |
|
| 618 | + if ($simpleSetupHtml) |
|
| 619 | 619 | { |
| 620 | 620 | $this->add('simpleSetupHtml', $simpleSetupHtml); |
| 621 | 621 | } |
@@ -628,18 +628,18 @@ discard block |
||
| 628 | 628 | * @param array $menu |
| 629 | 629 | * @return void |
| 630 | 630 | */ |
| 631 | - private function _menuInfoSetting(&$menu, &$start_module, &$isMenuFixed, $menuSrl,$siteSrl = 0) |
|
| 631 | + private function _menuInfoSetting(&$menu, &$start_module, &$isMenuFixed, $menuSrl, $siteSrl = 0) |
|
| 632 | 632 | { |
| 633 | 633 | $oModuleModel = getModel('module'); |
| 634 | 634 | // if url is empty and is_shortcut is 'N', change to is_shortcut 'Y' |
| 635 | - if(!$menu['url'] && $menu['is_shortcut'] == 'N') |
|
| 635 | + if (!$menu['url'] && $menu['is_shortcut'] == 'N') |
|
| 636 | 636 | { |
| 637 | 637 | $menu['is_shortcut'] = 'Y'; |
| 638 | 638 | |
| 639 | 639 | $args = new stdClass; |
| 640 | 640 | $args->menu_item_srl = $menu['node_srl']; |
| 641 | 641 | $args->is_shortcut = 'Y'; |
| 642 | - if($menu['menu_name_key']) $args->name = $menu['menu_name_key']; |
|
| 642 | + if ($menu['menu_name_key']) $args->name = $menu['menu_name_key']; |
|
| 643 | 643 | else $args->name = $menu['menu_name']; |
| 644 | 644 | $output = executeQuery('menu.updateMenuItem', $args); |
| 645 | 645 | |
@@ -648,17 +648,17 @@ discard block |
||
| 648 | 648 | |
| 649 | 649 | //if menu type is module menu |
| 650 | 650 | //if(!empty($menu['url']) && !preg_match('/^http/i', $menu['url'])) |
| 651 | - if($menu['is_shortcut'] != 'Y') |
|
| 651 | + if ($menu['is_shortcut'] != 'Y') |
|
| 652 | 652 | { |
| 653 | 653 | unset($midInfo, $moduleInfo); |
| 654 | 654 | $midInfo = $oModuleModel->getModuleInfoByMid($menu['url'], $siteSrl); |
| 655 | 655 | $moduleInfo = $oModuleModel->getModuleInfoXml($midInfo->module); |
| 656 | 656 | |
| 657 | - if($midInfo) |
|
| 657 | + if ($midInfo) |
|
| 658 | 658 | { |
| 659 | 659 | $menu['module_srl'] = $midInfo->module_srl; |
| 660 | 660 | $menu['module'] = $midInfo->module; |
| 661 | - if($midInfo->page_type) |
|
| 661 | + if ($midInfo->page_type) |
|
| 662 | 662 | { |
| 663 | 663 | $menu['module_type'] = $midInfo->page_type; |
| 664 | 664 | } |
@@ -668,16 +668,16 @@ discard block |
||
| 668 | 668 | } |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - if($moduleInfo->setup_index_act) |
|
| 671 | + if ($moduleInfo->setup_index_act) |
|
| 672 | 672 | { |
| 673 | 673 | $menu['setup_index_act'] = $moduleInfo->setup_index_act; |
| 674 | 674 | } |
| 675 | - else if($moduleInfo->default_index_act) |
|
| 675 | + else if ($moduleInfo->default_index_act) |
|
| 676 | 676 | { |
| 677 | 677 | $menu['setup_index_act'] = $moduleInfo->default_index_act; |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | - if($menu['is_shortcut'] == 'N' && $midInfo->mid == $start_module->mid) |
|
| 680 | + if ($menu['is_shortcut'] == 'N' && $midInfo->mid == $start_module->mid) |
|
| 681 | 681 | { |
| 682 | 682 | $menu['is_start_module'] = true; |
| 683 | 683 | $this->menuSrlWithinHome = $menuSrl; |
@@ -686,9 +686,9 @@ discard block |
||
| 686 | 686 | $menu['layout_srl'] = $midInfo->layout_srl; |
| 687 | 687 | $menu['browser_title'] = $midInfo->browser_title; |
| 688 | 688 | } |
| 689 | - if(count($menu['list']) > 0) |
|
| 689 | + if (count($menu['list']) > 0) |
|
| 690 | 690 | { |
| 691 | - foreach($menu['list'] as $key=>$value) |
|
| 691 | + foreach ($menu['list'] as $key=>$value) |
|
| 692 | 692 | { |
| 693 | 693 | $this->_menuInfoSetting($menu['list'][$key], $start_module, $isMenuFixed, $menuSrl, $siteSrl); |
| 694 | 694 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | /** |
| 111 | 111 | * RSS Module configurations |
| 112 | 112 | * |
| 113 | - * @return void |
|
| 113 | + * @return BaseObject|null |
|
| 114 | 114 | */ |
| 115 | 115 | function procRssAdminInsertModuleConfig() |
| 116 | 116 | { |
@@ -27,41 +27,41 @@ discard block |
||
| 27 | 27 | $total_config = $oModuleModel->getModuleConfig('rss'); |
| 28 | 28 | |
| 29 | 29 | $config_vars = Context::getRequestVars(); |
| 30 | - $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
|
| 30 | + $config_vars->feed_document_count = (int) $config_vars->feed_document_count; |
|
| 31 | 31 | |
| 32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
| 33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
| 32 | + if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
| 33 | + if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y'; |
|
| 34 | 34 | |
| 35 | - if($config_vars->image || $config_vars->del_image) |
|
| 35 | + if ($config_vars->image || $config_vars->del_image) |
|
| 36 | 36 | { |
| 37 | 37 | $image_obj = $config_vars->image; |
| 38 | 38 | $config_vars->image = $total_config->image; |
| 39 | 39 | // Get a variable for the delete request |
| 40 | - if($config_vars->del_image == 'Y' || $image_obj) |
|
| 40 | + if ($config_vars->del_image == 'Y' || $image_obj) |
|
| 41 | 41 | { |
| 42 | 42 | FileHandler::removeFile($config_vars->image); |
| 43 | 43 | $config_vars->image = ''; |
| 44 | 44 | $total_config->image = ''; |
| 45 | 45 | } |
| 46 | 46 | // Ignore if the file is not the one which has been successfully uploaded |
| 47 | - if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
| 47 | + if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
| 48 | 48 | { |
| 49 | 49 | // Ignore if the file is not an image |
| 50 | 50 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
| 51 | 51 | |
| 52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
| 52 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
| 53 | 53 | else |
| 54 | 54 | { |
| 55 | 55 | // Upload the file to a path |
| 56 | 56 | $path = './files/attach/images/rss/'; |
| 57 | 57 | // Create a directory |
| 58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
| 58 | + if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
| 59 | 59 | else |
| 60 | 60 | { |
| 61 | 61 | $filename = $path.$image_obj['name']; |
| 62 | 62 | |
| 63 | 63 | // Move the file |
| 64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
| 64 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
| 65 | 65 | else |
| 66 | 66 | { |
| 67 | 67 | $config_vars->image = $filename; |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
| 73 | + if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
| 74 | 74 | |
| 75 | 75 | $output = $this->setFeedConfig($config_vars); |
| 76 | 76 | |
| 77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
| 77 | + if (!$alt_message) $alt_message = 'success_updated'; |
|
| 78 | 78 | |
| 79 | 79 | $alt_message = Context::getLang($alt_message); |
| 80 | 80 | $this->setMessage($alt_message, 'info'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $originConfig = $oModuleModel->getModuleConfig('rss'); |
| 97 | 97 | |
| 98 | 98 | // Get a variable for the delete request |
| 99 | - if($delImage == 'Y') |
|
| 99 | + if ($delImage == 'Y') |
|
| 100 | 100 | { |
| 101 | 101 | FileHandler::removeFile($originConfig->image); |
| 102 | 102 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $feedCopyrightList = $config_vars->feed_copyright; |
| 123 | 123 | $targetModuleSrl = $config_vars->target_module_srl; |
| 124 | 124 | |
| 125 | - if($targetModuleSrl && !is_array($openRssList)) |
|
| 125 | + if ($targetModuleSrl && !is_array($openRssList)) |
|
| 126 | 126 | { |
| 127 | 127 | $openRssList = array($targetModuleSrl => $openRssList); |
| 128 | 128 | $openTotalFeedList = array($targetModuleSrl => $openTotalFeedList); |
@@ -130,16 +130,16 @@ discard block |
||
| 130 | 130 | $feedCopyrightList = array($targetModuleSrl => $feedCopyrightList); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if(is_array($openRssList)) |
|
| 133 | + if (is_array($openRssList)) |
|
| 134 | 134 | { |
| 135 | - foreach($openRssList AS $module_srl=>$open_rss) |
|
| 135 | + foreach ($openRssList AS $module_srl=>$open_rss) |
|
| 136 | 136 | { |
| 137 | - if(!$module_srl || !$open_rss) |
|
| 137 | + if (!$module_srl || !$open_rss) |
|
| 138 | 138 | { |
| 139 | 139 | return new BaseObject(-1, 'msg_invalid_request'); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
| 142 | + if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N'; |
|
| 143 | 143 | |
| 144 | 144 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
| 145 | 145 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | function setFeedConfig($config) |
| 162 | 162 | { |
| 163 | 163 | $oModuleController = getController('module'); |
| 164 | - $oModuleController->insertModuleConfig('rss',$config); |
|
| 164 | + $oModuleController->insertModuleConfig('rss', $config); |
|
| 165 | 165 | return new BaseObject(); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | $config = new stdClass; |
| 182 | 182 | $config->open_rss = $open_rss; |
| 183 | 183 | $config->open_total_feed = $open_total_feed; |
| 184 | - if($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
| 185 | - if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
| 186 | - $oModuleController->insertModulePartConfig('rss',$module_srl,$config); |
|
| 184 | + if ($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
| 185 | + if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
| 186 | + $oModuleController->insertModulePartConfig('rss', $module_srl, $config); |
|
| 187 | 187 | return new BaseObject(); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -29,8 +29,12 @@ discard block |
||
| 29 | 29 | $config_vars = Context::getRequestVars(); |
| 30 | 30 | $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
| 31 | 31 | |
| 32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
| 33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
| 32 | + if(!$config_vars->use_total_feed) { |
|
| 33 | + $alt_message = 'msg_invalid_request'; |
|
| 34 | + } |
|
| 35 | + if(!in_array($config_vars->use_total_feed, array('Y','N'))) { |
|
| 36 | + $config_vars->open_rss = 'Y'; |
|
| 37 | + } |
|
| 34 | 38 | |
| 35 | 39 | if($config_vars->image || $config_vars->del_image) |
| 36 | 40 | { |
@@ -49,20 +53,23 @@ discard block |
||
| 49 | 53 | // Ignore if the file is not an image |
| 50 | 54 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
| 51 | 55 | |
| 52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
| 53 | - else |
|
| 56 | + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { |
|
| 57 | + $alt_message = 'msg_rss_invalid_image_format'; |
|
| 58 | + } else |
|
| 54 | 59 | { |
| 55 | 60 | // Upload the file to a path |
| 56 | 61 | $path = './files/attach/images/rss/'; |
| 57 | 62 | // Create a directory |
| 58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
| 59 | - else |
|
| 63 | + if(!FileHandler::makeDir($path)) { |
|
| 64 | + $alt_message = 'msg_error_occured'; |
|
| 65 | + } else |
|
| 60 | 66 | { |
| 61 | 67 | $filename = $path.$image_obj['name']; |
| 62 | 68 | |
| 63 | 69 | // Move the file |
| 64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
| 65 | - else |
|
| 70 | + if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { |
|
| 71 | + $alt_message = 'msg_error_occured'; |
|
| 72 | + } else |
|
| 66 | 73 | { |
| 67 | 74 | $config_vars->image = $filename; |
| 68 | 75 | } |
@@ -70,11 +77,15 @@ discard block |
||
| 70 | 77 | } |
| 71 | 78 | } |
| 72 | 79 | } |
| 73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
| 80 | + if(!$config_vars->image && $config_vars->del_image != 'Y') { |
|
| 81 | + $config_vars->image = $total_config->image; |
|
| 82 | + } |
|
| 74 | 83 | |
| 75 | 84 | $output = $this->setFeedConfig($config_vars); |
| 76 | 85 | |
| 77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
| 86 | + if(!$alt_message) { |
|
| 87 | + $alt_message = 'success_updated'; |
|
| 88 | + } |
|
| 78 | 89 | |
| 79 | 90 | $alt_message = Context::getLang($alt_message); |
| 80 | 91 | $this->setMessage($alt_message, 'info'); |
@@ -139,7 +150,9 @@ discard block |
||
| 139 | 150 | return new BaseObject(-1, 'msg_invalid_request'); |
| 140 | 151 | } |
| 141 | 152 | |
| 142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
| 153 | + if(!in_array($open_rss, array('Y','H','N'))) { |
|
| 154 | + $open_rss = 'N'; |
|
| 155 | + } |
|
| 143 | 156 | |
| 144 | 157 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
| 145 | 158 | } |
@@ -697,6 +697,9 @@ discard block |
||
| 697 | 697 | return $GLOBALS['_xe_loaded_widgets_'][$widget]; |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | + /** |
|
| 701 | + * @param boolean $javascript_mode |
|
| 702 | + */ |
|
| 700 | 703 | function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
| 701 | 704 | { |
| 702 | 705 | if(!$widgetStyle) return $widget_content_body; |
@@ -737,6 +740,7 @@ discard block |
||
| 737 | 740 | |
| 738 | 741 | /** |
| 739 | 742 | * @brief request parameters and variables sort through the information widget |
| 743 | + * @param BaseObject $request_vars |
|
| 740 | 744 | */ |
| 741 | 745 | function arrangeWidgetVars($widget, $request_vars, &$vars) |
| 742 | 746 | { |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | $oModuleModel = getModel('module'); |
| 35 | 35 | $skin_info = $oModuleModel->loadSkinInfo($path, $skin); |
| 36 | 36 | |
| 37 | - for($i=0;$i<count($skin_info->colorset);$i++) |
|
| 37 | + for ($i = 0; $i < count($skin_info->colorset); $i++) |
|
| 38 | 38 | { |
| 39 | 39 | $colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title); |
| 40 | 40 | $colorset_list[] = $colorset; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
| 43 | + if (count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
| 44 | 44 | $this->add('colorset_list', $colorsets); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | function procWidgetGenerateCode() |
| 51 | 51 | { |
| 52 | 52 | $widget = Context::get('selected_widget'); |
| 53 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
| 54 | - if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
| 53 | + if (!$widget) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 54 | + if (!Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null')); |
|
| 55 | 55 | |
| 56 | 56 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
| 57 | 57 | |
| 58 | - $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute)); |
|
| 58 | + $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ', $attribute)); |
|
| 59 | 59 | // Code output |
| 60 | 60 | $this->add('widget_code', $widget_code); |
| 61 | 61 | } |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | function procWidgetGenerateCodeInPage() |
| 67 | 67 | { |
| 68 | 68 | $widget = Context::get('selected_widget'); |
| 69 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
| 69 | + if (!$widget) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 70 | 70 | |
| 71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
| 71 | + if (!in_array($widget, array('widgetBox', 'widgetContent')) && !Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null')); |
|
| 72 | 72 | |
| 73 | 73 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
| 74 | 74 | // Wanted results |
@@ -107,26 +107,26 @@ discard block |
||
| 107 | 107 | $err = 0; |
| 108 | 108 | $oLayoutModel = getModel('layout'); |
| 109 | 109 | $layout_info = $oLayoutModel->getLayout($module_srl); |
| 110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
| 110 | + if (!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
| 111 | 111 | |
| 112 | 112 | // Destination Information Wanted page module |
| 113 | 113 | $oModuleModel = getModel('module'); |
| 114 | 114 | $columnList = array('module_srl', 'module'); |
| 115 | 115 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 116 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
| 116 | + if (!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
| 117 | 117 | |
| 118 | - if($err > 1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 118 | + if ($err > 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 119 | 119 | |
| 120 | 120 | // Check permissions |
| 121 | 121 | $logged_info = Context::get('logged_info'); |
| 122 | - if(!$logged_info->member_srl) |
|
| 122 | + if (!$logged_info->member_srl) |
|
| 123 | 123 | { |
| 124 | - return new BaseObject(-1,'msg_not_permitted'); |
|
| 124 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 125 | 125 | } |
| 126 | 126 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
| 127 | - if(!$module_grant->manager) |
|
| 127 | + if (!$module_grant->manager) |
|
| 128 | 128 | { |
| 129 | - return new BaseObject(-1,'msg_not_permitted'); |
|
| 129 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Enter post |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $obj->document_srl = $document_srl; |
| 140 | 140 | |
| 141 | 141 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
| 142 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
| 142 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
| 143 | 143 | { |
| 144 | 144 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
| 145 | 145 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // Stop when an error occurs |
| 153 | - if(!$output->toBool()) return $output; |
|
| 153 | + if (!$output->toBool()) return $output; |
|
| 154 | 154 | |
| 155 | 155 | // Return results |
| 156 | 156 | $this->add('document_srl', $obj->document_srl); |
@@ -169,29 +169,29 @@ discard block |
||
| 169 | 169 | $oDocumentAdminController = getAdminController('document'); |
| 170 | 170 | |
| 171 | 171 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 172 | - if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request'); |
|
| 172 | + if (!$oDocument->isExists()) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 173 | 173 | $module_srl = $oDocument->get('module_srl'); |
| 174 | 174 | |
| 175 | 175 | // Destination Information Wanted page module |
| 176 | 176 | $oModuleModel = getModel('module'); |
| 177 | 177 | $columnList = array('module_srl', 'module'); |
| 178 | 178 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 179 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
| 179 | + if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 180 | 180 | |
| 181 | 181 | // Check permissions |
| 182 | 182 | $logged_info = Context::get('logged_info'); |
| 183 | - if(!$logged_info->member_srl) |
|
| 183 | + if (!$logged_info->member_srl) |
|
| 184 | 184 | { |
| 185 | - return new BaseObject(-1,'msg_not_permitted'); |
|
| 185 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 186 | 186 | } |
| 187 | 187 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
| 188 | - if(!$module_grant->manager) |
|
| 188 | + if (!$module_grant->manager) |
|
| 189 | 189 | { |
| 190 | - return new BaseObject(-1,'msg_not_permitted'); |
|
| 190 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
|
| 194 | - if(!$output->toBool()) return $output; |
|
| 193 | + $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'), 0); |
|
| 194 | + if (!$output->toBool()) return $output; |
|
| 195 | 195 | |
| 196 | 196 | // Return results |
| 197 | 197 | $copied_srls = $output->get('copied_srls'); |
@@ -210,28 +210,28 @@ discard block |
||
| 210 | 210 | $oDocumentController = getController('document'); |
| 211 | 211 | |
| 212 | 212 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 213 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 213 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
| 214 | 214 | $module_srl = $oDocument->get('module_srl'); |
| 215 | 215 | |
| 216 | 216 | // Destination Information Wanted page module |
| 217 | 217 | $oModuleModel = getModel('module'); |
| 218 | 218 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 219 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
| 219 | + if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 220 | 220 | |
| 221 | 221 | // Check permissions |
| 222 | 222 | $logged_info = Context::get('logged_info'); |
| 223 | - if(!$logged_info->member_srl) |
|
| 223 | + if (!$logged_info->member_srl) |
|
| 224 | 224 | { |
| 225 | 225 | return new BaseObject(-1, 'msg_not_permitted'); |
| 226 | 226 | } |
| 227 | 227 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
| 228 | - if(!$module_grant->manager) |
|
| 228 | + if (!$module_grant->manager) |
|
| 229 | 229 | { |
| 230 | 230 | return new BaseObject(-1, 'msg_not_permitted'); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl')); |
| 234 | - if(!$output->toBool()) return $output; |
|
| 234 | + if (!$output->toBool()) return $output; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | function triggerWidgetCompile(&$content) |
| 250 | 250 | { |
| 251 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 251 | + if (Context::getResponseMethod() != 'HTML') return new BaseObject(); |
|
| 252 | 252 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
| 253 | 253 | return new BaseObject(); |
| 254 | 254 | } |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | // Check whether to include information about editing |
| 265 | 265 | $this->javascript_mode = $javascript_mode; |
| 266 | 266 | // Widget code box change |
| 267 | - $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content); |
|
| 267 | + $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content); |
|
| 268 | 268 | // Widget code information byeogyeong |
| 269 | - $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content); |
|
| 269 | + $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this, 'transWidget'), $content); |
|
| 270 | 270 | |
| 271 | 271 | return $content; |
| 272 | 272 | } |
@@ -281,11 +281,11 @@ discard block |
||
| 281 | 281 | $oXmlParser = new XmlParser(); |
| 282 | 282 | $xml_doc = $oXmlParser->parse(trim($buff)); |
| 283 | 283 | |
| 284 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
| 284 | + if ($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
| 285 | 285 | else $vars = $xml_doc->attrs; |
| 286 | 286 | |
| 287 | 287 | $widget = $vars->widget; |
| 288 | - if(!$widget) return $matches[0]; |
|
| 288 | + if (!$widget) return $matches[0]; |
|
| 289 | 289 | unset($vars->widget); |
| 290 | 290 | |
| 291 | 291 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -296,13 +296,13 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | function transWidgetBox($matches) |
| 298 | 298 | { |
| 299 | - $buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]); |
|
| 299 | + $buff = preg_replace('/<div><div>(.*)$/i', '</div>', $matches[0]); |
|
| 300 | 300 | $oXmlParser = new XmlParser(); |
| 301 | 301 | $xml_doc = $oXmlParser->parse($buff); |
| 302 | 302 | |
| 303 | 303 | $vars = $xml_doc->div->attrs; |
| 304 | 304 | $widget = $vars->widget; |
| 305 | - if(!$widget) return $matches[0]; |
|
| 305 | + if (!$widget) return $matches[0]; |
|
| 306 | 306 | unset($vars->widget); |
| 307 | 307 | |
| 308 | 308 | $vars->widgetbox_content = $matches[3]; |
@@ -323,28 +323,28 @@ discard block |
||
| 323 | 323 | $oXmlParser = new XmlParser(); |
| 324 | 324 | |
| 325 | 325 | $cnt = count($matches[1]); |
| 326 | - for($i=0;$i<$cnt;$i++) |
|
| 326 | + for ($i = 0; $i < $cnt; $i++) |
|
| 327 | 327 | { |
| 328 | 328 | $buff = $matches[0][$i]; |
| 329 | 329 | $xml_doc = $oXmlParser->parse(trim($buff)); |
| 330 | 330 | |
| 331 | 331 | $args = $xml_doc->img->attrs; |
| 332 | - if(!$args) continue; |
|
| 332 | + if (!$args) continue; |
|
| 333 | 333 | // If you are not caching path |
| 334 | 334 | $widget = $args->widget; |
| 335 | 335 | $sequence = $args->widget_sequence; |
| 336 | 336 | $cache = $args->widget_cache; |
| 337 | - if(!$sequence || !$cache) continue; |
|
| 337 | + if (!$sequence || !$cache) continue; |
|
| 338 | 338 | |
| 339 | - if(count($args)) |
|
| 339 | + if (count($args)) |
|
| 340 | 340 | { |
| 341 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
| 341 | + foreach ($args as $k => $v) $args->{$k} = urldecode($v); |
|
| 342 | 342 | } |
| 343 | 343 | // If the cache file for each language widget regeneration |
| 344 | - foreach($lang_list as $lang_type => $val) |
|
| 344 | + foreach ($lang_list as $lang_type => $val) |
|
| 345 | 345 | { |
| 346 | 346 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
| 347 | - if(!file_exists($cache_file)) continue; |
|
| 347 | + if (!file_exists($cache_file)) continue; |
|
| 348 | 348 | $this->getCache($widget, $args, $lang_type, true); |
| 349 | 349 | } |
| 350 | 350 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
| 357 | 357 | { |
| 358 | 358 | // If the specified language specifies the current language |
| 359 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
| 359 | + if (!$lang_type) $lang_type = Context::getLangType(); |
|
| 360 | 360 | // widget, the cache number and cache values are set |
| 361 | 361 | $widget_sequence = $args->widget_sequence; |
| 362 | 362 | $widget_cache = $args->widget_cache; |
@@ -364,10 +364,10 @@ discard block |
||
| 364 | 364 | /** |
| 365 | 365 | * Even if the cache number and value of the cache and return it to extract data |
| 366 | 366 | */ |
| 367 | - if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
| 367 | + if (!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
| 368 | 368 | { |
| 369 | 369 | $oWidget = $this->getWidgetObject($widget); |
| 370 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
| 370 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
| 371 | 371 | |
| 372 | 372 | $widget_content = $oWidget->proc($args); |
| 373 | 373 | $oModuleController = getController('module'); |
@@ -376,15 +376,15 @@ discard block |
||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | $oCacheHandler = CacheHandler::getInstance('template'); |
| 379 | - if($oCacheHandler->isSupport()) |
|
| 379 | + if ($oCacheHandler->isSupport()) |
|
| 380 | 380 | { |
| 381 | - $key = 'widget_cache:' . $widget_sequence; |
|
| 381 | + $key = 'widget_cache:'.$widget_sequence; |
|
| 382 | 382 | |
| 383 | 383 | $cache_body = $oCacheHandler->get($key); |
| 384 | 384 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if($cache_body) |
|
| 387 | + if ($cache_body) |
|
| 388 | 388 | { |
| 389 | 389 | return $cache_body; |
| 390 | 390 | } |
@@ -397,11 +397,11 @@ discard block |
||
| 397 | 397 | // Wanted cache file |
| 398 | 398 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type); |
| 399 | 399 | // If the file exists in the cache, the file validation |
| 400 | - if(!$ignore_cache && file_exists($cache_file)) |
|
| 400 | + if (!$ignore_cache && file_exists($cache_file)) |
|
| 401 | 401 | { |
| 402 | 402 | $filemtime = filemtime($cache_file); |
| 403 | 403 | // Should be modified compared to the time of the cache or in the future if creating more than widget.controller.php file a return value of the cache |
| 404 | - if($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
| 404 | + if ($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
| 405 | 405 | { |
| 406 | 406 | $cache_body = FileHandler::readFile($cache_file); |
| 407 | 407 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
@@ -410,18 +410,18 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | // cache update and cache renewal of the file mtime |
| 413 | - if(!$oCacheHandler->isSupport()) |
|
| 413 | + if (!$oCacheHandler->isSupport()) |
|
| 414 | 414 | { |
| 415 | 415 | touch($cache_file); |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | $oWidget = $this->getWidgetObject($widget); |
| 419 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
| 419 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
| 420 | 420 | |
| 421 | 421 | $widget_content = $oWidget->proc($args); |
| 422 | 422 | $oModuleController = getController('module'); |
| 423 | 423 | $oModuleController->replaceDefinedLangCode($widget_content); |
| 424 | - if($oCacheHandler->isSupport()) |
|
| 424 | + if ($oCacheHandler->isSupport()) |
|
| 425 | 425 | { |
| 426 | 426 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
| 427 | 427 | } |
@@ -443,16 +443,16 @@ discard block |
||
| 443 | 443 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
| 444 | 444 | { |
| 445 | 445 | // Save for debug run-time widget |
| 446 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
| 446 | + if (__DEBUG__ == 3) $start = getMicroTime(); |
|
| 447 | 447 | $before = microtime(true); |
| 448 | 448 | // urldecode the value of args haejum |
| 449 | 449 | $object_vars = get_object_vars($args); |
| 450 | - if(count($object_vars)) |
|
| 450 | + if (count($object_vars)) |
|
| 451 | 451 | { |
| 452 | - foreach($object_vars as $key => $val) |
|
| 452 | + foreach ($object_vars as $key => $val) |
|
| 453 | 453 | { |
| 454 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
| 455 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
| 454 | + if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) continue; |
|
| 455 | + if ($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
@@ -461,14 +461,14 @@ discard block |
||
| 461 | 461 | * Widgets widgetContent/widgetBox Wanted If you are not content |
| 462 | 462 | */ |
| 463 | 463 | $widget_content = ''; |
| 464 | - if($widget != 'widgetContent' && $widget != 'widgetBox') |
|
| 464 | + if ($widget != 'widgetContent' && $widget != 'widgetBox') |
|
| 465 | 465 | { |
| 466 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
| 466 | + if (!is_dir(sprintf(_XE_PATH_.'widgets/%s/', $widget))) return; |
|
| 467 | 467 | // Hold the contents of the widget parameter |
| 468 | 468 | $widget_content = $this->getCache($widget, $args); |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - if($widget == 'widgetBox') |
|
| 471 | + if ($widget == 'widgetBox') |
|
| 472 | 472 | { |
| 473 | 473 | $widgetbox_content = $args->widgetbox_content; |
| 474 | 474 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | * Wanted specified by the administrator of the widget style |
| 478 | 478 | */ |
| 479 | 479 | // Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed |
| 480 | - $style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style); |
|
| 480 | + $style = preg_replace('/url\((.+)(\/?)none\)/is', '', $args->style); |
|
| 481 | 481 | // Find a style statement that based on the internal margin dropping pre-change |
| 482 | 482 | $widget_padding_left = $args->widget_padding_left; |
| 483 | 483 | $widget_padding_right = $args->widget_padding_right; |
@@ -493,18 +493,18 @@ discard block |
||
| 493 | 493 | $widget_content_body = ''; |
| 494 | 494 | $widget_content_footer = ''; |
| 495 | 495 | // If general call is given on page styles should return immediately dreamin ' |
| 496 | - if(!$javascript_mode) |
|
| 496 | + if (!$javascript_mode) |
|
| 497 | 497 | { |
| 498 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
| 499 | - switch($widget) |
|
| 498 | + if ($args->id) $args->id = ' id="'.$args->id.'" '; |
|
| 499 | + switch ($widget) |
|
| 500 | 500 | { |
| 501 | 501 | // If a direct orthogonal addition information |
| 502 | 502 | case 'widgetContent' : |
| 503 | - if($args->document_srl) |
|
| 503 | + if ($args->document_srl) |
|
| 504 | 504 | { |
| 505 | 505 | $oDocumentModel = getModel('document'); |
| 506 | 506 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
| 507 | - $body = $oDocument->getContent(false,false,false, false); |
|
| 507 | + $body = $oDocument->getContent(false, false, false, false); |
|
| 508 | 508 | } |
| 509 | 509 | else |
| 510 | 510 | { |
@@ -514,21 +514,21 @@ discard block |
||
| 514 | 514 | $oEditorController = getController('editor'); |
| 515 | 515 | $body = $oEditorController->transComponent($body); |
| 516 | 516 | |
| 517 | - $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
| 517 | + $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper '.$args->css_class.'" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
| 518 | 518 | $widget_content_body = $body; |
| 519 | 519 | $widget_content_footer = '</div></div>'; |
| 520 | 520 | |
| 521 | 521 | break; |
| 522 | 522 | // If the widget box; it could |
| 523 | 523 | case 'widgetBox' : |
| 524 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
| 524 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
| 525 | 525 | $widget_content_body = $widgetbox_content; |
| 526 | 526 | |
| 527 | 527 | break; |
| 528 | 528 | // If the General wijetil |
| 529 | 529 | default : |
| 530 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">',$args->id,$style); |
|
| 531 | - $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content); |
|
| 530 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s">', $args->id, $style); |
|
| 531 | + $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content); |
|
| 532 | 532 | $widget_content_footer = '</div>'; |
| 533 | 533 | break; |
| 534 | 534 | } |
@@ -536,15 +536,15 @@ discard block |
||
| 536 | 536 | } |
| 537 | 537 | else |
| 538 | 538 | { |
| 539 | - switch($widget) |
|
| 539 | + switch ($widget) |
|
| 540 | 540 | { |
| 541 | 541 | // If a direct orthogonal addition information |
| 542 | 542 | case 'widgetContent' : |
| 543 | - if($args->document_srl) |
|
| 543 | + if ($args->document_srl) |
|
| 544 | 544 | { |
| 545 | 545 | $oDocumentModel = getModel('document'); |
| 546 | 546 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
| 547 | - $body = $oDocument->getContent(false,false,false); |
|
| 547 | + $body = $oDocument->getContent(false, false, false); |
|
| 548 | 548 | } |
| 549 | 549 | else |
| 550 | 550 | { |
@@ -552,12 +552,12 @@ discard block |
||
| 552 | 552 | } |
| 553 | 553 | // by args |
| 554 | 554 | $attribute = array(); |
| 555 | - if($args) |
|
| 555 | + if ($args) |
|
| 556 | 556 | { |
| 557 | - foreach($args as $key => $val) |
|
| 557 | + foreach ($args as $key => $val) |
|
| 558 | 558 | { |
| 559 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
| 560 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
| 559 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
| 560 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
| 561 | 561 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 562 | 562 | } |
| 563 | 563 | } |
@@ -565,44 +565,44 @@ discard block |
||
| 565 | 565 | $oWidgetController = getController('widget'); |
| 566 | 566 | |
| 567 | 567 | $widget_content_header = sprintf( |
| 568 | - '<div class="xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
| 568 | + '<div class="xe_content widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
| 569 | 569 | '<div class="widgetResize"></div>'. |
| 570 | 570 | '<div class="widgetResizeLeft"></div>'. |
| 571 | 571 | '<div class="widgetBorder">'. |
| 572 | - '<div style="%s">',$args->widgetstyle, |
|
| 572 | + '<div style="%s">', $args->widgetstyle, |
|
| 573 | 573 | $style, |
| 574 | 574 | $args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom, |
| 575 | 575 | $args->document_srl, |
| 576 | - implode(' ',$attribute), |
|
| 576 | + implode(' ', $attribute), |
|
| 577 | 577 | $inner_style); |
| 578 | 578 | |
| 579 | 579 | $widget_content_body = $body; |
| 580 | 580 | $widget_content_footer = sprintf('</div>'. |
| 581 | 581 | '</div>'. |
| 582 | 582 | '<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'. |
| 583 | - '</div>',base64_encode($body)); |
|
| 583 | + '</div>', base64_encode($body)); |
|
| 584 | 584 | |
| 585 | 585 | break; |
| 586 | 586 | // If the widget box; it could |
| 587 | 587 | case 'widgetBox' : |
| 588 | 588 | // by args |
| 589 | 589 | $attribute = array(); |
| 590 | - if($args) |
|
| 590 | + if ($args) |
|
| 591 | 591 | { |
| 592 | - foreach($args as $key => $val) |
|
| 592 | + foreach ($args as $key => $val) |
|
| 593 | 593 | { |
| 594 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
| 595 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
| 596 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
| 594 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
| 595 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
| 596 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
| 597 | 597 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | $widget_content_header = sprintf( |
| 602 | - '<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
| 602 | + '<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
| 603 | 603 | '<div class="widgetBoxResize"></div>'. |
| 604 | 604 | '<div class="widgetBoxResizeLeft"></div>'. |
| 605 | - '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style); |
|
| 605 | + '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style); |
|
| 606 | 606 | |
| 607 | 607 | $widget_content_body = $widgetbox_content; |
| 608 | 608 | |
@@ -611,26 +611,26 @@ discard block |
||
| 611 | 611 | default : |
| 612 | 612 | // by args |
| 613 | 613 | $attribute = array(); |
| 614 | - if($args) |
|
| 614 | + if ($args) |
|
| 615 | 615 | { |
| 616 | - $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
|
| 617 | - foreach($args as $key => $val) |
|
| 616 | + $allowed_key = array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget'); |
|
| 617 | + foreach ($args as $key => $val) |
|
| 618 | 618 | { |
| 619 | - if(in_array($key, $allowed_key)) continue; |
|
| 620 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
| 621 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
| 619 | + if (in_array($key, $allowed_key)) continue; |
|
| 620 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
| 621 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
| 622 | 622 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - $widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
| 626 | + $widget_content_header = sprintf('<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
| 627 | 627 | '<div class="widgetResize"></div>'. |
| 628 | 628 | '<div class="widgetResizeLeft"></div>'. |
| 629 | - '<div class="widgetBorder">',$args->widgetstyle,$style, |
|
| 629 | + '<div class="widgetBorder">', $args->widgetstyle, $style, |
|
| 630 | 630 | $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, |
| 631 | - $widget, implode(' ',$attribute)); |
|
| 631 | + $widget, implode(' ', $attribute)); |
|
| 632 | 632 | |
| 633 | - $widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content); |
|
| 633 | + $widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style, $widget_content); |
|
| 634 | 634 | |
| 635 | 635 | $widget_content_footer = '</div></div>'; |
| 636 | 636 | |
@@ -638,11 +638,11 @@ discard block |
||
| 638 | 638 | } |
| 639 | 639 | } |
| 640 | 640 | // Compile the widget style. |
| 641 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
| 641 | + if ($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode); |
|
| 642 | 642 | |
| 643 | - $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
|
| 643 | + $output = $widget_content_header.$widget_content_body.$widget_content_footer; |
|
| 644 | 644 | // Debug widget creation time information added to the results |
| 645 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
| 645 | + if (__DEBUG__ == 3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
| 646 | 646 | |
| 647 | 647 | $after = microtime(true); |
| 648 | 648 | |
@@ -663,32 +663,32 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | function getWidgetObject($widget) |
| 665 | 665 | { |
| 666 | - if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
| 666 | + if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
| 667 | 667 | { |
| 668 | 668 | return Context::getLang('msg_invalid_request'); |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - if(!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
| 671 | + if (!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
| 672 | 672 | { |
| 673 | 673 | // Finding the location of a widget |
| 674 | 674 | $oWidgetModel = getModel('widget'); |
| 675 | 675 | $path = $oWidgetModel->getWidgetPath($widget); |
| 676 | 676 | // If you do not find the class file error output widget (html output) |
| 677 | 677 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
| 678 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
| 678 | + if (!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
| 679 | 679 | // Widget classes include |
| 680 | 680 | require_once($class_file); |
| 681 | 681 | |
| 682 | 682 | // Creating Objects |
| 683 | - if(!class_exists($widget, false)) |
|
| 683 | + if (!class_exists($widget, false)) |
|
| 684 | 684 | { |
| 685 | 685 | return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | $oWidget = new $widget(); |
| 689 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
| 689 | + if (!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
| 690 | 690 | |
| 691 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
| 691 | + if (!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
| 692 | 692 | |
| 693 | 693 | $oWidget->widget_path = $path; |
| 694 | 694 | |
@@ -697,29 +697,29 @@ discard block |
||
| 697 | 697 | return $GLOBALS['_xe_loaded_widgets_'][$widget]; |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
|
| 700 | + function compileWidgetStyle($widgetStyle, $widget, $widget_content_body, $args, $javascript_mode) |
|
| 701 | 701 | { |
| 702 | - if(!$widgetStyle) return $widget_content_body; |
|
| 702 | + if (!$widgetStyle) return $widget_content_body; |
|
| 703 | 703 | |
| 704 | 704 | $oWidgetModel = getModel('widget'); |
| 705 | 705 | // Bring extra_var widget style tie |
| 706 | 706 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
| 707 | - if(!$widgetstyle_info) return $widget_content_body; |
|
| 707 | + if (!$widgetstyle_info) return $widget_content_body; |
|
| 708 | 708 | |
| 709 | 709 | $widgetstyle_extra_var = new stdClass(); |
| 710 | 710 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
| 711 | - if(count($widgetstyle_extra_var_key['extra_var'])) |
|
| 711 | + if (count($widgetstyle_extra_var_key['extra_var'])) |
|
| 712 | 712 | { |
| 713 | - foreach($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
| 713 | + foreach ($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
| 714 | 714 | { |
| 715 | - $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
| 715 | + $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | Context::set('widgetstyle_extra_var', $widgetstyle_extra_var); |
| 719 | 719 | // #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated |
| 720 | 720 | Context::set('widgetstyle_extar_var', $widgetstyle_extra_var); |
| 721 | 721 | |
| 722 | - if($javascript_mode && $widget=='widgetBox') |
|
| 722 | + if ($javascript_mode && $widget == 'widgetBox') |
|
| 723 | 723 | { |
| 724 | 724 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
| 725 | 725 | } |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | $oWidgetModel = getModel('widget'); |
| 744 | 744 | $widget_info = $oWidgetModel->getWidgetInfo($widget); |
| 745 | 745 | |
| 746 | - if(!$vars) |
|
| 746 | + if (!$vars) |
|
| 747 | 747 | { |
| 748 | 748 | $vars = new stdClass(); |
| 749 | 749 | } |
@@ -754,31 +754,31 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | $vars->skin = trim($request_vars->skin); |
| 756 | 756 | $vars->colorset = trim($request_vars->colorset); |
| 757 | - $vars->widget_sequence = (int)($request_vars->widget_sequence); |
|
| 758 | - $vars->widget_cache = (int)($request_vars->widget_cache); |
|
| 757 | + $vars->widget_sequence = (int) ($request_vars->widget_sequence); |
|
| 758 | + $vars->widget_cache = (int) ($request_vars->widget_cache); |
|
| 759 | 759 | $vars->style = trim($request_vars->style); |
| 760 | 760 | $vars->widget_padding_left = trim($request_vars->widget_padding_left); |
| 761 | 761 | $vars->widget_padding_right = trim($request_vars->widget_padding_right); |
| 762 | 762 | $vars->widget_padding_top = trim($request_vars->widget_padding_top); |
| 763 | 763 | $vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom); |
| 764 | - $vars->document_srl= trim($request_vars->document_srl); |
|
| 764 | + $vars->document_srl = trim($request_vars->document_srl); |
|
| 765 | 765 | |
| 766 | - if(count($widget_info->extra_var)) |
|
| 766 | + if (count($widget_info->extra_var)) |
|
| 767 | 767 | { |
| 768 | - foreach($widget_info->extra_var as $key=>$val) |
|
| 768 | + foreach ($widget_info->extra_var as $key=>$val) |
|
| 769 | 769 | { |
| 770 | 770 | $vars->{$key} = trim($request_vars->{$key}); |
| 771 | 771 | } |
| 772 | 772 | } |
| 773 | 773 | // If the widget style |
| 774 | - if($request_vars->widgetstyle) |
|
| 774 | + if ($request_vars->widgetstyle) |
|
| 775 | 775 | { |
| 776 | 776 | $widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle); |
| 777 | - if(count($widgetStyle_info->extra_var)) |
|
| 777 | + if (count($widgetStyle_info->extra_var)) |
|
| 778 | 778 | { |
| 779 | - foreach($widgetStyle_info->extra_var as $key=>$val) |
|
| 779 | + foreach ($widgetStyle_info->extra_var as $key=>$val) |
|
| 780 | 780 | { |
| 781 | - if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea') |
|
| 781 | + if ($val->type == 'color' || $val->type == 'text' || $val->type == 'select' || $val->type == 'filebox' || $val->type == 'textarea') |
|
| 782 | 782 | { |
| 783 | 783 | $vars->{$key} = trim($request_vars->{$key}); |
| 784 | 784 | } |
@@ -786,23 +786,23 @@ discard block |
||
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | 788 | |
| 789 | - if($vars->widget_sequence) |
|
| 789 | + if ($vars->widget_sequence) |
|
| 790 | 790 | { |
| 791 | 791 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $vars->widget_sequence, Context::getLangType()); |
| 792 | 792 | FileHandler::removeFile($cache_file); |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
| 795 | + if ($vars->widget_cache > 0) $vars->widget_sequence = getNextSequence(); |
|
| 796 | 796 | |
| 797 | 797 | $attribute = array(); |
| 798 | - foreach($vars as $key => $val) |
|
| 798 | + foreach ($vars as $key => $val) |
|
| 799 | 799 | { |
| 800 | - if(!$val) |
|
| 800 | + if (!$val) |
|
| 801 | 801 | { |
| 802 | 802 | unset($vars->{$key}); |
| 803 | 803 | continue; |
| 804 | 804 | } |
| 805 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
| 805 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
| 806 | 806 | $vars->{$key} = Context::convertEncodingStr($val); |
| 807 | 807 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 808 | 808 | } |
@@ -40,7 +40,9 @@ discard block |
||
| 40 | 40 | $colorset_list[] = $colorset; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
| 43 | + if(count($colorset_list)) { |
|
| 44 | + $colorsets = implode("\n", $colorset_list); |
|
| 45 | + } |
|
| 44 | 46 | $this->add('colorset_list', $colorsets); |
| 45 | 47 | } |
| 46 | 48 | |
@@ -50,8 +52,12 @@ discard block |
||
| 50 | 52 | function procWidgetGenerateCode() |
| 51 | 53 | { |
| 52 | 54 | $widget = Context::get('selected_widget'); |
| 53 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
| 54 | - if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
| 55 | + if(!$widget) { |
|
| 56 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 57 | + } |
|
| 58 | + if(!Context::get('skin')) { |
|
| 59 | + return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
| 60 | + } |
|
| 55 | 61 | |
| 56 | 62 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
| 57 | 63 | |
@@ -66,9 +72,13 @@ discard block |
||
| 66 | 72 | function procWidgetGenerateCodeInPage() |
| 67 | 73 | { |
| 68 | 74 | $widget = Context::get('selected_widget'); |
| 69 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
| 75 | + if(!$widget) { |
|
| 76 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 77 | + } |
|
| 70 | 78 | |
| 71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
| 79 | + if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) { |
|
| 80 | + return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
| 81 | + } |
|
| 72 | 82 | |
| 73 | 83 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
| 74 | 84 | // Wanted results |
@@ -107,15 +117,21 @@ discard block |
||
| 107 | 117 | $err = 0; |
| 108 | 118 | $oLayoutModel = getModel('layout'); |
| 109 | 119 | $layout_info = $oLayoutModel->getLayout($module_srl); |
| 110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
| 120 | + if(!$layout_info || $layout_info->type != 'faceoff') { |
|
| 121 | + $err++; |
|
| 122 | + } |
|
| 111 | 123 | |
| 112 | 124 | // Destination Information Wanted page module |
| 113 | 125 | $oModuleModel = getModel('module'); |
| 114 | 126 | $columnList = array('module_srl', 'module'); |
| 115 | 127 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 116 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
| 128 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
| 129 | + $err++; |
|
| 130 | + } |
|
| 117 | 131 | |
| 118 | - if($err > 1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 132 | + if($err > 1) { |
|
| 133 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 134 | + } |
|
| 119 | 135 | |
| 120 | 136 | // Check permissions |
| 121 | 137 | $logged_info = Context::get('logged_info'); |
@@ -142,15 +158,16 @@ discard block |
||
| 142 | 158 | if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
| 143 | 159 | { |
| 144 | 160 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
| 145 | - } |
|
| 146 | - else |
|
| 161 | + } else |
|
| 147 | 162 | { |
| 148 | 163 | $output = $oDocumentController->insertDocument($obj); |
| 149 | 164 | $obj->document_srl = $output->get('document_srl'); |
| 150 | 165 | } |
| 151 | 166 | |
| 152 | 167 | // Stop when an error occurs |
| 153 | - if(!$output->toBool()) return $output; |
|
| 168 | + if(!$output->toBool()) { |
|
| 169 | + return $output; |
|
| 170 | + } |
|
| 154 | 171 | |
| 155 | 172 | // Return results |
| 156 | 173 | $this->add('document_srl', $obj->document_srl); |
@@ -169,14 +186,18 @@ discard block |
||
| 169 | 186 | $oDocumentAdminController = getAdminController('document'); |
| 170 | 187 | |
| 171 | 188 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 172 | - if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request'); |
|
| 189 | + if(!$oDocument->isExists()) { |
|
| 190 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 191 | + } |
|
| 173 | 192 | $module_srl = $oDocument->get('module_srl'); |
| 174 | 193 | |
| 175 | 194 | // Destination Information Wanted page module |
| 176 | 195 | $oModuleModel = getModel('module'); |
| 177 | 196 | $columnList = array('module_srl', 'module'); |
| 178 | 197 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 179 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
| 198 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
| 199 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 200 | + } |
|
| 180 | 201 | |
| 181 | 202 | // Check permissions |
| 182 | 203 | $logged_info = Context::get('logged_info'); |
@@ -191,7 +212,9 @@ discard block |
||
| 191 | 212 | } |
| 192 | 213 | |
| 193 | 214 | $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
| 194 | - if(!$output->toBool()) return $output; |
|
| 215 | + if(!$output->toBool()) { |
|
| 216 | + return $output; |
|
| 217 | + } |
|
| 195 | 218 | |
| 196 | 219 | // Return results |
| 197 | 220 | $copied_srls = $output->get('copied_srls'); |
@@ -210,13 +233,17 @@ discard block |
||
| 210 | 233 | $oDocumentController = getController('document'); |
| 211 | 234 | |
| 212 | 235 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 213 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 236 | + if(!$oDocument->isExists()) { |
|
| 237 | + return new BaseObject(); |
|
| 238 | + } |
|
| 214 | 239 | $module_srl = $oDocument->get('module_srl'); |
| 215 | 240 | |
| 216 | 241 | // Destination Information Wanted page module |
| 217 | 242 | $oModuleModel = getModel('module'); |
| 218 | 243 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 219 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
| 244 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
| 245 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 246 | + } |
|
| 220 | 247 | |
| 221 | 248 | // Check permissions |
| 222 | 249 | $logged_info = Context::get('logged_info'); |
@@ -231,7 +258,9 @@ discard block |
||
| 231 | 258 | } |
| 232 | 259 | |
| 233 | 260 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl')); |
| 234 | - if(!$output->toBool()) return $output; |
|
| 261 | + if(!$output->toBool()) { |
|
| 262 | + return $output; |
|
| 263 | + } |
|
| 235 | 264 | } |
| 236 | 265 | |
| 237 | 266 | /** |
@@ -248,7 +277,9 @@ discard block |
||
| 248 | 277 | */ |
| 249 | 278 | function triggerWidgetCompile(&$content) |
| 250 | 279 | { |
| 251 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 280 | + if(Context::getResponseMethod()!='HTML') { |
|
| 281 | + return new BaseObject(); |
|
| 282 | + } |
|
| 252 | 283 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
| 253 | 284 | return new BaseObject(); |
| 254 | 285 | } |
@@ -281,11 +312,16 @@ discard block |
||
| 281 | 312 | $oXmlParser = new XmlParser(); |
| 282 | 313 | $xml_doc = $oXmlParser->parse(trim($buff)); |
| 283 | 314 | |
| 284 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
| 285 | - else $vars = $xml_doc->attrs; |
|
| 315 | + if($xml_doc->img) { |
|
| 316 | + $vars = $xml_doc->img->attrs; |
|
| 317 | + } else { |
|
| 318 | + $vars = $xml_doc->attrs; |
|
| 319 | + } |
|
| 286 | 320 | |
| 287 | 321 | $widget = $vars->widget; |
| 288 | - if(!$widget) return $matches[0]; |
|
| 322 | + if(!$widget) { |
|
| 323 | + return $matches[0]; |
|
| 324 | + } |
|
| 289 | 325 | unset($vars->widget); |
| 290 | 326 | |
| 291 | 327 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -302,7 +338,9 @@ discard block |
||
| 302 | 338 | |
| 303 | 339 | $vars = $xml_doc->div->attrs; |
| 304 | 340 | $widget = $vars->widget; |
| 305 | - if(!$widget) return $matches[0]; |
|
| 341 | + if(!$widget) { |
|
| 342 | + return $matches[0]; |
|
| 343 | + } |
|
| 306 | 344 | unset($vars->widget); |
| 307 | 345 | |
| 308 | 346 | $vars->widgetbox_content = $matches[3]; |
@@ -329,22 +367,30 @@ discard block |
||
| 329 | 367 | $xml_doc = $oXmlParser->parse(trim($buff)); |
| 330 | 368 | |
| 331 | 369 | $args = $xml_doc->img->attrs; |
| 332 | - if(!$args) continue; |
|
| 370 | + if(!$args) { |
|
| 371 | + continue; |
|
| 372 | + } |
|
| 333 | 373 | // If you are not caching path |
| 334 | 374 | $widget = $args->widget; |
| 335 | 375 | $sequence = $args->widget_sequence; |
| 336 | 376 | $cache = $args->widget_cache; |
| 337 | - if(!$sequence || !$cache) continue; |
|
| 377 | + if(!$sequence || !$cache) { |
|
| 378 | + continue; |
|
| 379 | + } |
|
| 338 | 380 | |
| 339 | 381 | if(count($args)) |
| 340 | 382 | { |
| 341 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
| 383 | + foreach($args as $k => $v) { |
|
| 384 | + $args->{$k} = urldecode($v); |
|
| 385 | + } |
|
| 342 | 386 | } |
| 343 | 387 | // If the cache file for each language widget regeneration |
| 344 | 388 | foreach($lang_list as $lang_type => $val) |
| 345 | 389 | { |
| 346 | 390 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
| 347 | - if(!file_exists($cache_file)) continue; |
|
| 391 | + if(!file_exists($cache_file)) { |
|
| 392 | + continue; |
|
| 393 | + } |
|
| 348 | 394 | $this->getCache($widget, $args, $lang_type, true); |
| 349 | 395 | } |
| 350 | 396 | } |
@@ -356,7 +402,9 @@ discard block |
||
| 356 | 402 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
| 357 | 403 | { |
| 358 | 404 | // If the specified language specifies the current language |
| 359 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
| 405 | + if(!$lang_type) { |
|
| 406 | + $lang_type = Context::getLangType(); |
|
| 407 | + } |
|
| 360 | 408 | // widget, the cache number and cache values are set |
| 361 | 409 | $widget_sequence = $args->widget_sequence; |
| 362 | 410 | $widget_cache = $args->widget_cache; |
@@ -367,7 +415,9 @@ discard block |
||
| 367 | 415 | if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
| 368 | 416 | { |
| 369 | 417 | $oWidget = $this->getWidgetObject($widget); |
| 370 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
| 418 | + if(!$oWidget || !method_exists($oWidget, 'proc')) { |
|
| 419 | + return; |
|
| 420 | + } |
|
| 371 | 421 | |
| 372 | 422 | $widget_content = $oWidget->proc($args); |
| 373 | 423 | $oModuleController = getController('module'); |
@@ -387,8 +437,7 @@ discard block |
||
| 387 | 437 | if($cache_body) |
| 388 | 438 | { |
| 389 | 439 | return $cache_body; |
| 390 | - } |
|
| 391 | - else |
|
| 440 | + } else |
|
| 392 | 441 | { |
| 393 | 442 | /** |
| 394 | 443 | * Cache number and cache values are set so that the cache file should call |
@@ -416,7 +465,9 @@ discard block |
||
| 416 | 465 | } |
| 417 | 466 | |
| 418 | 467 | $oWidget = $this->getWidgetObject($widget); |
| 419 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
| 468 | + if(!$oWidget || !method_exists($oWidget,'proc')) { |
|
| 469 | + return; |
|
| 470 | + } |
|
| 420 | 471 | |
| 421 | 472 | $widget_content = $oWidget->proc($args); |
| 422 | 473 | $oModuleController = getController('module'); |
@@ -424,8 +475,7 @@ discard block |
||
| 424 | 475 | if($oCacheHandler->isSupport()) |
| 425 | 476 | { |
| 426 | 477 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
| 427 | - } |
|
| 428 | - else |
|
| 478 | + } else |
|
| 429 | 479 | { |
| 430 | 480 | FileHandler::writeFile($cache_file, $widget_content); |
| 431 | 481 | } |
@@ -443,7 +493,9 @@ discard block |
||
| 443 | 493 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
| 444 | 494 | { |
| 445 | 495 | // Save for debug run-time widget |
| 446 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
| 496 | + if(__DEBUG__==3) { |
|
| 497 | + $start = getMicroTime(); |
|
| 498 | + } |
|
| 447 | 499 | $before = microtime(true); |
| 448 | 500 | // urldecode the value of args haejum |
| 449 | 501 | $object_vars = get_object_vars($args); |
@@ -451,8 +503,12 @@ discard block |
||
| 451 | 503 | { |
| 452 | 504 | foreach($object_vars as $key => $val) |
| 453 | 505 | { |
| 454 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
| 455 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
| 506 | + if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) { |
|
| 507 | + continue; |
|
| 508 | + } |
|
| 509 | + if($escaped) { |
|
| 510 | + $args->{$key} = utf8RawUrlDecode($val); |
|
| 511 | + } |
|
| 456 | 512 | } |
| 457 | 513 | } |
| 458 | 514 | |
@@ -463,7 +519,9 @@ discard block |
||
| 463 | 519 | $widget_content = ''; |
| 464 | 520 | if($widget != 'widgetContent' && $widget != 'widgetBox') |
| 465 | 521 | { |
| 466 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
| 522 | + if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) { |
|
| 523 | + return; |
|
| 524 | + } |
|
| 467 | 525 | // Hold the contents of the widget parameter |
| 468 | 526 | $widget_content = $this->getCache($widget, $args); |
| 469 | 527 | } |
@@ -495,7 +553,9 @@ discard block |
||
| 495 | 553 | // If general call is given on page styles should return immediately dreamin ' |
| 496 | 554 | if(!$javascript_mode) |
| 497 | 555 | { |
| 498 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
| 556 | + if($args->id) { |
|
| 557 | + $args->id = ' id="'.$args->id.'" '; |
|
| 558 | + } |
|
| 499 | 559 | switch($widget) |
| 500 | 560 | { |
| 501 | 561 | // If a direct orthogonal addition information |
@@ -505,8 +565,7 @@ discard block |
||
| 505 | 565 | $oDocumentModel = getModel('document'); |
| 506 | 566 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
| 507 | 567 | $body = $oDocument->getContent(false,false,false, false); |
| 508 | - } |
|
| 509 | - else |
|
| 568 | + } else |
|
| 510 | 569 | { |
| 511 | 570 | $body = base64_decode($args->body); |
| 512 | 571 | } |
@@ -533,8 +592,7 @@ discard block |
||
| 533 | 592 | break; |
| 534 | 593 | } |
| 535 | 594 | // Edit page is called when a widget if you add the code for handling |
| 536 | - } |
|
| 537 | - else |
|
| 595 | + } else |
|
| 538 | 596 | { |
| 539 | 597 | switch($widget) |
| 540 | 598 | { |
@@ -545,8 +603,7 @@ discard block |
||
| 545 | 603 | $oDocumentModel = getModel('document'); |
| 546 | 604 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
| 547 | 605 | $body = $oDocument->getContent(false,false,false); |
| 548 | - } |
|
| 549 | - else |
|
| 606 | + } else |
|
| 550 | 607 | { |
| 551 | 608 | $body = base64_decode($args->body); |
| 552 | 609 | } |
@@ -556,8 +613,12 @@ discard block |
||
| 556 | 613 | { |
| 557 | 614 | foreach($args as $key => $val) |
| 558 | 615 | { |
| 559 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
| 560 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
| 616 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
| 617 | + continue; |
|
| 618 | + } |
|
| 619 | + if(strpos($val,'|@|')>0) { |
|
| 620 | + $val = str_replace('|@|',',',$val); |
|
| 621 | + } |
|
| 561 | 622 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 562 | 623 | } |
| 563 | 624 | } |
@@ -591,9 +652,15 @@ discard block |
||
| 591 | 652 | { |
| 592 | 653 | foreach($args as $key => $val) |
| 593 | 654 | { |
| 594 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
| 595 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
| 596 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
| 655 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
| 656 | + continue; |
|
| 657 | + } |
|
| 658 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
| 659 | + continue; |
|
| 660 | + } |
|
| 661 | + if(strpos($val,'|@|')>0) { |
|
| 662 | + $val = str_replace('|@|',',',$val); |
|
| 663 | + } |
|
| 597 | 664 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 598 | 665 | } |
| 599 | 666 | } |
@@ -616,9 +683,15 @@ discard block |
||
| 616 | 683 | $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
| 617 | 684 | foreach($args as $key => $val) |
| 618 | 685 | { |
| 619 | - if(in_array($key, $allowed_key)) continue; |
|
| 620 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
| 621 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
| 686 | + if(in_array($key, $allowed_key)) { |
|
| 687 | + continue; |
|
| 688 | + } |
|
| 689 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
| 690 | + continue; |
|
| 691 | + } |
|
| 692 | + if(strpos($val,'|@|')>0) { |
|
| 693 | + $val = str_replace('|@|',',',$val); |
|
| 694 | + } |
|
| 622 | 695 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 623 | 696 | } |
| 624 | 697 | } |
@@ -638,11 +711,15 @@ discard block |
||
| 638 | 711 | } |
| 639 | 712 | } |
| 640 | 713 | // Compile the widget style. |
| 641 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
| 714 | + if($args->widgetstyle) { |
|
| 715 | + $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
| 716 | + } |
|
| 642 | 717 | |
| 643 | 718 | $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
| 644 | 719 | // Debug widget creation time information added to the results |
| 645 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
| 720 | + if(__DEBUG__==3) { |
|
| 721 | + $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
| 722 | + } |
|
| 646 | 723 | |
| 647 | 724 | $after = microtime(true); |
| 648 | 725 | |
@@ -675,7 +752,9 @@ discard block |
||
| 675 | 752 | $path = $oWidgetModel->getWidgetPath($widget); |
| 676 | 753 | // If you do not find the class file error output widget (html output) |
| 677 | 754 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
| 678 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
| 755 | + if(!file_exists($class_file)) { |
|
| 756 | + return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
| 757 | + } |
|
| 679 | 758 | // Widget classes include |
| 680 | 759 | require_once($class_file); |
| 681 | 760 | |
@@ -686,9 +765,13 @@ discard block |
||
| 686 | 765 | } |
| 687 | 766 | |
| 688 | 767 | $oWidget = new $widget(); |
| 689 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
| 768 | + if(!is_object($oWidget)) { |
|
| 769 | + return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
| 770 | + } |
|
| 690 | 771 | |
| 691 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
| 772 | + if(!method_exists($oWidget, 'proc')) { |
|
| 773 | + return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
| 774 | + } |
|
| 692 | 775 | |
| 693 | 776 | $oWidget->widget_path = $path; |
| 694 | 777 | |
@@ -699,12 +782,16 @@ discard block |
||
| 699 | 782 | |
| 700 | 783 | function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
| 701 | 784 | { |
| 702 | - if(!$widgetStyle) return $widget_content_body; |
|
| 785 | + if(!$widgetStyle) { |
|
| 786 | + return $widget_content_body; |
|
| 787 | + } |
|
| 703 | 788 | |
| 704 | 789 | $oWidgetModel = getModel('widget'); |
| 705 | 790 | // Bring extra_var widget style tie |
| 706 | 791 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
| 707 | - if(!$widgetstyle_info) return $widget_content_body; |
|
| 792 | + if(!$widgetstyle_info) { |
|
| 793 | + return $widget_content_body; |
|
| 794 | + } |
|
| 708 | 795 | |
| 709 | 796 | $widgetstyle_extra_var = new stdClass(); |
| 710 | 797 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
@@ -722,8 +809,7 @@ discard block |
||
| 722 | 809 | if($javascript_mode && $widget=='widgetBox') |
| 723 | 810 | { |
| 724 | 811 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
| 725 | - } |
|
| 726 | - else |
|
| 812 | + } else |
|
| 727 | 813 | { |
| 728 | 814 | Context::set('widget_content', $widget_content_body); |
| 729 | 815 | } |
@@ -792,7 +878,9 @@ discard block |
||
| 792 | 878 | FileHandler::removeFile($cache_file); |
| 793 | 879 | } |
| 794 | 880 | |
| 795 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
| 881 | + if($vars->widget_cache>0) { |
|
| 882 | + $vars->widget_sequence = getNextSequence(); |
|
| 883 | + } |
|
| 796 | 884 | |
| 797 | 885 | $attribute = array(); |
| 798 | 886 | foreach($vars as $key => $val) |
@@ -802,7 +890,9 @@ discard block |
||
| 802 | 890 | unset($vars->{$key}); |
| 803 | 891 | continue; |
| 804 | 892 | } |
| 805 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
| 893 | + if(strpos($val,'|@|') > 0) { |
|
| 894 | + $val = str_replace('|@|', ',', $val); |
|
| 895 | + } |
|
| 806 | 896 | $vars->{$key} = Context::convertEncodingStr($val); |
| 807 | 897 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 808 | 898 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | {
|
| 96 | 96 | parent::__construct("{$file}({$line_no}):\n\t$message");
|
| 97 | 97 | |
| 98 | - $this->xml_file = $file; |
|
| 98 | + $this->xml_file = $file; |
|
| 99 | 99 | $this->xml_line_no = $line_no; |
| 100 | 100 | $this->xml_message = $message; |
| 101 | 101 | } |
@@ -133,32 +133,32 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | $libXmlErrors = libxml_get_errors(); |
| 135 | 135 | |
| 136 | - if(count($libXmlErrors)) |
|
| 136 | + if (count($libXmlErrors)) |
|
| 137 | 137 | {
|
| 138 | - if(!$filename) |
|
| 138 | + if (!$filename) |
|
| 139 | 139 | {
|
| 140 | 140 | $filename = $libXmlErrors[0]->file; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $msg = ''; |
| 144 | 144 | |
| 145 | - foreach($libXmlErrors as $libXmlError) |
|
| 145 | + foreach ($libXmlErrors as $libXmlError) |
|
| 146 | 146 | {
|
| 147 | 147 | $msg .= "{$libXmlError->file}({$libXmlError->line}):\n\t {$libXmlError->message}";
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if($throw_error) |
|
| 150 | + if ($throw_error) |
|
| 151 | 151 | {
|
| 152 | 152 | throw new ErrorMessage($msg); |
| 153 | 153 | } |
| 154 | 154 | else |
| 155 | 155 | {
|
| 156 | - fwrite(STDERR, $msg . "\n"); |
|
| 156 | + fwrite(STDERR, $msg."\n"); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | else |
| 160 | 160 | {
|
| 161 | - if($throw_error) |
|
| 161 | + if ($throw_error) |
|
| 162 | 162 | {
|
| 163 | 163 | throw new ErrorMessage('Schema validation failed.');
|
| 164 | 164 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | {
|
| 180 | 180 | $children = $node->getElementsByTagName($child_tag); |
| 181 | 181 | |
| 182 | - if($children->length > 1) |
|
| 182 | + if ($children->length > 1) |
|
| 183 | 183 | {
|
| 184 | 184 | throw |
| 185 | 185 | new XmlSchemaError( |
@@ -217,21 +217,21 @@ discard block |
||
| 217 | 217 | {
|
| 218 | 218 | $key_values = array(); |
| 219 | 219 | |
| 220 | - foreach($node->childNodes as $child_node) |
|
| 220 | + foreach ($node->childNodes as $child_node) |
|
| 221 | 221 | {
|
| 222 | - if($child_node->nodeType == XML_ELEMENT_NODE |
|
| 222 | + if ($child_node->nodeType == XML_ELEMENT_NODE |
|
| 223 | 223 | && |
| 224 | 224 | in_array($child_node->tagName, $child_tags)) |
| 225 | 225 | {
|
| 226 | 226 | $key_value = NULL; |
| 227 | 227 | |
| 228 | - foreach($attr_tags as $attr_tag) |
|
| 228 | + foreach ($attr_tags as $attr_tag) |
|
| 229 | 229 | {
|
| 230 | - if($child_node->hasAttribute($attr_tag)) |
|
| 230 | + if ($child_node->hasAttribute($attr_tag)) |
|
| 231 | 231 | {
|
| 232 | 232 | $key_value = $child_node->getAttribute($attr_tag); |
| 233 | 233 | |
| 234 | - if(array_key_exists($key_value, $key_values)) |
|
| 234 | + if (array_key_exists($key_value, $key_values)) |
|
| 235 | 235 | {
|
| 236 | 236 | throw |
| 237 | 237 | new XmlSchemaError( |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if(!$key_value && $key) |
|
| 249 | + if (!$key_value && $key) |
|
| 250 | 250 | {
|
| 251 | 251 | throw |
| 252 | 252 | new XmlSchemaError( |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | $child_node->getLineNo(), |
| 255 | 255 | "<{$child_node->tagName}>: at least one of the following attributes is expected: "
|
| 256 | 256 | . |
| 257 | - implode(', ', $attr_tags) . '.'
|
|
| 257 | + implode(', ', $attr_tags).'.'
|
|
| 258 | 258 | ); |
| 259 | 259 | } |
| 260 | 260 | } |
@@ -282,19 +282,19 @@ discard block |
||
| 282 | 282 | $table_name = NULL; |
| 283 | 283 | $join_type = NULL; |
| 284 | 284 | |
| 285 | - if($table_element->hasAttribute('name'))
|
|
| 285 | + if ($table_element->hasAttribute('name'))
|
|
| 286 | 286 | {
|
| 287 | 287 | $table_name = $table_element->getAttribute('name');
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if($table_element->hasAttribute('type'))
|
|
| 290 | + if ($table_element->hasAttribute('type'))
|
|
| 291 | 291 | {
|
| 292 | 292 | $join_type = $table_element->getAttribute('type');
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if($table_element->getAttribute('query') == 'true')
|
|
| 295 | + if ($table_element->getAttribute('query') == 'true')
|
|
| 296 | 296 | {
|
| 297 | - if($table_name !== NULL) |
|
| 297 | + if ($table_name !== NULL) |
|
| 298 | 298 | {
|
| 299 | 299 | throw |
| 300 | 300 | new XmlSchemaError( |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | ); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if($join_type !== NULL) |
|
| 307 | + if ($join_type !== NULL) |
|
| 308 | 308 | {
|
| 309 | 309 | throw |
| 310 | 310 | new XmlSchemaError( |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | // check contents for a select list or a table-specification |
| 323 | 323 | $has_query_clauses = FALSE; |
| 324 | 324 | |
| 325 | - foreach($table_element->childNodes as $query_clause) |
|
| 325 | + foreach ($table_element->childNodes as $query_clause) |
|
| 326 | 326 | {
|
| 327 | - if($query_clause->nodeType == XML_ELEMENT_NODE |
|
| 327 | + if ($query_clause->nodeType == XML_ELEMENT_NODE |
|
| 328 | 328 | && |
| 329 | 329 | ( |
| 330 | 330 | $query_clause->tagName == 'columns' |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if(!$has_query_clauses) |
|
| 338 | + if (!$has_query_clauses) |
|
| 339 | 339 | {
|
| 340 | 340 | throw |
| 341 | 341 | new XmlSchemaError( |
@@ -351,17 +351,17 @@ discard block |
||
| 351 | 351 | {
|
| 352 | 352 | // base table or view |
| 353 | 353 | |
| 354 | - if($join_type !== NULL) |
|
| 354 | + if ($join_type !== NULL) |
|
| 355 | 355 | {
|
| 356 | 356 | $has_conditions_element = FALSE; |
| 357 | 357 | |
| 358 | - foreach($table_element->childNodes as $child_node) |
|
| 358 | + foreach ($table_element->childNodes as $child_node) |
|
| 359 | 359 | {
|
| 360 | - if($child_node->nodeType == XML_ELEMENT_NODE) |
|
| 360 | + if ($child_node->nodeType == XML_ELEMENT_NODE) |
|
| 361 | 361 | {
|
| 362 | - if($child_node->tagName == 'conditions') |
|
| 362 | + if ($child_node->tagName == 'conditions') |
|
| 363 | 363 | {
|
| 364 | - if($has_conditions_element) |
|
| 364 | + if ($has_conditions_element) |
|
| 365 | 365 | {
|
| 366 | 366 | throw |
| 367 | 367 | new XmlSchemaError( |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - if(!$has_conditions_element) |
|
| 390 | + if (!$has_conditions_element) |
|
| 391 | 391 | {
|
| 392 | 392 | throw |
| 393 | 393 | new XmlSchemaError( |
@@ -399,9 +399,9 @@ discard block |
||
| 399 | 399 | } |
| 400 | 400 | else |
| 401 | 401 | {
|
| 402 | - foreach($table_element->childNodes as $child_node) |
|
| 402 | + foreach ($table_element->childNodes as $child_node) |
|
| 403 | 403 | {
|
| 404 | - if($child_node->nodeType == XML_ELEMENT_NODE) |
|
| 404 | + if ($child_node->nodeType == XML_ELEMENT_NODE) |
|
| 405 | 405 | {
|
| 406 | 406 | throw |
| 407 | 407 | new XmlSchemaError( |
@@ -429,26 +429,25 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function checkTablesClause($xml_file, $tables_element) |
| 431 | 431 | {
|
| 432 | - checkUniqueKey |
|
| 433 | - ( |
|
| 432 | + checkUniqueKey( |
|
| 434 | 433 | $xml_file, |
| 435 | 434 | $tables_element, |
| 436 | - array('table'), // child elements to be checked
|
|
| 437 | - array('alias', 'name'), // attributes to be checked
|
|
| 435 | + array('table'), // child elements to be checked
|
|
| 436 | + array('alias', 'name'), // attributes to be checked
|
|
| 438 | 437 | TRUE // attributes are required |
| 439 | 438 | ); |
| 440 | 439 | |
| 441 | - foreach($tables_element->childNodes as $table) |
|
| 440 | + foreach ($tables_element->childNodes as $table) |
|
| 442 | 441 | {
|
| 443 | - if($table->nodeType == XML_ELEMENT_NODE |
|
| 442 | + if ($table->nodeType == XML_ELEMENT_NODE |
|
| 444 | 443 | && |
| 445 | 444 | $table->tagName == 'table') |
| 446 | 445 | {
|
| 447 | 446 | checkTableExpression($xml_file, $table); |
| 448 | 447 | |
| 449 | - if($table->getAttribute('query') == 'true')
|
|
| 448 | + if ($table->getAttribute('query') == 'true')
|
|
| 450 | 449 | {
|
| 451 | - validate_select_query($xml_file, $table); // recursive call |
|
| 450 | + validate_select_query($xml_file, $table); // recursive call |
|
| 452 | 451 | } |
| 453 | 452 | } |
| 454 | 453 | } |
@@ -470,12 +469,11 @@ discard block |
||
| 470 | 469 | */ |
| 471 | 470 | function checkSelectListClause($xml_file, $columns_element) |
| 472 | 471 | {
|
| 473 | - checkUniqueKey |
|
| 474 | - ( |
|
| 472 | + checkUniqueKey( |
|
| 475 | 473 | $xml_file, |
| 476 | 474 | $columns_element, |
| 477 | - array('column', 'query'), // child elements
|
|
| 478 | - array('alias', 'name'), // attributes
|
|
| 475 | + array('column', 'query'), // child elements
|
|
| 476 | + array('alias', 'name'), // attributes
|
|
| 479 | 477 | FALSE // ignore if no attributes present |
| 480 | 478 | ); |
| 481 | 479 | } |
@@ -491,8 +489,7 @@ discard block |
||
| 491 | 489 | @param $container_element |
| 492 | 490 | @param $child_tag |
| 493 | 491 | */ |
| 494 | -function checkVarContentsValidation |
|
| 495 | - ( |
|
| 492 | +function checkVarContentsValidation( |
|
| 496 | 493 | $xml_file, |
| 497 | 494 | $container_element, |
| 498 | 495 | $child_tag |
@@ -503,23 +500,22 @@ discard block |
||
| 503 | 500 | |
| 504 | 501 | static |
| 505 | 502 | $var_attrs = |
| 506 | - array |
|
| 507 | - ( |
|
| 503 | + array( |
|
| 508 | 504 | 'filter', 'notnull', 'minlength', |
| 509 | 505 | 'maxlength' |
| 510 | 506 | ); |
| 511 | 507 | |
| 512 | - foreach($container_element->childNodes as $child_node) |
|
| 508 | + foreach ($container_element->childNodes as $child_node) |
|
| 513 | 509 | {
|
| 514 | - if($child_node->nodeType == XML_ELEMENT_NODE |
|
| 510 | + if ($child_node->nodeType == XML_ELEMENT_NODE |
|
| 515 | 511 | && |
| 516 | 512 | $child_node->tagName == $child_tag) |
| 517 | 513 | {
|
| 518 | - if(!$child_node->hasAttribute($key_attr)) |
|
| 514 | + if (!$child_node->hasAttribute($key_attr)) |
|
| 519 | 515 | {
|
| 520 | - foreach($var_attrs as $var_attr) |
|
| 516 | + foreach ($var_attrs as $var_attr) |
|
| 521 | 517 | {
|
| 522 | - if($child_node->hasAttribute($var_attr)) |
|
| 518 | + if ($child_node->hasAttribute($var_attr)) |
|
| 523 | 519 | {
|
| 524 | 520 | throw |
| 525 | 521 | new XmlSchemaError( |
@@ -551,9 +547,9 @@ discard block |
||
| 551 | 547 | $has_var_attribute = $condition->hasAttribute('var') || $condition->hasAttribute('default');
|
| 552 | 548 | $query_line_no = -1; |
| 553 | 549 | |
| 554 | - foreach($condition->childNodes as $query_node) |
|
| 550 | + foreach ($condition->childNodes as $query_node) |
|
| 555 | 551 | {
|
| 556 | - if($query_node->nodeType == XML_ELEMENT_NODE |
|
| 552 | + if ($query_node->nodeType == XML_ELEMENT_NODE |
|
| 557 | 553 | && |
| 558 | 554 | $query_node->tagName == 'query') |
| 559 | 555 | {
|
@@ -564,7 +560,7 @@ discard block |
||
| 564 | 560 | } |
| 565 | 561 | } |
| 566 | 562 | |
| 567 | - if($child_query_node && $has_var_attribute) |
|
| 563 | + if ($child_query_node && $has_var_attribute) |
|
| 568 | 564 | {
|
| 569 | 565 | throw |
| 570 | 566 | new XmlSchemaError( |
@@ -574,7 +570,7 @@ discard block |
||
| 574 | 570 | ); |
| 575 | 571 | } |
| 576 | 572 | |
| 577 | - if(!($child_query_node || $has_var_attribute)) |
|
| 573 | + if (!($child_query_node || $has_var_attribute)) |
|
| 578 | 574 | {
|
| 579 | 575 | throw |
| 580 | 576 | new XmlSchemaError( |
@@ -601,18 +597,18 @@ discard block |
||
| 601 | 597 | {
|
| 602 | 598 | $first_child = TRUE; |
| 603 | 599 | |
| 604 | - foreach($conditions->childNodes as $child_node) |
|
| 600 | + foreach ($conditions->childNodes as $child_node) |
|
| 605 | 601 | {
|
| 606 | - if($child_node->nodeType == XML_ELEMENT_NODE) |
|
| 602 | + if ($child_node->nodeType == XML_ELEMENT_NODE) |
|
| 607 | 603 | {
|
| 608 | 604 | // check for 'pipe' attribute |
| 609 | - if($first_child) |
|
| 605 | + if ($first_child) |
|
| 610 | 606 | {
|
| 611 | 607 | $first_child = FALSE; |
| 612 | 608 | } |
| 613 | 609 | else |
| 614 | 610 | {
|
| 615 | - if(!$child_node->hasAttribute('pipe'))
|
|
| 611 | + if (!$child_node->hasAttribute('pipe'))
|
|
| 616 | 612 | {
|
| 617 | 613 | throw |
| 618 | 614 | new XmlSchemaError( |
@@ -626,19 +622,19 @@ discard block |
||
| 626 | 622 | } |
| 627 | 623 | |
| 628 | 624 | // recurse in condition groups/queries |
| 629 | - if($child_node->tagName == 'group') |
|
| 625 | + if ($child_node->tagName == 'group') |
|
| 630 | 626 | {
|
| 631 | 627 | checkConditionsGroup($xml_file, $child_node); |
| 632 | 628 | } |
| 633 | 629 | else |
| 634 | 630 | {
|
| 635 | - if($child_node->tagName == 'query') |
|
| 631 | + if ($child_node->tagName == 'query') |
|
| 636 | 632 | {
|
| 637 | 633 | validate_select_query($xml_file, $child_node); |
| 638 | 634 | } |
| 639 | 635 | else |
| 640 | 636 | {
|
| 641 | - if($child_node->tagName == 'condition') |
|
| 637 | + if ($child_node->tagName == 'condition') |
|
| 642 | 638 | {
|
| 643 | 639 | checkConditionElement($xml_file, $child_node); |
| 644 | 640 | } |
@@ -664,12 +660,11 @@ discard block |
||
| 664 | 660 | */ |
| 665 | 661 | function checkNavigationClauses($xml_file, $navigation_element) |
| 666 | 662 | {
|
| 667 | - foreach(array('list_count', 'page_count', 'page')
|
|
| 663 | + foreach (array('list_count', 'page_count', 'page')
|
|
| 668 | 664 | as |
| 669 | 665 | $navigation_el) |
| 670 | 666 | {
|
| 671 | - checkDuplicateDescendants |
|
| 672 | - ( |
|
| 667 | + checkDuplicateDescendants( |
|
| 673 | 668 | $xml_file, |
| 674 | 669 | $navigation_element, |
| 675 | 670 | $navigation_el |
@@ -693,11 +688,11 @@ discard block |
||
| 693 | 688 | */ |
| 694 | 689 | function validate_select_query($xml_file, $query_element) |
| 695 | 690 | {
|
| 696 | - foreach($query_element->childNodes as $select_clause) |
|
| 691 | + foreach ($query_element->childNodes as $select_clause) |
|
| 697 | 692 | {
|
| 698 | - if($select_clause->nodeType == XML_ELEMENT_NODE) |
|
| 693 | + if ($select_clause->nodeType == XML_ELEMENT_NODE) |
|
| 699 | 694 | {
|
| 700 | - switch($select_clause->tagName) |
|
| 695 | + switch ($select_clause->tagName) |
|
| 701 | 696 | {
|
| 702 | 697 | case 'columns': |
| 703 | 698 | checkSelectListClause($xml_file, $select_clause); |
@@ -728,11 +723,11 @@ discard block |
||
| 728 | 723 | */ |
| 729 | 724 | function validate_update_query($xml_file, $query_element) |
| 730 | 725 | {
|
| 731 | - foreach($query_element->childNodes as $update_clause) |
|
| 726 | + foreach ($query_element->childNodes as $update_clause) |
|
| 732 | 727 | {
|
| 733 | - if($update_clause->nodeType == XML_ELEMENT_NODE) |
|
| 728 | + if ($update_clause->nodeType == XML_ELEMENT_NODE) |
|
| 734 | 729 | {
|
| 735 | - switch($update_clause->tagName) |
|
| 730 | + switch ($update_clause->tagName) |
|
| 736 | 731 | {
|
| 737 | 732 | case 'tables': |
| 738 | 733 | checkTablesClause($xml_file, $update_clause); |
@@ -755,11 +750,11 @@ discard block |
||
| 755 | 750 | */ |
| 756 | 751 | function validate_delete_query($xml_file, $query_element) |
| 757 | 752 | {
|
| 758 | - foreach($query_element->childNodes as $delete_clause) |
|
| 753 | + foreach ($query_element->childNodes as $delete_clause) |
|
| 759 | 754 | {
|
| 760 | - if($delete_clause->nodeType == XML_ELEMENT_NODE) |
|
| 755 | + if ($delete_clause->nodeType == XML_ELEMENT_NODE) |
|
| 761 | 756 | {
|
| 762 | - switch($delete_clause->tagName) |
|
| 757 | + switch ($delete_clause->tagName) |
|
| 763 | 758 | {
|
| 764 | 759 | case 'conditions': |
| 765 | 760 | checkConditionsGroup($xml_file, $delete_clause); |
@@ -778,11 +773,11 @@ discard block |
||
| 778 | 773 | */ |
| 779 | 774 | function validate_insert_select_query($xml_file, $query_element) |
| 780 | 775 | {
|
| 781 | - foreach($query_element->childNodes as $statement_clause) |
|
| 776 | + foreach ($query_element->childNodes as $statement_clause) |
|
| 782 | 777 | {
|
| 783 | - if($statement_clause->nodeType == XML_ELEMENT_NODE) |
|
| 778 | + if ($statement_clause->nodeType == XML_ELEMENT_NODE) |
|
| 784 | 779 | {
|
| 785 | - switch($statement_clause->tagName) |
|
| 780 | + switch ($statement_clause->tagName) |
|
| 786 | 781 | {
|
| 787 | 782 | case 'query': |
| 788 | 783 | validate_select_query($xml_file, $statement_clause); |
@@ -793,8 +788,7 @@ discard block |
||
| 793 | 788 | } |
| 794 | 789 | |
| 795 | 790 | $validate_query_type = |
| 796 | - array |
|
| 797 | - ( |
|
| 791 | + array( |
|
| 798 | 792 | // 'insert' => |
| 799 | 793 | // there is currently nothing special to check |
| 800 | 794 | // for a plain insert, all the needed checks |
@@ -818,13 +812,13 @@ discard block |
||
| 818 | 812 | |
| 819 | 813 | $action = $query_element->getAttribute('action');
|
| 820 | 814 | |
| 821 | - if(array_key_exists($action, $validate_query_type)) |
|
| 815 | + if (array_key_exists($action, $validate_query_type)) |
|
| 822 | 816 | {
|
| 823 | 817 | $validate_query_type[$action]($xml_file, $query_element); |
| 824 | 818 | } |
| 825 | 819 | } |
| 826 | 820 | |
| 827 | -if(strpos(PHP_SAPI, 'cli') !== FALSE |
|
| 821 | +if (strpos(PHP_SAPI, 'cli') !== FALSE |
|
| 828 | 822 | || |
| 829 | 823 | strpos(PHP_SAPI, 'cgi') !== FALSE) |
| 830 | 824 | {
|
@@ -857,7 +851,7 @@ discard block |
||
| 857 | 851 | print "Failed to restore working dir {$this->dirname}.";
|
| 858 | 852 | } |
| 859 | 853 | |
| 860 | - if(!$success) |
|
| 854 | + if (!$success) |
|
| 861 | 855 | {
|
| 862 | 856 | print "Failed to restore working dir {$this->dirname}.";
|
| 863 | 857 | } |
@@ -873,7 +867,7 @@ discard block |
||
| 873 | 867 | {
|
| 874 | 868 | $this->dirname = getcwd(); |
| 875 | 869 | |
| 876 | - if(!$this->dirname) |
|
| 870 | + if (!$this->dirname) |
|
| 877 | 871 | {
|
| 878 | 872 | throw new ErrorMessage("Failed to get current directory.");
|
| 879 | 873 | } |
@@ -903,7 +897,7 @@ discard block |
||
| 903 | 897 | $lowercase_name = strtolower($xml_path_info['basename']); |
| 904 | 898 | $uppercase_name = strtoupper($xml_path_info['basename']); |
| 905 | 899 | |
| 906 | - if(strlen($lowercase_name) != $filename_len |
|
| 900 | + if (strlen($lowercase_name) != $filename_len |
|
| 907 | 901 | || |
| 908 | 902 | strlen($uppercase_name) != $filename_len) |
| 909 | 903 | {
|
@@ -916,9 +910,9 @@ discard block |
||
| 916 | 910 | |
| 917 | 911 | $varing_case_filename = ''; |
| 918 | 912 | |
| 919 | - for($i = 0; $i < $filename_len; $i++) |
|
| 913 | + for ($i = 0; $i < $filename_len; $i++) |
|
| 920 | 914 | {
|
| 921 | - if($lowercase_name[$i] != $uppercase_name[$i]) |
|
| 915 | + if ($lowercase_name[$i] != $uppercase_name[$i]) |
|
| 922 | 916 | {
|
| 923 | 917 | $varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]";
|
| 924 | 918 | } |
@@ -932,13 +926,13 @@ discard block |
||
| 932 | 926 | |
| 933 | 927 | $restoreWorkDir = new RestoreWorkDir(); |
| 934 | 928 | |
| 935 | - if($glob_pattern) |
|
| 929 | + if ($glob_pattern) |
|
| 936 | 930 | {
|
| 937 | 931 | // change current dir to the xml file directory to keep |
| 938 | 932 | // glob pattern shorter (maximum 260 chars). |
| 939 | 933 | $success = chdir($glob_pattern); |
| 940 | 934 | |
| 941 | - if(!$success) |
|
| 935 | + if (!$success) |
|
| 942 | 936 | {
|
| 943 | 937 | throw new ErrorMessage("Failed to change work dir to {$glob_pattern}.");
|
| 944 | 938 | } |
@@ -950,14 +944,14 @@ discard block |
||
| 950 | 944 | // realpath() would have the same effect, but it is not documented as such |
| 951 | 945 | $matched_files = glob($glob_pattern, GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR); |
| 952 | 946 | |
| 953 | - unset($RestoreWorkDir); // restore work dir after call to glob() |
|
| 947 | + unset($RestoreWorkDir); // restore work dir after call to glob() |
|
| 954 | 948 | |
| 955 | - if($matched_files === FALSE || !is_array($matched_files)) |
|
| 949 | + if ($matched_files === FALSE || !is_array($matched_files)) |
|
| 956 | 950 | {
|
| 957 | 951 | throw new ErrorMessage("Directory listing for $xml_file failed.");
|
| 958 | 952 | } |
| 959 | 953 | |
| 960 | - switch(count($matched_files)) |
|
| 954 | + switch (count($matched_files)) |
|
| 961 | 955 | {
|
| 962 | 956 | case 0: |
| 963 | 957 | throw new ErrorMessage("Directory listing for $xml_file failed.");
|
@@ -968,9 +962,9 @@ discard block |
||
| 968 | 962 | default: |
| 969 | 963 | // more than one files with the same name and different case |
| 970 | 964 | // case-sensitive file system |
| 971 | - foreach($mached_files as $matched_file) |
|
| 965 | + foreach ($mached_files as $matched_file) |
|
| 972 | 966 | {
|
| 973 | - if(pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename']) |
|
| 967 | + if (pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename']) |
|
| 974 | 968 | {
|
| 975 | 969 | return ($xml_path_info['filename'] == $query_id); |
| 976 | 970 | } |
@@ -979,7 +973,7 @@ discard block |
||
| 979 | 973 | |
| 980 | 974 | } |
| 981 | 975 | |
| 982 | - throw new ErrorMessage("Internal application error."); // unreachable
|
|
| 976 | + throw new ErrorMessage("Internal application error."); // unreachable
|
|
| 983 | 977 | } |
| 984 | 978 | |
| 985 | 979 | /** |
@@ -1000,9 +994,9 @@ discard block |
||
| 1000 | 994 | */ |
| 1001 | 995 | function validate_schema_doc($xml_file, $table_element) |
| 1002 | 996 | {
|
| 1003 | - foreach($table_element->childNodes as $col_node) |
|
| 997 | + foreach ($table_element->childNodes as $col_node) |
|
| 1004 | 998 | {
|
| 1005 | - if($col_node->nodeType == XML_ELEMENT_NODE |
|
| 999 | + if ($col_node->nodeType == XML_ELEMENT_NODE |
|
| 1006 | 1000 | && |
| 1007 | 1001 | $col_node->tagName == 'column') |
| 1008 | 1002 | {
|
@@ -1010,12 +1004,11 @@ discard block |
||
| 1010 | 1004 | $col_size = NULL; |
| 1011 | 1005 | |
| 1012 | 1006 | // check auto-increment column |
| 1013 | - if($col_node->hasAttribute('auto_increment'))
|
|
| 1007 | + if ($col_node->hasAttribute('auto_increment'))
|
|
| 1014 | 1008 | {
|
| 1015 | - fwrite |
|
| 1016 | - ( |
|
| 1009 | + fwrite( |
|
| 1017 | 1010 | fopen('php://stdout', 'wt'),
|
| 1018 | - $xml_file . '(' . $col_node->getLineNo() . ")\n\t"
|
|
| 1011 | + $xml_file.'('.$col_node->getLineNo().")\n\t"
|
|
| 1019 | 1012 | . |
| 1020 | 1013 | "<column>: attribute 'auto_increment' is currently supported only by SQL Server and mysql backends.\n" |
| 1021 | 1014 | ); |
@@ -1023,7 +1016,7 @@ discard block |
||
| 1023 | 1016 | static |
| 1024 | 1017 | $autoinc_types = array('number', 'bignumber');
|
| 1025 | 1018 | |
| 1026 | - if(!in_array($col_type, $autoinc_types)) |
|
| 1019 | + if (!in_array($col_type, $autoinc_types)) |
|
| 1027 | 1020 | {
|
| 1028 | 1021 | throw |
| 1029 | 1022 | new XmlSchemaError( |
@@ -1031,30 +1024,29 @@ discard block |
||
| 1031 | 1024 | $col_node->getLineNo(), |
| 1032 | 1025 | "<column>: attribute 'auto_increment' only expected for one of the following types: " |
| 1033 | 1026 | . |
| 1034 | - implode(', ', $autoinc_types) . '.'
|
|
| 1027 | + implode(', ', $autoinc_types).'.'
|
|
| 1035 | 1028 | ); |
| 1036 | 1029 | } |
| 1037 | 1030 | } |
| 1038 | 1031 | |
| 1039 | 1032 | // check tinytext |
| 1040 | - if($col_type == 'tinytext') |
|
| 1033 | + if ($col_type == 'tinytext') |
|
| 1041 | 1034 | {
|
| 1042 | - fwrite |
|
| 1043 | - ( |
|
| 1035 | + fwrite( |
|
| 1044 | 1036 | fopen('php://stdout', 'wt'),
|
| 1045 | - $xml_file . '(' . $col_node->getLineNo() . ")\n\t"
|
|
| 1037 | + $xml_file.'('.$col_node->getLineNo().")\n\t"
|
|
| 1046 | 1038 | . |
| 1047 | 1039 | "<column>: type \"tinytext\" is supported only by CUBRID.\n" |
| 1048 | 1040 | ); |
| 1049 | 1041 | } |
| 1050 | 1042 | |
| 1051 | 1043 | // check size attribute |
| 1052 | - if($col_node->hasAttribute('size'))
|
|
| 1044 | + if ($col_node->hasAttribute('size'))
|
|
| 1053 | 1045 | {
|
| 1054 | 1046 | $col_size = $col_node->getAttribute('size');
|
| 1055 | 1047 | } |
| 1056 | 1048 | |
| 1057 | - if($col_type == 'varchar' && $col_size === NULL) |
|
| 1049 | + if ($col_type == 'varchar' && $col_size === NULL) |
|
| 1058 | 1050 | {
|
| 1059 | 1051 | throw |
| 1060 | 1052 | new XmlSchemaError( |
@@ -1068,7 +1060,7 @@ discard block |
||
| 1068 | 1060 | $varsize_types = array('char', 'varchar', 'float');
|
| 1069 | 1061 | |
| 1070 | 1062 | |
| 1071 | - if($col_size !== NULL && !in_array($col_type, $varsize_types)) |
|
| 1063 | + if ($col_size !== NULL && !in_array($col_type, $varsize_types)) |
|
| 1072 | 1064 | {
|
| 1073 | 1065 | throw |
| 1074 | 1066 | new XmlSchemaError( |
@@ -1076,7 +1068,7 @@ discard block |
||
| 1076 | 1068 | $col_node->getLineNo(), |
| 1077 | 1069 | "<column>: 'size' attribute only expected for the following types: " |
| 1078 | 1070 | . |
| 1079 | - implode(', ', $varsize_types) . "."
|
|
| 1071 | + implode(', ', $varsize_types)."."
|
|
| 1080 | 1072 | ); |
| 1081 | 1073 | } |
| 1082 | 1074 | } |
@@ -1102,8 +1094,8 @@ discard block |
||
| 1102 | 1094 | const RETCODE_GENERIC_XML_SYNTAX = 50; |
| 1103 | 1095 | const RETCODE_QUERY_ELEMENT = 40; |
| 1104 | 1096 | const RETCODE_XSD_VALIDATION = 30; |
| 1105 | - const RETCODE_BUILTIN_CHECKS = 20; |
|
| 1106 | - const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented. |
|
| 1097 | + const RETCODE_BUILTIN_CHECKS = 20; |
|
| 1098 | + const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented. |
|
| 1107 | 1099 | const RETCODE_SUCCESS = 0; |
| 1108 | 1100 | |
| 1109 | 1101 | |
@@ -1116,13 +1108,13 @@ discard block |
||
| 1116 | 1108 | */ |
| 1117 | 1109 | public function code($val = -1) |
| 1118 | 1110 | {
|
| 1119 | - if($val == -1) |
|
| 1111 | + if ($val == -1) |
|
| 1120 | 1112 | {
|
| 1121 | 1113 | return $this->exit_code; |
| 1122 | 1114 | } |
| 1123 | 1115 | else |
| 1124 | 1116 | {
|
| 1125 | - if($this->exit_code < $val) |
|
| 1117 | + if ($this->exit_code < $val) |
|
| 1126 | 1118 | {
|
| 1127 | 1119 | $this->exit_code = $val; |
| 1128 | 1120 | } |
@@ -1184,7 +1176,7 @@ discard block |
||
| 1184 | 1176 | */ |
| 1185 | 1177 | public function __destruct() |
| 1186 | 1178 | {
|
| 1187 | - if($this->file_name) |
|
| 1179 | + if ($this->file_name) |
|
| 1188 | 1180 | {
|
| 1189 | 1181 | unlink($this->file_name); |
| 1190 | 1182 | $this->file_name = NULL; |
@@ -1214,12 +1206,12 @@ discard block |
||
| 1214 | 1206 | $cmdname = CMD_NAME; |
| 1215 | 1207 | |
| 1216 | 1208 | // php manual says resources should not normally be declared constant |
| 1217 | - if(!defined('STDERR'))
|
|
| 1209 | + if (!defined('STDERR'))
|
|
| 1218 | 1210 | {
|
| 1219 | 1211 | define('STDERR', fopen('php://stderr', 'wt'));
|
| 1220 | 1212 | } |
| 1221 | 1213 | |
| 1222 | - if(!defined('__DIR__'))
|
|
| 1214 | + if (!defined('__DIR__'))
|
|
| 1223 | 1215 | {
|
| 1224 | 1216 | define('__DIR__', dirname(__FILE__));
|
| 1225 | 1217 | } |
@@ -1234,7 +1226,7 @@ discard block |
||
| 1234 | 1226 | $query_args = NULL; |
| 1235 | 1227 | $query_args_file = NULL; |
| 1236 | 1228 | |
| 1237 | - while($argc >= 2 && $argv[1][0] == '-') |
|
| 1229 | + while ($argc >= 2 && $argv[1][0] == '-') |
|
| 1238 | 1230 | {
|
| 1239 | 1231 | $option = $argv[1]; |
| 1240 | 1232 | |
@@ -1242,17 +1234,17 @@ discard block |
||
| 1242 | 1234 | $argv = array_values($argv); |
| 1243 | 1235 | $argc = count($argv); |
| 1244 | 1236 | |
| 1245 | - switch($option) |
|
| 1237 | + switch ($option) |
|
| 1246 | 1238 | {
|
| 1247 | 1239 | case '-s': |
| 1248 | 1240 | case '--schema': |
| 1249 | 1241 | case '--schema-language': |
| 1250 | - if($query_args !== NULL) |
|
| 1242 | + if ($query_args !== NULL) |
|
| 1251 | 1243 | {
|
| 1252 | 1244 | throw new SyntaxError("Both --args-string and --schema-language options given.");
|
| 1253 | 1245 | } |
| 1254 | 1246 | |
| 1255 | - if($query_args_file !== NULL) |
|
| 1247 | + if ($query_args_file !== NULL) |
|
| 1256 | 1248 | {
|
| 1257 | 1249 | throw new SyntaxError("Both --args-file and --schema-language options given.");
|
| 1258 | 1250 | } |
@@ -1272,7 +1264,7 @@ discard block |
||
| 1272 | 1264 | |
| 1273 | 1265 | case '--xe-path': |
| 1274 | 1266 | case '--xe': |
| 1275 | - if($argc < 2) |
|
| 1267 | + if ($argc < 2) |
|
| 1276 | 1268 | {
|
| 1277 | 1269 | throw |
| 1278 | 1270 | new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`");
|
@@ -1290,17 +1282,17 @@ discard block |
||
| 1290 | 1282 | case '--args-string': |
| 1291 | 1283 | case '--arguments': |
| 1292 | 1284 | case '--args': |
| 1293 | - if($schema_language !== NULL) |
|
| 1285 | + if ($schema_language !== NULL) |
|
| 1294 | 1286 | {
|
| 1295 | 1287 | throw new SyntaxError("Both --schema-language and --args-string options given.");
|
| 1296 | 1288 | } |
| 1297 | 1289 | |
| 1298 | - if($query_args_file !== NULL) |
|
| 1290 | + if ($query_args_file !== NULL) |
|
| 1299 | 1291 | {
|
| 1300 | 1292 | throw new SyntaxError("Both --args-string and --args-file options given.");
|
| 1301 | 1293 | } |
| 1302 | 1294 | |
| 1303 | - if($argc < 2) |
|
| 1295 | + if ($argc < 2) |
|
| 1304 | 1296 | {
|
| 1305 | 1297 | throw |
| 1306 | 1298 | new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`");
|
@@ -1316,17 +1308,17 @@ discard block |
||
| 1316 | 1308 | |
| 1317 | 1309 | case '--arguments-file': |
| 1318 | 1310 | case '--args-file': |
| 1319 | - if($schema_language !== NULL) |
|
| 1311 | + if ($schema_language !== NULL) |
|
| 1320 | 1312 | {
|
| 1321 | 1313 | throw new SyntaxError("Both --schema-language and --args-file options given.");
|
| 1322 | 1314 | } |
| 1323 | 1315 | |
| 1324 | - if($query_args !== NULL) |
|
| 1316 | + if ($query_args !== NULL) |
|
| 1325 | 1317 | {
|
| 1326 | 1318 | throw new SyntaxError("Both --args-string and --args-file options given.");
|
| 1327 | 1319 | } |
| 1328 | 1320 | |
| 1329 | - if($argc < 2) |
|
| 1321 | + if ($argc < 2) |
|
| 1330 | 1322 | {
|
| 1331 | 1323 | throw |
| 1332 | 1324 | new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`");
|
@@ -1357,7 +1349,7 @@ discard block |
||
| 1357 | 1349 | } |
| 1358 | 1350 | } |
| 1359 | 1351 | |
| 1360 | - if($argc < 2 || |
|
| 1352 | + if ($argc < 2 || |
|
| 1361 | 1353 | ( |
| 1362 | 1354 | $argc == 2 |
| 1363 | 1355 | && |
@@ -1366,48 +1358,48 @@ discard block |
||
| 1366 | 1358 | {
|
| 1367 | 1359 | throw |
| 1368 | 1360 | new SyntaxError( |
| 1369 | - "Validates an XML document against a given schema definition (XSD), using the standard php library.\n" . |
|
| 1370 | - "Syntax:\n" . |
|
| 1371 | - " {$cmdname} schema.xsd document.xml...\n" .
|
|
| 1372 | - " {$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n" .
|
|
| 1373 | - "Where:\n" . |
|
| 1374 | - " --schema-language\n" . |
|
| 1375 | - " --schema\n" . |
|
| 1376 | - " -s\n" . |
|
| 1377 | - " If given, the document(s) are validated against XE XML Schema Language,\n" . |
|
| 1378 | - " otherwise document(s) are validated against XE XML Query Language.\n" . |
|
| 1379 | - "\n" . |
|
| 1380 | - " --skip-query-id\n" . |
|
| 1381 | - " Do not check the query id, which should normally match the file name.\n" . |
|
| 1382 | - "\n" . |
|
| 1383 | - " --xe-path\n" . |
|
| 1384 | - " --xe\n" . |
|
| 1385 | - " Path to XE installation. Used to load the database-specific parsers to generate\n" . |
|
| 1386 | - " SQL from the XML language files.\n" . |
|
| 1387 | - "\n" . |
|
| 1388 | - " --validate-only\n" . |
|
| 1389 | - " Only check XML schemas, no SQL generated with the database-specific parsers.\n" . |
|
| 1390 | - "\n" . |
|
| 1391 | - " --args-string \" 'name' => 'val..', 'name' => 'val...' \"\n" . |
|
| 1392 | - " --args-file args/file/name.php\n" . |
|
| 1393 | - " Variables and values for the query, if it has any (only for XML Query Language).\n" . |
|
| 1394 | - " Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n" . |
|
| 1395 | - " array constructor. The validator script will directly eval()/include() this content.\n" . |
|
| 1396 | - " The file named with --args-file should include an array() constructor around the\n" . |
|
| 1397 | - " name-value list, and should immediately return it, without a named array variable.\n" . |
|
| 1398 | - " E.g.:\n" . |
|
| 1399 | - " return \n" . |
|
| 1400 | - " array\n" . |
|
| 1401 | - " (\n" . |
|
| 1402 | - " 'name' => 'val',\n" . |
|
| 1403 | - " 'name' => 'val',\n" . |
|
| 1404 | - " ...\n" . |
|
| 1405 | - " );\n" . |
|
| 1406 | - "\n" . |
|
| 1407 | - " schema.xsd if given, is the file name for the schema definition to validate the\n" . |
|
| 1408 | - " document against\n" . |
|
| 1409 | - "\n" . |
|
| 1410 | - " document.xml is the file name for the XML document to be validated against the schema.\n" . |
|
| 1361 | + "Validates an XML document against a given schema definition (XSD), using the standard php library.\n". |
|
| 1362 | + "Syntax:\n". |
|
| 1363 | + " {$cmdname} schema.xsd document.xml...\n".
|
|
| 1364 | + " {$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n".
|
|
| 1365 | + "Where:\n". |
|
| 1366 | + " --schema-language\n". |
|
| 1367 | + " --schema\n". |
|
| 1368 | + " -s\n". |
|
| 1369 | + " If given, the document(s) are validated against XE XML Schema Language,\n". |
|
| 1370 | + " otherwise document(s) are validated against XE XML Query Language.\n". |
|
| 1371 | + "\n". |
|
| 1372 | + " --skip-query-id\n". |
|
| 1373 | + " Do not check the query id, which should normally match the file name.\n". |
|
| 1374 | + "\n". |
|
| 1375 | + " --xe-path\n". |
|
| 1376 | + " --xe\n". |
|
| 1377 | + " Path to XE installation. Used to load the database-specific parsers to generate\n". |
|
| 1378 | + " SQL from the XML language files.\n". |
|
| 1379 | + "\n". |
|
| 1380 | + " --validate-only\n". |
|
| 1381 | + " Only check XML schemas, no SQL generated with the database-specific parsers.\n". |
|
| 1382 | + "\n". |
|
| 1383 | + " --args-string \" 'name' => 'val..', 'name' => 'val...' \"\n". |
|
| 1384 | + " --args-file args/file/name.php\n". |
|
| 1385 | + " Variables and values for the query, if it has any (only for XML Query Language).\n". |
|
| 1386 | + " Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n". |
|
| 1387 | + " array constructor. The validator script will directly eval()/include() this content.\n". |
|
| 1388 | + " The file named with --args-file should include an array() constructor around the\n". |
|
| 1389 | + " name-value list, and should immediately return it, without a named array variable.\n". |
|
| 1390 | + " E.g.:\n". |
|
| 1391 | + " return \n". |
|
| 1392 | + " array\n". |
|
| 1393 | + " (\n". |
|
| 1394 | + " 'name' => 'val',\n". |
|
| 1395 | + " 'name' => 'val',\n". |
|
| 1396 | + " ...\n". |
|
| 1397 | + " );\n". |
|
| 1398 | + "\n". |
|
| 1399 | + " schema.xsd if given, is the file name for the schema definition to validate the\n". |
|
| 1400 | + " document against\n". |
|
| 1401 | + "\n". |
|
| 1402 | + " document.xml is the file name for the XML document to be validated against the schema.\n". |
|
| 1411 | 1403 | " Multiple .xml files can be given.\n" |
| 1412 | 1404 | ); |
| 1413 | 1405 | } |
@@ -1415,23 +1407,23 @@ discard block |
||
| 1415 | 1407 | $query_user_args = array(); |
| 1416 | 1408 | |
| 1417 | 1409 | // check $xe_path, $query_args |
| 1418 | - if(!$validate_only) |
|
| 1410 | + if (!$validate_only) |
|
| 1419 | 1411 | {
|
| 1420 | - if($xe_path == NULL) |
|
| 1412 | + if ($xe_path == NULL) |
|
| 1421 | 1413 | {
|
| 1422 | 1414 | // assume validator.php is in directory .../xe/tools/dbxml_validator/ in an XE installation |
| 1423 | 1415 | $xe_path = dirname(dirname(realpath(__DIR__))); |
| 1424 | 1416 | } |
| 1425 | 1417 | |
| 1426 | - if(!file_exists($xe_path . '/index.php')) |
|
| 1418 | + if (!file_exists($xe_path.'/index.php')) |
|
| 1427 | 1419 | {
|
| 1428 | 1420 | throw |
| 1429 | 1421 | new ErrorMessage("File index.php not found in {$xe_path}.");
|
| 1430 | 1422 | } |
| 1431 | 1423 | |
| 1432 | - if(!defined('_XE_PATH_'))
|
|
| 1424 | + if (!defined('_XE_PATH_'))
|
|
| 1433 | 1425 | {
|
| 1434 | - define('_XE_PATH_', $xe_path . '/');
|
|
| 1426 | + define('_XE_PATH_', $xe_path.'/');
|
|
| 1435 | 1427 | } |
| 1436 | 1428 | |
| 1437 | 1429 | /** |
@@ -1485,7 +1477,7 @@ discard block |
||
| 1485 | 1477 | */ |
| 1486 | 1478 | public static function getDBType() |
| 1487 | 1479 | {
|
| 1488 | - if(self::$db_info) |
|
| 1480 | + if (self::$db_info) |
|
| 1489 | 1481 | {
|
| 1490 | 1482 | return self::$db_info->master_db['db_type']; |
| 1491 | 1483 | } |
@@ -1538,10 +1530,9 @@ discard block |
||
| 1538 | 1530 | */ |
| 1539 | 1531 | public static function setNoDBInfo() |
| 1540 | 1532 | {
|
| 1541 | - $db_info = (object)NULL; |
|
| 1533 | + $db_info = (object) NULL; |
|
| 1542 | 1534 | $db_info->master_db = |
| 1543 | - array |
|
| 1544 | - ( |
|
| 1535 | + array( |
|
| 1545 | 1536 | 'db_type' => NULL, |
| 1546 | 1537 | 'db_hostname' => NULL, |
| 1547 | 1538 | 'db_port' => NULL, |
@@ -1565,10 +1556,9 @@ discard block |
||
| 1565 | 1556 | */ |
| 1566 | 1557 | public static function setMysqlDBInfo() |
| 1567 | 1558 | {
|
| 1568 | - $db_info = (object)NULL; |
|
| 1559 | + $db_info = (object) NULL; |
|
| 1569 | 1560 | $db_info->master_db = |
| 1570 | - array |
|
| 1571 | - ( |
|
| 1561 | + array( |
|
| 1572 | 1562 | 'db_type' => 'mysql', |
| 1573 | 1563 | 'db_hostname' => NULL, |
| 1574 | 1564 | 'db_port' => NULL, |
@@ -1584,7 +1574,7 @@ discard block |
||
| 1584 | 1574 | |
| 1585 | 1575 | self::setDBInfo($db_info); |
| 1586 | 1576 | |
| 1587 | - if(array_key_exists('__DB__', $GLOBALS)
|
|
| 1577 | + if (array_key_exists('__DB__', $GLOBALS)
|
|
| 1588 | 1578 | && |
| 1589 | 1579 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1590 | 1580 | {
|
@@ -1607,10 +1597,9 @@ discard block |
||
| 1607 | 1597 | */ |
| 1608 | 1598 | public static function setMysqliDBInfo() |
| 1609 | 1599 | {
|
| 1610 | - $db_info = (object)NULL; |
|
| 1600 | + $db_info = (object) NULL; |
|
| 1611 | 1601 | $db_info->master_db = |
| 1612 | - array |
|
| 1613 | - ( |
|
| 1602 | + array( |
|
| 1614 | 1603 | 'db_type' => 'mysqli', |
| 1615 | 1604 | 'db_hostname' => NULL, |
| 1616 | 1605 | 'db_port' => NULL, |
@@ -1626,7 +1615,7 @@ discard block |
||
| 1626 | 1615 | |
| 1627 | 1616 | self::setDBInfo($db_info); |
| 1628 | 1617 | |
| 1629 | - if(array_key_exists('__DB__', $GLOBALS)
|
|
| 1618 | + if (array_key_exists('__DB__', $GLOBALS)
|
|
| 1630 | 1619 | && |
| 1631 | 1620 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1632 | 1621 | {
|
@@ -1649,10 +1638,9 @@ discard block |
||
| 1649 | 1638 | */ |
| 1650 | 1639 | public static function setCubridDBInfo() |
| 1651 | 1640 | {
|
| 1652 | - $db_info = (object)NULL; |
|
| 1641 | + $db_info = (object) NULL; |
|
| 1653 | 1642 | $db_info->master_db = |
| 1654 | - array |
|
| 1655 | - ( |
|
| 1643 | + array( |
|
| 1656 | 1644 | 'db_type' => 'cubrid', |
| 1657 | 1645 | 'db_hostname' => NULL, |
| 1658 | 1646 | 'db_port' => NULL, |
@@ -1668,7 +1656,7 @@ discard block |
||
| 1668 | 1656 | |
| 1669 | 1657 | self::setDBInfo($db_info); |
| 1670 | 1658 | |
| 1671 | - if(array_key_exists('__DB__', $GLOBALS)
|
|
| 1659 | + if (array_key_exists('__DB__', $GLOBALS)
|
|
| 1672 | 1660 | && |
| 1673 | 1661 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1674 | 1662 | {
|
@@ -1691,10 +1679,9 @@ discard block |
||
| 1691 | 1679 | */ |
| 1692 | 1680 | public static function setMssqlDBInfo() |
| 1693 | 1681 | {
|
| 1694 | - $db_info = (object)NULL; |
|
| 1682 | + $db_info = (object) NULL; |
|
| 1695 | 1683 | $db_info->master_db = |
| 1696 | - array |
|
| 1697 | - ( |
|
| 1684 | + array( |
|
| 1698 | 1685 | 'db_type' => 'mssql', |
| 1699 | 1686 | 'db_hostname' => NULL, |
| 1700 | 1687 | 'db_port' => NULL, |
@@ -1710,7 +1697,7 @@ discard block |
||
| 1710 | 1697 | |
| 1711 | 1698 | self::setDBInfo($db_info); |
| 1712 | 1699 | |
| 1713 | - if(array_key_exists('__DB__', $GLOBALS)
|
|
| 1700 | + if (array_key_exists('__DB__', $GLOBALS)
|
|
| 1714 | 1701 | && |
| 1715 | 1702 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1716 | 1703 | {
|
@@ -1765,49 +1752,49 @@ discard block |
||
| 1765 | 1752 | } |
| 1766 | 1753 | |
| 1767 | 1754 | global $lang; |
| 1768 | - $lang = new Any_prop_obj_base(); // to return NULL on non-existent properties |
|
| 1755 | + $lang = new Any_prop_obj_base(); // to return NULL on non-existent properties |
|
| 1769 | 1756 | $lang->filter = New LangArgFilterErrorMessage(); |
| 1770 | 1757 | |
| 1771 | - if(!defined('__XE__'))
|
|
| 1758 | + if (!defined('__XE__'))
|
|
| 1772 | 1759 | {
|
| 1773 | 1760 | define('__XE__', TRUE);
|
| 1774 | 1761 | } |
| 1775 | 1762 | |
| 1776 | - if(!defined('__ZBXE__'))
|
|
| 1763 | + if (!defined('__ZBXE__'))
|
|
| 1777 | 1764 | {
|
| 1778 | 1765 | define('__ZBXE__', TRUE);
|
| 1779 | 1766 | } |
| 1780 | 1767 | |
| 1781 | - if(!defined('__DEBUG__'))
|
|
| 1768 | + if (!defined('__DEBUG__'))
|
|
| 1782 | 1769 | {
|
| 1783 | 1770 | define('__DEBUG__', 0);
|
| 1784 | 1771 | } |
| 1785 | 1772 | |
| 1786 | - if(!defined('__DEBUG_QUERY__'))
|
|
| 1773 | + if (!defined('__DEBUG_QUERY__'))
|
|
| 1787 | 1774 | {
|
| 1788 | 1775 | define('__DEBUG_QUERY__', 0);
|
| 1789 | 1776 | } |
| 1790 | 1777 | |
| 1791 | - include(_XE_PATH_ . 'classes/object/BaseObject.class.php'); |
|
| 1792 | - include(_XE_PATH_ . 'classes/handler/Handler.class.php'); |
|
| 1793 | - include(_XE_PATH_ . 'classes/file/FileHandler.class.php'); |
|
| 1794 | - include(_XE_PATH_ . 'classes/page/PageHandler.class.php'); |
|
| 1778 | + include(_XE_PATH_.'classes/object/BaseObject.class.php'); |
|
| 1779 | + include(_XE_PATH_.'classes/handler/Handler.class.php'); |
|
| 1780 | + include(_XE_PATH_.'classes/file/FileHandler.class.php'); |
|
| 1781 | + include(_XE_PATH_.'classes/page/PageHandler.class.php'); |
|
| 1795 | 1782 | |
| 1796 | 1783 | Context::setNoDBInfo(); |
| 1797 | 1784 | |
| 1798 | - require_once(_XE_PATH_ . 'classes/db/DB.class.php'); |
|
| 1799 | - require_once(_XE_PATH_ . 'classes/db/DBMysql.class.php'); |
|
| 1800 | - require_once(_XE_PATH_ . 'classes/db/DBMysqli.class.php'); |
|
| 1801 | - require_once(_XE_PATH_ . 'classes/db/DBMysql_innodb.class.php'); |
|
| 1802 | - require_once(_XE_PATH_ . 'classes/db/DBCubrid.class.php'); |
|
| 1803 | - require_once(_XE_PATH_ . 'classes/db/DBMssql.class.php'); |
|
| 1804 | - require_once(_XE_PATH_ . 'classes/xml/XmlParser.class.php'); |
|
| 1805 | - require_once(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php'); |
|
| 1785 | + require_once(_XE_PATH_.'classes/db/DB.class.php'); |
|
| 1786 | + require_once(_XE_PATH_.'classes/db/DBMysql.class.php'); |
|
| 1787 | + require_once(_XE_PATH_.'classes/db/DBMysqli.class.php'); |
|
| 1788 | + require_once(_XE_PATH_.'classes/db/DBMysql_innodb.class.php'); |
|
| 1789 | + require_once(_XE_PATH_.'classes/db/DBCubrid.class.php'); |
|
| 1790 | + require_once(_XE_PATH_.'classes/db/DBMssql.class.php'); |
|
| 1791 | + require_once(_XE_PATH_.'classes/xml/XmlParser.class.php'); |
|
| 1792 | + require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php'); |
|
| 1806 | 1793 | |
| 1807 | - require_once(__DIR__ . '/connect_wrapper.php'); |
|
| 1794 | + require_once(__DIR__.'/connect_wrapper.php'); |
|
| 1808 | 1795 | |
| 1809 | 1796 | // check $query_args, $query_args_file |
| 1810 | - if($query_args_file) |
|
| 1797 | + if ($query_args_file) |
|
| 1811 | 1798 | {
|
| 1812 | 1799 | try |
| 1813 | 1800 | {
|
@@ -1821,11 +1808,11 @@ discard block |
||
| 1821 | 1808 | } |
| 1822 | 1809 | else |
| 1823 | 1810 | {
|
| 1824 | - if($query_args) |
|
| 1811 | + if ($query_args) |
|
| 1825 | 1812 | {
|
| 1826 | 1813 | try |
| 1827 | 1814 | {
|
| 1828 | - eval('$query_user_args = array(' . $query_args . ');');
|
|
| 1815 | + eval('$query_user_args = array('.$query_args.');');
|
|
| 1829 | 1816 | } |
| 1830 | 1817 | catch (Exception $exc) |
| 1831 | 1818 | {
|
@@ -1841,26 +1828,25 @@ discard block |
||
| 1841 | 1828 | |
| 1842 | 1829 | $schema_file = NULL; |
| 1843 | 1830 | $schemas_set = |
| 1844 | - array |
|
| 1845 | - ( |
|
| 1846 | - 'delete' => __DIR__ . '/xml_delete.xsd', |
|
| 1847 | - 'update' => __DIR__ . '/xml_update.xsd', |
|
| 1848 | - 'select' => __DIR__ . '/xml_select.xsd', |
|
| 1849 | - 'insert' => __DIR__ . '/xml_insert.xsd', |
|
| 1850 | - 'insert-select' => __DIR__ . '/xml_insert_select.xsd' |
|
| 1831 | + array( |
|
| 1832 | + 'delete' => __DIR__.'/xml_delete.xsd', |
|
| 1833 | + 'update' => __DIR__.'/xml_update.xsd', |
|
| 1834 | + 'select' => __DIR__.'/xml_select.xsd', |
|
| 1835 | + 'insert' => __DIR__.'/xml_insert.xsd', |
|
| 1836 | + 'insert-select' => __DIR__.'/xml_insert_select.xsd' |
|
| 1851 | 1837 | ); |
| 1852 | - $table_schema = __DIR__ . '/xml_create_table.xsd'; |
|
| 1838 | + $table_schema = __DIR__.'/xml_create_table.xsd'; |
|
| 1853 | 1839 | |
| 1854 | 1840 | $domDocument = new DOMDocument(); |
| 1855 | 1841 | |
| 1856 | 1842 | $i = 1; |
| 1857 | 1843 | |
| 1858 | - if(pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd') |
|
| 1844 | + if (pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd') |
|
| 1859 | 1845 | {
|
| 1860 | 1846 | $schema_file = $argv[$i++]; |
| 1861 | 1847 | } |
| 1862 | 1848 | |
| 1863 | - for(; $i < count($argv); $i++) |
|
| 1849 | + for (; $i < count($argv); $i++) |
|
| 1864 | 1850 | {
|
| 1865 | 1851 | try |
| 1866 | 1852 | {
|
@@ -1869,7 +1855,7 @@ discard block |
||
| 1869 | 1855 | $use_schema_language = $schema_language; |
| 1870 | 1856 | |
| 1871 | 1857 | $retcode->push(ReturnCode::RETCODE_GENERIC_XML_SYNTAX); |
| 1872 | - if($domDocument->load($argv[$i])) |
|
| 1858 | + if ($domDocument->load($argv[$i])) |
|
| 1873 | 1859 | {
|
| 1874 | 1860 | $retcode->pop(); |
| 1875 | 1861 | |
@@ -1883,7 +1869,7 @@ discard block |
||
| 1883 | 1869 | } |
| 1884 | 1870 | } |
| 1885 | 1871 | |
| 1886 | - if(!$schema_file && !$use_schema_language |
|
| 1872 | + if (!$schema_file && !$use_schema_language |
|
| 1887 | 1873 | && |
| 1888 | 1874 | ( |
| 1889 | 1875 | $queryElement->tagName != 'query' |
@@ -1895,15 +1881,15 @@ discard block |
||
| 1895 | 1881 | |
| 1896 | 1882 | throw |
| 1897 | 1883 | new ErrorMessage( |
| 1898 | - "{$argv[$i]}:" .
|
|
| 1899 | - " Root element should be <query> and should have an action attribute of:" . |
|
| 1900 | - " insert, insert-select, select, update or delete." . |
|
| 1901 | - " Otherwise an explicit schema, to validate the document with, should be" . |
|
| 1884 | + "{$argv[$i]}:".
|
|
| 1885 | + " Root element should be <query> and should have an action attribute of:". |
|
| 1886 | + " insert, insert-select, select, update or delete.". |
|
| 1887 | + " Otherwise an explicit schema, to validate the document with, should be". |
|
| 1902 | 1888 | " specified as first argument on the command line." |
| 1903 | 1889 | ); |
| 1904 | 1890 | } |
| 1905 | 1891 | |
| 1906 | - if(!$schema_file && !$use_schema_language && !$skip_query_id |
|
| 1892 | + if (!$schema_file && !$use_schema_language && !$skip_query_id |
|
| 1907 | 1893 | && |
| 1908 | 1894 | !validate_query_id($argv[$i], $queryElement->getAttribute('id')))
|
| 1909 | 1895 | {
|
@@ -1912,28 +1898,28 @@ discard block |
||
| 1912 | 1898 | |
| 1913 | 1899 | throw |
| 1914 | 1900 | new ErrorMessage( |
| 1915 | - "{$argv[$i]}(" . $queryElement->getLineNo() . "):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name."
|
|
| 1901 | + "{$argv[$i]}(".$queryElement->getLineNo()."):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name."
|
|
| 1916 | 1902 | ); |
| 1917 | 1903 | } |
| 1918 | 1904 | |
| 1919 | - if($use_schema_language) |
|
| 1905 | + if ($use_schema_language) |
|
| 1920 | 1906 | {
|
| 1921 | 1907 | $document_schema = $table_schema; |
| 1922 | 1908 | } |
| 1923 | 1909 | else |
| 1924 | 1910 | {
|
| 1925 | - if(!$document_schema) |
|
| 1911 | + if (!$document_schema) |
|
| 1926 | 1912 | {
|
| 1927 | 1913 | $document_schema = $schemas_set[$queryElement->getAttribute('action')];
|
| 1928 | 1914 | } |
| 1929 | 1915 | } |
| 1930 | 1916 | |
| 1931 | 1917 | $retcode->push(ReturnCode::RETCODE_XSD_VALIDATION); |
| 1932 | - if($domDocument->schemaValidate($document_schema)) |
|
| 1918 | + if ($domDocument->schemaValidate($document_schema)) |
|
| 1933 | 1919 | {
|
| 1934 | 1920 | $retcode->pop(); |
| 1935 | 1921 | |
| 1936 | - if($use_schema_language) |
|
| 1922 | + if ($use_schema_language) |
|
| 1937 | 1923 | {
|
| 1938 | 1924 | validate_schema_doc($argv[$i], $domDocument->documentElement); |
| 1939 | 1925 | } |
@@ -1944,22 +1930,22 @@ discard block |
||
| 1944 | 1930 | $success = TRUE; |
| 1945 | 1931 | } |
| 1946 | 1932 | |
| 1947 | - if(!$validate_only) |
|
| 1933 | + if (!$validate_only) |
|
| 1948 | 1934 | {
|
| 1949 | 1935 | // Generate SQL with the db provider back-ends |
| 1950 | 1936 | |
| 1951 | - if(function_exists('sys_get_temp_dir'))
|
|
| 1937 | + if (function_exists('sys_get_temp_dir'))
|
|
| 1952 | 1938 | {
|
| 1953 | 1939 | $tmpdir = sys_get_temp_dir(); |
| 1954 | 1940 | } |
| 1955 | 1941 | else |
| 1956 | 1942 | {
|
| 1957 | 1943 | $tmpdir = getenv('TEMP');
|
| 1958 | - if(!$tmpdir) |
|
| 1944 | + if (!$tmpdir) |
|
| 1959 | 1945 | {
|
| 1960 | 1946 | $tmpdir = getenv('TMP');
|
| 1961 | 1947 | } |
| 1962 | - if(!$tmpdir) |
|
| 1948 | + if (!$tmpdir) |
|
| 1963 | 1949 | {
|
| 1964 | 1950 | $tmpdir = '/tmp'; |
| 1965 | 1951 | } |
@@ -1968,30 +1954,29 @@ discard block |
||
| 1968 | 1954 | |
| 1969 | 1955 | global $_SERVER; |
| 1970 | 1956 | |
| 1971 | - if(!is_array($_SERVER)) |
|
| 1957 | + if (!is_array($_SERVER)) |
|
| 1972 | 1958 | {
|
| 1973 | 1959 | $_SERVER = array(); |
| 1974 | 1960 | } |
| 1975 | 1961 | |
| 1976 | - if(!array_key_exists('REMOTE_ADDR', $_SERVER))
|
|
| 1962 | + if (!array_key_exists('REMOTE_ADDR', $_SERVER))
|
|
| 1977 | 1963 | {
|
| 1978 | 1964 | $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
| 1979 | 1965 | } |
| 1980 | 1966 | |
| 1981 | 1967 | $set_db_info_methods = |
| 1982 | - array |
|
| 1983 | - ( |
|
| 1968 | + array( |
|
| 1984 | 1969 | 'mysql' => 'setMysqlDBInfo', |
| 1985 | 1970 | 'mysqli' => 'setMysqliDBInfo', |
| 1986 | 1971 | 'cubrid' => 'setCubridDBInfo', |
| 1987 | 1972 | 'mssql' => 'setMssqlDBInfo' |
| 1988 | 1973 | ); |
| 1989 | 1974 | |
| 1990 | - foreach($set_db_info_methods as $db_type => $set_info_method) |
|
| 1975 | + foreach ($set_db_info_methods as $db_type => $set_info_method) |
|
| 1991 | 1976 | {
|
| 1992 | 1977 | Context::$set_info_method(); // calls setMysqlDBInfo()/setCubridDBInfo()/... |
| 1993 | 1978 | |
| 1994 | - if($use_schema_language) |
|
| 1979 | + if ($use_schema_language) |
|
| 1995 | 1980 | {
|
| 1996 | 1981 | $GLOBALS['__DB__'][$db_type]->queries = ''; |
| 1997 | 1982 | $GLOBALS['__DB__'][$db_type]->createTableByXmlFile($argv[$i]); |
@@ -2010,39 +1995,38 @@ discard block |
||
| 2010 | 1995 | // copied from classes/db/DB.class.php |
| 2011 | 1996 | $oParser = new XmlQueryParser(); |
| 2012 | 1997 | $args_array = |
| 2013 | - $oParser->parse_xml_query |
|
| 2014 | - ( |
|
| 1998 | + $oParser->parse_xml_query( |
|
| 2015 | 1999 | pathinfo($argv[$i], PATHINFO_FILENAME), // query id |
| 2016 | - $argv[$i], // xml file |
|
| 2000 | + $argv[$i], // xml file |
|
| 2017 | 2001 | $unlink_tmpfile->file_name // cache file |
| 2018 | 2002 | ); |
| 2019 | 2003 | $args_array = $args_array->queryTag->getArguments(); |
| 2020 | 2004 | |
| 2021 | 2005 | $GLOBALS['__DB__'][$db_type]->queries = ''; |
| 2022 | 2006 | $k = 1; |
| 2023 | - foreach($args_array as $arg) |
|
| 2007 | + foreach ($args_array as $arg) |
|
| 2024 | 2008 | {
|
| 2025 | - if(// why would there be a query arg without a var name ? |
|
| 2009 | + if (// why would there be a query arg without a var name ? |
|
| 2026 | 2010 | isset($arg->variable_name) |
| 2027 | 2011 | && |
| 2028 | 2012 | !array_key_exists($arg->variable_name, $query_user_args)) |
| 2029 | 2013 | {
|
| 2030 | - if(isset($arg->argument_validator)) |
|
| 2014 | + if (isset($arg->argument_validator)) |
|
| 2031 | 2015 | {
|
| 2032 | - if(FALSE // some default values are to be parsed by php, some are not... |
|
| 2016 | + if (FALSE // some default values are to be parsed by php, some are not... |
|
| 2033 | 2017 | && |
| 2034 | 2018 | isset($arg->argument_validator->default_value) |
| 2035 | 2019 | && |
| 2036 | 2020 | isset($arg->argument_validator->default_value->value)) |
| 2037 | 2021 | {
|
| 2038 | 2022 | $query_user_args[$arg->variable_name] = |
| 2039 | - eval('return ' . $arg->argument_validator->default_value->toString() . ';');
|
|
| 2023 | + eval('return '.$arg->argument_validator->default_value->toString().';');
|
|
| 2040 | 2024 | } |
| 2041 | 2025 | else |
| 2042 | 2026 | {
|
| 2043 | - if($arg->argument_validator->filter) |
|
| 2027 | + if ($arg->argument_validator->filter) |
|
| 2044 | 2028 | {
|
| 2045 | - switch($arg->argument_validator->filter) |
|
| 2029 | + switch ($arg->argument_validator->filter) |
|
| 2046 | 2030 | {
|
| 2047 | 2031 | case 'email': |
| 2048 | 2032 | case 'email_address': |
@@ -2081,18 +2065,17 @@ discard block |
||
| 2081 | 2065 | } |
| 2082 | 2066 | } |
| 2083 | 2067 | |
| 2084 | - if(!array_key_exists($arg->variable_name, $query_user_args)) |
|
| 2068 | + if (!array_key_exists($arg->variable_name, $query_user_args)) |
|
| 2085 | 2069 | {
|
| 2086 | 2070 | $query_user_args[$arg->variable_name] = sprintf('%06d', $k);
|
| 2087 | 2071 | } |
| 2088 | 2072 | |
| 2089 | - if(isset($arg->argument_validator)) |
|
| 2073 | + if (isset($arg->argument_validator)) |
|
| 2090 | 2074 | {
|
| 2091 | - if(isset($arg->argument_validator->min_length)) |
|
| 2075 | + if (isset($arg->argument_validator->min_length)) |
|
| 2092 | 2076 | {
|
| 2093 | 2077 | $query_user_args[$arg->variable_name] = |
| 2094 | - str_pad |
|
| 2095 | - ( |
|
| 2078 | + str_pad( |
|
| 2096 | 2079 | $query_user_args[$arg->variable_name], |
| 2097 | 2080 | $arg->argument_validator->min_length, |
| 2098 | 2081 | isset($arg->argument_validator->filter) && |
@@ -2105,11 +2088,10 @@ discard block |
||
| 2105 | 2088 | ); |
| 2106 | 2089 | } |
| 2107 | 2090 | |
| 2108 | - if(isset($arg->argument_validator->max_length)) |
|
| 2091 | + if (isset($arg->argument_validator->max_length)) |
|
| 2109 | 2092 | {
|
| 2110 | 2093 | $query_user_args[$arg->variable_name] = |
| 2111 | - substr |
|
| 2112 | - ( |
|
| 2094 | + substr( |
|
| 2113 | 2095 | $query_user_args[$arg->variable_name], |
| 2114 | 2096 | 0, |
| 2115 | 2097 | $arg->argument_validator->max_length |
@@ -2122,15 +2104,14 @@ discard block |
||
| 2122 | 2104 | } |
| 2123 | 2105 | |
| 2124 | 2106 | $resultset = |
| 2125 | - $GLOBALS['__DB__'][$db_type]->_executeQuery |
|
| 2126 | - ( |
|
| 2127 | - $unlink_tmpfile->file_name, // cache_file |
|
| 2128 | - (object)$query_user_args, // source_args |
|
| 2129 | - basename($argv[$i]), // query_id |
|
| 2107 | + $GLOBALS['__DB__'][$db_type]->_executeQuery( |
|
| 2108 | + $unlink_tmpfile->file_name, // cache_file |
|
| 2109 | + (object) $query_user_args, // source_args |
|
| 2110 | + basename($argv[$i]), // query_id |
|
| 2130 | 2111 | array() // arg_columns |
| 2131 | 2112 | ); |
| 2132 | 2113 | |
| 2133 | - if(is_a($resultset, 'BaseObject') && !$resultset->toBool()) |
|
| 2114 | + if (is_a($resultset, 'BaseObject') && !$resultset->toBool()) |
|
| 2134 | 2115 | {
|
| 2135 | 2116 | throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed'); |
| 2136 | 2117 | } |
@@ -2147,7 +2128,7 @@ discard block |
||
| 2147 | 2128 | } |
| 2148 | 2129 | } |
| 2149 | 2130 | |
| 2150 | - if(!$success) |
|
| 2131 | + if (!$success) |
|
| 2151 | 2132 | {
|
| 2152 | 2133 | libXmlDisplayError($argv[$i], TRUE); |
| 2153 | 2134 | } |
@@ -2156,21 +2137,21 @@ discard block |
||
| 2156 | 2137 | {
|
| 2157 | 2138 | $retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS); |
| 2158 | 2139 | |
| 2159 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
| 2140 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
| 2160 | 2141 | } |
| 2161 | 2142 | catch (ErrorMessage $exc) |
| 2162 | 2143 | {
|
| 2163 | - if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
| 2144 | + if ($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
| 2164 | 2145 | {
|
| 2165 | 2146 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
| 2166 | 2147 | } |
| 2167 | 2148 | |
| 2168 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
| 2149 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
| 2169 | 2150 | libXmlDisplayError($argv[$i]); |
| 2170 | 2151 | } |
| 2171 | 2152 | catch (ErrorException $exc) |
| 2172 | 2153 | {
|
| 2173 | - if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
| 2154 | + if ($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
| 2174 | 2155 | {
|
| 2175 | 2156 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
| 2176 | 2157 | } |
@@ -2183,7 +2164,7 @@ discard block |
||
| 2183 | 2164 | {
|
| 2184 | 2165 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
| 2185 | 2166 | |
| 2186 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
| 2167 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
| 2187 | 2168 | fwrite(STDERR, $exc->getTraceAsString()); |
| 2188 | 2169 | libXmlDisplayError($argv[$i]); |
| 2189 | 2170 | } |
@@ -2193,22 +2174,22 @@ discard block |
||
| 2193 | 2174 | } |
| 2194 | 2175 | catch (SyntaxError $syntax) |
| 2195 | 2176 | {
|
| 2196 | - fwrite(STDERR, $syntax->getMessage() . "\n"); |
|
| 2197 | - exit(254); // wrong command line |
|
| 2177 | + fwrite(STDERR, $syntax->getMessage()."\n"); |
|
| 2178 | + exit(254); // wrong command line |
|
| 2198 | 2179 | // 255 is reserved by php (for parse errors, etc.) |
| 2199 | 2180 | } |
| 2200 | 2181 | catch (ErrorMessage $exc) |
| 2201 | 2182 | {
|
| 2202 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
| 2183 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
| 2203 | 2184 | libXmlDisplayError(); |
| 2204 | - exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
| 2185 | + exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
| 2205 | 2186 | } |
| 2206 | 2187 | catch (Exception $exc) |
| 2207 | 2188 | {
|
| 2208 | - fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n");
|
|
| 2189 | + fwrite(STDERR, $exc->getFile().'('.$exc->getLine().")\n\t".$exc->getMessage()."\n");
|
|
| 2209 | 2190 | fwrite(STDERR, $exc->getTraceAsString()); |
| 2210 | 2191 | libXmlDisplayError(); |
| 2211 | - exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
| 2192 | + exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
| 2212 | 2193 | } |
| 2213 | 2194 | |
| 2214 | 2195 | /* End of file validate.php */ |
@@ -150,13 +150,11 @@ discard block |
||
| 150 | 150 | if($throw_error) |
| 151 | 151 | {
|
| 152 | 152 | throw new ErrorMessage($msg); |
| 153 | - } |
|
| 154 | - else |
|
| 153 | + } else |
|
| 155 | 154 | {
|
| 156 | 155 | fwrite(STDERR, $msg . "\n"); |
| 157 | 156 | } |
| 158 | - } |
|
| 159 | - else |
|
| 157 | + } else |
|
| 160 | 158 | {
|
| 161 | 159 | if($throw_error) |
| 162 | 160 | {
|
@@ -346,8 +344,7 @@ discard block |
||
| 346 | 344 | "\nANSI SQL-99 declares the table specification as required." |
| 347 | 345 | ); |
| 348 | 346 | } |
| 349 | - } |
|
| 350 | - else |
|
| 347 | + } else |
|
| 351 | 348 | {
|
| 352 | 349 | // base table or view |
| 353 | 350 | |
@@ -369,13 +366,11 @@ discard block |
||
| 369 | 366 | $child_node->getLineNo(), |
| 370 | 367 | 'Duplicate <conditions> elements.' |
| 371 | 368 | ); |
| 372 | - } |
|
| 373 | - else |
|
| 369 | + } else |
|
| 374 | 370 | {
|
| 375 | 371 | $has_conditions_element = TRUE; |
| 376 | 372 | } |
| 377 | - } |
|
| 378 | - else |
|
| 373 | + } else |
|
| 379 | 374 | {
|
| 380 | 375 | throw |
| 381 | 376 | new XmlSchemaError( |
@@ -396,8 +391,7 @@ discard block |
||
| 396 | 391 | 'Expected <conditions> element as content.' |
| 397 | 392 | ); |
| 398 | 393 | } |
| 399 | - } |
|
| 400 | - else |
|
| 394 | + } else |
|
| 401 | 395 | {
|
| 402 | 396 | foreach($table_element->childNodes as $child_node) |
| 403 | 397 | {
|
@@ -609,8 +603,7 @@ discard block |
||
| 609 | 603 | if($first_child) |
| 610 | 604 | {
|
| 611 | 605 | $first_child = FALSE; |
| 612 | - } |
|
| 613 | - else |
|
| 606 | + } else |
|
| 614 | 607 | {
|
| 615 | 608 | if(!$child_node->hasAttribute('pipe'))
|
| 616 | 609 | {
|
@@ -629,14 +622,12 @@ discard block |
||
| 629 | 622 | if($child_node->tagName == 'group') |
| 630 | 623 | {
|
| 631 | 624 | checkConditionsGroup($xml_file, $child_node); |
| 632 | - } |
|
| 633 | - else |
|
| 625 | + } else |
|
| 634 | 626 | {
|
| 635 | 627 | if($child_node->tagName == 'query') |
| 636 | 628 | {
|
| 637 | 629 | validate_select_query($xml_file, $child_node); |
| 638 | - } |
|
| 639 | - else |
|
| 630 | + } else |
|
| 640 | 631 | {
|
| 641 | 632 | if($child_node->tagName == 'condition') |
| 642 | 633 | {
|
@@ -851,8 +842,7 @@ discard block |
||
| 851 | 842 | try |
| 852 | 843 | {
|
| 853 | 844 | $success = chdir($this->dirname); |
| 854 | - } |
|
| 855 | - catch (Exception $e) |
|
| 845 | + } catch (Exception $e) |
|
| 856 | 846 | {
|
| 857 | 847 | print "Failed to restore working dir {$this->dirname}.";
|
| 858 | 848 | } |
@@ -921,8 +911,7 @@ discard block |
||
| 921 | 911 | if($lowercase_name[$i] != $uppercase_name[$i]) |
| 922 | 912 | {
|
| 923 | 913 | $varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]";
|
| 924 | - } |
|
| 925 | - else |
|
| 914 | + } else |
|
| 926 | 915 | {
|
| 927 | 916 | $varing_case_filename .= $lowercase_name[$i]; |
| 928 | 917 | } |
@@ -1119,8 +1108,7 @@ discard block |
||
| 1119 | 1108 | if($val == -1) |
| 1120 | 1109 | {
|
| 1121 | 1110 | return $this->exit_code; |
| 1122 | - } |
|
| 1123 | - else |
|
| 1111 | + } else |
|
| 1124 | 1112 | {
|
| 1125 | 1113 | if($this->exit_code < $val) |
| 1126 | 1114 | {
|
@@ -1488,8 +1476,7 @@ discard block |
||
| 1488 | 1476 | if(self::$db_info) |
| 1489 | 1477 | {
|
| 1490 | 1478 | return self::$db_info->master_db['db_type']; |
| 1491 | - } |
|
| 1492 | - else |
|
| 1479 | + } else |
|
| 1493 | 1480 | {
|
| 1494 | 1481 | return NULL; |
| 1495 | 1482 | } |
@@ -1588,8 +1575,7 @@ discard block |
||
| 1588 | 1575 | && |
| 1589 | 1576 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1590 | 1577 | {
|
| 1591 | - } |
|
| 1592 | - else |
|
| 1578 | + } else |
|
| 1593 | 1579 | {
|
| 1594 | 1580 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
| 1595 | 1581 | new DBMysqlConnectWrapper(); |
@@ -1630,8 +1616,7 @@ discard block |
||
| 1630 | 1616 | && |
| 1631 | 1617 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1632 | 1618 | {
|
| 1633 | - } |
|
| 1634 | - else |
|
| 1619 | + } else |
|
| 1635 | 1620 | {
|
| 1636 | 1621 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
| 1637 | 1622 | new DBMysqliConnectWrapper(); |
@@ -1672,8 +1657,7 @@ discard block |
||
| 1672 | 1657 | && |
| 1673 | 1658 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1674 | 1659 | {
|
| 1675 | - } |
|
| 1676 | - else |
|
| 1660 | + } else |
|
| 1677 | 1661 | {
|
| 1678 | 1662 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
| 1679 | 1663 | new DBCubridConnectWrapper(); |
@@ -1714,8 +1698,7 @@ discard block |
||
| 1714 | 1698 | && |
| 1715 | 1699 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
| 1716 | 1700 | {
|
| 1717 | - } |
|
| 1718 | - else |
|
| 1701 | + } else |
|
| 1719 | 1702 | {
|
| 1720 | 1703 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
| 1721 | 1704 | new DBMssqlConnectWrapper(); |
@@ -1812,22 +1795,19 @@ discard block |
||
| 1812 | 1795 | try |
| 1813 | 1796 | {
|
| 1814 | 1797 | $query_user_args = require($query_args_file); |
| 1815 | - } |
|
| 1816 | - catch (Exception $exc) |
|
| 1798 | + } catch (Exception $exc) |
|
| 1817 | 1799 | {
|
| 1818 | 1800 | fwrite(STDERR, "Error in arguments file.\n"); |
| 1819 | 1801 | throw $exc; |
| 1820 | 1802 | } |
| 1821 | - } |
|
| 1822 | - else |
|
| 1803 | + } else |
|
| 1823 | 1804 | {
|
| 1824 | 1805 | if($query_args) |
| 1825 | 1806 | {
|
| 1826 | 1807 | try |
| 1827 | 1808 | {
|
| 1828 | 1809 | eval('$query_user_args = array(' . $query_args . ');');
|
| 1829 | - } |
|
| 1830 | - catch (Exception $exc) |
|
| 1810 | + } catch (Exception $exc) |
|
| 1831 | 1811 | {
|
| 1832 | 1812 | fwrite(STDERR, "Error in arguments string.\n"); |
| 1833 | 1813 | throw $exc; |
@@ -1919,8 +1899,7 @@ discard block |
||
| 1919 | 1899 | if($use_schema_language) |
| 1920 | 1900 | {
|
| 1921 | 1901 | $document_schema = $table_schema; |
| 1922 | - } |
|
| 1923 | - else |
|
| 1902 | + } else |
|
| 1924 | 1903 | {
|
| 1925 | 1904 | if(!$document_schema) |
| 1926 | 1905 | {
|
@@ -1936,8 +1915,7 @@ discard block |
||
| 1936 | 1915 | if($use_schema_language) |
| 1937 | 1916 | {
|
| 1938 | 1917 | validate_schema_doc($argv[$i], $domDocument->documentElement); |
| 1939 | - } |
|
| 1940 | - else |
|
| 1918 | + } else |
|
| 1941 | 1919 | {
|
| 1942 | 1920 | validate_xml_query($argv[$i], $domDocument->documentElement); |
| 1943 | 1921 | } |
@@ -1951,8 +1929,7 @@ discard block |
||
| 1951 | 1929 | if(function_exists('sys_get_temp_dir'))
|
| 1952 | 1930 | {
|
| 1953 | 1931 | $tmpdir = sys_get_temp_dir(); |
| 1954 | - } |
|
| 1955 | - else |
|
| 1932 | + } else |
|
| 1956 | 1933 | {
|
| 1957 | 1934 | $tmpdir = getenv('TEMP');
|
| 1958 | 1935 | if(!$tmpdir) |
@@ -2001,8 +1978,7 @@ discard block |
||
| 2001 | 1978 | print " {$db_type} query:\n";
|
| 2002 | 1979 | print $GLOBALS['__DB__'][$db_type]->queries; |
| 2003 | 1980 | print "\n"; |
| 2004 | - } |
|
| 2005 | - else |
|
| 1981 | + } else |
|
| 2006 | 1982 | {
|
| 2007 | 1983 | $unlink_tmpfile = |
| 2008 | 1984 | new UnlinkFile(tempnam($tmpdir, 'xe_')); |
@@ -2037,8 +2013,7 @@ discard block |
||
| 2037 | 2013 | {
|
| 2038 | 2014 | $query_user_args[$arg->variable_name] = |
| 2039 | 2015 | eval('return ' . $arg->argument_validator->default_value->toString() . ';');
|
| 2040 | - } |
|
| 2041 | - else |
|
| 2016 | + } else |
|
| 2042 | 2017 | {
|
| 2043 | 2018 | if($arg->argument_validator->filter) |
| 2044 | 2019 | {
|
@@ -2133,8 +2108,7 @@ discard block |
||
| 2133 | 2108 | if(is_a($resultset, 'BaseObject') && !$resultset->toBool()) |
| 2134 | 2109 | {
|
| 2135 | 2110 | throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed'); |
| 2136 | - } |
|
| 2137 | - else |
|
| 2111 | + } else |
|
| 2138 | 2112 | {
|
| 2139 | 2113 | print "\n"; |
| 2140 | 2114 | print pathinfo($argv[$i], PATHINFO_FILENAME); |
@@ -2151,14 +2125,12 @@ discard block |
||
| 2151 | 2125 | {
|
| 2152 | 2126 | libXmlDisplayError($argv[$i], TRUE); |
| 2153 | 2127 | } |
| 2154 | - } |
|
| 2155 | - catch (XmlSchemaError $exc) |
|
| 2128 | + } catch (XmlSchemaError $exc) |
|
| 2156 | 2129 | {
|
| 2157 | 2130 | $retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS); |
| 2158 | 2131 | |
| 2159 | 2132 | fwrite(STDERR, $exc->getMessage() . "\n"); |
| 2160 | - } |
|
| 2161 | - catch (ErrorMessage $exc) |
|
| 2133 | + } catch (ErrorMessage $exc) |
|
| 2162 | 2134 | {
|
| 2163 | 2135 | if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
| 2164 | 2136 | {
|
@@ -2167,8 +2139,7 @@ discard block |
||
| 2167 | 2139 | |
| 2168 | 2140 | fwrite(STDERR, $exc->getMessage() . "\n"); |
| 2169 | 2141 | libXmlDisplayError($argv[$i]); |
| 2170 | - } |
|
| 2171 | - catch (ErrorException $exc) |
|
| 2142 | + } catch (ErrorException $exc) |
|
| 2172 | 2143 | {
|
| 2173 | 2144 | if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
| 2174 | 2145 | {
|
@@ -2178,8 +2149,7 @@ discard block |
||
| 2178 | 2149 | fwrite(STDERR, "{$exc->getFile()}({$exc->getLine()}):\n\t{$exc->getMessage()}.\n");
|
| 2179 | 2150 | fwrite(STDERR, $exc->getTraceAsString()); |
| 2180 | 2151 | libXmlDisplayError($argv[$i]); |
| 2181 | - } |
|
| 2182 | - catch (Exception $exc) |
|
| 2152 | + } catch (Exception $exc) |
|
| 2183 | 2153 | {
|
| 2184 | 2154 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
| 2185 | 2155 | |
@@ -2190,20 +2160,17 @@ discard block |
||
| 2190 | 2160 | } |
| 2191 | 2161 | |
| 2192 | 2162 | exit($retcode->code()); |
| 2193 | -} |
|
| 2194 | -catch (SyntaxError $syntax) |
|
| 2163 | +} catch (SyntaxError $syntax) |
|
| 2195 | 2164 | {
|
| 2196 | 2165 | fwrite(STDERR, $syntax->getMessage() . "\n"); |
| 2197 | 2166 | exit(254); // wrong command line |
| 2198 | 2167 | // 255 is reserved by php (for parse errors, etc.) |
| 2199 | -} |
|
| 2200 | -catch (ErrorMessage $exc) |
|
| 2168 | +} catch (ErrorMessage $exc) |
|
| 2201 | 2169 | {
|
| 2202 | 2170 | fwrite(STDERR, $exc->getMessage() . "\n"); |
| 2203 | 2171 | libXmlDisplayError(); |
| 2204 | 2172 | exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
| 2205 | -} |
|
| 2206 | -catch (Exception $exc) |
|
| 2173 | +} catch (Exception $exc) |
|
| 2207 | 2174 | {
|
| 2208 | 2175 | fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n");
|
| 2209 | 2176 | fwrite(STDERR, $exc->getTraceAsString()); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @file config/config.inc.php |
| 8 | 8 | * @author NAVER ([email protected]) |
| 9 | 9 | */ |
| 10 | -if(version_compare(PHP_VERSION, '5.4.0', '<')) |
|
| 10 | +if (version_compare(PHP_VERSION, '5.4.0', '<')) |
|
| 11 | 11 | { |
| 12 | 12 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING); |
| 13 | 13 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if(!defined('__XE__')) |
|
| 19 | +if (!defined('__XE__')) |
|
| 20 | 20 | { |
| 21 | 21 | exit(); |
| 22 | 22 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | ini_set('session.use_only_cookies', 0); |
| 54 | 54 | |
| 55 | 55 | |
| 56 | -if(file_exists(_XE_PATH_ . 'config/package.inc.php')) |
|
| 56 | +if (file_exists(_XE_PATH_.'config/package.inc.php')) |
|
| 57 | 57 | { |
| 58 | - require _XE_PATH_ . 'config/package.inc.php'; |
|
| 58 | + require _XE_PATH_.'config/package.inc.php'; |
|
| 59 | 59 | } |
| 60 | 60 | else |
| 61 | 61 | { |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | * define('__ENABLE_PHPUNIT_TEST__', 0); |
| 98 | 98 | * define('__PROXY_SERVER__', 'http://domain:port/path'); |
| 99 | 99 | */ |
| 100 | -if(file_exists(_XE_PATH_ . 'config/config.user.inc.php')) |
|
| 100 | +if (file_exists(_XE_PATH_.'config/config.user.inc.php')) |
|
| 101 | 101 | { |
| 102 | - require _XE_PATH_ . 'config/config.user.inc.php'; |
|
| 102 | + require _XE_PATH_.'config/config.user.inc.php'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | -if(!defined('__DEBUG__')) |
|
| 105 | +if (!defined('__DEBUG__')) |
|
| 106 | 106 | { |
| 107 | 107 | /** |
| 108 | 108 | * output debug message(bit value) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | define('__DEBUG__', 0); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | -if(!defined('__DEBUG_OUTPUT__')) |
|
| 120 | +if (!defined('__DEBUG_OUTPUT__')) |
|
| 121 | 121 | { |
| 122 | 122 | /** |
| 123 | 123 | * output location of debug message |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | define('__DEBUG_OUTPUT__', 0); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | -if(!defined('__DEBUG_PROTECT__')) |
|
| 134 | +if (!defined('__DEBUG_PROTECT__')) |
|
| 135 | 135 | { |
| 136 | 136 | /** |
| 137 | 137 | * output comments of the firePHP console and browser |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | define('__DEBUG_PROTECT__', 1); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | -if(!defined('__DEBUG_PROTECT_IP__')) |
|
| 147 | +if (!defined('__DEBUG_PROTECT_IP__')) |
|
| 148 | 148 | { |
| 149 | 149 | /** |
| 150 | 150 | * Set a ip address to allow debug |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | define('__DEBUG_PROTECT_IP__', '127.0.0.1'); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -if(!defined('__DEBUG_DB_OUTPUT__')) |
|
| 155 | +if (!defined('__DEBUG_DB_OUTPUT__')) |
|
| 156 | 156 | { |
| 157 | 157 | /** |
| 158 | 158 | * DB error message definition |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | define('__DEBUG_DB_OUTPUT__', 0); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | -if(!defined('__LOG_SLOW_QUERY__')) |
|
| 168 | +if (!defined('__LOG_SLOW_QUERY__')) |
|
| 169 | 169 | { |
| 170 | 170 | /** |
| 171 | 171 | * Query log for only timeout query among DB queries |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | define('__LOG_SLOW_QUERY__', 0); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | -if(!defined('__LOG_SLOW_TRIGGER__')) |
|
| 182 | +if (!defined('__LOG_SLOW_TRIGGER__')) |
|
| 183 | 183 | { |
| 184 | 184 | /** |
| 185 | 185 | * Trigger excute time log |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | define('__LOG_SLOW_TRIGGER__', 0); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | -if(!defined('__LOG_SLOW_ADDON__')) |
|
| 196 | +if (!defined('__LOG_SLOW_ADDON__')) |
|
| 197 | 197 | { |
| 198 | 198 | /** |
| 199 | 199 | * Addon excute time log |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | define('__LOG_SLOW_ADDON__', 0); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | -if(!defined('__LOG_SLOW_WIDGET__')) |
|
| 210 | +if (!defined('__LOG_SLOW_WIDGET__')) |
|
| 211 | 211 | { |
| 212 | 212 | /** |
| 213 | 213 | * Widget excute time log |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | define('__LOG_SLOW_WIDGET__', 0); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | -if(!defined('__DEBUG_QUERY__')) |
|
| 224 | +if (!defined('__DEBUG_QUERY__')) |
|
| 225 | 225 | { |
| 226 | 226 | /** |
| 227 | 227 | * Leave DB query information |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | define('__DEBUG_QUERY__', 0); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | -if(!defined('__OB_GZHANDLER_ENABLE__')) |
|
| 237 | +if (!defined('__OB_GZHANDLER_ENABLE__')) |
|
| 238 | 238 | { |
| 239 | 239 | /** |
| 240 | 240 | * option to enable/disable a compression feature using ob_gzhandler |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | define('__OB_GZHANDLER_ENABLE__', 1); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | -if(!defined('__ENABLE_PHPUNIT_TEST__')) |
|
| 251 | +if (!defined('__ENABLE_PHPUNIT_TEST__')) |
|
| 252 | 252 | { |
| 253 | 253 | /** |
| 254 | 254 | * decide to use/not use the php unit test (Path/tests/index.php) |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | define('__ENABLE_PHPUNIT_TEST__', 0); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | -if(!defined('__PROXY_SERVER__')) |
|
| 264 | +if (!defined('__PROXY_SERVER__')) |
|
| 265 | 265 | { |
| 266 | 266 | /** |
| 267 | 267 | * __PROXY_SERVER__ has server information to request to the external through the target server |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | define('__PROXY_SERVER__', NULL); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | -if(!defined('__ERROR_LOG__')) |
|
| 273 | +if (!defined('__ERROR_LOG__')) |
|
| 274 | 274 | { |
| 275 | 275 | /** |
| 276 | 276 | * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다. |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | define('__ERROR_LOG__', 0); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | -if(!defined('__DISABLE_DEFAULT_CSS__')) |
|
| 284 | +if (!defined('__DISABLE_DEFAULT_CSS__')) |
|
| 285 | 285 | { |
| 286 | 286 | /** |
| 287 | 287 | * XE의 기본 CSS 스타일을 로드하지 않도록 합니다. |
@@ -297,25 +297,25 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // Require specific files when using Firebug console output |
| 300 | -if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 300 | +if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 301 | 301 | { |
| 302 | - require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php'; |
|
| 302 | + require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php'; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // Set Timezone as server time |
| 306 | -if(version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
| 306 | +if (version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
| 307 | 307 | { |
| 308 | 308 | date_default_timezone_set(@date_default_timezone_get()); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // Require a function-defined-file for simple use |
| 312 | -require(_XE_PATH_ . 'config/func.inc.php'); |
|
| 312 | +require(_XE_PATH_.'config/func.inc.php'); |
|
| 313 | 313 | |
| 314 | -if(__DEBUG__) { |
|
| 314 | +if (__DEBUG__) { |
|
| 315 | 315 | define('__StartTime__', getMicroTime()); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | -if(__DEBUG__) { |
|
| 318 | +if (__DEBUG__) { |
|
| 319 | 319 | $GLOBALS['__elapsed_class_load__'] = 0; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -418,43 +418,43 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | function __xe_autoload($class_name) |
| 420 | 420 | { |
| 421 | - if(__DEBUG__) { |
|
| 421 | + if (__DEBUG__) { |
|
| 422 | 422 | $time_at = getMicroTime(); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
| 425 | + if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
| 426 | 426 | { |
| 427 | - require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
| 427 | + require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
| 428 | 428 | } |
| 429 | - elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
| 429 | + elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
| 430 | 430 | { |
| 431 | 431 | $candidate_filename = array(); |
| 432 | - $candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1]; |
|
| 433 | - if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
| 432 | + $candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1]; |
|
| 433 | + if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
| 434 | 434 | $candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class'; |
| 435 | 435 | $candidate_filename[] = 'php'; |
| 436 | 436 | |
| 437 | 437 | $candidate_filename = implode('.', $candidate_filename); |
| 438 | 438 | |
| 439 | - if(file_exists(_XE_PATH_ . $candidate_filename)) |
|
| 439 | + if (file_exists(_XE_PATH_.$candidate_filename)) |
|
| 440 | 440 | { |
| 441 | - require _XE_PATH_ . $candidate_filename; |
|
| 441 | + require _XE_PATH_.$candidate_filename; |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if(__DEBUG__) { |
|
| 445 | + if (__DEBUG__) { |
|
| 446 | 446 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at; |
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | spl_autoload_register('__xe_autoload'); |
| 450 | 450 | |
| 451 | -if(version_compare(PHP_VERSION, '7.2', '<')) |
|
| 451 | +if (version_compare(PHP_VERSION, '7.2', '<')) |
|
| 452 | 452 | { |
| 453 | 453 | class_alias('BaseObject', 'Object', true); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | -if(file_exists(_XE_PATH_ . '/vendor/autoload.php')) { |
|
| 457 | - require _XE_PATH_ . '/vendor/autoload.php'; |
|
| 456 | +if (file_exists(_XE_PATH_.'/vendor/autoload.php')) { |
|
| 457 | + require _XE_PATH_.'/vendor/autoload.php'; |
|
| 458 | 458 | } |
| 459 | 459 | /* End of file config.inc.php */ |
| 460 | 460 | /* Location: ./config/config.inc.php */ |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
| 36 | 36 | { |
| 37 | 37 | // If XE has not installed yet, set module as install |
| 38 | - if(!Context::isInstalled()) |
|
| 38 | + if (!Context::isInstalled()) |
|
| 39 | 39 | { |
| 40 | 40 | $this->module = 'install'; |
| 41 | 41 | $this->act = Context::get('act'); |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $oContext = Context::getInstance(); |
| 46 | - if($oContext->isSuccessInit == FALSE) |
|
| 46 | + if ($oContext->isSuccessInit == FALSE) |
|
| 47 | 47 | { |
| 48 | 48 | $logged_info = Context::get('logged_info'); |
| 49 | - if($logged_info->is_admin != "Y") |
|
| 49 | + if ($logged_info->is_admin != "Y") |
|
| 50 | 50 | { |
| 51 | 51 | $this->error = 'msg_invalid_request'; |
| 52 | 52 | return; |
@@ -59,26 +59,26 @@ discard block |
||
| 59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
| 60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
| 61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
| 62 | - if($entry = Context::get('entry')) |
|
| 62 | + if ($entry = Context::get('entry')) |
|
| 63 | 63 | { |
| 64 | 64 | $this->entry = Context::convertEncodingStr($entry); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Validate variables to prevent XSS |
| 68 | 68 | $isInvalid = NULL; |
| 69 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 69 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 70 | 70 | { |
| 71 | 71 | $isInvalid = TRUE; |
| 72 | 72 | } |
| 73 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 73 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 74 | 74 | { |
| 75 | 75 | $isInvalid = TRUE; |
| 76 | 76 | } |
| 77 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 77 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 78 | 78 | { |
| 79 | 79 | $isInvalid = TRUE; |
| 80 | 80 | } |
| 81 | - if($isInvalid) |
|
| 81 | + if ($isInvalid) |
|
| 82 | 82 | { |
| 83 | 83 | htmlHeader(); |
| 84 | 84 | echo Context::getLang("msg_invalid_request"); |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | exit; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 90 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 91 | 91 | { |
| 92 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 92 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 93 | 93 | { |
| 94 | - if(Context::get('_https_port')!=null) { |
|
| 95 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
| 94 | + if (Context::get('_https_port') != null) { |
|
| 95 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
| 96 | 96 | } else { |
| 97 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
| 97 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
| 98 | 98 | } |
| 99 | 99 | return; |
| 100 | 100 | } |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // call a trigger before moduleHandler init |
| 104 | 104 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
| 105 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 105 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 106 | 106 | { |
| 107 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 107 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 108 | 108 | { |
| 109 | 109 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
| 110 | 110 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -115,40 +115,40 @@ discard block |
||
| 115 | 115 | $called_position = 'before_module_init'; |
| 116 | 116 | $oAddonController = getController('addon'); |
| 117 | 117 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
| 118 | - if(file_exists($addon_file)) include($addon_file); |
|
| 118 | + if (file_exists($addon_file)) include($addon_file); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
| 122 | 122 | { |
| 123 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 123 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 124 | 124 | { |
| 125 | 125 | return false; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | set_error_handler(function() { }, ~0); |
| 129 | 129 | |
| 130 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 131 | - if(!file_exists($debug_file)) |
|
| 130 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 131 | + if (!file_exists($debug_file)) |
|
| 132 | 132 | { |
| 133 | 133 | $print[] = '<?php exit() ?>'; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $errorname = self::getErrorType($errnumber); |
| 137 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
| 137 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
| 138 | 138 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 139 | 139 | $backtrace = debug_backtrace($backtrace_args); |
| 140 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 140 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 141 | 141 | { |
| 142 | 142 | array_shift($backtrace); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - foreach($backtrace as $key => $value) |
|
| 145 | + foreach ($backtrace as $key => $value) |
|
| 146 | 146 | { |
| 147 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
| 147 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
| 148 | 148 | $print[] = $message; |
| 149 | 149 | } |
| 150 | 150 | $print[] = PHP_EOL; |
| 151 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 151 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 152 | 152 | restore_error_handler(); |
| 153 | 153 | |
| 154 | 154 | return true; |
@@ -164,21 +164,21 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | set_error_handler(function() { }, ~0); |
| 166 | 166 | |
| 167 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 168 | - if(!file_exists($debug_file)) |
|
| 167 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 168 | + if (!file_exists($debug_file)) |
|
| 169 | 169 | { |
| 170 | 170 | $print[] = '<?php exit() ?>'; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $errorname = self::getErrorType($errinfo['type']); |
| 174 | 174 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 175 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
| 175 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
| 176 | 176 | |
| 177 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
| 177 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
| 178 | 178 | $print[] = $message; |
| 179 | 179 | |
| 180 | 180 | $print[] = PHP_EOL; |
| 181 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 181 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 182 | 182 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 183 | 183 | |
| 184 | 184 | return true; |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
| 223 | 223 | $defaultHost = $defaultUrlInfo['host']; |
| 224 | 224 | |
| 225 | - foreach($urls as $url) |
|
| 225 | + foreach ($urls as $url) |
|
| 226 | 226 | { |
| 227 | - if(empty($url)) |
|
| 227 | + if (empty($url)) |
|
| 228 | 228 | { |
| 229 | 229 | continue; |
| 230 | 230 | } |
@@ -232,29 +232,29 @@ discard block |
||
| 232 | 232 | $urlInfo = parse_url($url); |
| 233 | 233 | $host = $urlInfo['host']; |
| 234 | 234 | |
| 235 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 235 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 236 | 236 | { |
| 237 | 237 | throw new Exception('msg_default_url_is_null'); |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
| 241 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
| 242 | 242 | { |
| 243 | 243 | $oDocumentModel = getModel('document'); |
| 244 | 244 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
| 245 | - if($this->document_srl) |
|
| 245 | + if ($this->document_srl) |
|
| 246 | 246 | { |
| 247 | 247 | Context::set('document_srl', $this->document_srl); |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Get module's information based on document_srl, if it's specified |
| 252 | - if($this->document_srl) |
|
| 252 | + if ($this->document_srl) |
|
| 253 | 253 | { |
| 254 | 254 | |
| 255 | 255 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
| 256 | 256 | // If the document does not exist, remove document_srl |
| 257 | - if(!$module_info) |
|
| 257 | + if (!$module_info) |
|
| 258 | 258 | { |
| 259 | 259 | unset($this->document_srl); |
| 260 | 260 | } |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | { |
| 263 | 263 | // If it exists, compare mid based on the module information |
| 264 | 264 | // if mids are not matching, set it as the document's mid |
| 265 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
| 265 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
| 266 | 266 | { |
| 267 | 267 | |
| 268 | - if(Context::getRequestMethod() == 'GET') |
|
| 268 | + if (Context::getRequestMethod() == 'GET') |
|
| 269 | 269 | { |
| 270 | 270 | $this->mid = $module_info->mid; |
| 271 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 271 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 272 | 272 | return FALSE; |
| 273 | 273 | } |
| 274 | 274 | else |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | } |
| 281 | 281 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
| 282 | - if($this->module && $module_info->module != $this->module) |
|
| 282 | + if ($this->module && $module_info->module != $this->module) |
|
| 283 | 283 | { |
| 284 | 284 | unset($module_info); |
| 285 | 285 | } |
@@ -288,36 +288,36 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
| 291 | - if(!$module_info && $this->mid) |
|
| 291 | + if (!$module_info && $this->mid) |
|
| 292 | 292 | { |
| 293 | 293 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
| 294 | 294 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // redirect, if module_site_srl and site_srl are different |
| 298 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 298 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 299 | 299 | { |
| 300 | 300 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
| 301 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 301 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 302 | 302 | return FALSE; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // If module_info is not set still, and $module does not exist, find the default module |
| 306 | - if(!$module_info && !$this->module && !$this->mid) |
|
| 306 | + if (!$module_info && !$this->module && !$this->mid) |
|
| 307 | 307 | { |
| 308 | 308 | $module_info = $site_module_info; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 311 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 312 | 312 | { |
| 313 | 313 | $module_info = $site_module_info; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | // redirect, if site_srl of module_info is different from one of site's module_info |
| 317 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 317 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 318 | 318 | { |
| 319 | 319 | // If the module is of virtual site |
| 320 | - if($module_info->site_srl) |
|
| 320 | + if ($module_info->site_srl) |
|
| 321 | 321 | { |
| 322 | 322 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 323 | 323 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | else |
| 327 | 327 | { |
| 328 | 328 | $db_info = Context::getDBInfo(); |
| 329 | - if(!$db_info->default_url) |
|
| 329 | + if (!$db_info->default_url) |
|
| 330 | 330 | { |
| 331 | 331 | return Context::getLang('msg_default_url_is_not_defined'); |
| 332 | 332 | } |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | - header("location:" . $redirect_url); |
|
| 338 | + header("location:".$redirect_url); |
|
| 339 | 339 | return FALSE; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | // If module info was set, retrieve variables from the module information |
| 343 | - if($module_info) |
|
| 343 | + if ($module_info) |
|
| 344 | 344 | { |
| 345 | 345 | $this->module = $module_info->module; |
| 346 | 346 | $this->mid = $module_info->mid; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
| 352 | 352 | |
| 353 | 353 | // use the site default layout. |
| 354 | - if($module_info->{$targetSrl} == -1) |
|
| 354 | + if ($module_info->{$targetSrl} == -1) |
|
| 355 | 355 | { |
| 356 | 356 | $oLayoutAdminModel = getAdminModel('layout'); |
| 357 | 357 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // Set module and mid into module_info |
| 372 | - if(!isset($this->module_info)) |
|
| 372 | + if (!isset($this->module_info)) |
|
| 373 | 373 | { |
| 374 | 374 | $this->module_info = new stdClass(); |
| 375 | 375 | } |
@@ -380,21 +380,21 @@ discard block |
||
| 380 | 380 | $this->module_info->site_srl = $site_module_info->site_srl; |
| 381 | 381 | |
| 382 | 382 | // Still no module? it's an error |
| 383 | - if(!$this->module) |
|
| 383 | + if (!$this->module) |
|
| 384 | 384 | { |
| 385 | 385 | $this->error = 'msg_module_is_not_exists'; |
| 386 | 386 | $this->httpStatusCode = '404'; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | // If mid exists, set mid into context |
| 390 | - if($this->mid) |
|
| 390 | + if ($this->mid) |
|
| 391 | 391 | { |
| 392 | 392 | Context::set('mid', $this->mid, TRUE); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | // Call a trigger after moduleHandler init |
| 396 | 396 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
| 397 | - if(!$output->toBool()) |
|
| 397 | + if (!$output->toBool()) |
|
| 398 | 398 | { |
| 399 | 399 | $this->error = $output->getMessage(); |
| 400 | 400 | return TRUE; |
@@ -416,14 +416,14 @@ discard block |
||
| 416 | 416 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
| 417 | 417 | |
| 418 | 418 | // If error occurred while preparation, return a message instance |
| 419 | - if($this->error) |
|
| 419 | + if ($this->error) |
|
| 420 | 420 | { |
| 421 | 421 | $this->_setInputErrorToContext(); |
| 422 | 422 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 423 | 423 | $oMessageObject->setError(-1); |
| 424 | 424 | $oMessageObject->setMessage($this->error); |
| 425 | 425 | $oMessageObject->dispMessage(); |
| 426 | - if($this->httpStatusCode) |
|
| 426 | + if ($this->httpStatusCode) |
|
| 427 | 427 | { |
| 428 | 428 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 429 | 429 | } |
@@ -434,22 +434,22 @@ discard block |
||
| 434 | 434 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
| 435 | 435 | |
| 436 | 436 | // If not installed yet, modify act |
| 437 | - if($this->module == "install") |
|
| 437 | + if ($this->module == "install") |
|
| 438 | 438 | { |
| 439 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
| 439 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
| 440 | 440 | { |
| 441 | 441 | $this->act = $xml_info->default_index_act; |
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | // if act exists, find type of the action, if not use default index act |
| 446 | - if(!$this->act) |
|
| 446 | + if (!$this->act) |
|
| 447 | 447 | { |
| 448 | 448 | $this->act = $xml_info->default_index_act; |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // still no act means error |
| 452 | - if(!$this->act) |
|
| 452 | + if (!$this->act) |
|
| 453 | 453 | { |
| 454 | 454 | $this->error = 'msg_module_is_not_exists'; |
| 455 | 455 | $this->httpStatusCode = '404'; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $oMessageObject->setError(-1); |
| 460 | 460 | $oMessageObject->setMessage($this->error); |
| 461 | 461 | $oMessageObject->dispMessage(); |
| 462 | - if($this->httpStatusCode) |
|
| 462 | + if ($this->httpStatusCode) |
|
| 463 | 463 | { |
| 464 | 464 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 465 | 465 | } |
@@ -470,17 +470,17 @@ discard block |
||
| 470 | 470 | $type = $xml_info->action->{$this->act}->type; |
| 471 | 471 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
| 472 | 472 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 473 | - if(!$kind && $this->module == 'admin') |
|
| 473 | + if (!$kind && $this->module == 'admin') |
|
| 474 | 474 | { |
| 475 | 475 | $kind = 'admin'; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // check REQUEST_METHOD in controller |
| 479 | - if($type == 'controller') |
|
| 479 | + if ($type == 'controller') |
|
| 480 | 480 | { |
| 481 | 481 | $allowedMethod = $xml_info->action->{$this->act}->method; |
| 482 | 482 | |
| 483 | - if(!$allowedMethod) |
|
| 483 | + if (!$allowedMethod) |
|
| 484 | 484 | { |
| 485 | 485 | $allowedMethodList[0] = 'POST'; |
| 486 | 486 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 492 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 493 | 493 | { |
| 494 | 494 | $this->error = "msg_invalid_request"; |
| 495 | 495 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if($this->module_info->use_mobile != "Y") |
|
| 503 | + if ($this->module_info->use_mobile != "Y") |
|
| 504 | 504 | { |
| 505 | 505 | Mobile::setMobile(FALSE); |
| 506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | // check CSRF for non-GET actions |
| 511 | 511 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 512 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 512 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 513 | 513 | { |
| 514 | 514 | $this->error = 'msg_invalid_request'; |
| 515 | 515 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Admin ip |
| 523 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 523 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 524 | 524 | { |
| 525 | 525 | $this->_setInputErrorToContext(); |
| 526 | 526 | $this->error = "msg_not_permitted_act"; |
@@ -532,13 +532,13 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // if(type == view, and case for using mobilephone) |
| 535 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 535 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 536 | 536 | { |
| 537 | 537 | $orig_type = "view"; |
| 538 | 538 | $type = "mobile"; |
| 539 | 539 | // create a module instance |
| 540 | 540 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 541 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 541 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 542 | 542 | { |
| 543 | 543 | $type = $orig_type; |
| 544 | 544 | Mobile::setMobile(FALSE); |
@@ -551,14 +551,14 @@ discard block |
||
| 551 | 551 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - if(!is_object($oModule)) |
|
| 554 | + if (!is_object($oModule)) |
|
| 555 | 555 | { |
| 556 | 556 | $this->_setInputErrorToContext(); |
| 557 | 557 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 558 | 558 | $oMessageObject->setError(-1); |
| 559 | 559 | $oMessageObject->setMessage($this->error); |
| 560 | 560 | $oMessageObject->dispMessage(); |
| 561 | - if($this->httpStatusCode) |
|
| 561 | + if ($this->httpStatusCode) |
|
| 562 | 562 | { |
| 563 | 563 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 564 | 564 | } |
@@ -566,10 +566,10 @@ discard block |
||
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | // If there is no such action in the module object |
| 569 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 569 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 570 | 570 | { |
| 571 | 571 | |
| 572 | - if(!Context::isInstalled()) |
|
| 572 | + if (!Context::isInstalled()) |
|
| 573 | 573 | { |
| 574 | 574 | $this->_setInputErrorToContext(); |
| 575 | 575 | $this->error = 'msg_invalid_request'; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $oMessageObject->setError(-1); |
| 578 | 578 | $oMessageObject->setMessage($this->error); |
| 579 | 579 | $oMessageObject->dispMessage(); |
| 580 | - if($this->httpStatusCode) |
|
| 580 | + if ($this->httpStatusCode) |
|
| 581 | 581 | { |
| 582 | 582 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 583 | 583 | } |
@@ -586,12 +586,12 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | $forward = NULL; |
| 588 | 588 | // 1. Look for the module with action name |
| 589 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 589 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 590 | 590 | { |
| 591 | - $module = strtolower($matches[2] . $matches[3]); |
|
| 591 | + $module = strtolower($matches[2].$matches[3]); |
|
| 592 | 592 | $xml_info = $oModuleModel->getModuleActionXml($module); |
| 593 | 593 | |
| 594 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 594 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 595 | 595 | { |
| 596 | 596 | $forward = new stdClass(); |
| 597 | 597 | $forward->module = $module; |
@@ -611,12 +611,12 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - if(!$forward) |
|
| 614 | + if (!$forward) |
|
| 615 | 615 | { |
| 616 | 616 | $forward = $oModuleModel->getActionForward($this->act); |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 619 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 620 | 620 | { |
| 621 | 621 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
| 622 | 622 | $type = $forward->type; |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | // check CSRF for non-GET actions |
| 630 | 630 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 631 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 631 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 632 | 632 | { |
| 633 | 633 | $this->error = 'msg_invalid_request'; |
| 634 | 634 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -640,11 +640,11 @@ discard block |
||
| 640 | 640 | |
| 641 | 641 | // SECISSUE also check foward act method |
| 642 | 642 | // check REQUEST_METHOD in controller |
| 643 | - if($type == 'controller') |
|
| 643 | + if ($type == 'controller') |
|
| 644 | 644 | { |
| 645 | 645 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
| 646 | 646 | |
| 647 | - if(!$allowedMethod) |
|
| 647 | + if (!$allowedMethod) |
|
| 648 | 648 | { |
| 649 | 649 | $allowedMethodList[0] = 'POST'; |
| 650 | 650 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 656 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 657 | 657 | { |
| 658 | 658 | $this->error = "msg_invalid_request"; |
| 659 | 659 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -664,13 +664,13 @@ discard block |
||
| 664 | 664 | } |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
| 667 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
| 668 | 668 | { |
| 669 | 669 | $orig_type = "view"; |
| 670 | 670 | $type = "mobile"; |
| 671 | 671 | // create a module instance |
| 672 | 672 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 673 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 673 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 674 | 674 | { |
| 675 | 675 | $type = $orig_type; |
| 676 | 676 | Mobile::setMobile(FALSE); |
@@ -682,25 +682,25 @@ discard block |
||
| 682 | 682 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - if(!is_object($oModule)) |
|
| 685 | + if (!is_object($oModule)) |
|
| 686 | 686 | { |
| 687 | 687 | $this->_setInputErrorToContext(); |
| 688 | 688 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 689 | 689 | $oMessageObject->setError(-1); |
| 690 | 690 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
| 691 | 691 | $oMessageObject->dispMessage(); |
| 692 | - if($this->httpStatusCode) |
|
| 692 | + if ($this->httpStatusCode) |
|
| 693 | 693 | { |
| 694 | 694 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 695 | 695 | } |
| 696 | 696 | return $oMessageObject; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - if($this->module == "admin" && $type == "view") |
|
| 699 | + if ($this->module == "admin" && $type == "view") |
|
| 700 | 700 | { |
| 701 | - if($logged_info->is_admin == 'Y') |
|
| 701 | + if ($logged_info->is_admin == 'Y') |
|
| 702 | 702 | { |
| 703 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
| 703 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
| 704 | 704 | { |
| 705 | 705 | $oAdminView = getAdminView('admin'); |
| 706 | 706 | $oAdminView->makeGnbUrl($forward->module); |
@@ -720,10 +720,10 @@ discard block |
||
| 720 | 720 | return $oMessageObject; |
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | - if($kind == 'admin') |
|
| 723 | + if ($kind == 'admin') |
|
| 724 | 724 | { |
| 725 | 725 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
| 726 | - if(!$grant->manager) |
|
| 726 | + if (!$grant->manager) |
|
| 727 | 727 | { |
| 728 | 728 | $this->_setInputErrorToContext(); |
| 729 | 729 | $this->error = 'msg_is_not_manager'; |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | } |
| 736 | 736 | else |
| 737 | 737 | { |
| 738 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 738 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 739 | 739 | { |
| 740 | 740 | $this->_setInputErrorToContext(); |
| 741 | 741 | $this->error = 'msg_is_not_administrator'; |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | } |
| 749 | 749 | } |
| 750 | 750 | } |
| 751 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 751 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 752 | 752 | { |
| 753 | 753 | $this->act = $xml_info->default_index_act; |
| 754 | 754 | } |
@@ -762,16 +762,16 @@ discard block |
||
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | // ruleset check... |
| 765 | - if(!empty($ruleset)) |
|
| 765 | + if (!empty($ruleset)) |
|
| 766 | 766 | { |
| 767 | 767 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
| 768 | 768 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
| 769 | - if(!empty($rulesetFile)) |
|
| 769 | + if (!empty($rulesetFile)) |
|
| 770 | 770 | { |
| 771 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 771 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 772 | 772 | { |
| 773 | 773 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
| 774 | - foreach($errorLang as $key => $val) |
|
| 774 | + foreach ($errorLang as $key => $val) |
|
| 775 | 775 | { |
| 776 | 776 | Context::setLang($key, $val); |
| 777 | 777 | } |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | |
| 781 | 781 | $Validator = new Validator($rulesetFile); |
| 782 | 782 | $result = $Validator->validate(); |
| 783 | - if(!$result) |
|
| 783 | + if (!$result) |
|
| 784 | 784 | { |
| 785 | 785 | $lastError = $Validator->getLastError(); |
| 786 | 786 | $returnUrl = Context::get('error_return_url'); |
@@ -812,26 +812,26 @@ discard block |
||
| 812 | 812 | 'dispLayoutPreviewWithModule' => 1 |
| 813 | 813 | ); |
| 814 | 814 | $db_use_mobile = Mobile::isMobileEnabled(); |
| 815 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 815 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 816 | 816 | { |
| 817 | 817 | global $lang; |
| 818 | 818 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
| 819 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
| 819 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
| 820 | 820 | Context::addHtmlHeader($header); |
| 821 | 821 | Context::addHtmlFooter($footer); |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if($type == "view" && $kind != 'admin') |
|
| 824 | + if ($type == "view" && $kind != 'admin') |
|
| 825 | 825 | { |
| 826 | 826 | $module_config = $oModuleModel->getModuleConfig('module'); |
| 827 | - if($module_config->htmlFooter) |
|
| 827 | + if ($module_config->htmlFooter) |
|
| 828 | 828 | { |
| 829 | 829 | Context::addHtmlFooter($module_config->htmlFooter); |
| 830 | 830 | } |
| 831 | - if($module_config->siteTitle) |
|
| 831 | + if ($module_config->siteTitle) |
|
| 832 | 832 | { |
| 833 | 833 | $siteTitle = Context::getBrowserTitle(); |
| 834 | - if(!$siteTitle) |
|
| 834 | + if (!$siteTitle) |
|
| 835 | 835 | { |
| 836 | 836 | Context::setBrowserTitle($module_config->siteTitle); |
| 837 | 837 | } |
@@ -844,18 +844,18 @@ discard block |
||
| 844 | 844 | $procResult = $oModule->proc(); |
| 845 | 845 | |
| 846 | 846 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 847 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 847 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 848 | 848 | { |
| 849 | 849 | $error = $oModule->getError(); |
| 850 | 850 | $message = $oModule->getMessage(); |
| 851 | 851 | $messageType = $oModule->getMessageType(); |
| 852 | 852 | $redirectUrl = $oModule->getRedirectUrl(); |
| 853 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 853 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 854 | 854 | |
| 855 | - if(!$procResult) |
|
| 855 | + if (!$procResult) |
|
| 856 | 856 | { |
| 857 | 857 | $this->error = $message; |
| 858 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
| 858 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
| 859 | 859 | { |
| 860 | 860 | $redirectUrl = Context::get('error_return_url'); |
| 861 | 861 | } |
@@ -868,13 +868,13 @@ discard block |
||
| 868 | 868 | |
| 869 | 869 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
| 870 | 870 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
| 871 | - if($message != 'success') |
|
| 871 | + if ($message != 'success') |
|
| 872 | 872 | { |
| 873 | 873 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
| 874 | 874 | } |
| 875 | 875 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
| 876 | 876 | |
| 877 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 877 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 878 | 878 | { |
| 879 | 879 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
| 880 | 880 | } |
@@ -890,27 +890,27 @@ discard block |
||
| 890 | 890 | * */ |
| 891 | 891 | function _setInputErrorToContext() |
| 892 | 892 | { |
| 893 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 893 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 894 | 894 | { |
| 895 | 895 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
| 896 | 896 | } |
| 897 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 897 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 898 | 898 | { |
| 899 | 899 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
| 900 | 900 | } |
| 901 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 901 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 902 | 902 | { |
| 903 | 903 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
| 904 | 904 | } |
| 905 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 905 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 906 | 906 | { |
| 907 | 907 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
| 908 | 908 | } |
| 909 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 909 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 910 | 910 | { |
| 911 | 911 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
| 912 | 912 | } |
| 913 | - if(count($_SESSION['INPUT_ERROR'])) |
|
| 913 | + if (count($_SESSION['INPUT_ERROR'])) |
|
| 914 | 914 | { |
| 915 | 915 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
| 916 | 916 | } |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | { |
| 941 | 941 | $requestVars = Context::getRequestVars(); |
| 942 | 942 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
| 943 | - foreach($requestVars AS $key => $value) |
|
| 943 | + foreach ($requestVars AS $key => $value) |
|
| 944 | 944 | { |
| 945 | 945 | $_SESSION['INPUT_ERROR'][$key] = $value; |
| 946 | 946 | } |
@@ -954,41 +954,41 @@ discard block |
||
| 954 | 954 | function displayContent($oModule = NULL) |
| 955 | 955 | { |
| 956 | 956 | // If the module is not set or not an object, set error |
| 957 | - if(!$oModule || !is_object($oModule)) |
|
| 957 | + if (!$oModule || !is_object($oModule)) |
|
| 958 | 958 | { |
| 959 | 959 | $this->error = 'msg_module_is_not_exists'; |
| 960 | 960 | $this->httpStatusCode = '404'; |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | // If connection to DB has a problem even though it's not install module, set error |
| 964 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 964 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 965 | 965 | { |
| 966 | 966 | $this->error = 'msg_dbconnect_failed'; |
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | // Call trigger after moduleHandler proc |
| 970 | 970 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
| 971 | - if(!$output->toBool()) |
|
| 971 | + if (!$output->toBool()) |
|
| 972 | 972 | { |
| 973 | 973 | $this->error = $output->getMessage(); |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | // Use message view object, if HTML call |
| 977 | 977 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 978 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
| 978 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
| 979 | 979 | { |
| 980 | 980 | |
| 981 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 981 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 982 | 982 | { |
| 983 | 983 | $display_handler = new DisplayHandler(); |
| 984 | 984 | $display_handler->_debugOutput(); |
| 985 | 985 | |
| 986 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 986 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 987 | 987 | return; |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | // If error occurred, handle it |
| 991 | - if($this->error) |
|
| 991 | + if ($this->error) |
|
| 992 | 992 | { |
| 993 | 993 | // display content with message module instance |
| 994 | 994 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -997,14 +997,14 @@ discard block |
||
| 997 | 997 | $oMessageObject->setMessage($this->error); |
| 998 | 998 | $oMessageObject->dispMessage(); |
| 999 | 999 | |
| 1000 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1000 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 1001 | 1001 | { |
| 1002 | 1002 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
| 1003 | 1003 | $oMessageObject->setTemplateFile('http_status_code'); |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | // If module was called normally, change the templates of the module into ones of the message view module |
| 1007 | - if($oModule) |
|
| 1007 | + if ($oModule) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 1010 | 1010 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | // Check if layout_srl exists for the module |
| 1022 | - if(Mobile::isFromMobilePhone()) |
|
| 1022 | + if (Mobile::isFromMobilePhone()) |
|
| 1023 | 1023 | { |
| 1024 | 1024 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1025 | 1025 | } |
@@ -1029,58 +1029,58 @@ discard block |
||
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | // if layout_srl is rollback by module, set default layout |
| 1032 | - if($layout_srl == -1) |
|
| 1032 | + if ($layout_srl == -1) |
|
| 1033 | 1033 | { |
| 1034 | 1034 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 1035 | 1035 | $oLayoutAdminModel = getAdminModel('layout'); |
| 1036 | 1036 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
| 1039 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
| 1040 | 1040 | { |
| 1041 | 1041 | |
| 1042 | 1042 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
| 1043 | 1043 | $oLayoutModel = getModel('layout'); |
| 1044 | 1044 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 1045 | - if($layout_info) |
|
| 1045 | + if ($layout_info) |
|
| 1046 | 1046 | { |
| 1047 | 1047 | |
| 1048 | 1048 | // Input extra_vars into $layout_info |
| 1049 | - if($layout_info->extra_var_count) |
|
| 1049 | + if ($layout_info->extra_var_count) |
|
| 1050 | 1050 | { |
| 1051 | 1051 | |
| 1052 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 1052 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 1053 | 1053 | { |
| 1054 | - if($val->type == 'image') |
|
| 1054 | + if ($val->type == 'image') |
|
| 1055 | 1055 | { |
| 1056 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1056 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1057 | 1057 | { |
| 1058 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 1058 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 1059 | 1059 | } |
| 1060 | 1060 | } |
| 1061 | 1061 | $layout_info->{$var_id} = $val->value; |
| 1062 | 1062 | } |
| 1063 | 1063 | } |
| 1064 | 1064 | // Set menus into context |
| 1065 | - if($layout_info->menu_count) |
|
| 1065 | + if ($layout_info->menu_count) |
|
| 1066 | 1066 | { |
| 1067 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 1067 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 1068 | 1068 | { |
| 1069 | 1069 | // set default menu set(included home menu) |
| 1070 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1070 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1071 | 1071 | { |
| 1072 | 1072 | $oMenuAdminController = getAdminController('menu'); |
| 1073 | 1073 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 1074 | 1074 | |
| 1075 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
| 1075 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
| 1076 | 1076 | { |
| 1077 | 1077 | include($homeMenuCacheFile); |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | - if(!$menu->menu_srl) |
|
| 1080 | + if (!$menu->menu_srl) |
|
| 1081 | 1081 | { |
| 1082 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 1083 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 1082 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 1083 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 1084 | 1084 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1085 | 1085 | } |
| 1086 | 1086 | else |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | $php_file = FileHandler::exists($menu->php_file); |
| 1094 | - if($php_file) |
|
| 1094 | + if ($php_file) |
|
| 1095 | 1095 | { |
| 1096 | 1096 | include($php_file); |
| 1097 | 1097 | } |
@@ -1107,17 +1107,17 @@ discard block |
||
| 1107 | 1107 | |
| 1108 | 1108 | // If layout was modified, use the modified version |
| 1109 | 1109 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 1110 | - if(file_exists($edited_layout)) |
|
| 1110 | + if (file_exists($edited_layout)) |
|
| 1111 | 1111 | { |
| 1112 | 1112 | $oModule->setEditedLayoutFile($edited_layout); |
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | } |
| 1116 | 1116 | $isLayoutDrop = Context::get('isLayoutDrop'); |
| 1117 | - if($isLayoutDrop) |
|
| 1117 | + if ($isLayoutDrop) |
|
| 1118 | 1118 | { |
| 1119 | 1119 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 1120 | - if($kind == 'admin') |
|
| 1120 | + if ($kind == 'admin') |
|
| 1121 | 1121 | { |
| 1122 | 1122 | $oModule->setLayoutFile('popup_layout'); |
| 1123 | 1123 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | function &getModuleInstance($module, $type = 'view', $kind = '') |
| 1156 | 1156 | { |
| 1157 | 1157 | |
| 1158 | - if(__DEBUG__ == 3) |
|
| 1158 | + if (__DEBUG__ == 3) |
|
| 1159 | 1159 | { |
| 1160 | 1160 | $start_time = getMicroTime(); |
| 1161 | 1161 | } |
@@ -1165,51 +1165,51 @@ discard block |
||
| 1165 | 1165 | $type = strtolower($type); |
| 1166 | 1166 | |
| 1167 | 1167 | $kinds = array('svc' => 1, 'admin' => 1); |
| 1168 | - if(!isset($kinds[$kind])) |
|
| 1168 | + if (!isset($kinds[$kind])) |
|
| 1169 | 1169 | { |
| 1170 | 1170 | $kind = 'svc'; |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
| 1173 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
| 1174 | 1174 | |
| 1175 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1175 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1176 | 1176 | { |
| 1177 | 1177 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | 1180 | // if there is no instance of the module in global variable, create a new one |
| 1181 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1181 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1182 | 1182 | { |
| 1183 | 1183 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1184 | 1184 | |
| 1185 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1185 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1186 | 1186 | { |
| 1187 | 1187 | $module = $parent_module; |
| 1188 | 1188 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | 1191 | // Check if the base class and instance class exist |
| 1192 | - if(!class_exists($module, true)) |
|
| 1192 | + if (!class_exists($module, true)) |
|
| 1193 | 1193 | { |
| 1194 | 1194 | return NULL; |
| 1195 | 1195 | } |
| 1196 | - if(!class_exists($instance_name, true)) |
|
| 1196 | + if (!class_exists($instance_name, true)) |
|
| 1197 | 1197 | { |
| 1198 | 1198 | return NULL; |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | // Create an instance |
| 1202 | 1202 | $oModule = new $instance_name(); |
| 1203 | - if(!is_object($oModule)) |
|
| 1203 | + if (!is_object($oModule)) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | return NULL; |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | // Load language files for the class |
| 1209 | - Context::loadLang($class_path . 'lang'); |
|
| 1210 | - if($extend_module) |
|
| 1209 | + Context::loadLang($class_path.'lang'); |
|
| 1210 | + if ($extend_module) |
|
| 1211 | 1211 | { |
| 1212 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
| 1212 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | // Set variables to the instance |
@@ -1217,10 +1217,10 @@ discard block |
||
| 1217 | 1217 | $oModule->setModulePath($class_path); |
| 1218 | 1218 | |
| 1219 | 1219 | // If the module has a constructor, run it. |
| 1220 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1220 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1221 | 1221 | { |
| 1222 | 1222 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
| 1223 | - if(@method_exists($oModule, $instance_name)) |
|
| 1223 | + if (@method_exists($oModule, $instance_name)) |
|
| 1224 | 1224 | { |
| 1225 | 1225 | $oModule->{$instance_name}(); |
| 1226 | 1226 | } |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - if(__DEBUG__ == 3) |
|
| 1233 | + if (__DEBUG__ == 3) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
| 1236 | 1236 | } |
@@ -1246,17 +1246,17 @@ discard block |
||
| 1246 | 1246 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
| 1247 | 1247 | $highClassFile = FileHandler::getRealPath($highClassFile); |
| 1248 | 1248 | |
| 1249 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
| 1250 | - if(!in_array($type, $types)) |
|
| 1249 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
| 1250 | + if (!in_array($type, $types)) |
|
| 1251 | 1251 | { |
| 1252 | 1252 | $type = $types[0]; |
| 1253 | 1253 | } |
| 1254 | - if($type == 'class') |
|
| 1254 | + if ($type == 'class') |
|
| 1255 | 1255 | { |
| 1256 | 1256 | $instanceName = '%s'; |
| 1257 | 1257 | $classFile = '%s%s.%s.php'; |
| 1258 | 1258 | } |
| 1259 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1259 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1260 | 1260 | { |
| 1261 | 1261 | $instanceName = '%sAdmin%s'; |
| 1262 | 1262 | $classFile = '%s%s.admin.%s.php'; |
@@ -1281,26 +1281,26 @@ discard block |
||
| 1281 | 1281 | function triggerCall($trigger_name, $called_position, &$obj) |
| 1282 | 1282 | { |
| 1283 | 1283 | // skip if not installed |
| 1284 | - if(!Context::isInstalled()) |
|
| 1284 | + if (!Context::isInstalled()) |
|
| 1285 | 1285 | { |
| 1286 | 1286 | return new BaseObject(); |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | $oModuleModel = getModel('module'); |
| 1290 | 1290 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
| 1291 | - if(!$triggers || count($triggers) < 1) |
|
| 1291 | + if (!$triggers || count($triggers) < 1) |
|
| 1292 | 1292 | { |
| 1293 | 1293 | return new BaseObject(); |
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | //store before trigger call time |
| 1297 | 1297 | $before_trigger_time = NULL; |
| 1298 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
| 1298 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
| 1299 | 1299 | { |
| 1300 | 1300 | $before_trigger_time = microtime(true); |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | - foreach($triggers as $item) |
|
| 1303 | + foreach ($triggers as $item) |
|
| 1304 | 1304 | { |
| 1305 | 1305 | $module = $item->module; |
| 1306 | 1306 | $type = $item->type; |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | |
| 1309 | 1309 | // todo why don't we call a normal class object ? |
| 1310 | 1310 | $oModule = getModule($module, $type); |
| 1311 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
| 1311 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
| 1312 | 1312 | { |
| 1313 | 1313 | continue; |
| 1314 | 1314 | } |
@@ -1321,12 +1321,12 @@ discard block |
||
| 1321 | 1321 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
| 1322 | 1322 | |
| 1323 | 1323 | $slowlog = new stdClass; |
| 1324 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
| 1325 | - $slowlog->called = $module . '.' . $called_method; |
|
| 1324 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
| 1325 | + $slowlog->called = $module.'.'.$called_method; |
|
| 1326 | 1326 | $slowlog->called_extension = $module; |
| 1327 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1327 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1328 | 1328 | |
| 1329 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1329 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1330 | 1330 | { |
| 1331 | 1331 | return $output; |
| 1332 | 1332 | } |
@@ -1411,9 +1411,9 @@ discard block |
||
| 1411 | 1411 | '511' => 'Network Authentication Required', |
| 1412 | 1412 | ); |
| 1413 | 1413 | $statusMessage = $statusMessageList[$code]; |
| 1414 | - if(!$statusMessage) |
|
| 1414 | + if (!$statusMessage) |
|
| 1415 | 1415 | { |
| 1416 | - $statusMessage = 'HTTP ' . $code; |
|
| 1416 | + $statusMessage = 'HTTP '.$code; |
|
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | 1419 | Context::set('http_status_code', $code); |