@@ -98,6 +98,9 @@ discard block |
||
| 98 | 98 | $oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list'))); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | + /** |
|
| 102 | + * @param string $content_list |
|
| 103 | + */ |
|
| 101 | 104 | function arrangeContentList($content_list) { |
| 102 | 105 | $output = array(); |
| 103 | 106 | if(count($content_list)) { |
@@ -126,6 +129,9 @@ discard block |
||
| 126 | 129 | return $output; |
| 127 | 130 | } |
| 128 | 131 | |
| 132 | + /** |
|
| 133 | + * @param string $comment_list |
|
| 134 | + */ |
|
| 129 | 135 | function arrangeComment($comment_list) { |
| 130 | 136 | $output = array(); |
| 131 | 137 | if(count($comment_list) > 0 ) { |
@@ -142,6 +148,9 @@ discard block |
||
| 142 | 148 | } |
| 143 | 149 | |
| 144 | 150 | |
| 151 | + /** |
|
| 152 | + * @param string $file_list |
|
| 153 | + */ |
|
| 145 | 154 | function arrangeFile($file_list) { |
| 146 | 155 | $output = array(); |
| 147 | 156 | if(count($file_list) > 0) { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | * @brief notice list |
| 19 | 19 | **/ |
| 20 | 20 | function dispBoardNoticeList(&$oModule) { |
| 21 | - $oModule->add('notice_list',$this->arrangeContentList(Context::get('notice_list'))); |
|
| 21 | + $oModule->add('notice_list', $this->arrangeContentList(Context::get('notice_list'))); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | $api_type = Context::get('api_type'); |
| 30 | 30 | $document_list = $this->arrangeContentList(Context::get('document_list')); |
| 31 | 31 | |
| 32 | - if($api_type =='summary') |
|
| 32 | + if ($api_type == 'summary') |
|
| 33 | 33 | { |
| 34 | 34 | $content_cut_size = Context::get('content_cut_size'); |
| 35 | - $content_cut_size = $content_cut_size?$content_cut_size:50; |
|
| 36 | - foreach($document_list as $k=>$v) |
|
| 35 | + $content_cut_size = $content_cut_size ? $content_cut_size : 50; |
|
| 36 | + foreach ($document_list as $k=>$v) |
|
| 37 | 37 | { |
| 38 | 38 | $oDocument = new documentItem(); |
| 39 | 39 | $oDocument->setAttribute($v, false); |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $oModule->add('document_list',$document_list); |
|
| 46 | - $oModule->add('page_navigation',Context::get('page_navigation')); |
|
| 45 | + $oModule->add('document_list', $document_list); |
|
| 46 | + $oModule->add('page_navigation', Context::get('page_navigation')); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * @brief category list |
| 52 | 52 | **/ |
| 53 | 53 | function dispBoardCategoryList(&$oModule) { |
| 54 | - $oModule->add('category_list',Context::get('category_list')); |
|
| 54 | + $oModule->add('category_list', Context::get('category_list')); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | function dispBoardContentView(&$oModule) { |
| 61 | 61 | $oDocument = Context::get('oDocument'); |
| 62 | 62 | $extra_vars = $oDocument->getExtraVars(); |
| 63 | - if($oDocument->isGranted()) |
|
| 63 | + if ($oDocument->isGranted()) |
|
| 64 | 64 | { |
| 65 | - $oDocument->add('extra_vars',$this->arrangeExtraVars($extra_vars)); |
|
| 65 | + $oDocument->add('extra_vars', $this->arrangeExtraVars($extra_vars)); |
|
| 66 | 66 | } |
| 67 | - $oModule->add('oDocument',$this->arrangeContent($oDocument)); |
|
| 67 | + $oModule->add('oDocument', $this->arrangeContent($oDocument)); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | **/ |
| 74 | 74 | function dispBoardContentFileList(&$oModule) { |
| 75 | 75 | $oDocument = Context::get('oDocument'); |
| 76 | - if($oDocument->isAccessible()) |
|
| 76 | + if ($oDocument->isAccessible()) |
|
| 77 | 77 | { |
| 78 | 78 | $oModule->add('file_list', $this->arrangeFile(Context::get('file_list'))); |
| 79 | 79 | } |
@@ -88,20 +88,20 @@ discard block |
||
| 88 | 88 | * @brief tag list |
| 89 | 89 | **/ |
| 90 | 90 | function dispBoardTagList(&$oModule) { |
| 91 | - $oModule->add('tag_list',Context::get('tag_list')); |
|
| 91 | + $oModule->add('tag_list', Context::get('tag_list')); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * @brief comments list |
| 96 | 96 | **/ |
| 97 | 97 | function dispBoardContentCommentList(&$oModule) { |
| 98 | - $oModule->add('comment_list',$this->arrangeComment(Context::get('comment_list'))); |
|
| 98 | + $oModule->add('comment_list', $this->arrangeComment(Context::get('comment_list'))); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | function arrangeContentList($content_list) { |
| 102 | 102 | $output = array(); |
| 103 | - if(count($content_list)) { |
|
| 104 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 103 | + if (count($content_list)) { |
|
| 104 | + foreach ($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 105 | 105 | } |
| 106 | 106 | return $output; |
| 107 | 107 | } |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | function arrangeContent($content) { |
| 111 | 111 | $oBoardView = getView('board'); |
| 112 | 112 | $output = new stdClass; |
| 113 | - if($content){ |
|
| 114 | - $output = $content->gets('document_srl','category_srl','member_srl','nick_name','title','content','tags','readed_count','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status'); |
|
| 113 | + if ($content) { |
|
| 114 | + $output = $content->gets('document_srl', 'category_srl', 'member_srl', 'nick_name', 'title', 'content', 'tags', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'regdate', 'last_update', 'extra_vars', 'status'); |
|
| 115 | 115 | |
| 116 | 116 | $output->content = $content->getContent(false, false, true, false, true); |
| 117 | 117 | |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | function arrangeComment($comment_list) { |
| 130 | 130 | $output = array(); |
| 131 | - if(count($comment_list) > 0 ) { |
|
| 132 | - foreach($comment_list as $key => $val){ |
|
| 131 | + if (count($comment_list) > 0) { |
|
| 132 | + foreach ($comment_list as $key => $val) { |
|
| 133 | 133 | $item = null; |
| 134 | - $item = $val->gets('comment_srl','parent_srl','depth','nick_name','content','is_secret','voted_count','blamed_count','regdate','last_update'); |
|
| 134 | + $item = $val->gets('comment_srl', 'parent_srl', 'depth', 'nick_name', 'content', 'is_secret', 'voted_count', 'blamed_count', 'regdate', 'last_update'); |
|
| 135 | 135 | |
| 136 | 136 | $item->content = $val->getContent(false, false, false); |
| 137 | 137 | |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | function arrangeFile($file_list) { |
| 146 | 146 | $output = array(); |
| 147 | - if(count($file_list) > 0) { |
|
| 148 | - foreach($file_list as $key => $val){ |
|
| 147 | + if (count($file_list) > 0) { |
|
| 148 | + foreach ($file_list as $key => $val) { |
|
| 149 | 149 | $item = new stdClass; |
| 150 | 150 | $item->download_count = $val->download_count; |
| 151 | 151 | $item->source_filename = $val->source_filename; |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | function arrangeExtraVars($list) { |
| 161 | 161 | $output = array(); |
| 162 | - if(count($list)) { |
|
| 163 | - foreach($list as $key => $val){ |
|
| 162 | + if (count($list)) { |
|
| 163 | + foreach ($list as $key => $val) { |
|
| 164 | 164 | $item = new stdClass; |
| 165 | 165 | $item->name = $val->name; |
| 166 | 166 | $item->type = $val->type; |
@@ -76,8 +76,7 @@ discard block |
||
| 76 | 76 | if($oDocument->isAccessible()) |
| 77 | 77 | { |
| 78 | 78 | $oModule->add('file_list', $this->arrangeFile(Context::get('file_list'))); |
| 79 | - } |
|
| 80 | - else |
|
| 79 | + } else |
|
| 81 | 80 | { |
| 82 | 81 | $oModule->add('file_list', array()); |
| 83 | 82 | } |
@@ -101,7 +100,9 @@ discard block |
||
| 101 | 100 | function arrangeContentList($content_list) { |
| 102 | 101 | $output = array(); |
| 103 | 102 | if(count($content_list)) { |
| 104 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 103 | + foreach($content_list as $key => $val) { |
|
| 104 | + $output[] = $this->arrangeContent($val); |
|
| 105 | + } |
|
| 105 | 106 | } |
| 106 | 107 | return $output; |
| 107 | 108 | } |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | * @param int $member_srl |
| 758 | 758 | * @param object $target_file |
| 759 | 759 | * |
| 760 | - * @return void |
|
| 760 | + * @return BaseObject |
|
| 761 | 761 | */ |
| 762 | 762 | function insertProfileImage($member_srl, $target_file) |
| 763 | 763 | { |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | * @param int $member_srl |
| 870 | 870 | * @param object $target_file |
| 871 | 871 | * |
| 872 | - * @return void |
|
| 872 | + * @return BaseObject |
|
| 873 | 873 | */ |
| 874 | 874 | function insertImageName($member_srl, $target_file) |
| 875 | 875 | { |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | /** |
| 958 | 958 | * Delete Image name |
| 959 | 959 | * |
| 960 | - * @return void |
|
| 960 | + * @return BaseObject |
|
| 961 | 961 | */ |
| 962 | 962 | function procMemberDeleteImageName($_memberSrl = 0) |
| 963 | 963 | { |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | * @param int $member_srl |
| 1013 | 1013 | * @param object $target_file |
| 1014 | 1014 | * |
| 1015 | - * @return void |
|
| 1015 | + * @return BaseObject |
|
| 1016 | 1016 | */ |
| 1017 | 1017 | function insertImageMark($member_srl, $target_file) |
| 1018 | 1018 | { |
@@ -1532,6 +1532,9 @@ discard block |
||
| 1532 | 1532 | $this->setRedirectUrl($returnUrl); |
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | + /** |
|
| 1536 | + * @param stdClass $auth_args |
|
| 1537 | + */ |
|
| 1535 | 1538 | function _sendAuthMail($auth_args, $member_info) |
| 1536 | 1539 | { |
| 1537 | 1540 | $oMemberModel = getModel('member'); |
@@ -1664,7 +1667,7 @@ discard block |
||
| 1664 | 1667 | * @param int $member_srl |
| 1665 | 1668 | * @param string $signature |
| 1666 | 1669 | * |
| 1667 | - * @return void |
|
| 1670 | + * @return boolean|null |
|
| 1668 | 1671 | */ |
| 1669 | 1672 | function putSignature($member_srl, $signature) |
| 1670 | 1673 | { |
@@ -2066,6 +2069,8 @@ discard block |
||
| 2066 | 2069 | /** |
| 2067 | 2070 | * Logged method for providing a personalized menu |
| 2068 | 2071 | * Login information is used in the output widget, or personalized page |
| 2072 | + * @param string $act |
|
| 2073 | + * @param string $str |
|
| 2069 | 2074 | */ |
| 2070 | 2075 | function addMemberMenu($act, $str) |
| 2071 | 2076 | { |
@@ -2096,6 +2101,7 @@ discard block |
||
| 2096 | 2101 | |
| 2097 | 2102 | /** |
| 2098 | 2103 | * Add users to the member table |
| 2104 | + * @param stdClass $args |
|
| 2099 | 2105 | */ |
| 2100 | 2106 | function insertMember(&$args, $password_is_hashed = false) |
| 2101 | 2107 | { |
@@ -2296,6 +2302,7 @@ discard block |
||
| 2296 | 2302 | * Modify member information |
| 2297 | 2303 | * |
| 2298 | 2304 | * @param bool $is_admin , modified 2013-11-22 |
| 2305 | + * @param stdClass $args |
|
| 2299 | 2306 | */ |
| 2300 | 2307 | function updateMember($args, $is_admin = FALSE) |
| 2301 | 2308 | { |
@@ -2500,6 +2507,7 @@ discard block |
||
| 2500 | 2507 | |
| 2501 | 2508 | /** |
| 2502 | 2509 | * Modify member password |
| 2510 | + * @param stdClass $args |
|
| 2503 | 2511 | */ |
| 2504 | 2512 | function updateMemberPassword($args) |
| 2505 | 2513 | { |
@@ -2534,6 +2542,9 @@ discard block |
||
| 2534 | 2542 | return $output; |
| 2535 | 2543 | } |
| 2536 | 2544 | |
| 2545 | + /** |
|
| 2546 | + * @param string $answer |
|
| 2547 | + */ |
|
| 2537 | 2548 | function updateFindAccountAnswer($member_srl, $answer) |
| 2538 | 2549 | { |
| 2539 | 2550 | $oPassword = new Password(); |
@@ -2793,7 +2804,7 @@ discard block |
||
| 2793 | 2804 | * |
| 2794 | 2805 | * @param array &$menu_list |
| 2795 | 2806 | * |
| 2796 | - * @return object |
|
| 2807 | + * @return BaseObject |
|
| 2797 | 2808 | **/ |
| 2798 | 2809 | function triggerGetDocumentMenu(&$menu_list) |
| 2799 | 2810 | { |
@@ -2823,7 +2834,7 @@ discard block |
||
| 2823 | 2834 | * |
| 2824 | 2835 | * @param array &$menu_list |
| 2825 | 2836 | * |
| 2826 | - * @return object |
|
| 2837 | + * @return BaseObject |
|
| 2827 | 2838 | **/ |
| 2828 | 2839 | function triggerGetCommentMenu(&$menu_list) |
| 2829 | 2840 | { |
@@ -2851,7 +2862,7 @@ discard block |
||
| 2851 | 2862 | /** |
| 2852 | 2863 | * Spammer manage. Denied user login. And delete or trash all documents. Response Ajax string |
| 2853 | 2864 | * |
| 2854 | - * @return object |
|
| 2865 | + * @return BaseObject |
|
| 2855 | 2866 | **/ |
| 2856 | 2867 | function procMemberSpammerManage() |
| 2857 | 2868 | { |
@@ -41,19 +41,31 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Variables |
| 44 | - if(!$user_id) $user_id = Context::get('user_id'); |
|
| 44 | + if(!$user_id) { |
|
| 45 | + $user_id = Context::get('user_id'); |
|
| 46 | + } |
|
| 45 | 47 | $user_id = trim($user_id); |
| 46 | 48 | |
| 47 | - if(!$password) $password = Context::get('password'); |
|
| 49 | + if(!$password) { |
|
| 50 | + $password = Context::get('password'); |
|
| 51 | + } |
|
| 48 | 52 | $password = trim($password); |
| 49 | 53 | |
| 50 | - if(!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
| 54 | + if(!$keep_signed) { |
|
| 55 | + $keep_signed = Context::get('keep_signed'); |
|
| 56 | + } |
|
| 51 | 57 | // Return an error when id and password doesn't exist |
| 52 | - if(!$user_id) return new BaseObject(-1,'null_user_id'); |
|
| 53 | - if(!$password) return new BaseObject(-1,'null_password'); |
|
| 58 | + if(!$user_id) { |
|
| 59 | + return new BaseObject(-1,'null_user_id'); |
|
| 60 | + } |
|
| 61 | + if(!$password) { |
|
| 62 | + return new BaseObject(-1,'null_password'); |
|
| 63 | + } |
|
| 54 | 64 | |
| 55 | 65 | $output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false); |
| 56 | - if (!$output->toBool()) return $output; |
|
| 66 | + if (!$output->toBool()) { |
|
| 67 | + return $output; |
|
| 68 | + } |
|
| 57 | 69 | |
| 58 | 70 | $oModuleModel = getModel('module'); |
| 59 | 71 | $config = $oModuleModel->getModuleConfig('member'); |
@@ -80,8 +92,7 @@ discard block |
||
| 80 | 92 | if(!$config->after_login_url) |
| 81 | 93 | { |
| 82 | 94 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 83 | - } |
|
| 84 | - else |
|
| 95 | + } else |
|
| 85 | 96 | { |
| 86 | 97 | $returnUrl = $config->after_login_url; |
| 87 | 98 | } |
@@ -98,19 +109,24 @@ discard block |
||
| 98 | 109 | // Call a trigger before log-out (before) |
| 99 | 110 | $logged_info = Context::get('logged_info'); |
| 100 | 111 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); |
| 101 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 112 | + if(!$trigger_output->toBool()) { |
|
| 113 | + return $trigger_output; |
|
| 114 | + } |
|
| 102 | 115 | // Destroy session information |
| 103 | 116 | $this->destroySessionInfo(); |
| 104 | 117 | // Call a trigger after log-out (after) |
| 105 | 118 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); |
| 106 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 119 | + if(!$trigger_output->toBool()) { |
|
| 120 | + return $trigger_output; |
|
| 121 | + } |
|
| 107 | 122 | |
| 108 | 123 | $output = new BaseObject(); |
| 109 | 124 | |
| 110 | 125 | $oModuleModel = getModel('module'); |
| 111 | 126 | $config = $oModuleModel->getModuleConfig('member'); |
| 112 | - if($config->after_logout_url) |
|
| 113 | - $output->redirect_url = $config->after_logout_url; |
|
| 127 | + if($config->after_logout_url) { |
|
| 128 | + $output->redirect_url = $config->after_logout_url; |
|
| 129 | + } |
|
| 114 | 130 | |
| 115 | 131 | $this->_clearMemberCache($logged_info->member_srl); |
| 116 | 132 | |
@@ -127,12 +143,18 @@ discard block |
||
| 127 | 143 | $oModuleModel = &getModel('module'); |
| 128 | 144 | |
| 129 | 145 | // Check login information |
| 130 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 146 | + if(!Context::get('is_logged')) { |
|
| 147 | + return new BaseObject(-1, 'msg_not_logged'); |
|
| 148 | + } |
|
| 131 | 149 | $logged_info = Context::get('logged_info'); |
| 132 | 150 | |
| 133 | 151 | $document_srl = (int)Context::get('document_srl'); |
| 134 | - if(!$document_srl) $document_srl = (int)Context::get('target_srl'); |
|
| 135 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 152 | + if(!$document_srl) { |
|
| 153 | + $document_srl = (int)Context::get('target_srl'); |
|
| 154 | + } |
|
| 155 | + if(!$document_srl) { |
|
| 156 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 157 | + } |
|
| 136 | 158 | |
| 137 | 159 | // Get document |
| 138 | 160 | $oDocumentModel = getModel('document'); |
@@ -180,11 +202,15 @@ discard block |
||
| 180 | 202 | |
| 181 | 203 | // Check if already scrapped |
| 182 | 204 | $output = executeQuery('member.getScrapDocument', $args); |
| 183 | - if($output->data->count) return new BaseObject(-1, 'msg_alreay_scrapped'); |
|
| 205 | + if($output->data->count) { |
|
| 206 | + return new BaseObject(-1, 'msg_alreay_scrapped'); |
|
| 207 | + } |
|
| 184 | 208 | |
| 185 | 209 | // Insert |
| 186 | 210 | $output = executeQuery('member.addScrapDocument', $args); |
| 187 | - if(!$output->toBool()) return $output; |
|
| 211 | + if(!$output->toBool()) { |
|
| 212 | + return $output; |
|
| 213 | + } |
|
| 188 | 214 | |
| 189 | 215 | $this->setError(-1); |
| 190 | 216 | $this->setMessage('success_registed'); |
@@ -198,11 +224,15 @@ discard block |
||
| 198 | 224 | function procMemberDeleteScrap() |
| 199 | 225 | { |
| 200 | 226 | // Check login information |
| 201 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 227 | + if(!Context::get('is_logged')) { |
|
| 228 | + return new BaseObject(-1, 'msg_not_logged'); |
|
| 229 | + } |
|
| 202 | 230 | $logged_info = Context::get('logged_info'); |
| 203 | 231 | |
| 204 | 232 | $document_srl = (int)Context::get('document_srl'); |
| 205 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 233 | + if(!$document_srl) { |
|
| 234 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 235 | + } |
|
| 206 | 236 | // Variables |
| 207 | 237 | $args = new stdClass; |
| 208 | 238 | $args->member_srl = $logged_info->member_srl; |
@@ -228,11 +258,15 @@ discard block |
||
| 228 | 258 | function procMemberDeleteSavedDocument() |
| 229 | 259 | { |
| 230 | 260 | // Check login information |
| 231 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 261 | + if(!Context::get('is_logged')) { |
|
| 262 | + return new BaseObject(-1, 'msg_not_logged'); |
|
| 263 | + } |
|
| 232 | 264 | $logged_info = Context::get('logged_info'); |
| 233 | 265 | |
| 234 | 266 | $document_srl = (int)Context::get('document_srl'); |
| 235 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 267 | + if(!$document_srl) { |
|
| 268 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 269 | + } |
|
| 236 | 270 | |
| 237 | 271 | $oDocumentModel = getModel('document'); |
| 238 | 272 | $oDocument = $oDocumentModel->getDocument($document_srl); |
@@ -260,7 +294,9 @@ discard block |
||
| 260 | 294 | { |
| 261 | 295 | $name = Context::get('name'); |
| 262 | 296 | $value = Context::get('value'); |
| 263 | - if(!$value) return; |
|
| 297 | + if(!$value) { |
|
| 298 | + return; |
|
| 299 | + } |
|
| 264 | 300 | |
| 265 | 301 | $oMemberModel = getModel('member'); |
| 266 | 302 | // Check if logged-in |
@@ -271,10 +307,14 @@ discard block |
||
| 271 | 307 | { |
| 272 | 308 | case 'user_id' : |
| 273 | 309 | // Check denied ID |
| 274 | - if($oMemberModel->isDeniedID($value)) return new BaseObject(0,'denied_user_id'); |
|
| 310 | + if($oMemberModel->isDeniedID($value)) { |
|
| 311 | + return new BaseObject(0,'denied_user_id'); |
|
| 312 | + } |
|
| 275 | 313 | // Check if duplicated |
| 276 | 314 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
| 277 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_user_id'); |
|
| 315 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 316 | + return new BaseObject(0,'msg_exists_user_id'); |
|
| 317 | + } |
|
| 278 | 318 | break; |
| 279 | 319 | case 'nick_name' : |
| 280 | 320 | // Check denied ID |
@@ -284,13 +324,17 @@ discard block |
||
| 284 | 324 | } |
| 285 | 325 | // Check if duplicated |
| 286 | 326 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
| 287 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_nick_name'); |
|
| 327 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 328 | + return new BaseObject(0,'msg_exists_nick_name'); |
|
| 329 | + } |
|
| 288 | 330 | |
| 289 | 331 | break; |
| 290 | 332 | case 'email_address' : |
| 291 | 333 | // Check if duplicated |
| 292 | 334 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
| 293 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new BaseObject(0,'msg_exists_email_address'); |
|
| 335 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 336 | + return new BaseObject(0,'msg_exists_email_address'); |
|
| 337 | + } |
|
| 294 | 338 | break; |
| 295 | 339 | } |
| 296 | 340 | } |
@@ -302,17 +346,25 @@ discard block |
||
| 302 | 346 | */ |
| 303 | 347 | function procMemberInsert() |
| 304 | 348 | { |
| 305 | - if (Context::getRequestMethod () == "GET") return new BaseObject(-1, "msg_invalid_request"); |
|
| 349 | + if (Context::getRequestMethod () == "GET") { |
|
| 350 | + return new BaseObject(-1, "msg_invalid_request"); |
|
| 351 | + } |
|
| 306 | 352 | $oMemberModel = &getModel ('member'); |
| 307 | 353 | $config = $oMemberModel->getMemberConfig(); |
| 308 | 354 | |
| 309 | 355 | // call a trigger (before) |
| 310 | 356 | $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
| 311 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
| 357 | + if(!$trigger_output->toBool ()) { |
|
| 358 | + return $trigger_output; |
|
| 359 | + } |
|
| 312 | 360 | // Check if an administrator allows a membership |
| 313 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
| 361 | + if($config->enable_join != 'Y') { |
|
| 362 | + return $this->stop ('msg_signup_disabled'); |
|
| 363 | + } |
|
| 314 | 364 | // Check if the user accept the license terms (only if terms exist) |
| 315 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
| 365 | + if($config->agreement && Context::get('accept_agreement')!='Y') { |
|
| 366 | + return $this->stop('msg_accept_agreement'); |
|
| 367 | + } |
|
| 316 | 368 | |
| 317 | 369 | // Extract the necessary information in advance |
| 318 | 370 | $getVars = array(); |
@@ -331,16 +383,22 @@ discard block |
||
| 331 | 383 | foreach($getVars as $val) |
| 332 | 384 | { |
| 333 | 385 | $args->{$val} = Context::get($val); |
| 334 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 386 | + if($val == 'birthday') { |
|
| 387 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
| 388 | + } |
|
| 335 | 389 | } |
| 336 | 390 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 337 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 391 | + if(!$args->birthday && $args->birthday_ui) { |
|
| 392 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 393 | + } |
|
| 338 | 394 | |
| 339 | 395 | $args->find_account_answer = Context::get('find_account_answer'); |
| 340 | 396 | $args->allow_mailing = Context::get('allow_mailing'); |
| 341 | 397 | $args->allow_message = Context::get('allow_message'); |
| 342 | 398 | |
| 343 | - if($args->password1) $args->password = $args->password1; |
|
| 399 | + if($args->password1) { |
|
| 400 | + $args->password = $args->password1; |
|
| 401 | + } |
|
| 344 | 402 | |
| 345 | 403 | // check password strength |
| 346 | 404 | if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
@@ -369,7 +427,9 @@ discard block |
||
| 369 | 427 | unset($all_args->secret_text); |
| 370 | 428 | |
| 371 | 429 | // Set the user state as "denied" when using mail authentication |
| 372 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 430 | + if($config->enable_confirm == 'Y') { |
|
| 431 | + $args->denied = 'Y'; |
|
| 432 | + } |
|
| 373 | 433 | // Add extra vars after excluding necessary information from all the requested arguments |
| 374 | 434 | $extra_vars = delObjectVars($all_args, $args); |
| 375 | 435 | $args->extra_vars = serialize($extra_vars); |
@@ -384,7 +444,9 @@ discard block |
||
| 384 | 444 | } |
| 385 | 445 | } |
| 386 | 446 | $output = $this->insertMember($args); |
| 387 | - if(!$output->toBool()) return $output; |
|
| 447 | + if(!$output->toBool()) { |
|
| 448 | + return $output; |
|
| 449 | + } |
|
| 388 | 450 | |
| 389 | 451 | // insert ProfileImage, ImageName, ImageMark |
| 390 | 452 | $profile_image = $_FILES['profile_image']; |
@@ -423,43 +485,46 @@ discard block |
||
| 423 | 485 | if($config->identifier == 'email_address') |
| 424 | 486 | { |
| 425 | 487 | $output = $this->doLogin($args->email_address); |
| 426 | - } |
|
| 427 | - else |
|
| 488 | + } else |
|
| 428 | 489 | { |
| 429 | 490 | $output = $this->doLogin($args->user_id); |
| 430 | 491 | } |
| 431 | 492 | if(!$output->toBool()) { |
| 432 | - if($output->error == -9) |
|
| 433 | - $output->error = -11; |
|
| 493 | + if($output->error == -9) { |
|
| 494 | + $output->error = -11; |
|
| 495 | + } |
|
| 434 | 496 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
| 435 | 497 | } |
| 436 | 498 | } |
| 437 | 499 | |
| 438 | 500 | // Results |
| 439 | 501 | $this->add('member_srl', $args->member_srl); |
| 440 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 502 | + if($config->redirect_url) { |
|
| 503 | + $this->add('redirect_url', $config->redirect_url); |
|
| 504 | + } |
|
| 441 | 505 | if($config->enable_confirm == 'Y') |
| 442 | 506 | { |
| 443 | 507 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
| 444 | 508 | $this->setMessage($msg); |
| 445 | 509 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), new BaseObject(-12, $msg)); |
| 510 | + } else { |
|
| 511 | + $this->setMessage('success_registed'); |
|
| 446 | 512 | } |
| 447 | - else $this->setMessage('success_registed'); |
|
| 448 | 513 | // Call a trigger (after) |
| 449 | 514 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
| 450 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 515 | + if(!$trigger_output->toBool()) { |
|
| 516 | + return $trigger_output; |
|
| 517 | + } |
|
| 451 | 518 | |
| 452 | 519 | if($config->redirect_url) |
| 453 | 520 | { |
| 454 | 521 | $returnUrl = $config->redirect_url; |
| 455 | - } |
|
| 456 | - else |
|
| 522 | + } else |
|
| 457 | 523 | { |
| 458 | 524 | if(Context::get('success_return_url')) |
| 459 | 525 | { |
| 460 | 526 | $returnUrl = Context::get('success_return_url'); |
| 461 | - } |
|
| 462 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 527 | + } else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 463 | 528 | { |
| 464 | 529 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
| 465 | 530 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -513,8 +578,7 @@ discard block |
||
| 513 | 578 | if(Context::get('success_return_url')) |
| 514 | 579 | { |
| 515 | 580 | $redirectUrl = Context::get('success_return_url'); |
| 516 | - } |
|
| 517 | - else |
|
| 581 | + } else |
|
| 518 | 582 | { |
| 519 | 583 | $redirectUrl = getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 520 | 584 | } |
@@ -558,7 +622,9 @@ discard block |
||
| 558 | 622 | foreach($getVars as $val) |
| 559 | 623 | { |
| 560 | 624 | $args->{$val} = Context::get($val); |
| 561 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 625 | + if($val == 'birthday') { |
|
| 626 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
| 627 | + } |
|
| 562 | 628 | if($val == 'find_account_answer' && !Context::get($val)) { |
| 563 | 629 | unset($args->{$val}); |
| 564 | 630 | } |
@@ -568,7 +634,9 @@ discard block |
||
| 568 | 634 | $logged_info = Context::get('logged_info'); |
| 569 | 635 | $args->member_srl = $logged_info->member_srl; |
| 570 | 636 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 571 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 637 | + if(!$args->birthday && $args->birthday_ui) { |
|
| 638 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 639 | + } |
|
| 572 | 640 | |
| 573 | 641 | // Remove some unnecessary variables from all the vars |
| 574 | 642 | $all_args = Context::getRequestVars(); |
@@ -603,7 +671,9 @@ discard block |
||
| 603 | 671 | |
| 604 | 672 | // Execute insert or update depending on the value of member_srl |
| 605 | 673 | $output = $this->updateMember($args); |
| 606 | - if(!$output->toBool()) return $output; |
|
| 674 | + if(!$output->toBool()) { |
|
| 675 | + return $output; |
|
| 676 | + } |
|
| 607 | 677 | |
| 608 | 678 | $profile_image = $_FILES['profile_image']; |
| 609 | 679 | if(is_uploaded_file($profile_image['tmp_name'])) |
@@ -633,7 +703,9 @@ discard block |
||
| 633 | 703 | |
| 634 | 704 | // Call a trigger after successfully log-in (after) |
| 635 | 705 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
| 636 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 706 | + if(!$trigger_output->toBool()) { |
|
| 707 | + return $trigger_output; |
|
| 708 | + } |
|
| 637 | 709 | |
| 638 | 710 | $this->setSessionInfo(); |
| 639 | 711 | // Return result |
@@ -654,7 +726,9 @@ discard block |
||
| 654 | 726 | */ |
| 655 | 727 | function procMemberModifyPassword() |
| 656 | 728 | { |
| 657 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 729 | + if(!Context::get('is_logged')) { |
|
| 730 | + return $this->stop('msg_not_logged'); |
|
| 731 | + } |
|
| 658 | 732 | // Extract the necessary information in advance |
| 659 | 733 | $current_password = trim(Context::get('current_password')); |
| 660 | 734 | $password = trim(Context::get('password1')); |
@@ -668,17 +742,23 @@ discard block |
||
| 668 | 742 | |
| 669 | 743 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 670 | 744 | // Verify the cuttent password |
| 671 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new BaseObject(-1, 'invalid_password'); |
|
| 745 | + if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) { |
|
| 746 | + return new BaseObject(-1, 'invalid_password'); |
|
| 747 | + } |
|
| 672 | 748 | |
| 673 | 749 | // Check if a new password is as same as the previous password |
| 674 | - if($current_password == $password) return new BaseObject(-1, 'invalid_new_password'); |
|
| 750 | + if($current_password == $password) { |
|
| 751 | + return new BaseObject(-1, 'invalid_new_password'); |
|
| 752 | + } |
|
| 675 | 753 | |
| 676 | 754 | // Execute insert or update depending on the value of member_srl |
| 677 | 755 | $args = new stdClass; |
| 678 | 756 | $args->member_srl = $member_srl; |
| 679 | 757 | $args->password = $password; |
| 680 | 758 | $output = $this->updateMemberPassword($args); |
| 681 | - if(!$output->toBool()) return $output; |
|
| 759 | + if(!$output->toBool()) { |
|
| 760 | + return $output; |
|
| 761 | + } |
|
| 682 | 762 | |
| 683 | 763 | $this->add('member_srl', $args->member_srl); |
| 684 | 764 | $this->setMessage('success_updated'); |
@@ -694,7 +774,9 @@ discard block |
||
| 694 | 774 | */ |
| 695 | 775 | function procMemberLeave() |
| 696 | 776 | { |
| 697 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 777 | + if(!Context::get('is_logged')) { |
|
| 778 | + return $this->stop('msg_not_logged'); |
|
| 779 | + } |
|
| 698 | 780 | // Extract the necessary information in advance |
| 699 | 781 | $password = trim(Context::get('password')); |
| 700 | 782 | // Get information of logged-in user |
@@ -710,10 +792,14 @@ discard block |
||
| 710 | 792 | $this->memberInfo->password = $memberInfo->password; |
| 711 | 793 | } |
| 712 | 794 | // Verify the cuttent password |
| 713 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new BaseObject(-1, 'invalid_password'); |
|
| 795 | + if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) { |
|
| 796 | + return new BaseObject(-1, 'invalid_password'); |
|
| 797 | + } |
|
| 714 | 798 | |
| 715 | 799 | $output = $this->deleteMember($member_srl); |
| 716 | - if(!$output->toBool()) return $output; |
|
| 800 | + if(!$output->toBool()) { |
|
| 801 | + return $output; |
|
| 802 | + } |
|
| 717 | 803 | // Destroy all session information |
| 718 | 804 | $this->destroySessionInfo(); |
| 719 | 805 | // Return success message |
@@ -732,20 +818,30 @@ discard block |
||
| 732 | 818 | { |
| 733 | 819 | // Check if the file is successfully uploaded |
| 734 | 820 | $file = $_FILES['profile_image']; |
| 735 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 821 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 822 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 823 | + } |
|
| 736 | 824 | // Ignore if member_srl is invalid or doesn't exist. |
| 737 | 825 | $member_srl = Context::get('member_srl'); |
| 738 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 826 | + if(!$member_srl) { |
|
| 827 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 828 | + } |
|
| 739 | 829 | |
| 740 | 830 | $logged_info = Context::get('logged_info'); |
| 741 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 831 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 832 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 833 | + } |
|
| 742 | 834 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 743 | 835 | $oMemberModel = getModel('member'); |
| 744 | 836 | $config = $oMemberModel->getMemberConfig(); |
| 745 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 837 | + if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') { |
|
| 838 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 839 | + } |
|
| 746 | 840 | |
| 747 | 841 | $output = $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 748 | - if(!$output->toBool()) return $output; |
|
| 842 | + if(!$output->toBool()) { |
|
| 843 | + return $output; |
|
| 844 | + } |
|
| 749 | 845 | |
| 750 | 846 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 751 | 847 | $this->setRedirectUrl($returnUrl); |
@@ -768,8 +864,9 @@ discard block |
||
| 768 | 864 | $max_filesize = $config->profile_image_max_filesize; |
| 769 | 865 | foreach($config->signupForm as $val) |
| 770 | 866 | { |
| 771 | - if($val->name == "profile_image") |
|
| 772 | - $allow_transparent = $val->allow_transparent_thumbnail == 'Y'; |
|
| 867 | + if($val->name == "profile_image") { |
|
| 868 | + $allow_transparent = $val->allow_transparent_thumbnail == 'Y'; |
|
| 869 | + } |
|
| 773 | 870 | } |
| 774 | 871 | |
| 775 | 872 | Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
@@ -777,10 +874,13 @@ discard block |
||
| 777 | 874 | // Get file information |
| 778 | 875 | FileHandler::clearStatCache($target_file); |
| 779 | 876 | list($width, $height, $type) = @getimagesize($target_file); |
| 780 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 781 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 782 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 783 | - else |
|
| 877 | + if(IMAGETYPE_PNG == $type) { |
|
| 878 | + $ext = 'png'; |
|
| 879 | + } elseif(IMAGETYPE_JPEG == $type) { |
|
| 880 | + $ext = 'jpg'; |
|
| 881 | + } elseif(IMAGETYPE_GIF == $type) { |
|
| 882 | + $ext = 'gif'; |
|
| 883 | + } else |
|
| 784 | 884 | { |
| 785 | 885 | return $this->stop('msg_not_uploaded_profile_image'); |
| 786 | 886 | } |
@@ -811,8 +911,7 @@ discard block |
||
| 811 | 911 | FileHandler::removeFilesInDir($target_path); |
| 812 | 912 | FileHandler::moveFile($temp_filename, $target_filename); |
| 813 | 913 | FileHandler::clearStatCache($target_filename); |
| 814 | - } |
|
| 815 | - else |
|
| 914 | + } else |
|
| 816 | 915 | { |
| 817 | 916 | // 파일 용량 제한 |
| 818 | 917 | $filesize = filesize($target_file); |
@@ -841,20 +940,30 @@ discard block |
||
| 841 | 940 | { |
| 842 | 941 | // Check if the file is successfully uploaded |
| 843 | 942 | $file = $_FILES['image_name']; |
| 844 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 943 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 944 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 945 | + } |
|
| 845 | 946 | // Ignore if member_srl is invalid or doesn't exist. |
| 846 | 947 | $member_srl = Context::get('member_srl'); |
| 847 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 948 | + if(!$member_srl) { |
|
| 949 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 950 | + } |
|
| 848 | 951 | |
| 849 | 952 | $logged_info = Context::get('logged_info'); |
| 850 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 953 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 954 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 955 | + } |
|
| 851 | 956 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 852 | 957 | $oMemberModel = getModel('member'); |
| 853 | 958 | $config = $oMemberModel->getMemberConfig(); |
| 854 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 959 | + if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') { |
|
| 960 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 961 | + } |
|
| 855 | 962 | |
| 856 | 963 | $output = $this->insertImageName($member_srl, $file['tmp_name']); |
| 857 | - if(!$output->toBool()) return $output; |
|
| 964 | + if(!$output->toBool()) { |
|
| 965 | + return $output; |
|
| 966 | + } |
|
| 858 | 967 | |
| 859 | 968 | // Page refresh |
| 860 | 969 | //$this->setRefreshPage(); |
@@ -909,8 +1018,7 @@ discard block |
||
| 909 | 1018 | FileHandler::removeFilesInDir($target_path); |
| 910 | 1019 | FileHandler::moveFile($temp_filename, $target_filename); |
| 911 | 1020 | FileHandler::clearStatCache($target_filename); |
| 912 | - } |
|
| 913 | - else |
|
| 1021 | + } else |
|
| 914 | 1022 | { |
| 915 | 1023 | // 파일 용량 제한 |
| 916 | 1024 | $filesize = filesize($target_file); |
@@ -987,20 +1095,30 @@ discard block |
||
| 987 | 1095 | { |
| 988 | 1096 | // Check if the file is successfully uploaded |
| 989 | 1097 | $file = $_FILES['image_mark']; |
| 990 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1098 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 1099 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1100 | + } |
|
| 991 | 1101 | // Ignore if member_srl is invalid or doesn't exist. |
| 992 | 1102 | $member_srl = Context::get('member_srl'); |
| 993 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1103 | + if(!$member_srl) { |
|
| 1104 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1105 | + } |
|
| 994 | 1106 | |
| 995 | 1107 | $logged_info = Context::get('logged_info'); |
| 996 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1108 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 1109 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1110 | + } |
|
| 997 | 1111 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 998 | 1112 | $oMemberModel = getModel('member'); |
| 999 | 1113 | $config = $oMemberModel->getMemberConfig(); |
| 1000 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1114 | + if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') { |
|
| 1115 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1116 | + } |
|
| 1001 | 1117 | |
| 1002 | 1118 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 1003 | - if(!$output->toBool()) return $output; |
|
| 1119 | + if(!$output->toBool()) { |
|
| 1120 | + return $output; |
|
| 1121 | + } |
|
| 1004 | 1122 | |
| 1005 | 1123 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 1006 | 1124 | $this->setRedirectUrl($returnUrl); |
@@ -1051,8 +1169,7 @@ discard block |
||
| 1051 | 1169 | FileHandler::removeFilesInDir($target_path); |
| 1052 | 1170 | FileHandler::moveFile($temp_filename, $target_filename); |
| 1053 | 1171 | FileHandler::clearStatCache($target_filename); |
| 1054 | - } |
|
| 1055 | - else |
|
| 1172 | + } else |
|
| 1056 | 1173 | { |
| 1057 | 1174 | $filesize = filesize($target_file); |
| 1058 | 1175 | if($max_filesize && $filesize > ($max_filesize * 1024)) |
@@ -1104,14 +1221,18 @@ discard block |
||
| 1104 | 1221 | function procMemberFindAccount() |
| 1105 | 1222 | { |
| 1106 | 1223 | $email_address = Context::get('email_address'); |
| 1107 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1224 | + if(!$email_address) { |
|
| 1225 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1226 | + } |
|
| 1108 | 1227 | |
| 1109 | 1228 | $oMemberModel = getModel('member'); |
| 1110 | 1229 | $oModuleModel = getModel('module'); |
| 1111 | 1230 | |
| 1112 | 1231 | // Check if a member having the same email address exists |
| 1113 | 1232 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1114 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1233 | + if(!$member_srl) { |
|
| 1234 | + return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1235 | + } |
|
| 1115 | 1236 | |
| 1116 | 1237 | // Get information of the member |
| 1117 | 1238 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
@@ -1123,7 +1244,9 @@ discard block |
||
| 1123 | 1244 | $chk_args = new stdClass; |
| 1124 | 1245 | $chk_args->member_srl = $member_info->member_srl; |
| 1125 | 1246 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1126 | - if($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1247 | + if($output->toBool() && $output->data->count != '0') { |
|
| 1248 | + return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1249 | + } |
|
| 1127 | 1250 | } |
| 1128 | 1251 | |
| 1129 | 1252 | // Insert data into the authentication DB |
@@ -1136,7 +1259,9 @@ discard block |
||
| 1136 | 1259 | $args->is_register = 'N'; |
| 1137 | 1260 | |
| 1138 | 1261 | $output = executeQuery('member.insertAuthMail', $args); |
| 1139 | - if(!$output->toBool()) return $output; |
|
| 1262 | + if(!$output->toBool()) { |
|
| 1263 | + return $output; |
|
| 1264 | + } |
|
| 1140 | 1265 | // Get content of the email to send a member |
| 1141 | 1266 | Context::set('auth_args', $args); |
| 1142 | 1267 | |
@@ -1153,8 +1278,7 @@ discard block |
||
| 1153 | 1278 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1154 | 1279 | } |
| 1155 | 1280 | } |
| 1156 | - } |
|
| 1157 | - else |
|
| 1281 | + } else |
|
| 1158 | 1282 | { |
| 1159 | 1283 | $memberInfo[$lang->user_id] = $args->user_id; |
| 1160 | 1284 | $memberInfo[$lang->user_name] = $args->user_name; |
@@ -1163,13 +1287,19 @@ discard block |
||
| 1163 | 1287 | } |
| 1164 | 1288 | Context::set('memberInfo', $memberInfo); |
| 1165 | 1289 | |
| 1166 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1167 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1290 | + if(!$member_config->skin) { |
|
| 1291 | + $member_config->skin = "default"; |
|
| 1292 | + } |
|
| 1293 | + if(!$member_config->colorset) { |
|
| 1294 | + $member_config->colorset = "white"; |
|
| 1295 | + } |
|
| 1168 | 1296 | |
| 1169 | 1297 | Context::set('member_config', $member_config); |
| 1170 | 1298 | |
| 1171 | 1299 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1172 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1300 | + if(!is_dir($tpl_path)) { |
|
| 1301 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1302 | + } |
|
| 1173 | 1303 | |
| 1174 | 1304 | $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
| 1175 | 1305 | Context::set('find_url', $find_url); |
@@ -1212,19 +1342,25 @@ discard block |
||
| 1212 | 1342 | $find_account_question = trim(Context::get('find_account_question')); |
| 1213 | 1343 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1214 | 1344 | |
| 1215 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1345 | + if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) { |
|
| 1346 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1347 | + } |
|
| 1216 | 1348 | |
| 1217 | 1349 | $oModuleModel = getModel('module'); |
| 1218 | 1350 | // Check if a member having the same email address exists |
| 1219 | 1351 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1220 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1352 | + if(!$member_srl) { |
|
| 1353 | + return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1354 | + } |
|
| 1221 | 1355 | |
| 1222 | 1356 | // Get information of the member |
| 1223 | 1357 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1224 | 1358 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1225 | 1359 | |
| 1226 | 1360 | // Display a message if no answer is entered |
| 1227 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1361 | + if(!$member_info->find_account_question || !$member_info->find_account_answer) { |
|
| 1362 | + return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1363 | + } |
|
| 1228 | 1364 | |
| 1229 | 1365 | // 답변 확인 |
| 1230 | 1366 | $hashed = $oPassword->checkAlgorithm($member_info->find_account_answer); |
@@ -1233,12 +1369,10 @@ discard block |
||
| 1233 | 1369 | if($member_info->find_account_question != $find_account_question) |
| 1234 | 1370 | { |
| 1235 | 1371 | $authed = false; |
| 1236 | - } |
|
| 1237 | - else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1372 | + } else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1238 | 1373 | { |
| 1239 | 1374 | $authed = false; |
| 1240 | - } |
|
| 1241 | - else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1375 | + } else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1242 | 1376 | { |
| 1243 | 1377 | $authed = false; |
| 1244 | 1378 | } |
@@ -1267,7 +1401,9 @@ discard block |
||
| 1267 | 1401 | $args->password = $temp_password; |
| 1268 | 1402 | $args->change_password_date = '1'; |
| 1269 | 1403 | $output = $this->updateMemberPassword($args); |
| 1270 | - if(!$output->toBool()) return $output; |
|
| 1404 | + if(!$output->toBool()) { |
|
| 1405 | + return $output; |
|
| 1406 | + } |
|
| 1271 | 1407 | |
| 1272 | 1408 | $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
| 1273 | 1409 | |
@@ -1327,7 +1463,9 @@ discard block |
||
| 1327 | 1463 | $auth_args->is_register = 'Y'; |
| 1328 | 1464 | |
| 1329 | 1465 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1330 | - if(!$output->toBool()) return $output; |
|
| 1466 | + if(!$output->toBool()) { |
|
| 1467 | + return $output; |
|
| 1468 | + } |
|
| 1331 | 1469 | |
| 1332 | 1470 | // resend auth mail. |
| 1333 | 1471 | $this->_sendAuthMail($auth_args, $memberInfo); |
@@ -1344,8 +1482,7 @@ discard block |
||
| 1344 | 1482 | if($output->data->is_register == 'Y') |
| 1345 | 1483 | { |
| 1346 | 1484 | $args->denied = 'N'; |
| 1347 | - } |
|
| 1348 | - else |
|
| 1485 | + } else |
|
| 1349 | 1486 | { |
| 1350 | 1487 | $args->password = $oMemberModel->hashPassword($args->password); |
| 1351 | 1488 | } |
@@ -1379,33 +1516,45 @@ discard block |
||
| 1379 | 1516 | { |
| 1380 | 1517 | // Get an email_address |
| 1381 | 1518 | $email_address = Context::get('email_address'); |
| 1382 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1519 | + if(!$email_address) { |
|
| 1520 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1521 | + } |
|
| 1383 | 1522 | // Log test by using email_address |
| 1384 | 1523 | $oMemberModel = getModel('member'); |
| 1385 | 1524 | |
| 1386 | 1525 | $args = new stdClass; |
| 1387 | 1526 | $args->email_address = $email_address; |
| 1388 | 1527 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1389 | - if(!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1528 | + if(!$memberSrl) { |
|
| 1529 | + return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1530 | + } |
|
| 1390 | 1531 | |
| 1391 | 1532 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1392 | 1533 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1393 | 1534 | |
| 1394 | 1535 | $oModuleModel = getModel('module'); |
| 1395 | 1536 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1396 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1397 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1537 | + if(!$member_config->skin) { |
|
| 1538 | + $member_config->skin = "default"; |
|
| 1539 | + } |
|
| 1540 | + if(!$member_config->colorset) { |
|
| 1541 | + $member_config->colorset = "white"; |
|
| 1542 | + } |
|
| 1398 | 1543 | |
| 1399 | 1544 | // Check if a authentication mail has been sent previously |
| 1400 | 1545 | $chk_args = new stdClass; |
| 1401 | 1546 | $chk_args->member_srl = $member_info->member_srl; |
| 1402 | 1547 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1403 | - if($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1548 | + if($output->toBool() && $output->data->count == '0') { |
|
| 1549 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1550 | + } |
|
| 1404 | 1551 | |
| 1405 | 1552 | $auth_args = new stdClass; |
| 1406 | 1553 | $auth_args->member_srl = $member_info->member_srl; |
| 1407 | 1554 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1408 | - if(!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1555 | + if(!$output->data || !$output->data[0]->auth_key) { |
|
| 1556 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1557 | + } |
|
| 1409 | 1558 | $auth_info = $output->data[0]; |
| 1410 | 1559 | |
| 1411 | 1560 | // Update the regdate of authmail entry |
@@ -1426,8 +1575,7 @@ discard block |
||
| 1426 | 1575 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1427 | 1576 | } |
| 1428 | 1577 | } |
| 1429 | - } |
|
| 1430 | - else |
|
| 1578 | + } else |
|
| 1431 | 1579 | { |
| 1432 | 1580 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1433 | 1581 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1440,7 +1588,9 @@ discard block |
||
| 1440 | 1588 | Context::set('member_config', $member_config); |
| 1441 | 1589 | |
| 1442 | 1590 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1443 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1591 | + if(!is_dir($tpl_path)) { |
|
| 1592 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1593 | + } |
|
| 1444 | 1594 | |
| 1445 | 1595 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
| 1446 | 1596 | Context::set('auth_url', $auth_url); |
@@ -1518,7 +1668,9 @@ discard block |
||
| 1518 | 1668 | $auth_args->is_register = 'Y'; |
| 1519 | 1669 | |
| 1520 | 1670 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1521 | - if(!$output->toBool()) return $output; |
|
| 1671 | + if(!$output->toBool()) { |
|
| 1672 | + return $output; |
|
| 1673 | + } |
|
| 1522 | 1674 | |
| 1523 | 1675 | $memberInfo->email_address = $newEmail; |
| 1524 | 1676 | |
@@ -1552,8 +1704,7 @@ discard block |
||
| 1552 | 1704 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1553 | 1705 | } |
| 1554 | 1706 | } |
| 1555 | - } |
|
| 1556 | - else |
|
| 1707 | + } else |
|
| 1557 | 1708 | { |
| 1558 | 1709 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1559 | 1710 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1562,13 +1713,19 @@ discard block |
||
| 1562 | 1713 | } |
| 1563 | 1714 | Context::set('memberInfo', $memberInfo); |
| 1564 | 1715 | |
| 1565 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1566 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1716 | + if(!$member_config->skin) { |
|
| 1717 | + $member_config->skin = "default"; |
|
| 1718 | + } |
|
| 1719 | + if(!$member_config->colorset) { |
|
| 1720 | + $member_config->colorset = "white"; |
|
| 1721 | + } |
|
| 1567 | 1722 | |
| 1568 | 1723 | Context::set('member_config', $member_config); |
| 1569 | 1724 | |
| 1570 | 1725 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1571 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1726 | + if(!is_dir($tpl_path)) { |
|
| 1727 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1728 | + } |
|
| 1572 | 1729 | |
| 1573 | 1730 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
| 1574 | 1731 | Context::set('auth_url', $auth_url); |
@@ -1593,7 +1750,9 @@ discard block |
||
| 1593 | 1750 | { |
| 1594 | 1751 | $site_module_info = Context::get('site_module_info'); |
| 1595 | 1752 | $logged_info = Context::get('logged_info'); |
| 1596 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1753 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1754 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1755 | + } |
|
| 1597 | 1756 | |
| 1598 | 1757 | $oMemberModel = getModel('member'); |
| 1599 | 1758 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1612,13 +1771,17 @@ discard block |
||
| 1612 | 1771 | { |
| 1613 | 1772 | $site_module_info = Context::get('site_module_info'); |
| 1614 | 1773 | $logged_info = Context::get('logged_info'); |
| 1615 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1774 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1775 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1776 | + } |
|
| 1616 | 1777 | |
| 1617 | 1778 | $args = new stdClass; |
| 1618 | 1779 | $args->site_srl= $site_module_info->site_srl; |
| 1619 | 1780 | $args->member_srl = $logged_info->member_srl; |
| 1620 | 1781 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1621 | - if(!$output->toBool()) return $output; |
|
| 1782 | + if(!$output->toBool()) { |
|
| 1783 | + return $output; |
|
| 1784 | + } |
|
| 1622 | 1785 | $this->setMessage('success_deleted'); |
| 1623 | 1786 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1624 | 1787 | } |
@@ -1632,17 +1795,37 @@ discard block |
||
| 1632 | 1795 | */ |
| 1633 | 1796 | function setMemberConfig($args) |
| 1634 | 1797 | { |
| 1635 | - if(!$args->skin) $args->skin = "default"; |
|
| 1636 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1637 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1638 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1639 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1798 | + if(!$args->skin) { |
|
| 1799 | + $args->skin = "default"; |
|
| 1800 | + } |
|
| 1801 | + if(!$args->colorset) { |
|
| 1802 | + $args->colorset = "white"; |
|
| 1803 | + } |
|
| 1804 | + if(!$args->editor_skin) { |
|
| 1805 | + $args->editor_skin= "ckeditor"; |
|
| 1806 | + } |
|
| 1807 | + if(!$args->editor_colorset) { |
|
| 1808 | + $args->editor_colorset = "moono"; |
|
| 1809 | + } |
|
| 1810 | + if($args->enable_join!='Y') { |
|
| 1811 | + $args->enable_join = 'N'; |
|
| 1812 | + } |
|
| 1640 | 1813 | $args->enable_openid= 'N'; |
| 1641 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1642 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1643 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1644 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1645 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1814 | + if($args->profile_image !='Y') { |
|
| 1815 | + $args->profile_image = 'N'; |
|
| 1816 | + } |
|
| 1817 | + if($args->image_name!='Y') { |
|
| 1818 | + $args->image_name = 'N'; |
|
| 1819 | + } |
|
| 1820 | + if($args->image_mark!='Y') { |
|
| 1821 | + $args->image_mark = 'N'; |
|
| 1822 | + } |
|
| 1823 | + if($args->group_image_mark!='Y') { |
|
| 1824 | + $args->group_image_mark = 'N'; |
|
| 1825 | + } |
|
| 1826 | + if(!trim(strip_tags($args->agreement))) { |
|
| 1827 | + $args->agreement = null; |
|
| 1828 | + } |
|
| 1646 | 1829 | $args->limit_day = (int)$args->limit_day; |
| 1647 | 1830 | |
| 1648 | 1831 | $agreement = trim($args->agreement); |
@@ -1650,7 +1833,9 @@ discard block |
||
| 1650 | 1833 | |
| 1651 | 1834 | $oModuleController = getController('module'); |
| 1652 | 1835 | $output = $oModuleController->insertModuleConfig('member',$args); |
| 1653 | - if(!$output->toBool()) return $output; |
|
| 1836 | + if(!$output->toBool()) { |
|
| 1837 | + return $output; |
|
| 1838 | + } |
|
| 1654 | 1839 | |
| 1655 | 1840 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1656 | 1841 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1675,7 +1860,9 @@ discard block |
||
| 1675 | 1860 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1676 | 1861 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1677 | 1862 | |
| 1678 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1863 | + if(!$check_signature) { |
|
| 1864 | + return FileHandler::removeFile($filename); |
|
| 1865 | + } |
|
| 1679 | 1866 | |
| 1680 | 1867 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1681 | 1868 | FileHandler::makeDir($path); |
@@ -1709,7 +1896,9 @@ discard block |
||
| 1709 | 1896 | $args = new stdClass(); |
| 1710 | 1897 | $args->member_srl = $member_srl; |
| 1711 | 1898 | $args->group_srl = $group_srl; |
| 1712 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1899 | + if($site_srl) { |
|
| 1900 | + $args->site_srl = $site_srl; |
|
| 1901 | + } |
|
| 1713 | 1902 | |
| 1714 | 1903 | // Add |
| 1715 | 1904 | $output = executeQuery('member.addMemberToGroup',$args); |
@@ -1735,15 +1924,21 @@ discard block |
||
| 1735 | 1924 | $obj->member_srl = implode(',',$args->member_srl); |
| 1736 | 1925 | |
| 1737 | 1926 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1738 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1927 | + if($output->data) { |
|
| 1928 | + foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1929 | + } |
|
| 1739 | 1930 | |
| 1740 | 1931 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1741 | - if(!$output->toBool()) return $output; |
|
| 1932 | + if(!$output->toBool()) { |
|
| 1933 | + return $output; |
|
| 1934 | + } |
|
| 1742 | 1935 | |
| 1743 | 1936 | $inserted_members = array(); |
| 1744 | 1937 | foreach($args->member_srl as $key => $val) |
| 1745 | 1938 | { |
| 1746 | - if($inserted_members[$val]) continue; |
|
| 1939 | + if($inserted_members[$val]) { |
|
| 1940 | + continue; |
|
| 1941 | + } |
|
| 1747 | 1942 | $inserted_members[$val] = true; |
| 1748 | 1943 | |
| 1749 | 1944 | unset($obj); |
@@ -1753,7 +1948,9 @@ discard block |
||
| 1753 | 1948 | $obj->site_srl = $args->site_srl; |
| 1754 | 1949 | $obj->regdate = $date[$obj->member_srl]; |
| 1755 | 1950 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1756 | - if(!$output->toBool()) return $output; |
|
| 1951 | + if(!$output->toBool()) { |
|
| 1952 | + return $output; |
|
| 1953 | + } |
|
| 1757 | 1954 | |
| 1758 | 1955 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1759 | 1956 | } |
@@ -1815,8 +2012,7 @@ discard block |
||
| 1815 | 2012 | if($config->identifier == 'user_id') |
| 1816 | 2013 | { |
| 1817 | 2014 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1818 | - } |
|
| 1819 | - else |
|
| 2015 | + } else |
|
| 1820 | 2016 | { |
| 1821 | 2017 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1822 | 2018 | } |
@@ -1825,8 +2021,7 @@ discard block |
||
| 1825 | 2021 | $do_auto_login = true; |
| 1826 | 2022 | } |
| 1827 | 2023 | |
| 1828 | - } |
|
| 1829 | - else |
|
| 2024 | + } else |
|
| 1830 | 2025 | { |
| 1831 | 2026 | $do_auto_login = true; |
| 1832 | 2027 | } |
@@ -1835,8 +2030,7 @@ discard block |
||
| 1835 | 2030 | if($do_auto_login) |
| 1836 | 2031 | { |
| 1837 | 2032 | $output = $this->doLogin($user_id); |
| 1838 | - } |
|
| 1839 | - else |
|
| 2033 | + } else |
|
| 1840 | 2034 | { |
| 1841 | 2035 | executeQuery('member.deleteAutologin', $args); |
| 1842 | 2036 | setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
@@ -1855,13 +2049,17 @@ discard block |
||
| 1855 | 2049 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1856 | 2050 | { |
| 1857 | 2051 | $user_id = strtolower($user_id); |
| 1858 | - if(!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 2052 | + if(!$user_id) { |
|
| 2053 | + return new BaseObject(-1, 'null_user_id'); |
|
| 2054 | + } |
|
| 1859 | 2055 | // Call a trigger before log-in (before) |
| 1860 | 2056 | $trigger_obj = new stdClass(); |
| 1861 | 2057 | $trigger_obj->user_id = $user_id; |
| 1862 | 2058 | $trigger_obj->password = $password; |
| 1863 | 2059 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1864 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 2060 | + if(!$trigger_output->toBool()) { |
|
| 2061 | + return $trigger_output; |
|
| 2062 | + } |
|
| 1865 | 2063 | // Create a member model object |
| 1866 | 2064 | $oMemberModel = getModel('member'); |
| 1867 | 2065 | |
@@ -1876,15 +2074,18 @@ discard block |
||
| 1876 | 2074 | // Get user_id information |
| 1877 | 2075 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1878 | 2076 | // Set an invalid user if no value returned |
| 1879 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 2077 | + if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) { |
|
| 2078 | + return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 2079 | + } |
|
| 1880 | 2080 | |
| 1881 | - } |
|
| 1882 | - else |
|
| 2081 | + } else |
|
| 1883 | 2082 | { |
| 1884 | 2083 | // Get user_id information |
| 1885 | 2084 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1886 | 2085 | // Set an invalid user if no value returned |
| 1887 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 2086 | + if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) { |
|
| 2087 | + return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 2088 | + } |
|
| 1888 | 2089 | } |
| 1889 | 2090 | |
| 1890 | 2091 | $output = executeQuery('member.getLoginCountByIp', $args); |
@@ -1896,14 +2097,18 @@ discard block |
||
| 1896 | 2097 | if($term < $config->max_error_count_time) |
| 1897 | 2098 | { |
| 1898 | 2099 | $term = $config->max_error_count_time - $term; |
| 1899 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1900 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1901 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1902 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 2100 | + if($term < 60) { |
|
| 2101 | + $term = intval($term).Context::getLang('unit_sec'); |
|
| 2102 | + } elseif(60 <= $term && $term < 3600) { |
|
| 2103 | + $term = intval($term/60).Context::getLang('unit_min'); |
|
| 2104 | + } elseif(3600 <= $term && $term < 86400) { |
|
| 2105 | + $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 2106 | + } else { |
|
| 2107 | + $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 2108 | + } |
|
| 1903 | 2109 | |
| 1904 | 2110 | return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
| 1905 | - } |
|
| 1906 | - else |
|
| 2111 | + } else |
|
| 1907 | 2112 | { |
| 1908 | 2113 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1909 | 2114 | $output = executeQuery('member.deleteLoginCountByIp', $args); |
@@ -1930,7 +2135,9 @@ discard block |
||
| 1930 | 2135 | return new BaseObject(-1,'msg_user_denied'); |
| 1931 | 2136 | } |
| 1932 | 2137 | // Notify if denied_date is less than the current time |
| 1933 | - 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"))); |
|
| 2138 | + if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) { |
|
| 2139 | + return new BaseObject(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
| 2140 | + } |
|
| 1934 | 2141 | // Update the latest login time |
| 1935 | 2142 | $args->member_srl = $this->memberInfo->member_srl; |
| 1936 | 2143 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1979,7 +2186,9 @@ discard block |
||
| 1979 | 2186 | } |
| 1980 | 2187 | // Call a trigger after successfully log-in (after) |
| 1981 | 2188 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1982 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 2189 | + if(!$trigger_output->toBool()) { |
|
| 2190 | + return $trigger_output; |
|
| 2191 | + } |
|
| 1983 | 2192 | // When user checked to use auto-login |
| 1984 | 2193 | if($keep_signed) |
| 1985 | 2194 | { |
@@ -1993,7 +2202,9 @@ discard block |
||
| 1993 | 2202 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1994 | 2203 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1995 | 2204 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1996 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2205 | + if($autologin_output->toBool()) { |
|
| 2206 | + setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2207 | + } |
|
| 1997 | 2208 | } |
| 1998 | 2209 | if($this->memberInfo->is_admin == 'Y') |
| 1999 | 2210 | { |
@@ -2082,7 +2293,9 @@ discard block |
||
| 2082 | 2293 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 2083 | 2294 | { |
| 2084 | 2295 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 2085 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2296 | + if(!is_array($member_popup_menu_list)) { |
|
| 2297 | + $member_popup_menu_list = array(); |
|
| 2298 | + } |
|
| 2086 | 2299 | |
| 2087 | 2300 | $obj = new stdClass; |
| 2088 | 2301 | $obj->url = $url; |
@@ -2101,35 +2314,54 @@ discard block |
||
| 2101 | 2314 | { |
| 2102 | 2315 | // Call a trigger (before) |
| 2103 | 2316 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 2104 | - if(!$output->toBool()) return $output; |
|
| 2317 | + if(!$output->toBool()) { |
|
| 2318 | + return $output; |
|
| 2319 | + } |
|
| 2105 | 2320 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 2106 | 2321 | $oModuleModel = getModel('module'); |
| 2107 | 2322 | $config = $oModuleModel->getModuleConfig('member'); |
| 2108 | 2323 | |
| 2109 | 2324 | $logged_info = Context::get('logged_info'); |
| 2110 | 2325 | // If the date of the temporary restrictions limit further information on the date of |
| 2111 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2326 | + if($config->limit_day) { |
|
| 2327 | + $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2328 | + } |
|
| 2112 | 2329 | |
| 2113 | 2330 | $args->member_srl = getNextSequence(); |
| 2114 | 2331 | $args->list_order = -1 * $args->member_srl; |
| 2115 | 2332 | |
| 2116 | 2333 | // Execute insert or update depending on the value of member_srl |
| 2117 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2334 | + if(!$args->user_id) { |
|
| 2335 | + $args->user_id = 't'.$args->member_srl; |
|
| 2336 | + } |
|
| 2118 | 2337 | // Enter the user's identity changed to lowercase |
| 2119 | - else $args->user_id = strtolower($args->user_id); |
|
| 2120 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2121 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2338 | + else { |
|
| 2339 | + $args->user_id = strtolower($args->user_id); |
|
| 2340 | + } |
|
| 2341 | + if(!$args->user_name) { |
|
| 2342 | + $args->user_name = $args->member_srl; |
|
| 2343 | + } |
|
| 2344 | + if(!$args->nick_name) { |
|
| 2345 | + $args->nick_name = $args->member_srl; |
|
| 2346 | + } |
|
| 2122 | 2347 | |
| 2123 | 2348 | // Control of essential parameters |
| 2124 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2125 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2126 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 2349 | + if($args->allow_mailing!='Y') { |
|
| 2350 | + $args->allow_mailing = 'N'; |
|
| 2351 | + } |
|
| 2352 | + if($args->denied!='Y') { |
|
| 2353 | + $args->denied = 'N'; |
|
| 2354 | + } |
|
| 2355 | + if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) { |
|
| 2356 | + $args->allow_message = 'Y'; |
|
| 2357 | + } |
|
| 2127 | 2358 | |
| 2128 | 2359 | if($logged_info->is_admin == 'Y') |
| 2129 | 2360 | { |
| 2130 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 2131 | - } |
|
| 2132 | - else |
|
| 2361 | + if($args->is_admin!='Y') { |
|
| 2362 | + $args->is_admin = 'N'; |
|
| 2363 | + } |
|
| 2364 | + } else |
|
| 2133 | 2365 | { |
| 2134 | 2366 | unset($args->is_admin); |
| 2135 | 2367 | } |
@@ -2142,8 +2374,12 @@ discard block |
||
| 2142 | 2374 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2143 | 2375 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2144 | 2376 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2145 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2146 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2377 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) { |
|
| 2378 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2379 | + } |
|
| 2380 | + if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) { |
|
| 2381 | + $args->blog = 'http://'.$args->blog; |
|
| 2382 | + } |
|
| 2147 | 2383 | |
| 2148 | 2384 | // Create a model object |
| 2149 | 2385 | $oMemberModel = getModel('member'); |
@@ -2157,8 +2393,7 @@ discard block |
||
| 2157 | 2393 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2158 | 2394 | } |
| 2159 | 2395 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2160 | - } |
|
| 2161 | - elseif(!$args->password) |
|
| 2396 | + } elseif(!$args->password) |
|
| 2162 | 2397 | { |
| 2163 | 2398 | unset($args->password); |
| 2164 | 2399 | } |
@@ -2166,8 +2401,7 @@ discard block |
||
| 2166 | 2401 | if($args->find_account_answer && !$password_is_hashed) |
| 2167 | 2402 | { |
| 2168 | 2403 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2169 | - } |
|
| 2170 | - elseif(!$args->find_account_answer) |
|
| 2404 | + } elseif(!$args->find_account_answer) |
|
| 2171 | 2405 | { |
| 2172 | 2406 | unset($args->find_account_answer); |
| 2173 | 2407 | } |
@@ -2208,8 +2442,12 @@ discard block |
||
| 2208 | 2442 | // Insert data into the DB |
| 2209 | 2443 | $args->list_order = -1 * $args->member_srl; |
| 2210 | 2444 | |
| 2211 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2212 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2445 | + if(!$args->user_id) { |
|
| 2446 | + $args->user_id = 't'.$args->member_srl; |
|
| 2447 | + } |
|
| 2448 | + if(!$args->user_name) { |
|
| 2449 | + $args->user_name = $args->member_srl; |
|
| 2450 | + } |
|
| 2213 | 2451 | |
| 2214 | 2452 | $oDB = &DB::getInstance(); |
| 2215 | 2453 | $oDB->begin(); |
@@ -2221,8 +2459,11 @@ discard block |
||
| 2221 | 2459 | return $output; |
| 2222 | 2460 | } |
| 2223 | 2461 | |
| 2224 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2225 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2462 | + if(is_array($args->group_srl_list)) { |
|
| 2463 | + $group_srl_list = $args->group_srl_list; |
|
| 2464 | + } else { |
|
| 2465 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2466 | + } |
|
| 2226 | 2467 | // If no value is entered the default group, the value of group registration |
| 2227 | 2468 | if(!$args->group_srl_list) |
| 2228 | 2469 | { |
@@ -2239,8 +2480,7 @@ discard block |
||
| 2239 | 2480 | } |
| 2240 | 2481 | } |
| 2241 | 2482 | // If the value is the value of the group entered the group registration |
| 2242 | - } |
|
| 2243 | - else |
|
| 2483 | + } else |
|
| 2244 | 2484 | { |
| 2245 | 2485 | for($i=0;$i<count($group_srl_list);$i++) |
| 2246 | 2486 | { |
@@ -2301,27 +2541,39 @@ discard block |
||
| 2301 | 2541 | { |
| 2302 | 2542 | // Call a trigger (before) |
| 2303 | 2543 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2304 | - if(!$output->toBool()) return $output; |
|
| 2544 | + if(!$output->toBool()) { |
|
| 2545 | + return $output; |
|
| 2546 | + } |
|
| 2305 | 2547 | // Create a model object |
| 2306 | 2548 | $oMemberModel = getModel('member'); |
| 2307 | 2549 | |
| 2308 | 2550 | $logged_info = Context::get('logged_info'); |
| 2309 | 2551 | // Get what you want to modify the original information |
| 2310 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2552 | + if(!$this->memberInfo) { |
|
| 2553 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2554 | + } |
|
| 2311 | 2555 | // Control of essential parameters |
| 2312 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2313 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2556 | + if($args->allow_mailing!='Y') { |
|
| 2557 | + $args->allow_mailing = 'N'; |
|
| 2558 | + } |
|
| 2559 | + if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) { |
|
| 2560 | + $args->allow_message = 'Y'; |
|
| 2561 | + } |
|
| 2314 | 2562 | |
| 2315 | 2563 | if($logged_info->is_admin == 'Y') |
| 2316 | 2564 | { |
| 2317 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2318 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2319 | - } |
|
| 2320 | - else |
|
| 2565 | + if($args->denied!='Y') { |
|
| 2566 | + $args->denied = 'N'; |
|
| 2567 | + } |
|
| 2568 | + if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) { |
|
| 2569 | + $args->is_admin = 'N'; |
|
| 2570 | + } |
|
| 2571 | + } else |
|
| 2321 | 2572 | { |
| 2322 | 2573 | unset($args->is_admin); |
| 2323 | - if($is_admin == false) |
|
| 2324 | - unset($args->denied); |
|
| 2574 | + if($is_admin == false) { |
|
| 2575 | + unset($args->denied); |
|
| 2576 | + } |
|
| 2325 | 2577 | if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
| 2326 | 2578 | { |
| 2327 | 2579 | return $this->stop('msg_invalid_request'); |
@@ -2329,13 +2581,19 @@ discard block |
||
| 2329 | 2581 | } |
| 2330 | 2582 | |
| 2331 | 2583 | // Sanitize user ID, username, nickname, homepage, blog |
| 2332 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2584 | + if($args->user_id) { |
|
| 2585 | + $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2586 | + } |
|
| 2333 | 2587 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2334 | 2588 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2335 | 2589 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2336 | 2590 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2337 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2338 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2591 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) { |
|
| 2592 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2593 | + } |
|
| 2594 | + if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) { |
|
| 2595 | + $args->blog = 'http://'.$args->blog; |
|
| 2596 | + } |
|
| 2339 | 2597 | |
| 2340 | 2598 | // check member identifier form |
| 2341 | 2599 | $config = $oMemberModel->getMemberConfig(); |
@@ -2352,8 +2610,7 @@ discard block |
||
| 2352 | 2610 | return new BaseObject(-1,'msg_exists_email_address'); |
| 2353 | 2611 | } |
| 2354 | 2612 | $args->email_address = $orgMemberInfo->email_address; |
| 2355 | - } |
|
| 2356 | - else |
|
| 2613 | + } else |
|
| 2357 | 2614 | { |
| 2358 | 2615 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2359 | 2616 | if($member_srl && $args->member_srl != $member_srl) |
@@ -2410,16 +2667,14 @@ discard block |
||
| 2410 | 2667 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2411 | 2668 | } |
| 2412 | 2669 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2413 | - } |
|
| 2414 | - else |
|
| 2670 | + } else |
|
| 2415 | 2671 | { |
| 2416 | 2672 | $args->password = $orgMemberInfo->password; |
| 2417 | 2673 | } |
| 2418 | 2674 | |
| 2419 | 2675 | if($args->find_account_answer) { |
| 2420 | 2676 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2421 | - } |
|
| 2422 | - else |
|
| 2677 | + } else |
|
| 2423 | 2678 | { |
| 2424 | 2679 | $oPassword = new Password(); |
| 2425 | 2680 | $hashed = $oPassword->checkAlgorithm($orgMemberInfo->find_account_answer); |
@@ -2431,11 +2686,21 @@ discard block |
||
| 2431 | 2686 | } |
| 2432 | 2687 | } |
| 2433 | 2688 | |
| 2434 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2435 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2436 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2437 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2438 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2689 | + if(!$args->user_name) { |
|
| 2690 | + $args->user_name = $orgMemberInfo->user_name; |
|
| 2691 | + } |
|
| 2692 | + if(!$args->user_id) { |
|
| 2693 | + $args->user_id = $orgMemberInfo->user_id; |
|
| 2694 | + } |
|
| 2695 | + if(!$args->nick_name) { |
|
| 2696 | + $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2697 | + } |
|
| 2698 | + if(!$args->description) { |
|
| 2699 | + $args->description = $orgMemberInfo->description; |
|
| 2700 | + } |
|
| 2701 | + if(!$args->birthday) { |
|
| 2702 | + $args->birthday = ''; |
|
| 2703 | + } |
|
| 2439 | 2704 | |
| 2440 | 2705 | $output = executeQuery('member.updateMember', $args); |
| 2441 | 2706 | |
@@ -2447,8 +2712,11 @@ discard block |
||
| 2447 | 2712 | |
| 2448 | 2713 | if($args->group_srl_list) |
| 2449 | 2714 | { |
| 2450 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2451 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2715 | + if(is_array($args->group_srl_list)) { |
|
| 2716 | + $group_srl_list = $args->group_srl_list; |
|
| 2717 | + } else { |
|
| 2718 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2719 | + } |
|
| 2452 | 2720 | // If the group information, group information changes |
| 2453 | 2721 | if(count($group_srl_list) > 0) |
| 2454 | 2722 | { |
@@ -2491,7 +2759,9 @@ discard block |
||
| 2491 | 2759 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2492 | 2760 | |
| 2493 | 2761 | // Save Session |
| 2494 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2762 | + if(!$this->memberInfo) { |
|
| 2763 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2764 | + } |
|
| 2495 | 2765 | $logged_info = Context::get('logged_info'); |
| 2496 | 2766 | |
| 2497 | 2767 | $output->add('member_srl', $args->member_srl); |
@@ -2517,8 +2787,7 @@ discard block |
||
| 2517 | 2787 | } |
| 2518 | 2788 | |
| 2519 | 2789 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2520 | - } |
|
| 2521 | - else if($args->hashed_password) |
|
| 2790 | + } else if($args->hashed_password) |
|
| 2522 | 2791 | { |
| 2523 | 2792 | $args->password = $args->hashed_password; |
| 2524 | 2793 | } |
@@ -2553,7 +2822,9 @@ discard block |
||
| 2553 | 2822 | $trigger_obj = new stdClass(); |
| 2554 | 2823 | $trigger_obj->member_srl = $member_srl; |
| 2555 | 2824 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2556 | - if(!$output->toBool()) return $output; |
|
| 2825 | + if(!$output->toBool()) { |
|
| 2826 | + return $output; |
|
| 2827 | + } |
|
| 2557 | 2828 | // Create a model object |
| 2558 | 2829 | $oMemberModel = getModel('member'); |
| 2559 | 2830 | // Bringing the user's information |
@@ -2562,9 +2833,13 @@ discard block |
||
| 2562 | 2833 | $columnList = array('member_srl', 'is_admin'); |
| 2563 | 2834 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2564 | 2835 | } |
| 2565 | - if(!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2836 | + if(!$this->memberInfo) { |
|
| 2837 | + return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2838 | + } |
|
| 2566 | 2839 | // If managers can not be deleted |
| 2567 | - if($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2840 | + if($this->memberInfo->is_admin == 'Y') { |
|
| 2841 | + return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2842 | + } |
|
| 2568 | 2843 | |
| 2569 | 2844 | $oDB = &DB::getInstance(); |
| 2570 | 2845 | $oDB->begin(); |
@@ -2628,7 +2903,9 @@ discard block |
||
| 2628 | 2903 | */ |
| 2629 | 2904 | function destroySessionInfo() |
| 2630 | 2905 | { |
| 2631 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2906 | + if(!$_SESSION || !is_array($_SESSION)) { |
|
| 2907 | + return; |
|
| 2908 | + } |
|
| 2632 | 2909 | |
| 2633 | 2910 | $memberInfo = Context::get('logged_info'); |
| 2634 | 2911 | $memberSrl = $memberInfo->member_srl; |
@@ -2667,8 +2944,9 @@ discard block |
||
| 2667 | 2944 | } |
| 2668 | 2945 | $maxLevel = 0; |
| 2669 | 2946 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2670 | - if(count($resultGroup) > 0) |
|
| 2671 | - $maxLevel = max(array_flip($resultGroup)); |
|
| 2947 | + if(count($resultGroup) > 0) { |
|
| 2948 | + $maxLevel = max(array_flip($resultGroup)); |
|
| 2949 | + } |
|
| 2672 | 2950 | |
| 2673 | 2951 | if($maxLevel > 0) |
| 2674 | 2952 | { |
@@ -2685,16 +2963,22 @@ discard block |
||
| 2685 | 2963 | |
| 2686 | 2964 | function procMemberModifyEmailAddress() |
| 2687 | 2965 | { |
| 2688 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2966 | + if(!Context::get('is_logged')) { |
|
| 2967 | + return $this->stop('msg_not_logged'); |
|
| 2968 | + } |
|
| 2689 | 2969 | |
| 2690 | 2970 | $member_info = Context::get('logged_info'); |
| 2691 | 2971 | $newEmail = Context::get('email_address'); |
| 2692 | 2972 | |
| 2693 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2973 | + if(!$newEmail) { |
|
| 2974 | + return $this->stop('msg_invalid_request'); |
|
| 2975 | + } |
|
| 2694 | 2976 | |
| 2695 | 2977 | $oMemberModel = getModel('member'); |
| 2696 | 2978 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2697 | - if($member_srl) return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2979 | + if($member_srl) { |
|
| 2980 | + return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2981 | + } |
|
| 2698 | 2982 | |
| 2699 | 2983 | if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
| 2700 | 2984 | { |
@@ -2722,7 +3006,9 @@ discard block |
||
| 2722 | 3006 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2723 | 3007 | |
| 2724 | 3008 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2725 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 3009 | + if(!is_dir($tpl_path)) { |
|
| 3010 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 3011 | + } |
|
| 2726 | 3012 | |
| 2727 | 3013 | global $lang; |
| 2728 | 3014 | |
@@ -2758,7 +3044,9 @@ discard block |
||
| 2758 | 3044 | { |
| 2759 | 3045 | $member_srl = Context::get('member_srl'); |
| 2760 | 3046 | $auth_key = Context::get('auth_key'); |
| 2761 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 3047 | + if(!$member_srl || !$auth_key) { |
|
| 3048 | + return $this->stop('msg_invalid_request'); |
|
| 3049 | + } |
|
| 2762 | 3050 | |
| 2763 | 3051 | // Test logs for finding password by user_id and authkey |
| 2764 | 3052 | $args = new stdClass; |
@@ -2767,7 +3055,9 @@ discard block |
||
| 2767 | 3055 | $output = executeQuery('member.getAuthMail', $args); |
| 2768 | 3056 | if(!$output->toBool() || $output->data->auth_key != $auth_key) |
| 2769 | 3057 | { |
| 2770 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 3058 | + if(strlen($output->data->auth_key) !== strlen($auth_key)) { |
|
| 3059 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 3060 | + } |
|
| 2771 | 3061 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2772 | 3062 | } |
| 2773 | 3063 | |
@@ -2776,7 +3066,9 @@ discard block |
||
| 2776 | 3066 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2777 | 3067 | |
| 2778 | 3068 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2779 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 3069 | + if(!$output->toBool()) { |
|
| 3070 | + return $this->stop($output->getMessage()); |
|
| 3071 | + } |
|
| 2780 | 3072 | |
| 2781 | 3073 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2782 | 3074 | executeQuery('member.deleteAuthChangeEmailAddress',$args); |
@@ -2797,7 +3089,9 @@ discard block |
||
| 2797 | 3089 | **/ |
| 2798 | 3090 | function triggerGetDocumentMenu(&$menu_list) |
| 2799 | 3091 | { |
| 2800 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 3092 | + if(!Context::get('is_logged')) { |
|
| 3093 | + return new BaseObject(); |
|
| 3094 | + } |
|
| 2801 | 3095 | |
| 2802 | 3096 | $logged_info = Context::get('logged_info'); |
| 2803 | 3097 | $document_srl = Context::get('target_srl'); |
@@ -2808,8 +3102,12 @@ discard block |
||
| 2808 | 3102 | $member_srl = $oDocument->get('member_srl'); |
| 2809 | 3103 | $module_srl = $oDocument->get('module_srl'); |
| 2810 | 3104 | |
| 2811 | - if(!$member_srl) return new BaseObject(); |
|
| 2812 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 3105 | + if(!$member_srl) { |
|
| 3106 | + return new BaseObject(); |
|
| 3107 | + } |
|
| 3108 | + if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 3109 | + return new BaseObject(); |
|
| 3110 | + } |
|
| 2813 | 3111 | |
| 2814 | 3112 | $oDocumentController = getController('document'); |
| 2815 | 3113 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2827,7 +3125,9 @@ discard block |
||
| 2827 | 3125 | **/ |
| 2828 | 3126 | function triggerGetCommentMenu(&$menu_list) |
| 2829 | 3127 | { |
| 2830 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 3128 | + if(!Context::get('is_logged')) { |
|
| 3129 | + return new BaseObject(); |
|
| 3130 | + } |
|
| 2831 | 3131 | |
| 2832 | 3132 | $logged_info = Context::get('logged_info'); |
| 2833 | 3133 | $comment_srl = Context::get('target_srl'); |
@@ -2838,8 +3138,12 @@ discard block |
||
| 2838 | 3138 | $module_srl = $oComment->get('module_srl'); |
| 2839 | 3139 | $member_srl = $oComment->get('member_srl'); |
| 2840 | 3140 | |
| 2841 | - if(!$member_srl) return new BaseObject(); |
|
| 2842 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 3141 | + if(!$member_srl) { |
|
| 3142 | + return new BaseObject(); |
|
| 3143 | + } |
|
| 3144 | + if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 3145 | + return new BaseObject(); |
|
| 3146 | + } |
|
| 2843 | 3147 | |
| 2844 | 3148 | $oCommentController = getController('comment'); |
| 2845 | 3149 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2855,7 +3159,9 @@ discard block |
||
| 2855 | 3159 | **/ |
| 2856 | 3160 | function procMemberSpammerManage() |
| 2857 | 3161 | { |
| 2858 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 3162 | + if(!Context::get('is_logged')) { |
|
| 3163 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 3164 | + } |
|
| 2859 | 3165 | |
| 2860 | 3166 | $logged_info = Context::get('logged_info'); |
| 2861 | 3167 | $member_srl = Context::get('member_srl'); |
@@ -2863,8 +3169,9 @@ discard block |
||
| 2863 | 3169 | $cnt_loop = Context::get('cnt_loop'); |
| 2864 | 3170 | $proc_type = Context::get('proc_type'); |
| 2865 | 3171 | $isMoveToTrash = true; |
| 2866 | - if($proc_type == "delete") |
|
| 2867 | - $isMoveToTrash = false; |
|
| 3172 | + if($proc_type == "delete") { |
|
| 3173 | + $isMoveToTrash = false; |
|
| 3174 | + } |
|
| 2868 | 3175 | |
| 2869 | 3176 | // check grant |
| 2870 | 3177 | $oModuleModel = getModel('module'); |
@@ -2872,7 +3179,9 @@ discard block |
||
| 2872 | 3179 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2873 | 3180 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2874 | 3181 | |
| 2875 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 3182 | + if(!$grant->manager) { |
|
| 3183 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 3184 | + } |
|
| 2876 | 3185 | |
| 2877 | 3186 | $proc_msg = ""; |
| 2878 | 3187 | |
@@ -2881,11 +3190,13 @@ discard block |
||
| 2881 | 3190 | |
| 2882 | 3191 | // delete or trash destination |
| 2883 | 3192 | // proc member |
| 2884 | - if($cnt_loop == 1) |
|
| 2885 | - $this->_spammerMember($member_srl); |
|
| 3193 | + if($cnt_loop == 1) { |
|
| 3194 | + $this->_spammerMember($member_srl); |
|
| 3195 | + } |
|
| 2886 | 3196 | // proc document and comment |
| 2887 | - elseif($cnt_loop>1) |
|
| 2888 | - $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3197 | + elseif($cnt_loop>1) { |
|
| 3198 | + $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3199 | + } |
|
| 2889 | 3200 | |
| 2890 | 3201 | // get destination count |
| 2891 | 3202 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
@@ -2893,13 +3204,16 @@ discard block |
||
| 2893 | 3204 | |
| 2894 | 3205 | $total_count = Context::get('total_count'); |
| 2895 | 3206 | $remain_count = $cnt_document + $cnt_comment; |
| 2896 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 3207 | + if($cnt_loop == 1) { |
|
| 3208 | + $total_count = $remain_count; |
|
| 3209 | + } |
|
| 2897 | 3210 | |
| 2898 | 3211 | // get progress percent |
| 2899 | - if($total_count > 0) |
|
| 2900 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2901 | - else |
|
| 2902 | - $progress = 100; |
|
| 3212 | + if($total_count > 0) { |
|
| 3213 | + $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 3214 | + } else { |
|
| 3215 | + $progress = 100; |
|
| 3216 | + } |
|
| 2903 | 3217 | |
| 2904 | 3218 | $this->add('total_count', $total_count); |
| 2905 | 3219 | $this->add('remain_count', $remain_count); |
@@ -2941,7 +3255,10 @@ discard block |
||
| 2941 | 3255 | $args->nick_name = $member_info->nick_name; |
| 2942 | 3256 | $args->denied = "Y"; |
| 2943 | 3257 | $args->description = trim( $member_info->description ); |
| 2944 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 3258 | + if( $args->description != "" ) { |
|
| 3259 | + $args->description .= "\n"; |
|
| 3260 | + } |
|
| 3261 | + // add new line |
|
| 2945 | 3262 | |
| 2946 | 3263 | $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 . "]"; |
| 2947 | 3264 | |
@@ -2986,8 +3303,11 @@ discard block |
||
| 2986 | 3303 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2987 | 3304 | if($documentList) { |
| 2988 | 3305 | foreach($documentList as $v) { |
| 2989 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2990 | - else $oDocumentController->deleteDocument($v->document_srl); |
|
| 3306 | + if($isMoveToTrash) { |
|
| 3307 | + $oDocumentController->moveDocumentToTrash($v); |
|
| 3308 | + } else { |
|
| 3309 | + $oDocumentController->deleteDocument($v->document_srl); |
|
| 3310 | + } |
|
| 2991 | 3311 | } |
| 2992 | 3312 | } |
| 2993 | 3313 | } |
@@ -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', '', html_entity_decode($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', '', html_entity_decode($args->{$val})); |
| 601 | 601 | } |
@@ -603,22 +603,22 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | // Execute insert or update depending on the value of member_srl |
| 605 | 605 | $output = $this->updateMember($args); |
| 606 | - if(!$output->toBool()) return $output; |
|
| 606 | + if (!$output->toBool()) return $output; |
|
| 607 | 607 | |
| 608 | 608 | $profile_image = $_FILES['profile_image']; |
| 609 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 609 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 610 | 610 | { |
| 611 | 611 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | $image_mark = $_FILES['image_mark']; |
| 615 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 615 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 616 | 616 | { |
| 617 | 617 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | $image_name = $_FILES['image_name']; |
| 621 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
| 621 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
| 622 | 622 | { |
| 623 | 623 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 624 | 624 | } |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | // Call a trigger after successfully log-in (after) |
| 635 | 635 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
| 636 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 636 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 637 | 637 | |
| 638 | 638 | $this->setSessionInfo(); |
| 639 | 639 | // Return result |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | */ |
| 655 | 655 | function procMemberModifyPassword() |
| 656 | 656 | { |
| 657 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 657 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 658 | 658 | // Extract the necessary information in advance |
| 659 | 659 | $current_password = trim(Context::get('current_password')); |
| 660 | 660 | $password = trim(Context::get('password1')); |
@@ -668,17 +668,17 @@ discard block |
||
| 668 | 668 | |
| 669 | 669 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 670 | 670 | // Verify the cuttent password |
| 671 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new BaseObject(-1, 'invalid_password'); |
|
| 671 | + if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new BaseObject(-1, 'invalid_password'); |
|
| 672 | 672 | |
| 673 | 673 | // Check if a new password is as same as the previous password |
| 674 | - if($current_password == $password) return new BaseObject(-1, 'invalid_new_password'); |
|
| 674 | + if ($current_password == $password) return new BaseObject(-1, 'invalid_new_password'); |
|
| 675 | 675 | |
| 676 | 676 | // Execute insert or update depending on the value of member_srl |
| 677 | 677 | $args = new stdClass; |
| 678 | 678 | $args->member_srl = $member_srl; |
| 679 | 679 | $args->password = $password; |
| 680 | 680 | $output = $this->updateMemberPassword($args); |
| 681 | - if(!$output->toBool()) return $output; |
|
| 681 | + if (!$output->toBool()) return $output; |
|
| 682 | 682 | |
| 683 | 683 | $this->add('member_srl', $args->member_srl); |
| 684 | 684 | $this->setMessage('success_updated'); |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | function procMemberLeave() |
| 696 | 696 | { |
| 697 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 697 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 698 | 698 | // Extract the necessary information in advance |
| 699 | 699 | $password = trim(Context::get('password')); |
| 700 | 700 | // Get information of logged-in user |
@@ -703,17 +703,17 @@ discard block |
||
| 703 | 703 | // Create a member model object |
| 704 | 704 | $oMemberModel = getModel('member'); |
| 705 | 705 | // Get information of member_srl |
| 706 | - if(!$this->memberInfo->password) |
|
| 706 | + if (!$this->memberInfo->password) |
|
| 707 | 707 | { |
| 708 | 708 | $columnList = array('member_srl', 'password'); |
| 709 | 709 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 710 | 710 | $this->memberInfo->password = $memberInfo->password; |
| 711 | 711 | } |
| 712 | 712 | // Verify the cuttent password |
| 713 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new BaseObject(-1, 'invalid_password'); |
|
| 713 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new BaseObject(-1, 'invalid_password'); |
|
| 714 | 714 | |
| 715 | 715 | $output = $this->deleteMember($member_srl); |
| 716 | - if(!$output->toBool()) return $output; |
|
| 716 | + if (!$output->toBool()) return $output; |
|
| 717 | 717 | // Destroy all session information |
| 718 | 718 | $this->destroySessionInfo(); |
| 719 | 719 | // Return success message |
@@ -732,20 +732,20 @@ discard block |
||
| 732 | 732 | { |
| 733 | 733 | // Check if the file is successfully uploaded |
| 734 | 734 | $file = $_FILES['profile_image']; |
| 735 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 735 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 736 | 736 | // Ignore if member_srl is invalid or doesn't exist. |
| 737 | 737 | $member_srl = Context::get('member_srl'); |
| 738 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 738 | + if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 739 | 739 | |
| 740 | 740 | $logged_info = Context::get('logged_info'); |
| 741 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 741 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 742 | 742 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 743 | 743 | $oMemberModel = getModel('member'); |
| 744 | 744 | $config = $oMemberModel->getMemberConfig(); |
| 745 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 745 | + if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 746 | 746 | |
| 747 | 747 | $output = $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 748 | - if(!$output->toBool()) return $output; |
|
| 748 | + if (!$output->toBool()) return $output; |
|
| 749 | 749 | |
| 750 | 750 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 751 | 751 | $this->setRedirectUrl($returnUrl); |
@@ -766,20 +766,20 @@ discard block |
||
| 766 | 766 | $max_width = $config->profile_image_max_width; |
| 767 | 767 | $max_height = $config->profile_image_max_height; |
| 768 | 768 | $max_filesize = $config->profile_image_max_filesize; |
| 769 | - foreach($config->signupForm as $val) |
|
| 769 | + foreach ($config->signupForm as $val) |
|
| 770 | 770 | { |
| 771 | - if($val->name == "profile_image") |
|
| 771 | + if ($val->name == "profile_image") |
|
| 772 | 772 | $allow_transparent = $val->allow_transparent_thumbnail == 'Y'; |
| 773 | 773 | } |
| 774 | 774 | |
| 775 | - Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
| 775 | + Context::loadLang(_XE_PATH_.'modules/file/lang'); |
|
| 776 | 776 | |
| 777 | 777 | // Get file information |
| 778 | 778 | FileHandler::clearStatCache($target_file); |
| 779 | 779 | list($width, $height, $type) = @getimagesize($target_file); |
| 780 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 781 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 782 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 780 | + if (IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 781 | + elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 782 | + elseif (IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 783 | 783 | else |
| 784 | 784 | { |
| 785 | 785 | return $this->stop('msg_not_uploaded_profile_image'); |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); |
| 792 | 792 | |
| 793 | 793 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 794 | - if(($width > $max_width || $height > $max_height ) && $type != 1) |
|
| 794 | + if (($width > $max_width || $height > $max_height) && $type != 1) |
|
| 795 | 795 | { |
| 796 | 796 | $temp_filename = sprintf('files/cache/tmp/profile_image_%d.%s', $member_srl, $ext); |
| 797 | 797 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, $ext, 'crop', $allow_transparent); |
@@ -799,10 +799,10 @@ discard block |
||
| 799 | 799 | // 파일 용량 제한 |
| 800 | 800 | FileHandler::clearStatCache($temp_filename); |
| 801 | 801 | $filesize = filesize($temp_filename); |
| 802 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 802 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 803 | 803 | { |
| 804 | 804 | FileHandler::removeFile($temp_filename); |
| 805 | - return $this->stop(implode(' ' , array( |
|
| 805 | + return $this->stop(implode(' ', array( |
|
| 806 | 806 | Context::getLang('msg_not_uploaded_profile_image'), |
| 807 | 807 | Context::getLang('msg_exceeds_limit_size') |
| 808 | 808 | ))); |
@@ -816,9 +816,9 @@ discard block |
||
| 816 | 816 | { |
| 817 | 817 | // 파일 용량 제한 |
| 818 | 818 | $filesize = filesize($target_file); |
| 819 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 819 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 820 | 820 | { |
| 821 | - return $this->stop(implode(' ' , array( |
|
| 821 | + return $this->stop(implode(' ', array( |
|
| 822 | 822 | Context::getLang('msg_not_uploaded_profile_image'), |
| 823 | 823 | Context::getLang('msg_exceeds_limit_size') |
| 824 | 824 | ))); |
@@ -841,20 +841,20 @@ discard block |
||
| 841 | 841 | { |
| 842 | 842 | // Check if the file is successfully uploaded |
| 843 | 843 | $file = $_FILES['image_name']; |
| 844 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 844 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 845 | 845 | // Ignore if member_srl is invalid or doesn't exist. |
| 846 | 846 | $member_srl = Context::get('member_srl'); |
| 847 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 847 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 848 | 848 | |
| 849 | 849 | $logged_info = Context::get('logged_info'); |
| 850 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 850 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 851 | 851 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 852 | 852 | $oMemberModel = getModel('member'); |
| 853 | 853 | $config = $oMemberModel->getMemberConfig(); |
| 854 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 854 | + if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 855 | 855 | |
| 856 | 856 | $output = $this->insertImageName($member_srl, $file['tmp_name']); |
| 857 | - if(!$output->toBool()) return $output; |
|
| 857 | + if (!$output->toBool()) return $output; |
|
| 858 | 858 | |
| 859 | 859 | // Page refresh |
| 860 | 860 | //$this->setRefreshPage(); |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | $max_height = $config->image_name_max_height; |
| 880 | 880 | $max_filesize = $config->image_name_max_filesize; |
| 881 | 881 | |
| 882 | - Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
| 882 | + Context::loadLang(_XE_PATH_.'modules/file/lang'); |
|
| 883 | 883 | |
| 884 | 884 | // Get a target path to save |
| 885 | 885 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | // Get file information |
| 890 | 890 | list($width, $height, $type) = @getimagesize($target_file); |
| 891 | 891 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 892 | - if($width > $max_width || $height > $max_height || $type!=1) |
|
| 892 | + if ($width > $max_width || $height > $max_height || $type != 1) |
|
| 893 | 893 | { |
| 894 | 894 | $temp_filename = sprintf('files/cache/tmp/image_name_%d.gif', $member_srl, $ext); |
| 895 | 895 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, 'gif'); |
@@ -897,10 +897,10 @@ discard block |
||
| 897 | 897 | // 파일 용량 제한 |
| 898 | 898 | FileHandler::clearStatCache($temp_filename); |
| 899 | 899 | $filesize = filesize($temp_filename); |
| 900 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 900 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 901 | 901 | { |
| 902 | 902 | FileHandler::removeFile($temp_filename); |
| 903 | - return $this->stop(implode(' ' , array( |
|
| 903 | + return $this->stop(implode(' ', array( |
|
| 904 | 904 | Context::getLang('msg_not_uploaded_image_name'), |
| 905 | 905 | Context::getLang('msg_exceeds_limit_size') |
| 906 | 906 | ))); |
@@ -914,9 +914,9 @@ discard block |
||
| 914 | 914 | { |
| 915 | 915 | // 파일 용량 제한 |
| 916 | 916 | $filesize = filesize($target_file); |
| 917 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 917 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 918 | 918 | { |
| 919 | - return $this->stop(implode(' ' , array( |
|
| 919 | + return $this->stop(implode(' ', array( |
|
| 920 | 920 | Context::getLang('msg_not_uploaded_image_name'), |
| 921 | 921 | Context::getLang('msg_exceeds_limit_size') |
| 922 | 922 | ))); |
@@ -938,20 +938,20 @@ discard block |
||
| 938 | 938 | function procMemberDeleteProfileImage($_memberSrl = 0) |
| 939 | 939 | { |
| 940 | 940 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 941 | - if(!$member_srl) |
|
| 941 | + if (!$member_srl) |
|
| 942 | 942 | { |
| 943 | - return new BaseObject(0,'success'); |
|
| 943 | + return new BaseObject(0, 'success'); |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | $logged_info = Context::get('logged_info'); |
| 947 | 947 | |
| 948 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 948 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 949 | 949 | { |
| 950 | 950 | $oMemberModel = getModel('member'); |
| 951 | 951 | $profile_image = $oMemberModel->getProfileImage($member_srl); |
| 952 | 952 | FileHandler::removeFile($profile_image->file); |
| 953 | 953 | } |
| 954 | - return new BaseObject(0,'success'); |
|
| 954 | + return new BaseObject(0, 'success'); |
|
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | /** |
@@ -962,20 +962,20 @@ discard block |
||
| 962 | 962 | function procMemberDeleteImageName($_memberSrl = 0) |
| 963 | 963 | { |
| 964 | 964 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 965 | - if(!$member_srl) |
|
| 965 | + if (!$member_srl) |
|
| 966 | 966 | { |
| 967 | - return new BaseObject(0,'success'); |
|
| 967 | + return new BaseObject(0, 'success'); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | $logged_info = Context::get('logged_info'); |
| 971 | 971 | |
| 972 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 972 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 973 | 973 | { |
| 974 | 974 | $oMemberModel = getModel('member'); |
| 975 | 975 | $image_name = $oMemberModel->getImageName($member_srl); |
| 976 | 976 | FileHandler::removeFile($image_name->file); |
| 977 | 977 | } |
| 978 | - return new BaseObject(0,'success'); |
|
| 978 | + return new BaseObject(0, 'success'); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | /** |
@@ -987,20 +987,20 @@ discard block |
||
| 987 | 987 | { |
| 988 | 988 | // Check if the file is successfully uploaded |
| 989 | 989 | $file = $_FILES['image_mark']; |
| 990 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 990 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 991 | 991 | // Ignore if member_srl is invalid or doesn't exist. |
| 992 | 992 | $member_srl = Context::get('member_srl'); |
| 993 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 993 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 994 | 994 | |
| 995 | 995 | $logged_info = Context::get('logged_info'); |
| 996 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 996 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 997 | 997 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 998 | 998 | $oMemberModel = getModel('member'); |
| 999 | 999 | $config = $oMemberModel->getMemberConfig(); |
| 1000 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1000 | + if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1001 | 1001 | |
| 1002 | 1002 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 1003 | - if(!$output->toBool()) return $output; |
|
| 1003 | + if (!$output->toBool()) return $output; |
|
| 1004 | 1004 | |
| 1005 | 1005 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 1006 | 1006 | $this->setRedirectUrl($returnUrl); |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | $max_height = $config->image_mark_max_height; |
| 1023 | 1023 | $max_filesize = $config->image_mark_max_filesize; |
| 1024 | 1024 | |
| 1025 | - Context::loadLang(_XE_PATH_ . 'modules/file/lang'); |
|
| 1025 | + Context::loadLang(_XE_PATH_.'modules/file/lang'); |
|
| 1026 | 1026 | |
| 1027 | 1027 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
| 1028 | 1028 | FileHandler::makeDir($target_path); |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | // Get file information |
| 1032 | 1032 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 1033 | 1033 | |
| 1034 | - if($width > $max_width || $height > $max_height || $type!=1) |
|
| 1034 | + if ($width > $max_width || $height > $max_height || $type != 1) |
|
| 1035 | 1035 | { |
| 1036 | 1036 | $temp_filename = sprintf('files/cache/tmp/image_mark_%d.gif', $member_srl); |
| 1037 | 1037 | FileHandler::createImageFile($target_file, $temp_filename, $max_width, $max_height, 'gif'); |
@@ -1039,10 +1039,10 @@ discard block |
||
| 1039 | 1039 | // 파일 용량 제한 |
| 1040 | 1040 | FileHandler::clearStatCache($temp_filename); |
| 1041 | 1041 | $filesize = filesize($temp_filename); |
| 1042 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1042 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1043 | 1043 | { |
| 1044 | 1044 | FileHandler::removeFile($temp_filename); |
| 1045 | - return $this->stop(implode(' ' , array( |
|
| 1045 | + return $this->stop(implode(' ', array( |
|
| 1046 | 1046 | Context::getLang('msg_not_uploaded_group_image_mark'), |
| 1047 | 1047 | Context::getLang('msg_exceeds_limit_size') |
| 1048 | 1048 | ))); |
@@ -1055,10 +1055,10 @@ discard block |
||
| 1055 | 1055 | else |
| 1056 | 1056 | { |
| 1057 | 1057 | $filesize = filesize($target_file); |
| 1058 | - if($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1058 | + if ($max_filesize && $filesize > ($max_filesize * 1024)) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | FileHandler::removeFile($target_file); |
| 1061 | - return $this->stop(implode(' ' , array( |
|
| 1061 | + return $this->stop(implode(' ', array( |
|
| 1062 | 1062 | Context::getLang('msg_not_uploaded_group_image_mark'), |
| 1063 | 1063 | Context::getLang('msg_exceeds_limit_size') |
| 1064 | 1064 | ))); |
@@ -1080,20 +1080,20 @@ discard block |
||
| 1080 | 1080 | function procMemberDeleteImageMark($_memberSrl = 0) |
| 1081 | 1081 | { |
| 1082 | 1082 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 1083 | - if(!$member_srl) |
|
| 1083 | + if (!$member_srl) |
|
| 1084 | 1084 | { |
| 1085 | - return new BaseObject(0,'success'); |
|
| 1085 | + return new BaseObject(0, 'success'); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | $logged_info = Context::get('logged_info'); |
| 1089 | 1089 | |
| 1090 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 1090 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 1091 | 1091 | { |
| 1092 | 1092 | $oMemberModel = getModel('member'); |
| 1093 | 1093 | $image_mark = $oMemberModel->getImageMark($member_srl); |
| 1094 | 1094 | FileHandler::removeFile($image_mark->file); |
| 1095 | 1095 | } |
| 1096 | - return new BaseObject(0,'success'); |
|
| 1096 | + return new BaseObject(0, 'success'); |
|
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | /** |
@@ -1104,26 +1104,26 @@ discard block |
||
| 1104 | 1104 | function procMemberFindAccount() |
| 1105 | 1105 | { |
| 1106 | 1106 | $email_address = Context::get('email_address'); |
| 1107 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1107 | + if (!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1108 | 1108 | |
| 1109 | 1109 | $oMemberModel = getModel('member'); |
| 1110 | 1110 | $oModuleModel = getModel('module'); |
| 1111 | 1111 | |
| 1112 | 1112 | // Check if a member having the same email address exists |
| 1113 | 1113 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1114 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1114 | + if (!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1115 | 1115 | |
| 1116 | 1116 | // Get information of the member |
| 1117 | 1117 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
| 1118 | 1118 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1119 | 1119 | |
| 1120 | 1120 | // Check if possible to find member's ID and password |
| 1121 | - if($member_info->denied == 'Y') |
|
| 1121 | + if ($member_info->denied == 'Y') |
|
| 1122 | 1122 | { |
| 1123 | 1123 | $chk_args = new stdClass; |
| 1124 | 1124 | $chk_args->member_srl = $member_info->member_srl; |
| 1125 | 1125 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1126 | - if($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1126 | + if ($output->toBool() && $output->data->count != '0') return new BaseObject(-1, 'msg_user_not_confirmed'); |
|
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | // Insert data into the authentication DB |
@@ -1136,19 +1136,19 @@ discard block |
||
| 1136 | 1136 | $args->is_register = 'N'; |
| 1137 | 1137 | |
| 1138 | 1138 | $output = executeQuery('member.insertAuthMail', $args); |
| 1139 | - if(!$output->toBool()) return $output; |
|
| 1139 | + if (!$output->toBool()) return $output; |
|
| 1140 | 1140 | // Get content of the email to send a member |
| 1141 | 1141 | Context::set('auth_args', $args); |
| 1142 | 1142 | |
| 1143 | 1143 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1144 | 1144 | $memberInfo = array(); |
| 1145 | 1145 | global $lang; |
| 1146 | - if(is_array($member_config->signupForm)) |
|
| 1146 | + if (is_array($member_config->signupForm)) |
|
| 1147 | 1147 | { |
| 1148 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1149 | - foreach($member_config->signupForm as $form) |
|
| 1148 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1149 | + foreach ($member_config->signupForm as $form) |
|
| 1150 | 1150 | { |
| 1151 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1151 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1152 | 1152 | { |
| 1153 | 1153 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1154 | 1154 | } |
@@ -1163,15 +1163,15 @@ discard block |
||
| 1163 | 1163 | } |
| 1164 | 1164 | Context::set('memberInfo', $memberInfo); |
| 1165 | 1165 | |
| 1166 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1167 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1166 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1167 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1168 | 1168 | |
| 1169 | 1169 | Context::set('member_config', $member_config); |
| 1170 | 1170 | |
| 1171 | 1171 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1172 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1172 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1173 | 1173 | |
| 1174 | - $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1174 | + $find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1175 | 1175 | Context::set('find_url', $find_url); |
| 1176 | 1176 | |
| 1177 | 1177 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -1181,19 +1181,19 @@ discard block |
||
| 1181 | 1181 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1182 | 1182 | // Send a mail |
| 1183 | 1183 | $oMail = new Mail(); |
| 1184 | - $oMail->setTitle( Context::getLang('msg_find_account_title') ); |
|
| 1184 | + $oMail->setTitle(Context::getLang('msg_find_account_title')); |
|
| 1185 | 1185 | $oMail->setContent($content); |
| 1186 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1187 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1186 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1187 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1188 | 1188 | $oMail->send(); |
| 1189 | 1189 | // Return message |
| 1190 | 1190 | $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); |
| 1191 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 1191 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 1192 | 1192 | { |
| 1193 | 1193 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount'); |
| 1194 | 1194 | $this->setRedirectUrl($returnUrl); |
| 1195 | 1195 | } |
| 1196 | - return new BaseObject(0,$msg); |
|
| 1196 | + return new BaseObject(0, $msg); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | /** |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | function procMemberFindAccountByQuestion() |
| 1205 | 1205 | { |
| 1206 | 1206 | $oMemberModel = getModel('member'); |
| 1207 | - $oPassword = new Password(); |
|
| 1207 | + $oPassword = new Password(); |
|
| 1208 | 1208 | $config = $oMemberModel->getMemberConfig(); |
| 1209 | 1209 | |
| 1210 | 1210 | $email_address = Context::get('email_address'); |
@@ -1212,49 +1212,49 @@ discard block |
||
| 1212 | 1212 | $find_account_question = trim(Context::get('find_account_question')); |
| 1213 | 1213 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1214 | 1214 | |
| 1215 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1215 | + if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1216 | 1216 | |
| 1217 | 1217 | $oModuleModel = getModel('module'); |
| 1218 | 1218 | // Check if a member having the same email address exists |
| 1219 | 1219 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1220 | - if(!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1220 | + if (!$member_srl) return new BaseObject(-1, 'msg_email_not_exists'); |
|
| 1221 | 1221 | |
| 1222 | 1222 | // Get information of the member |
| 1223 | 1223 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1224 | 1224 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1225 | 1225 | |
| 1226 | 1226 | // Display a message if no answer is entered |
| 1227 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1227 | + if (!$member_info->find_account_question || !$member_info->find_account_answer) return new BaseObject(-1, 'msg_question_not_exists'); |
|
| 1228 | 1228 | |
| 1229 | 1229 | // 답변 확인 |
| 1230 | 1230 | $hashed = $oPassword->checkAlgorithm($member_info->find_account_answer); |
| 1231 | 1231 | $authed = true; |
| 1232 | 1232 | $member_info->find_account_question = trim($member_info->find_account_question); |
| 1233 | - if($member_info->find_account_question != $find_account_question) |
|
| 1233 | + if ($member_info->find_account_question != $find_account_question) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $authed = false; |
| 1236 | 1236 | } |
| 1237 | - else if($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1237 | + else if ($hashed && !$oPassword->checkPassword($find_account_answer, $member_info->find_account_answer)) |
|
| 1238 | 1238 | { |
| 1239 | 1239 | $authed = false; |
| 1240 | 1240 | } |
| 1241 | - else if(!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1241 | + else if (!$hashed && $find_account_answer != $member_info->find_account_answer) |
|
| 1242 | 1242 | { |
| 1243 | 1243 | $authed = false; |
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | - if(!$authed) |
|
| 1246 | + if (!$authed) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | return new BaseObject(-1, 'msg_answer_not_matches'); |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | // answer가 동일하고 hash 되지 않았으면 hash 값으로 저장 |
| 1252 | - if($authed && !$hashed) |
|
| 1252 | + if ($authed && !$hashed) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $this->updateFindAccountAnswer($member_srl, $find_account_answer); |
| 1255 | 1255 | } |
| 1256 | 1256 | |
| 1257 | - if($config->identifier == 'email_address') |
|
| 1257 | + if ($config->identifier == 'email_address') |
|
| 1258 | 1258 | { |
| 1259 | 1259 | $user_id = $email_address; |
| 1260 | 1260 | } |
@@ -1267,11 +1267,11 @@ discard block |
||
| 1267 | 1267 | $args->password = $temp_password; |
| 1268 | 1268 | $args->change_password_date = '1'; |
| 1269 | 1269 | $output = $this->updateMemberPassword($args); |
| 1270 | - if(!$output->toBool()) return $output; |
|
| 1270 | + if (!$output->toBool()) return $output; |
|
| 1271 | 1271 | |
| 1272 | - $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
|
| 1272 | + $_SESSION['xe_temp_password_'.$user_id] = $temp_password; |
|
| 1273 | 1273 | |
| 1274 | - $this->add('user_id',$user_id); |
|
| 1274 | + $this->add('user_id', $user_id); |
|
| 1275 | 1275 | |
| 1276 | 1276 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 1277 | 1277 | $this->setRedirectUrl($returnUrl.'&user_id='.$user_id); |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | $member_srl = Context::get('member_srl'); |
| 1292 | 1292 | $auth_key = Context::get('auth_key'); |
| 1293 | 1293 | |
| 1294 | - if(!$member_srl || !$auth_key) |
|
| 1294 | + if (!$member_srl || !$auth_key) |
|
| 1295 | 1295 | { |
| 1296 | 1296 | return $this->stop('msg_invalid_request'); |
| 1297 | 1297 | } |
@@ -1302,9 +1302,9 @@ discard block |
||
| 1302 | 1302 | $args->auth_key = $auth_key; |
| 1303 | 1303 | $output = executeQuery('member.getAuthMail', $args); |
| 1304 | 1304 | |
| 1305 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1305 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1306 | 1306 | { |
| 1307 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1307 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1308 | 1308 | { |
| 1309 | 1309 | executeQuery('member.deleteAuthMail', $args); |
| 1310 | 1310 | } |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | return $this->stop('msg_invalid_auth_key'); |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1315 | + if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1316 | 1316 | { |
| 1317 | 1317 | executeQuery('member.deleteAuthMail', $args); |
| 1318 | 1318 | |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | $auth_args->is_register = 'Y'; |
| 1328 | 1328 | |
| 1329 | 1329 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1330 | - if(!$output->toBool()) return $output; |
|
| 1330 | + if (!$output->toBool()) return $output; |
|
| 1331 | 1331 | |
| 1332 | 1332 | // resend auth mail. |
| 1333 | 1333 | $this->_sendAuthMail($auth_args, $memberInfo); |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | $args->password = $output->data->new_password; |
| 1342 | 1342 | |
| 1343 | 1343 | // If credentials are correct, change the password to a new one |
| 1344 | - if($output->data->is_register == 'Y') |
|
| 1344 | + if ($output->data->is_register == 'Y') |
|
| 1345 | 1345 | { |
| 1346 | 1346 | $args->denied = 'N'; |
| 1347 | 1347 | } |
@@ -1354,13 +1354,13 @@ discard block |
||
| 1354 | 1354 | $is_register = $output->data->is_register; |
| 1355 | 1355 | |
| 1356 | 1356 | $output = executeQuery('member.updateMemberPassword', $args); |
| 1357 | - if(!$output->toBool()) |
|
| 1357 | + if (!$output->toBool()) |
|
| 1358 | 1358 | { |
| 1359 | 1359 | return $this->stop($output->getMessage()); |
| 1360 | 1360 | } |
| 1361 | 1361 | |
| 1362 | 1362 | // Remove all values having the member_srl from authentication table |
| 1363 | - executeQuery('member.deleteAuthMail',$args); |
|
| 1363 | + executeQuery('member.deleteAuthMail', $args); |
|
| 1364 | 1364 | |
| 1365 | 1365 | $this->_clearMemberCache($args->member_srl); |
| 1366 | 1366 | |
@@ -1379,33 +1379,33 @@ discard block |
||
| 1379 | 1379 | { |
| 1380 | 1380 | // Get an email_address |
| 1381 | 1381 | $email_address = Context::get('email_address'); |
| 1382 | - if(!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1382 | + if (!$email_address) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1383 | 1383 | // Log test by using email_address |
| 1384 | 1384 | $oMemberModel = getModel('member'); |
| 1385 | 1385 | |
| 1386 | 1386 | $args = new stdClass; |
| 1387 | 1387 | $args->email_address = $email_address; |
| 1388 | 1388 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1389 | - if(!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1389 | + if (!$memberSrl) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 1390 | 1390 | |
| 1391 | 1391 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1392 | 1392 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1393 | 1393 | |
| 1394 | 1394 | $oModuleModel = getModel('module'); |
| 1395 | 1395 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1396 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1397 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1396 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1397 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1398 | 1398 | |
| 1399 | 1399 | // Check if a authentication mail has been sent previously |
| 1400 | 1400 | $chk_args = new stdClass; |
| 1401 | 1401 | $chk_args->member_srl = $member_info->member_srl; |
| 1402 | 1402 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1403 | - if($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1403 | + if ($output->toBool() && $output->data->count == '0') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1404 | 1404 | |
| 1405 | 1405 | $auth_args = new stdClass; |
| 1406 | 1406 | $auth_args->member_srl = $member_info->member_srl; |
| 1407 | 1407 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1408 | - if(!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1408 | + if (!$output->data || !$output->data[0]->auth_key) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1409 | 1409 | $auth_info = $output->data[0]; |
| 1410 | 1410 | |
| 1411 | 1411 | // Update the regdate of authmail entry |
@@ -1416,12 +1416,12 @@ discard block |
||
| 1416 | 1416 | |
| 1417 | 1417 | $memberInfo = array(); |
| 1418 | 1418 | global $lang; |
| 1419 | - if(is_array($member_config->signupForm)) |
|
| 1419 | + if (is_array($member_config->signupForm)) |
|
| 1420 | 1420 | { |
| 1421 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1422 | - foreach($member_config->signupForm as $form) |
|
| 1421 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1422 | + foreach ($member_config->signupForm as $form) |
|
| 1423 | 1423 | { |
| 1424 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1424 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1425 | 1425 | { |
| 1426 | 1426 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1427 | 1427 | } |
@@ -1440,19 +1440,19 @@ discard block |
||
| 1440 | 1440 | Context::set('member_config', $member_config); |
| 1441 | 1441 | |
| 1442 | 1442 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1443 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1443 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1444 | 1444 | |
| 1445 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
|
| 1445 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key); |
|
| 1446 | 1446 | Context::set('auth_url', $auth_url); |
| 1447 | 1447 | |
| 1448 | 1448 | $oTemplate = &TemplateHandler::getInstance(); |
| 1449 | 1449 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1450 | 1450 | // Send a mail |
| 1451 | 1451 | $oMail = new Mail(); |
| 1452 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1452 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1453 | 1453 | $oMail->setContent($content); |
| 1454 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1455 | - $oMail->setReceiptor( $args->user_name, $args->email_address ); |
|
| 1454 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1455 | + $oMail->setReceiptor($args->user_name, $args->email_address); |
|
| 1456 | 1456 | $oMail->send(); |
| 1457 | 1457 | |
| 1458 | 1458 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
@@ -1467,23 +1467,23 @@ discard block |
||
| 1467 | 1467 | $memberInfo = $_SESSION['auth_member_info']; |
| 1468 | 1468 | unset($_SESSION['auth_member_info']); |
| 1469 | 1469 | |
| 1470 | - if(!$memberInfo) |
|
| 1470 | + if (!$memberInfo) |
|
| 1471 | 1471 | { |
| 1472 | 1472 | return $this->stop('msg_invalid_request'); |
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | 1475 | $newEmail = Context::get('email_address'); |
| 1476 | 1476 | |
| 1477 | - if(!$newEmail) |
|
| 1477 | + if (!$newEmail) |
|
| 1478 | 1478 | { |
| 1479 | 1479 | return $this->stop('msg_invalid_request'); |
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | 1482 | $oMemberModel = getModel('member'); |
| 1483 | 1483 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 1484 | - if($member_srl) |
|
| 1484 | + if ($member_srl) |
|
| 1485 | 1485 | { |
| 1486 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 1486 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | // remove all key by member_srl |
@@ -1491,7 +1491,7 @@ discard block |
||
| 1491 | 1491 | $args->member_srl = $memberInfo->member_srl; |
| 1492 | 1492 | $output = executeQuery('member.deleteAuthMail', $args); |
| 1493 | 1493 | |
| 1494 | - if(!$output->toBool()) |
|
| 1494 | + if (!$output->toBool()) |
|
| 1495 | 1495 | { |
| 1496 | 1496 | return $output; |
| 1497 | 1497 | } |
@@ -1501,7 +1501,7 @@ discard block |
||
| 1501 | 1501 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 1502 | 1502 | |
| 1503 | 1503 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 1504 | - if(!$output->toBool()) |
|
| 1504 | + if (!$output->toBool()) |
|
| 1505 | 1505 | { |
| 1506 | 1506 | return $this->stop($output->getMessage()); |
| 1507 | 1507 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
| 1518 | 1518 | $auth_args->is_register = 'Y'; |
| 1519 | 1519 | |
| 1520 | 1520 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1521 | - if(!$output->toBool()) return $output; |
|
| 1521 | + if (!$output->toBool()) return $output; |
|
| 1522 | 1522 | |
| 1523 | 1523 | $memberInfo->email_address = $newEmail; |
| 1524 | 1524 | |
@@ -1542,12 +1542,12 @@ discard block |
||
| 1542 | 1542 | $memberInfo = array(); |
| 1543 | 1543 | |
| 1544 | 1544 | global $lang; |
| 1545 | - if(is_array($member_config->signupForm)) |
|
| 1545 | + if (is_array($member_config->signupForm)) |
|
| 1546 | 1546 | { |
| 1547 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1548 | - foreach($member_config->signupForm as $form) |
|
| 1547 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1548 | + foreach ($member_config->signupForm as $form) |
|
| 1549 | 1549 | { |
| 1550 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1550 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1551 | 1551 | { |
| 1552 | 1552 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1553 | 1553 | } |
@@ -1562,25 +1562,25 @@ discard block |
||
| 1562 | 1562 | } |
| 1563 | 1563 | Context::set('memberInfo', $memberInfo); |
| 1564 | 1564 | |
| 1565 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1566 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1565 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1566 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1567 | 1567 | |
| 1568 | 1568 | Context::set('member_config', $member_config); |
| 1569 | 1569 | |
| 1570 | 1570 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1571 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1571 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1572 | 1572 | |
| 1573 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 1573 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 1574 | 1574 | Context::set('auth_url', $auth_url); |
| 1575 | 1575 | |
| 1576 | 1576 | $oTemplate = &TemplateHandler::getInstance(); |
| 1577 | 1577 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1578 | 1578 | // Send a mail |
| 1579 | 1579 | $oMail = new Mail(); |
| 1580 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1580 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1581 | 1581 | $oMail->setContent($content); |
| 1582 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1583 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1582 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1583 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1584 | 1584 | $oMail->send(); |
| 1585 | 1585 | } |
| 1586 | 1586 | |
@@ -1593,7 +1593,7 @@ discard block |
||
| 1593 | 1593 | { |
| 1594 | 1594 | $site_module_info = Context::get('site_module_info'); |
| 1595 | 1595 | $logged_info = Context::get('logged_info'); |
| 1596 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1596 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1597 | 1597 | |
| 1598 | 1598 | $oMemberModel = getModel('member'); |
| 1599 | 1599 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1612,13 +1612,13 @@ discard block |
||
| 1612 | 1612 | { |
| 1613 | 1613 | $site_module_info = Context::get('site_module_info'); |
| 1614 | 1614 | $logged_info = Context::get('logged_info'); |
| 1615 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1615 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1616 | 1616 | |
| 1617 | 1617 | $args = new stdClass; |
| 1618 | - $args->site_srl= $site_module_info->site_srl; |
|
| 1618 | + $args->site_srl = $site_module_info->site_srl; |
|
| 1619 | 1619 | $args->member_srl = $logged_info->member_srl; |
| 1620 | 1620 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1621 | - if(!$output->toBool()) return $output; |
|
| 1621 | + if (!$output->toBool()) return $output; |
|
| 1622 | 1622 | $this->setMessage('success_deleted'); |
| 1623 | 1623 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1624 | 1624 | } |
@@ -1632,25 +1632,25 @@ discard block |
||
| 1632 | 1632 | */ |
| 1633 | 1633 | function setMemberConfig($args) |
| 1634 | 1634 | { |
| 1635 | - if(!$args->skin) $args->skin = "default"; |
|
| 1636 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1637 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1638 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1639 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1640 | - $args->enable_openid= 'N'; |
|
| 1641 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1642 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1643 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1644 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1645 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1646 | - $args->limit_day = (int)$args->limit_day; |
|
| 1635 | + if (!$args->skin) $args->skin = "default"; |
|
| 1636 | + if (!$args->colorset) $args->colorset = "white"; |
|
| 1637 | + if (!$args->editor_skin) $args->editor_skin = "ckeditor"; |
|
| 1638 | + if (!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1639 | + if ($args->enable_join != 'Y') $args->enable_join = 'N'; |
|
| 1640 | + $args->enable_openid = 'N'; |
|
| 1641 | + if ($args->profile_image != 'Y') $args->profile_image = 'N'; |
|
| 1642 | + if ($args->image_name != 'Y') $args->image_name = 'N'; |
|
| 1643 | + if ($args->image_mark != 'Y') $args->image_mark = 'N'; |
|
| 1644 | + if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N'; |
|
| 1645 | + if (!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1646 | + $args->limit_day = (int) $args->limit_day; |
|
| 1647 | 1647 | |
| 1648 | 1648 | $agreement = trim($args->agreement); |
| 1649 | 1649 | unset($args->agreement); |
| 1650 | 1650 | |
| 1651 | 1651 | $oModuleController = getController('module'); |
| 1652 | - $output = $oModuleController->insertModuleConfig('member',$args); |
|
| 1653 | - if(!$output->toBool()) return $output; |
|
| 1652 | + $output = $oModuleController->insertModuleConfig('member', $args); |
|
| 1653 | + if (!$output->toBool()) return $output; |
|
| 1654 | 1654 | |
| 1655 | 1655 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1656 | 1656 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1671,11 +1671,11 @@ discard block |
||
| 1671 | 1671 | $signature = trim(removeHackTag($signature)); |
| 1672 | 1672 | $signature = preg_replace('/<(\/?)(embed|object|param)/is', '<$1$2', $signature); |
| 1673 | 1673 | |
| 1674 | - $check_signature = trim(str_replace(array(' ',"\n","\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1674 | + $check_signature = trim(str_replace(array(' ', "\n", "\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1675 | 1675 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1676 | 1676 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1677 | 1677 | |
| 1678 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1678 | + if (!$check_signature) return FileHandler::removeFile($filename); |
|
| 1679 | 1679 | |
| 1680 | 1680 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1681 | 1681 | FileHandler::makeDir($path); |
@@ -1704,15 +1704,15 @@ discard block |
||
| 1704 | 1704 | * |
| 1705 | 1705 | * @return BaseObject |
| 1706 | 1706 | */ |
| 1707 | - function addMemberToGroup($member_srl, $group_srl, $site_srl=0) |
|
| 1707 | + function addMemberToGroup($member_srl, $group_srl, $site_srl = 0) |
|
| 1708 | 1708 | { |
| 1709 | 1709 | $args = new stdClass(); |
| 1710 | 1710 | $args->member_srl = $member_srl; |
| 1711 | 1711 | $args->group_srl = $group_srl; |
| 1712 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1712 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1713 | 1713 | |
| 1714 | 1714 | // Add |
| 1715 | - $output = executeQuery('member.addMemberToGroup',$args); |
|
| 1715 | + $output = executeQuery('member.addMemberToGroup', $args); |
|
| 1716 | 1716 | $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); |
| 1717 | 1717 | |
| 1718 | 1718 | $this->_clearMemberCache($member_srl, $site_srl); |
@@ -1732,18 +1732,18 @@ discard block |
||
| 1732 | 1732 | { |
| 1733 | 1733 | $obj = new stdClass; |
| 1734 | 1734 | $obj->site_srl = $args->site_srl; |
| 1735 | - $obj->member_srl = implode(',',$args->member_srl); |
|
| 1735 | + $obj->member_srl = implode(',', $args->member_srl); |
|
| 1736 | 1736 | |
| 1737 | 1737 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1738 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1738 | + if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1739 | 1739 | |
| 1740 | 1740 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1741 | - if(!$output->toBool()) return $output; |
|
| 1741 | + if (!$output->toBool()) return $output; |
|
| 1742 | 1742 | |
| 1743 | 1743 | $inserted_members = array(); |
| 1744 | - foreach($args->member_srl as $key => $val) |
|
| 1744 | + foreach ($args->member_srl as $key => $val) |
|
| 1745 | 1745 | { |
| 1746 | - if($inserted_members[$val]) continue; |
|
| 1746 | + if ($inserted_members[$val]) continue; |
|
| 1747 | 1747 | $inserted_members[$val] = true; |
| 1748 | 1748 | |
| 1749 | 1749 | unset($obj); |
@@ -1753,7 +1753,7 @@ discard block |
||
| 1753 | 1753 | $obj->site_srl = $args->site_srl; |
| 1754 | 1754 | $obj->regdate = $date[$obj->member_srl]; |
| 1755 | 1755 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1756 | - if(!$output->toBool()) return $output; |
|
| 1756 | + if (!$output->toBool()) return $output; |
|
| 1757 | 1757 | |
| 1758 | 1758 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1759 | 1759 | } |
@@ -1775,9 +1775,9 @@ discard block |
||
| 1775 | 1775 | // Get information of the key |
| 1776 | 1776 | $output = executeQuery('member.getAutologin', $args); |
| 1777 | 1777 | // If no information exists, delete a cookie |
| 1778 | - if(!$output->toBool() || !$output->data) |
|
| 1778 | + if (!$output->toBool() || !$output->data) |
|
| 1779 | 1779 | { |
| 1780 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1780 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1781 | 1781 | return; |
| 1782 | 1782 | } |
| 1783 | 1783 | |
@@ -1787,9 +1787,9 @@ discard block |
||
| 1787 | 1787 | $user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address; |
| 1788 | 1788 | $password = $output->data->password; |
| 1789 | 1789 | |
| 1790 | - if(!$user_id || !$password) |
|
| 1790 | + if (!$user_id || !$password) |
|
| 1791 | 1791 | { |
| 1792 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1792 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1793 | 1793 | return; |
| 1794 | 1794 | } |
| 1795 | 1795 | |
@@ -1799,7 +1799,7 @@ discard block |
||
| 1799 | 1799 | $check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT']; |
| 1800 | 1800 | $check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32); |
| 1801 | 1801 | |
| 1802 | - if($check_key === substr($args->autologin_key, 32)) |
|
| 1802 | + if ($check_key === substr($args->autologin_key, 32)) |
|
| 1803 | 1803 | { |
| 1804 | 1804 | // Check change_password_date |
| 1805 | 1805 | $oModuleModel = getModel('module'); |
@@ -1807,12 +1807,12 @@ discard block |
||
| 1807 | 1807 | $limit_date = $member_config->change_password_date; |
| 1808 | 1808 | |
| 1809 | 1809 | // Check if change_password_date is set |
| 1810 | - if($limit_date > 0) |
|
| 1810 | + if ($limit_date > 0) |
|
| 1811 | 1811 | { |
| 1812 | 1812 | $oMemberModel = getModel('member'); |
| 1813 | 1813 | $columnList = array('member_srl', 'change_password_date'); |
| 1814 | 1814 | |
| 1815 | - if($config->identifier == 'user_id') |
|
| 1815 | + if ($config->identifier == 'user_id') |
|
| 1816 | 1816 | { |
| 1817 | 1817 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1818 | 1818 | } |
@@ -1821,7 +1821,7 @@ discard block |
||
| 1821 | 1821 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1822 | 1822 | } |
| 1823 | 1823 | |
| 1824 | - if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){ |
|
| 1824 | + if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) { |
|
| 1825 | 1825 | $do_auto_login = true; |
| 1826 | 1826 | } |
| 1827 | 1827 | |
@@ -1832,14 +1832,14 @@ discard block |
||
| 1832 | 1832 | } |
| 1833 | 1833 | } |
| 1834 | 1834 | |
| 1835 | - if($do_auto_login) |
|
| 1835 | + if ($do_auto_login) |
|
| 1836 | 1836 | { |
| 1837 | 1837 | $output = $this->doLogin($user_id); |
| 1838 | 1838 | } |
| 1839 | 1839 | else |
| 1840 | 1840 | { |
| 1841 | 1841 | executeQuery('member.deleteAutologin', $args); |
| 1842 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1842 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1843 | 1843 | } |
| 1844 | 1844 | } |
| 1845 | 1845 | |
@@ -1855,13 +1855,13 @@ discard block |
||
| 1855 | 1855 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1856 | 1856 | { |
| 1857 | 1857 | $user_id = strtolower($user_id); |
| 1858 | - if(!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 1858 | + if (!$user_id) return new BaseObject(-1, 'null_user_id'); |
|
| 1859 | 1859 | // Call a trigger before log-in (before) |
| 1860 | 1860 | $trigger_obj = new stdClass(); |
| 1861 | 1861 | $trigger_obj->user_id = $user_id; |
| 1862 | 1862 | $trigger_obj->password = $password; |
| 1863 | 1863 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1864 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1864 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1865 | 1865 | // Create a member model object |
| 1866 | 1866 | $oMemberModel = getModel('member'); |
| 1867 | 1867 | |
@@ -1871,12 +1871,12 @@ discard block |
||
| 1871 | 1871 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1872 | 1872 | |
| 1873 | 1873 | // check identifier |
| 1874 | - if($config->identifier == 'email_address') |
|
| 1874 | + if ($config->identifier == 'email_address') |
|
| 1875 | 1875 | { |
| 1876 | 1876 | // Get user_id information |
| 1877 | 1877 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1878 | 1878 | // Set an invalid user if no value returned |
| 1879 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1879 | + if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1880 | 1880 | |
| 1881 | 1881 | } |
| 1882 | 1882 | else |
@@ -1884,24 +1884,24 @@ discard block |
||
| 1884 | 1884 | // Get user_id information |
| 1885 | 1885 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1886 | 1886 | // Set an invalid user if no value returned |
| 1887 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1887 | + if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1888 | 1888 | } |
| 1889 | 1889 | |
| 1890 | 1890 | $output = executeQuery('member.getLoginCountByIp', $args); |
| 1891 | 1891 | $errorCount = $output->data->count; |
| 1892 | - if($errorCount >= $config->max_error_count) |
|
| 1892 | + if ($errorCount >= $config->max_error_count) |
|
| 1893 | 1893 | { |
| 1894 | 1894 | $last_update = strtotime($output->data->last_update); |
| 1895 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
| 1896 | - if($term < $config->max_error_count_time) |
|
| 1895 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
| 1896 | + if ($term < $config->max_error_count_time) |
|
| 1897 | 1897 | { |
| 1898 | 1898 | $term = $config->max_error_count_time - $term; |
| 1899 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1900 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1901 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1902 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1899 | + if ($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1900 | + elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min'); |
|
| 1901 | + elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour'); |
|
| 1902 | + else $term = intval($term / 86400).Context::getLang('unit_day'); |
|
| 1903 | 1903 | |
| 1904 | - return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
|
| 1904 | + return new BaseObject(-1, sprintf(Context::getLang('excess_ip_access_count'), $term)); |
|
| 1905 | 1905 | } |
| 1906 | 1906 | else |
| 1907 | 1907 | { |
@@ -1911,13 +1911,13 @@ discard block |
||
| 1911 | 1911 | } |
| 1912 | 1912 | |
| 1913 | 1913 | // Password Check |
| 1914 | - if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1914 | + if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1915 | 1915 | { |
| 1916 | - return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo); |
|
| 1916 | + return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo); |
|
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | 1919 | // If denied == 'Y', notify |
| 1920 | - if($this->memberInfo->denied == 'Y') |
|
| 1920 | + if ($this->memberInfo->denied == 'Y') |
|
| 1921 | 1921 | { |
| 1922 | 1922 | $args->member_srl = $this->memberInfo->member_srl; |
| 1923 | 1923 | $output = executeQuery('member.chkAuthMail', $args); |
@@ -1925,12 +1925,12 @@ discard block |
||
| 1925 | 1925 | { |
| 1926 | 1926 | $_SESSION['auth_member_srl'] = $this->memberInfo->member_srl; |
| 1927 | 1927 | $redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail'); |
| 1928 | - return $this->setRedirectUrl($redirectUrl, new BaseObject(-1,'msg_user_not_confirmed')); |
|
| 1928 | + return $this->setRedirectUrl($redirectUrl, new BaseObject(-1, 'msg_user_not_confirmed')); |
|
| 1929 | 1929 | } |
| 1930 | - return new BaseObject(-1,'msg_user_denied'); |
|
| 1930 | + return new BaseObject(-1, 'msg_user_denied'); |
|
| 1931 | 1931 | } |
| 1932 | 1932 | // Notify if denied_date is less than the current time |
| 1933 | - 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"))); |
|
| 1933 | + 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"))); |
|
| 1934 | 1934 | // Update the latest login time |
| 1935 | 1935 | $args->member_srl = $this->memberInfo->member_srl; |
| 1936 | 1936 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1940,36 +1940,36 @@ discard block |
||
| 1940 | 1940 | |
| 1941 | 1941 | // Check if there is recoding table. |
| 1942 | 1942 | $oDB = &DB::getInstance(); |
| 1943 | - if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1943 | + if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1944 | 1944 | { |
| 1945 | 1945 | // check if there is login fail records. |
| 1946 | 1946 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
| 1947 | - if($output->data && $output->data->content) |
|
| 1947 | + if ($output->data && $output->data->content) |
|
| 1948 | 1948 | { |
| 1949 | 1949 | $title = Context::getLang('login_fail_report'); |
| 1950 | 1950 | $message = '<ul>'; |
| 1951 | 1951 | $content = unserialize($output->data->content); |
| 1952 | - if(count($content) > $config->max_error_count) |
|
| 1952 | + if (count($content) > $config->max_error_count) |
|
| 1953 | 1953 | { |
| 1954 | - foreach($content as $val) |
|
| 1954 | + foreach ($content as $val) |
|
| 1955 | 1955 | { |
| 1956 | - $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>'; |
|
| 1956 | + $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>'; |
|
| 1957 | 1957 | } |
| 1958 | 1958 | $message .= '</ul>'; |
| 1959 | - $content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa')); |
|
| 1959 | + $content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa')); |
|
| 1960 | 1960 | |
| 1961 | 1961 | //send message |
| 1962 | 1962 | $oCommunicationController = getController('communication'); |
| 1963 | 1963 | $oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true); |
| 1964 | 1964 | |
| 1965 | - if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1965 | + if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1966 | 1966 | { |
| 1967 | 1967 | $view_url = Context::getRequestUri(); |
| 1968 | - $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); |
|
| 1968 | + $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); |
|
| 1969 | 1969 | $oMail = new Mail(); |
| 1970 | 1970 | $oMail->setTitle($title); |
| 1971 | 1971 | $oMail->setContent($content); |
| 1972 | - $oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email); |
|
| 1972 | + $oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email); |
|
| 1973 | 1973 | $oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address); |
| 1974 | 1974 | $oMail->send(); |
| 1975 | 1975 | } |
@@ -1979,9 +1979,9 @@ discard block |
||
| 1979 | 1979 | } |
| 1980 | 1980 | // Call a trigger after successfully log-in (after) |
| 1981 | 1981 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1982 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1982 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1983 | 1983 | // When user checked to use auto-login |
| 1984 | - if($keep_signed) |
|
| 1984 | + if ($keep_signed) |
|
| 1985 | 1985 | { |
| 1986 | 1986 | // Key generate for auto login |
| 1987 | 1987 | $oPassword = new Password(); |
@@ -1993,12 +1993,12 @@ discard block |
||
| 1993 | 1993 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1994 | 1994 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1995 | 1995 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1996 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 1996 | + if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000); |
|
| 1997 | 1997 | } |
| 1998 | - if($this->memberInfo->is_admin == 'Y') |
|
| 1998 | + if ($this->memberInfo->is_admin == 'Y') |
|
| 1999 | 1999 | { |
| 2000 | 2000 | $oMemberAdminModel = getAdminModel('member'); |
| 2001 | - if(!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 2001 | + if (!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 2002 | 2002 | { |
| 2003 | 2003 | $_SESSION['denied_admin'] = 'Y'; |
| 2004 | 2004 | } |
@@ -2016,18 +2016,18 @@ discard block |
||
| 2016 | 2016 | { |
| 2017 | 2017 | $oMemberModel = getModel('member'); |
| 2018 | 2018 | // If your information came through the current session information to extract information from the users |
| 2019 | - if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) |
|
| 2019 | + if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged()) |
|
| 2020 | 2020 | { |
| 2021 | 2021 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); |
| 2022 | 2022 | // If you do not destroy the session Profile |
| 2023 | - if($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 2023 | + if ($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 2024 | 2024 | { |
| 2025 | 2025 | $this->destroySessionInfo(); |
| 2026 | 2026 | return; |
| 2027 | 2027 | } |
| 2028 | 2028 | } |
| 2029 | 2029 | // Stop using the session id is destroyed |
| 2030 | - if($this->memberInfo->denied=='Y') |
|
| 2030 | + if ($this->memberInfo->denied == 'Y') |
|
| 2031 | 2031 | { |
| 2032 | 2032 | $this->destroySessionInfo(); |
| 2033 | 2033 | return; |
@@ -2057,10 +2057,10 @@ discard block |
||
| 2057 | 2057 | Context::set('logged_info', $this->memberInfo); |
| 2058 | 2058 | |
| 2059 | 2059 | // Only the menu configuration of the user (such as an add-on to the menu can be changed) |
| 2060 | - $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); |
|
| 2061 | - $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 2062 | - $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 2063 | - $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 2060 | + $this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info'); |
|
| 2061 | + $this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 2062 | + $this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 2063 | + $this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | 2066 | /** |
@@ -2082,7 +2082,7 @@ discard block |
||
| 2082 | 2082 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 2083 | 2083 | { |
| 2084 | 2084 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 2085 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2085 | + if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2086 | 2086 | |
| 2087 | 2087 | $obj = new stdClass; |
| 2088 | 2088 | $obj->url = $url; |
@@ -2101,33 +2101,33 @@ discard block |
||
| 2101 | 2101 | { |
| 2102 | 2102 | // Call a trigger (before) |
| 2103 | 2103 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 2104 | - if(!$output->toBool()) return $output; |
|
| 2104 | + if (!$output->toBool()) return $output; |
|
| 2105 | 2105 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 2106 | 2106 | $oModuleModel = getModel('module'); |
| 2107 | 2107 | $config = $oModuleModel->getModuleConfig('member'); |
| 2108 | 2108 | |
| 2109 | 2109 | $logged_info = Context::get('logged_info'); |
| 2110 | 2110 | // If the date of the temporary restrictions limit further information on the date of |
| 2111 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2111 | + if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24); |
|
| 2112 | 2112 | |
| 2113 | 2113 | $args->member_srl = getNextSequence(); |
| 2114 | 2114 | $args->list_order = -1 * $args->member_srl; |
| 2115 | 2115 | |
| 2116 | 2116 | // Execute insert or update depending on the value of member_srl |
| 2117 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2117 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2118 | 2118 | // Enter the user's identity changed to lowercase |
| 2119 | 2119 | else $args->user_id = strtolower($args->user_id); |
| 2120 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2121 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2120 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2121 | + if (!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2122 | 2122 | |
| 2123 | 2123 | // Control of essential parameters |
| 2124 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2125 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2126 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 2124 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2125 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2126 | + if (!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F')))) $args->allow_message = 'Y'; |
|
| 2127 | 2127 | |
| 2128 | - if($logged_info->is_admin == 'Y') |
|
| 2128 | + if ($logged_info->is_admin == 'Y') |
|
| 2129 | 2129 | { |
| 2130 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 2130 | + if ($args->is_admin != 'Y') $args->is_admin = 'N'; |
|
| 2131 | 2131 | } |
| 2132 | 2132 | else |
| 2133 | 2133 | { |
@@ -2142,97 +2142,97 @@ discard block |
||
| 2142 | 2142 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2143 | 2143 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2144 | 2144 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2145 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2146 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2145 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2146 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2147 | 2147 | |
| 2148 | 2148 | // Create a model object |
| 2149 | 2149 | $oMemberModel = getModel('member'); |
| 2150 | 2150 | |
| 2151 | 2151 | // Check password strength |
| 2152 | - if($args->password && !$password_is_hashed) |
|
| 2152 | + if ($args->password && !$password_is_hashed) |
|
| 2153 | 2153 | { |
| 2154 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2154 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2155 | 2155 | { |
| 2156 | 2156 | $message = Context::getLang('about_password_strength'); |
| 2157 | 2157 | return new BaseObject(-1, $message[$config->password_strength]); |
| 2158 | 2158 | } |
| 2159 | 2159 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2160 | 2160 | } |
| 2161 | - elseif(!$args->password) |
|
| 2161 | + elseif (!$args->password) |
|
| 2162 | 2162 | { |
| 2163 | 2163 | unset($args->password); |
| 2164 | 2164 | } |
| 2165 | 2165 | |
| 2166 | - if($args->find_account_answer && !$password_is_hashed) |
|
| 2166 | + if ($args->find_account_answer && !$password_is_hashed) |
|
| 2167 | 2167 | { |
| 2168 | 2168 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2169 | 2169 | } |
| 2170 | - elseif(!$args->find_account_answer) |
|
| 2170 | + elseif (!$args->find_account_answer) |
|
| 2171 | 2171 | { |
| 2172 | 2172 | unset($args->find_account_answer); |
| 2173 | 2173 | } |
| 2174 | 2174 | |
| 2175 | 2175 | // Check if ID is prohibited |
| 2176 | - if($oMemberModel->isDeniedID($args->user_id)) |
|
| 2176 | + if ($oMemberModel->isDeniedID($args->user_id)) |
|
| 2177 | 2177 | { |
| 2178 | - return new BaseObject(-1,'denied_user_id'); |
|
| 2178 | + return new BaseObject(-1, 'denied_user_id'); |
|
| 2179 | 2179 | } |
| 2180 | 2180 | |
| 2181 | 2181 | // Check if ID is duplicate |
| 2182 | 2182 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2183 | - if($member_srl) |
|
| 2183 | + if ($member_srl) |
|
| 2184 | 2184 | { |
| 2185 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2185 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2186 | 2186 | } |
| 2187 | 2187 | |
| 2188 | 2188 | // Check if nickname is prohibited |
| 2189 | - if($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2189 | + if ($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2190 | 2190 | { |
| 2191 | - return new BaseObject(-1,'denied_nick_name'); |
|
| 2191 | + return new BaseObject(-1, 'denied_nick_name'); |
|
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | 2194 | // Check if nickname is duplicate |
| 2195 | 2195 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2196 | - if($member_srl) |
|
| 2196 | + if ($member_srl) |
|
| 2197 | 2197 | { |
| 2198 | - return new BaseObject(-1,'msg_exists_nick_name'); |
|
| 2198 | + return new BaseObject(-1, 'msg_exists_nick_name'); |
|
| 2199 | 2199 | } |
| 2200 | 2200 | |
| 2201 | 2201 | // Check if email address is duplicate |
| 2202 | 2202 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2203 | - if($member_srl) |
|
| 2203 | + if ($member_srl) |
|
| 2204 | 2204 | { |
| 2205 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2205 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2206 | 2206 | } |
| 2207 | 2207 | |
| 2208 | 2208 | // Insert data into the DB |
| 2209 | 2209 | $args->list_order = -1 * $args->member_srl; |
| 2210 | 2210 | |
| 2211 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2212 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2211 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2212 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2213 | 2213 | |
| 2214 | 2214 | $oDB = &DB::getInstance(); |
| 2215 | 2215 | $oDB->begin(); |
| 2216 | 2216 | |
| 2217 | 2217 | $output = executeQuery('member.insertMember', $args); |
| 2218 | - if(!$output->toBool()) |
|
| 2218 | + if (!$output->toBool()) |
|
| 2219 | 2219 | { |
| 2220 | 2220 | $oDB->rollback(); |
| 2221 | 2221 | return $output; |
| 2222 | 2222 | } |
| 2223 | 2223 | |
| 2224 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2224 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2225 | 2225 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2226 | 2226 | // If no value is entered the default group, the value of group registration |
| 2227 | - if(!$args->group_srl_list) |
|
| 2227 | + if (!$args->group_srl_list) |
|
| 2228 | 2228 | { |
| 2229 | 2229 | $columnList = array('site_srl', 'group_srl'); |
| 2230 | 2230 | $default_group = $oMemberModel->getDefaultGroup(0, $columnList); |
| 2231 | - if($default_group) |
|
| 2231 | + if ($default_group) |
|
| 2232 | 2232 | { |
| 2233 | 2233 | // Add to the default group |
| 2234 | - $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); |
|
| 2235 | - if(!$output->toBool()) |
|
| 2234 | + $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); |
|
| 2235 | + if (!$output->toBool()) |
|
| 2236 | 2236 | { |
| 2237 | 2237 | $oDB->rollback(); |
| 2238 | 2238 | return $output; |
@@ -2242,11 +2242,11 @@ discard block |
||
| 2242 | 2242 | } |
| 2243 | 2243 | else |
| 2244 | 2244 | { |
| 2245 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2245 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2246 | 2246 | { |
| 2247 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2247 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2248 | 2248 | |
| 2249 | - if(!$output->toBool()) |
|
| 2249 | + if (!$output->toBool()) |
|
| 2250 | 2250 | { |
| 2251 | 2251 | $oDB->rollback(); |
| 2252 | 2252 | return $output; |
@@ -2256,7 +2256,7 @@ discard block |
||
| 2256 | 2256 | |
| 2257 | 2257 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2258 | 2258 | // When using email authentication mode (when you subscribed members denied a) certified mail sent |
| 2259 | - if($args->denied == 'Y') |
|
| 2259 | + if ($args->denied == 'Y') |
|
| 2260 | 2260 | { |
| 2261 | 2261 | // Insert data into the authentication DB |
| 2262 | 2262 | $oPassword = new Password(); |
@@ -2268,7 +2268,7 @@ discard block |
||
| 2268 | 2268 | $auth_args->is_register = 'Y'; |
| 2269 | 2269 | |
| 2270 | 2270 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2271 | - if(!$output->toBool()) |
|
| 2271 | + if (!$output->toBool()) |
|
| 2272 | 2272 | { |
| 2273 | 2273 | $oDB->rollback(); |
| 2274 | 2274 | return $output; |
@@ -2276,10 +2276,10 @@ discard block |
||
| 2276 | 2276 | $this->_sendAuthMail($auth_args, $args); |
| 2277 | 2277 | } |
| 2278 | 2278 | // Call a trigger (after) |
| 2279 | - if($output->toBool()) |
|
| 2279 | + if ($output->toBool()) |
|
| 2280 | 2280 | { |
| 2281 | 2281 | $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); |
| 2282 | - if(!$trigger_output->toBool()) |
|
| 2282 | + if (!$trigger_output->toBool()) |
|
| 2283 | 2283 | { |
| 2284 | 2284 | $oDB->rollback(); |
| 2285 | 2285 | return $trigger_output; |
@@ -2301,41 +2301,41 @@ discard block |
||
| 2301 | 2301 | { |
| 2302 | 2302 | // Call a trigger (before) |
| 2303 | 2303 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2304 | - if(!$output->toBool()) return $output; |
|
| 2304 | + if (!$output->toBool()) return $output; |
|
| 2305 | 2305 | // Create a model object |
| 2306 | 2306 | $oMemberModel = getModel('member'); |
| 2307 | 2307 | |
| 2308 | 2308 | $logged_info = Context::get('logged_info'); |
| 2309 | 2309 | // Get what you want to modify the original information |
| 2310 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2310 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2311 | 2311 | // Control of essential parameters |
| 2312 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2313 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2312 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2313 | + if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y'; |
|
| 2314 | 2314 | |
| 2315 | - if($logged_info->is_admin == 'Y') |
|
| 2315 | + if ($logged_info->is_admin == 'Y') |
|
| 2316 | 2316 | { |
| 2317 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2318 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2317 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2318 | + if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2319 | 2319 | } |
| 2320 | 2320 | else |
| 2321 | 2321 | { |
| 2322 | 2322 | unset($args->is_admin); |
| 2323 | - if($is_admin == false) |
|
| 2323 | + if ($is_admin == false) |
|
| 2324 | 2324 | unset($args->denied); |
| 2325 | - if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2325 | + if ($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2326 | 2326 | { |
| 2327 | 2327 | return $this->stop('msg_invalid_request'); |
| 2328 | 2328 | } |
| 2329 | 2329 | } |
| 2330 | 2330 | |
| 2331 | 2331 | // Sanitize user ID, username, nickname, homepage, blog |
| 2332 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2332 | + if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2333 | 2333 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2334 | 2334 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2335 | 2335 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2336 | 2336 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2337 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2338 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2337 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2338 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2339 | 2339 | |
| 2340 | 2340 | // check member identifier form |
| 2341 | 2341 | $config = $oMemberModel->getMemberConfig(); |
@@ -2344,56 +2344,56 @@ discard block |
||
| 2344 | 2344 | $orgMemberInfo = $output->data; |
| 2345 | 2345 | |
| 2346 | 2346 | // Check if email address or user ID is duplicate |
| 2347 | - if($config->identifier == 'email_address') |
|
| 2347 | + if ($config->identifier == 'email_address') |
|
| 2348 | 2348 | { |
| 2349 | 2349 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2350 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2350 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2351 | 2351 | { |
| 2352 | - return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2352 | + return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2353 | 2353 | } |
| 2354 | 2354 | $args->email_address = $orgMemberInfo->email_address; |
| 2355 | 2355 | } |
| 2356 | 2356 | else |
| 2357 | 2357 | { |
| 2358 | 2358 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2359 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2359 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2360 | 2360 | { |
| 2361 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2361 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2362 | 2362 | } |
| 2363 | 2363 | |
| 2364 | 2364 | $args->user_id = $orgMemberInfo->user_id; |
| 2365 | 2365 | } |
| 2366 | 2366 | |
| 2367 | - if($logged_info->is_admin !== 'Y') |
|
| 2367 | + if ($logged_info->is_admin !== 'Y') |
|
| 2368 | 2368 | { |
| 2369 | 2369 | // Check if ID is prohibited |
| 2370 | - if($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2370 | + if ($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2371 | 2371 | { |
| 2372 | - return new BaseObject(-1,'denied_user_id'); |
|
| 2372 | + return new BaseObject(-1, 'denied_user_id'); |
|
| 2373 | 2373 | } |
| 2374 | 2374 | |
| 2375 | 2375 | // Check if nickname is prohibited |
| 2376 | - if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2376 | + if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2377 | 2377 | { |
| 2378 | 2378 | return new BaseObject(-1, 'denied_nick_name'); |
| 2379 | 2379 | } |
| 2380 | 2380 | } |
| 2381 | 2381 | |
| 2382 | 2382 | // Check if ID is duplicate |
| 2383 | - if($args->user_id) |
|
| 2383 | + if ($args->user_id) |
|
| 2384 | 2384 | { |
| 2385 | 2385 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2386 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2386 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2387 | 2387 | { |
| 2388 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 2388 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 2389 | 2389 | } |
| 2390 | 2390 | } |
| 2391 | 2391 | |
| 2392 | 2392 | // Check if nickname is duplicate |
| 2393 | 2393 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2394 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2394 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2395 | 2395 | { |
| 2396 | - return new BaseObject(-1,'msg_exists_nick_name'); |
|
| 2396 | + return new BaseObject(-1, 'msg_exists_nick_name'); |
|
| 2397 | 2397 | } |
| 2398 | 2398 | |
| 2399 | 2399 | list($args->email_id, $args->email_host) = explode('@', $args->email_address); |
@@ -2402,9 +2402,9 @@ discard block |
||
| 2402 | 2402 | $oDB->begin(); |
| 2403 | 2403 | |
| 2404 | 2404 | // Check password strength |
| 2405 | - if($args->password) |
|
| 2405 | + if ($args->password) |
|
| 2406 | 2406 | { |
| 2407 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2407 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2408 | 2408 | { |
| 2409 | 2409 | $message = Context::getLang('about_password_strength'); |
| 2410 | 2410 | return new BaseObject(-1, $message[$config->password_strength]); |
@@ -2416,55 +2416,55 @@ discard block |
||
| 2416 | 2416 | $args->password = $orgMemberInfo->password; |
| 2417 | 2417 | } |
| 2418 | 2418 | |
| 2419 | - if($args->find_account_answer) { |
|
| 2419 | + if ($args->find_account_answer) { |
|
| 2420 | 2420 | $args->find_account_answer = $oMemberModel->hashPassword($args->find_account_answer); |
| 2421 | 2421 | } |
| 2422 | 2422 | else |
| 2423 | 2423 | { |
| 2424 | - $oPassword = new Password(); |
|
| 2424 | + $oPassword = new Password(); |
|
| 2425 | 2425 | $hashed = $oPassword->checkAlgorithm($orgMemberInfo->find_account_answer); |
| 2426 | 2426 | |
| 2427 | - if($hashed) { |
|
| 2427 | + if ($hashed) { |
|
| 2428 | 2428 | $args->find_account_answer = $orgMemberInfo->find_account_answer; |
| 2429 | 2429 | } else { |
| 2430 | 2430 | $args->find_account_answer = $oPassword->createHash($orgMemberInfo->find_account_answer); |
| 2431 | 2431 | } |
| 2432 | 2432 | } |
| 2433 | 2433 | |
| 2434 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2435 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2436 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2437 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2438 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2434 | + if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2435 | + if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2436 | + if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2437 | + if (!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2438 | + if (!$args->birthday) $args->birthday = ''; |
|
| 2439 | 2439 | |
| 2440 | 2440 | $output = executeQuery('member.updateMember', $args); |
| 2441 | 2441 | |
| 2442 | - if(!$output->toBool()) |
|
| 2442 | + if (!$output->toBool()) |
|
| 2443 | 2443 | { |
| 2444 | 2444 | $oDB->rollback(); |
| 2445 | 2445 | return $output; |
| 2446 | 2446 | } |
| 2447 | 2447 | |
| 2448 | - if($args->group_srl_list) |
|
| 2448 | + if ($args->group_srl_list) |
|
| 2449 | 2449 | { |
| 2450 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2450 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2451 | 2451 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2452 | 2452 | // If the group information, group information changes |
| 2453 | - if(count($group_srl_list) > 0) |
|
| 2453 | + if (count($group_srl_list) > 0) |
|
| 2454 | 2454 | { |
| 2455 | 2455 | $args->site_srl = 0; |
| 2456 | 2456 | // One of its members to delete all the group |
| 2457 | 2457 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2458 | - if(!$output->toBool()) |
|
| 2458 | + if (!$output->toBool()) |
|
| 2459 | 2459 | { |
| 2460 | 2460 | $oDB->rollback(); |
| 2461 | 2461 | return $output; |
| 2462 | 2462 | } |
| 2463 | 2463 | // Enter one of the loop a |
| 2464 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2464 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2465 | 2465 | { |
| 2466 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2467 | - if(!$output->toBool()) |
|
| 2466 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2467 | + if (!$output->toBool()) |
|
| 2468 | 2468 | { |
| 2469 | 2469 | $oDB->rollback(); |
| 2470 | 2470 | return $output; |
@@ -2476,9 +2476,9 @@ discard block |
||
| 2476 | 2476 | } |
| 2477 | 2477 | } |
| 2478 | 2478 | // Call a trigger (after) |
| 2479 | - if($output->toBool()) { |
|
| 2479 | + if ($output->toBool()) { |
|
| 2480 | 2480 | $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); |
| 2481 | - if(!$trigger_output->toBool()) |
|
| 2481 | + if (!$trigger_output->toBool()) |
|
| 2482 | 2482 | { |
| 2483 | 2483 | $oDB->rollback(); |
| 2484 | 2484 | return $trigger_output; |
@@ -2491,7 +2491,7 @@ discard block |
||
| 2491 | 2491 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2492 | 2492 | |
| 2493 | 2493 | // Save Session |
| 2494 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2494 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2495 | 2495 | $logged_info = Context::get('logged_info'); |
| 2496 | 2496 | |
| 2497 | 2497 | $output->add('member_srl', $args->member_srl); |
@@ -2503,14 +2503,14 @@ discard block |
||
| 2503 | 2503 | */ |
| 2504 | 2504 | function updateMemberPassword($args) |
| 2505 | 2505 | { |
| 2506 | - if($args->password) |
|
| 2506 | + if ($args->password) |
|
| 2507 | 2507 | { |
| 2508 | 2508 | |
| 2509 | 2509 | // check password strength |
| 2510 | 2510 | $oMemberModel = getModel('member'); |
| 2511 | 2511 | $config = $oMemberModel->getMemberConfig(); |
| 2512 | 2512 | |
| 2513 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2513 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2514 | 2514 | { |
| 2515 | 2515 | $message = Context::getLang('about_password_strength'); |
| 2516 | 2516 | return new BaseObject(-1, $message[$config->password_strength]); |
@@ -2518,13 +2518,13 @@ discard block |
||
| 2518 | 2518 | |
| 2519 | 2519 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2520 | 2520 | } |
| 2521 | - else if($args->hashed_password) |
|
| 2521 | + else if ($args->hashed_password) |
|
| 2522 | 2522 | { |
| 2523 | 2523 | $args->password = $args->hashed_password; |
| 2524 | 2524 | } |
| 2525 | 2525 | |
| 2526 | 2526 | $output = executeQuery('member.updateMemberPassword', $args); |
| 2527 | - if($output->toBool()) |
|
| 2527 | + if ($output->toBool()) |
|
| 2528 | 2528 | { |
| 2529 | 2529 | $result = executeQuery('member.updateChangePasswordDate', $args); |
| 2530 | 2530 | } |
@@ -2536,7 +2536,7 @@ discard block |
||
| 2536 | 2536 | |
| 2537 | 2537 | function updateFindAccountAnswer($member_srl, $answer) |
| 2538 | 2538 | { |
| 2539 | - $oPassword = new Password(); |
|
| 2539 | + $oPassword = new Password(); |
|
| 2540 | 2540 | |
| 2541 | 2541 | $args = new stdClass(); |
| 2542 | 2542 | $args->member_srl = $member_srl; |
@@ -2553,18 +2553,18 @@ discard block |
||
| 2553 | 2553 | $trigger_obj = new stdClass(); |
| 2554 | 2554 | $trigger_obj->member_srl = $member_srl; |
| 2555 | 2555 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2556 | - if(!$output->toBool()) return $output; |
|
| 2556 | + if (!$output->toBool()) return $output; |
|
| 2557 | 2557 | // Create a model object |
| 2558 | 2558 | $oMemberModel = getModel('member'); |
| 2559 | 2559 | // Bringing the user's information |
| 2560 | - if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2560 | + if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2561 | 2561 | { |
| 2562 | 2562 | $columnList = array('member_srl', 'is_admin'); |
| 2563 | 2563 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2564 | 2564 | } |
| 2565 | - if(!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2565 | + if (!$this->memberInfo) return new BaseObject(-1, 'msg_not_exists_member'); |
|
| 2566 | 2566 | // If managers can not be deleted |
| 2567 | - if($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2567 | + if ($this->memberInfo->is_admin == 'Y') return new BaseObject(-1, 'msg_cannot_delete_admin'); |
|
| 2568 | 2568 | |
| 2569 | 2569 | $oDB = &DB::getInstance(); |
| 2570 | 2570 | $oDB->begin(); |
@@ -2573,7 +2573,7 @@ discard block |
||
| 2573 | 2573 | $args->member_srl = $member_srl; |
| 2574 | 2574 | // Delete the entries in member_auth_mail |
| 2575 | 2575 | $output = executeQuery('member.deleteAuthMail', $args); |
| 2576 | - if(!$output->toBool()) |
|
| 2576 | + if (!$output->toBool()) |
|
| 2577 | 2577 | { |
| 2578 | 2578 | $oDB->rollback(); |
| 2579 | 2579 | return $output; |
@@ -2588,23 +2588,23 @@ discard block |
||
| 2588 | 2588 | */ |
| 2589 | 2589 | // Delete the entries in member_group_member |
| 2590 | 2590 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2591 | - if(!$output->toBool()) |
|
| 2591 | + if (!$output->toBool()) |
|
| 2592 | 2592 | { |
| 2593 | 2593 | $oDB->rollback(); |
| 2594 | 2594 | return $output; |
| 2595 | 2595 | } |
| 2596 | 2596 | // member removed from the table |
| 2597 | 2597 | $output = executeQuery('member.deleteMember', $args); |
| 2598 | - if(!$output->toBool()) |
|
| 2598 | + if (!$output->toBool()) |
|
| 2599 | 2599 | { |
| 2600 | 2600 | $oDB->rollback(); |
| 2601 | 2601 | return $output; |
| 2602 | 2602 | } |
| 2603 | 2603 | // Call a trigger (after) |
| 2604 | - if($output->toBool()) |
|
| 2604 | + if ($output->toBool()) |
|
| 2605 | 2605 | { |
| 2606 | 2606 | $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); |
| 2607 | - if(!$trigger_output->toBool()) |
|
| 2607 | + if (!$trigger_output->toBool()) |
|
| 2608 | 2608 | { |
| 2609 | 2609 | $oDB->rollback(); |
| 2610 | 2610 | return $trigger_output; |
@@ -2628,23 +2628,23 @@ discard block |
||
| 2628 | 2628 | */ |
| 2629 | 2629 | function destroySessionInfo() |
| 2630 | 2630 | { |
| 2631 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2631 | + if (!$_SESSION || !is_array($_SESSION)) return; |
|
| 2632 | 2632 | |
| 2633 | 2633 | $memberInfo = Context::get('logged_info'); |
| 2634 | 2634 | $memberSrl = $memberInfo->member_srl; |
| 2635 | 2635 | |
| 2636 | - foreach($_SESSION as $key => $val) |
|
| 2636 | + foreach ($_SESSION as $key => $val) |
|
| 2637 | 2637 | { |
| 2638 | 2638 | $_SESSION[$key] = ''; |
| 2639 | 2639 | } |
| 2640 | 2640 | |
| 2641 | 2641 | session_destroy(); |
| 2642 | - setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000); |
|
| 2643 | - setcookie('sso','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2644 | - setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2642 | + setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2643 | + setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2644 | + setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2645 | 2645 | setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000); |
| 2646 | 2646 | |
| 2647 | - if($memberSrl || $_COOKIE['xeak']) |
|
| 2647 | + if ($memberSrl || $_COOKIE['xeak']) |
|
| 2648 | 2648 | { |
| 2649 | 2649 | $args = new stdClass(); |
| 2650 | 2650 | $args->member_srl = $memberSrl; |
@@ -2660,22 +2660,22 @@ discard block |
||
| 2660 | 2660 | $pointGroup = $pointModuleConfig->point_group; |
| 2661 | 2661 | |
| 2662 | 2662 | $levelGroup = array(); |
| 2663 | - if(is_array($pointGroup) && count($pointGroup)>0) |
|
| 2663 | + if (is_array($pointGroup) && count($pointGroup) > 0) |
|
| 2664 | 2664 | { |
| 2665 | 2665 | $levelGroup = array_flip($pointGroup); |
| 2666 | 2666 | ksort($levelGroup); |
| 2667 | 2667 | } |
| 2668 | 2668 | $maxLevel = 0; |
| 2669 | 2669 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2670 | - if(count($resultGroup) > 0) |
|
| 2670 | + if (count($resultGroup) > 0) |
|
| 2671 | 2671 | $maxLevel = max(array_flip($resultGroup)); |
| 2672 | 2672 | |
| 2673 | - if($maxLevel > 0) |
|
| 2673 | + if ($maxLevel > 0) |
|
| 2674 | 2674 | { |
| 2675 | 2675 | $oPointModel = getModel('point'); |
| 2676 | 2676 | $originPoint = $oPointModel->getPoint($memberSrl); |
| 2677 | 2677 | |
| 2678 | - if($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2678 | + if ($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2679 | 2679 | { |
| 2680 | 2680 | $oPointController = getController('point'); |
| 2681 | 2681 | $oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update'); |
@@ -2685,18 +2685,18 @@ discard block |
||
| 2685 | 2685 | |
| 2686 | 2686 | function procMemberModifyEmailAddress() |
| 2687 | 2687 | { |
| 2688 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2688 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2689 | 2689 | |
| 2690 | 2690 | $member_info = Context::get('logged_info'); |
| 2691 | 2691 | $newEmail = Context::get('email_address'); |
| 2692 | 2692 | |
| 2693 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2693 | + if (!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2694 | 2694 | |
| 2695 | 2695 | $oMemberModel = getModel('member'); |
| 2696 | 2696 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2697 | - if($member_srl) return new BaseObject(-1,'msg_exists_email_address'); |
|
| 2697 | + if ($member_srl) return new BaseObject(-1, 'msg_exists_email_address'); |
|
| 2698 | 2698 | |
| 2699 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2699 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2700 | 2700 | { |
| 2701 | 2701 | return $this->stop('msg_invalid_request'); |
| 2702 | 2702 | } |
@@ -2712,7 +2712,7 @@ discard block |
||
| 2712 | 2712 | $oDB = &DB::getInstance(); |
| 2713 | 2713 | $oDB->begin(); |
| 2714 | 2714 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2715 | - if(!$output->toBool()) |
|
| 2715 | + if (!$output->toBool()) |
|
| 2716 | 2716 | { |
| 2717 | 2717 | $oDB->rollback(); |
| 2718 | 2718 | return $output; |
@@ -2722,7 +2722,7 @@ discard block |
||
| 2722 | 2722 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2723 | 2723 | |
| 2724 | 2724 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2725 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2725 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2726 | 2726 | |
| 2727 | 2727 | global $lang; |
| 2728 | 2728 | |
@@ -2734,17 +2734,17 @@ discard block |
||
| 2734 | 2734 | |
| 2735 | 2735 | Context::set('newEmail', $newEmail); |
| 2736 | 2736 | |
| 2737 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 2737 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 2738 | 2738 | Context::set('auth_url', $auth_url); |
| 2739 | 2739 | |
| 2740 | 2740 | $oTemplate = &TemplateHandler::getInstance(); |
| 2741 | 2741 | $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); |
| 2742 | 2742 | |
| 2743 | 2743 | $oMail = new Mail(); |
| 2744 | - $oMail->setTitle( Context::getLang('title_modify_email_address') ); |
|
| 2744 | + $oMail->setTitle(Context::getLang('title_modify_email_address')); |
|
| 2745 | 2745 | $oMail->setContent($content); |
| 2746 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 2747 | - $oMail->setReceiptor( $member_info->nick_name, $newEmail ); |
|
| 2746 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 2747 | + $oMail->setReceiptor($member_info->nick_name, $newEmail); |
|
| 2748 | 2748 | $result = $oMail->send(); |
| 2749 | 2749 | |
| 2750 | 2750 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); |
@@ -2758,16 +2758,16 @@ discard block |
||
| 2758 | 2758 | { |
| 2759 | 2759 | $member_srl = Context::get('member_srl'); |
| 2760 | 2760 | $auth_key = Context::get('auth_key'); |
| 2761 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2761 | + if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2762 | 2762 | |
| 2763 | 2763 | // Test logs for finding password by user_id and authkey |
| 2764 | 2764 | $args = new stdClass; |
| 2765 | 2765 | $args->member_srl = $member_srl; |
| 2766 | 2766 | $args->auth_key = $auth_key; |
| 2767 | 2767 | $output = executeQuery('member.getAuthMail', $args); |
| 2768 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2768 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2769 | 2769 | { |
| 2770 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2770 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2771 | 2771 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2772 | 2772 | } |
| 2773 | 2773 | |
@@ -2776,10 +2776,10 @@ discard block |
||
| 2776 | 2776 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2777 | 2777 | |
| 2778 | 2778 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2779 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2779 | + if (!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2780 | 2780 | |
| 2781 | 2781 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2782 | - executeQuery('member.deleteAuthChangeEmailAddress',$args); |
|
| 2782 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2783 | 2783 | |
| 2784 | 2784 | $this->_clearMemberCache($args->member_srl); |
| 2785 | 2785 | |
@@ -2797,7 +2797,7 @@ discard block |
||
| 2797 | 2797 | **/ |
| 2798 | 2798 | function triggerGetDocumentMenu(&$menu_list) |
| 2799 | 2799 | { |
| 2800 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 2800 | + if (!Context::get('is_logged')) return new BaseObject(); |
|
| 2801 | 2801 | |
| 2802 | 2802 | $logged_info = Context::get('logged_info'); |
| 2803 | 2803 | $document_srl = Context::get('target_srl'); |
@@ -2808,12 +2808,12 @@ discard block |
||
| 2808 | 2808 | $member_srl = $oDocument->get('member_srl'); |
| 2809 | 2809 | $module_srl = $oDocument->get('module_srl'); |
| 2810 | 2810 | |
| 2811 | - if(!$member_srl) return new BaseObject(); |
|
| 2812 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 2811 | + if (!$member_srl) return new BaseObject(); |
|
| 2812 | + if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new BaseObject(); |
|
| 2813 | 2813 | |
| 2814 | 2814 | $oDocumentController = getController('document'); |
| 2815 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2816 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2815 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2816 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2817 | 2817 | |
| 2818 | 2818 | return new BaseObject(); |
| 2819 | 2819 | } |
@@ -2827,7 +2827,7 @@ discard block |
||
| 2827 | 2827 | **/ |
| 2828 | 2828 | function triggerGetCommentMenu(&$menu_list) |
| 2829 | 2829 | { |
| 2830 | - if(!Context::get('is_logged')) return new BaseObject(); |
|
| 2830 | + if (!Context::get('is_logged')) return new BaseObject(); |
|
| 2831 | 2831 | |
| 2832 | 2832 | $logged_info = Context::get('logged_info'); |
| 2833 | 2833 | $comment_srl = Context::get('target_srl'); |
@@ -2838,12 +2838,12 @@ discard block |
||
| 2838 | 2838 | $module_srl = $oComment->get('module_srl'); |
| 2839 | 2839 | $member_srl = $oComment->get('member_srl'); |
| 2840 | 2840 | |
| 2841 | - if(!$member_srl) return new BaseObject(); |
|
| 2842 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new BaseObject(); |
|
| 2841 | + if (!$member_srl) return new BaseObject(); |
|
| 2842 | + if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new BaseObject(); |
|
| 2843 | 2843 | |
| 2844 | 2844 | $oCommentController = getController('comment'); |
| 2845 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2846 | - $oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2845 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2846 | + $oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2847 | 2847 | |
| 2848 | 2848 | return new BaseObject(); |
| 2849 | 2849 | } |
@@ -2855,7 +2855,7 @@ discard block |
||
| 2855 | 2855 | **/ |
| 2856 | 2856 | function procMemberSpammerManage() |
| 2857 | 2857 | { |
| 2858 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2858 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2859 | 2859 | |
| 2860 | 2860 | $logged_info = Context::get('logged_info'); |
| 2861 | 2861 | $member_srl = Context::get('member_srl'); |
@@ -2863,7 +2863,7 @@ discard block |
||
| 2863 | 2863 | $cnt_loop = Context::get('cnt_loop'); |
| 2864 | 2864 | $proc_type = Context::get('proc_type'); |
| 2865 | 2865 | $isMoveToTrash = true; |
| 2866 | - if($proc_type == "delete") |
|
| 2866 | + if ($proc_type == "delete") |
|
| 2867 | 2867 | $isMoveToTrash = false; |
| 2868 | 2868 | |
| 2869 | 2869 | // check grant |
@@ -2872,7 +2872,7 @@ discard block |
||
| 2872 | 2872 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2873 | 2873 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2874 | 2874 | |
| 2875 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2875 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2876 | 2876 | |
| 2877 | 2877 | $proc_msg = ""; |
| 2878 | 2878 | |
@@ -2881,10 +2881,10 @@ discard block |
||
| 2881 | 2881 | |
| 2882 | 2882 | // delete or trash destination |
| 2883 | 2883 | // proc member |
| 2884 | - if($cnt_loop == 1) |
|
| 2884 | + if ($cnt_loop == 1) |
|
| 2885 | 2885 | $this->_spammerMember($member_srl); |
| 2886 | 2886 | // proc document and comment |
| 2887 | - elseif($cnt_loop>1) |
|
| 2887 | + elseif ($cnt_loop > 1) |
|
| 2888 | 2888 | $this->_spammerDocuments($member_srl, $isMoveToTrash); |
| 2889 | 2889 | |
| 2890 | 2890 | // get destination count |
@@ -2893,11 +2893,11 @@ discard block |
||
| 2893 | 2893 | |
| 2894 | 2894 | $total_count = Context::get('total_count'); |
| 2895 | 2895 | $remain_count = $cnt_document + $cnt_comment; |
| 2896 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 2896 | + if ($cnt_loop == 1) $total_count = $remain_count; |
|
| 2897 | 2897 | |
| 2898 | 2898 | // get progress percent |
| 2899 | - if($total_count > 0) |
|
| 2900 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2899 | + if ($total_count > 0) |
|
| 2900 | + $progress = intval((($total_count - $remain_count) / $total_count) * 100); |
|
| 2901 | 2901 | else |
| 2902 | 2902 | $progress = 100; |
| 2903 | 2903 | |
@@ -2921,7 +2921,7 @@ discard block |
||
| 2921 | 2921 | **/ |
| 2922 | 2922 | private function _spammerMember($member_srl) { |
| 2923 | 2923 | $logged_info = Context::get('logged_info'); |
| 2924 | - $spam_description = trim( Context::get('spam_description') ); |
|
| 2924 | + $spam_description = trim(Context::get('spam_description')); |
|
| 2925 | 2925 | |
| 2926 | 2926 | $oMemberModel = getModel('member'); |
| 2927 | 2927 | $columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description'); |
@@ -2940,10 +2940,10 @@ discard block |
||
| 2940 | 2940 | $args->user_id = $member_info->user_id; |
| 2941 | 2941 | $args->nick_name = $member_info->nick_name; |
| 2942 | 2942 | $args->denied = "Y"; |
| 2943 | - $args->description = trim( $member_info->description ); |
|
| 2944 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 2943 | + $args->description = trim($member_info->description); |
|
| 2944 | + if ($args->description != "") $args->description .= "\n"; // add new line |
|
| 2945 | 2945 | |
| 2946 | - $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 . "]"; |
|
| 2946 | + $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."]"; |
|
| 2947 | 2947 | |
| 2948 | 2948 | $output = $this->updateMember($args, true); |
| 2949 | 2949 | |
@@ -2972,21 +2972,21 @@ discard block |
||
| 2972 | 2972 | // 1. proc comment, 2. proc document |
| 2973 | 2973 | $cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl); |
| 2974 | 2974 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
| 2975 | - if($cnt_comment > 0) |
|
| 2975 | + if ($cnt_comment > 0) |
|
| 2976 | 2976 | { |
| 2977 | 2977 | $columnList = array(); |
| 2978 | 2978 | $commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2979 | - if($commentList) { |
|
| 2980 | - foreach($commentList as $v) { |
|
| 2979 | + if ($commentList) { |
|
| 2980 | + foreach ($commentList as $v) { |
|
| 2981 | 2981 | $oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash); |
| 2982 | 2982 | } |
| 2983 | 2983 | } |
| 2984 | - } elseif($cnt_document > 0) { |
|
| 2984 | + } elseif ($cnt_document > 0) { |
|
| 2985 | 2985 | $columnList = array(); |
| 2986 | 2986 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2987 | - if($documentList) { |
|
| 2988 | - foreach($documentList as $v) { |
|
| 2989 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2987 | + if ($documentList) { |
|
| 2988 | + foreach ($documentList as $v) { |
|
| 2989 | + if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2990 | 2990 | else $oDocumentController->deleteDocument($v->document_srl); |
| 2991 | 2991 | } |
| 2992 | 2992 | } |
@@ -2998,24 +2998,24 @@ discard block |
||
| 2998 | 2998 | function _clearMemberCache($member_srl, $site_srl = 0) |
| 2999 | 2999 | { |
| 3000 | 3000 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 3001 | - if($oCacheHandler->isSupport()) |
|
| 3001 | + if ($oCacheHandler->isSupport()) |
|
| 3002 | 3002 | { |
| 3003 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl; |
|
| 3003 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
| 3004 | 3004 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 3005 | 3005 | $oCacheHandler->delete($cache_key); |
| 3006 | 3006 | |
| 3007 | - if($site_srl !== 0) |
|
| 3007 | + if ($site_srl !== 0) |
|
| 3008 | 3008 | { |
| 3009 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 3009 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 3010 | 3010 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 3011 | 3011 | $oCacheHandler->delete($cache_key); |
| 3012 | 3012 | } |
| 3013 | 3013 | } |
| 3014 | 3014 | |
| 3015 | 3015 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 3016 | - if($oCacheHandler->isSupport()) |
|
| 3016 | + if ($oCacheHandler->isSupport()) |
|
| 3017 | 3017 | { |
| 3018 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 3018 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 3019 | 3019 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 3020 | 3020 | $oCacheHandler->delete($cache_key); |
| 3021 | 3021 | } |
@@ -141,24 +141,24 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | function getInstance($db_type = NULL) |
| 143 | 143 | { |
| 144 | - if(!$db_type) |
|
| 144 | + if (!$db_type) |
|
| 145 | 145 | { |
| 146 | 146 | $db_type = Context::getDBType(); |
| 147 | 147 | } |
| 148 | - if(!$db_type && Context::isInstalled()) |
|
| 148 | + if (!$db_type && Context::isInstalled()) |
|
| 149 | 149 | { |
| 150 | 150 | return new BaseObject(-1, 'msg_db_not_setted'); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if(!isset($GLOBALS['__DB__'])) |
|
| 153 | + if (!isset($GLOBALS['__DB__'])) |
|
| 154 | 154 | { |
| 155 | 155 | $GLOBALS['__DB__'] = array(); |
| 156 | 156 | } |
| 157 | - if(!isset($GLOBALS['__DB__'][$db_type])) |
|
| 157 | + if (!isset($GLOBALS['__DB__'][$db_type])) |
|
| 158 | 158 | { |
| 159 | - $class_name = 'DB' . ucfirst($db_type); |
|
| 160 | - $class_file = _XE_PATH_ . "classes/db/$class_name.class.php"; |
|
| 161 | - if(!file_exists($class_file)) |
|
| 159 | + $class_name = 'DB'.ucfirst($db_type); |
|
| 160 | + $class_file = _XE_PATH_."classes/db/$class_name.class.php"; |
|
| 161 | + if (!file_exists($class_file)) |
|
| 162 | 162 | { |
| 163 | 163 | return new BaseObject(-1, 'msg_db_not_setted'); |
| 164 | 164 | } |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function DB() |
| 189 | 189 | { |
| 190 | - $this->count_cache_path = _XE_PATH_ . $this->count_cache_path; |
|
| 191 | - $this->cache_file = _XE_PATH_ . $this->cache_file; |
|
| 190 | + $this->count_cache_path = _XE_PATH_.$this->count_cache_path; |
|
| 191 | + $this->cache_file = _XE_PATH_.$this->cache_file; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -210,18 +210,18 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public static function getEnableList() |
| 212 | 212 | { |
| 213 | - if(!self::$supported_list) |
|
| 213 | + if (!self::$supported_list) |
|
| 214 | 214 | { |
| 215 | 215 | $oDB = new DB(); |
| 216 | 216 | self::$supported_list = $oDB->_getSupportedList(); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $enableList = array(); |
| 220 | - if(is_array(self::$supported_list)) |
|
| 220 | + if (is_array(self::$supported_list)) |
|
| 221 | 221 | { |
| 222 | - foreach(self::$supported_list AS $key => $value) |
|
| 222 | + foreach (self::$supported_list AS $key => $value) |
|
| 223 | 223 | { |
| 224 | - if($value->enable) |
|
| 224 | + if ($value->enable) |
|
| 225 | 225 | { |
| 226 | 226 | $enableList[] = $value; |
| 227 | 227 | } |
@@ -237,18 +237,18 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public static function getDisableList() |
| 239 | 239 | { |
| 240 | - if(!self::$supported_list) |
|
| 240 | + if (!self::$supported_list) |
|
| 241 | 241 | { |
| 242 | 242 | $oDB = new DB(); |
| 243 | 243 | self::$supported_list = $oDB->_getSupportedList(); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $disableList = array(); |
| 247 | - if(is_array(self::$supported_list)) |
|
| 247 | + if (is_array(self::$supported_list)) |
|
| 248 | 248 | { |
| 249 | - foreach(self::$supported_list AS $key => $value) |
|
| 249 | + foreach (self::$supported_list AS $key => $value) |
|
| 250 | 250 | { |
| 251 | - if(!$value->enable) |
|
| 251 | + if (!$value->enable) |
|
| 252 | 252 | { |
| 253 | 253 | $disableList[] = $value; |
| 254 | 254 | } |
@@ -265,24 +265,24 @@ discard block |
||
| 265 | 265 | function _getSupportedList() |
| 266 | 266 | { |
| 267 | 267 | static $get_supported_list = ''; |
| 268 | - if(is_array($get_supported_list)) |
|
| 268 | + if (is_array($get_supported_list)) |
|
| 269 | 269 | { |
| 270 | 270 | self::$supported_list = $get_supported_list; |
| 271 | 271 | return self::$supported_list; |
| 272 | 272 | } |
| 273 | 273 | $get_supported_list = array(); |
| 274 | - $db_classes_path = _XE_PATH_ . "classes/db/"; |
|
| 274 | + $db_classes_path = _XE_PATH_."classes/db/"; |
|
| 275 | 275 | $filter = "/^DB([^\.]+)\.class\.php/i"; |
| 276 | 276 | $supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE); |
| 277 | 277 | |
| 278 | 278 | // after creating instance of class, check is supported |
| 279 | - for($i = 0; $i < count($supported_list); $i++) |
|
| 279 | + for ($i = 0; $i < count($supported_list); $i++) |
|
| 280 | 280 | { |
| 281 | 281 | $db_type = $supported_list[$i]; |
| 282 | 282 | |
| 283 | 283 | $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); |
| 284 | - $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); |
|
| 285 | - if(!file_exists($class_file)) |
|
| 284 | + $class_file = sprintf(_XE_PATH_."classes/db/%s.class.php", $class_name); |
|
| 285 | + if (!file_exists($class_file)) |
|
| 286 | 286 | { |
| 287 | 287 | continue; |
| 288 | 288 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | require_once($class_file); |
| 292 | 292 | $oDB = new $class_name(FALSE); |
| 293 | 293 | |
| 294 | - if(!$oDB) |
|
| 294 | + if (!$oDB) |
|
| 295 | 295 | { |
| 296 | 296 | continue; |
| 297 | 297 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | function _sortDBMS($a, $b) |
| 317 | 317 | { |
| 318 | - if(!isset($this->priority_dbms[$a->db_type])) |
|
| 318 | + if (!isset($this->priority_dbms[$a->db_type])) |
|
| 319 | 319 | { |
| 320 | 320 | $priority_a = 0; |
| 321 | 321 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $priority_a = $this->priority_dbms[$a->db_type]; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - if(!isset($this->priority_dbms[$b->db_type])) |
|
| 327 | + if (!isset($this->priority_dbms[$b->db_type])) |
|
| 328 | 328 | { |
| 329 | 329 | $priority_b = 0; |
| 330 | 330 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $priority_b = $this->priority_dbms[$b->db_type]; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if($priority_a == $priority_b) |
|
| 336 | + if ($priority_a == $priority_b) |
|
| 337 | 337 | { |
| 338 | 338 | return 0; |
| 339 | 339 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | function isConnected($type = 'master', $indx = 0) |
| 361 | 361 | { |
| 362 | - if($type == 'master') |
|
| 362 | + if ($type == 'master') |
|
| 363 | 363 | { |
| 364 | 364 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
| 365 | 365 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | */ |
| 389 | 389 | function actFinish() |
| 390 | 390 | { |
| 391 | - if(!$this->query) |
|
| 391 | + if (!$this->query) |
|
| 392 | 392 | { |
| 393 | 393 | return; |
| 394 | 394 | } |
@@ -409,14 +409,14 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | $bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace(); |
| 411 | 411 | |
| 412 | - foreach($bt as $no => $call) |
|
| 412 | + foreach ($bt as $no => $call) |
|
| 413 | 413 | { |
| 414 | - if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
| 414 | + if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
| 415 | 415 | { |
| 416 | 416 | $call_no = $no; |
| 417 | 417 | $call_no++; |
| 418 | 418 | $log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line']; |
| 419 | - $log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']); |
|
| 419 | + $log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']); |
|
| 420 | 420 | $call_no++; |
| 421 | 421 | $log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function']; |
| 422 | 422 | break; |
@@ -424,22 +424,22 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | // leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined) |
| 427 | - if($this->isError()) |
|
| 427 | + if ($this->isError()) |
|
| 428 | 428 | { |
| 429 | 429 | $log['result'] = 'Failed'; |
| 430 | 430 | $log['errno'] = $this->errno; |
| 431 | 431 | $log['errstr'] = $this->errstr; |
| 432 | 432 | |
| 433 | - if(__DEBUG_DB_OUTPUT__ == 1) |
|
| 433 | + if (__DEBUG_DB_OUTPUT__ == 1) |
|
| 434 | 434 | { |
| 435 | - $debug_file = _XE_PATH_ . "files/_debug_db_query.php"; |
|
| 435 | + $debug_file = _XE_PATH_."files/_debug_db_query.php"; |
|
| 436 | 436 | $buff = array(); |
| 437 | - if(!file_exists($debug_file)) |
|
| 437 | + if (!file_exists($debug_file)) |
|
| 438 | 438 | { |
| 439 | - $buff[] = '<?php exit(); ?' . '>'; |
|
| 439 | + $buff[] = '<?php exit(); ?'.'>'; |
|
| 440 | 440 | } |
| 441 | 441 | $buff[] = print_r($log, TRUE); |
| 442 | - @file_put_contents($debug_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
|
| 442 | + @file_put_contents($debug_file, implode("\n", $buff)."\n\n", FILE_APPEND | LOCK_EX); |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | else |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $log_args = new stdClass; |
| 453 | 453 | $log_args->query = $this->query; |
| 454 | 454 | $log_args->query_id = $this->query_id; |
| 455 | - $log_args->caller = $log['called_method'] . '() in ' . $log['called_file']; |
|
| 455 | + $log_args->caller = $log['called_method'].'() in '.$log['called_file']; |
|
| 456 | 456 | $log_args->connection = $log['connection']; |
| 457 | 457 | writeSlowlog('query', $elapsed_time, $log_args); |
| 458 | 458 | } |
@@ -510,11 +510,11 @@ discard block |
||
| 510 | 510 | { |
| 511 | 511 | static $cache_file = array(); |
| 512 | 512 | |
| 513 | - if(!$query_id) |
|
| 513 | + if (!$query_id) |
|
| 514 | 514 | { |
| 515 | 515 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 516 | 516 | } |
| 517 | - if(!$this->db_type) |
|
| 517 | + if (!$this->db_type) |
|
| 518 | 518 | { |
| 519 | 519 | return; |
| 520 | 520 | } |
@@ -523,20 +523,20 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | $this->query_id = $query_id; |
| 525 | 525 | |
| 526 | - if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
| 526 | + if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
| 527 | 527 | { |
| 528 | 528 | $id_args = explode('.', $query_id); |
| 529 | - if(count($id_args) == 2) |
|
| 529 | + if (count($id_args) == 2) |
|
| 530 | 530 | { |
| 531 | 531 | $target = 'modules'; |
| 532 | 532 | $module = $id_args[0]; |
| 533 | 533 | $id = $id_args[1]; |
| 534 | 534 | } |
| 535 | - elseif(count($id_args) == 3) |
|
| 535 | + elseif (count($id_args) == 3) |
|
| 536 | 536 | { |
| 537 | 537 | $target = $id_args[0]; |
| 538 | 538 | $typeList = array('addons' => 1, 'widgets' => 1); |
| 539 | - if(!isset($typeList[$target])) |
|
| 539 | + if (!isset($typeList[$target])) |
|
| 540 | 540 | { |
| 541 | 541 | $this->actDBClassFinish(); |
| 542 | 542 | return; |
@@ -544,14 +544,14 @@ discard block |
||
| 544 | 544 | $module = $id_args[1]; |
| 545 | 545 | $id = $id_args[2]; |
| 546 | 546 | } |
| 547 | - if(!$target || !$module || !$id) |
|
| 547 | + if (!$target || !$module || !$id) |
|
| 548 | 548 | { |
| 549 | 549 | $this->actDBClassFinish(); |
| 550 | 550 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | $xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id); |
| 554 | - if(!file_exists($xml_file)) |
|
| 554 | + if (!file_exists($xml_file)) |
|
| 555 | 555 | { |
| 556 | 556 | $this->actDBClassFinish(); |
| 557 | 557 | return new BaseObject(-1, 'msg_invalid_queryid'); |
@@ -579,13 +579,13 @@ discard block |
||
| 579 | 579 | $cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type); |
| 580 | 580 | |
| 581 | 581 | $cache_time = -1; |
| 582 | - if(file_exists($cache_file)) |
|
| 582 | + if (file_exists($cache_file)) |
|
| 583 | 583 | { |
| 584 | 584 | $cache_time = filemtime($cache_file); |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | // if there is no cache file or is not new, find original xml query file and parse it |
| 588 | - if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) |
|
| 588 | + if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_.'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_.'classes/xml/XmlQueryParser.class.php')) |
|
| 589 | 589 | { |
| 590 | 590 | $oParser = new XmlQueryParser(); |
| 591 | 591 | $oParser->parse($query_id, $xml_file, $cache_file); |
@@ -606,27 +606,27 @@ discard block |
||
| 606 | 606 | { |
| 607 | 607 | global $lang; |
| 608 | 608 | |
| 609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
| 609 | + if (!in_array($type, array('master', 'slave'))) $type = 'slave'; |
|
| 610 | 610 | |
| 611 | - if(!file_exists($cache_file)) |
|
| 611 | + if (!file_exists($cache_file)) |
|
| 612 | 612 | { |
| 613 | 613 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - if($source_args) |
|
| 616 | + if ($source_args) |
|
| 617 | 617 | { |
| 618 | 618 | $args = clone $source_args; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | $output = include($cache_file); |
| 622 | 622 | |
| 623 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
| 623 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
| 624 | 624 | { |
| 625 | 625 | return $output; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | // execute appropriate query |
| 629 | - switch($output->getAction()) |
|
| 629 | + switch ($output->getAction()) |
|
| 630 | 630 | { |
| 631 | 631 | case 'insert' : |
| 632 | 632 | case 'insert-select' : |
@@ -649,11 +649,11 @@ discard block |
||
| 649 | 649 | break; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - if($this->isError()) |
|
| 652 | + if ($this->isError()) |
|
| 653 | 653 | { |
| 654 | 654 | $output = $this->getError(); |
| 655 | 655 | } |
| 656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 656 | + else if (!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 657 | 657 | { |
| 658 | 658 | $output = new BaseObject(); |
| 659 | 659 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | */ |
| 800 | 800 | function dropTable($table_name) |
| 801 | 801 | { |
| 802 | - if(!$table_name) |
|
| 802 | + if (!$table_name) |
|
| 803 | 803 | { |
| 804 | 804 | return; |
| 805 | 805 | } |
@@ -816,59 +816,59 @@ discard block |
||
| 816 | 816 | function getSelectSql($query, $with_values = TRUE) |
| 817 | 817 | { |
| 818 | 818 | $select = $query->getSelectString($with_values); |
| 819 | - if($select == '') |
|
| 819 | + if ($select == '') |
|
| 820 | 820 | { |
| 821 | 821 | return new BaseObject(-1, "Invalid query"); |
| 822 | 822 | } |
| 823 | - $select = 'SELECT ' . $select; |
|
| 823 | + $select = 'SELECT '.$select; |
|
| 824 | 824 | |
| 825 | 825 | $from = $query->getFromString($with_values); |
| 826 | - if($from == '') |
|
| 826 | + if ($from == '') |
|
| 827 | 827 | { |
| 828 | 828 | return new BaseObject(-1, "Invalid query"); |
| 829 | 829 | } |
| 830 | - $from = ' FROM ' . $from; |
|
| 830 | + $from = ' FROM '.$from; |
|
| 831 | 831 | |
| 832 | 832 | $where = $query->getWhereString($with_values); |
| 833 | - if($where != '') |
|
| 833 | + if ($where != '') |
|
| 834 | 834 | { |
| 835 | - $where = ' WHERE ' . $where; |
|
| 835 | + $where = ' WHERE '.$where; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | $tableObjects = $query->getTables(); |
| 839 | 839 | $index_hint_list = ''; |
| 840 | - foreach($tableObjects as $tableObject) |
|
| 840 | + foreach ($tableObjects as $tableObject) |
|
| 841 | 841 | { |
| 842 | - if(is_a($tableObject, 'CubridTableWithHint')) |
|
| 842 | + if (is_a($tableObject, 'CubridTableWithHint')) |
|
| 843 | 843 | { |
| 844 | - $index_hint_list .= $tableObject->getIndexHintString() . ', '; |
|
| 844 | + $index_hint_list .= $tableObject->getIndexHintString().', '; |
|
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | $index_hint_list = substr($index_hint_list, 0, -2); |
| 848 | - if($index_hint_list != '') |
|
| 848 | + if ($index_hint_list != '') |
|
| 849 | 849 | { |
| 850 | - $index_hint_list = 'USING INDEX ' . $index_hint_list; |
|
| 850 | + $index_hint_list = 'USING INDEX '.$index_hint_list; |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | $groupBy = $query->getGroupByString(); |
| 854 | - if($groupBy != '') |
|
| 854 | + if ($groupBy != '') |
|
| 855 | 855 | { |
| 856 | - $groupBy = ' GROUP BY ' . $groupBy; |
|
| 856 | + $groupBy = ' GROUP BY '.$groupBy; |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | $orderBy = $query->getOrderByString(); |
| 860 | - if($orderBy != '') |
|
| 860 | + if ($orderBy != '') |
|
| 861 | 861 | { |
| 862 | - $orderBy = ' ORDER BY ' . $orderBy; |
|
| 862 | + $orderBy = ' ORDER BY '.$orderBy; |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | $limit = $query->getLimitString(); |
| 866 | - if($limit != '') |
|
| 866 | + if ($limit != '') |
|
| 867 | 867 | { |
| 868 | - $limit = ' LIMIT ' . $limit; |
|
| 868 | + $limit = ' LIMIT '.$limit; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
| 871 | + return $select.' '.$from.' '.$where.' '.$index_hint_list.' '.$groupBy.' '.$orderBy.' '.$limit; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | /** |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | { |
| 887 | 887 | $new_update_columns = array(); |
| 888 | 888 | $click_count_columns = $queryObject->getClickCountColumns(); |
| 889 | - foreach($click_count_columns as $click_count_column) |
|
| 889 | + foreach ($click_count_columns as $click_count_column) |
|
| 890 | 890 | { |
| 891 | 891 | $click_count_column_name = $click_count_column->column_name; |
| 892 | 892 | |
@@ -918,16 +918,16 @@ discard block |
||
| 918 | 918 | $sql .= $tables[0]->getAlias(); |
| 919 | 919 | |
| 920 | 920 | $from = $query->getFromString($with_values); |
| 921 | - if($from == '') |
|
| 921 | + if ($from == '') |
|
| 922 | 922 | { |
| 923 | 923 | return new BaseObject(-1, "Invalid query"); |
| 924 | 924 | } |
| 925 | - $sql .= ' FROM ' . $from; |
|
| 925 | + $sql .= ' FROM '.$from; |
|
| 926 | 926 | |
| 927 | 927 | $where = $query->getWhereString($with_values); |
| 928 | - if($where != '') |
|
| 928 | + if ($where != '') |
|
| 929 | 929 | { |
| 930 | - $sql .= ' WHERE ' . $where; |
|
| 930 | + $sql .= ' WHERE '.$where; |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | return $sql; |
@@ -943,26 +943,26 @@ discard block |
||
| 943 | 943 | function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE) |
| 944 | 944 | { |
| 945 | 945 | $columnsList = $query->getUpdateString($with_values); |
| 946 | - if($columnsList == '') |
|
| 946 | + if ($columnsList == '') |
|
| 947 | 947 | { |
| 948 | 948 | return new BaseObject(-1, "Invalid query"); |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | $tables = $query->getFromString($with_values); |
| 952 | - if($tables == '') |
|
| 952 | + if ($tables == '') |
|
| 953 | 953 | { |
| 954 | 954 | return new BaseObject(-1, "Invalid query"); |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | $where = $query->getWhereString($with_values); |
| 958 | - if($where != '') |
|
| 958 | + if ($where != '') |
|
| 959 | 959 | { |
| 960 | - $where = ' WHERE ' . $where; |
|
| 960 | + $where = ' WHERE '.$where; |
|
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | $priority = $with_priority ? $query->getPriority() : ''; |
| 964 | 964 | |
| 965 | - return "UPDATE $priority $tables SET $columnsList " . $where; |
|
| 965 | + return "UPDATE $priority $tables SET $columnsList ".$where; |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | /** |
@@ -1000,27 +1000,27 @@ discard block |
||
| 1000 | 1000 | */ |
| 1001 | 1001 | function _getConnection($type = 'master', $indx = NULL) |
| 1002 | 1002 | { |
| 1003 | - if($type == 'master') |
|
| 1003 | + if ($type == 'master') |
|
| 1004 | 1004 | { |
| 1005 | - if(!$this->master_db['is_connected']) |
|
| 1005 | + if (!$this->master_db['is_connected']) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | $this->_connect($type); |
| 1008 | 1008 | } |
| 1009 | - $this->connection = 'Master ' . $this->master_db['db_hostname']; |
|
| 1009 | + $this->connection = 'Master '.$this->master_db['db_hostname']; |
|
| 1010 | 1010 | return $this->master_db["resource"]; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | - if($indx === NULL) |
|
| 1013 | + if ($indx === NULL) |
|
| 1014 | 1014 | { |
| 1015 | 1015 | $indx = $this->_getSlaveConnectionStringIndex($type); |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | - if(!$this->slave_db[$indx]['is_connected']) |
|
| 1018 | + if (!$this->slave_db[$indx]['is_connected']) |
|
| 1019 | 1019 | { |
| 1020 | 1020 | $this->_connect($type, $indx); |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | - $this->connection = 'Slave ' . $this->slave_db[$indx]['db_hostname']; |
|
| 1023 | + $this->connection = 'Slave '.$this->slave_db[$indx]['db_hostname']; |
|
| 1024 | 1024 | return $this->slave_db[$indx]["resource"]; |
| 1025 | 1025 | } |
| 1026 | 1026 | |
@@ -1030,11 +1030,11 @@ discard block |
||
| 1030 | 1030 | */ |
| 1031 | 1031 | function _dbInfoExists() |
| 1032 | 1032 | { |
| 1033 | - if(!$this->master_db) |
|
| 1033 | + if (!$this->master_db) |
|
| 1034 | 1034 | { |
| 1035 | 1035 | return FALSE; |
| 1036 | 1036 | } |
| 1037 | - if(count($this->slave_db) === 0) |
|
| 1037 | + if (count($this->slave_db) === 0) |
|
| 1038 | 1038 | { |
| 1039 | 1039 | return FALSE; |
| 1040 | 1040 | } |
@@ -1060,12 +1060,12 @@ discard block |
||
| 1060 | 1060 | */ |
| 1061 | 1061 | function close($type = 'master', $indx = 0) |
| 1062 | 1062 | { |
| 1063 | - if(!$this->isConnected($type, $indx)) |
|
| 1063 | + if (!$this->isConnected($type, $indx)) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | return; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | - if($type == 'master') |
|
| 1068 | + if ($type == 'master') |
|
| 1069 | 1069 | { |
| 1070 | 1070 | $connection = &$this->master_db; |
| 1071 | 1071 | } |
@@ -1096,12 +1096,12 @@ discard block |
||
| 1096 | 1096 | */ |
| 1097 | 1097 | function begin() |
| 1098 | 1098 | { |
| 1099 | - if(!$this->isConnected()) |
|
| 1099 | + if (!$this->isConnected()) |
|
| 1100 | 1100 | { |
| 1101 | 1101 | return; |
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | - if($this->_begin($this->transactionNestedLevel)) |
|
| 1104 | + if ($this->_begin($this->transactionNestedLevel)) |
|
| 1105 | 1105 | { |
| 1106 | 1106 | $this->transaction_started = TRUE; |
| 1107 | 1107 | $this->transactionNestedLevel++; |
@@ -1124,15 +1124,15 @@ discard block |
||
| 1124 | 1124 | */ |
| 1125 | 1125 | function rollback() |
| 1126 | 1126 | { |
| 1127 | - if(!$this->isConnected() || !$this->transaction_started) |
|
| 1127 | + if (!$this->isConnected() || !$this->transaction_started) |
|
| 1128 | 1128 | { |
| 1129 | 1129 | return; |
| 1130 | 1130 | } |
| 1131 | - if($this->_rollback($this->transactionNestedLevel)) |
|
| 1131 | + if ($this->_rollback($this->transactionNestedLevel)) |
|
| 1132 | 1132 | { |
| 1133 | 1133 | $this->transactionNestedLevel--; |
| 1134 | 1134 | |
| 1135 | - if(!$this->transactionNestedLevel) |
|
| 1135 | + if (!$this->transactionNestedLevel) |
|
| 1136 | 1136 | { |
| 1137 | 1137 | $this->transaction_started = FALSE; |
| 1138 | 1138 | } |
@@ -1156,11 +1156,11 @@ discard block |
||
| 1156 | 1156 | */ |
| 1157 | 1157 | function commit($force = FALSE) |
| 1158 | 1158 | { |
| 1159 | - if(!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
| 1159 | + if (!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
| 1160 | 1160 | { |
| 1161 | 1161 | return; |
| 1162 | 1162 | } |
| 1163 | - if($this->transactionNestedLevel == 1 && $this->_commit()) |
|
| 1163 | + if ($this->transactionNestedLevel == 1 && $this->_commit()) |
|
| 1164 | 1164 | { |
| 1165 | 1165 | $this->transaction_started = FALSE; |
| 1166 | 1166 | $this->transactionNestedLevel = 0; |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | */ |
| 1193 | 1193 | function _query($query, $connection = NULL) |
| 1194 | 1194 | { |
| 1195 | - if($connection == NULL) |
|
| 1195 | + if ($connection == NULL) |
|
| 1196 | 1196 | { |
| 1197 | 1197 | $connection = $this->_getConnection('master'); |
| 1198 | 1198 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | { |
| 1218 | 1218 | $db_info = Context::getDBInfo(); |
| 1219 | 1219 | $this->master_db = $db_info->master_db; |
| 1220 | - if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
| 1220 | + if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
| 1221 | 1221 | && $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"] |
| 1222 | 1222 | && $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"] |
| 1223 | 1223 | && $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"] |
@@ -1265,18 +1265,18 @@ discard block |
||
| 1265 | 1265 | */ |
| 1266 | 1266 | function _connect($type = 'master', $indx = 0) |
| 1267 | 1267 | { |
| 1268 | - if($this->isConnected($type, $indx)) |
|
| 1268 | + if ($this->isConnected($type, $indx)) |
|
| 1269 | 1269 | { |
| 1270 | 1270 | return; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | // Ignore if no DB information exists |
| 1274 | - if(!$this->_dbInfoExists()) |
|
| 1274 | + if (!$this->_dbInfoExists()) |
|
| 1275 | 1275 | { |
| 1276 | 1276 | return; |
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | - if($type == 'master') |
|
| 1279 | + if ($type == 'master') |
|
| 1280 | 1280 | { |
| 1281 | 1281 | $connection = &$this->master_db; |
| 1282 | 1282 | } |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | $result = $this->__connect($connection); |
| 1289 | - if($result === NULL || $result === FALSE) |
|
| 1289 | + if ($result === NULL || $result === FALSE) |
|
| 1290 | 1290 | { |
| 1291 | 1291 | $connection["is_connected"] = FALSE; |
| 1292 | 1292 | return; |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | $connection["is_connected"] = TRUE; |
| 1298 | 1298 | |
| 1299 | 1299 | // Save connection info for db logs |
| 1300 | - $this->connection = ucfirst($type) . ' ' . $connection["db_hostname"]; |
|
| 1300 | + $this->connection = ucfirst($type).' '.$connection["db_hostname"]; |
|
| 1301 | 1301 | |
| 1302 | 1302 | // regist $this->close callback |
| 1303 | 1303 | register_shutdown_function(array($this, "close")); |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | */ |
| 1323 | 1323 | function actDBClassFinish() |
| 1324 | 1324 | { |
| 1325 | - if(!$this->query) |
|
| 1325 | + if (!$this->query) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | return; |
| 1328 | 1328 | } |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | function getParser($force = FALSE) |
| 1346 | 1346 | { |
| 1347 | 1347 | static $dbParser = NULL; |
| 1348 | - if(!$dbParser || $force) |
|
| 1348 | + if (!$dbParser || $force) |
|
| 1349 | 1349 | { |
| 1350 | 1350 | $oDB = DB::getInstance(); |
| 1351 | 1351 | $dbParser = $oDB->getParser(); |
@@ -318,8 +318,7 @@ discard block |
||
| 318 | 318 | if(!isset($this->priority_dbms[$a->db_type])) |
| 319 | 319 | { |
| 320 | 320 | $priority_a = 0; |
| 321 | - } |
|
| 322 | - else |
|
| 321 | + } else |
|
| 323 | 322 | { |
| 324 | 323 | $priority_a = $this->priority_dbms[$a->db_type]; |
| 325 | 324 | } |
@@ -327,8 +326,7 @@ discard block |
||
| 327 | 326 | if(!isset($this->priority_dbms[$b->db_type])) |
| 328 | 327 | { |
| 329 | 328 | $priority_b = 0; |
| 330 | - } |
|
| 331 | - else |
|
| 329 | + } else |
|
| 332 | 330 | { |
| 333 | 331 | $priority_b = $this->priority_dbms[$b->db_type]; |
| 334 | 332 | } |
@@ -362,8 +360,7 @@ discard block |
||
| 362 | 360 | if($type == 'master') |
| 363 | 361 | { |
| 364 | 362 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
| 365 | - } |
|
| 366 | - else |
|
| 363 | + } else |
|
| 367 | 364 | { |
| 368 | 365 | return $this->slave_db[$indx]["is_connected"] ? TRUE : FALSE; |
| 369 | 366 | } |
@@ -441,8 +438,7 @@ discard block |
||
| 441 | 438 | $buff[] = print_r($log, TRUE); |
| 442 | 439 | @file_put_contents($debug_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
| 443 | 440 | } |
| 444 | - } |
|
| 445 | - else |
|
| 441 | + } else |
|
| 446 | 442 | { |
| 447 | 443 | $log['result'] = 'Success'; |
| 448 | 444 | } |
@@ -531,8 +527,7 @@ discard block |
||
| 531 | 527 | $target = 'modules'; |
| 532 | 528 | $module = $id_args[0]; |
| 533 | 529 | $id = $id_args[1]; |
| 534 | - } |
|
| 535 | - elseif(count($id_args) == 3) |
|
| 530 | + } elseif(count($id_args) == 3) |
|
| 536 | 531 | { |
| 537 | 532 | $target = $id_args[0]; |
| 538 | 533 | $typeList = array('addons' => 1, 'widgets' => 1); |
@@ -606,7 +601,9 @@ discard block |
||
| 606 | 601 | { |
| 607 | 602 | global $lang; |
| 608 | 603 | |
| 609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
| 604 | + if(!in_array($type, array('master','slave'))) { |
|
| 605 | + $type = 'slave'; |
|
| 606 | + } |
|
| 610 | 607 | |
| 611 | 608 | if(!file_exists($cache_file)) |
| 612 | 609 | { |
@@ -652,8 +649,7 @@ discard block |
||
| 652 | 649 | if($this->isError()) |
| 653 | 650 | { |
| 654 | 651 | $output = $this->getError(); |
| 655 | - } |
|
| 656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 652 | + } else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 657 | 653 | { |
| 658 | 654 | $output = new BaseObject(); |
| 659 | 655 | } |
@@ -1068,8 +1064,7 @@ discard block |
||
| 1068 | 1064 | if($type == 'master') |
| 1069 | 1065 | { |
| 1070 | 1066 | $connection = &$this->master_db; |
| 1071 | - } |
|
| 1072 | - else |
|
| 1067 | + } else |
|
| 1073 | 1068 | { |
| 1074 | 1069 | $connection = &$this->slave_db[$indx]; |
| 1075 | 1070 | } |
@@ -1164,8 +1159,7 @@ discard block |
||
| 1164 | 1159 | { |
| 1165 | 1160 | $this->transaction_started = FALSE; |
| 1166 | 1161 | $this->transactionNestedLevel = 0; |
| 1167 | - } |
|
| 1168 | - else |
|
| 1162 | + } else |
|
| 1169 | 1163 | { |
| 1170 | 1164 | $this->transactionNestedLevel--; |
| 1171 | 1165 | } |
@@ -1225,8 +1219,7 @@ discard block |
||
| 1225 | 1219 | ) |
| 1226 | 1220 | { |
| 1227 | 1221 | $this->slave_db[0] = &$this->master_db; |
| 1228 | - } |
|
| 1229 | - else |
|
| 1222 | + } else |
|
| 1230 | 1223 | { |
| 1231 | 1224 | $this->slave_db = $db_info->slave_db; |
| 1232 | 1225 | } |
@@ -1279,8 +1272,7 @@ discard block |
||
| 1279 | 1272 | if($type == 'master') |
| 1280 | 1273 | { |
| 1281 | 1274 | $connection = &$this->master_db; |
| 1282 | - } |
|
| 1283 | - else |
|
| 1275 | + } else |
|
| 1284 | 1276 | { |
| 1285 | 1277 | $connection = &$this->slave_db[$indx]; |
| 1286 | 1278 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | // forbit access if the user is not an administrator |
| 21 | 21 | $oMemberModel = getModel('member'); |
| 22 | 22 | $logged_info = $oMemberModel->getLoggedInfo(); |
| 23 | - if($logged_info->is_admin != 'Y') |
|
| 23 | + if ($logged_info->is_admin != 'Y') |
|
| 24 | 24 | { |
| 25 | 25 | return $this->stop("msg_is_not_administrator"); |
| 26 | 26 | } |
@@ -33,20 +33,20 @@ discard block |
||
| 33 | 33 | function procAdminMenuReset() |
| 34 | 34 | { |
| 35 | 35 | $menuSrl = Context::get('menu_srl'); |
| 36 | - if(!$menuSrl) |
|
| 36 | + if (!$menuSrl) |
|
| 37 | 37 | { |
| 38 | 38 | return $this->stop('msg_invalid_request'); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $oMenuAdminController = getAdminController('menu'); |
| 42 | 42 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 43 | - if($oCacheHandler->isSupport()) |
|
| 43 | + if ($oCacheHandler->isSupport()) |
|
| 44 | 44 | { |
| 45 | - $cache_key = 'admin_menu_langs:' . Context::getLangType(); |
|
| 45 | + $cache_key = 'admin_menu_langs:'.Context::getLangType(); |
|
| 46 | 46 | $oCacheHandler->delete($cache_key); |
| 47 | 47 | } |
| 48 | 48 | $output = $oMenuAdminController->deleteMenu($menuSrl); |
| 49 | - if(!$output->toBool()) |
|
| 49 | + if (!$output->toBool()) |
|
| 50 | 50 | { |
| 51 | 51 | return $output; |
| 52 | 52 | } |
@@ -63,30 +63,30 @@ discard block |
||
| 63 | 63 | function procAdminRecompileCacheFile() |
| 64 | 64 | { |
| 65 | 65 | // rename cache dir |
| 66 | - $temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME']; |
|
| 66 | + $temp_cache_dir = './files/cache_'.$_SERVER['REQUEST_TIME']; |
|
| 67 | 67 | FileHandler::rename('./files/cache', $temp_cache_dir); |
| 68 | 68 | FileHandler::makeDir('./files/cache'); |
| 69 | 69 | |
| 70 | 70 | // remove module extend cache |
| 71 | - FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php'); |
|
| 71 | + FileHandler::removeFile(_XE_PATH_.'files/config/module_extend.php'); |
|
| 72 | 72 | |
| 73 | 73 | // remove debug files |
| 74 | - FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php'); |
|
| 75 | - FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php'); |
|
| 76 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_query.php'); |
|
| 77 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_trigger.php'); |
|
| 78 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_addon.php'); |
|
| 79 | - FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_widget.php'); |
|
| 74 | + FileHandler::removeFile(_XE_PATH_.'files/_debug_message.php'); |
|
| 75 | + FileHandler::removeFile(_XE_PATH_.'files/_debug_db_query.php'); |
|
| 76 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_query.php'); |
|
| 77 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_trigger.php'); |
|
| 78 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_addon.php'); |
|
| 79 | + FileHandler::removeFile(_XE_PATH_.'files/_slowlog_widget.php'); |
|
| 80 | 80 | |
| 81 | 81 | $oModuleModel = getModel('module'); |
| 82 | 82 | $module_list = $oModuleModel->getModuleList(); |
| 83 | 83 | |
| 84 | 84 | // call recompileCache for each module |
| 85 | - foreach($module_list as $module) |
|
| 85 | + foreach ($module_list as $module) |
|
| 86 | 86 | { |
| 87 | 87 | $oModule = NULL; |
| 88 | 88 | $oModule = getClass($module->module); |
| 89 | - if(method_exists($oModule, 'recompileCache')) |
|
| 89 | + if (method_exists($oModule, 'recompileCache')) |
|
| 90 | 90 | { |
| 91 | 91 | $oModule->recompileCache(); |
| 92 | 92 | } |
@@ -97,37 +97,37 @@ discard block |
||
| 97 | 97 | $oObjectCacheHandler = CacheHandler::getInstance('object'); |
| 98 | 98 | $oTemplateCacheHandler = CacheHandler::getInstance('template'); |
| 99 | 99 | |
| 100 | - if($oObjectCacheHandler->isSupport()) |
|
| 100 | + if ($oObjectCacheHandler->isSupport()) |
|
| 101 | 101 | { |
| 102 | 102 | $truncated[] = $oObjectCacheHandler->truncate(); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if($oTemplateCacheHandler->isSupport()) |
|
| 105 | + if ($oTemplateCacheHandler->isSupport()) |
|
| 106 | 106 | { |
| 107 | 107 | $truncated[] = $oTemplateCacheHandler->truncate(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if(count($truncated) && in_array(FALSE, $truncated)) |
|
| 110 | + if (count($truncated) && in_array(FALSE, $truncated)) |
|
| 111 | 111 | { |
| 112 | 112 | return new BaseObject(-1, 'msg_self_restart_cache_engine'); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // remove cache dir |
| 116 | 116 | $tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/'); |
| 117 | - if($tmp_cache_list) |
|
| 117 | + if ($tmp_cache_list) |
|
| 118 | 118 | { |
| 119 | - foreach($tmp_cache_list as $tmp_dir) |
|
| 119 | + foreach ($tmp_cache_list as $tmp_dir) |
|
| 120 | 120 | { |
| 121 | - if($tmp_dir) |
|
| 121 | + if ($tmp_dir) |
|
| 122 | 122 | { |
| 123 | - FileHandler::removeDir('./files/' . $tmp_dir); |
|
| 123 | + FileHandler::removeDir('./files/'.$tmp_dir); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // remove duplicate indexes (only for CUBRID) |
| 129 | 129 | $db_type = Context::getDBType(); |
| 130 | - if($db_type == 'cubrid') |
|
| 130 | + if ($db_type == 'cubrid') |
|
| 131 | 131 | { |
| 132 | 132 | $db = DB::getInstance(); |
| 133 | 133 | $db->deleteDuplicateIndexes(); |
@@ -149,13 +149,13 @@ discard block |
||
| 149 | 149 | $oMemberController = getController('member'); |
| 150 | 150 | $oMemberController->procMemberLogout(); |
| 151 | 151 | |
| 152 | - header('Location: ' . getNotEncodedUrl('', 'module', 'admin')); |
|
| 152 | + header('Location: '.getNotEncodedUrl('', 'module', 'admin')); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | public function procAdminInsertDefaultDesignInfo() |
| 156 | 156 | { |
| 157 | 157 | $vars = Context::getRequestVars(); |
| 158 | - if(!$vars->site_srl) |
|
| 158 | + if (!$vars->site_srl) |
|
| 159 | 159 | { |
| 160 | 160 | $vars->site_srl = 0; |
| 161 | 161 | } |
@@ -167,27 +167,27 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | public function updateDefaultDesignInfo($vars) |
| 169 | 169 | { |
| 170 | - $siteDesignPath = _XE_PATH_ . 'files/site_design/'; |
|
| 170 | + $siteDesignPath = _XE_PATH_.'files/site_design/'; |
|
| 171 | 171 | |
| 172 | 172 | $vars->module_skin = json_decode($vars->module_skin); |
| 173 | 173 | |
| 174 | - if(!is_dir($siteDesignPath)) |
|
| 174 | + if (!is_dir($siteDesignPath)) |
|
| 175 | 175 | { |
| 176 | 176 | FileHandler::makeDir($siteDesignPath); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $vars->site_srl . '.php'; |
|
| 179 | + $siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php'; |
|
| 180 | 180 | |
| 181 | 181 | $layoutTarget = 'layout_srl'; |
| 182 | 182 | $skinTarget = 'skin'; |
| 183 | 183 | |
| 184 | - if($vars->target_type == 'M') |
|
| 184 | + if ($vars->target_type == 'M') |
|
| 185 | 185 | { |
| 186 | 186 | $layoutTarget = 'mlayout_srl'; |
| 187 | 187 | $skinTarget = 'mskin'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if(is_readable($siteDesignFile)) |
|
| 190 | + if (is_readable($siteDesignFile)) |
|
| 191 | 191 | { |
| 192 | 192 | include($siteDesignFile); |
| 193 | 193 | } |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $designInfo->{$layoutTarget} = $layoutSrl; |
| 202 | 202 | |
| 203 | - foreach($vars->module_skin as $moduleName => $skinName) |
|
| 203 | + foreach ($vars->module_skin as $moduleName => $skinName) |
|
| 204 | 204 | { |
| 205 | - if($moduleName == 'ARTICLE') |
|
| 205 | + if ($moduleName == 'ARTICLE') |
|
| 206 | 206 | { |
| 207 | 207 | $moduleName = 'page'; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass(); |
|
| 210 | + if (!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass(); |
|
| 211 | 211 | $designInfo->module->{$moduleName}->{$skinTarget} = $skinName; |
| 212 | 212 | } |
| 213 | 213 | |
@@ -222,28 +222,28 @@ discard block |
||
| 222 | 222 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
| 223 | 223 | $buff[] = '$designInfo = new stdClass;'; |
| 224 | 224 | |
| 225 | - if($designInfo->layout_srl) |
|
| 225 | + if ($designInfo->layout_srl) |
|
| 226 | 226 | { |
| 227 | 227 | $buff[] = sprintf('$designInfo->layout_srl = %s; ', $designInfo->layout_srl); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - if($designInfo->mlayout_srl) |
|
| 230 | + if ($designInfo->mlayout_srl) |
|
| 231 | 231 | { |
| 232 | 232 | $buff[] = sprintf('$designInfo->mlayout_srl = %s;', $designInfo->mlayout_srl); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $buff[] = '$designInfo->module = new stdClass;'; |
| 236 | 236 | |
| 237 | - foreach($designInfo->module as $moduleName => $skinInfo) |
|
| 237 | + foreach ($designInfo->module as $moduleName => $skinInfo) |
|
| 238 | 238 | { |
| 239 | 239 | $buff[] = sprintf('$designInfo->module->%s = new stdClass;', $moduleName); |
| 240 | - foreach($skinInfo as $target => $skinName) |
|
| 240 | + foreach ($skinInfo as $target => $skinName) |
|
| 241 | 241 | { |
| 242 | 242 | $buff[] = sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName); |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $site_srl . '.php'; |
|
| 246 | + $siteDesignFile = _XE_PATH_.'files/site_design/design_'.$site_srl.'.php'; |
|
| 247 | 247 | FileHandler::writeFile($siteDesignFile, implode(PHP_EOL, $buff)); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | // check favorite exists |
| 260 | 260 | $oModel = getAdminModel('admin'); |
| 261 | 261 | $output = $oModel->isExistsFavorite($siteSrl, $moduleName); |
| 262 | - if(!$output->toBool()) |
|
| 262 | + if (!$output->toBool()) |
|
| 263 | 263 | { |
| 264 | 264 | return $output; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // if exists, delete favorite |
| 268 | - if($output->get('result')) |
|
| 268 | + if ($output->get('result')) |
|
| 269 | 269 | { |
| 270 | 270 | $favoriteSrl = $output->get('favoriteSrl'); |
| 271 | 271 | $output = $this->_deleteFavorite($favoriteSrl); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $result = 'on'; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if(!$output->toBool()) |
|
| 281 | + if (!$output->toBool()) |
|
| 282 | 282 | { |
| 283 | 283 | return $output; |
| 284 | 284 | } |
@@ -296,31 +296,31 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $oModel = getAdminModel('admin'); |
| 298 | 298 | $output = $oModel->getFavoriteList(); |
| 299 | - if(!$output->toBool()) |
|
| 299 | + if (!$output->toBool()) |
|
| 300 | 300 | { |
| 301 | 301 | return $output; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | $favoriteList = $output->get('favoriteList'); |
| 305 | - if(!$favoriteList) |
|
| 305 | + if (!$favoriteList) |
|
| 306 | 306 | { |
| 307 | 307 | return new BaseObject(); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | $deleteTargets = array(); |
| 311 | - foreach($favoriteList as $favorite) |
|
| 311 | + foreach ($favoriteList as $favorite) |
|
| 312 | 312 | { |
| 313 | - if($favorite->type == 'module') |
|
| 313 | + if ($favorite->type == 'module') |
|
| 314 | 314 | { |
| 315 | - $modulePath = _XE_PATH_ . 'modules/' . $favorite->module; |
|
| 316 | - if(!is_dir($modulePath)) |
|
| 315 | + $modulePath = _XE_PATH_.'modules/'.$favorite->module; |
|
| 316 | + if (!is_dir($modulePath)) |
|
| 317 | 317 | { |
| 318 | 318 | $deleteTargets[] = $favorite->admin_favorite_srl; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if(!count($deleteTargets)) |
|
| 323 | + if (!count($deleteTargets)) |
|
| 324 | 324 | { |
| 325 | 325 | return new BaseObject(); |
| 326 | 326 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $args = new stdClass(); |
| 329 | 329 | $args->admin_favorite_srls = $deleteTargets; |
| 330 | 330 | $output = executeQuery('admin.deleteFavorites', $args); |
| 331 | - if(!$output->toBool()) |
|
| 331 | + if (!$output->toBool()) |
|
| 332 | 332 | { |
| 333 | 333 | return $output; |
| 334 | 334 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | function procAdminEnviromentGatheringAgreement() |
| 344 | 344 | { |
| 345 | 345 | $isAgree = Context::get('is_agree'); |
| 346 | - if($isAgree == 'true') |
|
| 346 | + if ($isAgree == 'true') |
|
| 347 | 347 | { |
| 348 | 348 | $_SESSION['enviroment_gather'] = 'Y'; |
| 349 | 349 | } |
@@ -368,23 +368,23 @@ discard block |
||
| 368 | 368 | $oModuleModel = getModel('module'); |
| 369 | 369 | $oAdminConfig = $oModuleModel->getModuleConfig('admin'); |
| 370 | 370 | |
| 371 | - if(!is_object($oAdminConfig)) |
|
| 371 | + if (!is_object($oAdminConfig)) |
|
| 372 | 372 | { |
| 373 | 373 | $oAdminConfig = new stdClass(); |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - if($file['tmp_name']) |
|
| 376 | + if ($file['tmp_name']) |
|
| 377 | 377 | { |
| 378 | 378 | $target_path = 'files/attach/images/admin/'; |
| 379 | 379 | FileHandler::makeDir($target_path); |
| 380 | 380 | |
| 381 | 381 | // Get file information |
| 382 | 382 | list($width, $height, $type, $attrs) = @getimagesize($file['tmp_name']); |
| 383 | - if($type == 3) |
|
| 383 | + if ($type == 3) |
|
| 384 | 384 | { |
| 385 | 385 | $ext = 'png'; |
| 386 | 386 | } |
| 387 | - elseif($type == 2) |
|
| 387 | + elseif ($type == 2) |
|
| 388 | 388 | { |
| 389 | 389 | $ext = 'jpg'; |
| 390 | 390 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | $oAdminConfig->adminLogo = $target_filename; |
| 400 | 400 | } |
| 401 | - if($adminTitle) |
|
| 401 | + if ($adminTitle) |
|
| 402 | 402 | { |
| 403 | 403 | $oAdminConfig->adminTitle = strip_tags($adminTitle); |
| 404 | 404 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | unset($oAdminConfig->adminTitle); |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - if($oAdminConfig) |
|
| 410 | + if ($oAdminConfig) |
|
| 411 | 411 | { |
| 412 | 412 | $oModuleController = getController('module'); |
| 413 | 413 | $oModuleController->insertModuleConfig('admin', $oAdminConfig); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $oModuleModel = getModel('module'); |
| 429 | 429 | $oAdminConfig = $oModuleModel->getModuleConfig('admin'); |
| 430 | 430 | |
| 431 | - FileHandler::removeFile(_XE_PATH_ . $oAdminConfig->adminLogo); |
|
| 431 | + FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo); |
|
| 432 | 432 | unset($oAdminConfig->adminLogo); |
| 433 | 433 | |
| 434 | 434 | $oModuleController = getController('module'); |
@@ -487,16 +487,16 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | $site_info = Context::get('site_module_info'); |
| 489 | 489 | $virtual_site = ''; |
| 490 | - if($site_info->site_srl) |
|
| 490 | + if ($site_info->site_srl) |
|
| 491 | 491 | { |
| 492 | - $virtual_site = $site_info->site_srl . '/'; |
|
| 492 | + $virtual_site = $site_info->site_srl.'/'; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | $iconname = Context::get('iconname'); |
| 496 | - $file_exist = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
| 497 | - if($file_exist) |
|
| 496 | + $file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname); |
|
| 497 | + if ($file_exist) |
|
| 498 | 498 | { |
| 499 | - @FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
| 499 | + @FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname); |
|
| 500 | 500 | } |
| 501 | 501 | else |
| 502 | 502 | { |
@@ -517,33 +517,33 @@ discard block |
||
| 517 | 517 | $db_info->sitelock_message = $vars->sitelock_message; |
| 518 | 518 | |
| 519 | 519 | $whitelist = $vars->sitelock_whitelist; |
| 520 | - $whitelist = preg_replace("/[\r|\n|\r\n]+/",",",$whitelist); |
|
| 521 | - $whitelist = preg_replace("/\s+/","",$whitelist); |
|
| 522 | - if(preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist)) |
|
| 520 | + $whitelist = preg_replace("/[\r|\n|\r\n]+/", ",", $whitelist); |
|
| 521 | + $whitelist = preg_replace("/\s+/", "", $whitelist); |
|
| 522 | + if (preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist)) |
|
| 523 | 523 | { |
| 524 | 524 | $whitelist = ''; |
| 525 | 525 | } |
| 526 | - $whitelist .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR']; |
|
| 527 | - $whitelist = explode(',',trim($whitelist, ',')); |
|
| 526 | + $whitelist .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR']; |
|
| 527 | + $whitelist = explode(',', trim($whitelist, ',')); |
|
| 528 | 528 | $whitelist = array_unique($whitelist); |
| 529 | 529 | |
| 530 | - if(!IpFilter::validate($whitelist)) { |
|
| 530 | + if (!IpFilter::validate($whitelist)) { |
|
| 531 | 531 | return new BaseObject(-1, 'msg_invalid_ip'); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | $db_info->sitelock_whitelist = $whitelist; |
| 535 | 535 | |
| 536 | 536 | $oInstallController = getController('install'); |
| 537 | - if(!$oInstallController->makeConfigFile()) |
|
| 537 | + if (!$oInstallController->makeConfigFile()) |
|
| 538 | 538 | { |
| 539 | 539 | return new BaseObject(-1, 'msg_invalid_request'); |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) |
|
| 542 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 543 | 543 | { |
| 544 | 544 | $returnUrl = Context::get('success_return_url'); |
| 545 | - if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
| 546 | - header('location:' . $returnUrl); |
|
| 545 | + if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
| 546 | + header('location:'.$returnUrl); |
|
| 547 | 547 | return; |
| 548 | 548 | } |
| 549 | 549 | } |
@@ -574,20 +574,20 @@ discard block |
||
| 574 | 574 | $db_info->embed_white_iframe = $white_iframe; |
| 575 | 575 | |
| 576 | 576 | $oInstallController = getController('install'); |
| 577 | - if(!$oInstallController->makeConfigFile()) |
|
| 577 | + if (!$oInstallController->makeConfigFile()) |
|
| 578 | 578 | { |
| 579 | 579 | return new BaseObject(-1, 'msg_invalid_request'); |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
| 582 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
| 583 | 583 | $oEmbedFilter = EmbedFilter::getInstance(); |
| 584 | 584 | $oEmbedFilter->_makeWhiteDomainList($whitelist); |
| 585 | 585 | |
| 586 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON'))) |
|
| 586 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 587 | 587 | { |
| 588 | 588 | $returnUrl = Context::get('success_return_url'); |
| 589 | - if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
| 590 | - header('location:' . $returnUrl); |
|
| 589 | + if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral'); |
|
| 590 | + header('location:'.$returnUrl); |
|
| 591 | 591 | return; |
| 592 | 592 | } |
| 593 | 593 | } |
@@ -24,31 +24,31 @@ discard block |
||
| 24 | 24 | // if(Context::getRequestMethod() == "GET") return new BaseObject(-1, "msg_invalid_request"); |
| 25 | 25 | // Extract the necessary information in advance |
| 26 | 26 | $logged_info = Context::get('logged_info'); |
| 27 | - if($logged_info->is_admin != 'Y' || !checkCSRF()) |
|
| 27 | + if ($logged_info->is_admin != 'Y' || !checkCSRF()) |
|
| 28 | 28 | { |
| 29 | 29 | return new BaseObject(-1, 'msg_invalid_request'); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $args = Context::gets('member_srl','email_address','find_account_answer', 'allow_mailing','allow_message','denied','is_admin','description','group_srl_list','limit_date'); |
|
| 33 | - $oMemberModel = &getModel ('member'); |
|
| 34 | - $config = $oMemberModel->getMemberConfig (); |
|
| 32 | + $args = Context::gets('member_srl', 'email_address', 'find_account_answer', 'allow_mailing', 'allow_message', 'denied', 'is_admin', 'description', 'group_srl_list', 'limit_date'); |
|
| 33 | + $oMemberModel = &getModel('member'); |
|
| 34 | + $config = $oMemberModel->getMemberConfig(); |
|
| 35 | 35 | $getVars = array(); |
| 36 | - if($config->signupForm) |
|
| 36 | + if ($config->signupForm) |
|
| 37 | 37 | { |
| 38 | - foreach($config->signupForm as $formInfo) |
|
| 38 | + foreach ($config->signupForm as $formInfo) |
|
| 39 | 39 | { |
| 40 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 40 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 41 | 41 | { |
| 42 | 42 | $getVars[] = $formInfo->name; |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - foreach($getVars as $val) |
|
| 46 | + foreach ($getVars as $val) |
|
| 47 | 47 | { |
| 48 | 48 | $args->{$val} = Context::get($val); |
| 49 | 49 | } |
| 50 | 50 | $args->member_srl = Context::get('member_srl'); |
| 51 | - if(Context::get('reset_password')) |
|
| 51 | + if (Context::get('reset_password')) |
|
| 52 | 52 | $args->password = Context::get('reset_password'); |
| 53 | 53 | else unset($args->password); |
| 54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | unset($all_args->error_return_url); |
| 61 | 61 | unset($all_args->success_return_url); |
| 62 | 62 | unset($all_args->ruleset); |
| 63 | - if(!isset($args->limit_date)) $args->limit_date = ""; |
|
| 63 | + if (!isset($args->limit_date)) $args->limit_date = ""; |
|
| 64 | 64 | unset($all_args->password); |
| 65 | 65 | unset($all_args->password2); |
| 66 | 66 | unset($all_args->reset_password); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $extra_vars = delObjectVars($all_args, $args); |
| 69 | 69 | $args->extra_vars = serialize($extra_vars); |
| 70 | 70 | // Check if an original member exists having the member_srl |
| 71 | - if($args->member_srl) |
|
| 71 | + if ($args->member_srl) |
|
| 72 | 72 | { |
| 73 | 73 | // Create a member model object |
| 74 | 74 | $oMemberModel = getModel('member'); |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | $columnList = array('member_srl'); |
| 77 | 77 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl, 0, $columnList); |
| 78 | 78 | // If no original member exists, make a new one |
| 79 | - if($member_info->member_srl != $args->member_srl) unset($args->member_srl); |
|
| 79 | + if ($member_info->member_srl != $args->member_srl) unset($args->member_srl); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // remove whitespace |
| 83 | 83 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
| 84 | - foreach($checkInfos as $val) |
|
| 84 | + foreach ($checkInfos as $val) |
|
| 85 | 85 | { |
| 86 | - if(isset($args->{$val})) |
|
| 86 | + if (isset($args->{$val})) |
|
| 87 | 87 | { |
| 88 | 88 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', html_entity_decode($args->{$val})); |
| 89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $oMemberController = getController('member'); |
| 93 | 93 | // Execute insert or update depending on the value of member_srl |
| 94 | - if(!$args->member_srl) |
|
| 94 | + if (!$args->member_srl) |
|
| 95 | 95 | { |
| 96 | 96 | $args->password = Context::get('password'); |
| 97 | 97 | $output = $oMemberController->insertMember($args); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $msg_code = 'success_updated'; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if(!$output->toBool()) return $output; |
|
| 106 | + if (!$output->toBool()) return $output; |
|
| 107 | 107 | // Save Signature |
| 108 | 108 | $signature = Context::get('signature'); |
| 109 | 109 | $oMemberController->putSignature($args->member_srl, $signature); |
@@ -112,24 +112,24 @@ discard block |
||
| 112 | 112 | $this->setMessage($msg_code); |
| 113 | 113 | |
| 114 | 114 | $profile_image = $_FILES['profile_image']; |
| 115 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 115 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 116 | 116 | { |
| 117 | 117 | $output = $oMemberController->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 118 | - if(!$output->toBool()) return $output; |
|
| 118 | + if (!$output->toBool()) return $output; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | $image_mark = $_FILES['image_mark']; |
| 122 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 122 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 123 | 123 | { |
| 124 | 124 | $output = $oMemberController->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 125 | - if(!$output->toBool()) return $output; |
|
| 125 | + if (!$output->toBool()) return $output; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $image_name = $_FILES['image_name']; |
| 129 | 129 | if (is_uploaded_file($image_name['tmp_name'])) |
| 130 | 130 | { |
| 131 | 131 | $output = $oMemberController->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 132 | - if(!$output->toBool()) return $output; |
|
| 132 | + if (!$output->toBool()) return $output; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminList'); |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $oMemberController = getController('member'); |
| 149 | 149 | $output = $oMemberController->deleteMember($member_srl); |
| 150 | - if(!$output->toBool()) return $output; |
|
| 150 | + if (!$output->toBool()) return $output; |
|
| 151 | 151 | |
| 152 | - $this->add('page',Context::get('page')); |
|
| 152 | + $this->add('page', Context::get('page')); |
|
| 153 | 153 | $this->setMessage("success_deleted"); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -168,26 +168,26 @@ discard block |
||
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | 170 | $oPassword = new Password(); |
| 171 | - if(!array_key_exists($args->password_hashing_algorithm, $oPassword->getSupportedAlgorithms())) |
|
| 171 | + if (!array_key_exists($args->password_hashing_algorithm, $oPassword->getSupportedAlgorithms())) |
|
| 172 | 172 | { |
| 173 | 173 | $args->password_hashing_algorithm = 'md5'; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | $args->password_hashing_work_factor = intval($args->password_hashing_work_factor, 10); |
| 177 | - if($args->password_hashing_work_factor < 4) |
|
| 177 | + if ($args->password_hashing_work_factor < 4) |
|
| 178 | 178 | { |
| 179 | 179 | $args->password_hashing_work_factor = 4; |
| 180 | 180 | } |
| 181 | - if($args->password_hashing_work_factor > 16) |
|
| 181 | + if ($args->password_hashing_work_factor > 16) |
|
| 182 | 182 | { |
| 183 | 183 | $args->password_hashing_work_factor = 16; |
| 184 | 184 | } |
| 185 | - if($args->password_hashing_auto_upgrade != 'Y') |
|
| 185 | + if ($args->password_hashing_auto_upgrade != 'Y') |
|
| 186 | 186 | { |
| 187 | 187 | $args->password_hashing_auto_upgrade = 'N'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if((!$args->webmaster_name || !$args->webmaster_email) && $args->enable_confirm == 'Y') |
|
| 190 | + if ((!$args->webmaster_name || !$args->webmaster_email) && $args->enable_confirm == 'Y') |
|
| 191 | 191 | { |
| 192 | 192 | return new BaseObject(-1, 'msg_mail_authorization'); |
| 193 | 193 | } |
@@ -222,20 +222,20 @@ discard block |
||
| 222 | 222 | $usable_list = Context::get('usable_list'); |
| 223 | 223 | $all_args = Context::getRequestVars(); |
| 224 | 224 | |
| 225 | - $args->limit_day = (int)$args->limit_day; |
|
| 226 | - if(!trim(strip_tags($args->agreement))) |
|
| 225 | + $args->limit_day = (int) $args->limit_day; |
|
| 226 | + if (!trim(strip_tags($args->agreement))) |
|
| 227 | 227 | { |
| 228 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
| 228 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt'; |
|
| 229 | 229 | FileHandler::removeFile($agreement_file); |
| 230 | 230 | $args->agreement = NULL; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if($args->redirect_url) |
|
| 233 | + if ($args->redirect_url) |
|
| 234 | 234 | { |
| 235 | 235 | $oModuleModel = getModel('module'); |
| 236 | 236 | $redirectModuleInfo = $oModuleModel->getModuleInfoByModuleSrl($args->redirect_url, array('mid')); |
| 237 | 237 | |
| 238 | - if(!$redirectModuleInfo) |
|
| 238 | + if (!$redirectModuleInfo) |
|
| 239 | 239 | { |
| 240 | 240 | return new BaseObject('-1', 'msg_exist_selected_module'); |
| 241 | 241 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $mustRequireds = array('email_address', 'nick_name', 'password', 'find_account_question'); |
| 275 | 275 | $extendItems = $oMemberModel->getJoinFormList(); |
| 276 | 276 | |
| 277 | - foreach($list_order as $key) |
|
| 277 | + foreach ($list_order as $key) |
|
| 278 | 278 | { |
| 279 | 279 | $signupItem = new stdClass(); |
| 280 | 280 | $signupItem->isIdentifier = ($key == $all_args->identifier); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $signupItem->isUse = in_array($key, $usable_list) || $signupItem->required; |
| 288 | 288 | $signupItem->isPublic = ($all_args->{'is_'.$key.'_public'} == 'Y' && $signupItem->isUse) ? 'Y' : 'N'; |
| 289 | 289 | |
| 290 | - if($signupItem->imageType) |
|
| 290 | + if ($signupItem->imageType) |
|
| 291 | 291 | { |
| 292 | 292 | $signupItem->max_width = $all_args->{$key.'_max_width'}; |
| 293 | 293 | $signupItem->max_height = $all_args->{$key.'_max_height'}; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // set extends form |
| 299 | - if(!$signupItem->isDefaultForm) |
|
| 299 | + if (!$signupItem->isDefaultForm) |
|
| 300 | 300 | { |
| 301 | 301 | $extendItem = $extendItems[$all_args->{$key.'_member_join_form_srl'}]; |
| 302 | 302 | $signupItem->type = $extendItem->column_type; |
@@ -305,13 +305,13 @@ discard block |
||
| 305 | 305 | $signupItem->description = $extendItem->description; |
| 306 | 306 | |
| 307 | 307 | // check usable value change, required/option |
| 308 | - if($signupItem->isUse != ($extendItem->is_active == 'Y') || $signupItem->required != ($extendItem->required == 'Y')) |
|
| 308 | + if ($signupItem->isUse != ($extendItem->is_active == 'Y') || $signupItem->required != ($extendItem->required == 'Y')) |
|
| 309 | 309 | { |
| 310 | 310 | unset($update_args); |
| 311 | 311 | $update_args = new stdClass; |
| 312 | 312 | $update_args->member_join_form_srl = $extendItem->member_join_form_srl; |
| 313 | - $update_args->is_active = $signupItem->isUse?'Y':'N'; |
|
| 314 | - $update_args->required = $signupItem->required?'Y':'N'; |
|
| 313 | + $update_args->is_active = $signupItem->isUse ? 'Y' : 'N'; |
|
| 314 | + $update_args->required = $signupItem->required ? 'Y' : 'N'; |
|
| 315 | 315 | |
| 316 | 316 | $update_output = executeQuery('member.updateJoinForm', $update_args); |
| 317 | 317 | } |
@@ -328,9 +328,9 @@ discard block |
||
| 328 | 328 | $this->_createFindAccountByQuestion($args->identifier); |
| 329 | 329 | |
| 330 | 330 | // check agreement value exist |
| 331 | - if($args->agreement) |
|
| 331 | + if ($args->agreement) |
|
| 332 | 332 | { |
| 333 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
| 333 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt'; |
|
| 334 | 334 | $output = FileHandler::writeFile($agreement_file, $args->agreement); |
| 335 | 335 | |
| 336 | 336 | unset($args->agreement); |
@@ -358,16 +358,16 @@ discard block |
||
| 358 | 358 | 'after_logout_url' |
| 359 | 359 | ); |
| 360 | 360 | |
| 361 | - if(!$args->change_password_date) |
|
| 361 | + if (!$args->change_password_date) |
|
| 362 | 362 | { |
| 363 | 363 | $args->change_password_date = 0; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if(!trim(strip_tags($args->after_login_url))) |
|
| 366 | + if (!trim(strip_tags($args->after_login_url))) |
|
| 367 | 367 | { |
| 368 | 368 | $args->after_login_url = NULL; |
| 369 | 369 | } |
| 370 | - if(!trim(strip_tags($args->after_logout_url))) |
|
| 370 | + if (!trim(strip_tags($args->after_logout_url))) |
|
| 371 | 371 | { |
| 372 | 372 | $args->after_logout_url = NULL; |
| 373 | 373 | } |
@@ -394,17 +394,17 @@ discard block |
||
| 394 | 394 | ); |
| 395 | 395 | |
| 396 | 396 | $args->layout_srl = $args->layout_srl ? $args->layout_srl : NULL; |
| 397 | - if(!$args->skin) |
|
| 397 | + if (!$args->skin) |
|
| 398 | 398 | { |
| 399 | 399 | $args->skin = 'default'; |
| 400 | 400 | } |
| 401 | - if(!$args->colorset) |
|
| 401 | + if (!$args->colorset) |
|
| 402 | 402 | { |
| 403 | 403 | $args->colorset = 'white'; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | $args->mlayout_srl = $args->mlayout_srl ? $args->mlayout_srl : NULL; |
| 407 | - if(!$args->mskin) |
|
| 407 | + if (!$args->mskin) |
|
| 408 | 408 | { |
| 409 | 409 | $args->mskin = 'default'; |
| 410 | 410 | } |
@@ -427,12 +427,12 @@ discard block |
||
| 427 | 427 | $extendItems = $oMemberModel->getJoinFormList(); |
| 428 | 428 | |
| 429 | 429 | $items = array('user_id', 'password', 'user_name', 'nick_name', 'email_address', 'find_account_question', 'homepage', 'blog', 'birthday', 'signature', 'profile_image', 'image_name', 'image_mark'); |
| 430 | - $mustRequireds = array('email_address', 'nick_name','password', 'find_account_question'); |
|
| 430 | + $mustRequireds = array('email_address', 'nick_name', 'password', 'find_account_question'); |
|
| 431 | 431 | $orgRequireds = array('email_address', 'password', 'find_account_question', 'user_id', 'nick_name', 'user_name'); |
| 432 | 432 | $orgUse = array('email_address', 'password', 'find_account_question', 'user_id', 'nick_name', 'user_name', 'homepage', 'blog', 'birthday'); |
| 433 | 433 | $list_order = array(); |
| 434 | 434 | |
| 435 | - foreach($items as $key) |
|
| 435 | + foreach ($items as $key) |
|
| 436 | 436 | { |
| 437 | 437 | unset($signupItem); |
| 438 | 438 | $signupItem = new stdClass; |
@@ -444,23 +444,23 @@ discard block |
||
| 444 | 444 | $signupItem->required = in_array($key, $orgRequireds); |
| 445 | 445 | $signupItem->isUse = ($config->{$key} == 'Y') || in_array($key, $orgUse); |
| 446 | 446 | $signupItem->isPublic = ($signupItem->isUse) ? 'Y' : 'N'; |
| 447 | - if(in_array($key, array('find_account_question', 'password', 'email_address'))) |
|
| 447 | + if (in_array($key, array('find_account_question', 'password', 'email_address'))) |
|
| 448 | 448 | { |
| 449 | 449 | $signupItem->isPublic = 'N'; |
| 450 | 450 | } |
| 451 | 451 | $signupItem->isIdentifier = ($key == $identifier); |
| 452 | - if ($signupItem->imageType){ |
|
| 452 | + if ($signupItem->imageType) { |
|
| 453 | 453 | $signupItem->max_width = $config->{$key.'_max_width'}; |
| 454 | 454 | $signupItem->max_height = $config->{$key.'_max_height'}; |
| 455 | 455 | } |
| 456 | - if($signupItem->isIdentifier) |
|
| 456 | + if ($signupItem->isIdentifier) |
|
| 457 | 457 | array_unshift($list_order, $signupItem); |
| 458 | 458 | else |
| 459 | 459 | $list_order[] = $signupItem; |
| 460 | 460 | } |
| 461 | - if(is_array($extendItems)) |
|
| 461 | + if (is_array($extendItems)) |
|
| 462 | 462 | { |
| 463 | - foreach($extendItems as $form_srl=>$item_info) |
|
| 463 | + foreach ($extendItems as $form_srl=>$item_info) |
|
| 464 | 464 | { |
| 465 | 465 | unset($signupItem); |
| 466 | 466 | $signupItem = new stdClass; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $signupItem->isUse = ($item_info->is_active == 'Y'); |
| 474 | 474 | $signupItem->isPublic = ($signupItem->isUse) ? 'Y' : 'N'; |
| 475 | 475 | $signupItem->description = $item_info->description; |
| 476 | - if($signupItem->imageType) |
|
| 476 | + if ($signupItem->imageType) |
|
| 477 | 477 | { |
| 478 | 478 | $signupItem->max_width = $config->{$key.'_max_width'}; |
| 479 | 479 | $signupItem->max_height = $config->{$key.'_max_height'}; |
@@ -491,13 +491,13 @@ discard block |
||
| 491 | 491 | * @param string $agreement |
| 492 | 492 | * @return void |
| 493 | 493 | */ |
| 494 | - function _createSignupRuleset($signupForm, $agreement = null){ |
|
| 494 | + function _createSignupRuleset($signupForm, $agreement = null) { |
|
| 495 | 495 | $xml_file = './files/ruleset/insertMember.xml'; |
| 496 | - $buff = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL. |
|
| 497 | - '<ruleset version="1.5.0">' . PHP_EOL. |
|
| 498 | - '<customrules>' . PHP_EOL. |
|
| 499 | - '</customrules>' . PHP_EOL. |
|
| 500 | - '<fields>' . PHP_EOL . '%s' . PHP_EOL . '</fields>' . PHP_EOL. |
|
| 496 | + $buff = '<?xml version="1.0" encoding="utf-8"?>'.PHP_EOL. |
|
| 497 | + '<ruleset version="1.5.0">'.PHP_EOL. |
|
| 498 | + '<customrules>'.PHP_EOL. |
|
| 499 | + '</customrules>'.PHP_EOL. |
|
| 500 | + '<fields>'.PHP_EOL.'%s'.PHP_EOL.'</fields>'.PHP_EOL. |
|
| 501 | 501 | '</ruleset>'; |
| 502 | 502 | |
| 503 | 503 | $fields = array(); |
@@ -506,41 +506,41 @@ discard block |
||
| 506 | 506 | { |
| 507 | 507 | $fields[] = '<field name="accept_agreement"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /></field>'; |
| 508 | 508 | } |
| 509 | - foreach($signupForm as $formInfo) |
|
| 509 | + foreach ($signupForm as $formInfo) |
|
| 510 | 510 | { |
| 511 | - if($formInfo->required || $formInfo->mustRequired) |
|
| 511 | + if ($formInfo->required || $formInfo->mustRequired) |
|
| 512 | 512 | { |
| 513 | - if($formInfo->type == 'tel' || $formInfo->type == 'kr_zip') |
|
| 513 | + if ($formInfo->type == 'tel' || $formInfo->type == 'kr_zip') |
|
| 514 | 514 | { |
| 515 | 515 | $fields[] = sprintf('<field name="%s[]" required="true" />', $formInfo->name); |
| 516 | 516 | } |
| 517 | - else if($formInfo->name == 'password') |
|
| 517 | + else if ($formInfo->name == 'password') |
|
| 518 | 518 | { |
| 519 | 519 | $fields[] = '<field name="password"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /><if test="$act == \'procMemberInsert\'" attr="length" value="4:60" /></field>'; |
| 520 | 520 | $fields[] = '<field name="password2"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /><if test="$act == \'procMemberInsert\'" attr="equalto" value="password" /></field>'; |
| 521 | 521 | } |
| 522 | - else if($formInfo->name == 'find_account_question') |
|
| 522 | + else if ($formInfo->name == 'find_account_question') |
|
| 523 | 523 | { |
| 524 | 524 | $fields[] = '<field name="find_account_question"><if test="$modify_find_account_answer" attr="required" value="true" /></field>'; |
| 525 | 525 | $fields[] = '<field name="find_account_answer" length=":250"><if test="$modify_find_account_answer" attr="required" value="true" /></field>'; |
| 526 | 526 | } |
| 527 | - else if($formInfo->name == 'email_address') |
|
| 527 | + else if ($formInfo->name == 'email_address') |
|
| 528 | 528 | { |
| 529 | 529 | $fields[] = sprintf('<field name="%s" required="true" rule="email"/>', $formInfo->name); |
| 530 | 530 | } |
| 531 | - else if($formInfo->name == 'user_id') |
|
| 531 | + else if ($formInfo->name == 'user_id') |
|
| 532 | 532 | { |
| 533 | 533 | $fields[] = sprintf('<field name="%s" required="true" rule="userid" length="3:20" />', $formInfo->name); |
| 534 | 534 | } |
| 535 | - else if($formInfo->name == 'nick_name') |
|
| 535 | + else if ($formInfo->name == 'nick_name') |
|
| 536 | 536 | { |
| 537 | 537 | $fields[] = sprintf('<field name="%s" required="true" length="2:20" />', $formInfo->name); |
| 538 | 538 | } |
| 539 | - else if(strpos($formInfo->name, 'image') !== false) |
|
| 539 | + else if (strpos($formInfo->name, 'image') !== false) |
|
| 540 | 540 | { |
| 541 | 541 | $fields[] = sprintf('<field name="%s"><if test="$act != \'procMemberAdminInsert\' && $__%s_exist != \'true\'" attr="required" value="true" /></field>', $formInfo->name, $formInfo->name); |
| 542 | 542 | } |
| 543 | - else if($formInfo->name == 'signature') |
|
| 543 | + else if ($formInfo->name == 'signature') |
|
| 544 | 544 | { |
| 545 | 545 | $fields[] = '<field name="signature"><if test="$member_srl" attr="required" value="true" /></field>'; |
| 546 | 546 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | FileHandler::writeFile($xml_file, $xml_buff); |
| 556 | 556 | unset($xml_buff); |
| 557 | 557 | |
| 558 | - $validator = new Validator($xml_file); |
|
| 558 | + $validator = new Validator($xml_file); |
|
| 559 | 559 | $validator->setCacheDir('files/cache'); |
| 560 | 560 | $validator->getJsPath(); |
| 561 | 561 | } |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $xml_buff = sprintf($buff, implode('', $fields)); |
| 584 | 584 | Filehandler::writeFile($xml_file, $xml_buff); |
| 585 | 585 | |
| 586 | - $validator = new Validator($xml_file); |
|
| 586 | + $validator = new Validator($xml_file); |
|
| 587 | 587 | $validator->setCacheDir('files/cache'); |
| 588 | 588 | $validator->getJsPath(); |
| 589 | 589 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | '</ruleset>'; |
| 605 | 605 | |
| 606 | 606 | $fields = array(); |
| 607 | - if($identifier == 'user_id') |
|
| 607 | + if ($identifier == 'user_id') |
|
| 608 | 608 | $fields[] = '<field name="user_id" required="true" rule="userid" />'; |
| 609 | 609 | |
| 610 | 610 | $fields[] = '<field name="email_address" required="true" rule="email" />'; |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | $xml_buff = sprintf($buff, implode('', $fields)); |
| 615 | 615 | Filehandler::writeFile($xml_file, $xml_buff); |
| 616 | 616 | |
| 617 | - $validator = new Validator($xml_file); |
|
| 617 | + $validator = new Validator($xml_file); |
|
| 618 | 618 | $validator->setCacheDir('files/cache'); |
| 619 | 619 | $validator->getJsPath(); |
| 620 | 620 | } |
@@ -625,12 +625,12 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | function procMemberAdminInsertGroup() |
| 627 | 627 | { |
| 628 | - $args = Context::gets('title','description','is_default','image_mark'); |
|
| 628 | + $args = Context::gets('title', 'description', 'is_default', 'image_mark'); |
|
| 629 | 629 | $output = $this->insertGroup($args); |
| 630 | - if(!$output->toBool()) return $output; |
|
| 630 | + if (!$output->toBool()) return $output; |
|
| 631 | 631 | |
| 632 | - $this->add('group_srl',''); |
|
| 633 | - $this->add('page',Context::get('page')); |
|
| 632 | + $this->add('group_srl', ''); |
|
| 633 | + $this->add('page', Context::get('page')); |
|
| 634 | 634 | $this->setMessage('success_registed'); |
| 635 | 635 | |
| 636 | 636 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); |
@@ -645,13 +645,13 @@ discard block |
||
| 645 | 645 | { |
| 646 | 646 | $group_srl = Context::get('group_srl'); |
| 647 | 647 | |
| 648 | - $args = Context::gets('group_srl','title','description','is_default','image_mark'); |
|
| 648 | + $args = Context::gets('group_srl', 'title', 'description', 'is_default', 'image_mark'); |
|
| 649 | 649 | $args->site_srl = 0; |
| 650 | 650 | $output = $this->updateGroup($args); |
| 651 | - if(!$output->toBool()) return $output; |
|
| 651 | + if (!$output->toBool()) return $output; |
|
| 652 | 652 | |
| 653 | - $this->add('group_srl',''); |
|
| 654 | - $this->add('page',Context::get('page')); |
|
| 653 | + $this->add('group_srl', ''); |
|
| 654 | + $this->add('page', Context::get('page')); |
|
| 655 | 655 | $this->setMessage('success_updated'); |
| 656 | 656 | |
| 657 | 657 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); |
@@ -667,10 +667,10 @@ discard block |
||
| 667 | 667 | $group_srl = Context::get('group_srl'); |
| 668 | 668 | |
| 669 | 669 | $output = $this->deleteGroup($group_srl); |
| 670 | - if(!$output->toBool()) return $output; |
|
| 670 | + if (!$output->toBool()) return $output; |
|
| 671 | 671 | |
| 672 | - $this->add('group_srl',''); |
|
| 673 | - $this->add('page',Context::get('page')); |
|
| 672 | + $this->add('group_srl', ''); |
|
| 673 | + $this->add('page', Context::get('page')); |
|
| 674 | 674 | $this->setMessage('success_deleted'); |
| 675 | 675 | |
| 676 | 676 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); |
@@ -692,10 +692,10 @@ discard block |
||
| 692 | 692 | $args->default_value = explode("\n", str_replace("\r", '', Context::get('default_value'))); |
| 693 | 693 | $args->required = Context::get('required'); |
| 694 | 694 | $args->is_active = (isset($args->required)); |
| 695 | - if(!in_array(strtoupper($args->required), array('Y','N')))$args->required = 'N'; |
|
| 695 | + if (!in_array(strtoupper($args->required), array('Y', 'N')))$args->required = 'N'; |
|
| 696 | 696 | $args->description = Context::get('description') ? Context::get('description') : ''; |
| 697 | 697 | // Default values |
| 698 | - if(in_array($args->column_type, array('checkbox','select','radio')) && count($args->default_value)) |
|
| 698 | + if (in_array($args->column_type, array('checkbox', 'select', 'radio')) && count($args->default_value)) |
|
| 699 | 699 | { |
| 700 | 700 | $args->default_value = serialize($args->default_value); |
| 701 | 701 | } |
@@ -707,17 +707,17 @@ discard block |
||
| 707 | 707 | // Check ID duplicated |
| 708 | 708 | $oMemberModel = getModel('member'); |
| 709 | 709 | $config = $oMemberModel->getMemberConfig(); |
| 710 | - foreach($config->signupForm as $item) |
|
| 710 | + foreach ($config->signupForm as $item) |
|
| 711 | 711 | { |
| 712 | - if($item->name == $args->column_name) |
|
| 712 | + if ($item->name == $args->column_name) |
|
| 713 | 713 | { |
| 714 | - if($args->member_join_form_srl && $args->member_join_form_srl == $item->member_join_form_srl) continue; |
|
| 715 | - return new BaseObject(-1,'msg_exists_user_id'); |
|
| 714 | + if ($args->member_join_form_srl && $args->member_join_form_srl == $item->member_join_form_srl) continue; |
|
| 715 | + return new BaseObject(-1, 'msg_exists_user_id'); |
|
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | // Fix if member_join_form_srl exists. Add if not exists. |
| 719 | 719 | $isInsert; |
| 720 | - if(!$args->member_join_form_srl) |
|
| 720 | + if (!$args->member_join_form_srl) |
|
| 721 | 721 | { |
| 722 | 722 | $isInsert = true; |
| 723 | 723 | $args->list_order = $args->member_join_form_srl = getNextSequence(); |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $output = executeQuery('member.updateJoinForm', $args); |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - if(!$output->toBool()) return $output; |
|
| 731 | + if (!$output->toBool()) return $output; |
|
| 732 | 732 | |
| 733 | 733 | // memberConfig update |
| 734 | 734 | $signupItem = new stdClass(); |
@@ -745,15 +745,15 @@ discard block |
||
| 745 | 745 | $config = $oMemberModel->getMemberConfig(); |
| 746 | 746 | unset($config->agreement); |
| 747 | 747 | |
| 748 | - if($isInsert) |
|
| 748 | + if ($isInsert) |
|
| 749 | 749 | { |
| 750 | 750 | $config->signupForm[] = $signupItem; |
| 751 | 751 | } |
| 752 | 752 | else |
| 753 | 753 | { |
| 754 | - foreach($config->signupForm as $key=>$val) |
|
| 754 | + foreach ($config->signupForm as $key=>$val) |
|
| 755 | 755 | { |
| 756 | - if($val->member_join_form_srl == $signupItem->member_join_form_srl) |
|
| 756 | + if ($val->member_join_form_srl == $signupItem->member_join_form_srl) |
|
| 757 | 757 | { |
| 758 | 758 | $config->signupForm[$key] = $signupItem; |
| 759 | 759 | } |
@@ -781,9 +781,9 @@ discard block |
||
| 781 | 781 | $config = $oMemberModel->getMemberConfig(); |
| 782 | 782 | unset($config->agreement); |
| 783 | 783 | |
| 784 | - foreach($config->signupForm as $key=>$val) |
|
| 784 | + foreach ($config->signupForm as $key=>$val) |
|
| 785 | 785 | { |
| 786 | - if($val->member_join_form_srl == $member_join_form_srl) |
|
| 786 | + if ($val->member_join_form_srl == $member_join_form_srl) |
|
| 787 | 787 | { |
| 788 | 788 | unset($config->signupForm[$key]); |
| 789 | 789 | break; |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $member_join_form_srl = Context::get('member_join_form_srl'); |
| 804 | 804 | $mode = Context::get('mode'); |
| 805 | 805 | |
| 806 | - switch($mode) |
|
| 806 | + switch ($mode) |
|
| 807 | 807 | { |
| 808 | 808 | case 'up' : |
| 809 | 809 | $output = $this->moveJoinFormUp($member_join_form_srl); |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | case 'update' : |
| 821 | 821 | break; |
| 822 | 822 | } |
| 823 | - if(!$output->toBool()) return $output; |
|
| 823 | + if (!$output->toBool()) return $output; |
|
| 824 | 824 | |
| 825 | 825 | $this->setMessage($msg_code); |
| 826 | 826 | } |
@@ -839,40 +839,40 @@ discard block |
||
| 839 | 839 | $oDB->begin(); |
| 840 | 840 | |
| 841 | 841 | $oMemberController = getController('member'); |
| 842 | - foreach($members as $key=>$member_srl) |
|
| 842 | + foreach ($members as $key=>$member_srl) |
|
| 843 | 843 | { |
| 844 | 844 | $args = new stdClass(); |
| 845 | 845 | $args->member_srl = $member_srl; |
| 846 | - switch($var->type) |
|
| 846 | + switch ($var->type) |
|
| 847 | 847 | { |
| 848 | 848 | case 'modify': |
| 849 | 849 | { |
| 850 | - if(count($groups) > 0) |
|
| 850 | + if (count($groups) > 0) |
|
| 851 | 851 | { |
| 852 | 852 | $args->site_srl = 0; |
| 853 | 853 | // One of its members to delete all the group |
| 854 | 854 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 855 | - if(!$output->toBool()) |
|
| 855 | + if (!$output->toBool()) |
|
| 856 | 856 | { |
| 857 | 857 | $oDB->rollback(); |
| 858 | 858 | return $output; |
| 859 | 859 | } |
| 860 | 860 | // Enter one of the loop a |
| 861 | - foreach($groups as $group_srl) |
|
| 861 | + foreach ($groups as $group_srl) |
|
| 862 | 862 | { |
| 863 | - $output = $oMemberController->addMemberToGroup($args->member_srl,$group_srl); |
|
| 864 | - if(!$output->toBool()) |
|
| 863 | + $output = $oMemberController->addMemberToGroup($args->member_srl, $group_srl); |
|
| 864 | + if (!$output->toBool()) |
|
| 865 | 865 | { |
| 866 | 866 | $oDB->rollback(); |
| 867 | 867 | return $output; |
| 868 | 868 | } |
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | - if($var->denied) |
|
| 871 | + if ($var->denied) |
|
| 872 | 872 | { |
| 873 | 873 | $args->denied = $var->denied; |
| 874 | 874 | $output = executeQuery('member.updateMemberDeniedInfo', $args); |
| 875 | - if(!$output->toBool()) |
|
| 875 | + if (!$output->toBool()) |
|
| 876 | 876 | { |
| 877 | 877 | $oDB->rollback(); |
| 878 | 878 | return $output; |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | { |
| 886 | 886 | $oMemberController->memberInfo = null; |
| 887 | 887 | $output = $oMemberController->deleteMember($member_srl); |
| 888 | - if(!$output->toBool()) |
|
| 888 | + if (!$output->toBool()) |
|
| 889 | 889 | { |
| 890 | 890 | $oDB->rollback(); |
| 891 | 891 | return $output; |
@@ -898,15 +898,15 @@ discard block |
||
| 898 | 898 | |
| 899 | 899 | $message = $var->message; |
| 900 | 900 | // Send a message |
| 901 | - if($message) |
|
| 901 | + if ($message) |
|
| 902 | 902 | { |
| 903 | 903 | $oCommunicationController = getController('communication'); |
| 904 | 904 | |
| 905 | 905 | $logged_info = Context::get('logged_info'); |
| 906 | - $title = cut_str($message,10,'...'); |
|
| 906 | + $title = cut_str($message, 10, '...'); |
|
| 907 | 907 | $sender_member_srl = $logged_info->member_srl; |
| 908 | 908 | |
| 909 | - foreach($members as $member_srl) |
|
| 909 | + foreach ($members as $member_srl) |
|
| 910 | 910 | { |
| 911 | 911 | $oCommunicationController->sendMessage($sender_member_srl, $member_srl, $title, $message, false); |
| 912 | 912 | } |
@@ -923,14 +923,14 @@ discard block |
||
| 923 | 923 | function procMemberAdminDeleteMembers() |
| 924 | 924 | { |
| 925 | 925 | $target_member_srls = Context::get('target_member_srls'); |
| 926 | - if(!$target_member_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 926 | + if (!$target_member_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 927 | 927 | $member_srls = explode(',', $target_member_srls); |
| 928 | 928 | $oMemberController = getController('member'); |
| 929 | 929 | |
| 930 | - foreach($member_srls as $member) |
|
| 930 | + foreach ($member_srls as $member) |
|
| 931 | 931 | { |
| 932 | 932 | $output = $oMemberController->deleteMember($member); |
| 933 | - if(!$output->toBool()) |
|
| 933 | + if (!$output->toBool()) |
|
| 934 | 934 | { |
| 935 | 935 | $this->setMessage('failed_deleted'); |
| 936 | 936 | return $output; |
@@ -947,11 +947,11 @@ discard block |
||
| 947 | 947 | function procMemberAdminUpdateMembersGroup() |
| 948 | 948 | { |
| 949 | 949 | $member_srl = Context::get('member_srl'); |
| 950 | - if(!$member_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 951 | - $member_srls = explode(',',$member_srl); |
|
| 950 | + if (!$member_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 951 | + $member_srls = explode(',', $member_srl); |
|
| 952 | 952 | |
| 953 | 953 | $group_srl = Context::get('group_srls'); |
| 954 | - if(!is_array($group_srl)) $group_srls = explode('|@|', $group_srl); |
|
| 954 | + if (!is_array($group_srl)) $group_srls = explode('|@|', $group_srl); |
|
| 955 | 955 | else $group_srls = $group_srl; |
| 956 | 956 | |
| 957 | 957 | $oDB = &DB::getInstance(); |
@@ -960,7 +960,7 @@ discard block |
||
| 960 | 960 | $args = new stdClass; |
| 961 | 961 | $args->member_srl = $member_srl; |
| 962 | 962 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 963 | - if(!$output->toBool()) |
|
| 963 | + if (!$output->toBool()) |
|
| 964 | 964 | { |
| 965 | 965 | $oDB->rollback(); |
| 966 | 966 | return $output; |
@@ -968,21 +968,21 @@ discard block |
||
| 968 | 968 | // Add to a selected group |
| 969 | 969 | $group_count = count($group_srls); |
| 970 | 970 | $member_count = count($member_srls); |
| 971 | - for($j=0;$j<$group_count;$j++) |
|
| 971 | + for ($j = 0; $j < $group_count; $j++) |
|
| 972 | 972 | { |
| 973 | - $group_srl = (int)trim($group_srls[$j]); |
|
| 974 | - if(!$group_srl) continue; |
|
| 975 | - for($i=0;$i<$member_count;$i++) |
|
| 973 | + $group_srl = (int) trim($group_srls[$j]); |
|
| 974 | + if (!$group_srl) continue; |
|
| 975 | + for ($i = 0; $i < $member_count; $i++) |
|
| 976 | 976 | { |
| 977 | - $member_srl = (int)trim($member_srls[$i]); |
|
| 978 | - if(!$member_srl) continue; |
|
| 977 | + $member_srl = (int) trim($member_srls[$i]); |
|
| 978 | + if (!$member_srl) continue; |
|
| 979 | 979 | |
| 980 | 980 | $args = new stdClass; |
| 981 | 981 | $args->member_srl = $member_srl; |
| 982 | 982 | $args->group_srl = $group_srl; |
| 983 | 983 | |
| 984 | 984 | $output = executeQuery('member.addMemberToGroup', $args); |
| 985 | - if(!$output->toBool()) |
|
| 985 | + if (!$output->toBool()) |
|
| 986 | 986 | { |
| 987 | 987 | $oDB->rollback(); |
| 988 | 988 | return $output; |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | |
| 996 | 996 | $this->setMessage('success_updated'); |
| 997 | 997 | |
| 998 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 998 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 999 | 999 | { |
| 1000 | 1000 | global $lang; |
| 1001 | 1001 | htmlHeader(); |
@@ -1016,19 +1016,19 @@ discard block |
||
| 1016 | 1016 | { |
| 1017 | 1017 | $user_ids = Context::get('user_id'); |
| 1018 | 1018 | |
| 1019 | - $user_ids = explode(',',$user_ids); |
|
| 1019 | + $user_ids = explode(',', $user_ids); |
|
| 1020 | 1020 | $success_ids = array(); |
| 1021 | 1021 | |
| 1022 | - foreach($user_ids as $val) |
|
| 1022 | + foreach ($user_ids as $val) |
|
| 1023 | 1023 | { |
| 1024 | 1024 | $val = trim($val); |
| 1025 | - if(!$val) continue; |
|
| 1025 | + if (!$val) continue; |
|
| 1026 | 1026 | |
| 1027 | 1027 | $output = $this->insertDeniedID($val, ''); |
| 1028 | - if($output->toBool()) $success_ids[] = $val; |
|
| 1028 | + if ($output->toBool()) $success_ids[] = $val; |
|
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | - $this->add('user_ids', implode(',',$success_ids)); |
|
| 1031 | + $this->add('user_ids', implode(',', $success_ids)); |
|
| 1032 | 1032 | |
| 1033 | 1033 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminDeniedIDList'); |
| 1034 | 1034 | $this->setRedirectUrl($returnUrl); |
@@ -1045,10 +1045,10 @@ discard block |
||
| 1045 | 1045 | $mode = Context::get('mode'); |
| 1046 | 1046 | $mode = $mode ? $mode : 'insert'; |
| 1047 | 1047 | |
| 1048 | - if($mode == 'delete') |
|
| 1048 | + if ($mode == 'delete') |
|
| 1049 | 1049 | { |
| 1050 | 1050 | $output = $this->deleteDeniedNickName($nick_name); |
| 1051 | - if(!$output->toBool()) |
|
| 1051 | + if (!$output->toBool()) |
|
| 1052 | 1052 | { |
| 1053 | 1053 | return $output; |
| 1054 | 1054 | } |
@@ -1057,19 +1057,19 @@ discard block |
||
| 1057 | 1057 | } |
| 1058 | 1058 | else |
| 1059 | 1059 | { |
| 1060 | - $nick_names = explode(',',$nick_name); |
|
| 1060 | + $nick_names = explode(',', $nick_name); |
|
| 1061 | 1061 | $success_nick_names = array(); |
| 1062 | 1062 | |
| 1063 | - foreach($nick_names as $val) |
|
| 1063 | + foreach ($nick_names as $val) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | $val = trim($val); |
| 1066 | - if(!$val) continue; |
|
| 1066 | + if (!$val) continue; |
|
| 1067 | 1067 | |
| 1068 | 1068 | $output = $this->insertDeniedNickName($val, ''); |
| 1069 | - if($output->toBool()) $success_nick_names[] = $val; |
|
| 1069 | + if ($output->toBool()) $success_nick_names[] = $val; |
|
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | - $this->add('nick_names', implode(',',$success_nick_names)); |
|
| 1072 | + $this->add('nick_names', implode(',', $success_nick_names)); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | } |
| 1075 | 1075 | |
@@ -1082,16 +1082,16 @@ discard block |
||
| 1082 | 1082 | $user_id = Context::get('user_id'); |
| 1083 | 1083 | $mode = Context::get('mode'); |
| 1084 | 1084 | |
| 1085 | - switch($mode) |
|
| 1085 | + switch ($mode) |
|
| 1086 | 1086 | { |
| 1087 | 1087 | case 'delete' : |
| 1088 | 1088 | $output = $this->deleteDeniedID($user_id); |
| 1089 | - if(!$output->toBool()) return $output; |
|
| 1089 | + if (!$output->toBool()) return $output; |
|
| 1090 | 1090 | $msg_code = 'success_deleted'; |
| 1091 | 1091 | break; |
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | - $this->add('page',Context::get('page')); |
|
| 1094 | + $this->add('page', Context::get('page')); |
|
| 1095 | 1095 | $this->setMessage($msg_code); |
| 1096 | 1096 | } |
| 1097 | 1097 | |
@@ -1138,24 +1138,24 @@ discard block |
||
| 1138 | 1138 | */ |
| 1139 | 1139 | function insertGroup($args) |
| 1140 | 1140 | { |
| 1141 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 1141 | + if (!$args->site_srl) $args->site_srl = 0; |
|
| 1142 | 1142 | // Check the value of is_default. |
| 1143 | - if($args->is_default != 'Y') |
|
| 1143 | + if ($args->is_default != 'Y') |
|
| 1144 | 1144 | { |
| 1145 | 1145 | $args->is_default = 'N'; |
| 1146 | 1146 | } |
| 1147 | 1147 | else |
| 1148 | 1148 | { |
| 1149 | 1149 | $output = executeQuery('member.updateGroupDefaultClear', $args); |
| 1150 | - if(!$output->toBool()) return $output; |
|
| 1150 | + if (!$output->toBool()) return $output; |
|
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | - if(!isset($args->list_order) || $args->list_order=='') |
|
| 1153 | + if (!isset($args->list_order) || $args->list_order == '') |
|
| 1154 | 1154 | { |
| 1155 | 1155 | $args->list_order = $args->group_srl; |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | - if(!$args->group_srl) $args->group_srl = getNextSequence(); |
|
| 1158 | + if (!$args->group_srl) $args->group_srl = getNextSequence(); |
|
| 1159 | 1159 | $args->list_order = $args->group_srl; |
| 1160 | 1160 | $output = executeQuery('member.insertGroup', $args); |
| 1161 | 1161 | $this->_deleteMemberGroupCache($args->site_srl); |
@@ -1170,17 +1170,17 @@ discard block |
||
| 1170 | 1170 | */ |
| 1171 | 1171 | function updateGroup($args) |
| 1172 | 1172 | { |
| 1173 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 1173 | + if (!$args->site_srl) $args->site_srl = 0; |
|
| 1174 | 1174 | // Check the value of is_default. |
| 1175 | - if(!$args->group_srl) return new BaseObject(-1, 'lang->msg_not_founded'); |
|
| 1176 | - if($args->is_default!='Y') |
|
| 1175 | + if (!$args->group_srl) return new BaseObject(-1, 'lang->msg_not_founded'); |
|
| 1176 | + if ($args->is_default != 'Y') |
|
| 1177 | 1177 | { |
| 1178 | 1178 | $args->is_default = 'N'; |
| 1179 | 1179 | } |
| 1180 | 1180 | else |
| 1181 | 1181 | { |
| 1182 | 1182 | $output = executeQuery('member.updateGroupDefaultClear', $args); |
| 1183 | - if(!$output->toBool()) return $output; |
|
| 1183 | + if (!$output->toBool()) return $output; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | $output = executeQuery('member.updateGroup', $args); |
@@ -1203,8 +1203,8 @@ discard block |
||
| 1203 | 1203 | $columnList = array('group_srl', 'is_default'); |
| 1204 | 1204 | $group_info = $oMemberModel->getGroup($group_srl, $columnList); |
| 1205 | 1205 | |
| 1206 | - if(!$group_info) return new BaseObject(-1, 'lang->msg_not_founded'); |
|
| 1207 | - if($group_info->is_default == 'Y') return new BaseObject(-1, 'msg_not_delete_default'); |
|
| 1206 | + if (!$group_info) return new BaseObject(-1, 'lang->msg_not_founded'); |
|
| 1207 | + if ($group_info->is_default == 'Y') return new BaseObject(-1, 'msg_not_delete_default'); |
|
| 1208 | 1208 | |
| 1209 | 1209 | // Get groups where is_default == 'Y' |
| 1210 | 1210 | $columnList = array('site_srl', 'group_srl'); |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | $defaultGroup = $oMemberModel->getDefaultGroup(0); |
| 1242 | 1242 | $defaultGroupSrl = $defaultGroup->group_srl; |
| 1243 | 1243 | $group_srls = $vars->group_srls; |
| 1244 | - foreach($group_srls as $order=>$group_srl) |
|
| 1244 | + foreach ($group_srls as $order=>$group_srl) |
|
| 1245 | 1245 | { |
| 1246 | 1246 | $isInsert = false; |
| 1247 | 1247 | $update_args = new stdClass(); |
@@ -1250,9 +1250,9 @@ discard block |
||
| 1250 | 1250 | $update_args->image_mark = $vars->image_marks[$order]; |
| 1251 | 1251 | $update_args->list_order = $order + 1; |
| 1252 | 1252 | |
| 1253 | - if(!$update_args->title) continue; |
|
| 1253 | + if (!$update_args->title) continue; |
|
| 1254 | 1254 | |
| 1255 | - if(is_numeric($group_srl)) { |
|
| 1255 | + if (is_numeric($group_srl)) { |
|
| 1256 | 1256 | $update_args->group_srl = $group_srl; |
| 1257 | 1257 | $output = $this->updateGroup($update_args); |
| 1258 | 1258 | } |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | $output = $this->insertGroup($update_args); |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | - if($vars->defaultGroup == $group_srl) { |
|
| 1264 | + if ($vars->defaultGroup == $group_srl) { |
|
| 1265 | 1265 | $defaultGroupSrl = $update_args->group_srl; |
| 1266 | 1266 | } |
| 1267 | 1267 | } |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | { |
| 1288 | 1288 | $vars = Context::getRequestVars(); |
| 1289 | 1289 | |
| 1290 | - foreach($vars->group_srls as $key => $val) |
|
| 1290 | + foreach ($vars->group_srls as $key => $val) |
|
| 1291 | 1291 | { |
| 1292 | 1292 | $args = new stdClass; |
| 1293 | 1293 | $args->group_srl = $val; |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | { |
| 1309 | 1309 | //remove from cache |
| 1310 | 1310 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1311 | - if($oCacheHandler->isSupport()) |
|
| 1311 | + if ($oCacheHandler->isSupport()) |
|
| 1312 | 1312 | { |
| 1313 | 1313 | $oCacheHandler->invalidateGroupKey('member'); |
| 1314 | 1314 | } |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | $args = new stdClass(); |
| 1326 | 1326 | $args->user_id = $user_id; |
| 1327 | 1327 | $args->description = $description; |
| 1328 | - $args->list_order = -1*getNextSequence(); |
|
| 1328 | + $args->list_order = -1 * getNextSequence(); |
|
| 1329 | 1329 | |
| 1330 | 1330 | return executeQuery('member.insertDeniedID', $args); |
| 1331 | 1331 | } |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | */ |
| 1347 | 1347 | function deleteDeniedID($user_id) |
| 1348 | 1348 | { |
| 1349 | - if(!$user_id) unset($user_id); |
|
| 1349 | + if (!$user_id) unset($user_id); |
|
| 1350 | 1350 | |
| 1351 | 1351 | $args = new stdClass; |
| 1352 | 1352 | $args->user_id = $user_id; |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | */ |
| 1361 | 1361 | function deleteDeniedNickName($nick_name) |
| 1362 | 1362 | { |
| 1363 | - if(!$nick_name) unset($nick_name); |
|
| 1363 | + if (!$nick_name) unset($nick_name); |
|
| 1364 | 1364 | |
| 1365 | 1365 | $args = new stdClass; |
| 1366 | 1366 | $args->nick_name = $nick_name; |
@@ -1399,16 +1399,16 @@ discard block |
||
| 1399 | 1399 | // Get a list of all join forms |
| 1400 | 1400 | $join_form_list = $oMemberModel->getJoinFormList(); |
| 1401 | 1401 | $join_form_srl_list = array_keys($join_form_list); |
| 1402 | - if(count($join_form_srl_list)<2) return new BaseObject(); |
|
| 1402 | + if (count($join_form_srl_list) < 2) return new BaseObject(); |
|
| 1403 | 1403 | |
| 1404 | 1404 | $prev_member_join_form = NULL; |
| 1405 | - foreach($join_form_list as $key => $val) |
|
| 1405 | + foreach ($join_form_list as $key => $val) |
|
| 1406 | 1406 | { |
| 1407 | - if($val->member_join_form_srl == $member_join_form_srl) break; |
|
| 1407 | + if ($val->member_join_form_srl == $member_join_form_srl) break; |
|
| 1408 | 1408 | $prev_member_join_form = $val; |
| 1409 | 1409 | } |
| 1410 | 1410 | // Return if no previous join form exists |
| 1411 | - if(!$prev_member_join_form) return new BaseObject(); |
|
| 1411 | + if (!$prev_member_join_form) return new BaseObject(); |
|
| 1412 | 1412 | // Information of the join form |
| 1413 | 1413 | $cur_args = new stdClass; |
| 1414 | 1414 | $cur_args->member_join_form_srl = $member_join_form_srl; |
@@ -1419,10 +1419,10 @@ discard block |
||
| 1419 | 1419 | $prev_args->list_order = $list_order; |
| 1420 | 1420 | // Execute Query |
| 1421 | 1421 | $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); |
| 1422 | - if(!$output->toBool()) return $output; |
|
| 1422 | + if (!$output->toBool()) return $output; |
|
| 1423 | 1423 | |
| 1424 | 1424 | executeQuery('member.updateMemberJoinFormListorder', $prev_args); |
| 1425 | - if(!$output->toBool()) return $output; |
|
| 1425 | + if (!$output->toBool()) return $output; |
|
| 1426 | 1426 | |
| 1427 | 1427 | return new BaseObject(); |
| 1428 | 1428 | } |
@@ -1446,16 +1446,16 @@ discard block |
||
| 1446 | 1446 | // Get information of all join forms |
| 1447 | 1447 | $join_form_list = $oMemberModel->getJoinFormList(); |
| 1448 | 1448 | $join_form_srl_list = array_keys($join_form_list); |
| 1449 | - if(count($join_form_srl_list)<2) return new BaseObject(); |
|
| 1449 | + if (count($join_form_srl_list) < 2) return new BaseObject(); |
|
| 1450 | 1450 | |
| 1451 | - for($i=0;$i<count($join_form_srl_list);$i++) |
|
| 1451 | + for ($i = 0; $i < count($join_form_srl_list); $i++) |
|
| 1452 | 1452 | { |
| 1453 | - if($join_form_srl_list[$i]==$member_join_form_srl) break; |
|
| 1453 | + if ($join_form_srl_list[$i] == $member_join_form_srl) break; |
|
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | - $next_member_join_form_srl = $join_form_srl_list[$i+1]; |
|
| 1456 | + $next_member_join_form_srl = $join_form_srl_list[$i + 1]; |
|
| 1457 | 1457 | // Return if no previous join form exists |
| 1458 | - if(!$next_member_join_form_srl) return new BaseObject(); |
|
| 1458 | + if (!$next_member_join_form_srl) return new BaseObject(); |
|
| 1459 | 1459 | $next_member_join_form = $join_form_list[$next_member_join_form_srl]; |
| 1460 | 1460 | // Information of the join form |
| 1461 | 1461 | $cur_args = new stdClass; |
@@ -1467,10 +1467,10 @@ discard block |
||
| 1467 | 1467 | $next_args->list_order = $list_order; |
| 1468 | 1468 | // Execute Query |
| 1469 | 1469 | $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); |
| 1470 | - if(!$output->toBool()) return $output; |
|
| 1470 | + if (!$output->toBool()) return $output; |
|
| 1471 | 1471 | |
| 1472 | 1472 | $output = executeQuery('member.updateMemberJoinFormListorder', $next_args); |
| 1473 | - if(!$output->toBool()) return $output; |
|
| 1473 | + if (!$output->toBool()) return $output; |
|
| 1474 | 1474 | |
| 1475 | 1475 | return new BaseObject(); |
| 1476 | 1476 | } |
@@ -29,30 +29,30 @@ discard block |
||
| 29 | 29 | $file_info = $_FILES['Filedata']; |
| 30 | 30 | |
| 31 | 31 | // An error appears if not a normally uploaded file |
| 32 | - if(!is_uploaded_file($file_info['tmp_name'])) exit(); |
|
| 32 | + if (!is_uploaded_file($file_info['tmp_name'])) exit(); |
|
| 33 | 33 | |
| 34 | 34 | // Basic variables setting |
| 35 | 35 | $oFileModel = getModel('file'); |
| 36 | 36 | $editor_sequence = Context::get('editor_sequence'); |
| 37 | 37 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 38 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 38 | + if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 39 | 39 | $module_srl = $this->module_srl; |
| 40 | 40 | // Exit a session if there is neither upload permission nor information |
| 41 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 41 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 42 | 42 | // Extract from session information if upload_target_srl is not specified |
| 43 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 43 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 44 | 44 | // Create if upload_target_srl is not defined in the session information |
| 45 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 45 | + if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 46 | 46 | |
| 47 | 47 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
| 48 | 48 | Context::setResponseMethod('JSON'); |
| 49 | - $this->add('file_srl',$output->get('file_srl')); |
|
| 50 | - $this->add('file_size',$output->get('file_size')); |
|
| 51 | - $this->add('direct_download',$output->get('direct_download')); |
|
| 52 | - $this->add('source_filename',$output->get('source_filename')); |
|
| 53 | - $this->add('download_url',$output->get('uploaded_filename')); |
|
| 54 | - $this->add('upload_target_srl',$output->get('upload_target_srl')); |
|
| 55 | - if($output->error != '0') $this->stop($output->message); |
|
| 49 | + $this->add('file_srl', $output->get('file_srl')); |
|
| 50 | + $this->add('file_size', $output->get('file_size')); |
|
| 51 | + $this->add('direct_download', $output->get('direct_download')); |
|
| 52 | + $this->add('source_filename', $output->get('source_filename')); |
|
| 53 | + $this->add('download_url', $output->get('uploaded_filename')); |
|
| 54 | + $this->add('upload_target_srl', $output->get('upload_target_srl')); |
|
| 55 | + if ($output->error != '0') $this->stop($output->message); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -67,24 +67,24 @@ discard block |
||
| 67 | 67 | $callback = Context::get('callback'); |
| 68 | 68 | $module_srl = $this->module_srl; |
| 69 | 69 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 70 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 70 | + if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 71 | 71 | |
| 72 | 72 | // Exit a session if there is neither upload permission nor information |
| 73 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 73 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 74 | 74 | // Extract from session information if upload_target_srl is not specified |
| 75 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 75 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 76 | 76 | // Create if upload_target_srl is not defined in the session information |
| 77 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 77 | + if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 78 | 78 | |
| 79 | 79 | // Delete and then attempt to re-upload if file_srl is requested |
| 80 | 80 | $file_srl = Context::get('file_srl'); |
| 81 | - if($file_srl) |
|
| 81 | + if ($file_srl) |
|
| 82 | 82 | { |
| 83 | 83 | $oFileModel = getModel('file'); |
| 84 | 84 | $logged_info = Context::get('logged_info'); |
| 85 | 85 | $file_info = $oFileModel->getFile($file_srl); |
| 86 | 86 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
| 87 | - if($file_info->file_srl == $file_srl && $file_grant->is_deletable) |
|
| 87 | + if ($file_info->file_srl == $file_srl && $file_grant->is_deletable) |
|
| 88 | 88 | { |
| 89 | 89 | $this->deleteFile($file_srl); |
| 90 | 90 | } |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $file_info = Context::get('Filedata'); |
| 94 | 94 | // An error appears if not a normally uploaded file |
| 95 | - if(is_uploaded_file($file_info['tmp_name'])) { |
|
| 95 | + if (is_uploaded_file($file_info['tmp_name'])) { |
|
| 96 | 96 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
| 97 | - Context::set('uploaded_fileinfo',$output); |
|
| 97 | + Context::set('uploaded_fileinfo', $output); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - Context::set('layout','none'); |
|
| 100 | + Context::set('layout', 'none'); |
|
| 101 | 101 | |
| 102 | 102 | $this->setTemplatePath($this->module_path.'tpl'); |
| 103 | 103 | $this->setTemplateFile('iframe'); |
@@ -114,24 +114,24 @@ discard block |
||
| 114 | 114 | $width = Context::get('width'); |
| 115 | 115 | $height = Context::get('height'); |
| 116 | 116 | |
| 117 | - if(!$file_srl || !$width) |
|
| 117 | + if (!$file_srl || !$width) |
|
| 118 | 118 | { |
| 119 | - return new BaseObject(-1,'msg_invalid_request'); |
|
| 119 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $oFileModel = getModel('file'); |
| 123 | 123 | $fileInfo = $oFileModel->getFile($file_srl); |
| 124 | - if(!$fileInfo || $fileInfo->direct_download != 'Y') |
|
| 124 | + if (!$fileInfo || $fileInfo->direct_download != 'Y') |
|
| 125 | 125 | { |
| 126 | - return new BaseObject(-1,'msg_invalid_request'); |
|
| 126 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $source_src = $fileInfo->uploaded_filename; |
| 130 | - $output_src = $source_src . '.resized' . strrchr($source_src,'.'); |
|
| 130 | + $output_src = $source_src.'.resized'.strrchr($source_src, '.'); |
|
| 131 | 131 | |
| 132 | - if(!$height) $height = $width-1; |
|
| 132 | + if (!$height) $height = $width - 1; |
|
| 133 | 133 | |
| 134 | - if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio')) |
|
| 134 | + if (FileHandler::createImageFile($source_src, $output_src, $width, $height, '', 'ratio')) |
|
| 135 | 135 | { |
| 136 | 136 | $output = new stdClass(); |
| 137 | 137 | $output->info = getimagesize($output_src); |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | else |
| 141 | 141 | { |
| 142 | - return new BaseObject(-1,'msg_invalid_request'); |
|
| 142 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $this->add('resized_info',$output); |
|
| 145 | + $this->add('resized_info', $output); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | $oFileModel = getModel('file'); |
| 182 | 182 | |
| 183 | - if(isset($this->grant->access) && $this->grant->access !== true) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 183 | + if (isset($this->grant->access) && $this->grant->access !== true) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 184 | 184 | |
| 185 | 185 | $file_srl = Context::get('file_srl'); |
| 186 | 186 | $sid = Context::get('sid'); |
@@ -189,26 +189,26 @@ discard block |
||
| 189 | 189 | $columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); |
| 190 | 190 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 191 | 191 | // If the requested file information is incorrect, an error that file cannot be found appears |
| 192 | - if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); |
|
| 192 | + if ($file_obj->file_srl != $file_srl || $file_obj->sid != $sid) return $this->stop('msg_file_not_found'); |
|
| 193 | 193 | // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) |
| 194 | - if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); |
|
| 194 | + if ($logged_info->is_admin != 'Y' && $file_obj->isvalid != 'Y') return $this->stop('msg_not_permitted_download'); |
|
| 195 | 195 | // File name |
| 196 | 196 | $filename = $file_obj->source_filename; |
| 197 | 197 | $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); |
| 198 | 198 | // Not allow the file outlink |
| 199 | - if($file_module_config->allow_outlink == 'N') |
|
| 199 | + if ($file_module_config->allow_outlink == 'N') |
|
| 200 | 200 | { |
| 201 | 201 | // Handles extension to allow outlink |
| 202 | - if($file_module_config->allow_outlink_format) |
|
| 202 | + if ($file_module_config->allow_outlink_format) |
|
| 203 | 203 | { |
| 204 | 204 | $allow_outlink_format_array = array(); |
| 205 | 205 | $allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); |
| 206 | - if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 206 | + if (!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 207 | 207 | |
| 208 | - foreach($allow_outlink_format_array as $val) |
|
| 208 | + foreach ($allow_outlink_format_array as $val) |
|
| 209 | 209 | { |
| 210 | 210 | $val = trim($val); |
| 211 | - if(preg_match("/\.{$val}$/i", $filename)) |
|
| 211 | + if (preg_match("/\.{$val}$/i", $filename)) |
|
| 212 | 212 | { |
| 213 | 213 | $file_module_config->allow_outlink = 'Y'; |
| 214 | 214 | break; |
@@ -216,21 +216,21 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | // Sites that outlink is allowed |
| 219 | - if($file_module_config->allow_outlink != 'Y') |
|
| 219 | + if ($file_module_config->allow_outlink != 'Y') |
|
| 220 | 220 | { |
| 221 | 221 | $referer = parse_url($_SERVER["HTTP_REFERER"]); |
| 222 | - if($referer['host'] != $_SERVER['HTTP_HOST']) |
|
| 222 | + if ($referer['host'] != $_SERVER['HTTP_HOST']) |
|
| 223 | 223 | { |
| 224 | - if($file_module_config->allow_outlink_site) |
|
| 224 | + if ($file_module_config->allow_outlink_site) |
|
| 225 | 225 | { |
| 226 | 226 | $allow_outlink_site_array = array(); |
| 227 | 227 | $allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site); |
| 228 | - if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 228 | + if (!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 229 | 229 | |
| 230 | - foreach($allow_outlink_site_array as $val) |
|
| 230 | + foreach ($allow_outlink_site_array as $val) |
|
| 231 | 231 | { |
| 232 | 232 | $site = parse_url(trim($val)); |
| 233 | - if($site['host'] == $referer['host']) |
|
| 233 | + if ($site['host'] == $referer['host']) |
|
| 234 | 234 | { |
| 235 | 235 | $file_module_config->allow_outlink = 'Y'; |
| 236 | 236 | break; |
@@ -240,49 +240,49 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | else $file_module_config->allow_outlink = 'Y'; |
| 242 | 242 | } |
| 243 | - if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 243 | + if ($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | // Check if a permission for file download is granted |
| 247 | 247 | $downloadGrantCount = 0; |
| 248 | - if(is_array($file_module_config->download_grant)) |
|
| 248 | + if (is_array($file_module_config->download_grant)) |
|
| 249 | 249 | { |
| 250 | - foreach($file_module_config->download_grant AS $value) |
|
| 251 | - if($value) $downloadGrantCount++; |
|
| 250 | + foreach ($file_module_config->download_grant AS $value) |
|
| 251 | + if ($value) $downloadGrantCount++; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
| 254 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
| 255 | 255 | { |
| 256 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 256 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 257 | 257 | $logged_info = Context::get('logged_info'); |
| 258 | - if($logged_info->is_admin != 'Y') |
|
| 258 | + if ($logged_info->is_admin != 'Y') |
|
| 259 | 259 | { |
| 260 | - $oModuleModel =& getModel('module'); |
|
| 260 | + $oModuleModel = & getModel('module'); |
|
| 261 | 261 | $columnList = array('module_srl', 'site_srl'); |
| 262 | 262 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($file_obj->module_srl, $columnList); |
| 263 | 263 | |
| 264 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 264 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 265 | 265 | { |
| 266 | - $oMemberModel =& getModel('member'); |
|
| 266 | + $oMemberModel = & getModel('member'); |
|
| 267 | 267 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
| 268 | 268 | |
| 269 | 269 | $is_permitted = false; |
| 270 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
| 270 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
| 271 | 271 | { |
| 272 | 272 | $group_srl = $file_module_config->download_grant[$i]; |
| 273 | - if($member_groups[$group_srl]) |
|
| 273 | + if ($member_groups[$group_srl]) |
|
| 274 | 274 | { |
| 275 | 275 | $is_permitted = true; |
| 276 | 276 | break; |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 279 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | // Call a trigger (before) |
| 284 | 284 | $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); |
| 285 | - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
| 285 | + if (!$output->toBool()) return $this->stop(($output->message) ? $output->message : 'msg_not_permitted_download'); |
|
| 286 | 286 | |
| 287 | 287 | |
| 288 | 288 | // 다운로드 후 (가상) |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | $random = new Password(); |
| 297 | 297 | $file_key = $_SESSION['__XE_FILE_KEY__'][$file_srl] = $random->createSecureSalt(32, 'hex'); |
| 298 | - header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput','file_srl',$file_srl,'file_key',$file_key)); |
|
| 298 | + header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key)); |
|
| 299 | 299 | Context::close(); |
| 300 | 300 | exit(); |
| 301 | 301 | |
@@ -306,18 +306,18 @@ discard block |
||
| 306 | 306 | $oFileModel = getModel('file'); |
| 307 | 307 | $file_srl = Context::get('file_srl'); |
| 308 | 308 | $file_key = Context::get('file_key'); |
| 309 | - if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 309 | + if (strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 310 | 310 | |
| 311 | - if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 311 | + if ($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 312 | 312 | else $session_key = '__XE_FILE_KEY__'; |
| 313 | 313 | $columnList = array('source_filename', 'uploaded_filename', 'file_size'); |
| 314 | 314 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 315 | 315 | |
| 316 | 316 | $uploaded_filename = $file_obj->uploaded_filename; |
| 317 | 317 | |
| 318 | - if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 318 | + if (!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 319 | 319 | |
| 320 | - if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
| 320 | + if (!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
| 321 | 321 | { |
| 322 | 322 | unset($_SESSION[$session_key][$file_srl]); |
| 323 | 323 | return $this->stop('msg_invalid_request'); |
@@ -326,34 +326,34 @@ discard block |
||
| 326 | 326 | $file_size = $file_obj->file_size; |
| 327 | 327 | $filename = $file_obj->source_filename; |
| 328 | 328 | |
| 329 | - if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
| 329 | + if (preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
| 330 | 330 | { |
| 331 | - if($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) |
|
| 331 | + if ($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) |
|
| 332 | 332 | { |
| 333 | - $filename_param = 'filename="' . $filename . '"'; |
|
| 333 | + $filename_param = 'filename="'.$filename.'"'; |
|
| 334 | 334 | } |
| 335 | 335 | else |
| 336 | 336 | { |
| 337 | 337 | $filename_param = sprintf('filename="%s"; filename*=UTF-8\'\'%s', $filename, rawurlencode($filename)); |
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | - elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 340 | + elseif (preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 341 | 341 | { |
| 342 | 342 | $filename_param = sprintf('filename="%s"; filename*=UTF-8\'\'%s', $filename, rawurlencode($filename)); |
| 343 | 343 | } |
| 344 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 344 | + elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 345 | 345 | { |
| 346 | 346 | $filename = rawurlencode($filename); |
| 347 | - $filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"'; |
|
| 347 | + $filename_param = 'filename="'.preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1).'"'; |
|
| 348 | 348 | } |
| 349 | 349 | else |
| 350 | 350 | { |
| 351 | - $filename_param = 'filename="' . $filename . '"'; |
|
| 351 | + $filename_param = 'filename="'.$filename.'"'; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - if($is_android) |
|
| 354 | + if ($is_android) |
|
| 355 | 355 | { |
| 356 | - if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 356 | + if ($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | unset($_SESSION[$session_key][$file_srl]); |
@@ -361,21 +361,21 @@ discard block |
||
| 361 | 361 | Context::close(); |
| 362 | 362 | |
| 363 | 363 | $fp = fopen($uploaded_filename, 'rb'); |
| 364 | - if(!$fp) return $this->stop('msg_file_not_found'); |
|
| 364 | + if (!$fp) return $this->stop('msg_file_not_found'); |
|
| 365 | 365 | |
| 366 | 366 | header("Cache-Control: "); |
| 367 | 367 | header("Pragma: "); |
| 368 | 368 | header("Content-Type: application/octet-stream"); |
| 369 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 369 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 370 | 370 | |
| 371 | - header("Content-Length: " .(string)($file_size)); |
|
| 372 | - header('Content-Disposition: attachment; ' . $filename_param); |
|
| 371 | + header("Content-Length: ".(string) ($file_size)); |
|
| 372 | + header('Content-Disposition: attachment; '.$filename_param); |
|
| 373 | 373 | header("Content-Transfer-Encoding: binary\n"); |
| 374 | 374 | |
| 375 | 375 | // if file size is lager than 10MB, use fread function (#18675748) |
| 376 | - if($file_size > 1024 * 1024) |
|
| 376 | + if ($file_size > 1024 * 1024) |
|
| 377 | 377 | { |
| 378 | - while(!feof($fp)) echo fread($fp, 1024); |
|
| 378 | + while (!feof($fp)) echo fread($fp, 1024); |
|
| 379 | 379 | fclose($fp); |
| 380 | 380 | } |
| 381 | 381 | else |
@@ -397,36 +397,36 @@ discard block |
||
| 397 | 397 | $editor_sequence = Context::get('editor_sequence'); |
| 398 | 398 | $file_srl = Context::get('file_srl'); |
| 399 | 399 | $file_srls = Context::get('file_srls'); |
| 400 | - if($file_srls) $file_srl = $file_srls; |
|
| 400 | + if ($file_srls) $file_srl = $file_srls; |
|
| 401 | 401 | // Exit a session if there is neither upload permission nor information |
| 402 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 402 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 403 | 403 | |
| 404 | 404 | $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
| 405 | 405 | |
| 406 | 406 | $logged_info = Context::get('logged_info'); |
| 407 | 407 | $oFileModel = getModel('file'); |
| 408 | 408 | |
| 409 | - $srls = explode(',',$file_srl); |
|
| 410 | - if(!count($srls)) return; |
|
| 409 | + $srls = explode(',', $file_srl); |
|
| 410 | + if (!count($srls)) return; |
|
| 411 | 411 | |
| 412 | - for($i=0;$i<count($srls);$i++) |
|
| 412 | + for ($i = 0; $i < count($srls); $i++) |
|
| 413 | 413 | { |
| 414 | - $srl = (int)$srls[$i]; |
|
| 415 | - if(!$srl) continue; |
|
| 414 | + $srl = (int) $srls[$i]; |
|
| 415 | + if (!$srl) continue; |
|
| 416 | 416 | |
| 417 | 417 | $args = new stdClass; |
| 418 | 418 | $args->file_srl = $srl; |
| 419 | 419 | $output = executeQuery('file.getFile', $args); |
| 420 | - if(!$output->toBool()) continue; |
|
| 420 | + if (!$output->toBool()) continue; |
|
| 421 | 421 | |
| 422 | 422 | $file_info = $output->data; |
| 423 | - if(!$file_info) continue; |
|
| 423 | + if (!$file_info) continue; |
|
| 424 | 424 | |
| 425 | 425 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
| 426 | 426 | |
| 427 | - if(!$file_grant->is_deletable) continue; |
|
| 427 | + if (!$file_grant->is_deletable) continue; |
|
| 428 | 428 | |
| 429 | - if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 429 | + if ($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
@@ -437,32 +437,32 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | function procFileGetList() |
| 439 | 439 | { |
| 440 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 440 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 441 | 441 | |
| 442 | 442 | $oModuleModel = getModel('module'); |
| 443 | 443 | |
| 444 | 444 | $logged_info = Context::get('logged_info'); |
| 445 | - if($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info)) |
|
| 445 | + if ($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info)) |
|
| 446 | 446 | { |
| 447 | 447 | return new BaseObject(-1, 'msg_not_permitted'); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | $fileSrls = Context::get('file_srls'); |
| 451 | - if($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 451 | + if ($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 452 | 452 | |
| 453 | 453 | global $lang; |
| 454 | - if(count($fileSrlList) > 0) |
|
| 454 | + if (count($fileSrlList) > 0) |
|
| 455 | 455 | { |
| 456 | 456 | $oFileModel = getModel('file'); |
| 457 | 457 | $fileList = $oFileModel->getFile($fileSrlList); |
| 458 | - if(!is_array($fileList)) $fileList = array($fileList); |
|
| 458 | + if (!is_array($fileList)) $fileList = array($fileList); |
|
| 459 | 459 | |
| 460 | - if(is_array($fileList)) |
|
| 460 | + if (is_array($fileList)) |
|
| 461 | 461 | { |
| 462 | - foreach($fileList AS $key=>$value) |
|
| 462 | + foreach ($fileList AS $key=>$value) |
|
| 463 | 463 | { |
| 464 | 464 | $value->human_file_size = FileHandler::filesize($value->file_size); |
| 465 | - if($value->isvalid=='Y') $value->validName = $lang->is_valid; |
|
| 465 | + if ($value->isvalid == 'Y') $value->validName = $lang->is_valid; |
|
| 466 | 466 | else $value->validName = $lang->is_stand_by; |
| 467 | 467 | } |
| 468 | 468 | } |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | function triggerCheckAttached(&$obj) |
| 485 | 485 | { |
| 486 | 486 | $document_srl = $obj->document_srl; |
| 487 | - if(!$document_srl) return new BaseObject(); |
|
| 487 | + if (!$document_srl) return new BaseObject(); |
|
| 488 | 488 | // Get numbers of attachments |
| 489 | 489 | $oFileModel = getModel('file'); |
| 490 | 490 | $obj->uploaded_count = $oFileModel->getFilesCount($document_srl); |
@@ -501,10 +501,10 @@ discard block |
||
| 501 | 501 | function triggerAttachFiles(&$obj) |
| 502 | 502 | { |
| 503 | 503 | $document_srl = $obj->document_srl; |
| 504 | - if(!$document_srl) return new BaseObject(); |
|
| 504 | + if (!$document_srl) return new BaseObject(); |
|
| 505 | 505 | |
| 506 | 506 | $output = $this->setFilesValid($document_srl); |
| 507 | - if(!$output->toBool()) return $output; |
|
| 507 | + if (!$output->toBool()) return $output; |
|
| 508 | 508 | |
| 509 | 509 | return new BaseObject(); |
| 510 | 510 | } |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | function triggerDeleteAttached(&$obj) |
| 519 | 519 | { |
| 520 | 520 | $document_srl = $obj->document_srl; |
| 521 | - if(!$document_srl) return new BaseObject(); |
|
| 521 | + if (!$document_srl) return new BaseObject(); |
|
| 522 | 522 | |
| 523 | 523 | $output = $this->deleteFiles($document_srl); |
| 524 | 524 | return $output; |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | function triggerCommentCheckAttached(&$obj) |
| 534 | 534 | { |
| 535 | 535 | $comment_srl = $obj->comment_srl; |
| 536 | - if(!$comment_srl) return new BaseObject(); |
|
| 536 | + if (!$comment_srl) return new BaseObject(); |
|
| 537 | 537 | // Get numbers of attachments |
| 538 | 538 | $oFileModel = getModel('file'); |
| 539 | 539 | $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl); |
@@ -551,10 +551,10 @@ discard block |
||
| 551 | 551 | { |
| 552 | 552 | $comment_srl = $obj->comment_srl; |
| 553 | 553 | $uploaded_count = $obj->uploaded_count; |
| 554 | - if(!$comment_srl || !$uploaded_count) return new BaseObject(); |
|
| 554 | + if (!$comment_srl || !$uploaded_count) return new BaseObject(); |
|
| 555 | 555 | |
| 556 | 556 | $output = $this->setFilesValid($comment_srl); |
| 557 | - if(!$output->toBool()) return $output; |
|
| 557 | + if (!$output->toBool()) return $output; |
|
| 558 | 558 | |
| 559 | 559 | return new BaseObject(); |
| 560 | 560 | } |
@@ -568,9 +568,9 @@ discard block |
||
| 568 | 568 | function triggerCommentDeleteAttached(&$obj) |
| 569 | 569 | { |
| 570 | 570 | $comment_srl = $obj->comment_srl; |
| 571 | - if(!$comment_srl) return new BaseObject(); |
|
| 571 | + if (!$comment_srl) return new BaseObject(); |
|
| 572 | 572 | |
| 573 | - if($obj->isMoveToTrash) return new BaseObject(); |
|
| 573 | + if ($obj->isMoveToTrash) return new BaseObject(); |
|
| 574 | 574 | |
| 575 | 575 | $output = $this->deleteFiles($comment_srl); |
| 576 | 576 | return $output; |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | function triggerDeleteModuleFiles(&$obj) |
| 586 | 586 | { |
| 587 | 587 | $module_srl = $obj->module_srl; |
| 588 | - if(!$module_srl) return new BaseObject(); |
|
| 588 | + if (!$module_srl) return new BaseObject(); |
|
| 589 | 589 | |
| 590 | 590 | $oFileController = getAdminController('file'); |
| 591 | 591 | return $oFileController->deleteModuleFiles($module_srl); |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | * @param int $upload_target_srl |
| 599 | 599 | * @return void |
| 600 | 600 | */ |
| 601 | - function setUploadInfo($editor_sequence, $upload_target_srl=0) |
|
| 601 | + function setUploadInfo($editor_sequence, $upload_target_srl = 0) |
|
| 602 | 602 | { |
| 603 | - if(!isset($_SESSION['upload_info'][$editor_sequence])) |
|
| 603 | + if (!isset($_SESSION['upload_info'][$editor_sequence])) |
|
| 604 | 604 | { |
| 605 | 605 | $_SESSION['upload_info'][$editor_sequence] = new stdClass(); |
| 606 | 606 | } |
@@ -660,36 +660,36 @@ discard block |
||
| 660 | 660 | $trigger_obj->module_srl = $module_srl; |
| 661 | 661 | $trigger_obj->upload_target_srl = $upload_target_srl; |
| 662 | 662 | $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); |
| 663 | - if(!$output->toBool()) return $output; |
|
| 663 | + if (!$output->toBool()) return $output; |
|
| 664 | 664 | |
| 665 | 665 | // A workaround for Firefox upload bug |
| 666 | - if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
| 666 | + if (preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
| 667 | 667 | { |
| 668 | 668 | $file_info['name'] = base64_decode(strtr($match[1], ':', '/')); |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - if(!$manual_insert) |
|
| 671 | + if (!$manual_insert) |
|
| 672 | 672 | { |
| 673 | 673 | // Get the file configurations |
| 674 | 674 | $logged_info = Context::get('logged_info'); |
| 675 | - if($logged_info->is_admin != 'Y') |
|
| 675 | + if ($logged_info->is_admin != 'Y') |
|
| 676 | 676 | { |
| 677 | 677 | $oFileModel = getModel('file'); |
| 678 | 678 | $config = $oFileModel->getFileConfig($module_srl); |
| 679 | 679 | |
| 680 | 680 | // check file type |
| 681 | - if(isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
| 681 | + if (isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
| 682 | 682 | { |
| 683 | 683 | $filetypes = explode(';', $config->allowed_filetypes); |
| 684 | 684 | $ext = array(); |
| 685 | - foreach($filetypes as $item) { |
|
| 685 | + foreach ($filetypes as $item) { |
|
| 686 | 686 | $item = explode('.', $item); |
| 687 | 687 | $ext[] = strtolower($item[1]); |
| 688 | 688 | } |
| 689 | 689 | $uploaded_ext = explode('.', $file_info['name']); |
| 690 | 690 | $uploaded_ext = strtolower(array_pop($uploaded_ext)); |
| 691 | 691 | |
| 692 | - if(!in_array($uploaded_ext, $ext)) |
|
| 692 | + if (!in_array($uploaded_ext, $ext)) |
|
| 693 | 693 | { |
| 694 | 694 | return $this->stop('msg_not_allowed_filetype'); |
| 695 | 695 | } |
@@ -698,64 +698,64 @@ discard block |
||
| 698 | 698 | $allowed_filesize = $config->allowed_filesize * 1024 * 1024; |
| 699 | 699 | $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; |
| 700 | 700 | // An error appears if file size exceeds a limit |
| 701 | - if($allowed_filesize < filesize($file_info['tmp_name'])) return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 701 | + if ($allowed_filesize < filesize($file_info['tmp_name'])) return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 702 | 702 | // Get total file size of all attachements (from DB) |
| 703 | 703 | $size_args = new stdClass; |
| 704 | 704 | $size_args->upload_target_srl = $upload_target_srl; |
| 705 | 705 | $output = executeQuery('file.getAttachedFileSize', $size_args); |
| 706 | - $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']); |
|
| 707 | - if($attached_size > $allowed_attach_size) return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 706 | + $attached_size = (int) $output->data->attached_size + filesize($file_info['tmp_name']); |
|
| 707 | + if ($attached_size > $allowed_attach_size) return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 708 | 708 | } |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | // https://github.com/xpressengine/xe-core/issues/1713 |
| 712 | - $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']); |
|
| 712 | + $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']); |
|
| 713 | 713 | $file_info['name'] = removeHackTag($file_info['name']); |
| 714 | - $file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']); |
|
| 714 | + $file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']); |
|
| 715 | 715 | $file_info['name'] = str_replace('&', '&', $file_info['name']); |
| 716 | 716 | |
| 717 | 717 | // Get random number generator |
| 718 | 718 | $random = new Password(); |
| 719 | 719 | |
| 720 | 720 | // Set upload path by checking if the attachement is an image or other kinds of file |
| 721 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) |
|
| 721 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) |
|
| 722 | 722 | { |
| 723 | - $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); |
|
| 723 | + $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 724 | 724 | |
| 725 | 725 | // special character to '_' |
| 726 | 726 | // change to random file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter |
| 727 | - $ext = substr(strrchr($file_info['name'],'.'),1); |
|
| 727 | + $ext = substr(strrchr($file_info['name'], '.'), 1); |
|
| 728 | 728 | //$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']); |
| 729 | 729 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
| 730 | 730 | $filename = $path.$_filename; |
| 731 | 731 | $idx = 1; |
| 732 | - while(file_exists($filename)) |
|
| 732 | + while (file_exists($filename)) |
|
| 733 | 733 | { |
| 734 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1',$_filename); |
|
| 734 | + $filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); |
|
| 735 | 735 | $idx++; |
| 736 | 736 | } |
| 737 | 737 | $direct_download = 'Y'; |
| 738 | 738 | } |
| 739 | 739 | else |
| 740 | 740 | { |
| 741 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
| 741 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 742 | 742 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
| 743 | 743 | $direct_download = 'N'; |
| 744 | 744 | } |
| 745 | 745 | // Create a directory |
| 746 | - if(!FileHandler::makeDir($path)) return new BaseObject(-1,'msg_not_permitted_create'); |
|
| 746 | + if (!FileHandler::makeDir($path)) return new BaseObject(-1, 'msg_not_permitted_create'); |
|
| 747 | 747 | |
| 748 | 748 | // Check uploaded file |
| 749 | - if(!checkUploadedFile($file_info['tmp_name'])) return new BaseObject(-1,'msg_file_upload_error'); |
|
| 749 | + if (!checkUploadedFile($file_info['tmp_name'])) return new BaseObject(-1, 'msg_file_upload_error'); |
|
| 750 | 750 | |
| 751 | 751 | // Get random number generator |
| 752 | 752 | $random = new Password(); |
| 753 | 753 | |
| 754 | 754 | // Move the file |
| 755 | - if($manual_insert) |
|
| 755 | + if ($manual_insert) |
|
| 756 | 756 | { |
| 757 | 757 | @copy($file_info['tmp_name'], $filename); |
| 758 | - if(!file_exists($filename)) |
|
| 758 | + if (!file_exists($filename)) |
|
| 759 | 759 | { |
| 760 | 760 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 761 | 761 | @copy($file_info['tmp_name'], $filename); |
@@ -763,10 +763,10 @@ discard block |
||
| 763 | 763 | } |
| 764 | 764 | else |
| 765 | 765 | { |
| 766 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
| 766 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
| 767 | 767 | { |
| 768 | 768 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 769 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new BaseObject(-1,'msg_file_upload_error'); |
|
| 769 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) return new BaseObject(-1, 'msg_file_upload_error'); |
|
| 770 | 770 | } |
| 771 | 771 | } |
| 772 | 772 | // Get member information |
@@ -787,10 +787,10 @@ discard block |
||
| 787 | 787 | $args->sid = $random->createSecureSalt(32, 'hex'); |
| 788 | 788 | |
| 789 | 789 | $output = executeQuery('file.insertFile', $args); |
| 790 | - if(!$output->toBool()) return $output; |
|
| 790 | + if (!$output->toBool()) return $output; |
|
| 791 | 791 | // Call a trigger (after) |
| 792 | 792 | $trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); |
| 793 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 793 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 794 | 794 | |
| 795 | 795 | $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; |
| 796 | 796 | |
@@ -833,18 +833,18 @@ discard block |
||
| 833 | 833 | */ |
| 834 | 834 | function deleteFile($file_srl) |
| 835 | 835 | { |
| 836 | - if(!$file_srl) return; |
|
| 836 | + if (!$file_srl) return; |
|
| 837 | 837 | |
| 838 | 838 | $srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl); |
| 839 | - if(!count($srls)) return; |
|
| 839 | + if (!count($srls)) return; |
|
| 840 | 840 | |
| 841 | 841 | $oDocumentController = getController('document'); |
| 842 | 842 | $documentSrlList = array(); |
| 843 | 843 | |
| 844 | - foreach($srls as $srl) |
|
| 844 | + foreach ($srls as $srl) |
|
| 845 | 845 | { |
| 846 | - $srl = (int)$srl; |
|
| 847 | - if(!$srl) |
|
| 846 | + $srl = (int) $srl; |
|
| 847 | + if (!$srl) |
|
| 848 | 848 | { |
| 849 | 849 | continue; |
| 850 | 850 | } |
@@ -853,14 +853,14 @@ discard block |
||
| 853 | 853 | $args->file_srl = $srl; |
| 854 | 854 | $output = executeQuery('file.getFile', $args); |
| 855 | 855 | |
| 856 | - if(!$output->toBool() || !$output->data) |
|
| 856 | + if (!$output->toBool() || !$output->data) |
|
| 857 | 857 | { |
| 858 | 858 | continue; |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | $file_info = $output->data; |
| 862 | 862 | |
| 863 | - if($file_info->upload_target_srl) |
|
| 863 | + if ($file_info->upload_target_srl) |
|
| 864 | 864 | { |
| 865 | 865 | $documentSrlList[] = $file_info->upload_target_srl; |
| 866 | 866 | } |
@@ -871,15 +871,15 @@ discard block |
||
| 871 | 871 | // Call a trigger (before) |
| 872 | 872 | $trigger_obj = $output->data; |
| 873 | 873 | $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); |
| 874 | - if(!$output->toBool()) return $output; |
|
| 874 | + if (!$output->toBool()) return $output; |
|
| 875 | 875 | |
| 876 | 876 | // Remove from the DB |
| 877 | 877 | $output = executeQuery('file.deleteFile', $args); |
| 878 | - if(!$output->toBool()) return $output; |
|
| 878 | + if (!$output->toBool()) return $output; |
|
| 879 | 879 | |
| 880 | 880 | // Call a trigger (after) |
| 881 | 881 | $trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); |
| 882 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 882 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 883 | 883 | |
| 884 | 884 | // If successfully deleted, remove the file |
| 885 | 885 | FileHandler::removeFile($uploaded_filename); |
@@ -903,28 +903,28 @@ discard block |
||
| 903 | 903 | $columnList = array('file_srl', 'uploaded_filename', 'module_srl'); |
| 904 | 904 | $file_list = $oFileModel->getFiles($upload_target_srl, $columnList); |
| 905 | 905 | // Success returned if no attachement exists |
| 906 | - if(!is_array($file_list)||!count($file_list)) return new BaseObject(); |
|
| 906 | + if (!is_array($file_list) || !count($file_list)) return new BaseObject(); |
|
| 907 | 907 | |
| 908 | 908 | // Delete the file |
| 909 | 909 | $path = array(); |
| 910 | 910 | $file_count = count($file_list); |
| 911 | - for($i=0;$i<$file_count;$i++) |
|
| 911 | + for ($i = 0; $i < $file_count; $i++) |
|
| 912 | 912 | { |
| 913 | 913 | $this->deleteFile($file_list[$i]->file_srl); |
| 914 | 914 | |
| 915 | 915 | $uploaded_filename = $file_list[$i]->uploaded_filename; |
| 916 | 916 | $path_info = pathinfo($uploaded_filename); |
| 917 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 917 | + if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | // Remove from the DB |
| 921 | 921 | $args = new stdClass(); |
| 922 | 922 | $args->upload_target_srl = $upload_target_srl; |
| 923 | 923 | $output = executeQuery('file.deleteFiles', $args); |
| 924 | - if(!$output->toBool()) return $output; |
|
| 924 | + if (!$output->toBool()) return $output; |
|
| 925 | 925 | |
| 926 | 926 | // Remove a file directory of the document |
| 927 | - for($i=0, $c=count($path); $i<$c; $i++) |
|
| 927 | + for ($i = 0, $c = count($path); $i < $c; $i++) |
|
| 928 | 928 | { |
| 929 | 929 | FileHandler::removeBlankDir($path[$i]); |
| 930 | 930 | } |
@@ -942,23 +942,23 @@ discard block |
||
| 942 | 942 | */ |
| 943 | 943 | function moveFile($source_srl, $target_module_srl, $target_srl) |
| 944 | 944 | { |
| 945 | - if($source_srl == $target_srl) return; |
|
| 945 | + if ($source_srl == $target_srl) return; |
|
| 946 | 946 | |
| 947 | 947 | $oFileModel = getModel('file'); |
| 948 | 948 | $file_list = $oFileModel->getFiles($source_srl); |
| 949 | - if(!$file_list) return; |
|
| 949 | + if (!$file_list) return; |
|
| 950 | 950 | |
| 951 | 951 | $file_count = count($file_list); |
| 952 | 952 | |
| 953 | - for($i=0;$i<$file_count;$i++) |
|
| 953 | + for ($i = 0; $i < $file_count; $i++) |
|
| 954 | 954 | { |
| 955 | 955 | unset($file_info); |
| 956 | 956 | $file_info = $file_list[$i]; |
| 957 | 957 | $old_file = $file_info->uploaded_filename; |
| 958 | 958 | // Determine the file path by checking if the file is an image or other kinds |
| 959 | - if(preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) |
|
| 959 | + if (preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) |
|
| 960 | 960 | { |
| 961 | - $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); |
|
| 961 | + $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl, $target_srl); |
|
| 962 | 962 | $new_file = $path.$file_info->source_filename; |
| 963 | 963 | } |
| 964 | 964 | else |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | $new_file = $path.$random->createSecureSalt(32, 'hex'); |
| 969 | 969 | } |
| 970 | 970 | // Pass if a target document to move is same |
| 971 | - if($old_file == $new_file) continue; |
|
| 971 | + if ($old_file == $new_file) continue; |
|
| 972 | 972 | // Create a directory |
| 973 | 973 | FileHandler::makeDir($path); |
| 974 | 974 | // Move the file |
@@ -988,18 +988,18 @@ discard block |
||
| 988 | 988 | $vars = Context::getRequestVars(); |
| 989 | 989 | $logged_info = Context::get('logged_info'); |
| 990 | 990 | |
| 991 | - if(!$vars->editor_sequence) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 991 | + if (!$vars->editor_sequence) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 992 | 992 | |
| 993 | 993 | $upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl; |
| 994 | 994 | |
| 995 | 995 | $oFileModel = getModel('file'); |
| 996 | 996 | $file_info = $oFileModel->getFile($vars->file_srl); |
| 997 | 997 | |
| 998 | - if(!$file_info) return new BaseObject(-1, 'msg_not_founded'); |
|
| 998 | + if (!$file_info) return new BaseObject(-1, 'msg_not_founded'); |
|
| 999 | 999 | |
| 1000 | - if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1000 | + if (!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1001 | 1001 | |
| 1002 | - $args = new stdClass(); |
|
| 1002 | + $args = new stdClass(); |
|
| 1003 | 1003 | $args->file_srl = $vars->file_srl; |
| 1004 | 1004 | $args->upload_target_srl = $upload_target_srl; |
| 1005 | 1005 | |
@@ -1008,18 +1008,18 @@ discard block |
||
| 1008 | 1008 | |
| 1009 | 1009 | $args->cover_image = 'N'; |
| 1010 | 1010 | $output = executeQuery('file.updateClearCoverImage', $args); |
| 1011 | - if(!$output->toBool()) |
|
| 1011 | + if (!$output->toBool()) |
|
| 1012 | 1012 | { |
| 1013 | 1013 | $oDB->rollback(); |
| 1014 | 1014 | return $output; |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | - if($file_info->cover_image != 'Y') |
|
| 1017 | + if ($file_info->cover_image != 'Y') |
|
| 1018 | 1018 | { |
| 1019 | 1019 | |
| 1020 | 1020 | $args->cover_image = 'Y'; |
| 1021 | 1021 | $output = executeQuery('file.updateCoverImage', $args); |
| 1022 | - if(!$output->toBool()) |
|
| 1022 | + if (!$output->toBool()) |
|
| 1023 | 1023 | { |
| 1024 | 1024 | $oDB->rollback(); |
| 1025 | 1025 | return $output; |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | |
| 1030 | 1030 | $oDB->commit(); |
| 1031 | 1031 | |
| 1032 | - $this->add('is_cover',$args->cover_image); |
|
| 1032 | + $this->add('is_cover', $args->cover_image); |
|
| 1033 | 1033 | |
| 1034 | 1034 | // 썸네일 삭제 |
| 1035 | 1035 | $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($upload_target_srl, 3)); |
@@ -1055,9 +1055,9 @@ discard block |
||
| 1055 | 1055 | $fileConfig = $oModuleModel->getModulePartConfig('file', $obj->originModuleSrl); |
| 1056 | 1056 | |
| 1057 | 1057 | $oModuleController = getController('module'); |
| 1058 | - if(is_array($obj->moduleSrlList)) |
|
| 1058 | + if (is_array($obj->moduleSrlList)) |
|
| 1059 | 1059 | { |
| 1060 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 1060 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 1061 | 1061 | { |
| 1062 | 1062 | $oModuleController->insertModulePartConfig('file', $moduleSrl, $fileConfig); |
| 1063 | 1063 | } |
@@ -29,20 +29,30 @@ discard block |
||
| 29 | 29 | $file_info = $_FILES['Filedata']; |
| 30 | 30 | |
| 31 | 31 | // An error appears if not a normally uploaded file |
| 32 | - if(!is_uploaded_file($file_info['tmp_name'])) exit(); |
|
| 32 | + if(!is_uploaded_file($file_info['tmp_name'])) { |
|
| 33 | + exit(); |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | // Basic variables setting |
| 35 | 37 | $oFileModel = getModel('file'); |
| 36 | 38 | $editor_sequence = Context::get('editor_sequence'); |
| 37 | 39 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 38 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 40 | + if(!$upload_target_srl) { |
|
| 41 | + $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 42 | + } |
|
| 39 | 43 | $module_srl = $this->module_srl; |
| 40 | 44 | // Exit a session if there is neither upload permission nor information |
| 41 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 45 | + if(!$_SESSION['upload_info'][$editor_sequence]->enabled) { |
|
| 46 | + exit(); |
|
| 47 | + } |
|
| 42 | 48 | // Extract from session information if upload_target_srl is not specified |
| 43 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 49 | + if(!$upload_target_srl) { |
|
| 50 | + $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 51 | + } |
|
| 44 | 52 | // Create if upload_target_srl is not defined in the session information |
| 45 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 53 | + if(!$upload_target_srl) { |
|
| 54 | + $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 55 | + } |
|
| 46 | 56 | |
| 47 | 57 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
| 48 | 58 | Context::setResponseMethod('JSON'); |
@@ -52,7 +62,9 @@ discard block |
||
| 52 | 62 | $this->add('source_filename',$output->get('source_filename')); |
| 53 | 63 | $this->add('download_url',$output->get('uploaded_filename')); |
| 54 | 64 | $this->add('upload_target_srl',$output->get('upload_target_srl')); |
| 55 | - if($output->error != '0') $this->stop($output->message); |
|
| 65 | + if($output->error != '0') { |
|
| 66 | + $this->stop($output->message); |
|
| 67 | + } |
|
| 56 | 68 | } |
| 57 | 69 | |
| 58 | 70 | /** |
@@ -67,14 +79,22 @@ discard block |
||
| 67 | 79 | $callback = Context::get('callback'); |
| 68 | 80 | $module_srl = $this->module_srl; |
| 69 | 81 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 70 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 82 | + if(!$upload_target_srl) { |
|
| 83 | + $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 84 | + } |
|
| 71 | 85 | |
| 72 | 86 | // Exit a session if there is neither upload permission nor information |
| 73 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 87 | + if(!$_SESSION['upload_info'][$editor_sequence]->enabled) { |
|
| 88 | + exit(); |
|
| 89 | + } |
|
| 74 | 90 | // Extract from session information if upload_target_srl is not specified |
| 75 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 91 | + if(!$upload_target_srl) { |
|
| 92 | + $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 93 | + } |
|
| 76 | 94 | // Create if upload_target_srl is not defined in the session information |
| 77 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 95 | + if(!$upload_target_srl) { |
|
| 96 | + $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 97 | + } |
|
| 78 | 98 | |
| 79 | 99 | // Delete and then attempt to re-upload if file_srl is requested |
| 80 | 100 | $file_srl = Context::get('file_srl'); |
@@ -129,15 +149,16 @@ discard block |
||
| 129 | 149 | $source_src = $fileInfo->uploaded_filename; |
| 130 | 150 | $output_src = $source_src . '.resized' . strrchr($source_src,'.'); |
| 131 | 151 | |
| 132 | - if(!$height) $height = $width-1; |
|
| 152 | + if(!$height) { |
|
| 153 | + $height = $width-1; |
|
| 154 | + } |
|
| 133 | 155 | |
| 134 | 156 | if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio')) |
| 135 | 157 | { |
| 136 | 158 | $output = new stdClass(); |
| 137 | 159 | $output->info = getimagesize($output_src); |
| 138 | 160 | $output->src = $output_src; |
| 139 | - } |
|
| 140 | - else |
|
| 161 | + } else |
|
| 141 | 162 | { |
| 142 | 163 | return new BaseObject(-1,'msg_invalid_request'); |
| 143 | 164 | } |
@@ -180,7 +201,9 @@ discard block |
||
| 180 | 201 | { |
| 181 | 202 | $oFileModel = getModel('file'); |
| 182 | 203 | |
| 183 | - if(isset($this->grant->access) && $this->grant->access !== true) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 204 | + if(isset($this->grant->access) && $this->grant->access !== true) { |
|
| 205 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 206 | + } |
|
| 184 | 207 | |
| 185 | 208 | $file_srl = Context::get('file_srl'); |
| 186 | 209 | $sid = Context::get('sid'); |
@@ -189,9 +212,13 @@ discard block |
||
| 189 | 212 | $columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); |
| 190 | 213 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 191 | 214 | // If the requested file information is incorrect, an error that file cannot be found appears |
| 192 | - if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); |
|
| 215 | + if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) { |
|
| 216 | + return $this->stop('msg_file_not_found'); |
|
| 217 | + } |
|
| 193 | 218 | // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) |
| 194 | - if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); |
|
| 219 | + if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') { |
|
| 220 | + return $this->stop('msg_not_permitted_download'); |
|
| 221 | + } |
|
| 195 | 222 | // File name |
| 196 | 223 | $filename = $file_obj->source_filename; |
| 197 | 224 | $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); |
@@ -203,7 +230,9 @@ discard block |
||
| 203 | 230 | { |
| 204 | 231 | $allow_outlink_format_array = array(); |
| 205 | 232 | $allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); |
| 206 | - if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 233 | + if(!is_array($allow_outlink_format_array)) { |
|
| 234 | + $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 235 | + } |
|
| 207 | 236 | |
| 208 | 237 | foreach($allow_outlink_format_array as $val) |
| 209 | 238 | { |
@@ -225,7 +254,9 @@ discard block |
||
| 225 | 254 | { |
| 226 | 255 | $allow_outlink_site_array = array(); |
| 227 | 256 | $allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site); |
| 228 | - if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 257 | + if(!is_array($allow_outlink_site_array)) { |
|
| 258 | + $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 259 | + } |
|
| 229 | 260 | |
| 230 | 261 | foreach($allow_outlink_site_array as $val) |
| 231 | 262 | { |
@@ -237,23 +268,29 @@ discard block |
||
| 237 | 268 | } |
| 238 | 269 | } |
| 239 | 270 | } |
| 271 | + } else { |
|
| 272 | + $file_module_config->allow_outlink = 'Y'; |
|
| 240 | 273 | } |
| 241 | - else $file_module_config->allow_outlink = 'Y'; |
|
| 242 | 274 | } |
| 243 | - if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 275 | + if($file_module_config->allow_outlink != 'Y') { |
|
| 276 | + return $this->stop('msg_not_allowed_outlink'); |
|
| 277 | + } |
|
| 244 | 278 | } |
| 245 | 279 | |
| 246 | 280 | // Check if a permission for file download is granted |
| 247 | 281 | $downloadGrantCount = 0; |
| 248 | 282 | if(is_array($file_module_config->download_grant)) |
| 249 | 283 | { |
| 250 | - foreach($file_module_config->download_grant AS $value) |
|
| 251 | - if($value) $downloadGrantCount++; |
|
| 284 | + foreach($file_module_config->download_grant AS $value) { |
|
| 285 | + if($value) $downloadGrantCount++; |
|
| 286 | + } |
|
| 252 | 287 | } |
| 253 | 288 | |
| 254 | 289 | if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
| 255 | 290 | { |
| 256 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 291 | + if(!Context::get('is_logged')) { |
|
| 292 | + return $this->stop('msg_not_permitted_download'); |
|
| 293 | + } |
|
| 257 | 294 | $logged_info = Context::get('logged_info'); |
| 258 | 295 | if($logged_info->is_admin != 'Y') |
| 259 | 296 | { |
@@ -276,13 +313,17 @@ discard block |
||
| 276 | 313 | break; |
| 277 | 314 | } |
| 278 | 315 | } |
| 279 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 316 | + if(!$is_permitted) { |
|
| 317 | + return $this->stop('msg_not_permitted_download'); |
|
| 318 | + } |
|
| 280 | 319 | } |
| 281 | 320 | } |
| 282 | 321 | } |
| 283 | 322 | // Call a trigger (before) |
| 284 | 323 | $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); |
| 285 | - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
| 324 | + if(!$output->toBool()) { |
|
| 325 | + return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
| 326 | + } |
|
| 286 | 327 | |
| 287 | 328 | |
| 288 | 329 | // 다운로드 후 (가상) |
@@ -306,16 +347,23 @@ discard block |
||
| 306 | 347 | $oFileModel = getModel('file'); |
| 307 | 348 | $file_srl = Context::get('file_srl'); |
| 308 | 349 | $file_key = Context::get('file_key'); |
| 309 | - if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 350 | + if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) { |
|
| 351 | + $is_android = true; |
|
| 352 | + } |
|
| 310 | 353 | |
| 311 | - if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 312 | - else $session_key = '__XE_FILE_KEY__'; |
|
| 354 | + if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) { |
|
| 355 | + $session_key = '__XE_FILE_KEY_AND__'; |
|
| 356 | + } else { |
|
| 357 | + $session_key = '__XE_FILE_KEY__'; |
|
| 358 | + } |
|
| 313 | 359 | $columnList = array('source_filename', 'uploaded_filename', 'file_size'); |
| 314 | 360 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 315 | 361 | |
| 316 | 362 | $uploaded_filename = $file_obj->uploaded_filename; |
| 317 | 363 | |
| 318 | - if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 364 | + if(!file_exists($uploaded_filename)) { |
|
| 365 | + return $this->stop('msg_file_not_found'); |
|
| 366 | + } |
|
| 319 | 367 | |
| 320 | 368 | if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
| 321 | 369 | { |
@@ -331,29 +379,27 @@ discard block |
||
| 331 | 379 | if($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) |
| 332 | 380 | { |
| 333 | 381 | $filename_param = 'filename="' . $filename . '"'; |
| 334 | - } |
|
| 335 | - else |
|
| 382 | + } else |
|
| 336 | 383 | { |
| 337 | 384 | $filename_param = sprintf('filename="%s"; filename*=UTF-8\'\'%s', $filename, rawurlencode($filename)); |
| 338 | 385 | } |
| 339 | - } |
|
| 340 | - elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 386 | + } elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 341 | 387 | { |
| 342 | 388 | $filename_param = sprintf('filename="%s"; filename*=UTF-8\'\'%s', $filename, rawurlencode($filename)); |
| 343 | - } |
|
| 344 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 389 | + } elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 345 | 390 | { |
| 346 | 391 | $filename = rawurlencode($filename); |
| 347 | 392 | $filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"'; |
| 348 | - } |
|
| 349 | - else |
|
| 393 | + } else |
|
| 350 | 394 | { |
| 351 | 395 | $filename_param = 'filename="' . $filename . '"'; |
| 352 | 396 | } |
| 353 | 397 | |
| 354 | 398 | if($is_android) |
| 355 | 399 | { |
| 356 | - if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 400 | + if($_SESSION['__XE_FILE_KEY__'][$file_srl]) { |
|
| 401 | + $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 402 | + } |
|
| 357 | 403 | } |
| 358 | 404 | |
| 359 | 405 | unset($_SESSION[$session_key][$file_srl]); |
@@ -361,7 +407,9 @@ discard block |
||
| 361 | 407 | Context::close(); |
| 362 | 408 | |
| 363 | 409 | $fp = fopen($uploaded_filename, 'rb'); |
| 364 | - if(!$fp) return $this->stop('msg_file_not_found'); |
|
| 410 | + if(!$fp) { |
|
| 411 | + return $this->stop('msg_file_not_found'); |
|
| 412 | + } |
|
| 365 | 413 | |
| 366 | 414 | header("Cache-Control: "); |
| 367 | 415 | header("Pragma: "); |
@@ -375,10 +423,11 @@ discard block |
||
| 375 | 423 | // if file size is lager than 10MB, use fread function (#18675748) |
| 376 | 424 | if($file_size > 1024 * 1024) |
| 377 | 425 | { |
| 378 | - while(!feof($fp)) echo fread($fp, 1024); |
|
| 426 | + while(!feof($fp)) { |
|
| 427 | + echo fread($fp, 1024); |
|
| 428 | + } |
|
| 379 | 429 | fclose($fp); |
| 380 | - } |
|
| 381 | - else |
|
| 430 | + } else |
|
| 382 | 431 | { |
| 383 | 432 | fpassthru($fp); |
| 384 | 433 | } |
@@ -397,9 +446,13 @@ discard block |
||
| 397 | 446 | $editor_sequence = Context::get('editor_sequence'); |
| 398 | 447 | $file_srl = Context::get('file_srl'); |
| 399 | 448 | $file_srls = Context::get('file_srls'); |
| 400 | - if($file_srls) $file_srl = $file_srls; |
|
| 449 | + if($file_srls) { |
|
| 450 | + $file_srl = $file_srls; |
|
| 451 | + } |
|
| 401 | 452 | // Exit a session if there is neither upload permission nor information |
| 402 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 453 | + if(!$_SESSION['upload_info'][$editor_sequence]->enabled) { |
|
| 454 | + exit(); |
|
| 455 | + } |
|
| 403 | 456 | |
| 404 | 457 | $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
| 405 | 458 | |
@@ -407,26 +460,38 @@ discard block |
||
| 407 | 460 | $oFileModel = getModel('file'); |
| 408 | 461 | |
| 409 | 462 | $srls = explode(',',$file_srl); |
| 410 | - if(!count($srls)) return; |
|
| 463 | + if(!count($srls)) { |
|
| 464 | + return; |
|
| 465 | + } |
|
| 411 | 466 | |
| 412 | 467 | for($i=0;$i<count($srls);$i++) |
| 413 | 468 | { |
| 414 | 469 | $srl = (int)$srls[$i]; |
| 415 | - if(!$srl) continue; |
|
| 470 | + if(!$srl) { |
|
| 471 | + continue; |
|
| 472 | + } |
|
| 416 | 473 | |
| 417 | 474 | $args = new stdClass; |
| 418 | 475 | $args->file_srl = $srl; |
| 419 | 476 | $output = executeQuery('file.getFile', $args); |
| 420 | - if(!$output->toBool()) continue; |
|
| 477 | + if(!$output->toBool()) { |
|
| 478 | + continue; |
|
| 479 | + } |
|
| 421 | 480 | |
| 422 | 481 | $file_info = $output->data; |
| 423 | - if(!$file_info) continue; |
|
| 482 | + if(!$file_info) { |
|
| 483 | + continue; |
|
| 484 | + } |
|
| 424 | 485 | |
| 425 | 486 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
| 426 | 487 | |
| 427 | - if(!$file_grant->is_deletable) continue; |
|
| 488 | + if(!$file_grant->is_deletable) { |
|
| 489 | + continue; |
|
| 490 | + } |
|
| 428 | 491 | |
| 429 | - if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 492 | + if($upload_target_srl && $file_srl) { |
|
| 493 | + $output = $this->deleteFile($file_srl); |
|
| 494 | + } |
|
| 430 | 495 | } |
| 431 | 496 | } |
| 432 | 497 | |
@@ -437,7 +502,9 @@ discard block |
||
| 437 | 502 | */ |
| 438 | 503 | function procFileGetList() |
| 439 | 504 | { |
| 440 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 505 | + if(!Context::get('is_logged')) { |
|
| 506 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 507 | + } |
|
| 441 | 508 | |
| 442 | 509 | $oModuleModel = getModel('module'); |
| 443 | 510 | |
@@ -448,26 +515,32 @@ discard block |
||
| 448 | 515 | } |
| 449 | 516 | |
| 450 | 517 | $fileSrls = Context::get('file_srls'); |
| 451 | - if($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 518 | + if($fileSrls) { |
|
| 519 | + $fileSrlList = explode(',', $fileSrls); |
|
| 520 | + } |
|
| 452 | 521 | |
| 453 | 522 | global $lang; |
| 454 | 523 | if(count($fileSrlList) > 0) |
| 455 | 524 | { |
| 456 | 525 | $oFileModel = getModel('file'); |
| 457 | 526 | $fileList = $oFileModel->getFile($fileSrlList); |
| 458 | - if(!is_array($fileList)) $fileList = array($fileList); |
|
| 527 | + if(!is_array($fileList)) { |
|
| 528 | + $fileList = array($fileList); |
|
| 529 | + } |
|
| 459 | 530 | |
| 460 | 531 | if(is_array($fileList)) |
| 461 | 532 | { |
| 462 | 533 | foreach($fileList AS $key=>$value) |
| 463 | 534 | { |
| 464 | 535 | $value->human_file_size = FileHandler::filesize($value->file_size); |
| 465 | - if($value->isvalid=='Y') $value->validName = $lang->is_valid; |
|
| 466 | - else $value->validName = $lang->is_stand_by; |
|
| 536 | + if($value->isvalid=='Y') { |
|
| 537 | + $value->validName = $lang->is_valid; |
|
| 538 | + } else { |
|
| 539 | + $value->validName = $lang->is_stand_by; |
|
| 540 | + } |
|
| 467 | 541 | } |
| 468 | 542 | } |
| 469 | - } |
|
| 470 | - else |
|
| 543 | + } else |
|
| 471 | 544 | { |
| 472 | 545 | $fileList = array(); |
| 473 | 546 | $this->setMessage($lang->no_files); |
@@ -484,7 +557,9 @@ discard block |
||
| 484 | 557 | function triggerCheckAttached(&$obj) |
| 485 | 558 | { |
| 486 | 559 | $document_srl = $obj->document_srl; |
| 487 | - if(!$document_srl) return new BaseObject(); |
|
| 560 | + if(!$document_srl) { |
|
| 561 | + return new BaseObject(); |
|
| 562 | + } |
|
| 488 | 563 | // Get numbers of attachments |
| 489 | 564 | $oFileModel = getModel('file'); |
| 490 | 565 | $obj->uploaded_count = $oFileModel->getFilesCount($document_srl); |
@@ -501,10 +576,14 @@ discard block |
||
| 501 | 576 | function triggerAttachFiles(&$obj) |
| 502 | 577 | { |
| 503 | 578 | $document_srl = $obj->document_srl; |
| 504 | - if(!$document_srl) return new BaseObject(); |
|
| 579 | + if(!$document_srl) { |
|
| 580 | + return new BaseObject(); |
|
| 581 | + } |
|
| 505 | 582 | |
| 506 | 583 | $output = $this->setFilesValid($document_srl); |
| 507 | - if(!$output->toBool()) return $output; |
|
| 584 | + if(!$output->toBool()) { |
|
| 585 | + return $output; |
|
| 586 | + } |
|
| 508 | 587 | |
| 509 | 588 | return new BaseObject(); |
| 510 | 589 | } |
@@ -518,7 +597,9 @@ discard block |
||
| 518 | 597 | function triggerDeleteAttached(&$obj) |
| 519 | 598 | { |
| 520 | 599 | $document_srl = $obj->document_srl; |
| 521 | - if(!$document_srl) return new BaseObject(); |
|
| 600 | + if(!$document_srl) { |
|
| 601 | + return new BaseObject(); |
|
| 602 | + } |
|
| 522 | 603 | |
| 523 | 604 | $output = $this->deleteFiles($document_srl); |
| 524 | 605 | return $output; |
@@ -533,7 +614,9 @@ discard block |
||
| 533 | 614 | function triggerCommentCheckAttached(&$obj) |
| 534 | 615 | { |
| 535 | 616 | $comment_srl = $obj->comment_srl; |
| 536 | - if(!$comment_srl) return new BaseObject(); |
|
| 617 | + if(!$comment_srl) { |
|
| 618 | + return new BaseObject(); |
|
| 619 | + } |
|
| 537 | 620 | // Get numbers of attachments |
| 538 | 621 | $oFileModel = getModel('file'); |
| 539 | 622 | $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl); |
@@ -551,10 +634,14 @@ discard block |
||
| 551 | 634 | { |
| 552 | 635 | $comment_srl = $obj->comment_srl; |
| 553 | 636 | $uploaded_count = $obj->uploaded_count; |
| 554 | - if(!$comment_srl || !$uploaded_count) return new BaseObject(); |
|
| 637 | + if(!$comment_srl || !$uploaded_count) { |
|
| 638 | + return new BaseObject(); |
|
| 639 | + } |
|
| 555 | 640 | |
| 556 | 641 | $output = $this->setFilesValid($comment_srl); |
| 557 | - if(!$output->toBool()) return $output; |
|
| 642 | + if(!$output->toBool()) { |
|
| 643 | + return $output; |
|
| 644 | + } |
|
| 558 | 645 | |
| 559 | 646 | return new BaseObject(); |
| 560 | 647 | } |
@@ -568,9 +655,13 @@ discard block |
||
| 568 | 655 | function triggerCommentDeleteAttached(&$obj) |
| 569 | 656 | { |
| 570 | 657 | $comment_srl = $obj->comment_srl; |
| 571 | - if(!$comment_srl) return new BaseObject(); |
|
| 658 | + if(!$comment_srl) { |
|
| 659 | + return new BaseObject(); |
|
| 660 | + } |
|
| 572 | 661 | |
| 573 | - if($obj->isMoveToTrash) return new BaseObject(); |
|
| 662 | + if($obj->isMoveToTrash) { |
|
| 663 | + return new BaseObject(); |
|
| 664 | + } |
|
| 574 | 665 | |
| 575 | 666 | $output = $this->deleteFiles($comment_srl); |
| 576 | 667 | return $output; |
@@ -585,7 +676,9 @@ discard block |
||
| 585 | 676 | function triggerDeleteModuleFiles(&$obj) |
| 586 | 677 | { |
| 587 | 678 | $module_srl = $obj->module_srl; |
| 588 | - if(!$module_srl) return new BaseObject(); |
|
| 679 | + if(!$module_srl) { |
|
| 680 | + return new BaseObject(); |
|
| 681 | + } |
|
| 589 | 682 | |
| 590 | 683 | $oFileController = getAdminController('file'); |
| 591 | 684 | return $oFileController->deleteModuleFiles($module_srl); |
@@ -660,7 +753,9 @@ discard block |
||
| 660 | 753 | $trigger_obj->module_srl = $module_srl; |
| 661 | 754 | $trigger_obj->upload_target_srl = $upload_target_srl; |
| 662 | 755 | $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); |
| 663 | - if(!$output->toBool()) return $output; |
|
| 756 | + if(!$output->toBool()) { |
|
| 757 | + return $output; |
|
| 758 | + } |
|
| 664 | 759 | |
| 665 | 760 | // A workaround for Firefox upload bug |
| 666 | 761 | if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
@@ -698,13 +793,17 @@ discard block |
||
| 698 | 793 | $allowed_filesize = $config->allowed_filesize * 1024 * 1024; |
| 699 | 794 | $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; |
| 700 | 795 | // An error appears if file size exceeds a limit |
| 701 | - if($allowed_filesize < filesize($file_info['tmp_name'])) return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 796 | + if($allowed_filesize < filesize($file_info['tmp_name'])) { |
|
| 797 | + return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 798 | + } |
|
| 702 | 799 | // Get total file size of all attachements (from DB) |
| 703 | 800 | $size_args = new stdClass; |
| 704 | 801 | $size_args->upload_target_srl = $upload_target_srl; |
| 705 | 802 | $output = executeQuery('file.getAttachedFileSize', $size_args); |
| 706 | 803 | $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']); |
| 707 | - if($attached_size > $allowed_attach_size) return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 804 | + if($attached_size > $allowed_attach_size) { |
|
| 805 | + return new BaseObject(-1, 'msg_exceeds_limit_size'); |
|
| 806 | + } |
|
| 708 | 807 | } |
| 709 | 808 | } |
| 710 | 809 | |
@@ -735,18 +834,21 @@ discard block |
||
| 735 | 834 | $idx++; |
| 736 | 835 | } |
| 737 | 836 | $direct_download = 'Y'; |
| 738 | - } |
|
| 739 | - else |
|
| 837 | + } else |
|
| 740 | 838 | { |
| 741 | 839 | $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
| 742 | 840 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
| 743 | 841 | $direct_download = 'N'; |
| 744 | 842 | } |
| 745 | 843 | // Create a directory |
| 746 | - if(!FileHandler::makeDir($path)) return new BaseObject(-1,'msg_not_permitted_create'); |
|
| 844 | + if(!FileHandler::makeDir($path)) { |
|
| 845 | + return new BaseObject(-1,'msg_not_permitted_create'); |
|
| 846 | + } |
|
| 747 | 847 | |
| 748 | 848 | // Check uploaded file |
| 749 | - if(!checkUploadedFile($file_info['tmp_name'])) return new BaseObject(-1,'msg_file_upload_error'); |
|
| 849 | + if(!checkUploadedFile($file_info['tmp_name'])) { |
|
| 850 | + return new BaseObject(-1,'msg_file_upload_error'); |
|
| 851 | + } |
|
| 750 | 852 | |
| 751 | 853 | // Get random number generator |
| 752 | 854 | $random = new Password(); |
@@ -760,13 +862,14 @@ discard block |
||
| 760 | 862 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 761 | 863 | @copy($file_info['tmp_name'], $filename); |
| 762 | 864 | } |
| 763 | - } |
|
| 764 | - else |
|
| 865 | + } else |
|
| 765 | 866 | { |
| 766 | 867 | if(!@move_uploaded_file($file_info['tmp_name'], $filename)) |
| 767 | 868 | { |
| 768 | 869 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 769 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new BaseObject(-1,'msg_file_upload_error'); |
|
| 870 | + if(!@move_uploaded_file($file_info['tmp_name'], $filename)) { |
|
| 871 | + return new BaseObject(-1,'msg_file_upload_error'); |
|
| 872 | + } |
|
| 770 | 873 | } |
| 771 | 874 | } |
| 772 | 875 | // Get member information |
@@ -787,10 +890,14 @@ discard block |
||
| 787 | 890 | $args->sid = $random->createSecureSalt(32, 'hex'); |
| 788 | 891 | |
| 789 | 892 | $output = executeQuery('file.insertFile', $args); |
| 790 | - if(!$output->toBool()) return $output; |
|
| 893 | + if(!$output->toBool()) { |
|
| 894 | + return $output; |
|
| 895 | + } |
|
| 791 | 896 | // Call a trigger (after) |
| 792 | 897 | $trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); |
| 793 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 898 | + if(!$trigger_output->toBool()) { |
|
| 899 | + return $trigger_output; |
|
| 900 | + } |
|
| 794 | 901 | |
| 795 | 902 | $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; |
| 796 | 903 | |
@@ -833,10 +940,14 @@ discard block |
||
| 833 | 940 | */ |
| 834 | 941 | function deleteFile($file_srl) |
| 835 | 942 | { |
| 836 | - if(!$file_srl) return; |
|
| 943 | + if(!$file_srl) { |
|
| 944 | + return; |
|
| 945 | + } |
|
| 837 | 946 | |
| 838 | 947 | $srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl); |
| 839 | - if(!count($srls)) return; |
|
| 948 | + if(!count($srls)) { |
|
| 949 | + return; |
|
| 950 | + } |
|
| 840 | 951 | |
| 841 | 952 | $oDocumentController = getController('document'); |
| 842 | 953 | $documentSrlList = array(); |
@@ -871,15 +982,21 @@ discard block |
||
| 871 | 982 | // Call a trigger (before) |
| 872 | 983 | $trigger_obj = $output->data; |
| 873 | 984 | $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); |
| 874 | - if(!$output->toBool()) return $output; |
|
| 985 | + if(!$output->toBool()) { |
|
| 986 | + return $output; |
|
| 987 | + } |
|
| 875 | 988 | |
| 876 | 989 | // Remove from the DB |
| 877 | 990 | $output = executeQuery('file.deleteFile', $args); |
| 878 | - if(!$output->toBool()) return $output; |
|
| 991 | + if(!$output->toBool()) { |
|
| 992 | + return $output; |
|
| 993 | + } |
|
| 879 | 994 | |
| 880 | 995 | // Call a trigger (after) |
| 881 | 996 | $trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); |
| 882 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 997 | + if(!$trigger_output->toBool()) { |
|
| 998 | + return $trigger_output; |
|
| 999 | + } |
|
| 883 | 1000 | |
| 884 | 1001 | // If successfully deleted, remove the file |
| 885 | 1002 | FileHandler::removeFile($uploaded_filename); |
@@ -903,7 +1020,9 @@ discard block |
||
| 903 | 1020 | $columnList = array('file_srl', 'uploaded_filename', 'module_srl'); |
| 904 | 1021 | $file_list = $oFileModel->getFiles($upload_target_srl, $columnList); |
| 905 | 1022 | // Success returned if no attachement exists |
| 906 | - if(!is_array($file_list)||!count($file_list)) return new BaseObject(); |
|
| 1023 | + if(!is_array($file_list)||!count($file_list)) { |
|
| 1024 | + return new BaseObject(); |
|
| 1025 | + } |
|
| 907 | 1026 | |
| 908 | 1027 | // Delete the file |
| 909 | 1028 | $path = array(); |
@@ -914,14 +1033,18 @@ discard block |
||
| 914 | 1033 | |
| 915 | 1034 | $uploaded_filename = $file_list[$i]->uploaded_filename; |
| 916 | 1035 | $path_info = pathinfo($uploaded_filename); |
| 917 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 1036 | + if(!in_array($path_info['dirname'], $path)) { |
|
| 1037 | + $path[] = $path_info['dirname']; |
|
| 1038 | + } |
|
| 918 | 1039 | } |
| 919 | 1040 | |
| 920 | 1041 | // Remove from the DB |
| 921 | 1042 | $args = new stdClass(); |
| 922 | 1043 | $args->upload_target_srl = $upload_target_srl; |
| 923 | 1044 | $output = executeQuery('file.deleteFiles', $args); |
| 924 | - if(!$output->toBool()) return $output; |
|
| 1045 | + if(!$output->toBool()) { |
|
| 1046 | + return $output; |
|
| 1047 | + } |
|
| 925 | 1048 | |
| 926 | 1049 | // Remove a file directory of the document |
| 927 | 1050 | for($i=0, $c=count($path); $i<$c; $i++) |
@@ -942,11 +1065,15 @@ discard block |
||
| 942 | 1065 | */ |
| 943 | 1066 | function moveFile($source_srl, $target_module_srl, $target_srl) |
| 944 | 1067 | { |
| 945 | - if($source_srl == $target_srl) return; |
|
| 1068 | + if($source_srl == $target_srl) { |
|
| 1069 | + return; |
|
| 1070 | + } |
|
| 946 | 1071 | |
| 947 | 1072 | $oFileModel = getModel('file'); |
| 948 | 1073 | $file_list = $oFileModel->getFiles($source_srl); |
| 949 | - if(!$file_list) return; |
|
| 1074 | + if(!$file_list) { |
|
| 1075 | + return; |
|
| 1076 | + } |
|
| 950 | 1077 | |
| 951 | 1078 | $file_count = count($file_list); |
| 952 | 1079 | |
@@ -960,15 +1087,16 @@ discard block |
||
| 960 | 1087 | { |
| 961 | 1088 | $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); |
| 962 | 1089 | $new_file = $path.$file_info->source_filename; |
| 963 | - } |
|
| 964 | - else |
|
| 1090 | + } else |
|
| 965 | 1091 | { |
| 966 | 1092 | $path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl); |
| 967 | 1093 | $random = new Password(); |
| 968 | 1094 | $new_file = $path.$random->createSecureSalt(32, 'hex'); |
| 969 | 1095 | } |
| 970 | 1096 | // Pass if a target document to move is same |
| 971 | - if($old_file == $new_file) continue; |
|
| 1097 | + if($old_file == $new_file) { |
|
| 1098 | + continue; |
|
| 1099 | + } |
|
| 972 | 1100 | // Create a directory |
| 973 | 1101 | FileHandler::makeDir($path); |
| 974 | 1102 | // Move the file |
@@ -988,16 +1116,22 @@ discard block |
||
| 988 | 1116 | $vars = Context::getRequestVars(); |
| 989 | 1117 | $logged_info = Context::get('logged_info'); |
| 990 | 1118 | |
| 991 | - if(!$vars->editor_sequence) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1119 | + if(!$vars->editor_sequence) { |
|
| 1120 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1121 | + } |
|
| 992 | 1122 | |
| 993 | 1123 | $upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl; |
| 994 | 1124 | |
| 995 | 1125 | $oFileModel = getModel('file'); |
| 996 | 1126 | $file_info = $oFileModel->getFile($vars->file_srl); |
| 997 | 1127 | |
| 998 | - if(!$file_info) return new BaseObject(-1, 'msg_not_founded'); |
|
| 1128 | + if(!$file_info) { |
|
| 1129 | + return new BaseObject(-1, 'msg_not_founded'); |
|
| 1130 | + } |
|
| 999 | 1131 | |
| 1000 | - if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1132 | + if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) { |
|
| 1133 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1134 | + } |
|
| 1001 | 1135 | |
| 1002 | 1136 | $args = new stdClass(); |
| 1003 | 1137 | $args->file_srl = $vars->file_srl; |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | $filename = Context::get('filename'); |
| 44 | 44 | $isExists = 'false'; |
| 45 | 45 | |
| 46 | - if(strncasecmp('http://', $filename, 7) === 0) |
|
| 46 | + if (strncasecmp('http://', $filename, 7) === 0) |
|
| 47 | 47 | { |
| 48 | - if(ini_get('allow_url_fopen')) |
|
| 48 | + if (ini_get('allow_url_fopen')) |
|
| 49 | 49 | { |
| 50 | 50 | $fp = @fopen($filename, "r"); |
| 51 | - if($fp) |
|
| 51 | + if ($fp) |
|
| 52 | 52 | { |
| 53 | 53 | $str = fgets($fp, 100); |
| 54 | - if(strlen($str) > 0) |
|
| 54 | + if (strlen($str) > 0) |
|
| 55 | 55 | { |
| 56 | 56 | $isExists = 'true'; |
| 57 | 57 | $type = 'XML'; |
| 58 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
| 58 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
| 59 | 59 | |
| 60 | 60 | $this->add('type', $type); |
| 61 | 61 | } |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $realPath = FileHandler::getRealPath($filename); |
| 74 | 74 | |
| 75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
| 75 | + if (file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
| 76 | 76 | $this->add('exists', $isExists); |
| 77 | 77 | |
| 78 | - if($isExists == 'true') |
|
| 78 | + if ($isExists == 'true') |
|
| 79 | 79 | { |
| 80 | 80 | $type = 'XML'; |
| 81 | 81 | |
| 82 | 82 | $fp = fopen($realPath, "r"); |
| 83 | 83 | $str = fgets($fp, 100); |
| 84 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
| 84 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
| 85 | 85 | fclose($fp); |
| 86 | 86 | |
| 87 | 87 | $this->add('type', $type); |
@@ -107,16 +107,16 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | /* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다. |
| 109 | 109 | CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */ |
| 110 | - $db_info = Context::getDBInfo (); |
|
| 111 | - if($db_info->db_type != "cubrid") |
|
| 110 | + $db_info = Context::getDBInfo(); |
|
| 111 | + if ($db_info->db_type != "cubrid") |
|
| 112 | 112 | { |
| 113 | 113 | $output = executeQuery('importer.updateDocumentSync'.$postFix); |
| 114 | 114 | $output = executeQuery('importer.updateCommentSync'.$postFix); |
| 115 | 115 | } |
| 116 | 116 | else |
| 117 | 117 | { |
| 118 | - $output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); |
|
| 119 | - if(is_array ($output->data) && count ($output->data)) |
|
| 118 | + $output = executeQueryArray('importer.getDocumentMemberSrlWithUserID'.$postFix); |
|
| 119 | + if (is_array($output->data) && count($output->data)) |
|
| 120 | 120 | { |
| 121 | 121 | $success_count = 0; |
| 122 | 122 | $error_count = 0; |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $args->user_id = $val->user_id; |
| 127 | 127 | $args->member_srl = $val->member_srl; |
| 128 | - $tmp = executeQuery ('importer.updateDocumentSyncForCUBRID'.$postFix, $args); |
|
| 129 | - if($tmp->toBool () === true) |
|
| 128 | + $tmp = executeQuery('importer.updateDocumentSyncForCUBRID'.$postFix, $args); |
|
| 129 | + if ($tmp->toBool() === true) |
|
| 130 | 130 | { |
| 131 | 131 | $success_count++; |
| 132 | 132 | } |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | } // documents section |
| 140 | 140 | |
| 141 | - $output = executeQueryArray ('importer.getCommentMemberSrlWithUserID'.$postFix); |
|
| 142 | - if(is_array ($output->data) && count ($output->data)) |
|
| 141 | + $output = executeQueryArray('importer.getCommentMemberSrlWithUserID'.$postFix); |
|
| 142 | + if (is_array($output->data) && count($output->data)) |
|
| 143 | 143 | { |
| 144 | 144 | $success_count = 0; |
| 145 | 145 | $error_count = 0; |
@@ -148,8 +148,8 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | $args->user_id = $val->user_id; |
| 150 | 150 | $args->member_srl = $val->member_srl; |
| 151 | - $tmp = executeQuery ('importer.updateCommentSyncForCUBRID'.$postFix, $args); |
|
| 152 | - if($tmp->toBool () === true) |
|
| 151 | + $tmp = executeQuery('importer.updateCommentSyncForCUBRID'.$postFix, $args); |
|
| 152 | + if ($tmp->toBool() === true) |
|
| 153 | 153 | { |
| 154 | 154 | $success_count++; |
| 155 | 155 | } |
@@ -178,15 +178,15 @@ discard block |
||
| 178 | 178 | // Extract and cache information from the xml file |
| 179 | 179 | $oExtract = new extract(); |
| 180 | 180 | |
| 181 | - switch($type) |
|
| 181 | + switch ($type) |
|
| 182 | 182 | { |
| 183 | 183 | case 'member' : |
| 184 | - $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>'); |
|
| 185 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 184 | + $output = $oExtract->set($xml_file, '<members ', '</members>', '<member>', '</member>'); |
|
| 185 | + if ($output->toBool()) $oExtract->saveItems(); |
|
| 186 | 186 | break; |
| 187 | 187 | case 'message' : |
| 188 | - $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>'); |
|
| 189 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 188 | + $output = $oExtract->set($xml_file, '<messages ', '</messages>', '<message>', '</message>'); |
|
| 189 | + if ($output->toBool()) $oExtract->saveItems(); |
|
| 190 | 190 | break; |
| 191 | 191 | case 'ttxml' : |
| 192 | 192 | // Category information |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | while (!feof($oExtract->fd)) |
| 200 | 200 | { |
| 201 | 201 | $str = fgets($oExtract->fd, 1024); |
| 202 | - if(strstr($str, '<category>')) |
|
| 202 | + if (strstr($str, '<category>')) |
|
| 203 | 203 | { |
| 204 | 204 | $started = true; |
| 205 | 205 | $str = strstr($str, '<category>'); |
| 206 | 206 | } |
| 207 | - if(substr($str,0,strlen('<post ')) == '<post ') break; |
|
| 207 | + if (substr($str, 0, strlen('<post ')) == '<post ') break; |
|
| 208 | 208 | if ($started) $buff .= $str; |
| 209 | 209 | } |
| 210 | 210 | $buff = '<categories>'.$buff.'</categories>'; |
@@ -214,22 +214,22 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | // Guestbook information |
| 216 | 216 | $output = $oExtract->set($xml_file, '', '', '', ''); |
| 217 | - if($output->toBool()) |
|
| 217 | + if ($output->toBool()) |
|
| 218 | 218 | { |
| 219 | 219 | $started = false; |
| 220 | 220 | $buff = ''; |
| 221 | 221 | while (!feof($oExtract->fd)) |
| 222 | 222 | { |
| 223 | 223 | $str = fgets($oExtract->fd, 1024); |
| 224 | - if(strstr($str, '<guestbook>')) |
|
| 224 | + if (strstr($str, '<guestbook>')) |
|
| 225 | 225 | { |
| 226 | 226 | $started = true; |
| 227 | 227 | $str = strstr($str, '<guestbook>'); |
| 228 | 228 | } |
| 229 | - if($started) |
|
| 229 | + if ($started) |
|
| 230 | 230 | { |
| 231 | 231 | $pos = strpos($str, '</guestbook>'); |
| 232 | - if($pos !== false) |
|
| 232 | + if ($pos !== false) |
|
| 233 | 233 | { |
| 234 | 234 | $buff .= substr($str, 0, $pos + strlen('</guestbook>')); |
| 235 | 235 | break; |
@@ -241,37 +241,37 @@ discard block |
||
| 241 | 241 | $guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml'); |
| 242 | 242 | FileHandler::writeFile($guestbook_filename, $buff); |
| 243 | 243 | // Individual items |
| 244 | - $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>'); |
|
| 245 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 244 | + $output = $oExtract->set($xml_file, '<blog', '</blog>', '<post ', '</post>'); |
|
| 245 | + if ($output->toBool()) $oExtract->saveItems(); |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | break; |
| 249 | 249 | default : |
| 250 | 250 | // First get category information |
| 251 | - $output = $oExtract->set($xml_file,'<categories>', '</categories>', '<category','</category>'); |
|
| 252 | - if($output->toBool()) |
|
| 251 | + $output = $oExtract->set($xml_file, '<categories>', '</categories>', '<category', '</category>'); |
|
| 252 | + if ($output->toBool()) |
|
| 253 | 253 | { |
| 254 | 254 | $oExtract->mergeItems('category.xml'); |
| 255 | 255 | // Get each item |
| 256 | - $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>'); |
|
| 257 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 256 | + $output = $oExtract->set($xml_file, '<posts ', '</posts>', '<post>', '</post>'); |
|
| 257 | + if ($output->toBool()) $oExtract->saveItems(); |
|
| 258 | 258 | } |
| 259 | 259 | break; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - if(!$output->toBool()) |
|
| 262 | + if (!$output->toBool()) |
|
| 263 | 263 | { |
| 264 | - $this->add('error',0); |
|
| 265 | - $this->add('status',-1); |
|
| 264 | + $this->add('error', 0); |
|
| 265 | + $this->add('status', -1); |
|
| 266 | 266 | $this->setMessage($output->getMessage()); |
| 267 | 267 | return; |
| 268 | 268 | } |
| 269 | 269 | // Notify that all data completely extracted |
| 270 | - $this->add('type',$type); |
|
| 271 | - $this->add('total',$oExtract->getTotalCount()); |
|
| 272 | - $this->add('cur',0); |
|
| 270 | + $this->add('type', $type); |
|
| 271 | + $this->add('total', $oExtract->getTotalCount()); |
|
| 272 | + $this->add('cur', 0); |
|
| 273 | 273 | $this->add('key', $oExtract->getKey()); |
| 274 | - $this->add('status',0); |
|
| 274 | + $this->add('status', 0); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -291,19 +291,19 @@ discard block |
||
| 291 | 291 | $this->unit_count = Context::get('unit_count'); |
| 292 | 292 | // Check if an index file exists |
| 293 | 293 | $index_file = './files/cache/importer/'.$key.'/index'; |
| 294 | - if(!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
| 294 | + if (!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
| 295 | 295 | |
| 296 | - switch($type) |
|
| 296 | + switch ($type) |
|
| 297 | 297 | { |
| 298 | 298 | case 'ttxml' : |
| 299 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
| 299 | + if (!$target_module) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 300 | 300 | |
| 301 | 301 | $oModuleModel = getModel('module'); |
| 302 | 302 | $columnList = array('module_srl', 'module'); |
| 303 | 303 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList); |
| 304 | 304 | |
| 305 | - $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
|
| 306 | - if($ttimporter) require_once($ttimporter); |
|
| 305 | + $ttimporter = FileHandler::exists(_XE_PATH_.'modules/importer/ttimport.class.php'); |
|
| 306 | + if ($ttimporter) require_once($ttimporter); |
|
| 307 | 307 | |
| 308 | 308 | $oTT = new ttimport(); |
| 309 | 309 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module); |
@@ -316,23 +316,23 @@ discard block |
||
| 316 | 316 | break; |
| 317 | 317 | case 'module' : |
| 318 | 318 | // Check if the target module exists |
| 319 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
| 319 | + if (!$target_module) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 320 | 320 | $cur = $this->importModule($key, $cur, $index_file, $target_module); |
| 321 | 321 | break; |
| 322 | 322 | } |
| 323 | 323 | // Notify that all data completely extracted |
| 324 | - $this->add('type',$type); |
|
| 325 | - $this->add('total',$total); |
|
| 326 | - $this->add('cur',$cur); |
|
| 324 | + $this->add('type', $type); |
|
| 325 | + $this->add('total', $total); |
|
| 326 | + $this->add('cur', $cur); |
|
| 327 | 327 | $this->add('key', $key); |
| 328 | 328 | $this->add('target_module', $target_module); |
| 329 | 329 | // When completing, success message appears and remove the cache files |
| 330 | - if($total <= $cur) |
|
| 330 | + if ($total <= $cur) |
|
| 331 | 331 | { |
| 332 | - $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); |
|
| 332 | + $this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total)); |
|
| 333 | 333 | FileHandler::removeDir('./files/cache/importer/'.$key); |
| 334 | 334 | } |
| 335 | - else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
| 335 | + else $this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur)); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /** |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | function importMember($key, $cur, $index_file) |
| 346 | 346 | { |
| 347 | - if(!$cur) $cur = 0; |
|
| 347 | + if (!$cur) $cur = 0; |
|
| 348 | 348 | // Create the xmlParser object |
| 349 | 349 | $oXmlParser = new XmlParser(); |
| 350 | 350 | // Create objects for importing member information |
@@ -357,19 +357,19 @@ discard block |
||
| 357 | 357 | $oModuleModel = getModel('module'); |
| 358 | 358 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 359 | 359 | // Open an index file |
| 360 | - $f = fopen($index_file,"r"); |
|
| 360 | + $f = fopen($index_file, "r"); |
|
| 361 | 361 | // Pass if already read |
| 362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 362 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
| 363 | 363 | // Read by each line until the condition meets |
| 364 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
| 364 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
| 365 | 365 | { |
| 366 | - if(feof($f)) break; |
|
| 366 | + if (feof($f)) break; |
|
| 367 | 367 | // Find a given location |
| 368 | 368 | $target_file = trim(fgets($f, 1024)); |
| 369 | 369 | // Load and parse the file |
| 370 | 370 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
| 371 | 371 | FileHandler::removeFile($target_file); |
| 372 | - if(!$xmlObj) continue; |
|
| 372 | + if (!$xmlObj) continue; |
|
| 373 | 373 | // List Objects |
| 374 | 374 | $obj = new stdClass(); |
| 375 | 375 | $obj->member_srl = getNextSequence(); |
@@ -377,11 +377,11 @@ discard block |
||
| 377 | 377 | $obj->password = base64_decode($xmlObj->member->password->body); |
| 378 | 378 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
| 379 | 379 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
| 380 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 380 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 381 | 381 | $obj->email_address = base64_decode($xmlObj->member->email->body); |
| 382 | 382 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
| 383 | 383 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
| 384 | - $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body),0,8); |
|
| 384 | + $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8); |
|
| 385 | 385 | $obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body); |
| 386 | 386 | $obj->point = base64_decode($xmlObj->member->point->body); |
| 387 | 387 | $obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body); |
@@ -391,38 +391,38 @@ discard block |
||
| 391 | 391 | $obj->regdate = base64_decode($xmlObj->member->regdate->body); |
| 392 | 392 | $obj->last_login = base64_decode($xmlObj->member->last_login->body); |
| 393 | 393 | |
| 394 | - if($xmlObj->member->extra_vars) |
|
| 394 | + if ($xmlObj->member->extra_vars) |
|
| 395 | 395 | { |
| 396 | - foreach($xmlObj->member->extra_vars as $key => $val) |
|
| 396 | + foreach ($xmlObj->member->extra_vars as $key => $val) |
|
| 397 | 397 | { |
| 398 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
| 398 | + if (in_array($key, array('node_name', 'attrs', 'body'))) continue; |
|
| 399 | 399 | $obj->extra_vars->{$key} = base64_decode($val->body); |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | // Create url for homepage and blog |
| 403 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
| 403 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
| 404 | 404 | // Check user ID |
| 405 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 405 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 406 | 406 | { |
| 407 | 407 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
| 408 | 408 | } |
| 409 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 409 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 410 | 410 | { |
| 411 | - $obj->user_id = 't' . $obj->member_srl; |
|
| 411 | + $obj->user_id = 't'.$obj->member_srl; |
|
| 412 | 412 | } |
| 413 | 413 | // Check email address |
| 414 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
| 414 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
| 415 | 415 | { |
| 416 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
| 416 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
| 417 | 417 | } |
| 418 | 418 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email); |
| 419 | 419 | // Set the mailing option |
| 420 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
| 420 | + if ($obj->allow_mailing != 'Y') $obj->allow_mailing = 'N'; |
|
| 421 | 421 | // Set the message option |
| 422 | 422 | $obj->allow_message = 'Y'; |
| 423 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
| 423 | + if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) $obj->allow_message = 'Y'; |
|
| 424 | 424 | // Get member-join date if the last login time is not found |
| 425 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
| 425 | + if (!$obj->last_login) $obj->last_login = $obj->regdate; |
|
| 426 | 426 | // Set the list order |
| 427 | 427 | $obj->list_order = -1 * $obj->member_srl; |
| 428 | 428 | // List extra vars |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $args = new stdClass; |
| 434 | 434 | $args->user_id = $obj->user_id; |
| 435 | 435 | $output = executeQuery('member.getMemberSrl', $args); |
| 436 | - if(!$output->toBool() || $output->data) |
|
| 436 | + if (!$output->toBool() || $output->data) |
|
| 437 | 437 | { |
| 438 | 438 | $obj->user_id .= '_'.$obj->member_srl; |
| 439 | 439 | } |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $args = new stdClass; |
| 442 | 442 | $args->nick_name = $obj->nick_name; |
| 443 | 443 | $output = executeQuery('member.getMemberSrl', $args); |
| 444 | - if(!$output->toBool() || $output->data) |
|
| 444 | + if (!$output->toBool() || $output->data) |
|
| 445 | 445 | { |
| 446 | 446 | $obj->user_id .= '_'.$obj->member_srl; |
| 447 | 447 | } |
@@ -449,67 +449,67 @@ discard block |
||
| 449 | 449 | $args = new stdClass; |
| 450 | 450 | $args->email_address = $obj->email_address; |
| 451 | 451 | $output = executeQuery('member.getMemberSrl', $args); |
| 452 | - if(!$output->toBool() || $output->data) |
|
| 452 | + if (!$output->toBool() || $output->data) |
|
| 453 | 453 | { |
| 454 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
| 454 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | // Add a member |
| 458 | 458 | $output = executeQuery('member.insertMember', $obj); |
| 459 | 459 | |
| 460 | - if($output->toBool() && !($obj->password)) |
|
| 460 | + if ($output->toBool() && !($obj->password)) |
|
| 461 | 461 | { |
| 462 | 462 | // Send a mail telling the user to reset his password. |
| 463 | 463 | $oMail = new Mail(); |
| 464 | - $oMail->setTitle("Password update for your " . getFullSiteUrl() . " account"); |
|
| 465 | - $webmaster_name = $member_config->webmaster_name?$member_config->webmaster_name:'Webmaster'; |
|
| 464 | + $oMail->setTitle("Password update for your ".getFullSiteUrl()." account"); |
|
| 465 | + $webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster'; |
|
| 466 | 466 | $oMail->setContent("Dear $obj->user_name, <br /><br /> |
| 467 | 467 | We recently migrated our site to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link: |
| 468 | - <a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br /> |
|
| 468 | + <a href='".getFullSiteUrl()."/?act=dispMemberFindAccount' >".getFullSiteUrl()."?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br /> |
|
| 469 | 469 | |
| 470 | 470 | Thank you for your understanding,<br /> |
| 471 | 471 | {$webmaster_name}" |
| 472 | 472 | ); |
| 473 | 473 | $oMail->setSender($webmaster_name, $member_config->webmaster_email); |
| 474 | - $oMail->setReceiptor( $obj->user_name, $obj->email); |
|
| 474 | + $oMail->setReceiptor($obj->user_name, $obj->email); |
|
| 475 | 475 | $oMail->send(); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // add group join/image name-mark-signiture and so on if a new member successfully added |
| 479 | - if($output->toBool()) |
|
| 479 | + if ($output->toBool()) |
|
| 480 | 480 | { |
| 481 | 481 | // Join to the default group |
| 482 | 482 | $obj->group_srl = $default_group_srl; |
| 483 | - executeQuery('member.addMemberToGroup',$obj); |
|
| 483 | + executeQuery('member.addMemberToGroup', $obj); |
|
| 484 | 484 | // Image name |
| 485 | - if($obj->image_nickname) |
|
| 485 | + if ($obj->image_nickname) |
|
| 486 | 486 | { |
| 487 | 487 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl)); |
| 488 | 488 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
| 489 | 489 | FileHandler::writeFile($target_filename, $obj->image_nickname); |
| 490 | 490 | } |
| 491 | 491 | // Image mark |
| 492 | - if($obj->image_mark && file_exists($obj->image_mark)) |
|
| 492 | + if ($obj->image_mark && file_exists($obj->image_mark)) |
|
| 493 | 493 | { |
| 494 | 494 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl)); |
| 495 | 495 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
| 496 | 496 | FileHandler::writeFile($target_filename, $obj->image_mark); |
| 497 | 497 | } |
| 498 | 498 | // Profile image |
| 499 | - if($obj->profile_image) |
|
| 499 | + if ($obj->profile_image) |
|
| 500 | 500 | { |
| 501 | 501 | $target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl)); |
| 502 | 502 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
| 503 | 503 | FileHandler::writeFile($target_filename, $obj->profile_image); |
| 504 | 504 | } |
| 505 | 505 | // Signiture |
| 506 | - if($obj->signature) |
|
| 506 | + if ($obj->signature) |
|
| 507 | 507 | { |
| 508 | 508 | $signature = removeHackTag($obj->signature); |
| 509 | 509 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 510 | 510 | |
| 511 | 511 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
| 512 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
| 512 | + if (!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
| 513 | 513 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
| 514 | 514 | |
| 515 | 515 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | fclose($f); |
| 521 | 521 | |
| 522 | - return $idx-1; |
|
| 522 | + return $idx - 1; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | /** |
@@ -531,58 +531,58 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | function importMessage($key, $cur, $index_file) |
| 533 | 533 | { |
| 534 | - if(!$cur) $cur = 0; |
|
| 534 | + if (!$cur) $cur = 0; |
|
| 535 | 535 | // Create the xmlParser object |
| 536 | 536 | $oXmlParser = new XmlParser(); |
| 537 | 537 | // Open an index file |
| 538 | - $f = fopen($index_file,"r"); |
|
| 538 | + $f = fopen($index_file, "r"); |
|
| 539 | 539 | // Pass if already read |
| 540 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 540 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
| 541 | 541 | // Read each line until the condition meets |
| 542 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
| 542 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
| 543 | 543 | { |
| 544 | - if(feof($f)) break; |
|
| 544 | + if (feof($f)) break; |
|
| 545 | 545 | // Find a location |
| 546 | 546 | $target_file = trim(fgets($f, 1024)); |
| 547 | 547 | // Load and parse the file |
| 548 | 548 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
| 549 | 549 | FileHandler::removeFile($target_file); |
| 550 | - if(!$xmlObj) continue; |
|
| 550 | + if (!$xmlObj) continue; |
|
| 551 | 551 | // List objects |
| 552 | 552 | $obj = null; |
| 553 | 553 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
| 554 | 554 | $obj->sender = base64_decode($xmlObj->message->sender->body); |
| 555 | 555 | $obj->title = base64_decode($xmlObj->message->title->body); |
| 556 | 556 | $obj->content = base64_decode($xmlObj->message->content->body); |
| 557 | - $obj->readed = base64_decode($xmlObj->message->readed->body)=='Y'?'Y':'N'; |
|
| 557 | + $obj->readed = base64_decode($xmlObj->message->readed->body) == 'Y' ? 'Y' : 'N'; |
|
| 558 | 558 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
| 559 | 559 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
| 560 | 560 | // Get member_srl of sender/recipient (If not exists, pass) |
| 561 | - if(!$obj->sender) continue; |
|
| 561 | + if (!$obj->sender) continue; |
|
| 562 | 562 | $sender_args->user_id = $obj->sender; |
| 563 | - $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
|
| 563 | + $sender_output = executeQuery('member.getMemberInfo', $sender_args); |
|
| 564 | 564 | $sender_srl = $sender_output->data->member_srl; |
| 565 | - if(!$sender_srl) |
|
| 565 | + if (!$sender_srl) |
|
| 566 | 566 | { |
| 567 | 567 | unset($sender_args); |
| 568 | 568 | $sender_args->email_address = $obj->sender; |
| 569 | - $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
|
| 569 | + $sender_output = executeQuery('member.getMemberInfoByEmailAddress', $sender_args); |
|
| 570 | 570 | $sender_srl = $sender_output->data->member_srl; |
| 571 | 571 | } |
| 572 | - if(!$sender_srl) continue; |
|
| 572 | + if (!$sender_srl) continue; |
|
| 573 | 573 | |
| 574 | 574 | $receiver_args->user_id = $obj->receiver; |
| 575 | - if(!$obj->receiver) continue; |
|
| 576 | - $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
|
| 575 | + if (!$obj->receiver) continue; |
|
| 576 | + $receiver_output = executeQuery('member.getMemberInfo', $receiver_args); |
|
| 577 | 577 | $receiver_srl = $receiver_output->data->member_srl; |
| 578 | - if(!$receiver_srl) |
|
| 578 | + if (!$receiver_srl) |
|
| 579 | 579 | { |
| 580 | 580 | unset($receiver_args); |
| 581 | 581 | $receiver_args->email_address = $obj->receiver; |
| 582 | - $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
|
| 582 | + $receiver_output = executeQuery('member.getMemberInfoByEmailAddress', $receiver_args); |
|
| 583 | 583 | $receiver_srl = $receiver_output->data->member_srl; |
| 584 | 584 | } |
| 585 | - if(!$receiver_srl) continue; |
|
| 585 | + if (!$receiver_srl) continue; |
|
| 586 | 586 | // Message to save into sender's message box |
| 587 | 587 | $sender_args->sender_srl = $sender_srl; |
| 588 | 588 | $sender_args->receiver_srl = $receiver_srl; |
@@ -597,13 +597,13 @@ discard block |
||
| 597 | 597 | $sender_args->list_order = $sender_args->message_srl * -1; |
| 598 | 598 | |
| 599 | 599 | $output = executeQuery('communication.sendMessage', $sender_args); |
| 600 | - if($output->toBool()) |
|
| 600 | + if ($output->toBool()) |
|
| 601 | 601 | { |
| 602 | 602 | // Message to save into recipient's massage box |
| 603 | 603 | $receiver_args->message_srl = $sender_args->related_srl; |
| 604 | - $receiver_args->list_order = $sender_args->related_srl*-1; |
|
| 604 | + $receiver_args->list_order = $sender_args->related_srl * -1; |
|
| 605 | 605 | $receiver_args->sender_srl = $sender_srl; |
| 606 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
| 606 | + if (!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
| 607 | 607 | $receiver_args->receiver_srl = $receiver_srl; |
| 608 | 608 | $receiver_args->message_type = 'R'; |
| 609 | 609 | $receiver_args->title = $obj->title; |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | fclose($f); |
| 619 | 619 | |
| 620 | - return $idx-1; |
|
| 620 | + return $idx - 1; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -637,10 +637,10 @@ discard block |
||
| 637 | 637 | $oDocumentModel = getModel('document'); |
| 638 | 638 | $category_list = $category_titles = array(); |
| 639 | 639 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 640 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 640 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 641 | 641 | // Extract category information |
| 642 | 642 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
| 643 | - if(file_exists($category_file)) |
|
| 643 | + if (file_exists($category_file)) |
|
| 644 | 644 | { |
| 645 | 645 | $buff = FileHandler::readFile($category_file); |
| 646 | 646 | |
@@ -648,14 +648,14 @@ discard block |
||
| 648 | 648 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); |
| 649 | 649 | |
| 650 | 650 | $categories = $xmlDoc->items->category; |
| 651 | - if($categories) |
|
| 651 | + if ($categories) |
|
| 652 | 652 | { |
| 653 | - if(!is_array($categories)) $categories = array($categories); |
|
| 653 | + if (!is_array($categories)) $categories = array($categories); |
|
| 654 | 654 | $match_sequence = array(); |
| 655 | - foreach($categories as $k => $v) |
|
| 655 | + foreach ($categories as $k => $v) |
|
| 656 | 656 | { |
| 657 | 657 | $category = trim(base64_decode($v->body)); |
| 658 | - if(!$category || $category_titles[$category]) continue; |
|
| 658 | + if (!$category || $category_titles[$category]) continue; |
|
| 659 | 659 | |
| 660 | 660 | $sequence = $v->attrs->sequence; |
| 661 | 661 | $parent = $v->attrs->parent; |
@@ -663,10 +663,10 @@ discard block |
||
| 663 | 663 | $obj = null; |
| 664 | 664 | $obj->title = $category; |
| 665 | 665 | $obj->module_srl = $module_srl; |
| 666 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
| 666 | + if ($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
| 667 | 667 | |
| 668 | 668 | $output = $oDocumentController->insertCategory($obj); |
| 669 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
| 669 | + if ($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
| 670 | 670 | } |
| 671 | 671 | $oDocumentController = getController('document'); |
| 672 | 672 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -676,31 +676,31 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | $category_list = $category_titles = array(); |
| 678 | 678 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 679 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 679 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 680 | 680 | |
| 681 | 681 | $ek_args->module_srl = $module_srl; |
| 682 | 682 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
| 683 | - if($output->data) |
|
| 683 | + if ($output->data) |
|
| 684 | 684 | { |
| 685 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
| 685 | + foreach ($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if(!$cur) $cur = 0; |
|
| 688 | + if (!$cur) $cur = 0; |
|
| 689 | 689 | // Open an index file |
| 690 | - $f = fopen($index_file,"r"); |
|
| 690 | + $f = fopen($index_file, "r"); |
|
| 691 | 691 | // Pass if already read |
| 692 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 692 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
| 693 | 693 | // Read each line until the condition meets |
| 694 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
| 694 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
| 695 | 695 | { |
| 696 | - if(feof($f)) break; |
|
| 696 | + if (feof($f)) break; |
|
| 697 | 697 | // Find a location |
| 698 | 698 | $target_file = trim(fgets($f, 1024)); |
| 699 | 699 | |
| 700 | - if(!file_exists($target_file)) continue; |
|
| 700 | + if (!file_exists($target_file)) continue; |
|
| 701 | 701 | // Importing data from now on |
| 702 | - $fp = fopen($target_file,"r"); |
|
| 703 | - if(!$fp) continue; |
|
| 702 | + $fp = fopen($target_file, "r"); |
|
| 703 | + if (!$fp) continue; |
|
| 704 | 704 | |
| 705 | 705 | $obj = new stdClass; |
| 706 | 706 | $obj->module_srl = $module_srl; |
@@ -712,51 +712,51 @@ discard block |
||
| 712 | 712 | $started = false; |
| 713 | 713 | $buff = array(); |
| 714 | 714 | // Start from the body data |
| 715 | - while(!feof($fp)) |
|
| 715 | + while (!feof($fp)) |
|
| 716 | 716 | { |
| 717 | 717 | $str = fgets($fp, 1024); |
| 718 | 718 | // Prepare an item |
| 719 | - if(trim($str) == '<post>') |
|
| 719 | + if (trim($str) == '<post>') |
|
| 720 | 720 | { |
| 721 | 721 | $started = true; |
| 722 | 722 | // Trackback inserted |
| 723 | 723 | } |
| 724 | - else if(substr($str,0,11) == '<trackbacks') |
|
| 724 | + else if (substr($str, 0, 11) == '<trackbacks') |
|
| 725 | 725 | { |
| 726 | 726 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
| 727 | 727 | continue; |
| 728 | 728 | // Comments inserted |
| 729 | 729 | } |
| 730 | - else if(substr($str,0,9) == '<comments') |
|
| 730 | + else if (substr($str, 0, 9) == '<comments') |
|
| 731 | 731 | { |
| 732 | 732 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
| 733 | 733 | continue; |
| 734 | 734 | // Attachment inserted |
| 735 | 735 | } |
| 736 | - else if(substr($str,0,9) == '<attaches') |
|
| 736 | + else if (substr($str, 0, 9) == '<attaches') |
|
| 737 | 737 | { |
| 738 | 738 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
| 739 | 739 | continue; |
| 740 | 740 | // When starting extra variabls |
| 741 | 741 | } |
| 742 | - elseif(trim($str) == '<extra_vars>') |
|
| 742 | + elseif (trim($str) == '<extra_vars>') |
|
| 743 | 743 | { |
| 744 | 744 | $extra_vars = $this->importExtraVars($fp); |
| 745 | 745 | continue; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - if($started) $buff[] = $str; |
|
| 748 | + if ($started) $buff[] = $str; |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
| 752 | 752 | |
| 753 | 753 | $category = base64_decode($xmlDoc->post->category->body); |
| 754 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
| 754 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
| 755 | 755 | |
| 756 | 756 | $obj->member_srl = 0; |
| 757 | 757 | |
| 758 | - $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N'; |
|
| 759 | - $obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); |
|
| 758 | + $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body) == 'Y' ? 'Y' : 'N'; |
|
| 759 | + $obj->status = base64_decode($xmlDoc->post->is_secret->body) == 'Y' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); |
|
| 760 | 760 | $obj->title = base64_decode($xmlDoc->post->title->body); |
| 761 | 761 | $obj->content = base64_decode($xmlDoc->post->content->body); |
| 762 | 762 | $obj->readed_count = base64_decode($xmlDoc->post->readed_count->body); |
@@ -765,53 +765,53 @@ discard block |
||
| 765 | 765 | $obj->password = base64_decode($xmlDoc->post->password->body); |
| 766 | 766 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
| 767 | 767 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
| 768 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 768 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 769 | 769 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
| 770 | 770 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
| 771 | 771 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
| 772 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
| 772 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
| 773 | 773 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
| 774 | 774 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
| 775 | 775 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
| 776 | 776 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
| 777 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 777 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 778 | 778 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
| 779 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
|
| 780 | - $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
|
| 781 | - $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N'; |
|
| 779 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1; |
|
| 780 | + $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body) != 'N' ? 'ALLOW' : 'DENY'; |
|
| 781 | + $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body) != 'N' ? 'Y' : 'N'; |
|
| 782 | 782 | $obj->notify_message = base64_decode($xmlDoc->post->is_notice->body); |
| 783 | 783 | // Check user ID |
| 784 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 784 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 785 | 785 | { |
| 786 | 786 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
| 787 | 787 | } |
| 788 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 788 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 789 | 789 | { |
| 790 | - $obj->user_id = 't' . $obj->member_srl; |
|
| 790 | + $obj->user_id = 't'.$obj->member_srl; |
|
| 791 | 791 | } |
| 792 | 792 | // Check email address |
| 793 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
| 793 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
| 794 | 794 | { |
| 795 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
| 795 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
| 796 | 796 | } |
| 797 | 797 | // Change content information (attachment) |
| 798 | - if(count($files)) |
|
| 798 | + if (count($files)) |
|
| 799 | 799 | { |
| 800 | - foreach($files as $key => $val) |
|
| 800 | + foreach ($files as $key => $val) |
|
| 801 | 801 | { |
| 802 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
| 803 | - $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
| 804 | - $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
| 802 | + $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); |
|
| 803 | + $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); |
|
| 804 | + $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); |
|
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | $output = executeQuery('document.insertDocument', $obj); |
| 809 | 809 | |
| 810 | - if($output->toBool() && $obj->tags) |
|
| 810 | + if ($output->toBool() && $obj->tags) |
|
| 811 | 811 | { |
| 812 | - $tag_list = explode(',',$obj->tags); |
|
| 812 | + $tag_list = explode(',', $obj->tags); |
|
| 813 | 813 | $tag_count = count($tag_list); |
| 814 | - for($i=0;$i<$tag_count;$i++) |
|
| 814 | + for ($i = 0; $i < $tag_count; $i++) |
|
| 815 | 815 | { |
| 816 | 816 | $args = new stdClass; |
| 817 | 817 | $args->tag_srl = getNextSequence(); |
@@ -819,17 +819,17 @@ discard block |
||
| 819 | 819 | $args->document_srl = $obj->document_srl; |
| 820 | 820 | $args->tag = trim($tag_list[$i]); |
| 821 | 821 | $args->regdate = $obj->regdate; |
| 822 | - if(!$args->tag) continue; |
|
| 822 | + if (!$args->tag) continue; |
|
| 823 | 823 | $output = executeQuery('tag.insertTag', $args); |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | } |
| 827 | 827 | // Add extra variables |
| 828 | - if(count($extra_vars)) |
|
| 828 | + if (count($extra_vars)) |
|
| 829 | 829 | { |
| 830 | - foreach($extra_vars as $key => $val) |
|
| 830 | + foreach ($extra_vars as $key => $val) |
|
| 831 | 831 | { |
| 832 | - if(!$val->value) continue; |
|
| 832 | + if (!$val->value) continue; |
|
| 833 | 833 | unset($e_args); |
| 834 | 834 | $e_args->module_srl = $module_srl; |
| 835 | 835 | $e_args->document_srl = $obj->document_srl; |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | $e_args->lang_code = $val->lang_code; |
| 839 | 839 | $e_args->eid = $val->eid; |
| 840 | 840 | // Create a key for extra vars if not exists (except vars for title and content) |
| 841 | - if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) |
|
| 841 | + if (!preg_match('/^(title|content)_(.+)$/i', $e_args->eid) && !$extra_keys[$e_args->eid]) |
|
| 842 | 842 | { |
| 843 | 843 | unset($ek_args); |
| 844 | 844 | $ek_args->module_srl = $module_srl; |
@@ -862,9 +862,9 @@ discard block |
||
| 862 | 862 | |
| 863 | 863 | fclose($f); |
| 864 | 864 | // Sync category counts |
| 865 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 865 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 866 | 866 | |
| 867 | - return $idx-1; |
|
| 867 | + return $idx - 1; |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | /** |
@@ -880,17 +880,17 @@ discard block |
||
| 880 | 880 | $buff = null; |
| 881 | 881 | $cnt = 0; |
| 882 | 882 | |
| 883 | - while(!feof($fp)) |
|
| 883 | + while (!feof($fp)) |
|
| 884 | 884 | { |
| 885 | 885 | $str = fgets($fp, 1024); |
| 886 | 886 | // If </trackbacks> is, break |
| 887 | - if(trim($str) == '</trackbacks>') break; |
|
| 887 | + if (trim($str) == '</trackbacks>') break; |
|
| 888 | 888 | // If <trackback>, start importing |
| 889 | - if(trim($str) == '<trackback>') $started = true; |
|
| 889 | + if (trim($str) == '<trackback>') $started = true; |
|
| 890 | 890 | |
| 891 | - if($started) $buff .= $str; |
|
| 891 | + if ($started) $buff .= $str; |
|
| 892 | 892 | // If </trackback>, insert to the DB |
| 893 | - if(trim($str) == '</trackback>') |
|
| 893 | + if (trim($str) == '</trackback>') |
|
| 894 | 894 | { |
| 895 | 895 | $xmlDoc = $this->oXmlParser->parse($buff); |
| 896 | 896 | |
@@ -904,9 +904,9 @@ discard block |
||
| 904 | 904 | $obj->excerpt = base64_decode($xmlDoc->trackback->excerpt->body); |
| 905 | 905 | $obj->regdate = base64_decode($xmlDoc->trackback->regdate->body); |
| 906 | 906 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
| 907 | - $obj->list_order = -1*$obj->trackback_srl; |
|
| 907 | + $obj->list_order = -1 * $obj->trackback_srl; |
|
| 908 | 908 | $output = executeQuery('trackback.insertTrackback', $obj); |
| 909 | - if($output->toBool()) $cnt++; |
|
| 909 | + if ($output->toBool()) $cnt++; |
|
| 910 | 910 | |
| 911 | 911 | $buff = null; |
| 912 | 912 | $started = false; |
@@ -930,13 +930,13 @@ discard block |
||
| 930 | 930 | |
| 931 | 931 | $sequences = array(); |
| 932 | 932 | |
| 933 | - while(!feof($fp)) |
|
| 933 | + while (!feof($fp)) |
|
| 934 | 934 | { |
| 935 | 935 | $str = fgets($fp, 1024); |
| 936 | 936 | // If </comments> is, break |
| 937 | - if(trim($str) == '</comments>') break; |
|
| 937 | + if (trim($str) == '</comments>') break; |
|
| 938 | 938 | // If <comment> is, start importing |
| 939 | - if(trim($str) == '<comment>') |
|
| 939 | + if (trim($str) == '<comment>') |
|
| 940 | 940 | { |
| 941 | 941 | $started = true; |
| 942 | 942 | $obj = new stdClass; |
@@ -944,15 +944,15 @@ discard block |
||
| 944 | 944 | $files = array(); |
| 945 | 945 | } |
| 946 | 946 | // If <attaches is, start importing attachments |
| 947 | - if(substr($str,0,9) == '<attaches') |
|
| 947 | + if (substr($str, 0, 9) == '<attaches') |
|
| 948 | 948 | { |
| 949 | 949 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files); |
| 950 | 950 | continue; |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | - if($started) $buff .= $str; |
|
| 953 | + if ($started) $buff .= $str; |
|
| 954 | 954 | // If </comment> is, insert to the DB |
| 955 | - if(trim($str) == '</comment>') |
|
| 955 | + if (trim($str) == '</comment>') |
|
| 956 | 956 | { |
| 957 | 957 | $xmlDoc = $this->oXmlParser->parse($buff); |
| 958 | 958 | |
@@ -962,49 +962,49 @@ discard block |
||
| 962 | 962 | |
| 963 | 963 | $obj->module_srl = $module_srl; |
| 964 | 964 | |
| 965 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
| 965 | + if ($parent) $obj->parent_srl = $sequences[$parent]; |
|
| 966 | 966 | else $obj->parent_srl = 0; |
| 967 | 967 | |
| 968 | 968 | $obj->document_srl = $document_srl; |
| 969 | - $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
|
| 970 | - $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body)=='Y'?'Y':'N'; |
|
| 969 | + $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body) == 'Y' ? 'Y' : 'N'; |
|
| 970 | + $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body) == 'Y' ? 'Y' : 'N'; |
|
| 971 | 971 | $obj->content = base64_decode($xmlDoc->comment->content->body); |
| 972 | 972 | $obj->voted_count = base64_decode($xmlDoc->comment->voted_count->body); |
| 973 | 973 | $obj->blamed_count = base64_decode($xmlDoc->comment->blamed_count->body); |
| 974 | 974 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
| 975 | - $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
|
| 975 | + $obj->user_name = base64_decode($xmlDoc->comment->user_name->body); |
|
| 976 | 976 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
| 977 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 977 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 978 | 978 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
| 979 | 979 | $obj->member_srl = 0; |
| 980 | 980 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
| 981 | 981 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
| 982 | 982 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
| 983 | 983 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
| 984 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 984 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 985 | 985 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
| 986 | - $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
|
| 987 | - $obj->list_order = $obj->comment_srl*-1; |
|
| 986 | + $obj->status = base64_decode($xmlDoc->comment->status->body) == '' ? '1' : base64_decode($xmlDoc->comment->status->body); |
|
| 987 | + $obj->list_order = $obj->comment_srl * -1; |
|
| 988 | 988 | // Check user ID |
| 989 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 989 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 990 | 990 | { |
| 991 | 991 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
| 992 | 992 | } |
| 993 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 993 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
| 994 | 994 | { |
| 995 | - $obj->user_id = 't' . $obj->member_srl; |
|
| 995 | + $obj->user_id = 't'.$obj->member_srl; |
|
| 996 | 996 | } |
| 997 | 997 | // Check email address |
| 998 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
| 998 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
| 999 | 999 | { |
| 1000 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
| 1000 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
| 1001 | 1001 | } |
| 1002 | 1002 | // Change content information (attachment) |
| 1003 | - if(count($files)) |
|
| 1003 | + if (count($files)) |
|
| 1004 | 1004 | { |
| 1005 | - foreach($files as $key => $val) |
|
| 1005 | + foreach ($files as $key => $val) |
|
| 1006 | 1006 | { |
| 1007 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
| 1007 | + $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); |
|
| 1008 | 1008 | } |
| 1009 | 1009 | } |
| 1010 | 1010 | // Comment list first |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | $list_args->module_srl = $obj->module_srl; |
| 1015 | 1015 | $list_args->regdate = $obj->regdate; |
| 1016 | 1016 | // Set data directly if parent comment doesn't exist |
| 1017 | - if(!$obj->parent_srl) |
|
| 1017 | + if (!$obj->parent_srl) |
|
| 1018 | 1018 | { |
| 1019 | 1019 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
| 1020 | 1020 | $list_args->depth = 0; |
@@ -1026,25 +1026,25 @@ discard block |
||
| 1026 | 1026 | $parent_args->comment_srl = $obj->parent_srl; |
| 1027 | 1027 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
| 1028 | 1028 | // Return if parent comment doesn't exist |
| 1029 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
| 1029 | + if (!$parent_output->toBool() || !$parent_output->data) continue; |
|
| 1030 | 1030 | $parent = $parent_output->data; |
| 1031 | 1031 | |
| 1032 | 1032 | $list_args->head = $parent->head; |
| 1033 | - $list_args->depth = $parent->depth+1; |
|
| 1034 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
| 1033 | + $list_args->depth = $parent->depth + 1; |
|
| 1034 | + if ($list_args->depth < 2) $list_args->arrange = $obj->comment_srl; |
|
| 1035 | 1035 | else |
| 1036 | 1036 | { |
| 1037 | 1037 | $list_args->arrange = $parent->arrange; |
| 1038 | 1038 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
| 1039 | - if(!$output->toBool()) return $output; |
|
| 1039 | + if (!$output->toBool()) return $output; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | $output = executeQuery('comment.insertCommentList', $list_args); |
| 1044 | - if($output->toBool()) |
|
| 1044 | + if ($output->toBool()) |
|
| 1045 | 1045 | { |
| 1046 | 1046 | $output = executeQuery('comment.insertComment', $obj); |
| 1047 | - if($output->toBool()) $cnt++; |
|
| 1047 | + if ($output->toBool()) $cnt++; |
|
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | $buff = null; |
@@ -1070,13 +1070,13 @@ discard block |
||
| 1070 | 1070 | $buff = null; |
| 1071 | 1071 | |
| 1072 | 1072 | $file_obj = new stdClass; |
| 1073 | - while(!feof($fp)) |
|
| 1073 | + while (!feof($fp)) |
|
| 1074 | 1074 | { |
| 1075 | 1075 | $str = trim(fgets($fp, 1024)); |
| 1076 | 1076 | // If it ends with </attaches>, break |
| 1077 | - if(trim($str) == '</attaches>') break; |
|
| 1077 | + if (trim($str) == '</attaches>') break; |
|
| 1078 | 1078 | // If it starts with <attach>, collect attachments |
| 1079 | - if(trim($str) == '<attach>') |
|
| 1079 | + if (trim($str) == '<attach>') |
|
| 1080 | 1080 | { |
| 1081 | 1081 | $file_obj->file_srl = getNextSequence(); |
| 1082 | 1082 | $file_obj->upload_target_srl = $upload_target_srl; |
@@ -1086,26 +1086,26 @@ discard block |
||
| 1086 | 1086 | $buff = null; |
| 1087 | 1087 | // If it starts with <file>, handle the attachement in xml file |
| 1088 | 1088 | } |
| 1089 | - else if(trim($str) == '<file>') |
|
| 1089 | + else if (trim($str) == '<file>') |
|
| 1090 | 1090 | { |
| 1091 | 1091 | $file_obj->file = $this->saveTemporaryFile($fp); |
| 1092 | 1092 | continue; |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | - if($started) $buff .= $str; |
|
| 1095 | + if ($started) $buff .= $str; |
|
| 1096 | 1096 | // If it ends with </attach>, handle attachements |
| 1097 | - if(trim($str) == '</attach>') |
|
| 1097 | + if (trim($str) == '</attach>') |
|
| 1098 | 1098 | { |
| 1099 | 1099 | $xmlDoc = $this->oXmlParser->parse($buff.$str); |
| 1100 | 1100 | |
| 1101 | 1101 | $file_obj->source_filename = base64_decode($xmlDoc->attach->filename->body); |
| 1102 | 1102 | $file_obj->download_count = base64_decode($xmlDoc->attach->download_count->body); |
| 1103 | 1103 | |
| 1104 | - if(!$file_obj->file) |
|
| 1104 | + if (!$file_obj->file) |
|
| 1105 | 1105 | { |
| 1106 | 1106 | $url = base64_decode($xmlDoc->attach->url->body); |
| 1107 | 1107 | $path = base64_decode($xmlDoc->attach->path->body); |
| 1108 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
| 1108 | + if ($path && file_exists($path)) $file_obj->file = $path; |
|
| 1109 | 1109 | else |
| 1110 | 1110 | { |
| 1111 | 1111 | $file_obj->file = $this->getTmpFilename(); |
@@ -1113,11 +1113,11 @@ discard block |
||
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | - if(file_exists($file_obj->file)) |
|
| 1116 | + if (file_exists($file_obj->file)) |
|
| 1117 | 1117 | { |
| 1118 | 1118 | $random = new Password(); |
| 1119 | 1119 | // Set upload path by checking if the attachement is an image or other kind of file |
| 1120 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
| 1120 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
| 1121 | 1121 | { |
| 1122 | 1122 | // Immediately remove the direct file if it has any kind of extensions for hacking |
| 1123 | 1123 | $file_obj->source_filename = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_obj->source_filename); |
@@ -1125,14 +1125,14 @@ discard block |
||
| 1125 | 1125 | |
| 1126 | 1126 | $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
| 1127 | 1127 | |
| 1128 | - $ext = substr(strrchr($file_obj->source_filename,'.'),1); |
|
| 1128 | + $ext = substr(strrchr($file_obj->source_filename, '.'), 1); |
|
| 1129 | 1129 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
| 1130 | 1130 | $filename = $path.$_filename; |
| 1131 | 1131 | |
| 1132 | 1132 | $idx = 1; |
| 1133 | - while(file_exists($filename)) |
|
| 1133 | + while (file_exists($filename)) |
|
| 1134 | 1134 | { |
| 1135 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1', $_filename); |
|
| 1135 | + $filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); |
|
| 1136 | 1136 | $idx++; |
| 1137 | 1137 | } |
| 1138 | 1138 | |
@@ -1140,14 +1140,14 @@ discard block |
||
| 1140 | 1140 | } |
| 1141 | 1141 | else |
| 1142 | 1142 | { |
| 1143 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
| 1143 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 1144 | 1144 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
| 1145 | 1145 | $file_obj->direct_download = 'N'; |
| 1146 | 1146 | } |
| 1147 | 1147 | // Create a directory |
| 1148 | - if(!FileHandler::makeDir($path)) continue; |
|
| 1148 | + if (!FileHandler::makeDir($path)) continue; |
|
| 1149 | 1149 | |
| 1150 | - if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
| 1150 | + if (strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | FileHandler::rename($file_obj->file, $filename); |
| 1153 | 1153 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
| 1158 | 1158 | |
| 1159 | 1159 | // Insert the file to the DB |
| 1160 | 1160 | unset($file_obj->file); |
| 1161 | - if(file_exists($filename)) |
|
| 1161 | + if (file_exists($filename)) |
|
| 1162 | 1162 | { |
| 1163 | 1163 | $file_obj->uploaded_filename = $filename; |
| 1164 | 1164 | $file_obj->file_size = filesize($filename); |
@@ -1168,13 +1168,13 @@ discard block |
||
| 1168 | 1168 | $file_obj->isvalid = 'Y'; |
| 1169 | 1169 | $output = executeQuery('file.insertFile', $file_obj); |
| 1170 | 1170 | |
| 1171 | - if($output->toBool()) |
|
| 1171 | + if ($output->toBool()) |
|
| 1172 | 1172 | { |
| 1173 | 1173 | $uploaded_count++; |
| 1174 | 1174 | $tmp_obj = null; |
| 1175 | 1175 | $tmp_obj->source_filename = $file_obj->source_filename; |
| 1176 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
| 1177 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
| 1176 | + if ($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
| 1177 | + else $files[$file_obj->source_filename] = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | } |
| 1180 | 1180 | } |
@@ -1191,8 +1191,8 @@ discard block |
||
| 1191 | 1191 | { |
| 1192 | 1192 | $path = "./files/cache/importer"; |
| 1193 | 1193 | FileHandler::makeDir($path); |
| 1194 | - $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
|
| 1195 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
| 1194 | + $filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); |
|
| 1195 | + if (file_exists($filename)) $filename .= rand(111, 999); |
|
| 1196 | 1196 | return $filename; |
| 1197 | 1197 | } |
| 1198 | 1198 | |
@@ -1207,14 +1207,14 @@ discard block |
||
| 1207 | 1207 | $f = fopen($temp_filename, "w"); |
| 1208 | 1208 | |
| 1209 | 1209 | $buff = ''; |
| 1210 | - while(!feof($fp)) |
|
| 1210 | + while (!feof($fp)) |
|
| 1211 | 1211 | { |
| 1212 | 1212 | $str = trim(fgets($fp, 1024)); |
| 1213 | - if(trim($str) == '</file>') break; |
|
| 1213 | + if (trim($str) == '</file>') break; |
|
| 1214 | 1214 | |
| 1215 | 1215 | $buff .= $str; |
| 1216 | 1216 | |
| 1217 | - if(substr($buff,-7)=='</buff>') |
|
| 1217 | + if (substr($buff, -7) == '</buff>') |
|
| 1218 | 1218 | { |
| 1219 | 1219 | fwrite($f, base64_decode(substr($buff, 6, -7))); |
| 1220 | 1220 | $buff = ''; |
@@ -1233,23 +1233,23 @@ discard block |
||
| 1233 | 1233 | function importExtraVars($fp) |
| 1234 | 1234 | { |
| 1235 | 1235 | $buff = null; |
| 1236 | - while(!feof($fp)) |
|
| 1236 | + while (!feof($fp)) |
|
| 1237 | 1237 | { |
| 1238 | 1238 | $buff .= $str = trim(fgets($fp, 1024)); |
| 1239 | - if(trim($str) == '</extra_vars>') break; |
|
| 1239 | + if (trim($str) == '</extra_vars>') break; |
|
| 1240 | 1240 | } |
| 1241 | - if(!$buff) return array(); |
|
| 1241 | + if (!$buff) return array(); |
|
| 1242 | 1242 | |
| 1243 | 1243 | $buff = '<extra_vars>'.$buff; |
| 1244 | 1244 | $oXmlParser = new XmlParser(); |
| 1245 | 1245 | $xmlDoc = $this->oXmlParser->parse($buff); |
| 1246 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
| 1246 | + if (!count($xmlDoc->extra_vars->key)) return array(); |
|
| 1247 | 1247 | |
| 1248 | 1248 | $index = 1; |
| 1249 | - foreach($xmlDoc->extra_vars->key as $k => $v) |
|
| 1249 | + foreach ($xmlDoc->extra_vars->key as $k => $v) |
|
| 1250 | 1250 | { |
| 1251 | 1251 | unset($vobj); |
| 1252 | - if($v->var_idx) |
|
| 1252 | + if ($v->var_idx) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $vobj->var_idx = base64_decode($v->var_idx->body); |
| 1255 | 1255 | $vobj->lang_code = base64_decode($v->lang_code->body); |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | $vobj->eid = base64_decode($v->eid->body); |
| 1258 | 1258 | |
| 1259 | 1259 | } |
| 1260 | - else if($v->body) |
|
| 1260 | + else if ($v->body) |
|
| 1261 | 1261 | { |
| 1262 | 1262 | $vobj->var_idx = $index; |
| 1263 | 1263 | $vobj->lang_code = Context::getLangType(); |
@@ -55,24 +55,29 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $isExists = 'true'; |
| 57 | 57 | $type = 'XML'; |
| 58 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
| 58 | + if(stristr($str, 'tattertools')) { |
|
| 59 | + $type = 'TTXML'; |
|
| 60 | + } |
|
| 59 | 61 | |
| 60 | 62 | $this->add('type', $type); |
| 61 | 63 | } |
| 62 | 64 | fclose($fp); |
| 63 | 65 | $resultMessage = $lang->found_xml_file; |
| 66 | + } else { |
|
| 67 | + $resultMessage = $lang->cannot_url_file; |
|
| 64 | 68 | } |
| 65 | - else $resultMessage = $lang->cannot_url_file; |
|
| 69 | + } else { |
|
| 70 | + $resultMessage = $lang->cannot_allow_fopen_in_phpini; |
|
| 66 | 71 | } |
| 67 | - else $resultMessage = $lang->cannot_allow_fopen_in_phpini; |
|
| 68 | 72 | |
| 69 | 73 | $this->add('exists', $isExists); |
| 70 | - } |
|
| 71 | - else |
|
| 74 | + } else |
|
| 72 | 75 | { |
| 73 | 76 | $realPath = FileHandler::getRealPath($filename); |
| 74 | 77 | |
| 75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
| 78 | + if(file_exists($realPath) && is_file($realPath)) { |
|
| 79 | + $isExists = 'true'; |
|
| 80 | + } |
|
| 76 | 81 | $this->add('exists', $isExists); |
| 77 | 82 | |
| 78 | 83 | if($isExists == 'true') |
@@ -81,13 +86,16 @@ discard block |
||
| 81 | 86 | |
| 82 | 87 | $fp = fopen($realPath, "r"); |
| 83 | 88 | $str = fgets($fp, 100); |
| 84 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
| 89 | + if(stristr($str, 'tattertools')) { |
|
| 90 | + $type = 'TTXML'; |
|
| 91 | + } |
|
| 85 | 92 | fclose($fp); |
| 86 | 93 | |
| 87 | 94 | $this->add('type', $type); |
| 88 | 95 | $resultMessage = $lang->found_xml_file; |
| 96 | + } else { |
|
| 97 | + $resultMessage = $lang->not_found_xml_file; |
|
| 89 | 98 | } |
| 90 | - else $resultMessage = $lang->not_found_xml_file; |
|
| 91 | 99 | } |
| 92 | 100 | $this->add('result_message', $resultMessage); |
| 93 | 101 | } |
@@ -112,8 +120,7 @@ discard block |
||
| 112 | 120 | { |
| 113 | 121 | $output = executeQuery('importer.updateDocumentSync'.$postFix); |
| 114 | 122 | $output = executeQuery('importer.updateCommentSync'.$postFix); |
| 115 | - } |
|
| 116 | - else |
|
| 123 | + } else |
|
| 117 | 124 | { |
| 118 | 125 | $output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); |
| 119 | 126 | if(is_array ($output->data) && count ($output->data)) |
@@ -129,8 +136,7 @@ discard block |
||
| 129 | 136 | if($tmp->toBool () === true) |
| 130 | 137 | { |
| 131 | 138 | $success_count++; |
| 132 | - } |
|
| 133 | - else |
|
| 139 | + } else |
|
| 134 | 140 | { |
| 135 | 141 | $error_count++; |
| 136 | 142 | } |
@@ -152,8 +158,7 @@ discard block |
||
| 152 | 158 | if($tmp->toBool () === true) |
| 153 | 159 | { |
| 154 | 160 | $success_count++; |
| 155 | - } |
|
| 156 | - else |
|
| 161 | + } else |
|
| 157 | 162 | { |
| 158 | 163 | $error_count++; |
| 159 | 164 | } |
@@ -182,11 +187,15 @@ discard block |
||
| 182 | 187 | { |
| 183 | 188 | case 'member' : |
| 184 | 189 | $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>'); |
| 185 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 190 | + if($output->toBool()) { |
|
| 191 | + $oExtract->saveItems(); |
|
| 192 | + } |
|
| 186 | 193 | break; |
| 187 | 194 | case 'message' : |
| 188 | 195 | $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>'); |
| 189 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 196 | + if($output->toBool()) { |
|
| 197 | + $oExtract->saveItems(); |
|
| 198 | + } |
|
| 190 | 199 | break; |
| 191 | 200 | case 'ttxml' : |
| 192 | 201 | // Category information |
@@ -204,8 +213,12 @@ discard block |
||
| 204 | 213 | $started = true; |
| 205 | 214 | $str = strstr($str, '<category>'); |
| 206 | 215 | } |
| 207 | - if(substr($str,0,strlen('<post ')) == '<post ') break; |
|
| 208 | - if ($started) $buff .= $str; |
|
| 216 | + if(substr($str,0,strlen('<post ')) == '<post ') { |
|
| 217 | + break; |
|
| 218 | + } |
|
| 219 | + if ($started) { |
|
| 220 | + $buff .= $str; |
|
| 221 | + } |
|
| 209 | 222 | } |
| 210 | 223 | $buff = '<categories>'.$buff.'</categories>'; |
| 211 | 224 | $oExtract->closeFile(); |
@@ -242,7 +255,9 @@ discard block |
||
| 242 | 255 | FileHandler::writeFile($guestbook_filename, $buff); |
| 243 | 256 | // Individual items |
| 244 | 257 | $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>'); |
| 245 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 258 | + if($output->toBool()) { |
|
| 259 | + $oExtract->saveItems(); |
|
| 260 | + } |
|
| 246 | 261 | } |
| 247 | 262 | } |
| 248 | 263 | break; |
@@ -254,7 +269,9 @@ discard block |
||
| 254 | 269 | $oExtract->mergeItems('category.xml'); |
| 255 | 270 | // Get each item |
| 256 | 271 | $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>'); |
| 257 | - if($output->toBool()) $oExtract->saveItems(); |
|
| 272 | + if($output->toBool()) { |
|
| 273 | + $oExtract->saveItems(); |
|
| 274 | + } |
|
| 258 | 275 | } |
| 259 | 276 | break; |
| 260 | 277 | } |
@@ -291,19 +308,25 @@ discard block |
||
| 291 | 308 | $this->unit_count = Context::get('unit_count'); |
| 292 | 309 | // Check if an index file exists |
| 293 | 310 | $index_file = './files/cache/importer/'.$key.'/index'; |
| 294 | - if(!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
| 311 | + if(!file_exists($index_file)) { |
|
| 312 | + return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
| 313 | + } |
|
| 295 | 314 | |
| 296 | 315 | switch($type) |
| 297 | 316 | { |
| 298 | 317 | case 'ttxml' : |
| 299 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
| 318 | + if(!$target_module) { |
|
| 319 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 320 | + } |
|
| 300 | 321 | |
| 301 | 322 | $oModuleModel = getModel('module'); |
| 302 | 323 | $columnList = array('module_srl', 'module'); |
| 303 | 324 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList); |
| 304 | 325 | |
| 305 | 326 | $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
| 306 | - if($ttimporter) require_once($ttimporter); |
|
| 327 | + if($ttimporter) { |
|
| 328 | + require_once($ttimporter); |
|
| 329 | + } |
|
| 307 | 330 | |
| 308 | 331 | $oTT = new ttimport(); |
| 309 | 332 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module); |
@@ -316,7 +339,9 @@ discard block |
||
| 316 | 339 | break; |
| 317 | 340 | case 'module' : |
| 318 | 341 | // Check if the target module exists |
| 319 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
| 342 | + if(!$target_module) { |
|
| 343 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 344 | + } |
|
| 320 | 345 | $cur = $this->importModule($key, $cur, $index_file, $target_module); |
| 321 | 346 | break; |
| 322 | 347 | } |
@@ -331,8 +356,9 @@ discard block |
||
| 331 | 356 | { |
| 332 | 357 | $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); |
| 333 | 358 | FileHandler::removeDir('./files/cache/importer/'.$key); |
| 359 | + } else { |
|
| 360 | + $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
| 334 | 361 | } |
| 335 | - else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
| 336 | 362 | } |
| 337 | 363 | |
| 338 | 364 | /** |
@@ -344,7 +370,9 @@ discard block |
||
| 344 | 370 | */ |
| 345 | 371 | function importMember($key, $cur, $index_file) |
| 346 | 372 | { |
| 347 | - if(!$cur) $cur = 0; |
|
| 373 | + if(!$cur) { |
|
| 374 | + $cur = 0; |
|
| 375 | + } |
|
| 348 | 376 | // Create the xmlParser object |
| 349 | 377 | $oXmlParser = new XmlParser(); |
| 350 | 378 | // Create objects for importing member information |
@@ -359,17 +387,23 @@ discard block |
||
| 359 | 387 | // Open an index file |
| 360 | 388 | $f = fopen($index_file,"r"); |
| 361 | 389 | // Pass if already read |
| 362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 390 | + for($i=0;$i<$cur;$i++) { |
|
| 391 | + fgets($f, 1024); |
|
| 392 | + } |
|
| 363 | 393 | // Read by each line until the condition meets |
| 364 | 394 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
| 365 | 395 | { |
| 366 | - if(feof($f)) break; |
|
| 396 | + if(feof($f)) { |
|
| 397 | + break; |
|
| 398 | + } |
|
| 367 | 399 | // Find a given location |
| 368 | 400 | $target_file = trim(fgets($f, 1024)); |
| 369 | 401 | // Load and parse the file |
| 370 | 402 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
| 371 | 403 | FileHandler::removeFile($target_file); |
| 372 | - if(!$xmlObj) continue; |
|
| 404 | + if(!$xmlObj) { |
|
| 405 | + continue; |
|
| 406 | + } |
|
| 373 | 407 | // List Objects |
| 374 | 408 | $obj = new stdClass(); |
| 375 | 409 | $obj->member_srl = getNextSequence(); |
@@ -377,7 +411,9 @@ discard block |
||
| 377 | 411 | $obj->password = base64_decode($xmlObj->member->password->body); |
| 378 | 412 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
| 379 | 413 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
| 380 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 414 | + if(!$obj->user_name) { |
|
| 415 | + $obj->user_name = $obj->nick_name; |
|
| 416 | + } |
|
| 381 | 417 | $obj->email_address = base64_decode($xmlObj->member->email->body); |
| 382 | 418 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
| 383 | 419 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
@@ -395,12 +431,16 @@ discard block |
||
| 395 | 431 | { |
| 396 | 432 | foreach($xmlObj->member->extra_vars as $key => $val) |
| 397 | 433 | { |
| 398 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
| 434 | + if(in_array($key, array('node_name','attrs','body'))) { |
|
| 435 | + continue; |
|
| 436 | + } |
|
| 399 | 437 | $obj->extra_vars->{$key} = base64_decode($val->body); |
| 400 | 438 | } |
| 401 | 439 | } |
| 402 | 440 | // Create url for homepage and blog |
| 403 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
| 441 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
| 442 | + $obj->homepage = 'http://'.$obj->homepage; |
|
| 443 | + } |
|
| 404 | 444 | // Check user ID |
| 405 | 445 | if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
| 406 | 446 | { |
@@ -417,12 +457,18 @@ discard block |
||
| 417 | 457 | } |
| 418 | 458 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email); |
| 419 | 459 | // Set the mailing option |
| 420 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
| 460 | + if($obj->allow_mailing!='Y') { |
|
| 461 | + $obj->allow_mailing = 'N'; |
|
| 462 | + } |
|
| 421 | 463 | // Set the message option |
| 422 | 464 | $obj->allow_message = 'Y'; |
| 423 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
| 465 | + if(!in_array($obj->allow_message, array('Y','N','F'))) { |
|
| 466 | + $obj->allow_message= 'Y'; |
|
| 467 | + } |
|
| 424 | 468 | // Get member-join date if the last login time is not found |
| 425 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
| 469 | + if(!$obj->last_login) { |
|
| 470 | + $obj->last_login = $obj->regdate; |
|
| 471 | + } |
|
| 426 | 472 | // Set the list order |
| 427 | 473 | $obj->list_order = -1 * $obj->member_srl; |
| 428 | 474 | // List extra vars |
@@ -509,7 +555,9 @@ discard block |
||
| 509 | 555 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 510 | 556 | |
| 511 | 557 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
| 512 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
| 558 | + if(!is_dir($target_path)) { |
|
| 559 | + FileHandler::makeDir($target_path); |
|
| 560 | + } |
|
| 513 | 561 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
| 514 | 562 | |
| 515 | 563 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -531,23 +579,31 @@ discard block |
||
| 531 | 579 | */ |
| 532 | 580 | function importMessage($key, $cur, $index_file) |
| 533 | 581 | { |
| 534 | - if(!$cur) $cur = 0; |
|
| 582 | + if(!$cur) { |
|
| 583 | + $cur = 0; |
|
| 584 | + } |
|
| 535 | 585 | // Create the xmlParser object |
| 536 | 586 | $oXmlParser = new XmlParser(); |
| 537 | 587 | // Open an index file |
| 538 | 588 | $f = fopen($index_file,"r"); |
| 539 | 589 | // Pass if already read |
| 540 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 590 | + for($i=0;$i<$cur;$i++) { |
|
| 591 | + fgets($f, 1024); |
|
| 592 | + } |
|
| 541 | 593 | // Read each line until the condition meets |
| 542 | 594 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
| 543 | 595 | { |
| 544 | - if(feof($f)) break; |
|
| 596 | + if(feof($f)) { |
|
| 597 | + break; |
|
| 598 | + } |
|
| 545 | 599 | // Find a location |
| 546 | 600 | $target_file = trim(fgets($f, 1024)); |
| 547 | 601 | // Load and parse the file |
| 548 | 602 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
| 549 | 603 | FileHandler::removeFile($target_file); |
| 550 | - if(!$xmlObj) continue; |
|
| 604 | + if(!$xmlObj) { |
|
| 605 | + continue; |
|
| 606 | + } |
|
| 551 | 607 | // List objects |
| 552 | 608 | $obj = null; |
| 553 | 609 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
@@ -558,7 +614,9 @@ discard block |
||
| 558 | 614 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
| 559 | 615 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
| 560 | 616 | // Get member_srl of sender/recipient (If not exists, pass) |
| 561 | - if(!$obj->sender) continue; |
|
| 617 | + if(!$obj->sender) { |
|
| 618 | + continue; |
|
| 619 | + } |
|
| 562 | 620 | $sender_args->user_id = $obj->sender; |
| 563 | 621 | $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
| 564 | 622 | $sender_srl = $sender_output->data->member_srl; |
@@ -569,10 +627,14 @@ discard block |
||
| 569 | 627 | $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
| 570 | 628 | $sender_srl = $sender_output->data->member_srl; |
| 571 | 629 | } |
| 572 | - if(!$sender_srl) continue; |
|
| 630 | + if(!$sender_srl) { |
|
| 631 | + continue; |
|
| 632 | + } |
|
| 573 | 633 | |
| 574 | 634 | $receiver_args->user_id = $obj->receiver; |
| 575 | - if(!$obj->receiver) continue; |
|
| 635 | + if(!$obj->receiver) { |
|
| 636 | + continue; |
|
| 637 | + } |
|
| 576 | 638 | $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
| 577 | 639 | $receiver_srl = $receiver_output->data->member_srl; |
| 578 | 640 | if(!$receiver_srl) |
@@ -582,7 +644,9 @@ discard block |
||
| 582 | 644 | $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
| 583 | 645 | $receiver_srl = $receiver_output->data->member_srl; |
| 584 | 646 | } |
| 585 | - if(!$receiver_srl) continue; |
|
| 647 | + if(!$receiver_srl) { |
|
| 648 | + continue; |
|
| 649 | + } |
|
| 586 | 650 | // Message to save into sender's message box |
| 587 | 651 | $sender_args->sender_srl = $sender_srl; |
| 588 | 652 | $sender_args->receiver_srl = $receiver_srl; |
@@ -603,7 +667,9 @@ discard block |
||
| 603 | 667 | $receiver_args->message_srl = $sender_args->related_srl; |
| 604 | 668 | $receiver_args->list_order = $sender_args->related_srl*-1; |
| 605 | 669 | $receiver_args->sender_srl = $sender_srl; |
| 606 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
| 670 | + if(!$receiver_args->sender_srl) { |
|
| 671 | + $receiver_args->sender_srl = $receiver_srl; |
|
| 672 | + } |
|
| 607 | 673 | $receiver_args->receiver_srl = $receiver_srl; |
| 608 | 674 | $receiver_args->message_type = 'R'; |
| 609 | 675 | $receiver_args->title = $obj->title; |
@@ -637,7 +703,9 @@ discard block |
||
| 637 | 703 | $oDocumentModel = getModel('document'); |
| 638 | 704 | $category_list = $category_titles = array(); |
| 639 | 705 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 640 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 706 | + if(count($category_list)) { |
|
| 707 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 708 | + } |
|
| 641 | 709 | // Extract category information |
| 642 | 710 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
| 643 | 711 | if(file_exists($category_file)) |
@@ -650,12 +718,16 @@ discard block |
||
| 650 | 718 | $categories = $xmlDoc->items->category; |
| 651 | 719 | if($categories) |
| 652 | 720 | { |
| 653 | - if(!is_array($categories)) $categories = array($categories); |
|
| 721 | + if(!is_array($categories)) { |
|
| 722 | + $categories = array($categories); |
|
| 723 | + } |
|
| 654 | 724 | $match_sequence = array(); |
| 655 | 725 | foreach($categories as $k => $v) |
| 656 | 726 | { |
| 657 | 727 | $category = trim(base64_decode($v->body)); |
| 658 | - if(!$category || $category_titles[$category]) continue; |
|
| 728 | + if(!$category || $category_titles[$category]) { |
|
| 729 | + continue; |
|
| 730 | + } |
|
| 659 | 731 | |
| 660 | 732 | $sequence = $v->attrs->sequence; |
| 661 | 733 | $parent = $v->attrs->parent; |
@@ -663,10 +735,14 @@ discard block |
||
| 663 | 735 | $obj = null; |
| 664 | 736 | $obj->title = $category; |
| 665 | 737 | $obj->module_srl = $module_srl; |
| 666 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
| 738 | + if($parent) { |
|
| 739 | + $obj->parent_srl = $match_sequence[$parent]; |
|
| 740 | + } |
|
| 667 | 741 | |
| 668 | 742 | $output = $oDocumentController->insertCategory($obj); |
| 669 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
| 743 | + if($output->toBool()) { |
|
| 744 | + $match_sequence[$sequence] = $output->get('category_srl'); |
|
| 745 | + } |
|
| 670 | 746 | } |
| 671 | 747 | $oDocumentController = getController('document'); |
| 672 | 748 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -676,31 +752,45 @@ discard block |
||
| 676 | 752 | |
| 677 | 753 | $category_list = $category_titles = array(); |
| 678 | 754 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 679 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 755 | + if(count($category_list)) { |
|
| 756 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 757 | + } |
|
| 680 | 758 | |
| 681 | 759 | $ek_args->module_srl = $module_srl; |
| 682 | 760 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
| 683 | 761 | if($output->data) |
| 684 | 762 | { |
| 685 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
| 763 | + foreach($output->data as $key => $val) { |
|
| 764 | + $extra_keys[$val->eid] = true; |
|
| 765 | + } |
|
| 686 | 766 | } |
| 687 | 767 | |
| 688 | - if(!$cur) $cur = 0; |
|
| 768 | + if(!$cur) { |
|
| 769 | + $cur = 0; |
|
| 770 | + } |
|
| 689 | 771 | // Open an index file |
| 690 | 772 | $f = fopen($index_file,"r"); |
| 691 | 773 | // Pass if already read |
| 692 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 774 | + for($i=0;$i<$cur;$i++) { |
|
| 775 | + fgets($f, 1024); |
|
| 776 | + } |
|
| 693 | 777 | // Read each line until the condition meets |
| 694 | 778 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
| 695 | 779 | { |
| 696 | - if(feof($f)) break; |
|
| 780 | + if(feof($f)) { |
|
| 781 | + break; |
|
| 782 | + } |
|
| 697 | 783 | // Find a location |
| 698 | 784 | $target_file = trim(fgets($f, 1024)); |
| 699 | 785 | |
| 700 | - if(!file_exists($target_file)) continue; |
|
| 786 | + if(!file_exists($target_file)) { |
|
| 787 | + continue; |
|
| 788 | + } |
|
| 701 | 789 | // Importing data from now on |
| 702 | 790 | $fp = fopen($target_file,"r"); |
| 703 | - if(!$fp) continue; |
|
| 791 | + if(!$fp) { |
|
| 792 | + continue; |
|
| 793 | + } |
|
| 704 | 794 | |
| 705 | 795 | $obj = new stdClass; |
| 706 | 796 | $obj->module_srl = $module_srl; |
@@ -720,38 +810,38 @@ discard block |
||
| 720 | 810 | { |
| 721 | 811 | $started = true; |
| 722 | 812 | // Trackback inserted |
| 723 | - } |
|
| 724 | - else if(substr($str,0,11) == '<trackbacks') |
|
| 813 | + } else if(substr($str,0,11) == '<trackbacks') |
|
| 725 | 814 | { |
| 726 | 815 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
| 727 | 816 | continue; |
| 728 | 817 | // Comments inserted |
| 729 | - } |
|
| 730 | - else if(substr($str,0,9) == '<comments') |
|
| 818 | + } else if(substr($str,0,9) == '<comments') |
|
| 731 | 819 | { |
| 732 | 820 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
| 733 | 821 | continue; |
| 734 | 822 | // Attachment inserted |
| 735 | - } |
|
| 736 | - else if(substr($str,0,9) == '<attaches') |
|
| 823 | + } else if(substr($str,0,9) == '<attaches') |
|
| 737 | 824 | { |
| 738 | 825 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
| 739 | 826 | continue; |
| 740 | 827 | // When starting extra variabls |
| 741 | - } |
|
| 742 | - elseif(trim($str) == '<extra_vars>') |
|
| 828 | + } elseif(trim($str) == '<extra_vars>') |
|
| 743 | 829 | { |
| 744 | 830 | $extra_vars = $this->importExtraVars($fp); |
| 745 | 831 | continue; |
| 746 | 832 | } |
| 747 | 833 | |
| 748 | - if($started) $buff[] = $str; |
|
| 834 | + if($started) { |
|
| 835 | + $buff[] = $str; |
|
| 836 | + } |
|
| 749 | 837 | } |
| 750 | 838 | |
| 751 | 839 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
| 752 | 840 | |
| 753 | 841 | $category = base64_decode($xmlDoc->post->category->body); |
| 754 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
| 842 | + if($category_titles[$category]) { |
|
| 843 | + $obj->category_srl = $category_titles[$category]; |
|
| 844 | + } |
|
| 755 | 845 | |
| 756 | 846 | $obj->member_srl = 0; |
| 757 | 847 | |
@@ -765,16 +855,22 @@ discard block |
||
| 765 | 855 | $obj->password = base64_decode($xmlDoc->post->password->body); |
| 766 | 856 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
| 767 | 857 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
| 768 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 858 | + if(!$obj->user_name) { |
|
| 859 | + $obj->user_name = $obj->nick_name; |
|
| 860 | + } |
|
| 769 | 861 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
| 770 | 862 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
| 771 | 863 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
| 772 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
| 864 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
| 865 | + $obj->homepage = 'http://'.$obj->homepage; |
|
| 866 | + } |
|
| 773 | 867 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
| 774 | 868 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
| 775 | 869 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
| 776 | 870 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
| 777 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 871 | + if(!$obj->last_update) { |
|
| 872 | + $obj->last_update = $obj->regdate; |
|
| 873 | + } |
|
| 778 | 874 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
| 779 | 875 | $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
| 780 | 876 | $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
@@ -819,7 +915,9 @@ discard block |
||
| 819 | 915 | $args->document_srl = $obj->document_srl; |
| 820 | 916 | $args->tag = trim($tag_list[$i]); |
| 821 | 917 | $args->regdate = $obj->regdate; |
| 822 | - if(!$args->tag) continue; |
|
| 918 | + if(!$args->tag) { |
|
| 919 | + continue; |
|
| 920 | + } |
|
| 823 | 921 | $output = executeQuery('tag.insertTag', $args); |
| 824 | 922 | } |
| 825 | 923 | |
@@ -829,7 +927,9 @@ discard block |
||
| 829 | 927 | { |
| 830 | 928 | foreach($extra_vars as $key => $val) |
| 831 | 929 | { |
| 832 | - if(!$val->value) continue; |
|
| 930 | + if(!$val->value) { |
|
| 931 | + continue; |
|
| 932 | + } |
|
| 833 | 933 | unset($e_args); |
| 834 | 934 | $e_args->module_srl = $module_srl; |
| 835 | 935 | $e_args->document_srl = $obj->document_srl; |
@@ -862,7 +962,9 @@ discard block |
||
| 862 | 962 | |
| 863 | 963 | fclose($f); |
| 864 | 964 | // Sync category counts |
| 865 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 965 | + if(count($category_list)) { |
|
| 966 | + foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 967 | + } |
|
| 866 | 968 | |
| 867 | 969 | return $idx-1; |
| 868 | 970 | } |
@@ -884,11 +986,17 @@ discard block |
||
| 884 | 986 | { |
| 885 | 987 | $str = fgets($fp, 1024); |
| 886 | 988 | // If </trackbacks> is, break |
| 887 | - if(trim($str) == '</trackbacks>') break; |
|
| 989 | + if(trim($str) == '</trackbacks>') { |
|
| 990 | + break; |
|
| 991 | + } |
|
| 888 | 992 | // If <trackback>, start importing |
| 889 | - if(trim($str) == '<trackback>') $started = true; |
|
| 993 | + if(trim($str) == '<trackback>') { |
|
| 994 | + $started = true; |
|
| 995 | + } |
|
| 890 | 996 | |
| 891 | - if($started) $buff .= $str; |
|
| 997 | + if($started) { |
|
| 998 | + $buff .= $str; |
|
| 999 | + } |
|
| 892 | 1000 | // If </trackback>, insert to the DB |
| 893 | 1001 | if(trim($str) == '</trackback>') |
| 894 | 1002 | { |
@@ -906,7 +1014,9 @@ discard block |
||
| 906 | 1014 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
| 907 | 1015 | $obj->list_order = -1*$obj->trackback_srl; |
| 908 | 1016 | $output = executeQuery('trackback.insertTrackback', $obj); |
| 909 | - if($output->toBool()) $cnt++; |
|
| 1017 | + if($output->toBool()) { |
|
| 1018 | + $cnt++; |
|
| 1019 | + } |
|
| 910 | 1020 | |
| 911 | 1021 | $buff = null; |
| 912 | 1022 | $started = false; |
@@ -934,7 +1044,9 @@ discard block |
||
| 934 | 1044 | { |
| 935 | 1045 | $str = fgets($fp, 1024); |
| 936 | 1046 | // If </comments> is, break |
| 937 | - if(trim($str) == '</comments>') break; |
|
| 1047 | + if(trim($str) == '</comments>') { |
|
| 1048 | + break; |
|
| 1049 | + } |
|
| 938 | 1050 | // If <comment> is, start importing |
| 939 | 1051 | if(trim($str) == '<comment>') |
| 940 | 1052 | { |
@@ -950,7 +1062,9 @@ discard block |
||
| 950 | 1062 | continue; |
| 951 | 1063 | } |
| 952 | 1064 | |
| 953 | - if($started) $buff .= $str; |
|
| 1065 | + if($started) { |
|
| 1066 | + $buff .= $str; |
|
| 1067 | + } |
|
| 954 | 1068 | // If </comment> is, insert to the DB |
| 955 | 1069 | if(trim($str) == '</comment>') |
| 956 | 1070 | { |
@@ -962,8 +1076,11 @@ discard block |
||
| 962 | 1076 | |
| 963 | 1077 | $obj->module_srl = $module_srl; |
| 964 | 1078 | |
| 965 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
| 966 | - else $obj->parent_srl = 0; |
|
| 1079 | + if($parent) { |
|
| 1080 | + $obj->parent_srl = $sequences[$parent]; |
|
| 1081 | + } else { |
|
| 1082 | + $obj->parent_srl = 0; |
|
| 1083 | + } |
|
| 967 | 1084 | |
| 968 | 1085 | $obj->document_srl = $document_srl; |
| 969 | 1086 | $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
@@ -974,14 +1091,18 @@ discard block |
||
| 974 | 1091 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
| 975 | 1092 | $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
| 976 | 1093 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
| 977 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
| 1094 | + if(!$obj->user_name) { |
|
| 1095 | + $obj->user_name = $obj->nick_name; |
|
| 1096 | + } |
|
| 978 | 1097 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
| 979 | 1098 | $obj->member_srl = 0; |
| 980 | 1099 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
| 981 | 1100 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
| 982 | 1101 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
| 983 | 1102 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
| 984 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 1103 | + if(!$obj->last_update) { |
|
| 1104 | + $obj->last_update = $obj->regdate; |
|
| 1105 | + } |
|
| 985 | 1106 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
| 986 | 1107 | $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
| 987 | 1108 | $obj->list_order = $obj->comment_srl*-1; |
@@ -1019,24 +1140,28 @@ discard block |
||
| 1019 | 1140 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
| 1020 | 1141 | $list_args->depth = 0; |
| 1021 | 1142 | // Get parent_srl if parent comment exists |
| 1022 | - } |
|
| 1023 | - else |
|
| 1143 | + } else |
|
| 1024 | 1144 | { |
| 1025 | 1145 | // Get parent comment infomation |
| 1026 | 1146 | $parent_args->comment_srl = $obj->parent_srl; |
| 1027 | 1147 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
| 1028 | 1148 | // Return if parent comment doesn't exist |
| 1029 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
| 1149 | + if(!$parent_output->toBool() || !$parent_output->data) { |
|
| 1150 | + continue; |
|
| 1151 | + } |
|
| 1030 | 1152 | $parent = $parent_output->data; |
| 1031 | 1153 | |
| 1032 | 1154 | $list_args->head = $parent->head; |
| 1033 | 1155 | $list_args->depth = $parent->depth+1; |
| 1034 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
| 1035 | - else |
|
| 1156 | + if($list_args->depth<2) { |
|
| 1157 | + $list_args->arrange = $obj->comment_srl; |
|
| 1158 | + } else |
|
| 1036 | 1159 | { |
| 1037 | 1160 | $list_args->arrange = $parent->arrange; |
| 1038 | 1161 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
| 1039 | - if(!$output->toBool()) return $output; |
|
| 1162 | + if(!$output->toBool()) { |
|
| 1163 | + return $output; |
|
| 1164 | + } |
|
| 1040 | 1165 | } |
| 1041 | 1166 | } |
| 1042 | 1167 | |
@@ -1044,7 +1169,9 @@ discard block |
||
| 1044 | 1169 | if($output->toBool()) |
| 1045 | 1170 | { |
| 1046 | 1171 | $output = executeQuery('comment.insertComment', $obj); |
| 1047 | - if($output->toBool()) $cnt++; |
|
| 1172 | + if($output->toBool()) { |
|
| 1173 | + $cnt++; |
|
| 1174 | + } |
|
| 1048 | 1175 | } |
| 1049 | 1176 | |
| 1050 | 1177 | $buff = null; |
@@ -1074,7 +1201,9 @@ discard block |
||
| 1074 | 1201 | { |
| 1075 | 1202 | $str = trim(fgets($fp, 1024)); |
| 1076 | 1203 | // If it ends with </attaches>, break |
| 1077 | - if(trim($str) == '</attaches>') break; |
|
| 1204 | + if(trim($str) == '</attaches>') { |
|
| 1205 | + break; |
|
| 1206 | + } |
|
| 1078 | 1207 | // If it starts with <attach>, collect attachments |
| 1079 | 1208 | if(trim($str) == '<attach>') |
| 1080 | 1209 | { |
@@ -1085,14 +1214,15 @@ discard block |
||
| 1085 | 1214 | $started = true; |
| 1086 | 1215 | $buff = null; |
| 1087 | 1216 | // If it starts with <file>, handle the attachement in xml file |
| 1088 | - } |
|
| 1089 | - else if(trim($str) == '<file>') |
|
| 1217 | + } else if(trim($str) == '<file>') |
|
| 1090 | 1218 | { |
| 1091 | 1219 | $file_obj->file = $this->saveTemporaryFile($fp); |
| 1092 | 1220 | continue; |
| 1093 | 1221 | } |
| 1094 | 1222 | |
| 1095 | - if($started) $buff .= $str; |
|
| 1223 | + if($started) { |
|
| 1224 | + $buff .= $str; |
|
| 1225 | + } |
|
| 1096 | 1226 | // If it ends with </attach>, handle attachements |
| 1097 | 1227 | if(trim($str) == '</attach>') |
| 1098 | 1228 | { |
@@ -1105,8 +1235,9 @@ discard block |
||
| 1105 | 1235 | { |
| 1106 | 1236 | $url = base64_decode($xmlDoc->attach->url->body); |
| 1107 | 1237 | $path = base64_decode($xmlDoc->attach->path->body); |
| 1108 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
| 1109 | - else |
|
| 1238 | + if($path && file_exists($path)) { |
|
| 1239 | + $file_obj->file = $path; |
|
| 1240 | + } else |
|
| 1110 | 1241 | { |
| 1111 | 1242 | $file_obj->file = $this->getTmpFilename(); |
| 1112 | 1243 | FileHandler::getRemoteFile($url, $file_obj->file); |
@@ -1137,21 +1268,21 @@ discard block |
||
| 1137 | 1268 | } |
| 1138 | 1269 | |
| 1139 | 1270 | $file_obj->direct_download = 'Y'; |
| 1140 | - } |
|
| 1141 | - else |
|
| 1271 | + } else |
|
| 1142 | 1272 | { |
| 1143 | 1273 | $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
| 1144 | 1274 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
| 1145 | 1275 | $file_obj->direct_download = 'N'; |
| 1146 | 1276 | } |
| 1147 | 1277 | // Create a directory |
| 1148 | - if(!FileHandler::makeDir($path)) continue; |
|
| 1278 | + if(!FileHandler::makeDir($path)) { |
|
| 1279 | + continue; |
|
| 1280 | + } |
|
| 1149 | 1281 | |
| 1150 | 1282 | if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
| 1151 | 1283 | { |
| 1152 | 1284 | FileHandler::rename($file_obj->file, $filename); |
| 1153 | - } |
|
| 1154 | - else |
|
| 1285 | + } else |
|
| 1155 | 1286 | { |
| 1156 | 1287 | copy($file_obj->file, $filename); |
| 1157 | 1288 | } |
@@ -1173,8 +1304,11 @@ discard block |
||
| 1173 | 1304 | $uploaded_count++; |
| 1174 | 1305 | $tmp_obj = null; |
| 1175 | 1306 | $tmp_obj->source_filename = $file_obj->source_filename; |
| 1176 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
| 1177 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
| 1307 | + if($file_obj->direct_download == 'Y') { |
|
| 1308 | + $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
| 1309 | + } else { |
|
| 1310 | + $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
| 1311 | + } |
|
| 1178 | 1312 | } |
| 1179 | 1313 | } |
| 1180 | 1314 | } |
@@ -1192,7 +1326,9 @@ discard block |
||
| 1192 | 1326 | $path = "./files/cache/importer"; |
| 1193 | 1327 | FileHandler::makeDir($path); |
| 1194 | 1328 | $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
| 1195 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
| 1329 | + if(file_exists($filename)) { |
|
| 1330 | + $filename .= rand(111,999); |
|
| 1331 | + } |
|
| 1196 | 1332 | return $filename; |
| 1197 | 1333 | } |
| 1198 | 1334 | |
@@ -1210,7 +1346,9 @@ discard block |
||
| 1210 | 1346 | while(!feof($fp)) |
| 1211 | 1347 | { |
| 1212 | 1348 | $str = trim(fgets($fp, 1024)); |
| 1213 | - if(trim($str) == '</file>') break; |
|
| 1349 | + if(trim($str) == '</file>') { |
|
| 1350 | + break; |
|
| 1351 | + } |
|
| 1214 | 1352 | |
| 1215 | 1353 | $buff .= $str; |
| 1216 | 1354 | |
@@ -1236,14 +1374,20 @@ discard block |
||
| 1236 | 1374 | while(!feof($fp)) |
| 1237 | 1375 | { |
| 1238 | 1376 | $buff .= $str = trim(fgets($fp, 1024)); |
| 1239 | - if(trim($str) == '</extra_vars>') break; |
|
| 1377 | + if(trim($str) == '</extra_vars>') { |
|
| 1378 | + break; |
|
| 1379 | + } |
|
| 1380 | + } |
|
| 1381 | + if(!$buff) { |
|
| 1382 | + return array(); |
|
| 1240 | 1383 | } |
| 1241 | - if(!$buff) return array(); |
|
| 1242 | 1384 | |
| 1243 | 1385 | $buff = '<extra_vars>'.$buff; |
| 1244 | 1386 | $oXmlParser = new XmlParser(); |
| 1245 | 1387 | $xmlDoc = $this->oXmlParser->parse($buff); |
| 1246 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
| 1388 | + if(!count($xmlDoc->extra_vars->key)) { |
|
| 1389 | + return array(); |
|
| 1390 | + } |
|
| 1247 | 1391 | |
| 1248 | 1392 | $index = 1; |
| 1249 | 1393 | foreach($xmlDoc->extra_vars->key as $k => $v) |
@@ -1256,8 +1400,7 @@ discard block |
||
| 1256 | 1400 | $vobj->value = base64_decode($v->value->body); |
| 1257 | 1401 | $vobj->eid = base64_decode($v->eid->body); |
| 1258 | 1402 | |
| 1259 | - } |
|
| 1260 | - else if($v->body) |
|
| 1403 | + } else if($v->body) |
|
| 1261 | 1404 | { |
| 1262 | 1405 | $vobj->var_idx = $index; |
| 1263 | 1406 | $vobj->lang_code = Context::getLangType(); |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | function preProcParam(&$order_target, &$order_type, &$page) |
| 20 | 20 | { |
| 21 | 21 | $order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1); |
| 22 | - if(!isset($order_target_array[$order_target])) |
|
| 22 | + if (!isset($order_target_array[$order_target])) |
|
| 23 | 23 | { |
| 24 | 24 | $order_target = 'newest'; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $order_type_array = array('asc' => 1, 'desc' => 1); |
| 28 | - if(!isset($order_type_array[$order_type])) |
|
| 28 | + if (!isset($order_type_array[$order_type])) |
|
| 29 | 29 | { |
| 30 | 30 | $order_type = 'desc'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $page = (int) $page; |
| 34 | - if($page < 1) |
|
| 34 | + if ($page < 1) |
|
| 35 | 35 | { |
| 36 | 36 | $page = 1; |
| 37 | 37 | } |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $type_array = array('M' => 1, 'P' => 1); |
| 65 | 65 | $type = Context::get('type'); |
| 66 | - if(!isset($type_array[$type])) |
|
| 66 | + if (!isset($type_array[$type])) |
|
| 67 | 67 | { |
| 68 | 68 | $type = 'P'; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if($type == 'P') |
|
| 71 | + if ($type == 'P') |
|
| 72 | 72 | { |
| 73 | 73 | $category_srl = $this->layout_category_srl; |
| 74 | 74 | } |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $type_array = array('M' => 1, 'P' => 1); |
| 97 | 97 | $type = Context::get('type'); |
| 98 | - if(!isset($type_array[$type])) |
|
| 98 | + if (!isset($type_array[$type])) |
|
| 99 | 99 | { |
| 100 | 100 | $type = 'P'; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if($type == 'P') |
|
| 103 | + if ($type == 'P') |
|
| 104 | 104 | { |
| 105 | 105 | $category_srl = $this->module_skin_category_srl; |
| 106 | 106 | } |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL) |
| 120 | 120 | { |
| 121 | - if($type == 'menu') |
|
| 121 | + if ($type == 'menu') |
|
| 122 | 122 | { |
| 123 | 123 | $params["act"] = "getResourceapiMenuPackageList"; |
| 124 | 124 | } |
| 125 | - elseif($type == 'skin') |
|
| 125 | + elseif ($type == 'skin') |
|
| 126 | 126 | { |
| 127 | 127 | $params["act"] = "getResourceapiSkinPackageList"; |
| 128 | 128 | $params['parent_program'] = $parent_program; |
@@ -137,18 +137,18 @@ discard block |
||
| 137 | 137 | $params["order_type"] = $order_type; |
| 138 | 138 | $params["page"] = $page; |
| 139 | 139 | |
| 140 | - if($category_srl) |
|
| 140 | + if ($category_srl) |
|
| 141 | 141 | { |
| 142 | 142 | $params["category_srl"] = $category_srl; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if($search_keyword) |
|
| 145 | + if ($search_keyword) |
|
| 146 | 146 | { |
| 147 | 147 | $params["search_keyword"] = $search_keyword; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $xmlDoc = XmlGenerater::getXmlDoc($params); |
| 151 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
| 151 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
| 152 | 152 | { |
| 153 | 153 | $item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item); |
| 154 | 154 | $this->add('item_list', $item_list); |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $is_authed = 0; |
| 171 | 171 | $output = $oAdminModel->checkUseDirectModuleInstall($package); |
| 172 | - if($output->toBool()==TRUE) |
|
| 172 | + if ($output->toBool() == TRUE) |
|
| 173 | 173 | { |
| 174 | 174 | $is_authed = 1; |
| 175 | 175 | } |
| 176 | 176 | else |
| 177 | 177 | { |
| 178 | 178 | $ftp_info = Context::getFTPInfo(); |
| 179 | - if(!$ftp_info->ftp_root_path) |
|
| 179 | + if (!$ftp_info->ftp_root_path) |
|
| 180 | 180 | { |
| 181 | 181 | $is_authed = -1; |
| 182 | 182 | } |
@@ -196,14 +196,14 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | $oModel = getModel('autoinstall'); |
| 198 | 198 | $output = executeQueryArray('autoinstall.getNeedUpdate'); |
| 199 | - if(!is_array($output->data)) |
|
| 199 | + if (!is_array($output->data)) |
|
| 200 | 200 | { |
| 201 | 201 | return NULL; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $result = array(); |
| 205 | 205 | $xml = new XmlParser(); |
| 206 | - foreach($output->data as $package) |
|
| 206 | + foreach ($output->data as $package) |
|
| 207 | 207 | { |
| 208 | 208 | $packageSrl = $package->package_srl; |
| 209 | 209 | |
@@ -213,27 +213,27 @@ discard block |
||
| 213 | 213 | $packageInfo->type = $oModel->getTypeFromPath($package->path); |
| 214 | 214 | $packageInfo->url = $oModel->getUpdateUrlByPackageSrl($package->package_srl); |
| 215 | 215 | |
| 216 | - if($packageInfo->type == 'core') |
|
| 216 | + if ($packageInfo->type == 'core') |
|
| 217 | 217 | { |
| 218 | 218 | $title = 'XpressEngine'; |
| 219 | 219 | } |
| 220 | 220 | else |
| 221 | 221 | { |
| 222 | 222 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
| 223 | - $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
|
| 223 | + $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path).$configFile); |
|
| 224 | 224 | |
| 225 | - if($xmlDoc) |
|
| 225 | + if ($xmlDoc) |
|
| 226 | 226 | { |
| 227 | 227 | $type = $packageInfo->type; |
| 228 | - if($type == "drcomponent") |
|
| 228 | + if ($type == "drcomponent") |
|
| 229 | 229 | { |
| 230 | 230 | $type = "component"; |
| 231 | 231 | } |
| 232 | - if($type == "style" || $type == "m.skin") |
|
| 232 | + if ($type == "style" || $type == "m.skin") |
|
| 233 | 233 | { |
| 234 | 234 | $type = "skin"; |
| 235 | 235 | } |
| 236 | - if($type == "m.layout") |
|
| 236 | + if ($type == "m.layout") |
|
| 237 | 237 | { |
| 238 | 238 | $type = "layout"; |
| 239 | 239 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $oModel = getModel('autoinstall'); |
| 268 | 268 | |
| 269 | 269 | $targetpackages = array(); |
| 270 | - if($xmlDoc) |
|
| 270 | + if ($xmlDoc) |
|
| 271 | 271 | { |
| 272 | 272 | $xmlPackage = $xmlDoc->response->package; |
| 273 | 273 | $package = new stdClass(); |
@@ -276,15 +276,15 @@ discard block |
||
| 276 | 276 | $package->package_description = $xmlPackage->package_description->body; |
| 277 | 277 | $package->version = $xmlPackage->version->body; |
| 278 | 278 | $package->path = $xmlPackage->path->body; |
| 279 | - if($xmlPackage->depends) |
|
| 279 | + if ($xmlPackage->depends) |
|
| 280 | 280 | { |
| 281 | - if(!is_array($xmlPackage->depends->item)) |
|
| 281 | + if (!is_array($xmlPackage->depends->item)) |
|
| 282 | 282 | { |
| 283 | 283 | $xmlPackage->depends->item = array($xmlPackage->depends->item); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $package->depends = array(); |
| 287 | - foreach($xmlPackage->depends->item as $item) |
|
| 287 | + foreach ($xmlPackage->depends->item as $item) |
|
| 288 | 288 | { |
| 289 | 289 | $dep_item = new stdClass(); |
| 290 | 290 | $dep_item->package_srl = $item->package_srl->body; |
@@ -297,23 +297,23 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | $packages = $oModel->getInstalledPackages(array_keys($targetpackages)); |
| 299 | 299 | $package->deplist = ""; |
| 300 | - foreach($package->depends as $key => $dep) |
|
| 300 | + foreach ($package->depends as $key => $dep) |
|
| 301 | 301 | { |
| 302 | - if(!$packages[$dep->package_srl]) |
|
| 302 | + if (!$packages[$dep->package_srl]) |
|
| 303 | 303 | { |
| 304 | 304 | $package->depends[$key]->installed = FALSE; |
| 305 | - $package->package_srl .= "," . $dep->package_srl; |
|
| 305 | + $package->package_srl .= ",".$dep->package_srl; |
|
| 306 | 306 | } |
| 307 | 307 | else |
| 308 | 308 | { |
| 309 | 309 | $package->depends[$key]->installed = TRUE; |
| 310 | 310 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
| 311 | - if(version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
| 311 | + if (version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
| 312 | 312 | { |
| 313 | 313 | $package->depends[$key]->need_update = TRUE; |
| 314 | - $package->package_srl .= "," . $dep->package_srl; |
|
| 314 | + $package->package_srl .= ",".$dep->package_srl; |
|
| 315 | 315 | |
| 316 | - if($dep->path === '.') |
|
| 316 | + if ($dep->path === '.') |
|
| 317 | 317 | { |
| 318 | 318 | $package->contain_core = TRUE; |
| 319 | 319 | $package->contain_core_version = $dep->version; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $installedPackage = $oModel->getInstalledPackage($packageSrl); |
| 331 | - if($installedPackage) |
|
| 331 | + if ($installedPackage) |
|
| 332 | 332 | { |
| 333 | 333 | $package->installed = TRUE; |
| 334 | 334 | $package->cur_version = $installedPackage->current_version; |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | public function getAutoInstallAdminInstallInfo() |
| 346 | 346 | { |
| 347 | 347 | $packageSrl = Context::get('package_srl'); |
| 348 | - if(!$packageSrl) |
|
| 348 | + if (!$packageSrl) |
|
| 349 | 349 | { |
| 350 | 350 | return new BaseObject(-1, 'msg_invalid_request'); |
| 351 | 351 | } |
@@ -359,23 +359,23 @@ discard block |
||
| 359 | 359 | $directModuleInstall = TRUE; |
| 360 | 360 | $arrUnwritableDir = array(); |
| 361 | 361 | $output = $this->isWritableDir($package->path); |
| 362 | - if($output->toBool()==FALSE) |
|
| 362 | + if ($output->toBool() == FALSE) |
|
| 363 | 363 | { |
| 364 | 364 | $directModuleInstall = FALSE; |
| 365 | 365 | $arrUnwritableDir[] = $output->get('path'); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - foreach($package->depends as $dep) |
|
| 368 | + foreach ($package->depends as $dep) |
|
| 369 | 369 | { |
| 370 | 370 | $output = $this->isWritableDir($dep->path); |
| 371 | - if($output->toBool()==FALSE) |
|
| 371 | + if ($output->toBool() == FALSE) |
|
| 372 | 372 | { |
| 373 | 373 | $directModuleInstall = FALSE; |
| 374 | 374 | $arrUnwritableDir[] = $output->get('path'); |
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if($directModuleInstall==FALSE) |
|
| 378 | + if ($directModuleInstall == FALSE) |
|
| 379 | 379 | { |
| 380 | 380 | $output = new BaseObject(-1, 'msg_direct_inall_invalid'); |
| 381 | 381 | $output->add('path', $arrUnwritableDir); |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | $path_list = explode('/', dirname($path)); |
| 391 | 391 | $real_path = './'; |
| 392 | 392 | |
| 393 | - while($path_list) |
|
| 393 | + while ($path_list) |
|
| 394 | 394 | { |
| 395 | - $check_path = realpath($real_path . implode('/', $path_list)); |
|
| 396 | - if(FileHandler::isDir($check_path)) |
|
| 395 | + $check_path = realpath($real_path.implode('/', $path_list)); |
|
| 396 | + if (FileHandler::isDir($check_path)) |
|
| 397 | 397 | { |
| 398 | 398 | break; |
| 399 | 399 | } |
| 400 | 400 | array_pop($path_list); |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - if(FileHandler::isWritableDir($check_path)==FALSE) |
|
| 403 | + if (FileHandler::isWritableDir($check_path) == FALSE) |
|
| 404 | 404 | { |
| 405 | 405 | $output = new BaseObject(-1, 'msg_unwritable_directory'); |
| 406 | 406 | $output->add('path', FileHandler::getRealPath($check_path)); |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | * @author NAVER ([email protected]) |
| 8 | 8 | */ |
| 9 | -if(!defined('__XE__')) |
|
| 9 | +if (!defined('__XE__')) |
|
| 10 | 10 | { |
| 11 | 11 | exit(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist |
| 15 | -if(!function_exists('iconv')) |
|
| 15 | +if (!function_exists('iconv')) |
|
| 16 | 16 | { |
| 17 | 17 | eval(' |
| 18 | 18 | function iconv($in_charset, $out_charset, $str) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $oDB = DB::getInstance(); |
| 222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns); |
| 223 | - if(!is_array($output->data) && count($output->data) > 0) |
|
| 223 | + if (!is_array($output->data) && count($output->data) > 0) |
|
| 224 | 224 | { |
| 225 | 225 | $output->data = array($output->data); |
| 226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | function setUserSequence($seq) |
| 251 | 251 | { |
| 252 | 252 | $arr_seq = array(); |
| 253 | - if(isset($_SESSION['seq'])) |
|
| 253 | + if (isset($_SESSION['seq'])) |
|
| 254 | 254 | { |
| 255 | 255 | $arr_seq = $_SESSION['seq']; |
| 256 | 256 | } |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function checkUserSequence($seq) |
| 268 | 268 | { |
| 269 | - if(!isset($_SESSION['seq'])) |
|
| 269 | + if (!isset($_SESSION['seq'])) |
|
| 270 | 270 | { |
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | - if(!in_array($seq, $_SESSION['seq'])) |
|
| 273 | + if (!in_array($seq, $_SESSION['seq'])) |
|
| 274 | 274 | { |
| 275 | 275 | return false; |
| 276 | 276 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $num_args = func_num_args(); |
| 297 | 297 | $args_list = func_get_args(); |
| 298 | 298 | |
| 299 | - if($num_args) |
|
| 299 | + if ($num_args) |
|
| 300 | 300 | $url = Context::getUrl($num_args, $args_list); |
| 301 | 301 | else |
| 302 | 302 | $url = Context::getRequestUri(); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $num_args = func_num_args(); |
| 316 | 316 | $args_list = func_get_args(); |
| 317 | 317 | |
| 318 | - if($num_args) |
|
| 318 | + if ($num_args) |
|
| 319 | 319 | { |
| 320 | 320 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 321 | 321 | } |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $num_args = func_num_args(); |
| 339 | 339 | $args_list = func_get_args(); |
| 340 | 340 | |
| 341 | - if($num_args) |
|
| 341 | + if ($num_args) |
|
| 342 | 342 | { |
| 343 | 343 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
| 344 | 344 | } |
@@ -360,16 +360,16 @@ discard block |
||
| 360 | 360 | $num_args = func_num_args(); |
| 361 | 361 | $args_list = func_get_args(); |
| 362 | 362 | $request_uri = Context::getRequestUri(); |
| 363 | - if(!$num_args) |
|
| 363 | + if (!$num_args) |
|
| 364 | 364 | { |
| 365 | 365 | return $request_uri; |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | $url = Context::getUrl($num_args, $args_list); |
| 369 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 369 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 370 | 370 | { |
| 371 | 371 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 372 | - return substr($match[0], 0, -1) . $url; |
|
| 372 | + return substr($match[0], 0, -1).$url; |
|
| 373 | 373 | } |
| 374 | 374 | return $url; |
| 375 | 375 | } |
@@ -384,17 +384,17 @@ discard block |
||
| 384 | 384 | $num_args = func_num_args(); |
| 385 | 385 | $args_list = func_get_args(); |
| 386 | 386 | $request_uri = Context::getRequestUri(); |
| 387 | - if(!$num_args) |
|
| 387 | + if (!$num_args) |
|
| 388 | 388 | { |
| 389 | 389 | return $request_uri; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 393 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 393 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 394 | 394 | { |
| 395 | 395 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 396 | 396 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
| 397 | - return substr($match[0], 0, -1) . $url; |
|
| 397 | + return substr($match[0], 0, -1).$url; |
|
| 398 | 398 | } |
| 399 | 399 | return $url; |
| 400 | 400 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $num_args = func_num_args(); |
| 411 | 411 | $args_list = func_get_args(); |
| 412 | 412 | |
| 413 | - if(!$num_args) |
|
| 413 | + if (!$num_args) |
|
| 414 | 414 | { |
| 415 | 415 | return Context::getRequestUri(); |
| 416 | 416 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $num_args = func_num_args(); |
| 433 | 433 | $args_list = func_get_args(); |
| 434 | 434 | |
| 435 | - if(!$num_args) |
|
| 435 | + if (!$num_args) |
|
| 436 | 436 | { |
| 437 | 437 | return Context::getRequestUri(); |
| 438 | 438 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $args_list = func_get_args(); |
| 455 | 455 | |
| 456 | 456 | $request_uri = Context::getRequestUri(); |
| 457 | - if(!$num_args) |
|
| 457 | + if (!$num_args) |
|
| 458 | 458 | { |
| 459 | 459 | return $request_uri; |
| 460 | 460 | } |
@@ -463,10 +463,10 @@ discard block |
||
| 463 | 463 | $num_args = count($args_list); |
| 464 | 464 | |
| 465 | 465 | $url = Context::getUrl($num_args, $args_list, $domain); |
| 466 | - if(strncasecmp('http', $url, 4) !== 0) |
|
| 466 | + if (strncasecmp('http', $url, 4) !== 0) |
|
| 467 | 467 | { |
| 468 | 468 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
| 469 | - return substr($match[0], 0, -1) . $url; |
|
| 469 | + return substr($match[0], 0, -1).$url; |
|
| 470 | 470 | } |
| 471 | 471 | return $url; |
| 472 | 472 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | function getCurrentPageUrl() |
| 480 | 480 | { |
| 481 | 481 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
| 482 | - $url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
| 482 | + $url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
| 483 | 483 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
| 484 | 484 | } |
| 485 | 485 | |
@@ -504,12 +504,12 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | function cut_str($string, $cut_size = 0, $tail = '...') |
| 506 | 506 | { |
| 507 | - if($cut_size < 1 || !$string) |
|
| 507 | + if ($cut_size < 1 || !$string) |
|
| 508 | 508 | { |
| 509 | 509 | return $string; |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 512 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
| 513 | 513 | { |
| 514 | 514 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
| 515 | 515 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -523,16 +523,16 @@ discard block |
||
| 523 | 523 | $char_count = 0; |
| 524 | 524 | |
| 525 | 525 | $idx = 0; |
| 526 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 526 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
| 527 | 527 | { |
| 528 | 528 | $c = ord(substr($string, $idx, 1)); |
| 529 | 529 | $char_count++; |
| 530 | - if($c < 128) |
|
| 530 | + if ($c < 128) |
|
| 531 | 531 | { |
| 532 | 532 | $char_width += (int) $chars[$c - 32]; |
| 533 | 533 | $idx++; |
| 534 | 534 | } |
| 535 | - else if(191 < $c && $c < 224) |
|
| 535 | + else if (191 < $c && $c < 224) |
|
| 536 | 536 | { |
| 537 | 537 | $char_width += $chars[4]; |
| 538 | 538 | $idx += 2; |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | $output = substr($string, 0, $idx); |
| 548 | - if(strlen($output) < $string_length) |
|
| 548 | + if (strlen($output) < $string_length) |
|
| 549 | 549 | { |
| 550 | 550 | $output .= $tail; |
| 551 | 551 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | function zgap() |
| 562 | 562 | { |
| 563 | 563 | $time_zone = $GLOBALS['_time_zone']; |
| 564 | - if($time_zone < 0) |
|
| 564 | + if ($time_zone < 0) |
|
| 565 | 565 | { |
| 566 | 566 | $to = -1; |
| 567 | 567 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $t_min = substr($time_zone, 3, 2) * $to; |
| 575 | 575 | |
| 576 | 576 | $server_time_zone = date("O"); |
| 577 | - if($server_time_zone < 0) |
|
| 577 | + if ($server_time_zone < 0) |
|
| 578 | 578 | { |
| 579 | 579 | $so = -1; |
| 580 | 580 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | function ztime($str) |
| 603 | 603 | { |
| 604 | - if(!$str) |
|
| 604 | + if (!$str) |
|
| 605 | 605 | { |
| 606 | 606 | return; |
| 607 | 607 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $year = (int) substr($str, 0, 4); |
| 613 | 613 | $month = (int) substr($str, 4, 2); |
| 614 | 614 | $day = (int) substr($str, 6, 2); |
| 615 | - if(strlen($str) <= 8) |
|
| 615 | + if (strlen($str) <= 8) |
|
| 616 | 616 | { |
| 617 | 617 | $gap = 0; |
| 618 | 618 | } |
@@ -636,19 +636,19 @@ discard block |
||
| 636 | 636 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
| 637 | 637 | |
| 638 | 638 | $lang_time_gap = Context::getLang('time_gap'); |
| 639 | - if($gap < 60) |
|
| 639 | + if ($gap < 60) |
|
| 640 | 640 | { |
| 641 | 641 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
| 642 | 642 | } |
| 643 | - elseif($gap < 60 * 60) |
|
| 643 | + elseif ($gap < 60 * 60) |
|
| 644 | 644 | { |
| 645 | 645 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
| 646 | 646 | } |
| 647 | - elseif($gap < 60 * 60 * 2) |
|
| 647 | + elseif ($gap < 60 * 60 * 2) |
|
| 648 | 648 | { |
| 649 | 649 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
| 650 | 650 | } |
| 651 | - elseif($gap < 60 * 60 * 24) |
|
| 651 | + elseif ($gap < 60 * 60 * 24) |
|
| 652 | 652 | { |
| 653 | 653 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
| 654 | 654 | } |
@@ -685,40 +685,40 @@ discard block |
||
| 685 | 685 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
| 686 | 686 | { |
| 687 | 687 | // return null if no target time is specified |
| 688 | - if(!$str) |
|
| 688 | + if (!$str) |
|
| 689 | 689 | { |
| 690 | 690 | return; |
| 691 | 691 | } |
| 692 | 692 | // convert the date format according to the language |
| 693 | - if($conversion == TRUE) |
|
| 693 | + if ($conversion == TRUE) |
|
| 694 | 694 | { |
| 695 | - switch(Context::getLangType()) |
|
| 695 | + switch (Context::getLangType()) |
|
| 696 | 696 | { |
| 697 | 697 | case 'en' : |
| 698 | 698 | case 'es' : |
| 699 | - if($format == 'Y-m-d') |
|
| 699 | + if ($format == 'Y-m-d') |
|
| 700 | 700 | { |
| 701 | 701 | $format = 'M d, Y'; |
| 702 | 702 | } |
| 703 | - elseif($format == 'Y-m-d H:i:s') |
|
| 703 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 704 | 704 | { |
| 705 | 705 | $format = 'M d, Y H:i:s'; |
| 706 | 706 | } |
| 707 | - elseif($format == 'Y-m-d H:i') |
|
| 707 | + elseif ($format == 'Y-m-d H:i') |
|
| 708 | 708 | { |
| 709 | 709 | $format = 'M d, Y H:i'; |
| 710 | 710 | } |
| 711 | 711 | break; |
| 712 | 712 | case 'vi' : |
| 713 | - if($format == 'Y-m-d') |
|
| 713 | + if ($format == 'Y-m-d') |
|
| 714 | 714 | { |
| 715 | 715 | $format = 'd-m-Y'; |
| 716 | 716 | } |
| 717 | - elseif($format == 'Y-m-d H:i:s') |
|
| 717 | + elseif ($format == 'Y-m-d H:i:s') |
|
| 718 | 718 | { |
| 719 | 719 | $format = 'H:i:s d-m-Y'; |
| 720 | 720 | } |
| 721 | - elseif($format == 'Y-m-d H:i') |
|
| 721 | + elseif ($format == 'Y-m-d H:i') |
|
| 722 | 722 | { |
| 723 | 723 | $format = 'H:i d-m-Y'; |
| 724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | // If year value is less than 1970, handle it separately. |
| 730 | - if((int) substr($str, 0, 4) < 1970) |
|
| 730 | + if ((int) substr($str, 0, 4) < 1970) |
|
| 731 | 731 | { |
| 732 | 732 | $hour = (int) substr($str, 8, 2); |
| 733 | 733 | $min = (int) substr($str, 10, 2); |
@@ -777,9 +777,9 @@ discard block |
||
| 777 | 777 | function getEncodeEmailAddress($email) |
| 778 | 778 | { |
| 779 | 779 | $return = ''; |
| 780 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 780 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
| 781 | 781 | { |
| 782 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
| 782 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
| 783 | 783 | } |
| 784 | 784 | return $return; |
| 785 | 785 | } |
@@ -799,25 +799,25 @@ discard block |
||
| 799 | 799 | { |
| 800 | 800 | static $debug_file; |
| 801 | 801 | |
| 802 | - if(!(__DEBUG__ & 1)) |
|
| 802 | + if (!(__DEBUG__ & 1)) |
|
| 803 | 803 | { |
| 804 | 804 | return; |
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | static $firephp; |
| 808 | 808 | $bt = debug_backtrace(); |
| 809 | - if(is_array($bt)) |
|
| 809 | + if (is_array($bt)) |
|
| 810 | 810 | { |
| 811 | 811 | $bt_debug_print = array_shift($bt); |
| 812 | 812 | $bt_called_function = array_shift($bt); |
| 813 | 813 | } |
| 814 | 814 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
| 815 | 815 | $line_num = $bt_debug_print['line']; |
| 816 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
| 816 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
| 817 | 817 | |
| 818 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 818 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 819 | 819 | { |
| 820 | - if(!isset($firephp)) |
|
| 820 | + if (!isset($firephp)) |
|
| 821 | 821 | { |
| 822 | 822 | $firephp = FirePHP::getInstance(TRUE); |
| 823 | 823 | } |
@@ -826,16 +826,16 @@ discard block |
||
| 826 | 826 | $label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); |
| 827 | 827 | |
| 828 | 828 | // Check a FirePHP option |
| 829 | - if($display_option === 'TABLE') |
|
| 829 | + if ($display_option === 'TABLE') |
|
| 830 | 830 | { |
| 831 | 831 | $label = $display_option; |
| 832 | 832 | } |
| 833 | - if($display_option === 'ERROR') |
|
| 833 | + if ($display_option === 'ERROR') |
|
| 834 | 834 | { |
| 835 | 835 | $type = $display_option; |
| 836 | 836 | } |
| 837 | 837 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
| 838 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 838 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 839 | 839 | { |
| 840 | 840 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
| 841 | 841 | $label = NULL; |
@@ -845,52 +845,52 @@ discard block |
||
| 845 | 845 | } |
| 846 | 846 | else |
| 847 | 847 | { |
| 848 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 848 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 849 | 849 | { |
| 850 | 850 | return; |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | $print = array(); |
| 854 | - if(!$debug_file) |
|
| 854 | + if (!$debug_file) |
|
| 855 | 855 | { |
| 856 | - $debug_file = _XE_PATH_ . 'files/' . $file; |
|
| 856 | + $debug_file = _XE_PATH_.'files/'.$file; |
|
| 857 | 857 | } |
| 858 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
| 858 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
| 859 | 859 | |
| 860 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
| 860 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
| 861 | 861 | { |
| 862 | - $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));; |
|
| 862 | + $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ; |
|
| 863 | 863 | $print[] = str_repeat('=', 80); |
| 864 | 864 | } |
| 865 | 865 | $type = gettype($debug_output); |
| 866 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
| 866 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
| 867 | 867 | { |
| 868 | - if($display_option === 'ERROR') |
|
| 868 | + if ($display_option === 'ERROR') |
|
| 869 | 869 | { |
| 870 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
| 870 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
| 871 | 871 | } |
| 872 | 872 | else |
| 873 | 873 | { |
| 874 | - $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
| 874 | + $print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; |
|
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | else |
| 878 | 878 | { |
| 879 | - $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
|
| 879 | + $print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".' ', print_r($debug_output, true))); |
|
| 880 | 880 | } |
| 881 | 881 | $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 882 | 882 | $backtrace = debug_backtrace($backtrace_args); |
| 883 | 883 | |
| 884 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
| 884 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
| 885 | 885 | { |
| 886 | 886 | array_shift($backtrace); |
| 887 | 887 | } |
| 888 | - foreach($backtrace as $val) |
|
| 888 | + foreach ($backtrace as $val) |
|
| 889 | 889 | { |
| 890 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line']; |
|
| 890 | + $print[] = ' - '.$val['file'].' : '.$val['line']; |
|
| 891 | 891 | } |
| 892 | 892 | $print[] = PHP_EOL; |
| 893 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 893 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 894 | 894 | } |
| 895 | 895 | } |
| 896 | 896 | |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | */ |
| 902 | 902 | function writeSlowlog($type, $elapsed_time, $obj) |
| 903 | 903 | { |
| 904 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 904 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
| 905 | 905 | |
| 906 | 906 | static $log_filename = array( |
| 907 | 907 | 'query' => 'files/_slowlog_query.php', |
@@ -911,47 +911,47 @@ discard block |
||
| 911 | 911 | ); |
| 912 | 912 | $write_file = true; |
| 913 | 913 | |
| 914 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
| 914 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
| 915 | 915 | |
| 916 | 916 | $buff = array(); |
| 917 | 917 | $buff[] = '<?php exit(); ?>'; |
| 918 | 918 | $buff[] = date('c'); |
| 919 | 919 | |
| 920 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 920 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
| 921 | 921 | { |
| 922 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 923 | - $buff[] = "\tCalled : " . $obj->called; |
|
| 922 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 923 | + $buff[] = "\tCalled : ".$obj->called; |
|
| 924 | 924 | } |
| 925 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 925 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
| 926 | 926 | { |
| 927 | - $buff[] = "\tAddon : " . $obj->called; |
|
| 928 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
| 927 | + $buff[] = "\tAddon : ".$obj->called; |
|
| 928 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
| 929 | 929 | } |
| 930 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 930 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
| 931 | 931 | { |
| 932 | - $buff[] = "\tWidget : " . $obj->called; |
|
| 932 | + $buff[] = "\tWidget : ".$obj->called; |
|
| 933 | 933 | } |
| 934 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 934 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
| 935 | 935 | { |
| 936 | 936 | |
| 937 | 937 | $buff[] = $obj->query; |
| 938 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
| 939 | - $buff[] = "\tCaller : " . $obj->caller; |
|
| 940 | - $buff[] = "\tConnection : " . $obj->connection; |
|
| 938 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
| 939 | + $buff[] = "\tCaller : ".$obj->caller; |
|
| 940 | + $buff[] = "\tConnection : ".$obj->connection; |
|
| 941 | 941 | } |
| 942 | 942 | else |
| 943 | 943 | { |
| 944 | 944 | $write_file = false; |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | - if($write_file) |
|
| 947 | + if ($write_file) |
|
| 948 | 948 | { |
| 949 | 949 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
| 950 | - $buff[] = PHP_EOL . PHP_EOL; |
|
| 950 | + $buff[] = PHP_EOL.PHP_EOL; |
|
| 951 | 951 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
| 952 | 952 | } |
| 953 | 953 | |
| 954 | - if($type != 'query') |
|
| 954 | + if ($type != 'query') |
|
| 955 | 955 | { |
| 956 | 956 | $trigger_args = $obj; |
| 957 | 957 | $trigger_args->_log_type = $type; |
@@ -991,11 +991,11 @@ discard block |
||
| 991 | 991 | */ |
| 992 | 992 | function delObjectVars($target_obj, $del_obj) |
| 993 | 993 | { |
| 994 | - if(!is_object($target_obj)) |
|
| 994 | + if (!is_object($target_obj)) |
|
| 995 | 995 | { |
| 996 | 996 | return; |
| 997 | 997 | } |
| 998 | - if(!is_object($del_obj)) |
|
| 998 | + if (!is_object($del_obj)) |
|
| 999 | 999 | { |
| 1000 | 1000 | return; |
| 1001 | 1001 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | |
| 1006 | 1006 | $target = array_keys($target_vars); |
| 1007 | 1007 | $del = array_keys($del_vars); |
| 1008 | - if(!count($target) || !count($del)) |
|
| 1008 | + if (!count($target) || !count($del)) |
|
| 1009 | 1009 | { |
| 1010 | 1010 | return $target_obj; |
| 1011 | 1011 | } |
@@ -1013,10 +1013,10 @@ discard block |
||
| 1013 | 1013 | $return_obj = new stdClass(); |
| 1014 | 1014 | |
| 1015 | 1015 | $target_count = count($target); |
| 1016 | - for($i = 0; $i < $target_count; $i++) |
|
| 1016 | + for ($i = 0; $i < $target_count; $i++) |
|
| 1017 | 1017 | { |
| 1018 | 1018 | $target_key = $target[$i]; |
| 1019 | - if(!in_array($target_key, $del)) |
|
| 1019 | + if (!in_array($target_key, $del)) |
|
| 1020 | 1020 | { |
| 1021 | 1021 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
| 1022 | 1022 | } |
@@ -1029,10 +1029,10 @@ discard block |
||
| 1029 | 1029 | { |
| 1030 | 1030 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
| 1031 | 1031 | |
| 1032 | - foreach($del_vars as $var) |
|
| 1032 | + foreach ($del_vars as $var) |
|
| 1033 | 1033 | { |
| 1034 | - if(is_array($vars)) unset($vars[$var]); |
|
| 1035 | - else if(is_object($vars)) unset($vars->$var); |
|
| 1034 | + if (is_array($vars)) unset($vars[$var]); |
|
| 1035 | + else if (is_object($vars)) unset($vars->$var); |
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | return $vars; |
@@ -1049,12 +1049,12 @@ discard block |
||
| 1049 | 1049 | */ |
| 1050 | 1050 | function handleError($errno, $errstr, $file, $line) |
| 1051 | 1051 | { |
| 1052 | - if(!__DEBUG__) |
|
| 1052 | + if (!__DEBUG__) |
|
| 1053 | 1053 | { |
| 1054 | 1054 | return; |
| 1055 | 1055 | } |
| 1056 | 1056 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
| 1057 | - if(!in_array($errno, $errors)) |
|
| 1057 | + if (!in_array($errno, $errors)) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | return; |
| 1060 | 1060 | } |
@@ -1074,8 +1074,8 @@ discard block |
||
| 1074 | 1074 | function getNumberingPath($no, $size = 3) |
| 1075 | 1075 | { |
| 1076 | 1076 | $mod = pow(10, $size); |
| 1077 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
| 1078 | - if($no >= $mod) |
|
| 1077 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
| 1078 | + if ($no >= $mod) |
|
| 1079 | 1079 | { |
| 1080 | 1080 | $output .= getNumberingPath((int) $no / $mod, $size); |
| 1081 | 1081 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | |
| 1096 | 1096 | function purifierHtml(&$content) |
| 1097 | 1097 | { |
| 1098 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
| 1098 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
| 1099 | 1099 | $oPurifier = Purifier::getInstance(); |
| 1100 | 1100 | $oPurifier->purify($content); |
| 1101 | 1101 | } |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | */ |
| 1109 | 1109 | function removeHackTag($content) |
| 1110 | 1110 | { |
| 1111 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
| 1111 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
| 1112 | 1112 | $oEmbedFilter = EmbedFilter::getInstance(); |
| 1113 | 1113 | $oEmbedFilter->check($content); |
| 1114 | 1114 | |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | */ |
| 1151 | 1151 | function checkUploadedFile($file) |
| 1152 | 1152 | { |
| 1153 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
| 1153 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
| 1154 | 1154 | return UploadFileFilter::check($file); |
| 1155 | 1155 | } |
| 1156 | 1156 | |
@@ -1164,13 +1164,13 @@ discard block |
||
| 1164 | 1164 | { |
| 1165 | 1165 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
| 1166 | 1166 | |
| 1167 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1167 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
| 1168 | 1168 | { |
| 1169 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1169 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
| 1170 | 1170 | { |
| 1171 | 1171 | $content .= '</xmp>'; |
| 1172 | 1172 | } |
| 1173 | - else if($close_xmp < $start_xmp) |
|
| 1173 | + else if ($close_xmp < $start_xmp) |
|
| 1174 | 1174 | { |
| 1175 | 1175 | $content .= '</xmp>'; |
| 1176 | 1176 | } |
@@ -1190,33 +1190,33 @@ discard block |
||
| 1190 | 1190 | $tag = strtolower($match[2]); |
| 1191 | 1191 | |
| 1192 | 1192 | // xmp tag ?뺣━ |
| 1193 | - if($tag == 'xmp') |
|
| 1193 | + if ($tag == 'xmp') |
|
| 1194 | 1194 | { |
| 1195 | 1195 | return "<{$match[1]}xmp>"; |
| 1196 | 1196 | } |
| 1197 | - if($match[1]) |
|
| 1197 | + if ($match[1]) |
|
| 1198 | 1198 | { |
| 1199 | 1199 | return $match[0]; |
| 1200 | 1200 | } |
| 1201 | - if($match[4]) |
|
| 1201 | + if ($match[4]) |
|
| 1202 | 1202 | { |
| 1203 | - $match[4] = ' ' . $match[4]; |
|
| 1203 | + $match[4] = ' '.$match[4]; |
|
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | $attrs = array(); |
| 1207 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1207 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
| 1208 | 1208 | { |
| 1209 | - foreach($m[1] as $idx => $name) |
|
| 1209 | + foreach ($m[1] as $idx => $name) |
|
| 1210 | 1210 | { |
| 1211 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1211 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
| 1212 | 1212 | { |
| 1213 | 1213 | continue; |
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | - $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); |
|
| 1216 | + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); |
|
| 1217 | 1217 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
| 1218 | 1218 | |
| 1219 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
| 1219 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
| 1220 | 1220 | { |
| 1221 | 1221 | continue; |
| 1222 | 1222 | } |
@@ -1227,60 +1227,60 @@ discard block |
||
| 1227 | 1227 | |
| 1228 | 1228 | $filter_arrts = array('style', 'src', 'href'); |
| 1229 | 1229 | |
| 1230 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1231 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1230 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
| 1231 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
| 1232 | 1232 | |
| 1233 | - foreach($filter_arrts as $attr) |
|
| 1233 | + foreach ($filter_arrts as $attr) |
|
| 1234 | 1234 | { |
| 1235 | - if(!isset($attrs[$attr])) continue; |
|
| 1235 | + if (!isset($attrs[$attr])) continue; |
|
| 1236 | 1236 | |
| 1237 | 1237 | $attr_value = rawurldecode($attrs[$attr]); |
| 1238 | 1238 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
| 1239 | 1239 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
| 1240 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1240 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
| 1241 | 1241 | { |
| 1242 | 1242 | unset($attrs[$attr]); |
| 1243 | 1243 | } |
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1246 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
| 1247 | 1247 | { |
| 1248 | 1248 | unset($attrs['style']); |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | $attr = array(); |
| 1252 | - foreach($attrs as $name => $val) |
|
| 1252 | + foreach ($attrs as $name => $val) |
|
| 1253 | 1253 | { |
| 1254 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1254 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
| 1255 | 1255 | { |
| 1256 | 1256 | $attribute = strtolower(trim($name)); |
| 1257 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1257 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
| 1258 | 1258 | { |
| 1259 | - if(stripos($val, 'data:') === 0) |
|
| 1259 | + if (stripos($val, 'data:') === 0) |
|
| 1260 | 1260 | { |
| 1261 | 1261 | continue; |
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | - if($tag == 'img') |
|
| 1266 | + if ($tag == 'img') |
|
| 1267 | 1267 | { |
| 1268 | 1268 | $attribute = strtolower(trim($name)); |
| 1269 | - if(stripos($val, 'data:') === 0) |
|
| 1269 | + if (stripos($val, 'data:') === 0) |
|
| 1270 | 1270 | { |
| 1271 | 1271 | continue; |
| 1272 | 1272 | } |
| 1273 | 1273 | } |
| 1274 | 1274 | $val = str_replace('"', '"', $val); |
| 1275 | - $attr[] = $name . "=\"{$val}\""; |
|
| 1275 | + $attr[] = $name."=\"{$val}\""; |
|
| 1276 | 1276 | } |
| 1277 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
| 1277 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
| 1278 | 1278 | |
| 1279 | 1279 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | // convert hexa value to RGB |
| 1283 | -if(!function_exists('hexrgb')) |
|
| 1283 | +if (!function_exists('hexrgb')) |
|
| 1284 | 1284 | { |
| 1285 | 1285 | |
| 1286 | 1286 | /** |
@@ -1316,9 +1316,9 @@ discard block |
||
| 1316 | 1316 | |
| 1317 | 1317 | settype($password, "string"); |
| 1318 | 1318 | |
| 1319 | - for($i = 0; $i < strlen($password); $i++) |
|
| 1319 | + for ($i = 0; $i < strlen($password); $i++) |
|
| 1320 | 1320 | { |
| 1321 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1321 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
| 1322 | 1322 | { |
| 1323 | 1323 | continue; |
| 1324 | 1324 | } |
@@ -1330,11 +1330,11 @@ discard block |
||
| 1330 | 1330 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
| 1331 | 1331 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
| 1332 | 1332 | |
| 1333 | - if($result1 == '80000000') |
|
| 1333 | + if ($result1 == '80000000') |
|
| 1334 | 1334 | { |
| 1335 | 1335 | $nr += 0x80000000; |
| 1336 | 1336 | } |
| 1337 | - if($result2 == '80000000') |
|
| 1337 | + if ($result2 == '80000000') |
|
| 1338 | 1338 | { |
| 1339 | 1339 | $nr2 += 0x80000000; |
| 1340 | 1340 | } |
@@ -1350,7 +1350,7 @@ discard block |
||
| 1350 | 1350 | function getScriptPath() |
| 1351 | 1351 | { |
| 1352 | 1352 | static $url = NULL; |
| 1353 | - if($url == NULL) |
|
| 1353 | + if ($url == NULL) |
|
| 1354 | 1354 | { |
| 1355 | 1355 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); |
| 1356 | 1356 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); |
@@ -1381,14 +1381,14 @@ discard block |
||
| 1381 | 1381 | $decodedStr = ''; |
| 1382 | 1382 | $pos = 0; |
| 1383 | 1383 | $len = strlen($source); |
| 1384 | - while($pos < $len) |
|
| 1384 | + while ($pos < $len) |
|
| 1385 | 1385 | { |
| 1386 | 1386 | $charAt = substr($source, $pos, 1); |
| 1387 | - if($charAt == '%') |
|
| 1387 | + if ($charAt == '%') |
|
| 1388 | 1388 | { |
| 1389 | 1389 | $pos++; |
| 1390 | 1390 | $charAt = substr($source, $pos, 1); |
| 1391 | - if($charAt == 'u') |
|
| 1391 | + if ($charAt == 'u') |
|
| 1392 | 1392 | { |
| 1393 | 1393 | // we got a unicode character |
| 1394 | 1394 | $pos++; |
@@ -1422,21 +1422,21 @@ discard block |
||
| 1422 | 1422 | */ |
| 1423 | 1423 | function _code2utf($num) |
| 1424 | 1424 | { |
| 1425 | - if($num < 128) |
|
| 1425 | + if ($num < 128) |
|
| 1426 | 1426 | { |
| 1427 | 1427 | return chr($num); |
| 1428 | 1428 | } |
| 1429 | - if($num < 2048) |
|
| 1429 | + if ($num < 2048) |
|
| 1430 | 1430 | { |
| 1431 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
| 1431 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
| 1432 | 1432 | } |
| 1433 | - if($num < 65536) |
|
| 1433 | + if ($num < 65536) |
|
| 1434 | 1434 | { |
| 1435 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1435 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1436 | 1436 | } |
| 1437 | - if($num < 2097152) |
|
| 1437 | + if ($num < 2097152) |
|
| 1438 | 1438 | { |
| 1439 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
| 1439 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | return ''; |
| 1442 | 1442 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | */ |
| 1452 | 1452 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
| 1453 | 1453 | { |
| 1454 | - if($urldecode) |
|
| 1454 | + if ($urldecode) |
|
| 1455 | 1455 | { |
| 1456 | 1456 | $string = urldecode($string); |
| 1457 | 1457 | } |
@@ -1459,12 +1459,12 @@ discard block |
||
| 1459 | 1459 | $sample = iconv('utf-8', 'utf-8', $string); |
| 1460 | 1460 | $is_utf8 = (md5($sample) === md5($string)); |
| 1461 | 1461 | |
| 1462 | - if(!$urldecode) |
|
| 1462 | + if (!$urldecode) |
|
| 1463 | 1463 | { |
| 1464 | 1464 | $string = urldecode($string); |
| 1465 | 1465 | } |
| 1466 | 1466 | |
| 1467 | - if($return_convert) |
|
| 1467 | + if ($return_convert) |
|
| 1468 | 1468 | { |
| 1469 | 1469 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
| 1470 | 1470 | } |
@@ -1480,7 +1480,7 @@ discard block |
||
| 1480 | 1480 | */ |
| 1481 | 1481 | function json_encode2($data) |
| 1482 | 1482 | { |
| 1483 | - switch(gettype($data)) |
|
| 1483 | + switch (gettype($data)) |
|
| 1484 | 1484 | { |
| 1485 | 1485 | case 'boolean': |
| 1486 | 1486 | return $data ? 'true' : 'false'; |
@@ -1488,15 +1488,15 @@ discard block |
||
| 1488 | 1488 | case 'double': |
| 1489 | 1489 | return $data; |
| 1490 | 1490 | case 'string': |
| 1491 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
| 1491 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
| 1492 | 1492 | case 'object': |
| 1493 | 1493 | $data = get_object_vars($data); |
| 1494 | 1494 | case 'array': |
| 1495 | 1495 | $rel = FALSE; // relative array? |
| 1496 | 1496 | $key = array_keys($data); |
| 1497 | - foreach($key as $v) |
|
| 1497 | + foreach ($key as $v) |
|
| 1498 | 1498 | { |
| 1499 | - if(!is_int($v)) |
|
| 1499 | + if (!is_int($v)) |
|
| 1500 | 1500 | { |
| 1501 | 1501 | $rel = TRUE; |
| 1502 | 1502 | break; |
@@ -1504,12 +1504,12 @@ discard block |
||
| 1504 | 1504 | } |
| 1505 | 1505 | |
| 1506 | 1506 | $arr = array(); |
| 1507 | - foreach($data as $k => $v) |
|
| 1507 | + foreach ($data as $k => $v) |
|
| 1508 | 1508 | { |
| 1509 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
| 1509 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
| 1512 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
| 1513 | 1513 | default: |
| 1514 | 1514 | return '""'; |
| 1515 | 1515 | } |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | */ |
| 1524 | 1524 | function isCrawler($agent = NULL) |
| 1525 | 1525 | { |
| 1526 | - if(!$agent) |
|
| 1526 | + if (!$agent) |
|
| 1527 | 1527 | { |
| 1528 | 1528 | $agent = $_SERVER['HTTP_USER_AGENT']; |
| 1529 | 1529 | } |
@@ -1533,9 +1533,9 @@ discard block |
||
| 1533 | 1533 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
| 1534 | 1534 | ); |
| 1535 | 1535 | |
| 1536 | - foreach($check_agent as $str) |
|
| 1536 | + foreach ($check_agent as $str) |
|
| 1537 | 1537 | { |
| 1538 | - if(stristr($agent, $str) != FALSE) |
|
| 1538 | + if (stristr($agent, $str) != FALSE) |
|
| 1539 | 1539 | { |
| 1540 | 1540 | return TRUE; |
| 1541 | 1541 | } |
@@ -1553,7 +1553,7 @@ discard block |
||
| 1553 | 1553 | */ |
| 1554 | 1554 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
| 1555 | 1555 | { |
| 1556 | - if(!Context::get('is_logged')) |
|
| 1556 | + if (!Context::get('is_logged')) |
|
| 1557 | 1557 | { |
| 1558 | 1558 | return; |
| 1559 | 1559 | } |
@@ -1561,18 +1561,18 @@ discard block |
||
| 1561 | 1561 | $oModuleModel = getModel('module'); |
| 1562 | 1562 | $logged_info = Context::get('logged_info'); |
| 1563 | 1563 | |
| 1564 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1564 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
| 1565 | 1565 | { |
| 1566 | - if($writer_member_srl) |
|
| 1566 | + if ($writer_member_srl) |
|
| 1567 | 1567 | { |
| 1568 | 1568 | $oMemberModel = getModel('member'); |
| 1569 | 1569 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
| 1570 | - if($member_info->is_admin == "Y") |
|
| 1570 | + if ($member_info->is_admin == "Y") |
|
| 1571 | 1571 | { |
| 1572 | 1572 | return; |
| 1573 | 1573 | } |
| 1574 | 1574 | } |
| 1575 | - $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; |
|
| 1575 | + $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; |
|
| 1576 | 1576 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
| 1577 | 1577 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
| 1578 | 1578 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1589,18 +1589,18 @@ discard block |
||
| 1589 | 1589 | function requirePear() |
| 1590 | 1590 | { |
| 1591 | 1591 | static $required = false; |
| 1592 | - if($required) |
|
| 1592 | + if ($required) |
|
| 1593 | 1593 | { |
| 1594 | 1594 | return; |
| 1595 | 1595 | } |
| 1596 | 1596 | |
| 1597 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1597 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
| 1598 | 1598 | { |
| 1599 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
| 1599 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
| 1600 | 1600 | } |
| 1601 | 1601 | else |
| 1602 | 1602 | { |
| 1603 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
| 1603 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | 1606 | $required = true; |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | |
| 1609 | 1609 | function checkCSRF() |
| 1610 | 1610 | { |
| 1611 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1611 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 1612 | 1612 | { |
| 1613 | 1613 | return FALSE; |
| 1614 | 1614 | } |
@@ -1616,9 +1616,9 @@ discard block |
||
| 1616 | 1616 | $default_url = Context::getDefaultUrl(); |
| 1617 | 1617 | $referer = $_SERVER["HTTP_REFERER"]; |
| 1618 | 1618 | |
| 1619 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1619 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
| 1620 | 1620 | { |
| 1621 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1621 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1622 | 1622 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1623 | 1623 | $referer = $IDN->encode($referer); |
| 1624 | 1624 | } |
@@ -1629,9 +1629,9 @@ discard block |
||
| 1629 | 1629 | $oModuleModel = getModel('module'); |
| 1630 | 1630 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
| 1631 | 1631 | |
| 1632 | - if($siteModuleInfo->site_srl == 0) |
|
| 1632 | + if ($siteModuleInfo->site_srl == 0) |
|
| 1633 | 1633 | { |
| 1634 | - if($default_url['host'] !== $referer['host']) |
|
| 1634 | + if ($default_url['host'] !== $referer['host']) |
|
| 1635 | 1635 | { |
| 1636 | 1636 | return FALSE; |
| 1637 | 1637 | } |
@@ -1639,7 +1639,7 @@ discard block |
||
| 1639 | 1639 | else |
| 1640 | 1640 | { |
| 1641 | 1641 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
| 1642 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1642 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
| 1643 | 1643 | { |
| 1644 | 1644 | return FALSE; |
| 1645 | 1645 | } |
@@ -1655,15 +1655,15 @@ discard block |
||
| 1655 | 1655 | */ |
| 1656 | 1656 | function recurciveExposureCheck(&$menu) |
| 1657 | 1657 | { |
| 1658 | - if(is_array($menu)) |
|
| 1658 | + if (is_array($menu)) |
|
| 1659 | 1659 | { |
| 1660 | - foreach($menu AS $key=>$value) |
|
| 1660 | + foreach ($menu AS $key=>$value) |
|
| 1661 | 1661 | { |
| 1662 | - if(!$value['isShow']) |
|
| 1662 | + if (!$value['isShow']) |
|
| 1663 | 1663 | { |
| 1664 | 1664 | unset($menu[$key]); |
| 1665 | 1665 | } |
| 1666 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
| 1666 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
| 1667 | 1667 | { |
| 1668 | 1668 | recurciveExposureCheck($menu[$key]['list']); |
| 1669 | 1669 | } |
@@ -1673,14 +1673,14 @@ discard block |
||
| 1673 | 1673 | |
| 1674 | 1674 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
| 1675 | 1675 | { |
| 1676 | - if($requestKey != $dbKey) |
|
| 1676 | + if ($requestKey != $dbKey) |
|
| 1677 | 1677 | { |
| 1678 | 1678 | $arrayUrl = parse_url(Context::get('success_return_url')); |
| 1679 | - if($arrayUrl['query']) |
|
| 1679 | + if ($arrayUrl['query']) |
|
| 1680 | 1680 | { |
| 1681 | 1681 | parse_str($arrayUrl['query'], $parsedStr); |
| 1682 | 1682 | |
| 1683 | - if(isset($parsedStr[$key])) |
|
| 1683 | + if (isset($parsedStr[$key])) |
|
| 1684 | 1684 | { |
| 1685 | 1685 | $parsedStr[$key] = $requestKey; |
| 1686 | 1686 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1723,14 +1723,14 @@ discard block |
||
| 1723 | 1723 | */ |
| 1724 | 1724 | function alertScript($msg) |
| 1725 | 1725 | { |
| 1726 | - if(!$msg) |
|
| 1726 | + if (!$msg) |
|
| 1727 | 1727 | { |
| 1728 | 1728 | return; |
| 1729 | 1729 | } |
| 1730 | 1730 | |
| 1731 | 1731 | echo '<script type="text/javascript"> |
| 1732 | 1732 | //<![CDATA[ |
| 1733 | -alert("' . $msg . '"); |
|
| 1733 | +alert("' . $msg.'"); |
|
| 1734 | 1734 | //]]> |
| 1735 | 1735 | </script>'; |
| 1736 | 1736 | } |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | |
| 1762 | 1762 | echo '<script type="text/javascript"> |
| 1763 | 1763 | //<![CDATA[ |
| 1764 | -' . $reloadScript . ' |
|
| 1764 | +' . $reloadScript.' |
|
| 1765 | 1765 | //]]> |
| 1766 | 1766 | </script>'; |
| 1767 | 1767 | } |