GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b130b6...8a2f54 )
by gyeong-won
07:36
created
modules/board/board.admin.controller.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -27,37 +27,37 @@  discard block
 block discarded – undo
27 27
 		$args = Context::getRequestVars();
28 28
 		$args->module = 'board';
29 29
 		$args->mid = $args->board_name;
30
-		if(is_array($args->use_status)) $args->use_status = implode('|@|', $args->use_status);
30
+		if (is_array($args->use_status)) $args->use_status = implode('|@|', $args->use_status);
31 31
 		unset($args->board_name);
32 32
 
33 33
 		// setup extra_order_target
34 34
 		$extra_order_target = array();
35
-		if($args->module_srl)
35
+		if ($args->module_srl)
36 36
 		{
37 37
 			$oDocumentModel = getModel('document');
38 38
 			$module_extra_vars = $oDocumentModel->getExtraKeys($args->module_srl);
39
-			foreach($module_extra_vars as $oExtraItem)
39
+			foreach ($module_extra_vars as $oExtraItem)
40 40
 			{
41 41
 				$extra_order_target[$oExtraItem->eid] = $oExtraItem->name;
42 42
 			}
43 43
 		}
44 44
 
45 45
 		// setup other variables
46
-		if($args->except_notice != 'Y') $args->except_notice = 'N';
47
-		if($args->use_anonymous != 'Y') $args->use_anonymous = 'N';
48
-		if($args->consultation != 'Y') $args->consultation = 'N';
49
-		if($args->protect_content!= 'Y') $args->protect_content = 'N';
50
-		if(!in_array($args->order_target,$this->order_target) && !array_key_exists($args->order_target, $extra_order_target)) $args->order_target = 'list_order';
51
-		if(!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
46
+		if ($args->except_notice != 'Y') $args->except_notice = 'N';
47
+		if ($args->use_anonymous != 'Y') $args->use_anonymous = 'N';
48
+		if ($args->consultation != 'Y') $args->consultation = 'N';
49
+		if ($args->protect_content != 'Y') $args->protect_content = 'N';
50
+		if (!in_array($args->order_target, $this->order_target) && !array_key_exists($args->order_target, $extra_order_target)) $args->order_target = 'list_order';
51
+		if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
52 52
 
53 53
 		// if there is an existed module
54
-		if($args->module_srl) {
54
+		if ($args->module_srl) {
55 55
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
56
-			if($module_info->module_srl != $args->module_srl) unset($args->module_srl);
56
+			if ($module_info->module_srl != $args->module_srl) unset($args->module_srl);
57 57
 		}
58 58
 
59 59
 		// insert/update the board module based on module_srl
60
-		if(!$args->module_srl) {
60
+		if (!$args->module_srl) {
61 61
 			$args->hide_category = 'N';
62 62
 			$output = $oModuleController->insertModule($args);
63 63
 			$msg_code = 'success_registed';
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
 			$msg_code = 'success_updated';
68 68
 		}
69 69
 
70
-		if(!$output->toBool()) return $output;
70
+		if (!$output->toBool()) return $output;
71 71
 
72 72
 		// setup list config
73
-		$list = explode(',',Context::get('list'));
74
-		if(count($list))
73
+		$list = explode(',', Context::get('list'));
74
+		if (count($list))
75 75
 		{
76 76
 			$list_arr = array();
77
-			foreach($list as $val)
77
+			foreach ($list as $val)
78 78
 			{
79 79
 				$val = trim($val);
80
-				if(!$val) continue;
81
-				if(substr($val,0,10)=='extra_vars') $val = substr($val,10);
80
+				if (!$val) continue;
81
+				if (substr($val, 0, 10) == 'extra_vars') $val = substr($val, 10);
82 82
 				$list_arr[] = $val;
83 83
 			}
84 84
 			$oModuleController = getController('module');
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 		}
87 87
 
88 88
 		$this->setMessage($msg_code);
89
-		if (Context::get('success_return_url')){
89
+		if (Context::get('success_return_url')) {
90 90
 			changeValueInUrl('mid', $args->mid, $module_info->mid);
91 91
 			$this->setRedirectUrl(Context::get('success_return_url'));
92
-		}else{
92
+		} else {
93 93
 			$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminBoardInfo', 'module_srl', $output->get('module_srl')));
94 94
 		}
95 95
 	}
@@ -105,17 +105,17 @@  discard block
 block discarded – undo
105 105
 		// for board info
106 106
 		$args->module = 'board';
107 107
 		$args->mid = $args->board_name;
108
-		if(is_array($args->use_status))
108
+		if (is_array($args->use_status))
109 109
 		{
110 110
 			$args->use_status = implode('|@|', $args->use_status);
111 111
 		}
112 112
 		unset($args->board_name);
113 113
 
114
-		if(!in_array($args->order_target, $this->order_target))
114
+		if (!in_array($args->order_target, $this->order_target))
115 115
 		{
116 116
 			$args->order_target = 'list_order';
117 117
 		}
118
-		if(!in_array($args->order_type, array('asc', 'desc')))
118
+		if (!in_array($args->order_type, array('asc', 'desc')))
119 119
 		{
120 120
 			$args->order_type = 'asc';
121 121
 		}
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
 
126 126
 		// for grant info, Register Admin ID
127 127
 		$oModuleController->deleteAdminId($args->module_srl);
128
-		if($args->admin_member)
128
+		if ($args->admin_member)
129 129
 		{
130
-			$admin_members = explode(',',$args->admin_member);
131
-			for($i=0;$i<count($admin_members);$i++)
130
+			$admin_members = explode(',', $args->admin_member);
131
+			for ($i = 0; $i < count($admin_members); $i++)
132 132
 			{
133 133
 				$admin_id = trim($admin_members[$i]);
134
-				if(!$admin_id) continue;
134
+				if (!$admin_id) continue;
135 135
 				$oModuleController->insertAdminId($args->module_srl, $admin_id);
136 136
 			}
137 137
 		}
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 		// get the current module
147 147
 		$oModuleController = getController('module');
148 148
 		$output = $oModuleController->deleteModule($module_srl);
149
-		if(!$output->toBool()) return $output;
149
+		if (!$output->toBool()) return $output;
150 150
 
151
-		$this->add('module','board');
152
-		$this->add('page',Context::get('page'));
151
+		$this->add('module', 'board');
152
+		$this->add('page', Context::get('page'));
153 153
 		$this->setMessage('success_deleted');
154 154
 	}
155 155
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 		$oModuleModel = getModel('module');
162 162
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
163
-		if($module_info->mid != $mid)
163
+		if ($module_info->mid != $mid)
164 164
 		{
165 165
 			return new BaseObject(-1, 'msg_invalid_request');
166 166
 		}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$module_info->hide_category = Context::get('hide_category') == 'Y' ? 'Y' : 'N';
169 169
 		$oModuleController = getController('module'); /* @var $oModuleController moduleController */
170 170
 		$output = $oModuleController->updateModule($module_info);
171
-		if(!$output->toBool())
171
+		if (!$output->toBool())
172 172
 		{
173 173
 			return $output;
174 174
 		}
Please login to merge, or discard this patch.
modules/board/board.class.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 class board extends ModuleObject
11 11
 {
12
-	var $search_option = array('title_content','title','content','comment','user_name','nick_name','user_id','tag'); ///< 검색 옵션
12
+	var $search_option = array('title_content', 'title', 'content', 'comment', 'user_name', 'nick_name', 'user_id', 'tag'); ///< 검색 옵션
13 13
 
14 14
 	var $order_target = array('list_order', 'update_order', 'regdate', 'voted_count', 'blamed_count', 'readed_count', 'comment_count', 'title', 'nick_name', 'user_name', 'user_id'); // 정렬 옵션
15 15
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	function board()
27 27
 	{
28
-		if(!Context::isInstalled()) return;
28
+		if (!Context::isInstalled()) return;
29 29
 
30
-		if(!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional')
30
+		if (!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional')
31 31
 		{
32 32
 			$ssl_actions = array('dispBoardWrite', 'dispBoardWriteComment', 'dispBoardReplyComment', 'dispBoardModifyComment', 'dispBoardDelete', 'dispBoardDeleteComment', 'procBoardInsertDocument', 'procBoardDeleteDocument', 'procBoardInsertComment', 'procBoardDeleteComment', 'procBoardVerificationPassword');
33 33
 			Context::addSSLActions($ssl_actions);
34 34
 		}
35
-		if(!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional')
35
+		if (!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional')
36 36
 		{
37 37
 			Context::addSSLAction('dispTempSavedList');
38 38
 		}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$args = new stdClass;
55 55
 		$args->site_srl = 0;
56 56
 		$output = executeQuery('module.getSite', $args);
57
-		if(!$output->data->index_module_srl)
57
+		if (!$output->data->index_module_srl)
58 58
 		{
59 59
 			$args->mid = 'board';
60 60
 			$args->module = 'board';
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			$args->site_srl = 0;
64 64
 			$output = $oModuleController->insertModule($args);
65 65
 
66
-			if($output->toBool())
66
+			if ($output->toBool())
67 67
 			{
68 68
 				$module_srl = $output->get('module_srl');
69 69
 
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 		$oModuleModel = getModel('module');
88 88
 		$oModuleController = getController('module');
89 89
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
90
-		if($oModuleModel->needUpdate($version_update_id))
90
+		if ($oModuleModel->needUpdate($version_update_id))
91 91
 		{
92 92
 			// 2007. 10. 17 get the member menu trigger
93
-			if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true;
93
+			if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true;
94 94
 
95 95
 			// 2011. 09. 20 when add new menu in sitemap, custom menu add
96
-			if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true;
96
+			if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true;
97 97
 
98 98
 			$oModuleController->insertUpdatedLog($version_update_id);
99 99
 		}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 		$oModuleModel = getModel('module');
110 110
 		$oModuleController = getController('module');
111 111
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
112
-		if($oModuleModel->needUpdate($version_update_id))
112
+		if ($oModuleModel->needUpdate($version_update_id))
113 113
 		{
114 114
 			// 2007. 10. 17  check the member menu trigger, if it is not existed then insert
115
-			if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after'))
115
+			if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after'))
116 116
 			{
117 117
 				$oModuleController->insertTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after');
118 118
 			}
119 119
 
120 120
 			// 2011. 09. 20 when add new menu in sitemap, custom menu add
121
-			if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after'))
121
+			if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after'))
122 122
 			{
123 123
 				$oModuleController->insertTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after');
124 124
 			}
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 	function moduleUninstall()
132 132
 	{
133 133
 		$output = executeQueryArray("board.getAllBoard");
134
-		if(!$output->data) return new BaseObject();
134
+		if (!$output->data) return new BaseObject();
135 135
 		@set_time_limit(0);
136 136
 
137 137
 		$oModuleController = getController('module');
138 138
 
139
-		foreach($output->data as $board)
139
+		foreach ($output->data as $board)
140 140
 		{
141 141
 			$oModuleController->deleteModule($board->module_srl);
142 142
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	function board()
27 27
 	{
28
-		if(!Context::isInstalled()) return;
28
+		if(!Context::isInstalled()) {
29
+			return;
30
+		}
29 31
 
30 32
 		if(!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional')
31 33
 		{
@@ -90,10 +92,14 @@  discard block
 block discarded – undo
90 92
 		if($oModuleModel->needUpdate($version_update_id))
91 93
 		{
92 94
 			// 2007. 10. 17 get the member menu trigger
93
-			if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true;
95
+			if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) {
96
+				return true;
97
+			}
94 98
 
95 99
 			// 2011. 09. 20 when add new menu in sitemap, custom menu add
96
-			if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true;
100
+			if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) {
101
+				return true;
102
+			}
97 103
 
98 104
 			$oModuleController->insertUpdatedLog($version_update_id);
99 105
 		}
@@ -131,7 +137,9 @@  discard block
 block discarded – undo
131 137
 	function moduleUninstall()
132 138
 	{
133 139
 		$output = executeQueryArray("board.getAllBoard");
134
-		if(!$output->data) return new BaseObject();
140
+		if(!$output->data) {
141
+			return new BaseObject();
142
+		}
135 143
 		@set_time_limit(0);
136 144
 
137 145
 		$oModuleController = getController('module');
Please login to merge, or discard this patch.
modules/install/install.controller.php 2 patches
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	function init()
18 18
 	{
19 19
 		// Error occurs if already installed
20
-		if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
20
+		if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
21 21
 		{
22 22
 			$this->stop('msg_already_installed');
23 23
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	function _procDBSetting()
87 87
 	{
88 88
 		// Get DB-related variables
89
-		$con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix');
89
+		$con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix');
90 90
 
91 91
 		$db_info = new stdClass();
92 92
 		$db_info->master_db = get_object_vars($con_string);
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 		// Check if available to connect to the DB
102 102
 		$oDB = &DB::getInstance();
103 103
 		$output = $oDB->getError();
104
-		if(!$output->toBool()) return $output;
105
-		if(!$oDB->isConnected()) return $oDB->getError();
104
+		if (!$output->toBool()) return $output;
105
+		if (!$oDB->isConnected()) return $oDB->getError();
106 106
 
107 107
 		// Create a db temp config file
108
-		if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
108
+		if (!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
109 109
 
110
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
110
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
111 111
 		{
112 112
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm');
113 113
 			header('location:'.$returnUrl);
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	function procConfigSetting()
122 122
 	{
123 123
 		// Get variables
124
-		$config_info = Context::gets('use_rewrite','time_zone');
125
-		if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
124
+		$config_info = Context::gets('use_rewrite', 'time_zone');
125
+		if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N';
126 126
 
127 127
 		// Create a db temp config file
128
-		if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
128
+		if (!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
129 129
 
130
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
130
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
131 131
 		{
132 132
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm');
133 133
 			header('location:'.$returnUrl);
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	function procInstall()
142 142
 	{
143 143
 		// Check if it is already installed
144
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
144
+		if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
145 145
 
146 146
 		Context::loadLang('modules/member/lang');
147 147
 		$oMemberModel = getModel('member');
148 148
 		$vars = Context::getRequestVars();
149 149
 
150
-		if(!$oMemberModel->checkPasswordStrength($vars->password, 'high'))
150
+		if (!$oMemberModel->checkPasswordStrength($vars->password, 'high'))
151 151
 		{
152 152
 			Context::loadLang('modules/member/lang');
153 153
 			$message = Context::getLang('about_password_strength');
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 		Context::set('logged_info', $logged_info);
161 161
 
162 162
 		// check install config
163
-		if(Context::get('install_config'))
163
+		if (Context::get('install_config'))
164 164
 		{
165 165
 			$db_info = $this->_makeDbInfoByInstallConfig();
166 166
 		}
167 167
 		// install by default XE UI
168 168
 		else
169 169
 		{
170
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
171
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
170
+			if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
171
+			if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
172 172
 		}
173 173
 
174 174
 		// Set DB type and information
@@ -176,30 +176,30 @@  discard block
 block discarded – undo
176 176
 		// Create DB Instance
177 177
 		$oDB = &DB::getInstance();
178 178
 		// Check if available to connect to the DB
179
-		if(!$oDB->isConnected()) return $oDB->getError();
179
+		if (!$oDB->isConnected()) return $oDB->getError();
180 180
 
181 181
 		// Install all the modules
182 182
 		try {
183 183
 			$oDB->begin();
184 184
 			$this->installDownloadedModule();
185 185
 			$oDB->commit();
186
-		} catch(Exception $e) {
186
+		} catch (Exception $e) {
187 187
 			$oDB->rollback();
188 188
 			return new BaseObject(-1, $e->getMessage());
189 189
 		}
190 190
 
191 191
 		// Create a config file
192
-		if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
192
+		if (!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
193 193
 
194 194
 		// load script
195
-		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
196
-		if(count($scripts)>0)
195
+		$scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/');
196
+		if (count($scripts) > 0)
197 197
 		{
198 198
 			sort($scripts);
199
-			foreach($scripts as $script)
199
+			foreach ($scripts as $script)
200 200
 			{
201 201
 				$script_path = FileHandler::getRealPath('./modules/install/script/');
202
-				$output = include($script_path . $script);
202
+				$output = include($script_path.$script);
203 203
 			}
204 204
 		}
205 205
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 		unset($_SESSION['use_rewrite']);
214 214
 
215
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
215
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
216 216
 		{
217 217
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
218 218
 			header('location:'.$returnUrl);
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		$db_info->use_rewrite = Context::get('use_rewrite');
243 243
 		$db_info->time_zone = Context::get('time_zone');
244 244
 
245
-		if($_SERVER['HTTPS'] == 'on')
245
+		if ($_SERVER['HTTPS'] == 'on')
246 246
 		{
247 247
 			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT'];
248 248
 			$https_port = (!$https_port != 443) ? $https_port : null;
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT'];
253 253
 			$http_port = (!$http_port != 80) ? $http_port : null;
254 254
 		}
255
-		if($http_port) $db_info->http_port = $http_port;
256
-		if($https_port) $db_info->https_port = $https_port;
255
+		if ($http_port) $db_info->http_port = $http_port;
256
+		if ($https_port) $db_info->https_port = $https_port;
257 257
 
258 258
 		return $db_info;
259 259
 	}
@@ -263,57 +263,57 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	function procInstallFTP()
265 265
 	{
266
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
267
-		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
268
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
269
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
270
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
271
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
266
+		if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
267
+		$ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path');
268
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
269
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
270
+		if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
271
+		if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
272 272
 
273 273
 		$buff = array('<?php if(!defined("__XE__")) exit();');
274 274
 		$buff[] = "\$ftp_info = new stdClass();";
275
-		foreach($ftp_info as $key => $val)
275
+		foreach ($ftp_info as $key => $val)
276 276
 		{
277
-			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val));
277
+			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val));
278 278
 		}
279 279
 
280 280
 		// If safe_mode
281
-		if(ini_get('safe_mode'))
281
+		if (ini_get('safe_mode'))
282 282
 		{
283
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
283
+			if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');
284 284
 
285 285
 			require_once(_XE_PATH_.'libs/ftp.class.php');
286 286
 			$oFtp = new ftp();
287
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
287
+			if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
288 288
 
289
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
289
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
290 290
 			{
291 291
 				$oFtp->ftp_quit();
292
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
292
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
293 293
 			}
294 294
 
295
-			if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
295
+			if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
296 296
 			{
297 297
 				$oFtp->ftp_quit();
298
-				return new BaseObject(-1,'msg_ftp_mkdir_fail');
298
+				return new BaseObject(-1, 'msg_ftp_mkdir_fail');
299 299
 			}
300 300
 
301
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
301
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
302 302
 			{
303 303
 				$oFtp->ftp_quit();
304
-				return new BaseObject(-1,'msg_ftp_chmod_fail');
304
+				return new BaseObject(-1, 'msg_ftp_chmod_fail');
305 305
 			}
306 306
 
307
-			if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
307
+			if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
308 308
 			{
309 309
 				$oFtp->ftp_quit();
310
-				return new BaseObject(-1,'msg_ftp_mkdir_fail');
310
+				return new BaseObject(-1, 'msg_ftp_mkdir_fail');
311 311
 			}
312 312
 
313
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
313
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
314 314
 			{
315 315
 				$oFtp->ftp_quit();
316
-				return new BaseObject(-1,'msg_ftp_chmod_fail');
316
+				return new BaseObject(-1, 'msg_ftp_chmod_fail');
317 317
 			}
318 318
 
319 319
 			$oFtp->ftp_quit();
@@ -324,31 +324,31 @@  discard block
 block discarded – undo
324 324
 
325 325
 	function procInstallCheckFtp()
326 326
 	{
327
-		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
328
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
329
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
330
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
327
+		$ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp');
328
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
329
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
330
+		if (!$ftp_info->sftp) $ftp_info->sftp = 'N';
331 331
 
332
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
332
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed');
333 333
 
334
-		if($ftp_info->sftp == 'Y')
334
+		if ($ftp_info->sftp == 'Y')
335 335
 		{
336 336
 			$connection = ssh2_connect('localhost', $ftp_info->ftp_port);
337
-			if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
337
+			if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
338 338
 			{
339
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
339
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
340 340
 			}
341 341
 		}
342 342
 		else
343 343
 		{
344 344
 			require_once(_XE_PATH_.'libs/ftp.class.php');
345 345
 			$oFtp = new ftp();
346
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
346
+			if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
347 347
 
348
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
348
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
349 349
 			{
350 350
 				$oFtp->ftp_quit();
351
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
351
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
352 352
 			}
353 353
 			$oFtp->ftp_quit();
354 354
 		}
@@ -365,36 +365,36 @@  discard block
 block discarded – undo
365 365
 		$checklist = array();
366 366
 		// 0. check your version of php (5.2.4 or higher)
367 367
 		$checklist['php_version'] = true;
368
-		if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
368
+		if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
369 369
 		{
370 370
 			$checklist['php_version'] = false;
371 371
 		}
372 372
 
373
-		if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
373
+		if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
374 374
 		{
375 375
 			Context::set('phpversion_warning', true);
376 376
 		}
377 377
 
378 378
 		// 1. Check permission
379
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
379
+		if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true;
380 380
 		else $checklist['permission'] = false;
381 381
 		// 2. Check if xml_parser_create exists
382
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
382
+		if (function_exists('xml_parser_create')) $checklist['xml'] = true;
383 383
 		else $checklist['xml'] = false;
384 384
 		// 3. Check if ini_get (session.auto_start) == 1
385
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
385
+		if (ini_get('session.auto_start') != 1) $checklist['session'] = true;
386 386
 		else $checklist['session'] = false;
387 387
 		// 4. Check if iconv exists
388
-		if(function_exists('iconv')) $checklist['iconv'] = true;
388
+		if (function_exists('iconv')) $checklist['iconv'] = true;
389 389
 		else $checklist['iconv'] = false;
390 390
 		// 5. Check gd(imagecreatefromgif function)
391
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
391
+		if (function_exists('imagecreatefromgif')) $checklist['gd'] = true;
392 392
 		else $checklist['gd'] = false;
393 393
 		// 6. Check DB
394
-		if(DB::getEnableList()) $checklist['db'] = true;
394
+		if (DB::getEnableList()) $checklist['db'] = true;
395 395
 		else $checklist['db'] = false;
396 396
 
397
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
397
+		if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
398 398
 		else $install_enable = true;
399 399
 
400 400
 		// Save the checked result to the Context
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 		$license_agreement = ($vars->license_agreement == 'Y') ? true : false;
416 416
 
417
-		if($license_agreement)
417
+		if ($license_agreement)
418 418
 		{
419 419
 			$currentTime = $_SERVER['REQUEST_TIME'];
420 420
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 			return new BaseObject(-1, 'msg_must_accept_license_agreement');
426 426
 		}
427 427
 
428
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
428
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
429 429
 		{
430 430
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv');
431 431
 			$this->setRedirectUrl($returnUrl);
@@ -448,25 +448,25 @@  discard block
 block discarded – undo
448 448
 		$hostname = $_SERVER['SERVER_NAME'];
449 449
 		$port = $_SERVER['SERVER_PORT'];
450 450
 		$str_port = '';
451
-		if($port)
451
+		if ($port)
452 452
 		{
453
-			$str_port = ':' . $port;
453
+			$str_port = ':'.$port;
454 454
 		}
455 455
 
456 456
 		$tmpPath = $_SERVER['DOCUMENT_ROOT'];
457 457
 
458 458
 		//if DIRECTORY_SEPARATOR is not /(IIS)
459
-		if(DIRECTORY_SEPARATOR !== '/')
459
+		if (DIRECTORY_SEPARATOR !== '/')
460 460
 		{
461 461
 			//change to slash for compare
462 462
 			$tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']);
463 463
 		}
464 464
 
465
-		$query = "/JUST/CHECK/REWRITE/" . $checkFilePath;
465
+		$query = "/JUST/CHECK/REWRITE/".$checkFilePath;
466 466
 		$currentPath = str_replace($tmpPath, "", _XE_PATH_);
467
-		if($currentPath != "")
467
+		if ($currentPath != "")
468 468
 		{
469
-			$query = $currentPath . $query;
469
+			$query = $currentPath.$query;
470 470
 		}
471 471
 		$requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query);
472 472
 		$requestConfig = array();
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 			'./files/cache/template_compiled',
492 492
 		);
493 493
 
494
-		foreach($directory_list as $dir)
494
+		foreach ($directory_list as $dir)
495 495
 		{
496 496
 			FileHandler::makeDir($dir);
497 497
 		}
@@ -507,57 +507,57 @@  discard block
 block discarded – undo
507 507
 		$oModuleModel = getModel('module');
508 508
 		// Create a table ny finding schemas/*.xml file in each module
509 509
 		$module_list = FileHandler::readDir('./modules/', NULL, false, true);
510
-		foreach($module_list as $module_path)
510
+		foreach ($module_list as $module_path)
511 511
 		{
512 512
 			// Get module name
513
-			$tmp_arr = explode('/',$module_path);
514
-			$module = $tmp_arr[count($tmp_arr)-1];
513
+			$tmp_arr = explode('/', $module_path);
514
+			$module = $tmp_arr[count($tmp_arr) - 1];
515 515
 
516 516
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
517
-			if(!$xml_info) continue;
517
+			if (!$xml_info) continue;
518 518
 			$modules[$xml_info->category][] = $module;
519 519
 		}
520 520
 		// Install "module" module in advance
521
-		$this->installModule('module','./modules/module');
521
+		$this->installModule('module', './modules/module');
522 522
 		$oModule = getClass('module');
523
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
523
+		if ($oModule->checkUpdate()) $oModule->moduleUpdate();
524 524
 		// Determine the order of module installation depending on category
525
-		$install_step = array('system','content','member');
525
+		$install_step = array('system', 'content', 'member');
526 526
 		// Install all the remaining modules
527
-		foreach($install_step as $category)
527
+		foreach ($install_step as $category)
528 528
 		{
529
-			if(count($modules[$category]))
529
+			if (count($modules[$category]))
530 530
 			{
531
-				foreach($modules[$category] as $module)
531
+				foreach ($modules[$category] as $module)
532 532
 				{
533
-					if($module == 'module') continue;
533
+					if ($module == 'module') continue;
534 534
 					$this->installModule($module, sprintf('./modules/%s', $module));
535 535
 
536 536
 					$oModule = getClass($module);
537
-					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
537
+					if (is_object($oModule) && method_exists($oModule, 'checkUpdate'))
538 538
 					{
539
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
539
+						if ($oModule->checkUpdate()) $oModule->moduleUpdate();
540 540
 					}
541 541
 				}
542 542
 				unset($modules[$category]);
543 543
 			}
544 544
 		}
545 545
 		// Install all the remaining modules
546
-		if(count($modules))
546
+		if (count($modules))
547 547
 		{
548
-			foreach($modules as $category => $module_list)
548
+			foreach ($modules as $category => $module_list)
549 549
 			{
550
-				if(count($module_list))
550
+				if (count($module_list))
551 551
 				{
552
-					foreach($module_list as $module)
552
+					foreach ($module_list as $module)
553 553
 					{
554
-						if($module == 'module') continue;
554
+						if ($module == 'module') continue;
555 555
 						$this->installModule($module, sprintf('./modules/%s', $module));
556 556
 
557 557
 						$oModule = getClass($module);
558
-						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
558
+						if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
559 559
 						{
560
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
560
+							if ($oModule->checkUpdate()) $oModule->moduleUpdate();
561 561
 						}
562 562
 					}
563 563
 				}
@@ -579,31 +579,31 @@  discard block
 block discarded – undo
579 579
 		$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
580 580
 
581 581
 		$file_cnt = count($schema_files);
582
-		for($i=0;$i<$file_cnt;$i++)
582
+		for ($i = 0; $i < $file_cnt; $i++)
583 583
 		{
584 584
 			$file = trim($schema_files[$i]);
585
-			if(!$file || substr($file,-4)!='.xml') continue;
585
+			if (!$file || substr($file, -4) != '.xml') continue;
586 586
 			$output = $oDB->createTableByXmlFile($file);
587
-			if($output === false)
587
+			if ($output === false)
588 588
 				throw new Exception('msg_create_table_failed');
589 589
 		}
590 590
 		// Create a table and module instance and then execute install() method
591 591
 		unset($oModule);
592 592
 		$oModule = getClass($module);
593
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
593
+		if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
594 594
 		return new BaseObject();
595 595
 	}
596 596
 
597 597
 	function _getDBConfigFileContents($db_info)
598 598
 	{
599
-		if(substr($db_info->master_db['db_table_prefix'], -1) != '_')
599
+		if (substr($db_info->master_db['db_table_prefix'], -1) != '_')
600 600
 		{
601 601
 			$db_info->master_db['db_table_prefix'] .= '_';
602 602
 		}
603 603
 
604
-		foreach($db_info->slave_db as &$slave)
604
+		foreach ($db_info->slave_db as &$slave)
605 605
 		{
606
-			if(substr($slave['db_table_prefix'], -1) != '_')
606
+			if (substr($slave['db_table_prefix'], -1) != '_')
607 607
 			{
608 608
 				$slave['db_table_prefix'] .= '_';
609 609
 			}
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 
612 612
 		$buff = array();
613 613
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
614
-		$buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';';
614
+		$buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';';
615 615
 
616 616
 		return implode(PHP_EOL, $buff);
617 617
 	}
@@ -625,13 +625,13 @@  discard block
 block discarded – undo
625 625
 		$db_tmp_config_file = $this->db_tmp_config_file;
626 626
 
627 627
 		$db_info = Context::getDBInfo();
628
-		if(!$db_info) return;
628
+		if (!$db_info) return;
629 629
 
630 630
 		$buff = $this->_getDBConfigFileContents($db_info);
631 631
 
632 632
 		FileHandler::writeFile($db_tmp_config_file, $buff);
633 633
 
634
-		if(@file_exists($db_tmp_config_file)) return true;
634
+		if (@file_exists($db_tmp_config_file)) return true;
635 635
 		return false;
636 636
 	}
637 637
 
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
 		$etc_tmp_config_file = $this->etc_tmp_config_file;
645 645
 
646 646
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n";
647
-		foreach($config_info as $key => $val)
647
+		foreach ($config_info as $key => $val)
648 648
 		{
649
-			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
649
+			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
650 650
 		}
651 651
 
652 652
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
653 653
 
654
-		if(@file_exists($etc_tmp_config_file)) return true;
654
+		if (@file_exists($etc_tmp_config_file)) return true;
655 655
 		return false;
656 656
 	}
657 657
 
@@ -666,13 +666,13 @@  discard block
 block discarded – undo
666 666
 			//if(file_exists($config_file)) return;
667 667
 
668 668
 			$db_info = Context::getDBInfo();
669
-			if(!$db_info) return;
669
+			if (!$db_info) return;
670 670
 
671 671
 			$buff = $this->_getDBConfigFileContents($db_info);
672 672
 
673 673
 			FileHandler::writeFile($config_file, $buff);
674 674
 
675
-			if(@file_exists($config_file))
675
+			if (@file_exists($config_file))
676 676
 			{
677 677
 				FileHandler::removeFile($this->db_tmp_config_file);
678 678
 				FileHandler::removeFile($this->etc_tmp_config_file);
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	function installByConfig($install_config_file)
688 688
 	{
689 689
 		include $install_config_file;
690
-		if(!is_array($auto_config)) return false;
690
+		if (!is_array($auto_config)) return false;
691 691
 
692 692
 		$auto_config['module'] = 'install';
693 693
 		$auto_config['act'] = 'procInstall';
@@ -695,22 +695,22 @@  discard block
 block discarded – undo
695 695
 		$fstr = "<%s><![CDATA[%s]]></%s>\r\n";
696 696
 		$fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n";
697 697
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
698
-		foreach($auto_config as $k => $v)
698
+		foreach ($auto_config as $k => $v)
699 699
 		{
700
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
700
+			if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k);
701 701
 		}
702 702
 		$body .= "</params>\r\n</methodCall>";
703 703
 
704
-		$header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body);
704
+		$header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body);
705 705
 		$fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5);
706 706
 
707
-		if($fp)
707
+		if ($fp)
708 708
 		{
709 709
 			fputs($fp, $header);
710
-			while(!feof($fp))
710
+			while (!feof($fp))
711 711
 			{
712 712
 				$line = trim(fgets($fp, 4096));
713
-				if(strncmp('<error>', $line, 7) === 0)
713
+				if (strncmp('<error>', $line, 7) === 0)
714 714
 				{
715 715
 					fclose($fp);
716 716
 					return false;
Please login to merge, or discard this patch.
Braces   +149 added lines, -58 removed lines patch added patch discarded remove patch
@@ -101,11 +101,17 @@  discard block
 block discarded – undo
101 101
 		// Check if available to connect to the DB
102 102
 		$oDB = &DB::getInstance();
103 103
 		$output = $oDB->getError();
104
-		if(!$output->toBool()) return $output;
105
-		if(!$oDB->isConnected()) return $oDB->getError();
104
+		if(!$output->toBool()) {
105
+			return $output;
106
+		}
107
+		if(!$oDB->isConnected()) {
108
+			return $oDB->getError();
109
+		}
106 110
 
107 111
 		// Create a db temp config file
108
-		if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed');
112
+		if(!$this->makeDBConfigFile()) {
113
+			return new BaseObject(-1, 'msg_install_failed');
114
+		}
109 115
 
110 116
 		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
111 117
 		{
@@ -122,10 +128,14 @@  discard block
 block discarded – undo
122 128
 	{
123 129
 		// Get variables
124 130
 		$config_info = Context::gets('use_rewrite','time_zone');
125
-		if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
131
+		if($config_info->use_rewrite!='Y') {
132
+			$config_info->use_rewrite = 'N';
133
+		}
126 134
 
127 135
 		// Create a db temp config file
128
-		if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed');
136
+		if(!$this->makeEtcConfigFile($config_info)) {
137
+			return new BaseObject(-1, 'msg_install_failed');
138
+		}
129 139
 
130 140
 		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
131 141
 		{
@@ -141,7 +151,9 @@  discard block
 block discarded – undo
141 151
 	function procInstall()
142 152
 	{
143 153
 		// Check if it is already installed
144
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
154
+		if(Context::isInstalled()) {
155
+			return new BaseObject(-1, 'msg_already_installed');
156
+		}
145 157
 
146 158
 		Context::loadLang('modules/member/lang');
147 159
 		$oMemberModel = getModel('member');
@@ -167,8 +179,12 @@  discard block
 block discarded – undo
167 179
 		// install by default XE UI
168 180
 		else
169 181
 		{
170
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
171
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
182
+			if(FileHandler::exists($this->db_tmp_config_file)) {
183
+				include $this->db_tmp_config_file;
184
+			}
185
+			if(FileHandler::exists($this->etc_tmp_config_file)) {
186
+				include $this->etc_tmp_config_file;
187
+			}
172 188
 		}
173 189
 
174 190
 		// Set DB type and information
@@ -176,7 +192,9 @@  discard block
 block discarded – undo
176 192
 		// Create DB Instance
177 193
 		$oDB = &DB::getInstance();
178 194
 		// Check if available to connect to the DB
179
-		if(!$oDB->isConnected()) return $oDB->getError();
195
+		if(!$oDB->isConnected()) {
196
+			return $oDB->getError();
197
+		}
180 198
 
181 199
 		// Install all the modules
182 200
 		try {
@@ -189,7 +207,9 @@  discard block
 block discarded – undo
189 207
 		}
190 208
 
191 209
 		// Create a config file
192
-		if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed');
210
+		if(!$this->makeConfigFile()) {
211
+			return new BaseObject(-1, 'msg_install_failed');
212
+		}
193 213
 
194 214
 		// load script
195 215
 		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
@@ -246,14 +266,17 @@  discard block
 block discarded – undo
246 266
 		{
247 267
 			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT'];
248 268
 			$https_port = (!$https_port != 443) ? $https_port : null;
249
-		}
250
-		else
269
+		} else
251 270
 		{
252 271
 			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT'];
253 272
 			$http_port = (!$http_port != 80) ? $http_port : null;
254 273
 		}
255
-		if($http_port) $db_info->http_port = $http_port;
256
-		if($https_port) $db_info->https_port = $https_port;
274
+		if($http_port) {
275
+			$db_info->http_port = $http_port;
276
+		}
277
+		if($https_port) {
278
+			$db_info->https_port = $https_port;
279
+		}
257 280
 
258 281
 		return $db_info;
259 282
 	}
@@ -263,12 +286,20 @@  discard block
 block discarded – undo
263 286
 	 */
264 287
 	function procInstallFTP()
265 288
 	{
266
-		if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed');
289
+		if(Context::isInstalled()) {
290
+			return new BaseObject(-1, 'msg_already_installed');
291
+		}
267 292
 		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
268 293
 		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
269
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
270
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
271
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
294
+		if(!$ftp_info->ftp_port) {
295
+			$ftp_info->ftp_port = 21;
296
+		}
297
+		if(!$ftp_info->ftp_host) {
298
+			$ftp_info->ftp_host = '127.0.0.1';
299
+		}
300
+		if(!$ftp_info->ftp_root_path) {
301
+			$ftp_info->ftp_root_path = '/';
302
+		}
272 303
 
273 304
 		$buff = array('<?php if(!defined("__XE__")) exit();');
274 305
 		$buff[] = "\$ftp_info = new stdClass();";
@@ -280,11 +311,15 @@  discard block
 block discarded – undo
280 311
 		// If safe_mode
281 312
 		if(ini_get('safe_mode'))
282 313
 		{
283
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
314
+			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
315
+				return new BaseObject(-1,'msg_safe_mode_ftp_needed');
316
+			}
284 317
 
285 318
 			require_once(_XE_PATH_.'libs/ftp.class.php');
286 319
 			$oFtp = new ftp();
287
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
320
+			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
321
+				return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
322
+			}
288 323
 
289 324
 			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
290 325
 			{
@@ -326,10 +361,16 @@  discard block
 block discarded – undo
326 361
 	{
327 362
 		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
328 363
 		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
329
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
330
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
364
+		if(!$ftp_info->ftp_port) {
365
+			$ftp_info->ftp_port = 21;
366
+		}
367
+		if(!$ftp_info->sftp) {
368
+			$ftp_info->sftp = 'N';
369
+		}
331 370
 
332
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed');
371
+		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
372
+			return new BaseObject(-1,'msg_safe_mode_ftp_needed');
373
+		}
333 374
 
334 375
 		if($ftp_info->sftp == 'Y')
335 376
 		{
@@ -338,12 +379,13 @@  discard block
 block discarded – undo
338 379
 			{
339 380
 				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
340 381
 			}
341
-		}
342
-		else
382
+		} else
343 383
 		{
344 384
 			require_once(_XE_PATH_.'libs/ftp.class.php');
345 385
 			$oFtp = new ftp();
346
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
386
+			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) {
387
+				return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
388
+			}
347 389
 
348 390
 			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
349 391
 			{
@@ -376,26 +418,47 @@  discard block
 block discarded – undo
376 418
 		}
377 419
 
378 420
 		// 1. Check permission
379
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
380
-		else $checklist['permission'] = false;
421
+		if(is_writable('./')||is_writable('./files')) {
422
+			$checklist['permission'] = true;
423
+		} else {
424
+			$checklist['permission'] = false;
425
+		}
381 426
 		// 2. Check if xml_parser_create exists
382
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
383
-		else $checklist['xml'] = false;
427
+		if(function_exists('xml_parser_create')) {
428
+			$checklist['xml'] = true;
429
+		} else {
430
+			$checklist['xml'] = false;
431
+		}
384 432
 		// 3. Check if ini_get (session.auto_start) == 1
385
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
386
-		else $checklist['session'] = false;
433
+		if(ini_get('session.auto_start')!=1) {
434
+			$checklist['session'] = true;
435
+		} else {
436
+			$checklist['session'] = false;
437
+		}
387 438
 		// 4. Check if iconv exists
388
-		if(function_exists('iconv')) $checklist['iconv'] = true;
389
-		else $checklist['iconv'] = false;
439
+		if(function_exists('iconv')) {
440
+			$checklist['iconv'] = true;
441
+		} else {
442
+			$checklist['iconv'] = false;
443
+		}
390 444
 		// 5. Check gd(imagecreatefromgif function)
391
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
392
-		else $checklist['gd'] = false;
445
+		if(function_exists('imagecreatefromgif')) {
446
+			$checklist['gd'] = true;
447
+		} else {
448
+			$checklist['gd'] = false;
449
+		}
393 450
 		// 6. Check DB
394
-		if(DB::getEnableList()) $checklist['db'] = true;
395
-		else $checklist['db'] = false;
451
+		if(DB::getEnableList()) {
452
+			$checklist['db'] = true;
453
+		} else {
454
+			$checklist['db'] = false;
455
+		}
396 456
 
397
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
398
-		else $install_enable = true;
457
+		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) {
458
+			$install_enable = false;
459
+		} else {
460
+			$install_enable = true;
461
+		}
399 462
 
400 463
 		// Save the checked result to the Context
401 464
 		Context::set('checklist', $checklist);
@@ -418,8 +481,7 @@  discard block
 block discarded – undo
418 481
 		{
419 482
 			$currentTime = $_SERVER['REQUEST_TIME'];
420 483
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
421
-		}
422
-		else
484
+		} else
423 485
 		{
424 486
 			FileHandler::removeFile($this->flagLicenseAgreement);
425 487
 			return new BaseObject(-1, 'msg_must_accept_license_agreement');
@@ -514,13 +576,17 @@  discard block
 block discarded – undo
514 576
 			$module = $tmp_arr[count($tmp_arr)-1];
515 577
 
516 578
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
517
-			if(!$xml_info) continue;
579
+			if(!$xml_info) {
580
+				continue;
581
+			}
518 582
 			$modules[$xml_info->category][] = $module;
519 583
 		}
520 584
 		// Install "module" module in advance
521 585
 		$this->installModule('module','./modules/module');
522 586
 		$oModule = getClass('module');
523
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
587
+		if($oModule->checkUpdate()) {
588
+			$oModule->moduleUpdate();
589
+		}
524 590
 		// Determine the order of module installation depending on category
525 591
 		$install_step = array('system','content','member');
526 592
 		// Install all the remaining modules
@@ -530,13 +596,17 @@  discard block
 block discarded – undo
530 596
 			{
531 597
 				foreach($modules[$category] as $module)
532 598
 				{
533
-					if($module == 'module') continue;
599
+					if($module == 'module') {
600
+						continue;
601
+					}
534 602
 					$this->installModule($module, sprintf('./modules/%s', $module));
535 603
 
536 604
 					$oModule = getClass($module);
537 605
 					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
538 606
 					{
539
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
607
+						if($oModule->checkUpdate()) {
608
+							$oModule->moduleUpdate();
609
+						}
540 610
 					}
541 611
 				}
542 612
 				unset($modules[$category]);
@@ -551,13 +621,17 @@  discard block
 block discarded – undo
551 621
 				{
552 622
 					foreach($module_list as $module)
553 623
 					{
554
-						if($module == 'module') continue;
624
+						if($module == 'module') {
625
+							continue;
626
+						}
555 627
 						$this->installModule($module, sprintf('./modules/%s', $module));
556 628
 
557 629
 						$oModule = getClass($module);
558 630
 						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
559 631
 						{
560
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
632
+							if($oModule->checkUpdate()) {
633
+								$oModule->moduleUpdate();
634
+							}
561 635
 						}
562 636
 					}
563 637
 				}
@@ -582,15 +656,20 @@  discard block
 block discarded – undo
582 656
 		for($i=0;$i<$file_cnt;$i++)
583 657
 		{
584 658
 			$file = trim($schema_files[$i]);
585
-			if(!$file || substr($file,-4)!='.xml') continue;
659
+			if(!$file || substr($file,-4)!='.xml') {
660
+				continue;
661
+			}
586 662
 			$output = $oDB->createTableByXmlFile($file);
587
-			if($output === false)
588
-				throw new Exception('msg_create_table_failed');
663
+			if($output === false) {
664
+							throw new Exception('msg_create_table_failed');
665
+			}
589 666
 		}
590 667
 		// Create a table and module instance and then execute install() method
591 668
 		unset($oModule);
592 669
 		$oModule = getClass($module);
593
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
670
+		if(method_exists($oModule, 'moduleInstall')) {
671
+			$oModule->moduleInstall();
672
+		}
594 673
 		return new BaseObject();
595 674
 	}
596 675
 
@@ -625,13 +704,17 @@  discard block
 block discarded – undo
625 704
 		$db_tmp_config_file = $this->db_tmp_config_file;
626 705
 
627 706
 		$db_info = Context::getDBInfo();
628
-		if(!$db_info) return;
707
+		if(!$db_info) {
708
+			return;
709
+		}
629 710
 
630 711
 		$buff = $this->_getDBConfigFileContents($db_info);
631 712
 
632 713
 		FileHandler::writeFile($db_tmp_config_file, $buff);
633 714
 
634
-		if(@file_exists($db_tmp_config_file)) return true;
715
+		if(@file_exists($db_tmp_config_file)) {
716
+			return true;
717
+		}
635 718
 		return false;
636 719
 	}
637 720
 
@@ -651,7 +734,9 @@  discard block
 block discarded – undo
651 734
 
652 735
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
653 736
 
654
-		if(@file_exists($etc_tmp_config_file)) return true;
737
+		if(@file_exists($etc_tmp_config_file)) {
738
+			return true;
739
+		}
655 740
 		return false;
656 741
 	}
657 742
 
@@ -666,7 +751,9 @@  discard block
 block discarded – undo
666 751
 			//if(file_exists($config_file)) return;
667 752
 
668 753
 			$db_info = Context::getDBInfo();
669
-			if(!$db_info) return;
754
+			if(!$db_info) {
755
+				return;
756
+			}
670 757
 
671 758
 			$buff = $this->_getDBConfigFileContents($db_info);
672 759
 
@@ -687,7 +774,9 @@  discard block
 block discarded – undo
687 774
 	function installByConfig($install_config_file)
688 775
 	{
689 776
 		include $install_config_file;
690
-		if(!is_array($auto_config)) return false;
777
+		if(!is_array($auto_config)) {
778
+			return false;
779
+		}
691 780
 
692 781
 		$auto_config['module'] = 'install';
693 782
 		$auto_config['act'] = 'procInstall';
@@ -697,7 +786,9 @@  discard block
 block discarded – undo
697 786
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
698 787
 		foreach($auto_config as $k => $v)
699 788
 		{
700
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
789
+			if(!in_array($k,array('host','port','path'))) {
790
+				$body .= sprintf($fstr,$k,$v,$k);
791
+			}
701 792
 		}
702 793
 		$body .= "</params>\r\n</methodCall>";
703 794
 
Please login to merge, or discard this patch.
modules/install/install.model.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
 
7 7
 	function getSFTPList()
8 8
 	{
9
-		$ftp_info =  Context::getRequestVars();
10
-		if(!$ftp_info->ftp_host)
9
+		$ftp_info = Context::getRequestVars();
10
+		if (!$ftp_info->ftp_host)
11 11
 		{
12 12
 			$ftp_info->ftp_host = "127.0.0.1";
13 13
 		}
14 14
 
15 15
 		$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
16
-		if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
16
+		if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
17 17
 		{
18
-			return new BaseObject(-1,'msg_ftp_invalid_auth_info');
18
+			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
19 19
 		}
20 20
 
21 21
 		$sftp = ssh2_sftp($connection);
22 22
 		$curpwd = "ssh2.sftp://$sftp".$this->pwd;
23 23
 		$dh = @opendir($curpwd);
24
-		if(!$dh) return new BaseObject(-1, 'msg_ftp_invalid_path');
24
+		if (!$dh) return new BaseObject(-1, 'msg_ftp_invalid_path');
25 25
 
26 26
 		$list = array();
27
-		while(($file = readdir($dh)) !== false)
27
+		while (($file = readdir($dh)) !== false)
28 28
 		{
29
-			if(!is_dir($curpwd.$file)) continue;
30
-			$list[] = $file . "/";
29
+			if (!is_dir($curpwd.$file)) continue;
30
+			$list[] = $file."/";
31 31
 		}
32 32
 		closedir($dh);
33 33
 		$this->add('list', $list);
@@ -35,33 +35,33 @@  discard block
 block discarded – undo
35 35
 
36 36
 	function getInstallFTPList()
37 37
 	{
38
-		if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) 
38
+		if (!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) 
39 39
 		{
40 40
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
41 41
 		}
42 42
 		$this->pwd = $ftp_info->ftp_root_path;
43
-		if(!$ftp_info->ftp_host)
43
+		if (!$ftp_info->ftp_host)
44 44
 		{
45 45
 			$ftp_info->ftp_host = "127.0.0.1";
46 46
 		}
47 47
 
48
-		if($ftp_info->sftp == 'Y')
48
+		if ($ftp_info->sftp == 'Y')
49 49
 		{
50 50
 			return $this->getSFTPList();
51 51
 		}
52 52
 
53 53
 		$_list = NULL;
54
-		if(function_exists('ftp_connect'))
54
+		if (function_exists('ftp_connect'))
55 55
 		{
56 56
 			$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
57
-			if(!$connection) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
58
-			if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
57
+			if (!$connection) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
58
+			if (!@ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
59 59
 			{
60 60
 				ftp_close($connection);	
61
-				return new BaseObject(-1,'msg_ftp_invalid_auth_info');
61
+				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
62 62
 			}
63 63
 
64
-			if($ftp_info->ftp_pasv != "N") 
64
+			if ($ftp_info->ftp_pasv != "N") 
65 65
 			{
66 66
 				ftp_pasv($connection, true);
67 67
 			}
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 		{
74 74
 			require_once(_XE_PATH_.'libs/ftp.class.php');
75 75
 			$oFtp = new ftp();
76
-			if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
76
+			if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
77 77
 			{
78
-				if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
78
+				if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
79 79
 				{
80 80
 					$_list = $oFtp->ftp_rawlist($this->pwd);
81 81
 					$oFtp->ftp_quit();
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
 				else
84 84
 				{
85 85
 					$oFtp->ftp_quit();
86
-					return new BaseObject(-1,'msg_ftp_invalid_auth_info');
86
+					return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
87 87
 				}
88 88
 			}
89 89
 		}
90 90
 
91 91
 		$list = array();
92
-		if($_list)
92
+		if ($_list)
93 93
 		{
94
-			foreach($_list as $k => $v)
94
+			foreach ($_list as $k => $v)
95 95
 			{
96 96
 				$src = new stdClass(); 
97 97
 				$src->data = $v;
98 98
 				$res = Context::convertEncoding($src);
99 99
 				$v = $res->data;
100
-				if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/';
100
+				if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v, ' '), 1).'/';
101 101
 			}
102 102
 		}
103 103
 		$this->add('list', $list);
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,16 @@  discard block
 block discarded – undo
21 21
 		$sftp = ssh2_sftp($connection);
22 22
 		$curpwd = "ssh2.sftp://$sftp".$this->pwd;
23 23
 		$dh = @opendir($curpwd);
24
-		if(!$dh) return new BaseObject(-1, 'msg_ftp_invalid_path');
24
+		if(!$dh) {
25
+			return new BaseObject(-1, 'msg_ftp_invalid_path');
26
+		}
25 27
 
26 28
 		$list = array();
27 29
 		while(($file = readdir($dh)) !== false)
28 30
 		{
29
-			if(!is_dir($curpwd.$file)) continue;
31
+			if(!is_dir($curpwd.$file)) {
32
+				continue;
33
+			}
30 34
 			$list[] = $file . "/";
31 35
 		}
32 36
 		closedir($dh);
@@ -54,7 +58,9 @@  discard block
 block discarded – undo
54 58
 		if(function_exists('ftp_connect'))
55 59
 		{
56 60
 			$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
57
-			if(!$connection) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
61
+			if(!$connection) {
62
+				return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
63
+			}
58 64
 			if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
59 65
 			{
60 66
 				ftp_close($connection);	
@@ -68,8 +74,7 @@  discard block
 block discarded – undo
68 74
 
69 75
 			$_list = ftp_rawlist($connection, $this->pwd);
70 76
 			ftp_close($connection);	
71
-		}
72
-		else
77
+		} else
73 78
 		{
74 79
 			require_once(_XE_PATH_.'libs/ftp.class.php');
75 80
 			$oFtp = new ftp();
@@ -79,8 +84,7 @@  discard block
 block discarded – undo
79 84
 				{
80 85
 					$_list = $oFtp->ftp_rawlist($this->pwd);
81 86
 					$oFtp->ftp_quit();
82
-				}
83
-				else
87
+				} else
84 88
 				{
85 89
 					$oFtp->ftp_quit();
86 90
 					return new BaseObject(-1,'msg_ftp_invalid_auth_info');
@@ -97,7 +101,9 @@  discard block
 block discarded – undo
97 101
 				$src->data = $v;
98 102
 				$res = Context::convertEncoding($src);
99 103
 				$v = $res->data;
100
-				if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/';
104
+				if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) {
105
+					$list[] = substr(strrchr($v,' '),1) . '/';
106
+				}
101 107
 			}
102 108
 		}
103 109
 		$this->add('list', $list);
Please login to merge, or discard this patch.
modules/install/script/ko.install.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 function __makeMenu(&$list, $parent_srl)
131 131
 {
132 132
 	$oMenuAdminController = getAdminController('menu');
133
-	foreach($list as $idx => &$item)
133
+	foreach ($list as $idx => &$item)
134 134
 	{
135 135
 		Context::set('parent_srl', $parent_srl, TRUE);
136 136
 		Context::set('menu_name', $item['menu_name'], TRUE);
137 137
 		Context::set('module_type', $item['module_type'], TRUE);
138 138
 		Context::set('module_id', $item['module_id'], TRUE);
139
-		if($item['is_shortcut'] === 'Y')
139
+		if ($item['is_shortcut'] === 'Y')
140 140
 		{
141 141
 			Context::set('is_shortcut', $item['is_shortcut'], TRUE);
142 142
 			Context::set('shortcut_target', $item['shortcut_target'], TRUE);
@@ -148,23 +148,23 @@  discard block
 block discarded – undo
148 148
 		}
149 149
 
150 150
 		$output = $oMenuAdminController->procMenuAdminInsertItem();
151
-		if($output instanceof BaseObject && !$output->toBool())
151
+		if ($output instanceof BaseObject && !$output->toBool())
152 152
 		{
153 153
 			return $output;
154 154
 		}
155 155
 		$menu_srl = $oMenuAdminController->get('menu_item_srl');
156 156
 		$item['menu_srl'] = $menu_srl;
157 157
 
158
-		if($item['list']) __makeMenu($item['list'], $menu_srl);
158
+		if ($item['list']) __makeMenu($item['list'], $menu_srl);
159 159
 	}
160 160
 }
161 161
 
162 162
 
163 163
 // 사이트맵 생성
164
-foreach($sitemap as $id => &$val)
164
+foreach ($sitemap as $id => &$val)
165 165
 {
166 166
 	$output = $oMenuAdminController->addMenu($val['title']);
167
-	if(!$output->toBool())
167
+	if (!$output->toBool())
168 168
 	{
169 169
 		return $output;
170 170
 	}
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 
192 192
 $oLayoutAdminController = getAdminController('layout');
193 193
 $output = $oLayoutAdminController->insertLayout($args);
194
-if(!$output->toBool()) return $output;
194
+if (!$output->toBool()) return $output;
195 195
 
196 196
 // update Layout (PC)
197 197
 $args->extra_vars = serialize($extra_vars);
198 198
 $output = $oLayoutAdminController->updateLayout($args);
199
-if(!$output->toBool()) return $output;
199
+if (!$output->toBool()) return $output;
200 200
 
201 201
 //create mobile layout
202 202
 $mlayout_srl = $args->layout_srl = getNextSequence();
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 $extra_vars->main_menu = $sitemap['GNB']['menu_srl'];
207 207
 
208 208
 $output = $oLayoutAdminController->insertLayout($args);
209
-if(!$output->toBool()) return $output;
209
+if (!$output->toBool()) return $output;
210 210
 
211 211
 // update mobile Layout
212 212
 $args->extra_vars = serialize($extra_vars);
213 213
 $output = $oLayoutAdminController->updateLayout($args);
214
-if(!$output->toBool()) return $output;
214
+if (!$output->toBool()) return $output;
215 215
 
216 216
 
217 217
 $siteDesignPath = _XE_PATH_.'files/site_design/';
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 $moduleList = array('page', 'board', 'editor');
226 226
 $moutput = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList);
227
-if($moutput->toBool())
227
+if ($moutput->toBool())
228 228
 {
229 229
 	$moduleList = array_unique($moduleList);
230 230
 }
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 $designInfo->module = new stdClass();
235 235
 
236 236
 $oModuleModel = getModel('module'); /* @var $oModuleModel moduleModel */
237
-foreach($skinTypes as $key => $dir)
237
+foreach ($skinTypes as $key => $dir)
238 238
 {
239 239
 	$skinType = $key == 'skin' ? 'P' : 'M';
240
-	foreach($moduleList as $moduleName)
240
+	foreach ($moduleList as $moduleName)
241 241
 	{
242 242
 		$designInfo->module->{$moduleName} = new stdClass();
243 243
 		$designInfo->module->{$moduleName}->{$key} = $oModuleModel->getModuleDefaultSkin($moduleName, $skinType, 0, false);
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 Context::set('version', __XE_VERSION__);
272 272
 $obj->title = 'Welcome XE';
273 273
 
274
-$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content_'.$lang);
274
+$obj->content = $oTemplateHandler->compile(_XE_PATH_.'modules/install/script/welcome_content', 'welcome_content_'.$lang);
275 275
 
276 276
 $output = $oDocumentController->insertDocument($obj, true);
277
-if(!$output->toBool()) return $output;
277
+if (!$output->toBool()) return $output;
278 278
 
279 279
 $document_srl = $output->get('document_srl');
280 280
 
281 281
 unset($obj->document_srl);
282 282
 $obj->title = 'Welcome mobile XE';
283 283
 $output = $oDocumentController->insertDocument($obj, true);
284
-if(!$output->toBool()) return $output;
284
+if (!$output->toBool()) return $output;
285 285
 
286 286
 // save PageWidget
287 287
 $oModuleController = getController('module'); /* @var $oModuleController moduleController */
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 $module_info->content = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$document_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0"  />';
291 291
 $module_info->mcontent = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$mdocument_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0"  />';
292 292
 $output = $oModuleController->updateModule($module_info);
293
-if(!$output->toBool()) return $output;
293
+if (!$output->toBool()) return $output;
294 294
 
295 295
 // insertFirstModule
296 296
 $site_args = new stdClass();
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
 $xeicon_module_srl = $moduleInfo->module_srl;
305 305
 
306 306
 $xeicon_document_srl = array();
307
-for($i = 1; $i <=4; $i++)
307
+for ($i = 1; $i <= 4; $i++)
308 308
 {
309 309
 	unset($obj->document_srl);
310 310
 	$obj->title = "XEIcon ({$i})";
311
-	$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/xeicon_content', 'xeicon_content_ko_' . $i);
311
+	$obj->content = $oTemplateHandler->compile(_XE_PATH_.'modules/install/script/xeicon_content', 'xeicon_content_ko_'.$i);
312 312
 
313 313
 	$output = $oDocumentController->insertDocument($obj, true);
314
-	if(!$output->toBool()) return $output;
314
+	if (!$output->toBool()) return $output;
315 315
 
316 316
 	$xeicon_document_srl[$i] = $output->get('document_srl');
317 317
 }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 $module_info = $oModuleModel->getModuleInfoByModuleSrl($xeicon_module_srl);
322 322
 $module_info->content = '<div widget="widgetBox" style="float:left;width:100%;" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" css_class="XEicon" ><div><div><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[1].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[2].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[3].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[4].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /></div></div></div>';
323 323
 $output = $oModuleController->updateModule($module_info);
324
-if(!$output->toBool()) return $output;
324
+if (!$output->toBool()) return $output;
325 325
 
326 326
 
327 327
 // create menu cache
Please login to merge, or discard this patch.
modules/document/document.class.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 * Search option to use in admin page
18 18
 	 * @var array
19 19
 	 */
20
-	var $search_option = array('title','content','title_content','user_name',); // /< Search options
20
+	var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options
21 21
 	/**
22 22
 	 * Status list
23 23
 	 * @var array
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
 		$oModuleController = getController('module');
35 35
 
36 36
 		$oDB = &DB::getInstance();
37
-		$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
38
-		$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
39
-		$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
40
-		$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
41
-		$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
42
-		$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
43
-		$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
44
-		$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true);
45
-		$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
37
+		$oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order"));
38
+		$oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order"));
39
+		$oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count"));
40
+		$oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count"));
41
+		$oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice"));
42
+		$oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl"));
43
+		$oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count"));
44
+		$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true);
45
+		$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true);
46 46
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
47 47
 		$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
48 48
 
49 49
 		// 2009. 01. 29 Added a trigger for additional setup
50 50
 		$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
51 51
 
52
-		if(!is_dir('./files/cache/tmp'))
52
+		if (!is_dir('./files/cache/tmp'))
53 53
 		{
54 54
 			FileHandler::makeDir('./files/cache/tmp');
55 55
 		}
@@ -67,71 +67,71 @@  discard block
 block discarded – undo
67 67
 		$oModuleModel = getModel('module');
68 68
 		$oModuleController = getController('module');
69 69
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
70
-		if($oModuleModel->needUpdate($version_update_id))
70
+		if ($oModuleModel->needUpdate($version_update_id))
71 71
 		{
72 72
 			// 2007. 7. 25: Add a column(notify_message) for notification
73
-			if(!$oDB->isColumnExists("documents","notify_message")) return true;
73
+			if (!$oDB->isColumnExists("documents", "notify_message")) return true;
74 74
 
75 75
 			// 2007. 8. 23: create a clustered index in the document table
76
-			if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true;
77
-			if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
78
-			if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
79
-			if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
76
+			if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true;
77
+			if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true;
78
+			if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true;
79
+			if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true;
80 80
 			// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
81
-			if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
81
+			if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
82 82
 			// 2007. 10. 25 add parent_srl, expand to the document category
83
-			if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
84
-			if(!$oDB->isColumnExists("document_categories","expand")) return true;
85
-			if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
83
+			if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true;
84
+			if (!$oDB->isColumnExists("document_categories", "expand")) return true;
85
+			if (!$oDB->isColumnExists("document_categories", "group_srls")) return true;
86 86
 			// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
87
-			if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
87
+			if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true;
88 88
 			// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
89
-			if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
89
+			if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true;
90 90
 
91 91
 			// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
92
-			if(!$oDB->isColumnExists("documents","extra_vars")) return true;
92
+			if (!$oDB->isColumnExists("documents", "extra_vars")) return true;
93 93
 			// 2008. 04. 23 Add a column(blamed_count)
94
-			if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
95
-			if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
96
-			if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
94
+			if (!$oDB->isColumnExists("documents", "blamed_count")) return true;
95
+			if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true;
96
+			if (!$oDB->isColumnExists("document_voted_log", "point")) return true;
97 97
 			// 2008-12-15 Add a column(color)
98
-			if(!$oDB->isColumnExists("document_categories", "color")) return true;
98
+			if (!$oDB->isColumnExists("document_categories", "color")) return true;
99 99
 
100 100
 			/**
101 101
 			 * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
102 102
 			 */
103
-			if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
103
+			if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true;
104 104
 
105
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
105
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
106 106
 			// 2009. 03. 09 Add a column(lang_code) to the documnets table
107
-			if(!$oDB->isColumnExists("documents","lang_code")) return true;
107
+			if (!$oDB->isColumnExists("documents", "lang_code")) return true;
108 108
 			// 2009. 03. 11 check the index in the document_extra_vars table
109
-			if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
109
+			if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
110 110
 
111 111
 			// 2009. 03. 19: Add a column(eid) if not exist in the table
112
-			if(!$oDB->isColumnExists("document_extra_keys","eid")) return true;
113
-			if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
112
+			if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true;
113
+			if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true;
114 114
 
115 115
 			// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
116
-			if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
116
+			if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
117 117
 
118 118
 			//2011. 04. 07 adding description column to document categories
119
-			if(!$oDB->isColumnExists("document_categories","description")) return true;
119
+			if (!$oDB->isColumnExists("document_categories", "description")) return true;
120 120
 
121 121
 			//2011. 05. 23 adding status column to document
122
-			if(!$oDB->isColumnExists('documents', 'status')) return true;
122
+			if (!$oDB->isColumnExists('documents', 'status')) return true;
123 123
 
124 124
 			//2011. 06. 07 check comment status update
125
-			if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
125
+			if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
126 126
 
127 127
 			// 2011. 10. 25 status index check
128
-			if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
128
+			if (!$oDB->isIndexExists("documents", "idx_module_status")) return true;
129 129
 
130 130
 			// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
131
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
131
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
132 132
 
133 133
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
134
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
134
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
135 135
 
136 136
 			$oModuleController->insertUpdatedLog($version_update_id);
137 137
 		}
@@ -149,101 +149,101 @@  discard block
 block discarded – undo
149 149
 		$oModuleModel = getModel('module');
150 150
 		$oModuleController = getController('module');
151 151
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
152
-		if($oModuleModel->needUpdate($version_update_id))
152
+		if ($oModuleModel->needUpdate($version_update_id))
153 153
 		{
154 154
 			// 2007. 7. 25: Add a column(notify_message) for notification
155
-			if(!$oDB->isColumnExists("documents","notify_message"))
155
+			if (!$oDB->isColumnExists("documents", "notify_message"))
156 156
 			{
157
-				$oDB->addColumn('documents',"notify_message","char",1);
157
+				$oDB->addColumn('documents', "notify_message", "char", 1);
158 158
 			}
159 159
 
160 160
 			// 2007. 8. 23: create a clustered index in the document table
161
-			if(!$oDB->isIndexExists("documents","idx_module_list_order"))
161
+			if (!$oDB->isIndexExists("documents", "idx_module_list_order"))
162 162
 			{
163
-				$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
163
+				$oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order"));
164 164
 			}
165 165
 
166
-			if(!$oDB->isIndexExists("documents","idx_module_update_order"))
166
+			if (!$oDB->isIndexExists("documents", "idx_module_update_order"))
167 167
 			{
168
-				$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
168
+				$oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order"));
169 169
 			}
170 170
 
171
-			if(!$oDB->isIndexExists("documents","idx_module_readed_count"))
171
+			if (!$oDB->isIndexExists("documents", "idx_module_readed_count"))
172 172
 			{
173
-				$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
173
+				$oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count"));
174 174
 			}
175 175
 
176
-			if(!$oDB->isIndexExists("documents","idx_module_voted_count"))
176
+			if (!$oDB->isIndexExists("documents", "idx_module_voted_count"))
177 177
 			{
178
-				$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
178
+				$oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count"));
179 179
 			}
180 180
 			// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
181
-			if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
181
+			if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
182 182
 				$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
183 183
 			// 2007. 10. 25 add columns(parent_srl, expand) 
184
-			if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
185
-			if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
186
-			if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
184
+			if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0);
185
+			if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N");
186
+			if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text");
187 187
 			// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
188
-			if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
188
+			if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice"));
189 189
 
190 190
 			// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
191
-			if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text');
191
+			if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text');
192 192
 
193 193
 			// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
194
-			if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
194
+			if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl"));
195 195
 			// 2008. 04. 23 Add a column(blamed count)
196
-			if(!$oDB->isColumnExists("documents", "blamed_count"))
196
+			if (!$oDB->isColumnExists("documents", "blamed_count"))
197 197
 			{
198 198
 				$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
199 199
 				$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
200 200
 			}
201 201
 
202
-			if(!$oDB->isIndexExists("documents","idx_module_blamed_count"))
202
+			if (!$oDB->isIndexExists("documents", "idx_module_blamed_count"))
203 203
 			{
204 204
 				$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
205 205
 			}
206 206
 
207
-			if(!$oDB->isColumnExists("document_voted_log", "point"))
207
+			if (!$oDB->isColumnExists("document_voted_log", "point"))
208 208
 				$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
209 209
 
210 210
 
211
-			if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7);
211
+			if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7);
212 212
 
213 213
 			// 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
214
-			if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
214
+			if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10);
215 215
 
216 216
 			// 2009. 01. 29 Added a trigger for additional setup
217
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
217
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
218 218
 				$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
219 219
 			// 2009. 03. 09 Add a column(lang_code) to the documnets table
220
-			if(!$oDB->isColumnExists("documents","lang_code"))
220
+			if (!$oDB->isColumnExists("documents", "lang_code"))
221 221
 			{
222 222
 				$db_info = Context::getDBInfo();
223
-				$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
223
+				$oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code);
224 224
 				$obj->lang_code = $db_info->lang_type;
225 225
 				executeQuery('document.updateDocumentsLangCode', $obj);
226 226
 			}
227 227
 			// 2009. 03. 11 Check the index in the document_extra_vars table
228
-			if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars"))
228
+			if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars"))
229 229
 			{
230
-				$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
230
+				$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true);
231 231
 			}
232 232
 
233
-			if($oDB->isIndexExists("document_extra_vars", "unique_module_vars"))
233
+			if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars"))
234 234
 			{
235 235
 				$oDB->dropIndex("document_extra_vars", "unique_module_vars", true);
236 236
 			}
237 237
 
238 238
 			// 2009. 03. 19: Add a column(eid)
239 239
 			// 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
240
-			if(!$oDB->isColumnExists("document_extra_keys","eid"))
240
+			if (!$oDB->isColumnExists("document_extra_keys", "eid"))
241 241
 			{
242
-				$oDB->addColumn("document_extra_keys","eid","varchar",40);
242
+				$oDB->addColumn("document_extra_keys", "eid", "varchar", 40);
243 243
 
244 244
 				$output = executeQuery('document.getGroupsExtraKeys', $obj);
245
-				if($output->toBool() && $output->data && count($output->data)) {
246
-					foreach($output->data as $extra_keys) {
245
+				if ($output->toBool() && $output->data && count($output->data)) {
246
+					foreach ($output->data as $extra_keys) {
247 247
 						$args->module_srl = $extra_keys->module_srl;
248 248
 						$args->var_idx = $extra_keys->idx;
249 249
 						$args->new_eid = "extra_vars".$extra_keys->idx;
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
 				}
253 253
 			}
254 254
 
255
-			if(!$oDB->isColumnExists("document_extra_vars","eid"))
255
+			if (!$oDB->isColumnExists("document_extra_vars", "eid"))
256 256
 			{
257
-				$oDB->addColumn("document_extra_vars","eid","varchar",40);
257
+				$oDB->addColumn("document_extra_vars", "eid", "varchar", 40);
258 258
 				$obj->var_idx = '-1,-2';
259 259
 				$output = executeQuery('document.getGroupsExtraVars', $obj);
260
-				if($output->toBool() && $output->data && count($output->data))
260
+				if ($output->toBool() && $output->data && count($output->data))
261 261
 				{
262
-					foreach($output->data as $extra_vars)
262
+					foreach ($output->data as $extra_vars)
263 263
 					{
264 264
 						$args->module_srl = $extra_vars->module_srl;
265 265
 						$args->var_idx = $extra_vars->idx;
@@ -270,16 +270,16 @@  discard block
 block discarded – undo
270 270
 			}
271 271
 
272 272
 			// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
273
-			if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order"))
273
+			if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order"))
274 274
 			{
275
-				$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false);
275
+				$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false);
276 276
 			}
277 277
 
278 278
 			//2011. 04. 07 adding description column to document categories
279
-			if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0);
279
+			if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0);
280 280
 
281 281
 			//2011. 05. 23 adding status column to document
282
-			if(!$oDB->isColumnExists('documents', 'status'))
282
+			if (!$oDB->isColumnExists('documents', 'status'))
283 283
 			{
284 284
 				$oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC');
285 285
 				$args->is_secret = 'Y';
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
 			}
288 288
 
289 289
 			// 2011. 09. 08 drop column document is_secret
290
-			if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
290
+			if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
291 291
 				$oDB->dropColumn('documents', 'is_secret');
292 292
 
293 293
 			//2011. 06. 07 merge column, allow_comment and lock_comment
294
-			if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
294
+			if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
295 295
 			{
296 296
 				$oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW');
297 297
 
@@ -313,23 +313,23 @@  discard block
 block discarded – undo
313 313
 				$output = executeQuery('document.updateDocumentCommentStatus', $args);
314 314
 			}
315 315
 
316
-			if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
316
+			if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
317 317
 				$oDB->dropColumn('documents', 'allow_comment');
318 318
 
319
-			if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
319
+			if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
320 320
 				$oDB->dropColumn('documents', 'lock_comment');
321 321
 
322
-			if(!$oDB->isIndexExists("documents", "idx_module_status"))
323
-				$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
322
+			if (!$oDB->isIndexExists("documents", "idx_module_status"))
323
+				$oDB->addIndex("documents", "idx_module_status", array("module_srl", "status"));
324 324
 
325 325
 			// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
326
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
326
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
327 327
 			{
328 328
 				$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
329 329
 			}
330 330
 
331 331
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
332
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
332
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
333 333
 			{
334 334
 				$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after');
335 335
 			}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			$oModuleController->insertUpdatedLog($version_update_id);
338 338
 		}
339 339
 
340
-		return new BaseObject(0,'success_updated');
340
+		return new BaseObject(0, 'success_updated');
341 341
 	}
342 342
 
343 343
 	/**
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	function recompileCache()
348 348
 	{
349
-		if(!is_dir('./files/cache/tmp'))
349
+		if (!is_dir('./files/cache/tmp'))
350 350
 		{
351 351
 			FileHandler::makeDir('./files/cache/tmp');
352 352
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	function getConfigStatus($key)
378 378
 	{
379
-		if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
379
+		if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
380 380
 		else $this->getDefaultStatus();
381 381
 	}
382 382
 }
Please login to merge, or discard this patch.
modules/member/member.class.php 2 patches
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	function member()
22 22
 	{
23
-		if(!Context::isInstalled()) return;
23
+		if (!Context::isInstalled()) return;
24 24
 
25 25
 		$oModuleModel = getModel('module');
26 26
 		$member_config = $oModuleModel->getModuleConfig('member');
27 27
 
28 28
 		// Set to use SSL upon actions related member join/information/password and so on. 2013.02.15
29
-		if(!Context::isExistsSSLAction('dispMemberModifyPassword') && Context::getSslStatus() == 'optional')
29
+		if (!Context::isExistsSSLAction('dispMemberModifyPassword') && Context::getSslStatus() == 'optional')
30 30
 		{
31 31
 			$ssl_actions = array('dispMemberModifyPassword', 'dispMemberSignUpForm', 'dispMemberModifyInfo', 'dispMemberModifyEmailAddress', 'dispMemberGetTempPassword', 'dispMemberResendAuthMail', 'dispMemberLoginForm', 'dispMemberFindAccount', 'dispMemberLeave', 'procMemberLogin', 'procMemberModifyPassword', 'procMemberInsert', 'procMemberModifyInfo', 'procMemberFindAccount', 'procMemberModifyEmailAddress', 'procMemberResendAuthMail', 'procMemberLeave'/*, 'getMemberMenu'*/, 'procMemberFindAccountByQuestion');
32 32
 			Context::addSSLActions($ssl_actions);
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 		$oModuleController = getController('module');
45 45
 
46 46
 		$oDB = &DB::getInstance();
47
-		$oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true);
47
+		$oDB->addIndex("member_group", "idx_site_title", array("site_srl", "title"), true);
48 48
 
49 49
 		$oModuleModel = getModel('module');
50 50
 		$config = $oModuleModel->getModuleConfig('member');
51 51
 
52
-		if(empty($config))
52
+		if (empty($config))
53 53
 		{
54 54
 			$isNotInstall = true;
55 55
 			$config = new stdClass;
@@ -58,29 +58,29 @@  discard block
 block discarded – undo
58 58
 		// Set the basic information
59 59
 		$config->enable_join = 'Y';
60 60
 		$config->enable_openid = 'N';
61
-		if(!$config->enable_auth_mail) $config->enable_auth_mail = 'N';
62
-		if(!$config->image_name) $config->image_name = 'Y';
63
-		if(!$config->image_mark) $config->image_mark = 'Y';
64
-		if(!$config->profile_image) $config->profile_image = 'Y';
65
-		if(!$config->image_name_max_width) $config->image_name_max_width = '90';
66
-		if(!$config->image_name_max_height) $config->image_name_max_height = '20';
67
-		if(!$config->image_mark_max_width) $config->image_mark_max_width = '20';
68
-		if(!$config->image_mark_max_height) $config->image_mark_max_height = '20';
69
-		if(!$config->profile_image_max_width) $config->profile_image_max_width = '90';
70
-		if(!$config->profile_image_max_height) $config->profile_image_max_height = '90';
71
-		if($config->group_image_mark!='Y') $config->group_image_mark = 'N';
72
-		if(!$config->password_strength) $config->password_strength = 'normal';
61
+		if (!$config->enable_auth_mail) $config->enable_auth_mail = 'N';
62
+		if (!$config->image_name) $config->image_name = 'Y';
63
+		if (!$config->image_mark) $config->image_mark = 'Y';
64
+		if (!$config->profile_image) $config->profile_image = 'Y';
65
+		if (!$config->image_name_max_width) $config->image_name_max_width = '90';
66
+		if (!$config->image_name_max_height) $config->image_name_max_height = '20';
67
+		if (!$config->image_mark_max_width) $config->image_mark_max_width = '20';
68
+		if (!$config->image_mark_max_height) $config->image_mark_max_height = '20';
69
+		if (!$config->profile_image_max_width) $config->profile_image_max_width = '90';
70
+		if (!$config->profile_image_max_height) $config->profile_image_max_height = '90';
71
+		if ($config->group_image_mark != 'Y') $config->group_image_mark = 'N';
72
+		if (!$config->password_strength) $config->password_strength = 'normal';
73 73
 		
74
-		if(!$config->password_hashing_algorithm)
74
+		if (!$config->password_hashing_algorithm)
75 75
 		{
76 76
 			$oPassword = new Password();
77 77
 			$config->password_hashing_algorithm = $oPassword->getBestAlgorithm();
78 78
 		}
79
-		if(!$config->password_hashing_work_factor)
79
+		if (!$config->password_hashing_work_factor)
80 80
 		{
81 81
 			$config->password_hashing_work_factor = 8;
82 82
 		}
83
-		if(!$config->password_hashing_auto_upgrade)
83
+		if (!$config->password_hashing_auto_upgrade)
84 84
 		{
85 85
 			$config->password_hashing_auto_upgrade = 'Y';
86 86
 		}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		$oMemberController = getController('member');
92 92
 		$oMemberAdminController = getAdminController('member');
93 93
 
94
-		if(!$config->signupForm || !is_array($config->signupForm))
94
+		if (!$config->signupForm || !is_array($config->signupForm))
95 95
 		{
96 96
 			$identifier = $isNotInstall ? 'email_address' : 'user_id';
97 97
 
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 			$oMemberAdminController->_createFindAccountByQuestion($config->identifier);
107 107
 		}
108 108
 		
109
-		$oModuleController->insertModuleConfig('member',$config);
109
+		$oModuleController->insertModuleConfig('member', $config);
110 110
 
111 111
 		$groups = $oMemberModel->getGroups();
112
-		if(!count($groups))
112
+		if (!count($groups))
113 113
 		{
114 114
 			// Set an administrator, regular member(group1), and associate member(group2)
115 115
 			$group_args = new stdClass;
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 		$admin_args = new stdClass;
136 136
 		$admin_args->is_admin = 'Y';
137 137
 		$output = executeQuery('member.getMemberList', $admin_args);
138
-		if(!$output->data)
138
+		if (!$output->data)
139 139
 		{
140
-			$admin_info = Context::gets('password','nick_name','email_address', 'user_id');
141
-			if($admin_info->email_address)
140
+			$admin_info = Context::gets('password', 'nick_name', 'email_address', 'user_id');
141
+			if ($admin_info->email_address)
142 142
 			{
143 143
 				$admin_info->user_name = 'admin';
144 144
 				// Insert admin information
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
 		// Register denied ID(default + module name)
151 151
 		$oModuleModel = getModel('module');
152 152
 		$module_list = $oModuleModel->getModuleList();
153
-		foreach($module_list as $key => $val)
153
+		foreach ($module_list as $key => $val)
154 154
 		{
155
-			$oMemberAdminController->insertDeniedID($val->module,'');
155
+			$oMemberAdminController->insertDeniedID($val->module, '');
156 156
 		}
157
-		$oMemberAdminController->insertDeniedID('www','');
158
-		$oMemberAdminController->insertDeniedID('root','');
159
-		$oMemberAdminController->insertDeniedID('administrator','');
160
-		$oMemberAdminController->insertDeniedID('telnet','');
161
-		$oMemberAdminController->insertDeniedID('ftp','');
162
-		$oMemberAdminController->insertDeniedID('http','');
157
+		$oMemberAdminController->insertDeniedID('www', '');
158
+		$oMemberAdminController->insertDeniedID('root', '');
159
+		$oMemberAdminController->insertDeniedID('administrator', '');
160
+		$oMemberAdminController->insertDeniedID('telnet', '');
161
+		$oMemberAdminController->insertDeniedID('ftp', '');
162
+		$oMemberAdminController->insertDeniedID('http', '');
163 163
 		// Create cache directory to use in the member module
164 164
 		FileHandler::makeDir('./files/member_extra_info/image_name');
165 165
 		FileHandler::makeDir('./files/member_extra_info/image_mark');
@@ -184,76 +184,76 @@  discard block
 block discarded – undo
184 184
 		$oModuleModel = getModel('module');
185 185
 		$oModuleController = getController('module');
186 186
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
187
-		if($oModuleModel->needUpdate($version_update_id))
187
+		if ($oModuleModel->needUpdate($version_update_id))
188 188
 		{
189 189
 			// check member directory (11/08/2007 added)
190
-			if(!is_dir("./files/member_extra_info")) return true;
190
+			if (!is_dir("./files/member_extra_info")) return true;
191 191
 			// check member directory (22/10/2007 added)
192
-			if(!is_dir("./files/member_extra_info/profile_image")) return true;
192
+			if (!is_dir("./files/member_extra_info/profile_image")) return true;
193 193
 			// Add a column(is_register) to "member_auth_mail" table (22/04/2008)
194 194
 			$act = $oDB->isColumnExists("member_auth_mail", "is_register");
195
-			if(!$act) return true;
195
+			if (!$act) return true;
196 196
 			// Add a column(site_srl) to "member_group_member" table (11/15/2008)
197
-			if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true;
198
-			if(!$oDB->isColumnExists("member_group", "site_srl")) return true;
199
-			if($oDB->isIndexExists("member_group","uni_member_group_title")) return true;
197
+			if (!$oDB->isColumnExists("member_group_member", "site_srl")) return true;
198
+			if (!$oDB->isColumnExists("member_group", "site_srl")) return true;
199
+			if ($oDB->isIndexExists("member_group", "uni_member_group_title")) return true;
200 200
 
201 201
 			// Add a column for list_order (05/18/2011)
202
-			if(!$oDB->isColumnExists("member_group", "list_order")) return true;
202
+			if (!$oDB->isColumnExists("member_group", "list_order")) return true;
203 203
 
204 204
 			// image_mark 추가 (2009. 02. 14)
205
-			if(!$oDB->isColumnExists("member_group", "image_mark")) return true;
205
+			if (!$oDB->isColumnExists("member_group", "image_mark")) return true;
206 206
 			// Add c column for password expiration date
207
-			if(!$oDB->isColumnExists("member", "change_password_date")) return true;
207
+			if (!$oDB->isColumnExists("member", "change_password_date")) return true;
208 208
 
209 209
 			// Add columns of question and answer to verify a password
210
-			if(!$oDB->isColumnExists("member", "find_account_question")) return true;
211
-			if(!$oDB->isColumnExists("member", "find_account_answer")) return true;
210
+			if (!$oDB->isColumnExists("member", "find_account_question")) return true;
211
+			if (!$oDB->isColumnExists("member", "find_account_answer")) return true;
212 212
 
213
-			if(!$oDB->isColumnExists("member", "list_order")) return true;
214
-			if(!$oDB->isIndexExists("member","idx_list_order")) return true;
213
+			if (!$oDB->isColumnExists("member", "list_order")) return true;
214
+			if (!$oDB->isIndexExists("member", "idx_list_order")) return true;
215 215
 
216 216
 			$oModuleModel = getModel('module');
217 217
 			$config = $oModuleModel->getModuleConfig('member');
218 218
 			// check signup form ordering info
219
-			if(!$config->signupForm) return true;
219
+			if (!$config->signupForm) return true;
220 220
 
221
-			foreach($config->signupForm as $form)
221
+			foreach ($config->signupForm as $form)
222 222
 			{
223
-				if($form->name === 'email_address' && $form->isPublic !== 'N')
223
+				if ($form->name === 'email_address' && $form->isPublic !== 'N')
224 224
 				{
225 225
 					return true;
226 226
 				}
227 227
 			}
228 228
 
229 229
 			// check agreement field exist
230
-			if($config->agreement) return true;
230
+			if ($config->agreement) return true;
231 231
 
232
-			if($config->skin)
232
+			if ($config->skin)
233 233
 			{
234 234
 				$config_parse = explode('.', $config->skin);
235
-				if(count($config_parse) > 1)
235
+				if (count($config_parse) > 1)
236 236
 				{
237 237
 					$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
238
-					if(is_dir($template_path)) return true;
238
+					if (is_dir($template_path)) return true;
239 239
 				}
240 240
 			}
241 241
 
242 242
 			// supprot multilanguage agreement.
243
-			if(is_readable('./files/member_extra_info/agreement.txt')) return true;
243
+			if (is_readable('./files/member_extra_info/agreement.txt')) return true;
244 244
 
245 245
 			// 2013. 11. 22 add menu when popup document menu called
246
-			if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) return true;
247
-			if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) return true;
246
+			if (!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) return true;
247
+			if (!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) return true;
248 248
 
249 249
 			$oModuleController->insertUpdatedLog($version_update_id);
250 250
 		}
251 251
 
252
-		if(!is_readable('./files/ruleset/insertMember.xml')) return true;
253
-		if(!is_readable('./files/ruleset/login.xml')) return true;
254
-		if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true;
252
+		if (!is_readable('./files/ruleset/insertMember.xml')) return true;
253
+		if (!is_readable('./files/ruleset/login.xml')) return true;
254
+		if (!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true;
255 255
 
256
-		if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) return true;
256
+		if ($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) return true;
257 257
 
258 258
 		return false;
259 259
 	}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		$oMemberAdminController = getAdminController('member');
272 272
 		$config = $oModuleModel->getModuleConfig('member');
273 273
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
274
-		if($oModuleModel->needUpdate($version_update_id))
274
+		if ($oModuleModel->needUpdate($version_update_id))
275 275
 		{
276 276
 			// Check member directory
277 277
 			FileHandler::makeDir('./files/member_extra_info/image_name');
@@ -279,74 +279,74 @@  discard block
 block discarded – undo
279 279
 			FileHandler::makeDir('./files/member_extra_info/signature');
280 280
 			FileHandler::makeDir('./files/member_extra_info/profile_image');
281 281
 			// Add a column
282
-			if(!$oDB->isColumnExists("member_auth_mail", "is_register"))
282
+			if (!$oDB->isColumnExists("member_auth_mail", "is_register"))
283 283
 			{
284 284
 				$oDB->addColumn("member_auth_mail", "is_register", "char", 1, "N", true);
285 285
 			}
286 286
 			// Add a column(site_srl) to "member_group_member" table (11/15/2008)
287
-			if(!$oDB->isColumnExists("member_group_member", "site_srl"))
287
+			if (!$oDB->isColumnExists("member_group_member", "site_srl"))
288 288
 			{
289 289
 				$oDB->addColumn("member_group_member", "site_srl", "number", 11, 0, true);
290 290
 				$oDB->addIndex("member_group_member", "idx_site_srl", "site_srl", false);
291 291
 			}
292
-			if(!$oDB->isColumnExists("member_group", "site_srl"))
292
+			if (!$oDB->isColumnExists("member_group", "site_srl"))
293 293
 			{
294 294
 				$oDB->addColumn("member_group", "site_srl", "number", 11, 0, true);
295
-				$oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true);
295
+				$oDB->addIndex("member_group", "idx_site_title", array("site_srl", "title"), true);
296 296
 			}
297
-			if($oDB->isIndexExists("member_group","uni_member_group_title"))
297
+			if ($oDB->isIndexExists("member_group", "uni_member_group_title"))
298 298
 			{
299
-				$oDB->dropIndex("member_group","uni_member_group_title",true);
299
+				$oDB->dropIndex("member_group", "uni_member_group_title", true);
300 300
 			}
301 301
 
302 302
 			// Add a column(list_order) to "member_group" table (05/18/2011)
303
-			if(!$oDB->isColumnExists("member_group", "list_order"))
303
+			if (!$oDB->isColumnExists("member_group", "list_order"))
304 304
 			{
305 305
 				$oDB->addColumn("member_group", "list_order", "number", 11, '', true);
306
-				$oDB->addIndex("member_group","idx_list_order", "list_order",false);
306
+				$oDB->addIndex("member_group", "idx_list_order", "list_order", false);
307 307
 				$output = executeQuery('member.updateAllMemberGroupListOrder');
308 308
 			}
309 309
 			// Add a column for image_mark (02/14/2009)
310
-			if(!$oDB->isColumnExists("member_group", "image_mark"))
310
+			if (!$oDB->isColumnExists("member_group", "image_mark"))
311 311
 			{
312 312
 				$oDB->addColumn("member_group", "image_mark", "text");
313 313
 			}
314 314
 			// Add a column for password expiration date
315
-			if(!$oDB->isColumnExists("member", "change_password_date"))
315
+			if (!$oDB->isColumnExists("member", "change_password_date"))
316 316
 			{
317 317
 				$oDB->addColumn("member", "change_password_date", "date");
318 318
 				executeQuery('member.updateAllChangePasswordDate');
319 319
 			}
320 320
 
321 321
 			// Add columns of question and answer to verify a password
322
-			if(!$oDB->isColumnExists("member", "find_account_question"))
322
+			if (!$oDB->isColumnExists("member", "find_account_question"))
323 323
 			{
324 324
 				$oDB->addColumn("member", "find_account_question", "number", 11);
325 325
 			}
326
-			if(!$oDB->isColumnExists("member", "find_account_answer"))
326
+			if (!$oDB->isColumnExists("member", "find_account_answer"))
327 327
 			{
328 328
 				$oDB->addColumn("member", "find_account_answer", "varchar", 250);
329 329
 			}
330 330
 
331
-			if(!$oDB->isColumnExists("member", "list_order"))
331
+			if (!$oDB->isColumnExists("member", "list_order"))
332 332
 			{
333 333
 				$oDB->addColumn("member", "list_order", "number", 11);
334 334
 				@set_time_limit(0);
335 335
 				$args->list_order = 'member_srl';
336
-				executeQuery('member.updateMemberListOrderAll',$args);
336
+				executeQuery('member.updateMemberListOrderAll', $args);
337 337
 				executeQuery('member.updateMemberListOrderAll');
338 338
 			}
339
-			if(!$oDB->isIndexExists("member","idx_list_order"))
339
+			if (!$oDB->isIndexExists("member", "idx_list_order"))
340 340
 			{
341
-				$oDB->addIndex("member","idx_list_order", array("list_order"));
341
+				$oDB->addIndex("member", "idx_list_order", array("list_order"));
342 342
 			}
343 343
 
344 344
 			$config = $oModuleModel->getModuleConfig('member');
345 345
 
346 346
 			// check agreement value exist
347
-			if($config->agreement)
347
+			if ($config->agreement)
348 348
 			{
349
-				$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
349
+				$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt';
350 350
 				$output = FileHandler::writeFile($agreement_file, $config->agreement);
351 351
 
352 352
 				$config->agreement = NULL;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			}
355 355
 
356 356
 			// check signup form ordering info
357
-			if(!$config->signupForm || !is_array($config->signupForm))
357
+			if (!$config->signupForm || !is_array($config->signupForm))
358 358
 			{
359 359
 				$identifier = 'email_address';
360 360
 
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
 
366 366
 			// 회원정보에서 이메일 노출 제거
367 367
 			// @see https://github.com/xpressengine/xe-core/issues/2177
368
-			foreach($config->signupForm as $form)
368
+			foreach ($config->signupForm as $form)
369 369
 			{
370
-				if($form->name === 'email_address')
370
+				if ($form->name === 'email_address')
371 371
 				{
372 372
 					$form->isPublic = 'N';
373 373
 					break;
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
 			}
376 376
 			$oModuleController->updateModuleConfig('member', $config);
377 377
 
378
-			if($config->skin)
378
+			if ($config->skin)
379 379
 			{
380 380
 				$config_parse = explode('.', $config->skin);
381 381
 				if (count($config_parse) > 1)
382 382
 				{
383 383
 					$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
384
-					if(is_dir($template_path))
384
+					if (is_dir($template_path))
385 385
 					{
386 386
 						$config->skin = implode('|@|', $config_parse);
387 387
 						$oModuleController = getController('module');
@@ -391,15 +391,15 @@  discard block
 block discarded – undo
391 391
 			}
392 392
 			
393 393
 			// 2013. 11. 22 add menu when popup document menu called
394
-			if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after'))
394
+			if (!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after'))
395 395
 				$oModuleController->insertTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after');
396
-			if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after'))
396
+			if (!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after'))
397 397
 				$oModuleController->insertTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after');
398 398
 
399
-			if(is_readable('./files/member_extra_info/agreement.txt'))
399
+			if (is_readable('./files/member_extra_info/agreement.txt'))
400 400
 			{
401 401
 				$source_file = _XE_PATH_.'files/member_extra_info/agreement.txt';
402
-				$target_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
402
+				$target_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt';
403 403
 
404 404
 				FileHandler::rename($source_file, $target_file);
405 405
 			}
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
 		}
409 409
 
410 410
 		FileHandler::makeDir('./files/ruleset');
411
-		if(!is_readable('./files/ruleset/insertMember.xml'))
411
+		if (!is_readable('./files/ruleset/insertMember.xml'))
412 412
 			$oMemberAdminController->_createSignupRuleset($config->signupForm);
413
-		if(!is_readable('./files/ruleset/login.xml'))
413
+		if (!is_readable('./files/ruleset/login.xml'))
414 414
 			$oMemberAdminController->_createLoginRuleset($config->identifier);
415
-		if(!is_readable('./files/ruleset/find_member_account_by_question.xml'))
415
+		if (!is_readable('./files/ruleset/find_member_account_by_question.xml'))
416 416
 			$oMemberAdminController->_createFindAccountByQuestion($config->identifier);
417 417
 
418
-		if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset'))
418
+		if ($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset'))
419 419
 		{
420 420
 			$oMemberAdminController->_createSignupRuleset($config->signupForm);
421 421
 			$oModuleController->insertUpdatedLog('member.1.8.43.recreate_signup_ruleset');
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	 */
439 439
 	function recordLoginError($error = 0, $message = 'success')
440 440
 	{
441
-		if($error == 0) return new BaseObject($error, $message);
441
+		if ($error == 0) return new BaseObject($error, $message);
442 442
 
443 443
 		// Create a member model object
444 444
 		$oMemberModel = getModel('member');
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 
447 447
 		// Check if there is recoding table.
448 448
 		$oDB = &DB::getInstance();
449
-		if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message);
449
+		if (!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message);
450 450
 
451 451
 		$args = new stdClass();
452 452
 		$args->ipaddress = $_SERVER['REMOTE_ADDR'];
453 453
 
454 454
 		$output = executeQuery('member.getLoginCountByIp', $args);
455
-		if($output->data && $output->data->count)
455
+		if ($output->data && $output->data->count)
456 456
 		{
457 457
 			$last_update = strtotime($output->data->last_update);
458
-			$term = intval($_SERVER['REQUEST_TIME']-$last_update);
458
+			$term = intval($_SERVER['REQUEST_TIME'] - $last_update);
459 459
 			//update, if IP address access in a short time, update count. If not, make count 1.
460
-			if($term < $config->max_error_count_time)
460
+			if ($term < $config->max_error_count_time)
461 461
 			{
462 462
 				$args->count = $output->data->count + 1;
463 463
 			}
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 */
484 484
 	function recordMemberLoginError($error = 0, $message = 'success', $args = NULL)
485 485
 	{
486
-		if($error == 0 || !$args->member_srl) return new BaseObject($error, $message);
486
+		if ($error == 0 || !$args->member_srl) return new BaseObject($error, $message);
487 487
 
488 488
 		// Create a member model object
489 489
 		$oMemberModel = getModel('member');
@@ -491,21 +491,21 @@  discard block
 block discarded – undo
491 491
 
492 492
 		// Check if there is recoding table.
493 493
 		$oDB = &DB::getInstance();
494
-		if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message);
494
+		if (!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message);
495 495
 
496 496
 		$output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args);
497
-		if($output->data && $output->data->content)
497
+		if ($output->data && $output->data->content)
498 498
 		{
499 499
 			//update
500 500
 			$content = unserialize($output->data->content);
501
-			$content[] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']);
501
+			$content[] = array($_SERVER['REMOTE_ADDR'], Context::getLang($message), $_SERVER['REQUEST_TIME']);
502 502
 			$args->content = serialize($content);
503 503
 			$output = executeQuery('member.updateLoginCountHistoryByMemberSrl', $args);
504 504
 		}
505 505
 		else
506 506
 		{
507 507
 			//insert
508
-			$content[0] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']);
508
+			$content[0] = array($_SERVER['REMOTE_ADDR'], Context::getLang($message), $_SERVER['REQUEST_TIME']);
509 509
 			$args->content = serialize($content);
510 510
 			$output = executeQuery('member.insertLoginCountHistoryByMemberSrl', $args);
511 511
 		}
Please login to merge, or discard this patch.
Braces   +138 added lines, -56 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	function member()
22 22
 	{
23
-		if(!Context::isInstalled()) return;
23
+		if(!Context::isInstalled()) {
24
+			return;
25
+		}
24 26
 
25 27
 		$oModuleModel = getModel('module');
26 28
 		$member_config = $oModuleModel->getModuleConfig('member');
@@ -58,18 +60,42 @@  discard block
 block discarded – undo
58 60
 		// Set the basic information
59 61
 		$config->enable_join = 'Y';
60 62
 		$config->enable_openid = 'N';
61
-		if(!$config->enable_auth_mail) $config->enable_auth_mail = 'N';
62
-		if(!$config->image_name) $config->image_name = 'Y';
63
-		if(!$config->image_mark) $config->image_mark = 'Y';
64
-		if(!$config->profile_image) $config->profile_image = 'Y';
65
-		if(!$config->image_name_max_width) $config->image_name_max_width = '90';
66
-		if(!$config->image_name_max_height) $config->image_name_max_height = '20';
67
-		if(!$config->image_mark_max_width) $config->image_mark_max_width = '20';
68
-		if(!$config->image_mark_max_height) $config->image_mark_max_height = '20';
69
-		if(!$config->profile_image_max_width) $config->profile_image_max_width = '90';
70
-		if(!$config->profile_image_max_height) $config->profile_image_max_height = '90';
71
-		if($config->group_image_mark!='Y') $config->group_image_mark = 'N';
72
-		if(!$config->password_strength) $config->password_strength = 'normal';
63
+		if(!$config->enable_auth_mail) {
64
+			$config->enable_auth_mail = 'N';
65
+		}
66
+		if(!$config->image_name) {
67
+			$config->image_name = 'Y';
68
+		}
69
+		if(!$config->image_mark) {
70
+			$config->image_mark = 'Y';
71
+		}
72
+		if(!$config->profile_image) {
73
+			$config->profile_image = 'Y';
74
+		}
75
+		if(!$config->image_name_max_width) {
76
+			$config->image_name_max_width = '90';
77
+		}
78
+		if(!$config->image_name_max_height) {
79
+			$config->image_name_max_height = '20';
80
+		}
81
+		if(!$config->image_mark_max_width) {
82
+			$config->image_mark_max_width = '20';
83
+		}
84
+		if(!$config->image_mark_max_height) {
85
+			$config->image_mark_max_height = '20';
86
+		}
87
+		if(!$config->profile_image_max_width) {
88
+			$config->profile_image_max_width = '90';
89
+		}
90
+		if(!$config->profile_image_max_height) {
91
+			$config->profile_image_max_height = '90';
92
+		}
93
+		if($config->group_image_mark!='Y') {
94
+			$config->group_image_mark = 'N';
95
+		}
96
+		if(!$config->password_strength) {
97
+			$config->password_strength = 'normal';
98
+		}
73 99
 		
74 100
 		if(!$config->password_hashing_algorithm)
75 101
 		{
@@ -187,36 +213,64 @@  discard block
 block discarded – undo
187 213
 		if($oModuleModel->needUpdate($version_update_id))
188 214
 		{
189 215
 			// check member directory (11/08/2007 added)
190
-			if(!is_dir("./files/member_extra_info")) return true;
216
+			if(!is_dir("./files/member_extra_info")) {
217
+				return true;
218
+			}
191 219
 			// check member directory (22/10/2007 added)
192
-			if(!is_dir("./files/member_extra_info/profile_image")) return true;
220
+			if(!is_dir("./files/member_extra_info/profile_image")) {
221
+				return true;
222
+			}
193 223
 			// Add a column(is_register) to "member_auth_mail" table (22/04/2008)
194 224
 			$act = $oDB->isColumnExists("member_auth_mail", "is_register");
195
-			if(!$act) return true;
225
+			if(!$act) {
226
+				return true;
227
+			}
196 228
 			// Add a column(site_srl) to "member_group_member" table (11/15/2008)
197
-			if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true;
198
-			if(!$oDB->isColumnExists("member_group", "site_srl")) return true;
199
-			if($oDB->isIndexExists("member_group","uni_member_group_title")) return true;
229
+			if(!$oDB->isColumnExists("member_group_member", "site_srl")) {
230
+				return true;
231
+			}
232
+			if(!$oDB->isColumnExists("member_group", "site_srl")) {
233
+				return true;
234
+			}
235
+			if($oDB->isIndexExists("member_group","uni_member_group_title")) {
236
+				return true;
237
+			}
200 238
 
201 239
 			// Add a column for list_order (05/18/2011)
202
-			if(!$oDB->isColumnExists("member_group", "list_order")) return true;
240
+			if(!$oDB->isColumnExists("member_group", "list_order")) {
241
+				return true;
242
+			}
203 243
 
204 244
 			// image_mark 추가 (2009. 02. 14)
205
-			if(!$oDB->isColumnExists("member_group", "image_mark")) return true;
245
+			if(!$oDB->isColumnExists("member_group", "image_mark")) {
246
+				return true;
247
+			}
206 248
 			// Add c column for password expiration date
207
-			if(!$oDB->isColumnExists("member", "change_password_date")) return true;
249
+			if(!$oDB->isColumnExists("member", "change_password_date")) {
250
+				return true;
251
+			}
208 252
 
209 253
 			// Add columns of question and answer to verify a password
210
-			if(!$oDB->isColumnExists("member", "find_account_question")) return true;
211
-			if(!$oDB->isColumnExists("member", "find_account_answer")) return true;
254
+			if(!$oDB->isColumnExists("member", "find_account_question")) {
255
+				return true;
256
+			}
257
+			if(!$oDB->isColumnExists("member", "find_account_answer")) {
258
+				return true;
259
+			}
212 260
 
213
-			if(!$oDB->isColumnExists("member", "list_order")) return true;
214
-			if(!$oDB->isIndexExists("member","idx_list_order")) return true;
261
+			if(!$oDB->isColumnExists("member", "list_order")) {
262
+				return true;
263
+			}
264
+			if(!$oDB->isIndexExists("member","idx_list_order")) {
265
+				return true;
266
+			}
215 267
 
216 268
 			$oModuleModel = getModel('module');
217 269
 			$config = $oModuleModel->getModuleConfig('member');
218 270
 			// check signup form ordering info
219
-			if(!$config->signupForm) return true;
271
+			if(!$config->signupForm) {
272
+				return true;
273
+			}
220 274
 
221 275
 			foreach($config->signupForm as $form)
222 276
 			{
@@ -227,7 +281,9 @@  discard block
 block discarded – undo
227 281
 			}
228 282
 
229 283
 			// check agreement field exist
230
-			if($config->agreement) return true;
284
+			if($config->agreement) {
285
+				return true;
286
+			}
231 287
 
232 288
 			if($config->skin)
233 289
 			{
@@ -235,25 +291,41 @@  discard block
 block discarded – undo
235 291
 				if(count($config_parse) > 1)
236 292
 				{
237 293
 					$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
238
-					if(is_dir($template_path)) return true;
294
+					if(is_dir($template_path)) {
295
+						return true;
296
+					}
239 297
 				}
240 298
 			}
241 299
 
242 300
 			// supprot multilanguage agreement.
243
-			if(is_readable('./files/member_extra_info/agreement.txt')) return true;
301
+			if(is_readable('./files/member_extra_info/agreement.txt')) {
302
+				return true;
303
+			}
244 304
 
245 305
 			// 2013. 11. 22 add menu when popup document menu called
246
-			if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) return true;
247
-			if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) return true;
306
+			if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) {
307
+				return true;
308
+			}
309
+			if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) {
310
+				return true;
311
+			}
248 312
 
249 313
 			$oModuleController->insertUpdatedLog($version_update_id);
250 314
 		}
251 315
 
252
-		if(!is_readable('./files/ruleset/insertMember.xml')) return true;
253
-		if(!is_readable('./files/ruleset/login.xml')) return true;
254
-		if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true;
316
+		if(!is_readable('./files/ruleset/insertMember.xml')) {
317
+			return true;
318
+		}
319
+		if(!is_readable('./files/ruleset/login.xml')) {
320
+			return true;
321
+		}
322
+		if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) {
323
+			return true;
324
+		}
255 325
 
256
-		if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) return true;
326
+		if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) {
327
+			return true;
328
+		}
257 329
 
258 330
 		return false;
259 331
 	}
@@ -391,10 +463,12 @@  discard block
 block discarded – undo
391 463
 			}
392 464
 			
393 465
 			// 2013. 11. 22 add menu when popup document menu called
394
-			if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after'))
395
-				$oModuleController->insertTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after');
396
-			if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after'))
397
-				$oModuleController->insertTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after');
466
+			if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) {
467
+							$oModuleController->insertTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after');
468
+			}
469
+			if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) {
470
+							$oModuleController->insertTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after');
471
+			}
398 472
 
399 473
 			if(is_readable('./files/member_extra_info/agreement.txt'))
400 474
 			{
@@ -408,12 +482,15 @@  discard block
 block discarded – undo
408 482
 		}
409 483
 
410 484
 		FileHandler::makeDir('./files/ruleset');
411
-		if(!is_readable('./files/ruleset/insertMember.xml'))
412
-			$oMemberAdminController->_createSignupRuleset($config->signupForm);
413
-		if(!is_readable('./files/ruleset/login.xml'))
414
-			$oMemberAdminController->_createLoginRuleset($config->identifier);
415
-		if(!is_readable('./files/ruleset/find_member_account_by_question.xml'))
416
-			$oMemberAdminController->_createFindAccountByQuestion($config->identifier);
485
+		if(!is_readable('./files/ruleset/insertMember.xml')) {
486
+					$oMemberAdminController->_createSignupRuleset($config->signupForm);
487
+		}
488
+		if(!is_readable('./files/ruleset/login.xml')) {
489
+					$oMemberAdminController->_createLoginRuleset($config->identifier);
490
+		}
491
+		if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) {
492
+					$oMemberAdminController->_createFindAccountByQuestion($config->identifier);
493
+		}
417 494
 
418 495
 		if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset'))
419 496
 		{
@@ -438,7 +515,9 @@  discard block
 block discarded – undo
438 515
 	 */
439 516
 	function recordLoginError($error = 0, $message = 'success')
440 517
 	{
441
-		if($error == 0) return new BaseObject($error, $message);
518
+		if($error == 0) {
519
+			return new BaseObject($error, $message);
520
+		}
442 521
 
443 522
 		// Create a member model object
444 523
 		$oMemberModel = getModel('member');
@@ -446,7 +525,9 @@  discard block
 block discarded – undo
446 525
 
447 526
 		// Check if there is recoding table.
448 527
 		$oDB = &DB::getInstance();
449
-		if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message);
528
+		if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') {
529
+			return new BaseObject($error, $message);
530
+		}
450 531
 
451 532
 		$args = new stdClass();
452 533
 		$args->ipaddress = $_SERVER['REMOTE_ADDR'];
@@ -460,16 +541,14 @@  discard block
 block discarded – undo
460 541
 			if($term < $config->max_error_count_time)
461 542
 			{
462 543
 				$args->count = $output->data->count + 1;
463
-			}
464
-			else
544
+			} else
465 545
 			{
466 546
 				$args->count = 1;
467 547
 			}
468 548
 			unset($oMemberModel);
469 549
 			unset($config);
470 550
 			$output = executeQuery('member.updateLoginCountByIp', $args);
471
-		}
472
-		else
551
+		} else
473 552
 		{
474 553
 			//insert
475 554
 			$args->count = 1;
@@ -483,7 +562,9 @@  discard block
 block discarded – undo
483 562
 	 */
484 563
 	function recordMemberLoginError($error = 0, $message = 'success', $args = NULL)
485 564
 	{
486
-		if($error == 0 || !$args->member_srl) return new BaseObject($error, $message);
565
+		if($error == 0 || !$args->member_srl) {
566
+			return new BaseObject($error, $message);
567
+		}
487 568
 
488 569
 		// Create a member model object
489 570
 		$oMemberModel = getModel('member');
@@ -491,7 +572,9 @@  discard block
 block discarded – undo
491 572
 
492 573
 		// Check if there is recoding table.
493 574
 		$oDB = &DB::getInstance();
494
-		if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message);
575
+		if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') {
576
+			return new BaseObject($error, $message);
577
+		}
495 578
 
496 579
 		$output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args);
497 580
 		if($output->data && $output->data->content)
@@ -501,8 +584,7 @@  discard block
 block discarded – undo
501 584
 			$content[] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']);
502 585
 			$args->content = serialize($content);
503 586
 			$output = executeQuery('member.updateLoginCountHistoryByMemberSrl', $args);
504
-		}
505
-		else
587
+		} else
506 588
 		{
507 589
 			//insert
508 590
 			$content[0] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']);
Please login to merge, or discard this patch.
modules/spamfilter/spamfilter.controller.php 2 patches
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -27,39 +27,39 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	function triggerInsertDocument(&$obj)
29 29
 	{
30
-		if($_SESSION['avoid_log']) return new BaseObject();
30
+		if ($_SESSION['avoid_log']) return new BaseObject();
31 31
 		// Check the login status, login information, and permission
32 32
 		$is_logged = Context::get('is_logged');
33 33
 		$logged_info = Context::get('logged_info');
34 34
 		$grant = Context::get('grant');
35 35
 		// In case logged in, check if it is an administrator
36
-		if($is_logged)
36
+		if ($is_logged)
37 37
 		{
38
-			if($logged_info->is_admin == 'Y') return new BaseObject();
39
-			if($grant->manager) return new BaseObject();
38
+			if ($logged_info->is_admin == 'Y') return new BaseObject();
39
+			if ($grant->manager) return new BaseObject();
40 40
 		}
41 41
 
42 42
 		$oFilterModel = getModel('spamfilter');
43 43
 		// Check if the IP is prohibited
44 44
 		$output = $oFilterModel->isDeniedIP();
45
-		if(!$output->toBool()) return $output;
45
+		if (!$output->toBool()) return $output;
46 46
 		// Check if there is a ban on the word
47 47
 		$text = '';
48
-		if($is_logged)
48
+		if ($is_logged)
49 49
 		{
50
-			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags;
50
+			$text = $obj->title.' '.$obj->content.' '.$obj->tags;
51 51
 		}
52 52
 		else
53 53
 		{
54
-			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags;	
54
+			$text = $obj->title.' '.$obj->content.' '.$obj->nick_name.' '.$obj->homepage.' '.$obj->tags;	
55 55
 		}
56 56
 		$output = $oFilterModel->isDeniedWord($text);
57
-		if(!$output->toBool()) return $output;
57
+		if (!$output->toBool()) return $output;
58 58
 		// Check the specified time beside the modificaiton time
59
-		if($obj->document_srl == 0)
59
+		if ($obj->document_srl == 0)
60 60
 		{
61 61
 			$output = $oFilterModel->checkLimited();
62
-			if(!$output->toBool()) return $output;
62
+			if (!$output->toBool()) return $output;
63 63
 		}
64 64
 		// Save a log
65 65
 		$this->insertLog();
@@ -72,39 +72,39 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	function triggerInsertComment(&$obj)
74 74
 	{
75
-		if($_SESSION['avoid_log']) return new BaseObject();
75
+		if ($_SESSION['avoid_log']) return new BaseObject();
76 76
 		// Check the login status, login information, and permission
77 77
 		$is_logged = Context::get('is_logged');
78 78
 		$logged_info = Context::get('logged_info');
79 79
 		$grant = Context::get('grant');
80 80
 		// In case logged in, check if it is an administrator
81
-		if($is_logged)
81
+		if ($is_logged)
82 82
 		{
83
-			if($logged_info->is_admin == 'Y') return new BaseObject();
84
-			if($grant->manager) return new BaseObject();
83
+			if ($logged_info->is_admin == 'Y') return new BaseObject();
84
+			if ($grant->manager) return new BaseObject();
85 85
 		}
86 86
 
87 87
 		$oFilterModel = getModel('spamfilter');
88 88
 		// Check if the IP is prohibited
89 89
 		$output = $oFilterModel->isDeniedIP();
90
-		if(!$output->toBool()) return $output;
90
+		if (!$output->toBool()) return $output;
91 91
 		// Check if there is a ban on the word
92 92
 		$text = '';
93
-		if($is_logged)
93
+		if ($is_logged)
94 94
 		{
95 95
 			$text = $obj->content;
96 96
 		}
97 97
 		else
98 98
 		{
99
-			$text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage;	
99
+			$text = $obj->content.' '.$obj->nick_name.' '.$obj->homepage;	
100 100
 		}
101 101
 		$output = $oFilterModel->isDeniedWord($text);
102
-		if(!$output->toBool()) return $output;
102
+		if (!$output->toBool()) return $output;
103 103
 		// If the specified time check is not modified
104
-		if(!$obj->__isupdate)
104
+		if (!$obj->__isupdate)
105 105
 		{
106 106
 			$output = $oFilterModel->checkLimited();
107
-			if(!$output->toBool()) return $output;
107
+			if (!$output->toBool()) return $output;
108 108
 		}
109 109
 		unset($obj->__isupdate);
110 110
 		// Save a log
@@ -118,32 +118,32 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	function triggerInsertTrackback(&$obj)
120 120
 	{
121
-		if($_SESSION['avoid_log']) return new BaseObject();
121
+		if ($_SESSION['avoid_log']) return new BaseObject();
122 122
 
123 123
 		$oFilterModel = getModel('spamfilter');
124 124
 		// Confirm if the trackbacks have been added more than once to your document
125 125
 		$output = $oFilterModel->isInsertedTrackback($obj->document_srl);
126
-		if(!$output->toBool()) return $output;
126
+		if (!$output->toBool()) return $output;
127 127
 
128 128
 		// Check if the IP is prohibited
129 129
 		$output = $oFilterModel->isDeniedIP();
130
-		if(!$output->toBool()) return $output;
130
+		if (!$output->toBool()) return $output;
131 131
 		// Check if there is a ban on the word
132
-		$text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url;
132
+		$text = $obj->blog_name.' '.$obj->title.' '.$obj->excerpt.' '.$obj->url;
133 133
 		$output = $oFilterModel->isDeniedWord($text);
134
-		if(!$output->toBool()) return $output;
134
+		if (!$output->toBool()) return $output;
135 135
 		// Start Filtering
136 136
 		$oTrackbackModel = getModel('trackback');
137 137
 		$oTrackbackController = getController('trackback');
138 138
 
139
-		list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']);
139
+		list($ipA, $ipB, $ipC, $ipD) = explode('.', $_SERVER['REMOTE_ADDR']);
140 140
 		$ipaddress = $ipA.'.'.$ipB.'.'.$ipC;
141 141
 		// In case the title and the blog name are indentical, investigate the IP address of the last 6 hours, delete and ban it.
142
-		if($obj->title == $obj->excerpt)
142
+		if ($obj->title == $obj->excerpt)
143 143
 		{
144
-			$oTrackbackController->deleteTrackbackSender(60*60*6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
144
+			$oTrackbackController->deleteTrackbackSender(60 * 60 * 6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt);
145 145
 			$this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback');
146
-			return new BaseObject(-1,'msg_alert_trackback_denied');
146
+			return new BaseObject(-1, 'msg_alert_trackback_denied');
147 147
 		}
148 148
 		// If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts
149 149
 		/* 호스팅 환경을 감안하여 일단 이 부분은 동작하지 않도록 주석 처리
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 	function insertIP($ipaddress_list, $description = null)
166 166
 	{
167 167
 		$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
168
-		if(!preg_match($regExr,$ipaddress_list)) return new BaseObject(-1, 'msg_invalid');
169
-		$ipaddress_list = str_replace("\r","",$ipaddress_list);
170
-		$ipaddress_list = explode("\n",$ipaddress_list);
171
-		foreach($ipaddress_list as $ipaddressValue)
168
+		if (!preg_match($regExr, $ipaddress_list)) return new BaseObject(-1, 'msg_invalid');
169
+		$ipaddress_list = str_replace("\r", "", $ipaddress_list);
170
+		$ipaddress_list = explode("\n", $ipaddress_list);
171
+		foreach ($ipaddress_list as $ipaddressValue)
172 172
 		{
173 173
 			$args = new stdClass();
174
-			preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches);
175
-			if($ipaddress=trim($matches[1]))
174
+			preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/", $ipaddressValue, $matches);
175
+			if ($ipaddress = trim($matches[1]))
176 176
 			{
177 177
 				$args->ipaddress = $ipaddress;
178
-				if(!$description && $matches[4]) $args->description = $matches[4];
178
+				if (!$description && $matches[4]) $args->description = $matches[4];
179 179
 				else $args->description = $description;
180 180
 			}
181 181
 			$output = executeQuery('spamfilter.insertDeniedIP', $args);
182
-			if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
182
+			if (!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
183 183
 		}
184 184
 
185
-		$output->add('fail_list',$fail_list);
185
+		$output->add('fail_list', $fail_list);
186 186
 		return $output;
187 187
 	}
188 188
 
@@ -191,22 +191,22 @@  discard block
 block discarded – undo
191 191
 	 */
192 192
 	function triggerSendMessage(&$obj)
193 193
 	{
194
-		if($_SESSION['avoid_log']) return new BaseObject();
194
+		if ($_SESSION['avoid_log']) return new BaseObject();
195 195
 
196 196
 		$logged_info = Context::get('logged_info');
197
-		if($logged_info->is_admin == 'Y') return new BaseObject();
197
+		if ($logged_info->is_admin == 'Y') return new BaseObject();
198 198
 
199 199
 		$oFilterModel = getModel('spamfilter');
200 200
 		// Check if the IP is prohibited
201 201
 		$output = $oFilterModel->isDeniedIP();
202
-		if(!$output->toBool()) return $output;
202
+		if (!$output->toBool()) return $output;
203 203
 		// Check if there is a ban on the word
204
-		$text = $obj->title . ' ' . $obj->content;
204
+		$text = $obj->title.' '.$obj->content;
205 205
 		$output = $oFilterModel->isDeniedWord($text);
206
-		if(!$output->toBool()) return $output;
206
+		if (!$output->toBool()) return $output;
207 207
 		// Check the specified time
208 208
 		$output = $oFilterModel->checkLimited(TRUE);
209
-		if(!$output->toBool()) return $output;
209
+		if (!$output->toBool()) return $output;
210 210
 		// Save a log
211 211
 		$this->insertLog();
212 212
 
Please login to merge, or discard this patch.
Braces   +76 added lines, -29 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	function triggerInsertDocument(&$obj)
29 29
 	{
30
-		if($_SESSION['avoid_log']) return new BaseObject();
30
+		if($_SESSION['avoid_log']) {
31
+			return new BaseObject();
32
+		}
31 33
 		// Check the login status, login information, and permission
32 34
 		$is_logged = Context::get('is_logged');
33 35
 		$logged_info = Context::get('logged_info');
@@ -35,31 +37,40 @@  discard block
 block discarded – undo
35 37
 		// In case logged in, check if it is an administrator
36 38
 		if($is_logged)
37 39
 		{
38
-			if($logged_info->is_admin == 'Y') return new BaseObject();
39
-			if($grant->manager) return new BaseObject();
40
+			if($logged_info->is_admin == 'Y') {
41
+				return new BaseObject();
42
+			}
43
+			if($grant->manager) {
44
+				return new BaseObject();
45
+			}
40 46
 		}
41 47
 
42 48
 		$oFilterModel = getModel('spamfilter');
43 49
 		// Check if the IP is prohibited
44 50
 		$output = $oFilterModel->isDeniedIP();
45
-		if(!$output->toBool()) return $output;
51
+		if(!$output->toBool()) {
52
+			return $output;
53
+		}
46 54
 		// Check if there is a ban on the word
47 55
 		$text = '';
48 56
 		if($is_logged)
49 57
 		{
50 58
 			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags;
51
-		}
52
-		else
59
+		} else
53 60
 		{
54 61
 			$text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags;	
55 62
 		}
56 63
 		$output = $oFilterModel->isDeniedWord($text);
57
-		if(!$output->toBool()) return $output;
64
+		if(!$output->toBool()) {
65
+			return $output;
66
+		}
58 67
 		// Check the specified time beside the modificaiton time
59 68
 		if($obj->document_srl == 0)
60 69
 		{
61 70
 			$output = $oFilterModel->checkLimited();
62
-			if(!$output->toBool()) return $output;
71
+			if(!$output->toBool()) {
72
+				return $output;
73
+			}
63 74
 		}
64 75
 		// Save a log
65 76
 		$this->insertLog();
@@ -72,7 +83,9 @@  discard block
 block discarded – undo
72 83
 	 */
73 84
 	function triggerInsertComment(&$obj)
74 85
 	{
75
-		if($_SESSION['avoid_log']) return new BaseObject();
86
+		if($_SESSION['avoid_log']) {
87
+			return new BaseObject();
88
+		}
76 89
 		// Check the login status, login information, and permission
77 90
 		$is_logged = Context::get('is_logged');
78 91
 		$logged_info = Context::get('logged_info');
@@ -80,31 +93,40 @@  discard block
 block discarded – undo
80 93
 		// In case logged in, check if it is an administrator
81 94
 		if($is_logged)
82 95
 		{
83
-			if($logged_info->is_admin == 'Y') return new BaseObject();
84
-			if($grant->manager) return new BaseObject();
96
+			if($logged_info->is_admin == 'Y') {
97
+				return new BaseObject();
98
+			}
99
+			if($grant->manager) {
100
+				return new BaseObject();
101
+			}
85 102
 		}
86 103
 
87 104
 		$oFilterModel = getModel('spamfilter');
88 105
 		// Check if the IP is prohibited
89 106
 		$output = $oFilterModel->isDeniedIP();
90
-		if(!$output->toBool()) return $output;
107
+		if(!$output->toBool()) {
108
+			return $output;
109
+		}
91 110
 		// Check if there is a ban on the word
92 111
 		$text = '';
93 112
 		if($is_logged)
94 113
 		{
95 114
 			$text = $obj->content;
96
-		}
97
-		else
115
+		} else
98 116
 		{
99 117
 			$text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage;	
100 118
 		}
101 119
 		$output = $oFilterModel->isDeniedWord($text);
102
-		if(!$output->toBool()) return $output;
120
+		if(!$output->toBool()) {
121
+			return $output;
122
+		}
103 123
 		// If the specified time check is not modified
104 124
 		if(!$obj->__isupdate)
105 125
 		{
106 126
 			$output = $oFilterModel->checkLimited();
107
-			if(!$output->toBool()) return $output;
127
+			if(!$output->toBool()) {
128
+				return $output;
129
+			}
108 130
 		}
109 131
 		unset($obj->__isupdate);
110 132
 		// Save a log
@@ -118,20 +140,28 @@  discard block
 block discarded – undo
118 140
 	 */
119 141
 	function triggerInsertTrackback(&$obj)
120 142
 	{
121
-		if($_SESSION['avoid_log']) return new BaseObject();
143
+		if($_SESSION['avoid_log']) {
144
+			return new BaseObject();
145
+		}
122 146
 
123 147
 		$oFilterModel = getModel('spamfilter');
124 148
 		// Confirm if the trackbacks have been added more than once to your document
125 149
 		$output = $oFilterModel->isInsertedTrackback($obj->document_srl);
126
-		if(!$output->toBool()) return $output;
150
+		if(!$output->toBool()) {
151
+			return $output;
152
+		}
127 153
 
128 154
 		// Check if the IP is prohibited
129 155
 		$output = $oFilterModel->isDeniedIP();
130
-		if(!$output->toBool()) return $output;
156
+		if(!$output->toBool()) {
157
+			return $output;
158
+		}
131 159
 		// Check if there is a ban on the word
132 160
 		$text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url;
133 161
 		$output = $oFilterModel->isDeniedWord($text);
134
-		if(!$output->toBool()) return $output;
162
+		if(!$output->toBool()) {
163
+			return $output;
164
+		}
135 165
 		// Start Filtering
136 166
 		$oTrackbackModel = getModel('trackback');
137 167
 		$oTrackbackController = getController('trackback');
@@ -165,7 +195,9 @@  discard block
 block discarded – undo
165 195
 	function insertIP($ipaddress_list, $description = null)
166 196
 	{
167 197
 		$regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/";
168
-		if(!preg_match($regExr,$ipaddress_list)) return new BaseObject(-1, 'msg_invalid');
198
+		if(!preg_match($regExr,$ipaddress_list)) {
199
+			return new BaseObject(-1, 'msg_invalid');
200
+		}
169 201
 		$ipaddress_list = str_replace("\r","",$ipaddress_list);
170 202
 		$ipaddress_list = explode("\n",$ipaddress_list);
171 203
 		foreach($ipaddress_list as $ipaddressValue)
@@ -175,11 +207,16 @@  discard block
 block discarded – undo
175 207
 			if($ipaddress=trim($matches[1]))
176 208
 			{
177 209
 				$args->ipaddress = $ipaddress;
178
-				if(!$description && $matches[4]) $args->description = $matches[4];
179
-				else $args->description = $description;
210
+				if(!$description && $matches[4]) {
211
+					$args->description = $matches[4];
212
+				} else {
213
+					$args->description = $description;
214
+				}
180 215
 			}
181 216
 			$output = executeQuery('spamfilter.insertDeniedIP', $args);
182
-			if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>';
217
+			if(!$output->toBool()) {
218
+				$fail_list .= $ipaddress.'<br/>';
219
+			}
183 220
 		}
184 221
 
185 222
 		$output->add('fail_list',$fail_list);
@@ -191,22 +228,32 @@  discard block
 block discarded – undo
191 228
 	 */
192 229
 	function triggerSendMessage(&$obj)
193 230
 	{
194
-		if($_SESSION['avoid_log']) return new BaseObject();
231
+		if($_SESSION['avoid_log']) {
232
+			return new BaseObject();
233
+		}
195 234
 
196 235
 		$logged_info = Context::get('logged_info');
197
-		if($logged_info->is_admin == 'Y') return new BaseObject();
236
+		if($logged_info->is_admin == 'Y') {
237
+			return new BaseObject();
238
+		}
198 239
 
199 240
 		$oFilterModel = getModel('spamfilter');
200 241
 		// Check if the IP is prohibited
201 242
 		$output = $oFilterModel->isDeniedIP();
202
-		if(!$output->toBool()) return $output;
243
+		if(!$output->toBool()) {
244
+			return $output;
245
+		}
203 246
 		// Check if there is a ban on the word
204 247
 		$text = $obj->title . ' ' . $obj->content;
205 248
 		$output = $oFilterModel->isDeniedWord($text);
206
-		if(!$output->toBool()) return $output;
249
+		if(!$output->toBool()) {
250
+			return $output;
251
+		}
207 252
 		// Check the specified time
208 253
 		$output = $oFilterModel->checkLimited(TRUE);
209
-		if(!$output->toBool()) return $output;
254
+		if(!$output->toBool()) {
255
+			return $output;
256
+		}
210 257
 		// Save a log
211 258
 		$this->insertLog();
212 259
 
Please login to merge, or discard this patch.
modules/spamfilter/spamfilter.model.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$args = new stdClass();
33 33
 		$args->sort_index = "regdate";
34
-		$args->page = Context::get('page')?Context::get('page'):1;
34
+		$args->page = Context::get('page') ?Context::get('page') : 1;
35 35
 		$output = executeQuery('spamfilter.getDeniedIPList', $args);
36
-		if(!$output->data) return;
37
-		if(!is_array($output->data)) return array($output->data);
36
+		if (!$output->data) return;
37
+		if (!is_array($output->data)) return array($output->data);
38 38
 		return $output->data;
39 39
 	}
40 40
 
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 		$ipaddress = $_SERVER['REMOTE_ADDR'];
47 47
 
48 48
 		$ip_list = $this->getDeniedIPList();
49
-		if(!count($ip_list)) return new BaseObject();
49
+		if (!count($ip_list)) return new BaseObject();
50 50
 
51 51
 		$count = count($ip_list);
52
-		for($i=0;$i<$count;$i++)
52
+		for ($i = 0; $i < $count; $i++)
53 53
 		{
54
-			$ip = str_replace('.', '\.', str_replace('*','(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',$ip_list[$i]->ipaddress));
55
-			if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new BaseObject(-1,'msg_alert_registered_denied_ip');
54
+			$ip = str_replace('.', '\.', str_replace('*', '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)', $ip_list[$i]->ipaddress));
55
+			if (preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new BaseObject(-1, 'msg_alert_registered_denied_ip');
56 56
 		}
57 57
 
58 58
 		return new BaseObject();
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 		$args = new stdClass();
67 67
 		$args->sort_index = "hit";
68 68
 		$output = executeQuery('spamfilter.getDeniedWordList', $args);
69
-		if(!$output->data) return;
70
-		if(!is_array($output->data)) return array($output->data);
69
+		if (!$output->data) return;
70
+		if (!is_array($output->data)) return array($output->data);
71 71
 		return $output->data;
72 72
 	}
73 73
 
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 	function isDeniedWord($text)
78 78
 	{
79 79
 		$word_list = $this->getDeniedWordList();
80
-		if(!count($word_list)) return new BaseObject();
80
+		if (!count($word_list)) return new BaseObject();
81 81
 
82 82
 		$count = count($word_list);
83
-		for($i=0;$i<$count;$i++)
83
+		for ($i = 0; $i < $count; $i++)
84 84
 		{
85 85
 			$word = $word_list[$i]->word;
86
-			if(preg_match('/'.preg_quote($word,'/').'/is', $text))
86
+			if (preg_match('/'.preg_quote($word, '/').'/is', $text))
87 87
 			{
88 88
 				$args->word = $word;
89 89
 				$output = executeQuery('spamfilter.updateDeniedWordHit', $args);
90
-				return new BaseObject(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word));
90
+				return new BaseObject(-1, sprintf(Context::getLang('msg_alert_denied_word'), $word));
91 91
 			}
92 92
 		}
93 93
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	{
102 102
 		$config = $this->getConfig();
103 103
 
104
-		if($config->limits != 'Y') return new BaseObject(); 
104
+		if ($config->limits != 'Y') return new BaseObject(); 
105 105
 		$limit_count = '3';
106 106
 		$interval = '10';
107 107
 
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 
110 110
 		$ipaddress = $_SERVER['REMOTE_ADDR'];
111 111
 		// Ban the IP address if the interval is exceeded
112
-		if($count>=$limit_count)
112
+		if ($count >= $limit_count)
113 113
 		{
114 114
 			$oSpamFilterController = getController('spamfilter');
115 115
 			$oSpamFilterController->insertIP($ipaddress, 'AUTO-DENIED : Over limit');
116 116
 			return new BaseObject(-1, 'msg_alert_registered_denied_ip');
117 117
 		}
118 118
 		// If the number of limited posts is not reached, keep creating.
119
-		if($count)
119
+		if ($count)
120 120
 		{
121
-			if($isMessage)
121
+			if ($isMessage)
122 122
 			{
123 123
 				$message = sprintf(Context::getLang('msg_alert_limited_message_by_config'), $interval);
124 124
 			}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	{
143 143
 		$oTrackbackModel = getModel('trackback');
144 144
 		$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $_SERVER['REMOTE_ADDR']);
145
-		if($count>0) return new BaseObject(-1, 'msg_alert_trackback_denied');
145
+		if ($count > 0) return new BaseObject(-1, 'msg_alert_trackback_denied');
146 146
 
147 147
 		return new BaseObject();
148 148
 	}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 	/**
151 151
 	 * @brief Return the number of logs recorded within the interval for the specified IPaddress
152 152
 	 */
153
-	function getLogCount($time = 60, $ipaddress='')
153
+	function getLogCount($time = 60, $ipaddress = '')
154 154
 	{
155
-		if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
155
+		if (!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
156 156
 
157 157
 		$args->ipaddress = $ipaddress;
158
-		$args->regdate = date("YmdHis", $_SERVER['REQUEST_TIME']-$time);
158
+		$args->regdate = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time);
159 159
 		$output = executeQuery('spamfilter.getLogCount', $args);
160 160
 		$count = $output->data->count;
161 161
 		return $count;
Please login to merge, or discard this patch.
Braces   +31 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,8 +33,12 @@  discard block
 block discarded – undo
33 33
 		$args->sort_index = "regdate";
34 34
 		$args->page = Context::get('page')?Context::get('page'):1;
35 35
 		$output = executeQuery('spamfilter.getDeniedIPList', $args);
36
-		if(!$output->data) return;
37
-		if(!is_array($output->data)) return array($output->data);
36
+		if(!$output->data) {
37
+			return;
38
+		}
39
+		if(!is_array($output->data)) {
40
+			return array($output->data);
41
+		}
38 42
 		return $output->data;
39 43
 	}
40 44
 
@@ -46,13 +50,17 @@  discard block
 block discarded – undo
46 50
 		$ipaddress = $_SERVER['REMOTE_ADDR'];
47 51
 
48 52
 		$ip_list = $this->getDeniedIPList();
49
-		if(!count($ip_list)) return new BaseObject();
53
+		if(!count($ip_list)) {
54
+			return new BaseObject();
55
+		}
50 56
 
51 57
 		$count = count($ip_list);
52 58
 		for($i=0;$i<$count;$i++)
53 59
 		{
54 60
 			$ip = str_replace('.', '\.', str_replace('*','(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)',$ip_list[$i]->ipaddress));
55
-			if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) return new BaseObject(-1,'msg_alert_registered_denied_ip');
61
+			if(preg_match('/^'.$ip.'$/', $ipaddress, $matches)) {
62
+				return new BaseObject(-1,'msg_alert_registered_denied_ip');
63
+			}
56 64
 		}
57 65
 
58 66
 		return new BaseObject();
@@ -66,8 +74,12 @@  discard block
 block discarded – undo
66 74
 		$args = new stdClass();
67 75
 		$args->sort_index = "hit";
68 76
 		$output = executeQuery('spamfilter.getDeniedWordList', $args);
69
-		if(!$output->data) return;
70
-		if(!is_array($output->data)) return array($output->data);
77
+		if(!$output->data) {
78
+			return;
79
+		}
80
+		if(!is_array($output->data)) {
81
+			return array($output->data);
82
+		}
71 83
 		return $output->data;
72 84
 	}
73 85
 
@@ -77,7 +89,9 @@  discard block
 block discarded – undo
77 89
 	function isDeniedWord($text)
78 90
 	{
79 91
 		$word_list = $this->getDeniedWordList();
80
-		if(!count($word_list)) return new BaseObject();
92
+		if(!count($word_list)) {
93
+			return new BaseObject();
94
+		}
81 95
 
82 96
 		$count = count($word_list);
83 97
 		for($i=0;$i<$count;$i++)
@@ -101,7 +115,9 @@  discard block
 block discarded – undo
101 115
 	{
102 116
 		$config = $this->getConfig();
103 117
 
104
-		if($config->limits != 'Y') return new BaseObject(); 
118
+		if($config->limits != 'Y') {
119
+			return new BaseObject();
120
+		}
105 121
 		$limit_count = '3';
106 122
 		$interval = '10';
107 123
 
@@ -121,8 +137,7 @@  discard block
 block discarded – undo
121 137
 			if($isMessage)
122 138
 			{
123 139
 				$message = sprintf(Context::getLang('msg_alert_limited_message_by_config'), $interval);
124
-			}
125
-			else
140
+			} else
126 141
 			{
127 142
 				$message = sprintf(Context::getLang('msg_alert_limited_by_config'), $interval);
128 143
 			}
@@ -142,7 +157,9 @@  discard block
 block discarded – undo
142 157
 	{
143 158
 		$oTrackbackModel = getModel('trackback');
144 159
 		$count = $oTrackbackModel->getTrackbackCountByIPAddress($document_srl, $_SERVER['REMOTE_ADDR']);
145
-		if($count>0) return new BaseObject(-1, 'msg_alert_trackback_denied');
160
+		if($count>0) {
161
+			return new BaseObject(-1, 'msg_alert_trackback_denied');
162
+		}
146 163
 
147 164
 		return new BaseObject();
148 165
 	}
@@ -152,7 +169,9 @@  discard block
 block discarded – undo
152 169
 	 */
153 170
 	function getLogCount($time = 60, $ipaddress='')
154 171
 	{
155
-		if(!$ipaddress) $ipaddress = $_SERVER['REMOTE_ADDR'];
172
+		if(!$ipaddress) {
173
+			$ipaddress = $_SERVER['REMOTE_ADDR'];
174
+		}
156 175
 
157 176
 		$args->ipaddress = $ipaddress;
158 177
 		$args->regdate = date("YmdHis", $_SERVER['REQUEST_TIME']-$time);
Please login to merge, or discard this patch.