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/spamfilter/spamfilter.admin.controller.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 	function procSpamfilterAdminInsertConfig()
18 18
 	{
19 19
 		// Get the default information
20
-		$argsConfig = Context::gets('limits','check_trackback');
20
+		$argsConfig = Context::gets('limits', 'check_trackback');
21 21
 		$flag = Context::get('flag');
22 22
 		//interval, limit_count
23
-		if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N';
24
-		if($argsConfig->limits!='Y') $argsConfig->limits = 'N';
23
+		if ($argsConfig->check_trackback != 'Y') $argsConfig->check_trackback = 'N';
24
+		if ($argsConfig->limits != 'Y') $argsConfig->limits = 'N';
25 25
 		// Create and insert the module Controller object
26 26
 		$oModuleController = getController('module');
27
-		$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig);
28
-		if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
27
+		$moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter', $argsConfig);
28
+		if (!$moduleConfigOutput->toBool()) return $moduleConfigOutput;
29 29
 
30 30
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock');
31 31
 		$this->setRedirectUrl($returnUrl);
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 		//스팸IP  추가
37 37
 		$ipaddress_list = Context::get('ipaddress_list');
38 38
 		$oSpamfilterController = getController('spamfilter');
39
-		if($ipaddress_list)
39
+		if ($ipaddress_list)
40 40
 		{
41 41
 			$output = $oSpamfilterController->insertIP($ipaddress_list);
42
-			if(!$output->toBool() && !$output->get('fail_list')) return $output;
42
+			if (!$output->toBool() && !$output->get('fail_list')) return $output;
43 43
 
44
-			if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
44
+			if ($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')).'</em>';
45 45
 			$this->setMessage(Context::getLang('success_registed').$message_fail);
46 46
 		}
47 47
 
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 	{
55 55
 		//스팸 키워드 추가
56 56
 		$word_list = Context::get('word_list');
57
-		if($word_list)
57
+		if ($word_list)
58 58
 		{
59 59
 			$output = $this->insertWord($word_list);
60
-			if(!$output->toBool() && !$output->get('fail_list')) return $output;
60
+			if (!$output->toBool() && !$output->get('fail_list')) return $output;
61 61
 
62
-			if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>';
62
+			if ($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')).'</em>';
63 63
 			$this->setMessage(Context::getLang('success_registed').$message_fail);
64 64
 		}
65 65
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	function procSpamfilterAdminDeleteDeniedIP()
74 74
 	{
75 75
 		$ipAddressList = Context::get('ipaddress');
76
-		if($ipAddressList) $this->deleteIP($ipAddressList);
76
+		if ($ipAddressList) $this->deleteIP($ipAddressList);
77 77
 
78 78
 		$this->setMessage(Context::getLang('success_deleted'));
79 79
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$this->setMessage(Context::getLang('success_deleted'));
93 93
 
94
-		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word');
94
+		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList', 'active', 'word');
95 95
 		return $this->setRedirectUrl($returnUrl);
96 96
 	}
97 97
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	function deleteIP($ipaddress)
103 103
 	{
104
-		if(!$ipaddress) return;
104
+		if (!$ipaddress) return;
105 105
 
106 106
 		$args = new stdClass;
107 107
 		$args->ipaddress = $ipaddress;
@@ -115,26 +115,26 @@  discard block
 block discarded – undo
115 115
 	function insertWord($word_list)
116 116
 	{
117 117
 
118
-		$word_list = str_replace("\r","",$word_list);
119
-		$word_list = explode("\n",$word_list);
118
+		$word_list = str_replace("\r", "", $word_list);
119
+		$word_list = explode("\n", $word_list);
120 120
 
121
-		foreach($word_list as $word)
121
+		foreach ($word_list as $word)
122 122
 		{
123
-			if(!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word))
123
+			if (!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word))
124 124
 			{
125 125
 				return new BaseObject(-1, 'msg_invalid');
126 126
 			}
127 127
 		}
128 128
 
129 129
 		$fail_word = '';
130
-		foreach($word_list as $word)
130
+		foreach ($word_list as $word)
131 131
 		{
132 132
 			$args = new stdClass;
133
-			if(trim($word)) $args->word = $word;
133
+			if (trim($word)) $args->word = $word;
134 134
 			$output = executeQuery('spamfilter.insertDeniedWord', $args);
135
-			if(!$output->toBool()) $fail_word .= $word.'<br />';
135
+			if (!$output->toBool()) $fail_word .= $word.'<br />';
136 136
 		}
137
-		$output->add('fail_list',$fail_word);
137
+		$output->add('fail_list', $fail_word);
138 138
 		return $output;
139 139
 	}
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	function deleteWord($word)
146 146
 	{
147
-		if(!$word) return;
147
+		if (!$word) return;
148 148
 		$args = new stdClass;
149 149
 		$args->word = $word;
150 150
 		return executeQuery('spamfilter.deleteDeniedWord', $args);
Please login to merge, or discard this patch.
modules/module/module.class.php 2 patches
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$oModuleController = getController('module');
17 17
 
18 18
 		$oDB = &DB::getInstance();
19
-		$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true);
20
-		$oDB->addIndex('sites','unique_domain',array('domain'),true);
19
+		$oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true);
20
+		$oDB->addIndex('sites', 'unique_domain', array('domain'), true);
21 21
 		// Create a directory to use in the module module
22 22
 		FileHandler::makeDir('./files/cache/module_info');
23 23
 		FileHandler::makeDir('./files/cache/triggers');
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 		$args = new stdClass;
28 28
 		$args->site_srl = 0;
29 29
 		$output = $oDB->executeQuery('module.getSite', $args);
30
-		if(!$output->data || !$output->data->index_module_srl)
30
+		if (!$output->data || !$output->data->index_module_srl)
31 31
 		{
32 32
 			$db_info = Context::getDBInfo();
33 33
 			$domain = Context::getDefaultUrl();
34 34
 			$url_info = parse_url($domain);
35
-			$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
35
+			$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
36 36
 
37 37
 			$site_args = new stdClass;
38 38
 			$site_args->site_srl = 0;
39
-			$site_args->index_module_srl  = 0;
39
+			$site_args->index_module_srl = 0;
40 40
 			$site_args->domain = $domain;
41 41
 			$site_args->default_language = $db_info->lang_type;
42 42
 
43 43
 			$output = executeQuery('module.insertSite', $site_args);
44
-			if(!$output->toBool()) return $output;
44
+			if (!$output->toBool()) return $output;
45 45
 		}
46 46
 
47 47
 		return new BaseObject();
@@ -56,66 +56,66 @@  discard block
 block discarded – undo
56 56
 		$oModuleModel = getModel('module');
57 57
 		$oModuleController = getController('module');
58 58
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
59
-		if($oModuleModel->needUpdate($version_update_id))
59
+		if ($oModuleModel->needUpdate($version_update_id))
60 60
 		{
61 61
 			// 2008. 10. 27 Add multi-index in the table, the module_part_config
62
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
62
+			if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) return true;
63 63
 			// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
64
-			if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
64
+			if (!$oDB->isIndexExists('modules', "idx_site_mid")) return true;
65 65
 			// Move permissions/skin information of all modules to the table, grants.
66
-			if($oDB->isColumnExists('modules', 'grants')) return true;
66
+			if ($oDB->isColumnExists('modules', 'grants')) return true;
67 67
 			// Move permissions/skin information of all modules to the table, grants.
68
-			if(!$oDB->isColumnExists('sites', 'default_language')) return true;
68
+			if (!$oDB->isColumnExists('sites', 'default_language')) return true;
69 69
 			// Delete extra_vars* column
70
-			for($i=1;$i<=20;$i++)
70
+			for ($i = 1; $i <= 20; $i++)
71 71
 			{
72
-				if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
72
+				if ($oDB->isColumnExists("documents", "extra_vars".$i)) return true;
73 73
 			}
74 74
 			// Insert site information to the table, sites
75 75
 			$args = new stdClass();
76 76
 			$args->site_srl = 0;
77 77
 			$output = $oDB->executeQuery('module.getSite', $args);
78
-			if(!$output->data) return true;
78
+			if (!$output->data) return true;
79 79
 
80 80
 			// If domain index is defined on the table, sites
81
-			if($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
-			if(!$oDB->isIndexExists('sites','unique_domain')) return true;
81
+			if ($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
+			if (!$oDB->isIndexExists('sites', 'unique_domain')) return true;
83 83
 
84
-			if(!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
-			if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
-			if(!$oDB->isColumnExists("modules", "mcontent")) return true;
87
-			if(!$oDB->isColumnExists("modules", "mskin")) return true;
84
+			if (!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
+			if (!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
+			if (!$oDB->isColumnExists("modules", "mcontent")) return true;
87
+			if (!$oDB->isColumnExists("modules", "mskin")) return true;
88 88
 
89 89
 			// check fix skin
90
-			if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
90
+			if (!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
91 91
 
92
-			if(!$oDB->isColumnExists("module_config", "site_srl")) return true;
92
+			if (!$oDB->isColumnExists("module_config", "site_srl")) return true;
93 93
 
94 94
 			$args->skin = '.';
95 95
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
96
-			if($output->data && count($output->data) > 0)
96
+			if ($output->data && count($output->data) > 0)
97 97
 			{
98
-				foreach($output->data as $item)
98
+				foreach ($output->data as $item)
99 99
 				{
100 100
 					$skin_path = explode('.', $item->skin);
101
-					if(count($skin_path) != 2) continue;
102
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
101
+					if (count($skin_path) != 2) continue;
102
+					if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
103 103
 				}
104 104
 			}
105 105
 
106 106
 			// XE 1.7
107 107
 
108 108
 			// check fix mskin
109
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
109
+			if (!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
110 110
 
111 111
 			$oModuleModel = getModel('module');
112 112
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
113
-			if(!$moduleConfig->isUpdateFixedValue) return true;
113
+			if (!$moduleConfig->isUpdateFixedValue) return true;
114 114
 
115 115
 			$oModuleController->insertUpdatedLog($version_update_id);
116 116
 		}
117 117
 
118
-		if(!is_dir('./files/ruleset')) return true;
118
+		if (!is_dir('./files/ruleset')) return true;
119 119
 
120 120
 		return false;
121 121
 	}
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$oModuleController = getController('module');
131 131
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
132
-		if($oModuleModel->needUpdate($version_update_id))
132
+		if ($oModuleModel->needUpdate($version_update_id))
133 133
 		{
134 134
 			// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg
135
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config"))
135
+			if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config"))
136 136
 			{
137 137
 				$oModuleModel = getModel('module');
138 138
 				$oModuleController = getController('module');
139 139
 				$modules = $oModuleModel->getModuleList();
140
-				foreach($modules as $key => $module_info)
140
+				foreach ($modules as $key => $module_info)
141 141
 				{
142 142
 					$module = $module_info->module;
143
-					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
143
+					if (!in_array($module, array('point', 'trackback', 'layout', 'rss', 'file', 'comment', 'editor'))) continue;
144 144
 					$config = $oModuleModel->getModuleConfig($module);
145 145
 
146 146
 					$module_config = null;
147
-					switch($module)
147
+					switch ($module)
148 148
 					{
149 149
 						case 'point' :
150 150
 							$module_config = $config->module_point;
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 						case 'editor' :
158 158
 							$module_config = $config->module_config;
159 159
 							unset($config->module_config);
160
-							if(is_array($module_config) && count($module_config))
160
+							if (is_array($module_config) && count($module_config))
161 161
 							{
162
-								foreach($module_config as $key => $val)
162
+								foreach ($module_config as $key => $val)
163 163
 								{
164
-									if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
164
+									if (isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
165 165
 								}
166 166
 							}
167 167
 							break;
168 168
 						case 'layout' :
169 169
 							$tmp = $config->header_script;
170
-							if(is_array($tmp) && count($tmp))
170
+							if (is_array($tmp) && count($tmp))
171 171
 							{
172
-								foreach($tmp as $k => $v)
172
+								foreach ($tmp as $k => $v)
173 173
 								{
174
-									if(!$v && !trim($v)) continue;
174
+									if (!$v && !trim($v)) continue;
175 175
 									$module_config[$k]->header_script = $v;
176 176
 								}
177 177
 							}
@@ -181,29 +181,29 @@  discard block
 block discarded – undo
181 181
 
182 182
 					$oModuleController->insertModuleConfig($module, $config);
183 183
 
184
-					if(is_array($module_config) && count($module_config))
184
+					if (is_array($module_config) && count($module_config))
185 185
 					{
186
-						foreach($module_config as $module_srl => $module_part_config)
186
+						foreach ($module_config as $module_srl => $module_part_config)
187 187
 						{
188
-							$oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config);
188
+							$oModuleController->insertModulePartConfig($module, $module_srl, $module_part_config);
189 189
 						}
190 190
 					}
191 191
 				}
192
-				$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
192
+				$oDB->addIndex("module_part_config", "idx_module_part_config", array("module", "module_srl"));
193 193
 			}
194 194
 			// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns
195
-			if(!$oDB->isIndexExists('modules',"idx_site_mid"))
195
+			if (!$oDB->isIndexExists('modules', "idx_site_mid"))
196 196
 			{
197
-				$oDB->dropIndex("modules","unique_mid",true);
198
-				$oDB->addColumn('modules','site_srl','number',11,0,true);
199
-				$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
197
+				$oDB->dropIndex("modules", "unique_mid", true);
198
+				$oDB->addColumn('modules', 'site_srl', 'number', 11, 0, true);
199
+				$oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true);
200 200
 			}
201 201
 			// document extra vars
202
-			if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
202
+			if (!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
203 203
 
204
-			if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
204
+			if (!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
205 205
 			// Move permission, skin info, extection info, admin ID of all modules to the table, grants
206
-			if($oDB->isColumnExists('modules', 'grants'))
206
+			if ($oDB->isColumnExists('modules', 'grants'))
207 207
 			{
208 208
 				$oModuleController = getController('module');
209 209
 				$oDocumentController = getController('document');
@@ -211,26 +211,26 @@  discard block
 block discarded – undo
211 211
 				$lang_code = Context::getLangType();
212 212
 				// Get module_info of all modules
213 213
 				$output = executeQueryArray('module.getModuleInfos');
214
-				if(count($output->data))
214
+				if (count($output->data))
215 215
 				{
216
-					foreach($output->data as $module_info)
216
+					foreach ($output->data as $module_info)
217 217
 					{
218 218
 						// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority
219 219
 						$module_srl = trim($module_info->module_srl);
220 220
 						// grant an authority
221 221
 						$grants = unserialize($module_info->grants);
222
-						if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
222
+						if ($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
223 223
 						// Insert skin vars
224 224
 						$skin_vars = unserialize($module_info->skin_vars);
225
-						if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
225
+						if ($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
226 226
 						// Insert super admin's ID
227 227
 						$admin_id = trim($module_info->admin_id);
228
-						if($admin_id && $admin_id != 'Array')
228
+						if ($admin_id && $admin_id != 'Array')
229 229
 						{
230
-							$admin_ids = explode(',',$admin_id);
231
-							if(count($admin_id))
230
+							$admin_ids = explode(',', $admin_id);
231
+							if (count($admin_id))
232 232
 							{
233
-								foreach($admin_ids as $admin_id)
233
+								foreach ($admin_ids as $admin_id)
234 234
 								{
235 235
 									$oModuleController->insertAdminId($module_srl, $admin_id);
236 236
 								}
@@ -239,20 +239,20 @@  discard block
 block discarded – undo
239 239
 						// Save extra configurations for each module(column data which doesn't exist in the defaut modules)
240 240
 						$extra_vars = unserialize($module_info->extra_vars);
241 241
 						$document_extra_keys = null;
242
-						if($extra_vars->extra_vars && count($extra_vars->extra_vars))
242
+						if ($extra_vars->extra_vars && count($extra_vars->extra_vars))
243 243
 						{
244 244
 							$document_extra_keys = $extra_vars->extra_vars;
245 245
 							unset($extra_vars->extra_vars);
246 246
 						}
247
-						if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
247
+						if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
248 248
 
249 249
 						/**
250 250
 						 * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
251 251
 						 */
252 252
 						// Insert extra vars if planet module is
253
-						if($module_info->module == 'planet')
253
+						if ($module_info->module == 'planet')
254 254
 						{
255
-							if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
255
+							if (!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
256 256
 							$planet_extra_keys->name = 'postscript';
257 257
 							$planet_extra_keys->type = 'text';
258 258
 							$planet_extra_keys->is_required = 'N';
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 							$document_extra_keys[20] = $planet_extra_keys;
263 263
 						}
264 264
 						// Register keys for document extra vars
265
-						if(count($document_extra_keys))
265
+						if (count($document_extra_keys))
266 266
 						{
267
-							foreach($document_extra_keys as $var_idx => $val)
267
+							foreach ($document_extra_keys as $var_idx => $val)
268 268
 							{
269 269
 								$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx);
270 270
 							}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 							$oDocumentModel = getModel('document');
273 273
 							$total_count = $oDocumentModel->getDocumentCount($module_srl);
274 274
 
275
-							if($total_count > 0)
275
+							if ($total_count > 0)
276 276
 							{
277 277
 								$per_page = 100;
278 278
 								$total_pages = (int) (($total_count - 1) / $per_page) + 1;
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
 								$doc_args->sort_index = 'list_order';
284 284
 								$doc_args->order_type = 'asc';
285 285
 
286
-								for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++)
286
+								for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++)
287 287
 								{
288 288
 									$output = executeQueryArray('document.getDocumentList', $doc_args);
289 289
 
290
-									if($output->toBool() && $output->data && count($output->data))
290
+									if ($output->toBool() && $output->data && count($output->data))
291 291
 									{
292 292
 										foreach ($output->data as $document)
293 293
 										{
294
-											if(!$document) continue;
294
+											if (!$document) continue;
295 295
 											foreach ($document as $key => $var)
296 296
 											{
297 297
 												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
298
-												$var_idx = str_replace('extra_vars','',$key);
298
+												$var_idx = str_replace('extra_vars', '', $key);
299 299
 												$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
300 300
 											}
301 301
 										}
@@ -311,96 +311,96 @@  discard block
 block discarded – undo
311 311
 						executeQuery('module.updateModule', $module_info);
312 312
 
313 313
 						$oCacheHandler = CacheHandler::getInstance('object', null, true);
314
-						if($oCacheHandler->isSupport())
314
+						if ($oCacheHandler->isSupport())
315 315
 						{
316 316
 							$oCacheHandler->invalidateGroupKey('site_and_module');
317 317
 						}
318 318
 					}
319 319
 				}
320 320
 				// Various column drop
321
-				$oDB->dropColumn('modules','grants');
322
-				$oDB->dropColumn('modules','admin_id');
323
-				$oDB->dropColumn('modules','skin_vars');
324
-				$oDB->dropColumn('modules','extra_vars');
321
+				$oDB->dropColumn('modules', 'grants');
322
+				$oDB->dropColumn('modules', 'admin_id');
323
+				$oDB->dropColumn('modules', 'skin_vars');
324
+				$oDB->dropColumn('modules', 'extra_vars');
325 325
 			}
326 326
 			// Rights of all modules/skins transferring the information into a table Update grants
327
-			if(!$oDB->isColumnExists('sites', 'default_language'))
327
+			if (!$oDB->isColumnExists('sites', 'default_language'))
328 328
 			{
329
-				$oDB->addColumn('sites','default_language','varchar',255,0,false);
329
+				$oDB->addColumn('sites', 'default_language', 'varchar', 255, 0, false);
330 330
 			}
331 331
 			// extra_vars * Remove Column
332
-			for($i=1;$i<=20;$i++)
332
+			for ($i = 1; $i <= 20; $i++)
333 333
 			{
334
-				if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
335
-				$oDB->dropColumn('documents','extra_vars'.$i);
334
+				if (!$oDB->isColumnExists("documents", "extra_vars".$i)) continue;
335
+				$oDB->dropColumn('documents', 'extra_vars'.$i);
336 336
 			}
337 337
 
338 338
 			// Enter the main site information sites on the table
339 339
 			$args = new stdClass;
340 340
 			$args->site_srl = 0;
341 341
 			$output = $oDB->executeQuery('module.getSite', $args);
342
-			if(!$output->data)
342
+			if (!$output->data)
343 343
 			{
344 344
 				// Basic mid, language Wanted
345 345
 				$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
346 346
 				$db_info = Context::getDBInfo();
347 347
 				$domain = Context::getDefaultUrl();
348 348
 				$url_info = parse_url($domain);
349
-				$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
349
+				$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
350 350
 				$site_args->site_srl = 0;
351
-				$site_args->index_module_srl  = $mid_output->data->module_srl;
351
+				$site_args->index_module_srl = $mid_output->data->module_srl;
352 352
 				$site_args->domain = $domain;
353 353
 				$site_args->default_language = $db_info->lang_type;
354 354
 
355 355
 				$output = executeQuery('module.insertSite', $site_args);
356
-				if(!$output->toBool()) return $output;
356
+				if (!$output->toBool()) return $output;
357 357
 			}
358 358
 
359
-			if($oDB->isIndexExists('sites','idx_domain'))
359
+			if ($oDB->isIndexExists('sites', 'idx_domain'))
360 360
 			{
361
-				$oDB->dropIndex('sites','idx_domain');
361
+				$oDB->dropIndex('sites', 'idx_domain');
362 362
 			}
363
-			if(!$oDB->isIndexExists('sites','unique_domain'))
363
+			if (!$oDB->isIndexExists('sites', 'unique_domain'))
364 364
 			{
365 365
 				$this->updateForUniqueSiteDomain();
366
-				$oDB->addIndex('sites','unique_domain',array('domain'),true);
366
+				$oDB->addIndex('sites', 'unique_domain', array('domain'), true);
367 367
 			}
368 368
 
369
-			if(!$oDB->isColumnExists("modules", "use_mobile"))
369
+			if (!$oDB->isColumnExists("modules", "use_mobile"))
370 370
 			{
371
-				$oDB->addColumn('modules','use_mobile','char',1,'N');
371
+				$oDB->addColumn('modules', 'use_mobile', 'char', 1, 'N');
372 372
 			}
373
-			if(!$oDB->isColumnExists("modules", "mlayout_srl"))
373
+			if (!$oDB->isColumnExists("modules", "mlayout_srl"))
374 374
 			{
375
-				$oDB->addColumn('modules','mlayout_srl','number',11, 0);
375
+				$oDB->addColumn('modules', 'mlayout_srl', 'number', 11, 0);
376 376
 			}
377
-			if(!$oDB->isColumnExists("modules", "mcontent"))
377
+			if (!$oDB->isColumnExists("modules", "mcontent"))
378 378
 			{
379
-				$oDB->addColumn('modules','mcontent','bigtext');
379
+				$oDB->addColumn('modules', 'mcontent', 'bigtext');
380 380
 			}
381
-			if(!$oDB->isColumnExists("modules", "mskin"))
381
+			if (!$oDB->isColumnExists("modules", "mskin"))
382 382
 			{
383
-				$oDB->addColumn('modules','mskin','varchar',250);
383
+				$oDB->addColumn('modules', 'mskin', 'varchar', 250);
384 384
 			}
385
-			if(!$oDB->isColumnExists("modules", "is_skin_fix"))
385
+			if (!$oDB->isColumnExists("modules", "is_skin_fix"))
386 386
 			{
387 387
 				$oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N');
388 388
 				$output = executeQuery('module.updateSkinFixModules');
389 389
 			}
390
-			if(!$oDB->isColumnExists("module_config", "site_srl"))
390
+			if (!$oDB->isColumnExists("module_config", "site_srl"))
391 391
 			{
392 392
 				$oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true);
393 393
 			}
394 394
 
395 395
 			$args->skin = '.';
396 396
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
397
-			if($output->data && count($output->data) > 0)
397
+			if ($output->data && count($output->data) > 0)
398 398
 			{
399
-				foreach($output->data as $item)
399
+				foreach ($output->data as $item)
400 400
 				{
401 401
 					$skin_path = explode('.', $item->skin);
402
-					if(count($skin_path) != 2) continue;
403
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
402
+					if (count($skin_path) != 2) continue;
403
+					if (is_dir(sprintf(_XE_PATH_.'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
404 404
 					{
405 405
 						unset($args);
406 406
 						$args->skin = $item->skin;
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			}
412 412
 
413 413
 			// XE 1.7
414
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix"))
414
+			if (!$oDB->isColumnExists("modules", "is_mskin_fix"))
415 415
 			{
416 416
 				$oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N');
417 417
 				$output = executeQuery('module.updateMobileSkinFixModules');
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
 
420 420
 			$oModuleModel = getModel('module');
421 421
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
422
-			if(!$moduleConfig->isUpdateFixedValue)
422
+			if (!$moduleConfig->isUpdateFixedValue)
423 423
 			{
424 424
 				$output = executeQuery('module.updateSkinFixModules');
425 425
 				$output = executeQuery('module.updateMobileSkinFixModules');
426 426
 
427 427
 				$oModuleController = getController('module');
428
-				if(!$moduleConfig) $moduleConfig = new stdClass;
428
+				if (!$moduleConfig) $moduleConfig = new stdClass;
429 429
 				$moduleConfig->isUpdateFixedValue = TRUE;
430 430
 				$output = $oModuleController->updateModuleConfig('module', $moduleConfig);
431 431
 			}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			$oModuleController->insertUpdatedLog($version_update_id);
434 434
 		}
435 435
 
436
-		if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
436
+		if (!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
437 437
 
438 438
 		return new BaseObject(0, 'success_updated');
439 439
 	}
@@ -441,18 +441,18 @@  discard block
 block discarded – undo
441 441
 	function updateForUniqueSiteDomain()
442 442
 	{
443 443
 		$output = executeQueryArray("module.getNonuniqueDomains");
444
-		if(!$output->data) return;
445
-		foreach($output->data as $data)
444
+		if (!$output->data) return;
445
+		foreach ($output->data as $data)
446 446
 		{
447
-			if($data->count == 1) continue;
447
+			if ($data->count == 1) continue;
448 448
 			$domain = $data->domain;
449 449
 			$args = new stdClass;
450 450
 			$args->domain = $domain;
451 451
 			$output2 = executeQueryArray("module.getSiteByDomain", $args);
452 452
 			$bFirst = true;
453
-			foreach($output2->data as $site)
453
+			foreach ($output2->data as $site)
454 454
 			{
455
-				if($bFirst)
455
+				if ($bFirst)
456 456
 				{
457 457
 					$bFirst = false;
458 458
 					continue;
Please login to merge, or discard this patch.
Braces   +114 added lines, -38 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 			$site_args->default_language = $db_info->lang_type;
42 42
 
43 43
 			$output = executeQuery('module.insertSite', $site_args);
44
-			if(!$output->toBool()) return $output;
44
+			if(!$output->toBool()) {
45
+				return $output;
46
+			}
45 47
 		}
46 48
 
47 49
 		return new BaseObject();
@@ -59,37 +61,65 @@  discard block
 block discarded – undo
59 61
 		if($oModuleModel->needUpdate($version_update_id))
60 62
 		{
61 63
 			// 2008. 10. 27 Add multi-index in the table, the module_part_config
62
-			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
64
+			if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) {
65
+				return true;
66
+			}
63 67
 			// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
64
-			if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
68
+			if(!$oDB->isIndexExists('modules',"idx_site_mid")) {
69
+				return true;
70
+			}
65 71
 			// Move permissions/skin information of all modules to the table, grants.
66
-			if($oDB->isColumnExists('modules', 'grants')) return true;
72
+			if($oDB->isColumnExists('modules', 'grants')) {
73
+				return true;
74
+			}
67 75
 			// Move permissions/skin information of all modules to the table, grants.
68
-			if(!$oDB->isColumnExists('sites', 'default_language')) return true;
76
+			if(!$oDB->isColumnExists('sites', 'default_language')) {
77
+				return true;
78
+			}
69 79
 			// Delete extra_vars* column
70 80
 			for($i=1;$i<=20;$i++)
71 81
 			{
72
-				if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
82
+				if($oDB->isColumnExists("documents","extra_vars".$i)) {
83
+					return true;
84
+				}
73 85
 			}
74 86
 			// Insert site information to the table, sites
75 87
 			$args = new stdClass();
76 88
 			$args->site_srl = 0;
77 89
 			$output = $oDB->executeQuery('module.getSite', $args);
78
-			if(!$output->data) return true;
90
+			if(!$output->data) {
91
+				return true;
92
+			}
79 93
 
80 94
 			// If domain index is defined on the table, sites
81
-			if($oDB->isIndexExists('sites', 'idx_domain')) return true;
82
-			if(!$oDB->isIndexExists('sites','unique_domain')) return true;
95
+			if($oDB->isIndexExists('sites', 'idx_domain')) {
96
+				return true;
97
+			}
98
+			if(!$oDB->isIndexExists('sites','unique_domain')) {
99
+				return true;
100
+			}
83 101
 
84
-			if(!$oDB->isColumnExists("modules", "use_mobile")) return true;
85
-			if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true;
86
-			if(!$oDB->isColumnExists("modules", "mcontent")) return true;
87
-			if(!$oDB->isColumnExists("modules", "mskin")) return true;
102
+			if(!$oDB->isColumnExists("modules", "use_mobile")) {
103
+				return true;
104
+			}
105
+			if(!$oDB->isColumnExists("modules", "mlayout_srl")) {
106
+				return true;
107
+			}
108
+			if(!$oDB->isColumnExists("modules", "mcontent")) {
109
+				return true;
110
+			}
111
+			if(!$oDB->isColumnExists("modules", "mskin")) {
112
+				return true;
113
+			}
88 114
 
89 115
 			// check fix skin
90
-			if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true;
116
+			if(!$oDB->isColumnExists("modules", "is_skin_fix")) {
117
+				return true;
118
+			}
91 119
 
92
-			if(!$oDB->isColumnExists("module_config", "site_srl")) return true;
120
+			if(!$oDB->isColumnExists("module_config", "site_srl")) {
121
+				return true;
122
+			}
93 123
 
94 124
 			$args->skin = '.';
95 125
 			$output = executeQueryArray('module.getModuleSkinDotList', $args);
@@ -98,24 +128,34 @@  discard block
 block discarded – undo
98 128
 				foreach($output->data as $item)
99 129
 				{
100 130
 					$skin_path = explode('.', $item->skin);
101
-					if(count($skin_path) != 2) continue;
102
-					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
131
+					if(count($skin_path) != 2) {
132
+						continue;
133
+					}
134
+					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) {
135
+						return true;
136
+					}
103 137
 				}
104 138
 			}
105 139
 
106 140
 			// XE 1.7
107 141
 
108 142
 			// check fix mskin
109
-			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
143
+			if(!$oDB->isColumnExists("modules", "is_mskin_fix")) {
144
+				return true;
145
+			}
110 146
 
111 147
 			$oModuleModel = getModel('module');
112 148
 			$moduleConfig = $oModuleModel->getModuleConfig('module');
113
-			if(!$moduleConfig->isUpdateFixedValue) return true;
149
+			if(!$moduleConfig->isUpdateFixedValue) {
150
+				return true;
151
+			}
114 152
 
115 153
 			$oModuleController->insertUpdatedLog($version_update_id);
116 154
 		}
117 155
 
118
-		if(!is_dir('./files/ruleset')) return true;
156
+		if(!is_dir('./files/ruleset')) {
157
+			return true;
158
+		}
119 159
 
120 160
 		return false;
121 161
 	}
@@ -140,7 +180,9 @@  discard block
 block discarded – undo
140 180
 				foreach($modules as $key => $module_info)
141 181
 				{
142 182
 					$module = $module_info->module;
143
-					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
183
+					if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) {
184
+						continue;
185
+					}
144 186
 					$config = $oModuleModel->getModuleConfig($module);
145 187
 
146 188
 					$module_config = null;
@@ -161,7 +203,9 @@  discard block
 block discarded – undo
161 203
 							{
162 204
 								foreach($module_config as $key => $val)
163 205
 								{
164
-									if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
206
+									if(isset($module_config[$key]->module_srl)) {
207
+										unset($module_config[$key]->module_srl);
208
+									}
165 209
 								}
166 210
 							}
167 211
 							break;
@@ -171,7 +215,9 @@  discard block
 block discarded – undo
171 215
 							{
172 216
 								foreach($tmp as $k => $v)
173 217
 								{
174
-									if(!$v && !trim($v)) continue;
218
+									if(!$v && !trim($v)) {
219
+										continue;
220
+									}
175 221
 									$module_config[$k]->header_script = $v;
176 222
 								}
177 223
 							}
@@ -199,9 +245,13 @@  discard block
 block discarded – undo
199 245
 				$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
200 246
 			}
201 247
 			// document extra vars
202
-			if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
248
+			if(!$oDB->isTableExists('document_extra_vars')) {
249
+				$oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
250
+			}
203 251
 
204
-			if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
252
+			if(!$oDB->isTableExists('document_extra_keys')) {
253
+				$oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
254
+			}
205 255
 			// Move permission, skin info, extection info, admin ID of all modules to the table, grants
206 256
 			if($oDB->isColumnExists('modules', 'grants'))
207 257
 			{
@@ -219,10 +269,14 @@  discard block
 block discarded – undo
219 269
 						$module_srl = trim($module_info->module_srl);
220 270
 						// grant an authority
221 271
 						$grants = unserialize($module_info->grants);
222
-						if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
272
+						if($grants) {
273
+							$oModuleController->insertModuleGrants($module_srl, $grants);
274
+						}
223 275
 						// Insert skin vars
224 276
 						$skin_vars = unserialize($module_info->skin_vars);
225
-						if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
277
+						if($skin_vars) {
278
+							$oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
279
+						}
226 280
 						// Insert super admin's ID
227 281
 						$admin_id = trim($module_info->admin_id);
228 282
 						if($admin_id && $admin_id != 'Array')
@@ -244,7 +298,9 @@  discard block
 block discarded – undo
244 298
 							$document_extra_keys = $extra_vars->extra_vars;
245 299
 							unset($extra_vars->extra_vars);
246 300
 						}
247
-						if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
301
+						if($extra_vars) {
302
+							$oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
303
+						}
248 304
 
249 305
 						/**
250 306
 						 * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
@@ -252,7 +308,9 @@  discard block
 block discarded – undo
252 308
 						// Insert extra vars if planet module is
253 309
 						if($module_info->module == 'planet')
254 310
 						{
255
-							if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
311
+							if(!$document_extra_keys || !is_array($document_extra_keys)) {
312
+								$document_extra_keys = array();
313
+							}
256 314
 							$planet_extra_keys->name = 'postscript';
257 315
 							$planet_extra_keys->type = 'text';
258 316
 							$planet_extra_keys->is_required = 'N';
@@ -291,10 +349,14 @@  discard block
 block discarded – undo
291 349
 									{
292 350
 										foreach ($output->data as $document)
293 351
 										{
294
-											if(!$document) continue;
352
+											if(!$document) {
353
+												continue;
354
+											}
295 355
 											foreach ($document as $key => $var)
296 356
 											{
297
-												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
357
+												if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') {
358
+													continue;
359
+												}
298 360
 												$var_idx = str_replace('extra_vars','',$key);
299 361
 												$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
300 362
 											}
@@ -331,7 +393,9 @@  discard block
 block discarded – undo
331 393
 			// extra_vars * Remove Column
332 394
 			for($i=1;$i<=20;$i++)
333 395
 			{
334
-				if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
396
+				if(!$oDB->isColumnExists("documents","extra_vars".$i)) {
397
+					continue;
398
+				}
335 399
 				$oDB->dropColumn('documents','extra_vars'.$i);
336 400
 			}
337 401
 
@@ -353,7 +417,9 @@  discard block
 block discarded – undo
353 417
 				$site_args->default_language = $db_info->lang_type;
354 418
 
355 419
 				$output = executeQuery('module.insertSite', $site_args);
356
-				if(!$output->toBool()) return $output;
420
+				if(!$output->toBool()) {
421
+					return $output;
422
+				}
357 423
 			}
358 424
 
359 425
 			if($oDB->isIndexExists('sites','idx_domain'))
@@ -399,7 +465,9 @@  discard block
 block discarded – undo
399 465
 				foreach($output->data as $item)
400 466
 				{
401 467
 					$skin_path = explode('.', $item->skin);
402
-					if(count($skin_path) != 2) continue;
468
+					if(count($skin_path) != 2) {
469
+						continue;
470
+					}
403 471
 					if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
404 472
 					{
405 473
 						unset($args);
@@ -425,7 +493,9 @@  discard block
 block discarded – undo
425 493
 				$output = executeQuery('module.updateMobileSkinFixModules');
426 494
 
427 495
 				$oModuleController = getController('module');
428
-				if(!$moduleConfig) $moduleConfig = new stdClass;
496
+				if(!$moduleConfig) {
497
+					$moduleConfig = new stdClass;
498
+				}
429 499
 				$moduleConfig->isUpdateFixedValue = TRUE;
430 500
 				$output = $oModuleController->updateModuleConfig('module', $moduleConfig);
431 501
 			}
@@ -433,7 +503,9 @@  discard block
 block discarded – undo
433 503
 			$oModuleController->insertUpdatedLog($version_update_id);
434 504
 		}
435 505
 
436
-		if(!is_dir('./files/ruleset')) FileHandler::makeDir('./files/ruleset');
506
+		if(!is_dir('./files/ruleset')) {
507
+			FileHandler::makeDir('./files/ruleset');
508
+		}
437 509
 
438 510
 		return new BaseObject(0, 'success_updated');
439 511
 	}
@@ -441,10 +513,14 @@  discard block
 block discarded – undo
441 513
 	function updateForUniqueSiteDomain()
442 514
 	{
443 515
 		$output = executeQueryArray("module.getNonuniqueDomains");
444
-		if(!$output->data) return;
516
+		if(!$output->data) {
517
+			return;
518
+		}
445 519
 		foreach($output->data as $data)
446 520
 		{
447
-			if($data->count == 1) continue;
521
+			if($data->count == 1) {
522
+				continue;
523
+			}
448 524
 			$domain = $data->domain;
449 525
 			$args = new stdClass;
450 526
 			$args->domain = $domain;
Please login to merge, or discard this patch.
modules/module/module.view.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 		$skin = Context::get('skin');
26 26
 		// Get modules/skin information
27 27
 		$module_path = sprintf("./modules/%s/", $selected_module);
28
-		if(!is_dir($module_path)) $this->stop("msg_invalid_request");
28
+		if (!is_dir($module_path)) $this->stop("msg_invalid_request");
29 29
 
30 30
 		$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
31
-		if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
31
+		if (!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
32 32
 
33 33
 		$oModuleModel = getModel('module');
34 34
 		$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
35
-		Context::set('skin_info',$skin_info);
35
+		Context::set('skin_info', $skin_info);
36 36
 
37 37
 		$this->setLayoutFile("popup_layout");
38 38
 		$this->setTemplateFile("skin_info");
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	function dispModuleSelectList()
45 45
 	{
46
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
46
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
47 47
 
48 48
 		$oModuleModel = getModel('module');
49 49
 		$logged_info = Context::get('logged_info');
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
 
58 58
 		$args = new stdClass();
59 59
 		$module_category_exists = false;
60
-		if($logged_info->is_admin == 'Y' && $site_keyword)
60
+		if ($logged_info->is_admin == 'Y' && $site_keyword)
61 61
 		{
62 62
 			$args->site_keyword = $site_keyword;
63 63
 		}
64 64
 		else
65 65
 		{
66
-			$args->site_srl = (int)$site_module_info->site_srl;
66
+			$args->site_srl = (int) $site_module_info->site_srl;
67 67
 			Context::set('site_keyword', null);
68 68
 		}
69 69
 
70
-		if($logged_info->is_admin == 'Y')
70
+		if ($logged_info->is_admin == 'Y')
71 71
 		{
72 72
 			$module_category_exists = true;
73 73
 		}
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 		// Get a list of modules at the site
76 76
 		$mid_list = array();
77 77
 		$output = executeQueryArray('module.getSiteModules', $args);
78
-		if(!$output->data) $output->data = array();
78
+		if (!$output->data) $output->data = array();
79 79
 
80
-		foreach($output->data as $key => $val)
80
+		foreach ($output->data as $key => $val)
81 81
 		{
82 82
 			$module = trim($val->module);
83
-			if(!$module) continue;
83
+			if (!$module) continue;
84 84
 
85
-			if(!$oModuleModel->getGrant($val, $logged_info)->access)
85
+			if (!$oModuleModel->getGrant($val, $logged_info)->access)
86 86
 			{
87 87
 				continue;
88 88
 			}
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 			$obj->browser_title = $val->browser_title;
94 94
 			$mid_list[$module]->list[$category][$val->mid] = $obj;
95 95
 
96
-			if(!$selected_module) $selected_module = $module;
97
-			if(!$mid_list[$module]->title)
96
+			if (!$selected_module) $selected_module = $module;
97
+			if (!$mid_list[$module]->title)
98 98
 			{
99 99
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
100 100
 				$mid_list[$module]->title = $xml_info->title;
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 	function dispModuleFileBox()
118 118
 	{
119 119
 		$logged_info = Context::get('logged_info');
120
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
120
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
121 121
 
122 122
 		$input_name = Context::get('input');
123
-		if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
123
+		if (!preg_match('/^[a-z0-9_]+$/i', $input_name))
124 124
 		{
125 125
 			return new BaseObject(-1, 'msg_invalid_request');
126 126
 		}
127 127
 
128
-		if(!$input_name) return new BaseObject(-1, 'msg_not_permitted');
128
+		if (!$input_name) return new BaseObject(-1, 'msg_not_permitted');
129 129
 
130 130
 		$addscript = sprintf('<script>//<![CDATA[
131 131
 				var selected_filebox_input_name = "%s";
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		Context::set('filebox_list', $output->data);
138 138
 
139 139
 		$filter = Context::get('filter');
140
-		if($filter) Context::set('arrfilter',explode(',',$filter));
140
+		if ($filter) Context::set('arrfilter', explode(',', $filter));
141 141
 
142 142
 		Context::set('page_navigation', $output->page_navigation);
143 143
 		$this->setLayoutFile('popup_layout');
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	function dispModuleFileBoxAdd()
149 149
 	{
150 150
 		$logged_info = Context::get('logged_info');
151
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
151
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
152 152
 
153 153
 		$filter = Context::get('filter');
154
-		if($filter) Context::set('arrfilter',explode(',',$filter));
154
+		if ($filter) Context::set('arrfilter', explode(',', $filter));
155 155
 
156 156
 		$this->setLayoutFile('popup_layout');
157 157
 		$this->setTemplateFile('filebox_add');
Please login to merge, or discard this patch.
Braces   +34 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,10 +25,14 @@  discard block
 block discarded – undo
25 25
 		$skin = Context::get('skin');
26 26
 		// Get modules/skin information
27 27
 		$module_path = sprintf("./modules/%s/", $selected_module);
28
-		if(!is_dir($module_path)) $this->stop("msg_invalid_request");
28
+		if(!is_dir($module_path)) {
29
+			$this->stop("msg_invalid_request");
30
+		}
29 31
 
30 32
 		$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
31
-		if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
33
+		if(!file_exists($skin_info_xml)) {
34
+			$this->stop("msg_invalid_request");
35
+		}
32 36
 
33 37
 		$oModuleModel = getModel('module');
34 38
 		$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
@@ -43,7 +47,9 @@  discard block
 block discarded – undo
43 47
 	 */
44 48
 	function dispModuleSelectList()
45 49
 	{
46
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
50
+		if(!Context::get('is_logged')) {
51
+			return new BaseObject(-1, 'msg_not_permitted');
52
+		}
47 53
 
48 54
 		$oModuleModel = getModel('module');
49 55
 		$logged_info = Context::get('logged_info');
@@ -60,8 +66,7 @@  discard block
 block discarded – undo
60 66
 		if($logged_info->is_admin == 'Y' && $site_keyword)
61 67
 		{
62 68
 			$args->site_keyword = $site_keyword;
63
-		}
64
-		else
69
+		} else
65 70
 		{
66 71
 			$args->site_srl = (int)$site_module_info->site_srl;
67 72
 			Context::set('site_keyword', null);
@@ -75,12 +80,16 @@  discard block
 block discarded – undo
75 80
 		// Get a list of modules at the site
76 81
 		$mid_list = array();
77 82
 		$output = executeQueryArray('module.getSiteModules', $args);
78
-		if(!$output->data) $output->data = array();
83
+		if(!$output->data) {
84
+			$output->data = array();
85
+		}
79 86
 
80 87
 		foreach($output->data as $key => $val)
81 88
 		{
82 89
 			$module = trim($val->module);
83
-			if(!$module) continue;
90
+			if(!$module) {
91
+				continue;
92
+			}
84 93
 
85 94
 			if(!$oModuleModel->getGrant($val, $logged_info)->access)
86 95
 			{
@@ -93,7 +102,9 @@  discard block
 block discarded – undo
93 102
 			$obj->browser_title = $val->browser_title;
94 103
 			$mid_list[$module]->list[$category][$val->mid] = $obj;
95 104
 
96
-			if(!$selected_module) $selected_module = $module;
105
+			if(!$selected_module) {
106
+				$selected_module = $module;
107
+			}
97 108
 			if(!$mid_list[$module]->title)
98 109
 			{
99 110
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
@@ -117,7 +128,9 @@  discard block
 block discarded – undo
117 128
 	function dispModuleFileBox()
118 129
 	{
119 130
 		$logged_info = Context::get('logged_info');
120
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
131
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
132
+			return new BaseObject(-1, 'msg_not_permitted');
133
+		}
121 134
 
122 135
 		$input_name = Context::get('input');
123 136
 		if(!preg_match('/^[a-z0-9_]+$/i', $input_name))
@@ -125,7 +138,9 @@  discard block
 block discarded – undo
125 138
 			return new BaseObject(-1, 'msg_invalid_request');
126 139
 		}
127 140
 
128
-		if(!$input_name) return new BaseObject(-1, 'msg_not_permitted');
141
+		if(!$input_name) {
142
+			return new BaseObject(-1, 'msg_not_permitted');
143
+		}
129 144
 
130 145
 		$addscript = sprintf('<script>//<![CDATA[
131 146
 				var selected_filebox_input_name = "%s";
@@ -137,7 +152,9 @@  discard block
 block discarded – undo
137 152
 		Context::set('filebox_list', $output->data);
138 153
 
139 154
 		$filter = Context::get('filter');
140
-		if($filter) Context::set('arrfilter',explode(',',$filter));
155
+		if($filter) {
156
+			Context::set('arrfilter',explode(',',$filter));
157
+		}
141 158
 
142 159
 		Context::set('page_navigation', $output->page_navigation);
143 160
 		$this->setLayoutFile('popup_layout');
@@ -148,10 +165,14 @@  discard block
 block discarded – undo
148 165
 	function dispModuleFileBoxAdd()
149 166
 	{
150 167
 		$logged_info = Context::get('logged_info');
151
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
168
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
169
+			return new BaseObject(-1, 'msg_not_permitted');
170
+		}
152 171
 
153 172
 		$filter = Context::get('filter');
154
-		if($filter) Context::set('arrfilter',explode(',',$filter));
173
+		if($filter) {
174
+			Context::set('arrfilter',explode(',',$filter));
175
+		}
155 176
 
156 177
 		$this->setLayoutFile('popup_layout');
157 178
 		$this->setTemplateFile('filebox_add');
Please login to merge, or discard this patch.
modules/module/module.admin.view.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 		$oAutoinstallModel = getModel('autoinstall');
36 36
 
37 37
 		$module_list = $oModuleModel->getModuleList();
38
-		if(is_array($module_list))
38
+		if (is_array($module_list))
39 39
 		{
40
-			foreach($module_list as $key => $val)
40
+			foreach ($module_list as $key => $val)
41 41
 			{
42 42
 				$module_list[$key]->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path);
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 				$module_list[$key]->need_autoinstall_update = $package[$packageSrl]->need_update;
48 48
 
49 49
 				// get easyinstall update url
50
-				if($module_list[$key]->need_autoinstall_update == 'Y')
50
+				if ($module_list[$key]->need_autoinstall_update == 'Y')
51 51
 				{
52 52
 					$module_list[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
53 53
 				}
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 
59 59
 		$favoriteList = $output->get('favoriteList');
60 60
 		$favoriteModuleList = array();
61
-		if($favoriteList)
61
+		if ($favoriteList)
62 62
 		{
63
-			foreach($favoriteList as $favorite => $favorite_info)
63
+			foreach ($favoriteList as $favorite => $favorite_info)
64 64
 			{
65 65
 				$favoriteModuleList[] = $favorite_info->module;
66 66
 			}
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 		//Security
111 111
 		$security = new Security();
112 112
 
113
-		if($module_category_srl)
113
+		if ($module_category_srl)
114 114
 		{
115
-			$selected_category  = $oModuleModel->getModuleCategory($module_category_srl);
115
+			$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
116 116
 			Context::set('selected_category', $selected_category);
117 117
 
118 118
 			//Security
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 	{
165 165
 		$module_srls = Context::get('module_srls');
166 166
 
167
-		$modules = explode(',',$module_srls);
168
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
167
+		$modules = explode(',', $module_srls);
168
+		if (!count($modules)) if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
169 169
 
170 170
 		$oModuleModel = getModel('module');
171 171
 		$columnList = array('module_srl', 'module');
172 172
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList);
173 173
 		// Get a skin list of the module
174
-		$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/'.$module_info->module);
175
-		Context::set('skin_list',$skin_list);
174
+		$skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$module_info->module);
175
+		Context::set('skin_list', $skin_list);
176 176
 		// Get a layout list
177 177
 		$oLayoutModel = getModel('layout');
178 178
 		$layout_list = $oLayoutModel->getLayoutList();
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		Context::set('module_category', $module_category);
183 183
 
184 184
 		$security = new Security();
185
-		$security->encodeHTML('layout_list..title','layout_list..layout');
185
+		$security->encodeHTML('layout_list..title', 'layout_list..layout');
186 186
 		$security->encodeHTML('skin_list....');
187 187
 		$security->encodeHTML('module_category...');
188 188
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	{
201 201
 		$module_srls = Context::get('module_srls');
202 202
 
203
-		$modules = explode(',',$module_srls);
204
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
203
+		$modules = explode(',', $module_srls);
204
+		if (!count($modules)) if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
205 205
 		// pre-define variables because you can get contents from other module (call by reference)
206 206
 		$content = '';
207 207
 		// Call a trigger for additional settings
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	{
224 224
 		$module_srls = Context::get('module_srls');
225 225
 
226
-		$modules = explode(',',$module_srls);
227
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
226
+		$modules = explode(',', $module_srls);
227
+		if (!count($modules)) if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
228 228
 
229 229
 		$oModuleModel = getModel('module');
230 230
 		$columnList = array('module_srl', 'module', 'site_srl');
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 		// Grant virtual permissions for access and manager
235 235
 		$grant_list->access->title = Context::getLang('grant_access');
236 236
 		$grant_list->access->default = 'guest';
237
-		if(count($source_grant_list))
237
+		if (count($source_grant_list))
238 238
 		{
239
-			foreach($source_grant_list as $key => $val)
239
+			foreach ($source_grant_list as $key => $val)
240 240
 			{
241
-				if(!$val->default) $val->default = 'guest';
242
-				if($val->default == 'root') $val->default = 'manager';
241
+				if (!$val->default) $val->default = 'guest';
242
+				if ($val->default == 'root') $val->default = 'manager';
243 243
 				$grant_list->{$key} = $val;
244 244
 			}
245 245
 		}
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		// Get the language file of the current site
269 269
 		$site_module_info = Context::get('site_module_info');
270 270
 		$args = new stdClass();
271
-		$args->site_srl = (int)$site_module_info->site_srl;
271
+		$args->site_srl = (int) $site_module_info->site_srl;
272 272
 		$args->langCode = Context::get('lang_type');
273 273
 		$args->page = Context::get('page'); // /< Page
274 274
 		$args->list_count = 30; // /< the number of posts to display on a single page
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		Context::set('lang_code_list', $output->data);
288 288
 		Context::set('page_navigation', $output->page_navigation);
289 289
 
290
-		if(Context::get('module') != 'admin')
290
+		if (Context::get('module') != 'admin')
291 291
 		{
292 292
 			$this->setLayoutPath('./common/tpl');
293 293
 			$this->setLayoutFile('popup_layout');
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		$oModuleModel = getModel('module');
302 302
 		$output = $oModuleModel->getModuleFileBoxList();
303 303
 		$page = Context::get('page');
304
-		$page = $page?$page:1;
304
+		$page = $page ? $page : 1;
305 305
 		Context::set('filebox_list', $output->data);
306 306
 		Context::set('page_navigation', $output->page_navigation);
307 307
 		Context::set('page', $page);
Please login to merge, or discard this patch.
Braces   +16 added lines, -7 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 			// Set a template file
122 122
 			$this->setTemplateFile('category_update_form');
123 123
 			// If not selected, display a list of categories
124
-		}
125
-		else
124
+		} else
126 125
 		{
127 126
 			$category_list = $oModuleModel->getModuleCategories();
128 127
 			Context::set('category_list', $category_list);
@@ -165,7 +164,9 @@  discard block
 block discarded – undo
165 164
 		$module_srls = Context::get('module_srls');
166 165
 
167 166
 		$modules = explode(',',$module_srls);
168
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
167
+		if(!count($modules)) {
168
+			if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
169
+		}
169 170
 
170 171
 		$oModuleModel = getModel('module');
171 172
 		$columnList = array('module_srl', 'module');
@@ -201,7 +202,9 @@  discard block
 block discarded – undo
201 202
 		$module_srls = Context::get('module_srls');
202 203
 
203 204
 		$modules = explode(',',$module_srls);
204
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
205
+		if(!count($modules)) {
206
+			if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
207
+		}
205 208
 		// pre-define variables because you can get contents from other module (call by reference)
206 209
 		$content = '';
207 210
 		// Call a trigger for additional settings
@@ -224,7 +227,9 @@  discard block
 block discarded – undo
224 227
 		$module_srls = Context::get('module_srls');
225 228
 
226 229
 		$modules = explode(',',$module_srls);
227
-		if(!count($modules)) if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
230
+		if(!count($modules)) {
231
+			if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
232
+		}
228 233
 
229 234
 		$oModuleModel = getModel('module');
230 235
 		$columnList = array('module_srl', 'module', 'site_srl');
@@ -238,8 +243,12 @@  discard block
 block discarded – undo
238 243
 		{
239 244
 			foreach($source_grant_list as $key => $val)
240 245
 			{
241
-				if(!$val->default) $val->default = 'guest';
242
-				if($val->default == 'root') $val->default = 'manager';
246
+				if(!$val->default) {
247
+					$val->default = 'guest';
248
+				}
249
+				if($val->default == 'root') {
250
+					$val->default = 'manager';
251
+				}
243 252
 				$grant_list->{$key} = $val;
244 253
 			}
245 254
 		}
Please login to merge, or discard this patch.
modules/module/module.admin.model.php 2 patches
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass;
27 27
 		$args->module_srls = Context::get('module_srls');
28 28
 		$output = executeQueryArray('module.getModulesInfo', $args);
29
-		if(!$output->toBool() || !$output->data) return new BaseObject();
29
+		if (!$output->toBool() || !$output->data) return new BaseObject();
30 30
 
31
-		foreach($output->data as $key => $val)
31
+		foreach ($output->data as $key => $val)
32 32
 		{
33 33
 			$info_xml = $oModuleModel->getModuleInfoXml($val->module);
34 34
 			$oModuleController->replaceDefinedLangCode($val->browser_title);
35
-			$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
35
+			$list[$val->module_srl] = array('module_srl'=>$val->module_srl, 'mid'=>$val->mid, 'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
36 36
 		}
37
-		$modules = explode(',',$args->module_srls);
38
-		for($i=0;$i<count($modules);$i++)
37
+		$modules = explode(',', $args->module_srls);
38
+		for ($i = 0; $i < count($modules); $i++)
39 39
 		{
40 40
 			$module_list[$modules[$i]] = $list[$modules[$i]];
41 41
 		}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$args->list_count = 20;
50 50
 		$args->page_count = 10;
51 51
 		$output = executeQueryArray('module.getModuleMidList', $args);
52
-		if(!$output->toBool()) return $output;
52
+		if (!$output->toBool()) return $output;
53 53
 
54 54
 		ModuleModel::syncModuleToSite($output->data);
55 55
 
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
 	function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL)
60 60
 	{
61
-		if($modulePath)
61
+		if ($modulePath)
62 62
 		{
63 63
 			// get the skins path
64 64
 			$oModuleModel = getModel('module');
65 65
 			$skin_list = $oModuleModel->getSkins($modulePath);
66
-			Context::set('skin_list',$skin_list);
66
+			Context::set('skin_list', $skin_list);
67 67
 
68 68
 			$mskin_list = $oModuleModel->getSkins($modulePath, "m.skins");
69 69
 			Context::set('mskin_list', $mskin_list);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$layout_list = $oLayoutModel->getLayoutList();
75 75
 		Context::set('layout_list', $layout_list);
76 76
 
77
-		$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
77
+		$mobile_layout_list = $oLayoutModel->getLayoutList(0, "M");
78 78
 		Context::set('mlayout_list', $mobile_layout_list);
79 79
 
80 80
 		$security = new Security();
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
 		$security->encodeHTML('skin_list..title');
84 84
 		$security->encodeHTML('mskin_list..title');
85 85
 
86
-		$grant_list =new stdClass();
86
+		$grant_list = new stdClass();
87 87
 		// Grant virtual permission for access and manager
88
-		if(!$grantList)
88
+		if (!$grantList)
89 89
 		{
90
-			$grantList =new stdClass();
90
+			$grantList = new stdClass();
91 91
 		}
92 92
 		$grantList->access = new stdClass();
93 93
 		$grantList->access->title = Context::getLang('grant_access');
94 94
 		$grantList->access->default = 'guest';
95
-		if(count($grantList))
95
+		if (count($grantList))
96 96
 		{
97
-			foreach($grantList as $key => $val)
97
+			foreach ($grantList as $key => $val)
98 98
 			{
99
-				if(!$val->default) $val->default = 'guest';
100
-				if($val->default == 'root') $val->default = 'manager';
99
+				if (!$val->default) $val->default = 'guest';
100
+				if ($val->default == 'root') $val->default = 'manager';
101 101
 				$grant_list->{$key} = $val;
102 102
 			}
103 103
 		}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
120 120
 		Context::set('setup_content', $content);
121 121
 
122
-		if(count($tabChoice) == 0)
122
+		if (count($tabChoice) == 0)
123 123
 		{
124 124
 			$tabChoice = array('tab1'=>1, 'tab2'=>1, 'tab3'=>1);
125 125
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	function getModuleGrantHTML($module_srl, $source_grant_list)
138 138
 	{
139
-		if(!$module_srl)
139
+		if (!$module_srl)
140 140
 		{
141 141
 			return;
142 142
 		}
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 		$grant_list->access = new stdClass();
155 155
 		$grant_list->access->title = Context::getLang('grant_access');
156 156
 		$grant_list->access->default = 'guest';
157
-		if(count($source_grant_list))
157
+		if (count($source_grant_list))
158 158
 		{
159
-			foreach($source_grant_list as $key => $val)
159
+			foreach ($source_grant_list as $key => $val)
160 160
 			{
161
-				if(!$val->default) $val->default = 'guest';
162
-				if($val->default == 'root') $val->default = 'manager';
161
+				if (!$val->default) $val->default = 'guest';
162
+				if ($val->default == 'root') $val->default = 'manager';
163 163
 				$grant_list->{$key} = $val;
164 164
 			}
165 165
 		}
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 		$args = new stdClass();
173 173
 		$args->module_srl = $module_srl;
174 174
 		$output = executeQueryArray('module.getModuleGrants', $args);
175
-		if($output->data)
175
+		if ($output->data)
176 176
 		{
177
-			foreach($output->data as $val)
177
+			foreach ($output->data as $val)
178 178
 			{
179
-				if($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
-				else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
-				else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
-				else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
179
+				if ($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
+				else if ($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
+				else if ($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
+				else if ($val->group_srl == -3) $default_grant[$val->name] = 'manager';
183 183
 				else
184 184
 				{
185 185
 					$selected_group[$val->name][] = $val->group_srl;
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
 	{
214 214
 		$targetModule = Context::get('target_module');
215 215
 		$moduleSrl = Context::get('module_srl');
216
-		if(!$targetModule || !$moduleSrl)
216
+		if (!$targetModule || !$moduleSrl)
217 217
 		{
218 218
 			return new BaseObject(-1, 'msg_invalid_request');
219 219
 		}
220 220
 
221
-		if($targetModule == '_SHORTCUT')
221
+		if ($targetModule == '_SHORTCUT')
222 222
 		{
223 223
 			return new BaseObject(0);
224 224
 		}
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 		$grantList->access = new stdClass();
232 232
 		$grantList->access->title = Context::getLang('grant_access');
233 233
 		$grantList->access->default = 'guest';
234
-		if(count($xmlInfo->grant))
234
+		if (count($xmlInfo->grant))
235 235
 		{
236
-			foreach($xmlInfo->grant as $key => $val)
236
+			foreach ($xmlInfo->grant as $key => $val)
237 237
 			{
238
-				if(!$val->default) $val->default = 'guest';
239
-				if($val->default == 'root') $val->default = 'manager';
238
+				if (!$val->default) $val->default = 'guest';
239
+				if ($val->default == 'root') $val->default = 'manager';
240 240
 				$grantList->{$key} = $val;
241 241
 			}
242 242
 		}
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 		$args = new stdClass();
250 250
 		$args->module_srl = $moduleSrl;
251 251
 		$output = executeQueryArray('module.getModuleGrants', $args);
252
-		if($output->data)
252
+		if ($output->data)
253 253
 		{
254
-			foreach($output->data as $val)
254
+			foreach ($output->data as $val)
255 255
 			{
256
-				if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
-				else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
-				else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
-				else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
256
+				if ($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
+				else if ($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
+				else if ($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
+				else if ($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
260 260
 				else
261 261
 				{
262 262
 					$selectedGroup->{$val->name}[] = $val->group_srl;
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
 			}
266 266
 		}
267 267
 
268
-		if(is_object($grantList))
268
+		if (is_object($grantList))
269 269
 		{
270
-			foreach($grantList AS $key=>$value)
270
+			foreach ($grantList AS $key=>$value)
271 271
 			{
272
-				if(isset($defaultGrant->{$key}))
272
+				if (isset($defaultGrant->{$key}))
273 273
 				{
274 274
 					$grantList->{$key}->grant = $defaultGrant->{$key};
275 275
 				}
276
-				if(isset($selectedGroup->{$key}))
276
+				if (isset($selectedGroup->{$key}))
277 277
 				{
278 278
 					$grantList->{$key}->group_srls = $selectedGroup->{$key};
279 279
 				}
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 
316 316
 		$oModuleModel = getModel('module');
317 317
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
318
-		if(!$module_info) return;
318
+		if (!$module_info) return;
319 319
 
320
-		if($mode === 'P')
320
+		if ($mode === 'P')
321 321
 		{
322
-			if($module_info->is_skin_fix == 'N')
322
+			if ($module_info->is_skin_fix == 'N')
323 323
 			{
324 324
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
325 325
 			}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		}
331 331
 		else
332 332
 		{
333
-			if($module_info->is_mskin_fix == 'N')
333
+			if ($module_info->is_mskin_fix == 'N')
334 334
 			{
335 335
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
336 336
 			}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		$module_path = './modules/'.$module_info->module;
344 344
 
345 345
 		// Get XML information of the skin and skin sinformation set in DB
346
-		if($mode === 'P')
346
+		if ($mode === 'P')
347 347
 		{
348 348
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
349 349
 			$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
@@ -354,25 +354,25 @@  discard block
 block discarded – undo
354 354
 			$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
355 355
 		}
356 356
 
357
-		if(count($skin_info->extra_vars)) 
357
+		if (count($skin_info->extra_vars)) 
358 358
 		{
359
-			foreach($skin_info->extra_vars as $key => $val) 
359
+			foreach ($skin_info->extra_vars as $key => $val) 
360 360
 			{
361 361
 				$group = $val->group;
362 362
 				$name = $val->name;
363 363
 				$type = $val->type;
364
-				if($skin_vars[$name]) 
364
+				if ($skin_vars[$name]) 
365 365
 				{
366 366
 					$value = $skin_vars[$name]->value;
367 367
 				}
368 368
 				else $value = '';
369
-				if($type=="checkbox")
369
+				if ($type == "checkbox")
370 370
 				{
371
-					$value = $value?unserialize($value):array();
371
+					$value = $value ?unserialize($value) : array();
372 372
 				}
373 373
 
374 374
 				$value = empty($value) ? $val->default : $value;
375
-				$skin_info->extra_vars[$key]->value= $value;
375
+				$skin_info->extra_vars[$key]->value = $value;
376 376
 			}
377 377
 		}
378 378
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	function getLangCode($site_srl, $name, $isFullLanguage = FALSE)
400 400
 	{
401
-		if($isFullLanguage)
401
+		if ($isFullLanguage)
402 402
 		{
403 403
 			$lang_supported = Context::loadLangSupported();
404 404
 		}
@@ -407,15 +407,15 @@  discard block
 block discarded – undo
407 407
 			$lang_supported = Context::get('lang_supported');
408 408
 		}
409 409
 
410
-		if(substr($name,0,12)=='$user_lang->')
410
+		if (substr($name, 0, 12) == '$user_lang->')
411 411
 		{
412 412
 			$args = new stdClass();
413
-			$args->site_srl = (int)$site_srl;
414
-			$args->name = substr($name,12);
413
+			$args->site_srl = (int) $site_srl;
414
+			$args->name = substr($name, 12);
415 415
 			$output = executeQueryArray('module.getLang', $args);
416
-			if($output->data)
416
+			if ($output->data)
417 417
 			{
418
-				foreach($output->data as $key => $val)
418
+				foreach ($output->data as $key => $val)
419 419
 				{
420 420
 					$selected_lang[$val->lang_code] = $val->value;
421 421
 				}
@@ -424,24 +424,24 @@  discard block
 block discarded – undo
424 424
 		else
425 425
 		{
426 426
 			$tmp = unserialize($name);
427
-			if($tmp)
427
+			if ($tmp)
428 428
 			{
429 429
 				$selected_lang = array();
430 430
 				$rand_name = $tmp[Context::getLangType()];
431
-				if(!$rand_name) $rand_name = array_shift($tmp);
432
-				if(is_array($lang_supported))
431
+				if (!$rand_name) $rand_name = array_shift($tmp);
432
+				if (is_array($lang_supported))
433 433
 				{
434
-					foreach($lang_supported as $key => $val)
435
-						$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
434
+					foreach ($lang_supported as $key => $val)
435
+						$selected_lang[$key] = $tmp[$key] ? $tmp[$key] : $rand_name;
436 436
 				}
437 437
 			}
438 438
 		}
439 439
 
440 440
 		$output = array();
441
-		if(is_array($lang_supported))
441
+		if (is_array($lang_supported))
442 442
 		{
443
-			foreach($lang_supported as $key => $val)
444
-				$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
443
+			foreach ($lang_supported as $key => $val)
444
+				$output[$key] = $selected_lang[$key] ? $selected_lang[$key] : $name;
445 445
 		}
446 446
 		return $output;
447 447
 	}
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	function getModuleAdminLangCode()
453 453
 	{
454 454
 		$name = Context::get('name');
455
-		if(!$name) return new BaseObject(-1,'msg_invalid_request');
455
+		if (!$name) return new BaseObject(-1, 'msg_invalid_request');
456 456
 		$site_module_info = Context::get('site_module_info');
457 457
 		$this->add('name', $name);
458 458
 		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	function getModuleAdminLangListByName()
466 466
 	{
467 467
 		$args = Context::getRequestVars();
468
-		if(!$args->site_srl) $args->site_srl = 0;
468
+		if (!$args->site_srl) $args->site_srl = 0;
469 469
 
470 470
 		$columnList = array('lang_code', 'name', 'value');
471 471
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 
474 474
 		$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
475 475
 		$output = executeQueryArray('module.getLangListByName', $args, $columnList);
476
-		if($output->toBool()) $langList = $output->data;
476
+		if ($output->toBool()) $langList = $output->data;
477 477
 
478 478
 		$this->add('lang_list', $langList);
479 479
 		$this->add('lang_name', $args->langName);
@@ -485,23 +485,23 @@  discard block
 block discarded – undo
485 485
 	function getModuleAdminLangListByValue()
486 486
 	{
487 487
 		$args = Context::getRequestVars();
488
-		if(!$args->site_srl) $args->site_srl = 0;
488
+		if (!$args->site_srl) $args->site_srl = 0;
489 489
 
490 490
 		$langList = array();
491 491
 
492 492
 		// search value
493 493
 		$output = executeQueryArray('module.getLangNameByValue', $args);
494
-		if($output->toBool() && is_array($output->data))
494
+		if ($output->toBool() && is_array($output->data))
495 495
 		{
496 496
 			unset($args->value);
497 497
 
498
-			foreach($output->data as $data)
498
+			foreach ($output->data as $data)
499 499
 			{
500 500
 				$args->langName = $data->name;
501 501
 				$columnList = array('lang_code', 'name', 'value');
502 502
 				$outputByName = executeQueryArray('module.getLangListByName', $args, $columnList);
503 503
 
504
-				if($outputByName->toBool())
504
+				if ($outputByName->toBool())
505 505
 				{
506 506
 					$langList = array_merge($langList, $outputByName->data);
507 507
 				}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	function getLangListByLangcode($args)
518 518
 	{
519 519
 		$output = executeQueryArray('module.getLangListByLangcode', $args);
520
-		if(!$output->toBool()) return array();
520
+		if (!$output->toBool()) return array();
521 521
 
522 522
 		return $output;
523 523
 	}
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	function getModuleAdminMultilingualHtml()
529 529
 	{
530 530
 		$oTemplate = TemplateHandler::getInstance();
531
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17.html');
531
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17.html');
532 532
 
533 533
 		$this->add('html', $tpl);
534 534
 	}
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	{
541 541
 		$site_module_info = Context::get('site_module_info');
542 542
 		$args = new stdClass();
543
-		$args->site_srl = (int)$site_module_info->site_srl;
543
+		$args->site_srl = (int) $site_module_info->site_srl;
544 544
 		$args->langCode = Context::get('lang_code');
545 545
 		$args->page = Context::get('page');
546 546
 		$args->sort_index = 'name';
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$args->list_count = Context::get('list_count');
551 551
 		$args->page_count = 5;
552 552
 
553
-		if(!$args->langCode)
553
+		if (!$args->langCode)
554 554
 		{
555 555
 			$args->langCode = Context::get('lang_type');
556 556
 		}
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		$oSecurity->encodeHTML('lang_code_list..');
568 568
 
569 569
 		$oTemplate = TemplateHandler::getInstance();
570
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17_list.html');
570
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17_list.html');
571 571
 
572 572
 		$this->add('html', $tpl);
573 573
 	}
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
 	 */
578 578
 	function getModuleAdminModuleSearcherHtml()
579 579
 	{
580
-		Context::loadLang(_XE_PATH_ . 'modules/admin/lang');
580
+		Context::loadLang(_XE_PATH_.'modules/admin/lang');
581 581
 		$oTemplate = TemplateHandler::getInstance();
582
-		$tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'module_searcher_v17.html');
582
+		$tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'module_searcher_v17.html');
583 583
 
584 584
 		$this->add('html', $tpl);
585 585
 	}
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 	 */
590 590
 	function getModuleAdminModuleInfo()
591 591
 	{
592
-		if(Context::get('search_module_srl'))
592
+		if (Context::get('search_module_srl'))
593 593
 		{
594 594
 			$module_srl = Context::get('search_module_srl');
595 595
 		}
Please login to merge, or discard this patch.
Braces   +78 added lines, -44 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass;
27 27
 		$args->module_srls = Context::get('module_srls');
28 28
 		$output = executeQueryArray('module.getModulesInfo', $args);
29
-		if(!$output->toBool() || !$output->data) return new BaseObject();
29
+		if(!$output->toBool() || !$output->data) {
30
+			return new BaseObject();
31
+		}
30 32
 
31 33
 		foreach($output->data as $key => $val)
32 34
 		{
@@ -49,7 +51,9 @@  discard block
 block discarded – undo
49 51
 		$args->list_count = 20;
50 52
 		$args->page_count = 10;
51 53
 		$output = executeQueryArray('module.getModuleMidList', $args);
52
-		if(!$output->toBool()) return $output;
54
+		if(!$output->toBool()) {
55
+			return $output;
56
+		}
53 57
 
54 58
 		ModuleModel::syncModuleToSite($output->data);
55 59
 
@@ -96,8 +100,12 @@  discard block
 block discarded – undo
96 100
 		{
97 101
 			foreach($grantList as $key => $val)
98 102
 			{
99
-				if(!$val->default) $val->default = 'guest';
100
-				if($val->default == 'root') $val->default = 'manager';
103
+				if(!$val->default) {
104
+					$val->default = 'guest';
105
+				}
106
+				if($val->default == 'root') {
107
+					$val->default = 'manager';
108
+				}
101 109
 				$grant_list->{$key} = $val;
102 110
 			}
103 111
 		}
@@ -158,8 +166,12 @@  discard block
 block discarded – undo
158 166
 		{
159 167
 			foreach($source_grant_list as $key => $val)
160 168
 			{
161
-				if(!$val->default) $val->default = 'guest';
162
-				if($val->default == 'root') $val->default = 'manager';
169
+				if(!$val->default) {
170
+					$val->default = 'guest';
171
+				}
172
+				if($val->default == 'root') {
173
+					$val->default = 'manager';
174
+				}
163 175
 				$grant_list->{$key} = $val;
164 176
 			}
165 177
 		}
@@ -176,11 +188,15 @@  discard block
 block discarded – undo
176 188
 		{
177 189
 			foreach($output->data as $val)
178 190
 			{
179
-				if($val->group_srl == 0) $default_grant[$val->name] = 'all';
180
-				else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
181
-				else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
182
-				else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
183
-				else
191
+				if($val->group_srl == 0) {
192
+					$default_grant[$val->name] = 'all';
193
+				} else if($val->group_srl == -1) {
194
+					$default_grant[$val->name] = 'member';
195
+				} else if($val->group_srl == -2) {
196
+					$default_grant[$val->name] = 'site';
197
+				} else if($val->group_srl == -3) {
198
+					$default_grant[$val->name] = 'manager';
199
+				} else
184 200
 				{
185 201
 					$selected_group[$val->name][] = $val->group_srl;
186 202
 					$default_grant[$val->name] = 'group';
@@ -235,8 +251,12 @@  discard block
 block discarded – undo
235 251
 		{
236 252
 			foreach($xmlInfo->grant as $key => $val)
237 253
 			{
238
-				if(!$val->default) $val->default = 'guest';
239
-				if($val->default == 'root') $val->default = 'manager';
254
+				if(!$val->default) {
255
+					$val->default = 'guest';
256
+				}
257
+				if($val->default == 'root') {
258
+					$val->default = 'manager';
259
+				}
240 260
 				$grantList->{$key} = $val;
241 261
 			}
242 262
 		}
@@ -253,11 +273,15 @@  discard block
 block discarded – undo
253 273
 		{
254 274
 			foreach($output->data as $val)
255 275
 			{
256
-				if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
257
-				else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
258
-				else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
259
-				else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
260
-				else
276
+				if($val->group_srl == 0) {
277
+					$defaultGrant->{$val->name} = 'all';
278
+				} else if($val->group_srl == -1) {
279
+					$defaultGrant->{$val->name} = 'member';
280
+				} else if($val->group_srl == -2) {
281
+					$defaultGrant->{$val->name} = 'site';
282
+				} else if($val->group_srl == -3) {
283
+					$defaultGrant->{$val->name} = 'manager';
284
+				} else
261 285
 				{
262 286
 					$selectedGroup->{$val->name}[] = $val->group_srl;
263 287
 					$defaultGrant->{$val->name} = 'group';
@@ -315,26 +339,25 @@  discard block
 block discarded – undo
315 339
 
316 340
 		$oModuleModel = getModel('module');
317 341
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
318
-		if(!$module_info) return;
342
+		if(!$module_info) {
343
+			return;
344
+		}
319 345
 
320 346
 		if($mode === 'P')
321 347
 		{
322 348
 			if($module_info->is_skin_fix == 'N')
323 349
 			{
324 350
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
325
-			}
326
-			else
351
+			} else
327 352
 			{
328 353
 				$skin = $module_info->skin;
329 354
 			}
330
-		}
331
-		else
355
+		} else
332 356
 		{
333 357
 			if($module_info->is_mskin_fix == 'N')
334 358
 			{
335 359
 				$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
336
-			}
337
-			else
360
+			} else
338 361
 			{
339 362
 				$skin = $module_info->mskin;
340 363
 			}
@@ -347,8 +370,7 @@  discard block
 block discarded – undo
347 370
 		{
348 371
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
349 372
 			$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
350
-		}
351
-		else
373
+		} else
352 374
 		{
353 375
 			$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
354 376
 			$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
@@ -364,8 +386,9 @@  discard block
 block discarded – undo
364 386
 				if($skin_vars[$name]) 
365 387
 				{
366 388
 					$value = $skin_vars[$name]->value;
389
+				} else {
390
+					$value = '';
367 391
 				}
368
-				else $value = '';
369 392
 				if($type=="checkbox")
370 393
 				{
371 394
 					$value = $value?unserialize($value):array();
@@ -401,8 +424,7 @@  discard block
 block discarded – undo
401 424
 		if($isFullLanguage)
402 425
 		{
403 426
 			$lang_supported = Context::loadLangSupported();
404
-		}
405
-		else
427
+		} else
406 428
 		{
407 429
 			$lang_supported = Context::get('lang_supported');
408 430
 		}
@@ -420,19 +442,21 @@  discard block
 block discarded – undo
420 442
 					$selected_lang[$val->lang_code] = $val->value;
421 443
 				}
422 444
 			}
423
-		}
424
-		else
445
+		} else
425 446
 		{
426 447
 			$tmp = unserialize($name);
427 448
 			if($tmp)
428 449
 			{
429 450
 				$selected_lang = array();
430 451
 				$rand_name = $tmp[Context::getLangType()];
431
-				if(!$rand_name) $rand_name = array_shift($tmp);
452
+				if(!$rand_name) {
453
+					$rand_name = array_shift($tmp);
454
+				}
432 455
 				if(is_array($lang_supported))
433 456
 				{
434
-					foreach($lang_supported as $key => $val)
435
-						$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
457
+					foreach($lang_supported as $key => $val) {
458
+											$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
459
+					}
436 460
 				}
437 461
 			}
438 462
 		}
@@ -440,8 +464,9 @@  discard block
 block discarded – undo
440 464
 		$output = array();
441 465
 		if(is_array($lang_supported))
442 466
 		{
443
-			foreach($lang_supported as $key => $val)
444
-				$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
467
+			foreach($lang_supported as $key => $val) {
468
+							$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
469
+			}
445 470
 		}
446 471
 		return $output;
447 472
 	}
@@ -452,7 +477,9 @@  discard block
 block discarded – undo
452 477
 	function getModuleAdminLangCode()
453 478
 	{
454 479
 		$name = Context::get('name');
455
-		if(!$name) return new BaseObject(-1,'msg_invalid_request');
480
+		if(!$name) {
481
+			return new BaseObject(-1,'msg_invalid_request');
482
+		}
456 483
 		$site_module_info = Context::get('site_module_info');
457 484
 		$this->add('name', $name);
458 485
 		$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
@@ -465,7 +492,9 @@  discard block
 block discarded – undo
465 492
 	function getModuleAdminLangListByName()
466 493
 	{
467 494
 		$args = Context::getRequestVars();
468
-		if(!$args->site_srl) $args->site_srl = 0;
495
+		if(!$args->site_srl) {
496
+			$args->site_srl = 0;
497
+		}
469 498
 
470 499
 		$columnList = array('lang_code', 'name', 'value');
471 500
 
@@ -473,7 +502,9 @@  discard block
 block discarded – undo
473 502
 
474 503
 		$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
475 504
 		$output = executeQueryArray('module.getLangListByName', $args, $columnList);
476
-		if($output->toBool()) $langList = $output->data;
505
+		if($output->toBool()) {
506
+			$langList = $output->data;
507
+		}
477 508
 
478 509
 		$this->add('lang_list', $langList);
479 510
 		$this->add('lang_name', $args->langName);
@@ -485,7 +516,9 @@  discard block
 block discarded – undo
485 516
 	function getModuleAdminLangListByValue()
486 517
 	{
487 518
 		$args = Context::getRequestVars();
488
-		if(!$args->site_srl) $args->site_srl = 0;
519
+		if(!$args->site_srl) {
520
+			$args->site_srl = 0;
521
+		}
489 522
 
490 523
 		$langList = array();
491 524
 
@@ -517,7 +550,9 @@  discard block
 block discarded – undo
517 550
 	function getLangListByLangcode($args)
518 551
 	{
519 552
 		$output = executeQueryArray('module.getLangListByLangcode', $args);
520
-		if(!$output->toBool()) return array();
553
+		if(!$output->toBool()) {
554
+			return array();
555
+		}
521 556
 
522 557
 		return $output;
523 558
 	}
@@ -592,8 +627,7 @@  discard block
 block discarded – undo
592 627
 		if(Context::get('search_module_srl'))
593 628
 		{
594 629
 			$module_srl = Context::get('search_module_srl');
595
-		}
596
-		else
630
+		} else
597 631
 		{
598 632
 			$module_srl = Context::get('module_srl');
599 633
 		}
Please login to merge, or discard this patch.
modules/comment/comment.model.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		$oCommentController = getController('comment');
44 44
 
45 45
 		// feature that only member can do
46
-		if($logged_info->member_srl)
46
+		if ($logged_info->member_srl)
47 47
 		{
48 48
 			$oCommentModel = getModel('comment');
49 49
 			$columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress');
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 			$oModuleModel = getModel('module');
55 55
 			$comment_config = $oModuleModel->getModulePartConfig('document', $module_srl);
56 56
 
57
-			if($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
57
+			if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
58 58
 			{
59 59
 				// Add a vote-up button for positive feedback
60 60
 				$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
61 61
 				$oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript');
62 62
 			}
63 63
 
64
-			if($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
64
+			if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
65 65
 			{
66 66
 				// Add a vote-down button for negative feedback
67 67
 				$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
@@ -76,20 +76,20 @@  discard block
 block discarded – undo
76 76
 		// call a trigger (after)
77 77
 		ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
78 78
 
79
-		if($this->grant->manager){
79
+		if ($this->grant->manager) {
80 80
 			$str_confirm = Context::getLang('confirm_move');
81 81
 			$url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['comment_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('comment', 'procCommentAdminMoveToTrash', params)", $str_confirm, $comment_srl);
82
-			$oCommentController->addCommentPopupMenu($url,'cmd_trash','','javascript');
82
+			$oCommentController->addCommentPopupMenu($url, 'cmd_trash', '', 'javascript');
83 83
 
84 84
 		}
85 85
 
86 86
 		// find a comment by IP matching if an administrator.
87
-		if($logged_info->is_admin == 'Y')
87
+		if ($logged_info->is_admin == 'Y')
88 88
 		{
89 89
 			$oCommentModel = getModel('comment');
90 90
 			$oComment = $oCommentModel->getComment($comment_srl);
91 91
 
92
-			if($oComment->isExists())
92
+			if ($oComment->isExists())
93 93
 			{
94 94
 				// Find a post of the corresponding ip address
95 95
 				$url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress());
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		$menus = Context::get('comment_popup_menu_list');
105 105
 		$menus_count = count($menus);
106 106
 
107
-		for($i = 0; $i < $menus_count; $i++)
107
+		for ($i = 0; $i < $menus_count; $i++)
108 108
 		{
109 109
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
110 110
 		}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	function getComment($comment_srl = 0, $is_admin = FALSE, $columnList = array())
161 161
 	{
162 162
 		$oComment = new commentItem($comment_srl, $columnList);
163
-		if($is_admin)
163
+		if ($is_admin)
164 164
 		{
165 165
 			$oComment->setGrant();
166 166
 		}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	function getComments($comment_srl_list, $columnList = array())
178 178
 	{
179
-		if(is_array($comment_srl_list))
179
+		if (is_array($comment_srl_list))
180 180
 		{
181 181
 			$comment_srls = implode(',', $comment_srl_list);
182 182
 		}
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$args = new stdClass();
186 186
 		$args->comment_srls = $comment_srls;
187 187
 		$output = executeQuery('comment.getComments', $args, $columnList);
188
-		if(!$output->toBool())
188
+		if (!$output->toBool())
189 189
 		{
190 190
 			return;
191 191
 		}
192 192
 
193 193
 		$comment_list = $output->data;
194
-		if(!$comment_list)
194
+		if (!$comment_list)
195 195
 		{
196 196
 			return;
197 197
 		}
198
-		if(!is_array($comment_list))
198
+		if (!is_array($comment_list))
199 199
 		{
200 200
 			$comment_list = array($comment_list);
201 201
 		}
202 202
 
203 203
 		$comment_count = count($comment_list);
204
-		foreach($comment_list as $key => $attribute)
204
+		foreach ($comment_list as $key => $attribute)
205 205
 		{
206
-			if(!$attribute->comment_srl)
206
+			if (!$attribute->comment_srl)
207 207
 			{
208 208
 				continue;
209 209
 			}
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			$oComment = NULL;
212 212
 			$oComment = new commentItem();
213 213
 			$oComment->setAttribute($attribute);
214
-			if($is_admin)
214
+			if ($is_admin)
215 215
 			{
216 216
 				$oComment->setGrant();
217 217
 			}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		$oDocument = $oDocumentModel->getDocument($document_srl, FALSE, TRUE, $columnList);
239 239
 
240 240
 		// return if no doc exists.
241
-		if(!$oDocument->isExists())
241
+		if (!$oDocument->isExists())
242 242
 		{
243 243
 			return;
244 244
 		}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		$oCommentController = getController('comment');
251 251
 
252 252
 		$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
253
-		if($using_validation)
253
+		if ($using_validation)
254 254
 		{
255 255
 			$args->status = 1;
256 256
 		}
@@ -269,18 +269,18 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	function getCommentCountByDate($date = '', $moduleSrlList = array())
271 271
 	{
272
-		if($date)
272
+		if ($date)
273 273
 		{
274 274
 			$args->regDate = date('Ymd', strtotime($date));
275 275
 		}
276 276
 
277
-		if(count($moduleSrlList) > 0)
277
+		if (count($moduleSrlList) > 0)
278 278
 		{
279 279
 			$args->module_srl = $moduleSrlList;
280 280
 		}
281 281
 
282 282
 		$output = executeQuery('comment.getCommentCount', $args);
283
-		if(!$output->toBool())
283
+		if (!$output->toBool())
284 284
 		{
285 285
 			return 0;
286 286
 		}
@@ -299,19 +299,19 @@  discard block
 block discarded – undo
299 299
 		$args = new stdClass();
300 300
 		$args->module_srl = $module_srl;
301 301
 
302
-		if(is_null($published))
302
+		if (is_null($published))
303 303
 		{
304 304
 			// check if module is using comment validation system
305 305
 			$oCommentController = getController("comment");
306 306
 			$is_using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
307
-			if($is_using_validation)
307
+			if ($is_using_validation)
308 308
 			{
309 309
 				$args->status = 1;
310 310
 			}
311 311
 		}
312 312
 		else
313 313
 		{
314
-			if($published)
314
+			if ($published)
315 315
 			{
316 316
 				$args->status = 1;
317 317
 			}
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	{
364 364
 		$args = new stdClass();
365 365
 
366
-		if(!is_object($obj))
366
+		if (!is_object($obj))
367 367
 		{
368 368
 			$obj = new stdClass();
369 369
 		}
370 370
 
371
-		if($obj->mid)
371
+		if ($obj->mid)
372 372
 		{
373 373
 			$oModuleModel = getModel('module');
374 374
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		// check if module_srl is an arrary.
379
-		if(is_array($obj->module_srl))
379
+		if (is_array($obj->module_srl))
380 380
 		{
381 381
 			$args->module_srl = implode(',', $obj->module_srl);
382 382
 		}
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
 		$args->document_srl = $obj->document_srl;
389 389
 		$args->list_count = $obj->list_count;
390 390
 
391
-		if(strpos($args->module_srl, ",") === false)
391
+		if (strpos($args->module_srl, ",") === false)
392 392
 		{
393
-			if($args->module_srl)
393
+			if ($args->module_srl)
394 394
 			{
395 395
 				// check if module is using comment validation system
396 396
 				$oCommentController = getController("comment");
397 397
 				$is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl);
398
-				if($is_using_validation)
398
+				if ($is_using_validation)
399 399
 				{
400 400
 					$args->status = 1;
401 401
 				}
@@ -404,24 +404,24 @@  discard block
 block discarded – undo
404 404
 
405 405
 		$output = executeQuery('comment.getNewestCommentList', $args, $columnList);
406 406
 
407
-		if(!$output->toBool())
407
+		if (!$output->toBool())
408 408
 		{
409 409
 			return $output;
410 410
 		}
411 411
 
412 412
 		$comment_list = $output->data;
413
-		if($comment_list)
413
+		if ($comment_list)
414 414
 		{
415
-			if(!is_array($comment_list))
415
+			if (!is_array($comment_list))
416 416
 			{
417 417
 				$comment_list = array($comment_list);
418 418
 			}
419 419
 
420 420
 			$comment_count = count($comment_list);
421 421
 
422
-			foreach($comment_list as $key => $attribute)
422
+			foreach ($comment_list as $key => $attribute)
423 423
 			{
424
-				if(!$attribute->comment_srl)
424
+				if (!$attribute->comment_srl)
425 425
 				{
426 426
 					continue;
427 427
 				}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	function getCommentList($document_srl, $page = 0, $is_admin = FALSE, $count = 0)
450 450
 	{
451
-		if(!isset($document_srl))
451
+		if (!isset($document_srl))
452 452
 		{
453 453
 			return;
454 454
 		}
@@ -459,13 +459,13 @@  discard block
 block discarded – undo
459 459
 		$oDocument = $oDocumentModel->getDocument($document_srl, FALSE, TRUE, $columnList);
460 460
 
461 461
 		// return if no doc exists.
462
-		if(!$oDocument->isExists())
462
+		if (!$oDocument->isExists())
463 463
 		{
464 464
 			return;
465 465
 		}
466 466
 
467 467
 		// return if no comment exists
468
-		if($oDocument->getCommentCount() < 1)
468
+		if ($oDocument->getCommentCount() < 1)
469 469
 		{
470 470
 			return;
471 471
 		}
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 		// get a list of comments
474 474
 		$module_srl = $oDocument->get('module_srl');
475 475
 
476
-		if(!$count)
476
+		if (!$count)
477 477
 		{
478 478
 			$comment_config = $this->getCommentConfig($module_srl);
479 479
 			$comment_count = $comment_config->comment_count;
480
-			if(!$comment_count)
480
+			if (!$comment_count)
481 481
 			{
482 482
 				$comment_count = 50;
483 483
 			}
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
 		}
489 489
 
490 490
 		// get a very last page if no page exists
491
-		if(!$page)
491
+		if (!$page)
492 492
 		{
493
-			$page = (int) ( ($oDocument->getCommentCount() - 1) / $comment_count) + 1;
493
+			$page = (int) (($oDocument->getCommentCount() - 1) / $comment_count) + 1;
494 494
 		}
495 495
 
496 496
 		// get a list of comments
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		//check if module is using validation system
504 504
 		$oCommentController = getController('comment');
505 505
 		$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
506
-		if($using_validation)
506
+		if ($using_validation)
507 507
 		{
508 508
 			$args->status = 1;
509 509
 		}
@@ -511,17 +511,17 @@  discard block
 block discarded – undo
511 511
 		$output = executeQueryArray('comment.getCommentPageList', $args);
512 512
 
513 513
 		// return if an error occurs in the query results
514
-		if(!$output->toBool())
514
+		if (!$output->toBool())
515 515
 		{
516 516
 			return;
517 517
 		}
518 518
 
519 519
 		// insert data into CommentPageList table if the number of results is different from stored comments
520
-		if(!$output->data)
520
+		if (!$output->data)
521 521
 		{
522 522
 			$this->fixCommentList($oDocument->get('module_srl'), $document_srl);
523 523
 			$output = executeQueryArray('comment.getCommentPageList', $args);
524
-			if(!$output->toBool())
524
+			if (!$output->toBool())
525 525
 			{
526 526
 				return;
527 527
 			}
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
 	function fixCommentList($module_srl, $document_srl)
541 541
 	{
542 542
 		// create a lock file to prevent repeated work when performing a batch job
543
-		$lock_file = "./files/cache/tmp/lock." . $document_srl;
543
+		$lock_file = "./files/cache/tmp/lock.".$document_srl;
544 544
 
545
-		if(file_exists($lock_file) && filemtime($lock_file) + 60 * 60 * 10 < $_SERVER['REQUEST_TIME'])
545
+		if (file_exists($lock_file) && filemtime($lock_file) + 60 * 60 * 10 < $_SERVER['REQUEST_TIME'])
546 546
 		{
547 547
 			return;
548 548
 		}
@@ -554,13 +554,13 @@  discard block
 block discarded – undo
554 554
 		$args->document_srl = $document_srl;
555 555
 		$args->list_order = 'list_order';
556 556
 		$output = executeQuery('comment.getCommentList', $args);
557
-		if(!$output->toBool())
557
+		if (!$output->toBool())
558 558
 		{
559 559
 			return $output;
560 560
 		}
561 561
 
562 562
 		$source_list = $output->data;
563
-		if(!is_array($source_list))
563
+		if (!is_array($source_list))
564 564
 		{
565 565
 			$source_list = array($source_list);
566 566
 		}
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 		$logged_info = Context::get('logged_info');
577 577
 
578 578
 		// generate a hierarchical structure of comments for loop
579
-		for($i = $comment_count - 1; $i >= 0; $i--)
579
+		for ($i = $comment_count - 1; $i >= 0; $i--)
580 580
 		{
581 581
 			$comment_srl = $source_list[$i]->comment_srl;
582 582
 			$parent_srl = $source_list[$i]->parent_srl;
583
-			if(!$comment_srl)
583
+			if (!$comment_srl)
584 584
 			{
585 585
 				continue;
586 586
 			}
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 			// generate a list
589 589
 			$list[$comment_srl] = $source_list[$i];
590 590
 
591
-			if($parent_srl)
591
+			if ($parent_srl)
592 592
 			{
593 593
 				$list[$parent_srl]->child[] = &$list[$comment_srl];
594 594
 			}
@@ -600,9 +600,9 @@  discard block
 block discarded – undo
600 600
 		$this->_arrangeComment($comment_list, $root->child, 0, NULL);
601 601
 
602 602
 		// insert values to the database
603
-		if(count($comment_list))
603
+		if (count($comment_list))
604 604
 		{
605
-			foreach($comment_list as $comment_srl => $item)
605
+			foreach ($comment_list as $comment_srl => $item)
606 606
 			{
607 607
 				$comment_args = new stdClass();
608 608
 				$comment_args->comment_srl = $comment_srl;
@@ -631,14 +631,14 @@  discard block
 block discarded – undo
631 631
 	 */
632 632
 	function _arrangeComment(&$comment_list, $list, $depth, $parent = NULL)
633 633
 	{
634
-		if(!count($list))
634
+		if (!count($list))
635 635
 		{
636 636
 			return;
637 637
 		}
638 638
 
639
-		foreach($list as $key => $val)
639
+		foreach ($list as $key => $val)
640 640
 		{
641
-			if($parent)
641
+			if ($parent)
642 642
 			{
643 643
 				$val->head = $parent->head;
644 644
 			}
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 
650 650
 			$val->arrange = count($comment_list) + 1;
651 651
 
652
-			if($val->child)
652
+			if ($val->child)
653 653
 			{
654 654
 				$val->depth = $depth;
655 655
 				$comment_list[$val->comment_srl] = $val;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		// check if module is using comment validation system
687 687
 		$oCommentController = getController("comment");
688 688
 		$is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl);
689
-		if($is_using_validation)
689
+		if ($is_using_validation)
690 690
 		{
691 691
 			$args->s_is_published = 1;
692 692
 		}
@@ -694,12 +694,12 @@  discard block
 block discarded – undo
694 694
 		// Search options
695 695
 		$search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target'));
696 696
 		$search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword'));
697
-		if($search_target && $search_keyword)
697
+		if ($search_target && $search_keyword)
698 698
 		{
699
-			switch($search_target)
699
+			switch ($search_target)
700 700
 			{
701 701
 				case 'content' :
702
-					if($search_keyword)
702
+					if ($search_keyword)
703 703
 					{
704 704
 						$search_keyword = str_replace(' ', '%', $search_keyword);
705 705
 					}
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 					break;
709 709
 
710 710
 				case 'user_id' :
711
-					if($search_keyword)
711
+					if ($search_keyword)
712 712
 					{
713 713
 						$search_keyword = str_replace(' ', '%', $search_keyword);
714 714
 					}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 					break;
720 720
 
721 721
 				case 'user_name' :
722
-					if($search_keyword)
722
+					if ($search_keyword)
723 723
 					{
724 724
 						$search_keyword = str_replace(' ', '%', $search_keyword);
725 725
 					}
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 					break;
729 729
 
730 730
 				case 'nick_name' :
731
-					if($search_keyword)
731
+					if ($search_keyword)
732 732
 					{
733 733
 						$search_keyword = str_replace(' ', '%', $search_keyword);
734 734
 					}
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 					break;
738 738
 
739 739
 				case 'email_address' :
740
-					if($search_keyword)
740
+					if ($search_keyword)
741 741
 					{
742 742
 						$search_keyword = str_replace(' ', '%', $search_keyword);
743 743
 					}
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 					break;
747 747
 
748 748
 				case 'homepage' :
749
-					if($search_keyword)
749
+					if ($search_keyword)
750 750
 					{
751 751
 						$search_keyword = str_replace(' ', '%', $search_keyword);
752 752
 					}
@@ -771,12 +771,12 @@  discard block
 block discarded – undo
771 771
 					break;
772 772
 
773 773
 				case 'is_published' :
774
-					if($search_keyword == 'Y')
774
+					if ($search_keyword == 'Y')
775 775
 					{
776 776
 						$args->s_is_published = 1;
777 777
 					}
778 778
 
779
-					if($search_keyword == 'N')
779
+					if ($search_keyword == 'N')
780 780
 					{
781 781
 						$args->s_is_published = 0;
782 782
 					}
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 					break;
789 789
 
790 790
 				case 'member_srl' :
791
-					$args->{"s_" . $search_target} = (int) $search_keyword;
791
+					$args->{"s_".$search_target} = (int) $search_keyword;
792 792
 					break;
793 793
 			}
794 794
 		}
@@ -797,12 +797,12 @@  discard block
 block discarded – undo
797 797
 		$output = executeQueryArray($query_id, $args, $columnList);
798 798
 
799 799
 		// return when no result or error occurance
800
-		if(!$output->toBool() || !count($output->data))
800
+		if (!$output->toBool() || !count($output->data))
801 801
 		{
802 802
 			return $output;
803 803
 		}
804 804
 
805
-		foreach($output->data as $key => $val)
805
+		foreach ($output->data as $key => $val)
806 806
 		{
807 807
 			unset($_oComment);
808 808
 			$_oComment = new CommentItem(0);
@@ -831,12 +831,12 @@  discard block
 block discarded – undo
831 831
 		$search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target'));
832 832
 		$search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword'));
833 833
 
834
-		if($search_target && $search_keyword)
834
+		if ($search_target && $search_keyword)
835 835
 		{
836
-			switch($search_target)
836
+			switch ($search_target)
837 837
 			{
838 838
 				case 'content' :
839
-					if($search_keyword)
839
+					if ($search_keyword)
840 840
 					{
841 841
 						$search_keyword = str_replace(' ', '%', $search_keyword);
842 842
 					}
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 					break;
846 846
 
847 847
 				case 'user_id' :
848
-					if($search_keyword)
848
+					if ($search_keyword)
849 849
 					{
850 850
 						$search_keyword = str_replace(' ', '%', $search_keyword);
851 851
 					}
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 					break;
856 856
 
857 857
 				case 'user_name' :
858
-					if($search_keyword)
858
+					if ($search_keyword)
859 859
 					{
860 860
 						$search_keyword = str_replace(' ', '%', $search_keyword);
861 861
 					}
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 					break;
865 865
 
866 866
 				case 'nick_name' :
867
-					if($search_keyword)
867
+					if ($search_keyword)
868 868
 					{
869 869
 						$search_keyword = str_replace(' ', '%', $search_keyword);
870 870
 					}
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 					break;
874 874
 
875 875
 				case 'email_address' :
876
-					if($search_keyword)
876
+					if ($search_keyword)
877 877
 					{
878 878
 						$search_keyword = str_replace(' ', '%', $search_keyword);
879 879
 					}
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 					break;
883 883
 
884 884
 				case 'homepage' :
885
-					if($search_keyword)
885
+					if ($search_keyword)
886 886
 					{
887 887
 						$search_keyword = str_replace(' ', '%', $search_keyword);
888 888
 					}
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 					break;
908 908
 
909 909
 				case 'member_srl' :
910
-					$args->{"s_" . $search_target} = (int) $search_keyword;
910
+					$args->{"s_".$search_target} = (int) $search_keyword;
911 911
 					break;
912 912
 			}
913 913
 		}
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 		$output = executeQueryArray($query_id, $args);
916 916
 
917 917
 		// return when no result or error occurance
918
-		if(!$output->toBool() || !count($output->data))
918
+		if (!$output->toBool() || !count($output->data))
919 919
 		{
920 920
 			return $output;
921 921
 		}
@@ -932,12 +932,12 @@  discard block
 block discarded – undo
932 932
 	{
933 933
 		$oModuleModel = getModel('module');
934 934
 		$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
935
-		if(!is_object($comment_config))
935
+		if (!is_object($comment_config))
936 936
 		{
937 937
 			$comment_config = new stdClass();
938 938
 		}
939 939
 
940
-		if(!isset($comment_config->comment_count))
940
+		if (!isset($comment_config->comment_count))
941 941
 		{
942 942
 			$comment_config->comment_count = 50;
943 943
 		}
@@ -952,13 +952,13 @@  discard block
 block discarded – undo
952 952
 	function getCommentVotedMemberList()
953 953
 	{
954 954
 		$comment_srl = Context::get('comment_srl');
955
-		if(!$comment_srl)
955
+		if (!$comment_srl)
956 956
 		{
957 957
 			return new BaseObject(-1, 'msg_invalid_request');
958 958
 		}
959 959
 
960 960
 		$point = Context::get('point');
961
-		if($point != -1)
961
+		if ($point != -1)
962 962
 		{
963 963
 			$point = 1;
964 964
 		}
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 		$oCommentModel = getModel('comment');
967 967
 		$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
968 968
 		$module_srl = $oComment->get('module_srl');
969
-		if(!$module_srl)
969
+		if (!$module_srl)
970 970
 		{
971 971
 			return new BaseObject(-1, 'msg_invalid_request');
972 972
 		}
@@ -976,9 +976,9 @@  discard block
 block discarded – undo
976 976
 
977 977
 		$args = new stdClass();
978 978
 
979
-		if($point == -1)
979
+		if ($point == -1)
980 980
 		{
981
-			if($comment_config->use_vote_down != 'S')
981
+			if ($comment_config->use_vote_down != 'S')
982 982
 			{
983 983
 				return new BaseObject(-1, 'msg_invalid_request');
984 984
 			}
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 		}
988 988
 		else
989 989
 		{
990
-			if($comment_config->use_vote_up != 'S')
990
+			if ($comment_config->use_vote_up != 'S')
991 991
 			{
992 992
 				return new BaseObject(-1, 'msg_invalid_request');
993 993
 			}
@@ -997,15 +997,15 @@  discard block
 block discarded – undo
997 997
 
998 998
 		$args->comment_srl = $comment_srl;
999 999
 		$output = executeQueryArray('comment.getVotedMemberList', $args);
1000
-		if(!$output->toBool())
1000
+		if (!$output->toBool())
1001 1001
 		{
1002 1002
 			return $output;
1003 1003
 		}
1004 1004
 
1005 1005
 		$oMemberModel = getModel('member');
1006
-		if($output->data)
1006
+		if ($output->data)
1007 1007
 		{
1008
-			foreach($output->data as $k => $d)
1008
+			foreach ($output->data as $k => $d)
1009 1009
 			{
1010 1010
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1011 1011
 				$output->data[$k]->src = $profile_image->src;
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 	{
1024 1024
 		global $lang;
1025 1025
 
1026
-		if(!isset($lang->secret_name_list))
1026
+		if (!isset($lang->secret_name_list))
1027 1027
 		{
1028 1028
 			return array('Y' => 'Secret', 'N' => 'Public');
1029 1029
 		}
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
 		$output = executeQuery('comment.getCommentListByMemberSrl', $args, $columnList);
1065 1065
 		$comment_list = $output->data;
1066 1066
 
1067
-		if(!$comment_list) return array();
1068
-		if(!is_array($comment_list)) $comment_list = array($comment_list);
1067
+		if (!$comment_list) return array();
1068
+		if (!is_array($comment_list)) $comment_list = array($comment_list);
1069 1069
 
1070 1070
 		return $comment_list;
1071 1071
 
Please login to merge, or discard this patch.
modules/comment/comment.admin.controller.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	{
30 30
 		// Error display if none is selected
31 31
 		$cart = Context::get('cart');
32
-		if(!is_array($cart))
32
+		if (!is_array($cart))
33 33
 		{
34 34
 			$comment_srl_list = explode('|@|', $cart);
35 35
 		}
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 
55 55
 		// Error display if none is selected
56 56
 		$cart = Context::get('cart');
57
-		if(!$cart)
57
+		if (!$cart)
58 58
 		{
59 59
 			return $this->stop('msg_cart_is_null');
60 60
 		}
61
-		if(!is_array($cart))
61
+		if (!is_array($cart))
62 62
 		{
63 63
 			$comment_srl_list = explode('|@|', $cart);
64 64
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		$args->status = $will_publish;
72 72
 		$args->comment_srls_list = $comment_srl_list;
73 73
 		$output = executeQuery('comment.updatePublishedStatus', $args);
74
-		if(!$output->toBool())
74
+		if (!$output->toBool())
75 75
 		{
76 76
 			return $output;
77 77
 		}
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 			//$oMemberModule = getModel("member");
91 91
 			//$logged_info = $oMemberModule->getMemberInfoByMemberSrl($logged_member_srl);
92 92
 			$new_status = ($will_publish) ? "published" : "unpublished";
93
-			foreach($comment_srl_list as $comment_srl)
93
+			foreach ($comment_srl_list as $comment_srl)
94 94
 			{
95 95
 				// check if comment already exists
96 96
 				$comment = $oCommentModel->getComment($comment_srl);
97
-				if($comment->comment_srl != $comment_srl)
97
+				if ($comment->comment_srl != $comment_srl)
98 98
 				{
99 99
 					return new BaseObject(-1, 'msg_invalid_request');
100 100
 				}
101 101
 				$document_srl = $comment->document_srl;
102
-				if(!in_array($document_srl, $updated_documents_arr))
102
+				if (!in_array($document_srl, $updated_documents_arr))
103 103
 				{
104 104
 					$updated_documents_arr[] = $document_srl;
105 105
 					// update the number of comments
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 					// send email to comment's author, all admins and thread(document) subscribers - START
118 118
 					// -------------------------------------------------------
119 119
 					$oMail = new Mail();
120
-					$mail_title = "[XE - " . $module_info->mid . "] comment(s) status changed to " . $new_status . " on document: \"" . $oDocument->getTitleText() . "\"";
120
+					$mail_title = "[XE - ".$module_info->mid."] comment(s) status changed to ".$new_status." on document: \"".$oDocument->getTitleText()."\"";
121 121
 					$oMail->setTitle($mail_title);
122 122
 					$mail_content = "
123
-						The comment #" . $comment_srl . " on document \"" . $oDocument->getTitleText() . "\" has been " . $new_status . " by admin of <strong><i>" . strtoupper($module_info->mid) . "</i></strong> module.
123
+						The comment #" . $comment_srl." on document \"".$oDocument->getTitleText()."\" has been ".$new_status." by admin of <strong><i>".strtoupper($module_info->mid)."</i></strong> module.
124 124
 						<br />
125 125
 						<br />Comment content:
126
-						" . $comment->content . "
126
+						" . $comment->content."
127 127
 						<br />
128 128
 						";
129 129
 					$oMail->setContent($mail_content);
@@ -145,17 +145,17 @@  discard block
 block discarded – undo
145 145
 					*/
146 146
 					//mail to author of thread - STOP
147 147
 					//mail to all emails set for administrators - START
148
-					if($module_info->admin_mail)
148
+					if ($module_info->admin_mail)
149 149
 					{
150 150
 						$target_mail = explode(',', $module_info->admin_mail);
151
-						for($i = 0; $i < count($target_mail); $i++)
151
+						for ($i = 0; $i < count($target_mail); $i++)
152 152
 						{
153 153
 							$email_address = trim($target_mail[$i]);
154
-							if(!$email_address)
154
+							if (!$email_address)
155 155
 							{
156 156
 								continue;
157 157
 							}
158
-							if($author_email != $email_address)
158
+							if ($author_email != $email_address)
159 159
 							{
160 160
 								$oMail->setReceiptor($email_address, $email_address);
161 161
 								$oMail->send();
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 
174 174
 		// for message send - start
175 175
 		$message_content = Context::get('message_content');
176
-		if($message_content)
176
+		if ($message_content)
177 177
 		{
178 178
 			$message_content = nl2br($message_content);
179 179
 		}
180 180
 
181
-		if($message_content)
181
+		if ($message_content)
182 182
 		{
183 183
 			$this->_sendMessageForComment($message_content, $comment_srl_list);
184 184
 		}
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
 		// Error display if none is selected
197 197
 		$cart = Context::get('cart');
198
-		if(!$cart)
198
+		if (!$cart)
199 199
 		{
200 200
 			return $this->stop('msg_cart_is_null');
201 201
 		}
202
-		if(!is_array($cart))
202
+		if (!is_array($cart))
203 203
 		{
204 204
 			$comment_srl_list = explode('|@|', $cart);
205 205
 		}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			$comment_srl_list = $cart;
209 209
 		}
210 210
 		$comment_count = count($comment_srl_list);
211
-		if(!$comment_count)
211
+		if (!$comment_count)
212 212
 		{
213 213
 			return $this->stop('msg_cart_is_null');
214 214
 		}
@@ -220,34 +220,34 @@  discard block
 block discarded – undo
220 220
 
221 221
 		// for message send - start
222 222
 		$message_content = Context::get('message_content');
223
-		if($message_content)
223
+		if ($message_content)
224 224
 		{
225 225
 			$message_content = nl2br($message_content);
226 226
 		}
227 227
 
228
-		if($message_content)
228
+		if ($message_content)
229 229
 		{
230 230
 			$this->_sendMessageForComment($message_content, $comment_srl_list);
231 231
 		}
232 232
 		// for message send - end
233 233
 		// comment into trash
234
-		if($isTrash == 'true')
234
+		if ($isTrash == 'true')
235 235
 		{
236 236
 			$this->_moveCommentToTrash($comment_srl_list, $oCommentController, $oDB, $message_content);
237 237
 		}
238 238
 
239 239
 		$deleted_count = 0;
240 240
 		// Delete the comment posting
241
-		for($i = 0; $i < $comment_count; $i++)
241
+		for ($i = 0; $i < $comment_count; $i++)
242 242
 		{
243 243
 			$comment_srl = trim($comment_srl_list[$i]);
244
-			if(!$comment_srl)
244
+			if (!$comment_srl)
245 245
 			{
246 246
 				continue;
247 247
 			}
248 248
 
249 249
 			$output = $oCommentController->deleteComment($comment_srl, TRUE, $isTrash);
250
-			if(!$output->toBool())
250
+			if (!$output->toBool())
251 251
 			{
252 252
 				$oDB->rollback();
253 253
 				return $output;
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$oDB->commit();
260 260
 
261 261
 		$msgCode = '';
262
-		if($isTrash == 'true')
262
+		if ($isTrash == 'true')
263 263
 		{
264 264
 			$msgCode = 'success_trashed';
265 265
 		}
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
 		$sender_member_srl = $logged_info->member_srl;
291 291
 
292 292
 		$comment_count = count($comment_srl_list);
293
-		for($i = 0; $i < $comment_count; $i++)
293
+		for ($i = 0; $i < $comment_count; $i++)
294 294
 		{
295 295
 			$comment_srl = $comment_srl_list[$i];
296 296
 			$oComment = $oCommentModel->getComment($comment_srl, TRUE);
297 297
 
298
-			if(!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl)
298
+			if (!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl)
299 299
 			{
300 300
 				continue;
301 301
 			}
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL)
314 314
 	{
315
-		require_once(_XE_PATH_ . 'modules/trash/model/TrashVO.php');
315
+		require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
316 316
 
317
-		if(is_array($commentSrlList))
317
+		if (is_array($commentSrlList))
318 318
 		{
319 319
 			$logged_info = Context::get('logged_info');
320 320
 			$oCommentModel = getModel('comment');
321 321
 			$commentItemList = $oCommentModel->getComments($commentSrlList);
322 322
 			$oTrashAdminController = getAdminController('trash');
323 323
 
324
-			foreach($commentItemList AS $key => $oComment)
324
+			foreach ($commentItemList AS $key => $oComment)
325 325
 			{
326 326
 				$oTrashVO = new TrashVO();
327 327
 				$oTrashVO->setTrashSrl(getNextSequence());
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 				$oTrashVO->setDescription($message_content);
332 332
 
333 333
 				$output = $oTrashAdminController->insertTrash($oTrashVO);
334
-				if(!$output->toBool())
334
+				if (!$output->toBool())
335 335
 				{
336 336
 					$oDB->rollback();
337 337
 					return $output;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		$oCommentController = getController('comment');
356 356
 		$oComment = $oCommentModel->getComment($comment_srl, false);
357 357
 
358
-		if(!$oComment->isGranted()) return $this->stop('msg_not_permitted');
358
+		if (!$oComment->isGranted()) return $this->stop('msg_not_permitted');
359 359
 
360 360
 		$message_content = "";
361 361
 		$this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content);
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 	{
378 378
 		$comment_srl = trim(Context::get('comment_srl'));
379 379
 
380
-		if($comment_srl)
380
+		if ($comment_srl)
381 381
 		{
382 382
 			$args = new stdClass();
383 383
 			$args->comment_srl = $comment_srl;
384 384
 			$output = executeQuery('comment.deleteDeclaredComments', $args);
385
-			if(!$output->toBool())
385
+			if (!$output->toBool())
386 386
 			{
387 387
 				return $output;
388 388
 			}
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 
404 404
 		$output = $oCommentModel->getComments($commentSrlList);
405 405
 
406
-		if(is_array($output))
406
+		if (is_array($output))
407 407
 		{
408
-			foreach($output AS $key => $value)
408
+			foreach ($output AS $key => $value)
409 409
 			{
410
-				if($_SESSION['comment_management'][$key])
410
+				if ($_SESSION['comment_management'][$key])
411 411
 				{
412 412
 					unset($_SESSION['comment_management'][$key]);
413 413
 				}
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 		$args = new stdClass();
429 429
 		$args->module_srl = $module_srl;
430 430
 		$output = executeQuery('comment.deleteModuleComments', $args);
431
-		if(!$output->toBool())
431
+		if (!$output->toBool())
432 432
 		{
433 433
 			return $output;
434 434
 		}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 		//remove from cache
439 439
 		$oCacheHandler = CacheHandler::getInstance('object');
440
-		if($oCacheHandler->isSupport())
440
+		if ($oCacheHandler->isSupport())
441 441
 		{
442 442
 			// Invalidate newest comments. Per document cache is invalidated inside document admin controller.
443 443
 			$oCacheHandler->invalidateGroupKey('newestCommentsList');
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 */
453 453
 	function restoreTrash($originObject)
454 454
 	{
455
-		if(is_array($originObject))
455
+		if (is_array($originObject))
456 456
 		{
457 457
 			$originObject = (object) $originObject;
458 458
 		}
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	function emptyTrash($originObject)
486 486
 	{
487 487
 		$originObject = unserialize($originObject);
488
-		if(is_array($originObject))
488
+		if (is_array($originObject))
489 489
 		{
490 490
 			$originObject = (object) $originObject;
491 491
 		}
Please login to merge, or discard this patch.
modules/communication/communication.controller.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function procCommunicationUpdateAllowMessage()
25 25
 	{
26
-		if(!Context::get('is_logged'))
26
+		if (!Context::get('is_logged'))
27 27
 		{
28 28
 			return new BaseObject(-1, 'msg_not_logged');
29 29
 		}
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		$args = new stdClass();
32 32
 		$args->allow_message = Context::get('allow_message');
33 33
 
34
-		if(!in_array($args->allow_message, array('Y', 'N', 'F')))
34
+		if (!in_array($args->allow_message, array('Y', 'N', 'F')))
35 35
 		{
36 36
 			$args->allow_message = 'Y';
37 37
 		}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	function procCommunicationSendMessage()
54 54
 	{
55 55
 		// Check login information
56
-		if(!Context::get('is_logged'))
56
+		if (!Context::get('is_logged'))
57 57
 		{
58 58
 			return new BaseObject(-1, 'msg_not_logged');
59 59
 		}
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 
63 63
 		// Check variables
64 64
 		$receiver_srl = Context::get('receiver_srl');
65
-		if(!$receiver_srl)
65
+		if (!$receiver_srl)
66 66
 		{
67 67
 			return new BaseObject(-1, 'msg_not_exists_member');
68 68
 		}
69 69
 
70 70
 		$title = trim(Context::get('title'));
71
-		if(!$title)
71
+		if (!$title)
72 72
 		{
73 73
 			return new BaseObject(-1, 'msg_title_is_null');
74 74
 		}
75 75
 
76 76
 		$content = trim(Context::get('content'));
77
-		if(!$content)
77
+		if (!$content)
78 78
 		{
79 79
 			return new BaseObject(-1, 'msg_content_is_null');
80 80
 		}
81 81
 
82 82
 		$send_mail = Context::get('send_mail');
83
-		if($send_mail != 'Y')
83
+		if ($send_mail != 'Y')
84 84
 		{
85 85
 			$send_mail = 'N';
86 86
 		}
@@ -90,28 +90,28 @@  discard block
 block discarded – undo
90 90
 		$oCommunicationModel = getModel('communication');
91 91
 		$config = $oCommunicationModel->getConfig();
92 92
 
93
-		if(!$oCommunicationModel->checkGrant($config->grant_write))
93
+		if (!$oCommunicationModel->checkGrant($config->grant_write))
94 94
 		{
95 95
 			return new BaseObject(-1, 'msg_not_permitted');
96 96
 		}
97 97
 
98 98
 		$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
99
-		if($receiver_member_info->member_srl != $receiver_srl)
99
+		if ($receiver_member_info->member_srl != $receiver_srl)
100 100
 		{
101 101
 			return new BaseObject(-1, 'msg_not_exists_member');
102 102
 		}
103 103
 
104 104
 		// check whether to allow to receive the message(pass if a top-administrator)
105
-		if($logged_info->is_admin != 'Y')
105
+		if ($logged_info->is_admin != 'Y')
106 106
 		{
107
-			if($receiver_member_info->allow_message == 'F')
107
+			if ($receiver_member_info->allow_message == 'F')
108 108
 			{
109
-				if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl))
109
+				if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl))
110 110
 				{
111 111
 					return new BaseObject(-1, 'msg_allow_message_to_friend');
112 112
 				}
113 113
 			}
114
-			else if($receiver_member_info->allow_message == 'N')
114
+			else if ($receiver_member_info->allow_message == 'N')
115 115
 			{
116 116
 				return new BaseObject(-1, 'msg_disallow_message');
117 117
 			}
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 		// send a message
121 121
 		$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
122 122
 
123
-		if(!$output->toBool())
123
+		if (!$output->toBool())
124 124
 		{
125 125
 			return $output;
126 126
 		}
127 127
 
128 128
 		// send an e-mail
129
-		if($send_mail == 'Y')
129
+		if ($send_mail == 'Y')
130 130
 		{
131 131
 			$view_url = Context::getRequestUri();
132 132
 			$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 			$oMail->send();
139 139
 		}
140 140
 
141
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
141
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
142 142
 		{
143
-			if(Context::get('is_popup') != 'Y')
143
+			if (Context::get('is_popup') != 'Y')
144 144
 			{
145 145
 				global $lang;
146 146
 				htmlHeader();
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			else
154 154
 			{
155 155
 				$this->setMessage('success_sended');
156
-				$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('','act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', '');
156
+				$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', '');
157 157
 				$this->setRedirectUrl($returnUrl);
158 158
 			}
159 159
 		}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$receiver_args->related_srl = 0;
198 198
 		$receiver_args->list_order = $related_srl * -1;
199 199
 		$receiver_args->sender_srl = $sender_srl;
200
-		if(!$receiver_args->sender_srl)
200
+		if (!$receiver_args->sender_srl)
201 201
 		{
202 202
 			$receiver_args->sender_srl = $receiver_srl;
203 203
 		}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		$trigger_obj->content = $content;
219 219
 		$trigger_obj->sender_log = $sender_log;
220 220
 		$triggerOutput = ModuleHandler::triggerCall('communication.sendMessage', 'before', $trigger_obj);
221
-		if(!$triggerOutput->toBool())
221
+		if (!$triggerOutput->toBool())
222 222
 		{
223 223
 			return $triggerOutput;
224 224
 		}
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 		$oDB->begin();
228 228
 
229 229
 		// messages to save in the sendor's message box
230
-		if($sender_srl && $sender_log)
230
+		if ($sender_srl && $sender_log)
231 231
 		{
232 232
 			$output = executeQuery('communication.sendMessage', $sender_args);
233
-			if(!$output->toBool())
233
+			if (!$output->toBool())
234 234
 			{
235 235
 				$oDB->rollback();
236 236
 				return $output;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 		// messages to save in the receiver's message box
241 241
 		$output = executeQuery('communication.sendMessage', $receiver_args);
242
-		if(!$output->toBool())
242
+		if (!$output->toBool())
243 243
 		{
244 244
 			$oDB->rollback();
245 245
 			return $output;
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
 
248 248
 		// Call a trigger (after)
249 249
 		$trigger_output = ModuleHandler::triggerCall('communication.sendMessage', 'after', $trigger_obj);
250
-		if(!$trigger_output->toBool())
250
+		if (!$trigger_output->toBool())
251 251
 		{
252 252
 			$oDB->rollback();
253 253
 			return $trigger_output;
254 254
 		}
255 255
 
256 256
 		// create a flag that message is sent (in file format) 
257
-		$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($receiver_srl);
257
+		$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($receiver_srl);
258 258
 		FileHandler::makeDir($flag_path);
259 259
 		$flag_file = sprintf('%s%s', $flag_path, $receiver_srl);
260 260
 		$flag_count = FileHandler::readFile($flag_file);
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	function procCommunicationStoreMessage()
273 273
 	{
274 274
 		// Check login information
275
-		if(!Context::get('is_logged'))
275
+		if (!Context::get('is_logged'))
276 276
 		{
277 277
 			return new BaseObject(-1, 'msg_not_logged');
278 278
 		}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 
281 281
 		// Check variable
282 282
 		$message_srl = Context::get('message_srl');
283
-		if(!$message_srl)
283
+		if (!$message_srl)
284 284
 		{
285 285
 			return new BaseObject(-1, 'msg_invalid_request');
286 286
 		}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		// get the message
289 289
 		$oCommunicationModel = getModel('communication');
290 290
 		$message = $oCommunicationModel->getSelectedMessage($message_srl);
291
-		if(!$message || $message->message_type != 'R')
291
+		if (!$message || $message->message_type != 'R')
292 292
 		{
293 293
 			return new BaseObject(-1, 'msg_invalid_request');
294 294
 		}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		$args->message_srl = $message_srl;
298 298
 		$args->receiver_srl = $logged_info->member_srl;
299 299
 		$output = executeQuery('communication.setMessageStored', $args);
300
-		if(!$output->toBool())
300
+		if (!$output->toBool())
301 301
 		{
302 302
 			return $output;
303 303
 		}
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	function procCommunicationDeleteMessage()
313 313
 	{
314 314
 		// Check login information
315
-		if(!Context::get('is_logged'))
315
+		if (!Context::get('is_logged'))
316 316
 		{
317 317
 			return new BaseObject(-1, 'msg_not_logged');
318 318
 		}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 		// Check the variable
324 324
 		$message_srl = Context::get('message_srl');
325
-		if(!$message_srl)
325
+		if (!$message_srl)
326 326
 		{
327 327
 			return new BaseObject(-1, 'msg_invalid_request');
328 328
 		}
@@ -330,23 +330,23 @@  discard block
 block discarded – undo
330 330
 		// Get the message
331 331
 		$oCommunicationModel = getModel('communication');
332 332
 		$message = $oCommunicationModel->getSelectedMessage($message_srl);
333
-		if(!$message)
333
+		if (!$message)
334 334
 		{
335 335
 			return new BaseObject(-1, 'msg_invalid_request');
336 336
 		}
337 337
 
338 338
 		// Check the grant
339
-		switch($message->message_type)
339
+		switch ($message->message_type)
340 340
 		{
341 341
 			case 'S':
342
-				if($message->sender_srl != $member_srl)
342
+				if ($message->sender_srl != $member_srl)
343 343
 				{
344 344
 					return new BaseObject(-1, 'msg_invalid_request');
345 345
 				}
346 346
 				break;
347 347
 
348 348
 			case 'R':
349
-				if($message->receiver_srl != $member_srl)
349
+				if ($message->receiver_srl != $member_srl)
350 350
 				{
351 351
 					return new BaseObject(-1, 'msg_invalid_request');
352 352
 				}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 		$args = new stdClass();
358 358
 		$args->message_srl = $message_srl;
359 359
 		$output = executeQuery('communication.deleteMessage', $args);
360
-		if(!$output->toBool())
360
+		if (!$output->toBool())
361 361
 		{
362 362
 			return $output;
363 363
 		}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	function procCommunicationDeleteMessages()
373 373
 	{
374 374
 		// Check login information
375
-		if(!Context::get('is_logged'))
375
+		if (!Context::get('is_logged'))
376 376
 		{
377 377
 			return new BaseObject(-1, 'msg_not_logged');
378 378
 		}
@@ -381,41 +381,41 @@  discard block
 block discarded – undo
381 381
 		$member_srl = $logged_info->member_srl;
382 382
 
383 383
 		// check variables
384
-		if(!Context::get('message_srl_list'))
384
+		if (!Context::get('message_srl_list'))
385 385
 		{
386 386
 			return new BaseObject(-1, 'msg_cart_is_null');
387 387
 		}
388 388
 
389 389
 		$message_srl_list = Context::get('message_srl_list');
390
-		if(!is_array($message_srl_list))
390
+		if (!is_array($message_srl_list))
391 391
 		{
392 392
 			$message_srl_list = explode('|@|', trim($message_srl_list));
393 393
 		}
394 394
 
395
-		if(!count($message_srl_list))
395
+		if (!count($message_srl_list))
396 396
 		{
397 397
 			return new BaseObject(-1, 'msg_cart_is_null');
398 398
 		}
399 399
 
400 400
 		$message_type = Context::get('message_type');
401
-		if(!$message_type || !in_array($message_type, array('R', 'S', 'T')))
401
+		if (!$message_type || !in_array($message_type, array('R', 'S', 'T')))
402 402
 		{
403 403
 			return new BaseObject(-1, 'msg_invalid_request');
404 404
 		}
405 405
 
406 406
 		$message_count = count($message_srl_list);
407 407
 		$target = array();
408
-		for($i = 0; $i < $message_count; $i++)
408
+		for ($i = 0; $i < $message_count; $i++)
409 409
 		{
410 410
 			$message_srl = (int) trim($message_srl_list[$i]);
411
-			if(!$message_srl)
411
+			if (!$message_srl)
412 412
 			{
413 413
 				continue;
414 414
 			}
415 415
 
416 416
 			$target[] = $message_srl;
417 417
 		}
418
-		if(!count($target))
418
+		if (!count($target))
419 419
 		{
420 420
 			return new BaseObject(-1, 'msg_cart_is_null');
421 421
 		}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 		$args->message_srls = implode(',', $target);
426 426
 		$args->message_type = $message_type;
427 427
 
428
-		if($message_type == 'S')
428
+		if ($message_type == 'S')
429 429
 		{
430 430
 			$args->sender_srl = $member_srl;
431 431
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		}
436 436
 
437 437
 		$output = executeQuery('communication.deleteMessages', $args);
438
-		if(!$output->toBool())
438
+		if (!$output->toBool())
439 439
 		{
440 440
 			return $output;
441 441
 		}
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	function procCommunicationAddFriend()
454 454
 	{
455 455
 		// Check login information
456
-		if(!Context::get('is_logged'))
456
+		if (!Context::get('is_logged'))
457 457
 		{
458 458
 			return new BaseObject(-1, 'msg_not_logged');
459 459
 		}
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		$logged_info = Context::get('logged_info');
462 462
 
463 463
 		$target_srl = (int) trim(Context::get('target_srl'));
464
-		if(!$target_srl)
464
+		if (!$target_srl)
465 465
 		{
466 466
 			return new BaseObject(-1, 'msg_invalid_request');
467 467
 		}
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 		$args->member_srl = $logged_info->member_srl;
475 475
 		$args->target_srl = $target_srl;
476 476
 		$output = executeQuery('communication.addFriend', $args);
477
-		if(!$output->toBool())
477
+		if (!$output->toBool())
478 478
 		{
479 479
 			return $output;
480 480
 		}
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 		$this->add('member_srl', $target_srl);
483 483
 		$this->setMessage('success_registed');
484 484
 
485
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
485
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
486 486
 		{
487 487
 			global $lang;
488 488
 			htmlHeader();
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	function procCommunicationMoveFriend()
502 502
 	{
503 503
 		// Check login information
504
-		if(!Context::get('is_logged'))
504
+		if (!Context::get('is_logged'))
505 505
 		{
506 506
 			return new BaseObject(-1, 'msg_not_logged');
507 507
 		}
@@ -510,27 +510,27 @@  discard block
 block discarded – undo
510 510
 
511 511
 		// Check variables
512 512
 		$friend_srl_list = Context::get('friend_srl_list');
513
-		if(!$friend_srl_list)
513
+		if (!$friend_srl_list)
514 514
 		{
515 515
 			return new BaseObject(-1, 'msg_cart_is_null');
516 516
 		}
517 517
 
518
-		if(!is_array($friend_srl_list))
518
+		if (!is_array($friend_srl_list))
519 519
 		{
520 520
 			$friend_srl_list = explode('|@|', $friend_srl_list);
521 521
 		}
522 522
 
523
-		if(!count($friend_srl_list))
523
+		if (!count($friend_srl_list))
524 524
 		{
525 525
 			return new BaseObject(-1, 'msg_cart_is_null');
526 526
 		}
527 527
 
528 528
 		$friend_count = count($friend_srl_list);
529 529
 		$target = array();
530
-		for($i = 0; $i < $friend_count; $i++)
530
+		for ($i = 0; $i < $friend_count; $i++)
531 531
 		{
532 532
 			$friend_srl = (int) trim($friend_srl_list[$i]);
533
-			if(!$friend_srl)
533
+			if (!$friend_srl)
534 534
 			{
535 535
 				continue;
536 536
 			}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 			$target[] = $friend_srl;
539 539
 		}
540 540
 
541
-		if(!count($target))
541
+		if (!count($target))
542 542
 		{
543 543
 			return new BaseObject(-1, 'msg_cart_is_null');
544 544
 		}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 		$args->friend_group_srl = Context::get('target_friend_group_srl');
551 551
 
552 552
 		$output = executeQuery('communication.moveFriend', $args);
553
-		if(!$output->toBool())
553
+		if (!$output->toBool())
554 554
 		{
555 555
 			return $output;
556 556
 		}
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	function procCommunicationDeleteFriend()
569 569
 	{
570 570
 		// Check login information
571
-		if(!Context::get('is_logged'))
571
+		if (!Context::get('is_logged'))
572 572
 		{
573 573
 			return new BaseObject(-1, 'msg_not_logged');
574 574
 		}
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 		// Check variables
580 580
 		$friend_srl_list = Context::get('friend_srl_list');
581 581
 
582
-		if(!is_array($friend_srl_list))
582
+		if (!is_array($friend_srl_list))
583 583
 		{
584 584
 			$friend_srl_list = explode('|@|', $friend_srl_list);
585 585
 		}
586 586
 
587
-		if(!count($friend_srl_list))
587
+		if (!count($friend_srl_list))
588 588
 		{
589 589
 			return new BaseObject(-1, 'msg_cart_is_null');
590 590
 		}
@@ -592,10 +592,10 @@  discard block
 block discarded – undo
592 592
 		$friend_count = count($friend_srl_list);
593 593
 		$target = array();
594 594
 
595
-		for($i = 0; $i < $friend_count; $i++)
595
+		for ($i = 0; $i < $friend_count; $i++)
596 596
 		{
597 597
 			$friend_srl = (int) trim($friend_srl_list[$i]);
598
-			if(!$friend_srl)
598
+			if (!$friend_srl)
599 599
 			{
600 600
 				continue;
601 601
 			}
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 			$target[] = $friend_srl;
604 604
 		}
605 605
 
606
-		if(!count($target))
606
+		if (!count($target))
607 607
 		{
608 608
 			return new BaseObject(-1, 'msg_cart_is_null');
609 609
 		}
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 		$args->friend_srls = implode(',', $target);
614 614
 		$args->member_srl = $logged_info->member_srl;
615 615
 		$output = executeQuery('communication.deleteFriend', $args);
616
-		if(!$output->toBool())
616
+		if (!$output->toBool())
617 617
 		{
618 618
 			return $output;
619 619
 		}
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	function procCommunicationAddFriendGroup()
632 632
 	{
633 633
 		// Check login information
634
-		if(!Context::get('is_logged'))
634
+		if (!Context::get('is_logged'))
635 635
 		{
636 636
 			return new BaseObject(-1, 'msg_not_logged');
637 637
 		}
@@ -645,13 +645,13 @@  discard block
 block discarded – undo
645 645
 		$args->title = Context::get('title');
646 646
 		$args->title = htmlspecialchars($args->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
647 647
 
648
-		if(!$args->title)
648
+		if (!$args->title)
649 649
 		{
650 650
 			return new BaseObject(-1, 'msg_invalid_request');
651 651
 		}
652 652
 
653 653
 		// modify if friend_group_srl exists.
654
-		if($args->friend_group_srl)
654
+		if ($args->friend_group_srl)
655 655
 		{
656 656
 			$output = executeQuery('communication.renameFriendGroup', $args);
657 657
 			$msg_code = 'success_updated';
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
 			$msg_code = 'success_registed';
664 664
 		}
665 665
 
666
-		if(!$output->toBool())
666
+		if (!$output->toBool())
667 667
 		{
668
-			if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
668
+			if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
669 669
 			{
670 670
 				global $lang;
671 671
 				htmlHeader();
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 		}
683 683
 		else
684 684
 		{
685
-			if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
685
+			if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
686 686
 			{
687 687
 				global $lang;
688 688
 				htmlHeader();
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	function procCommunicationRenameFriendGroup()
708 708
 	{
709 709
 		// Check login information
710
-		if(!Context::get('is_logged'))
710
+		if (!Context::get('is_logged'))
711 711
 		{
712 712
 			return new BaseObject(-1, 'msg_not_logged');
713 713
 		}
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 		$args->title = Context::get('title');
722 722
 		$args->title = htmlspecialchars($args->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
723 723
 
724
-		if(!$args->title)
724
+		if (!$args->title)
725 725
 		{
726 726
 			return new BaseObject(-1, 'msg_invalid_request');
727 727
 		}
728 728
 
729 729
 		$output = executeQuery('communication.renameFriendGroup', $args);
730
-		if(!$output->toBool())
730
+		if (!$output->toBool())
731 731
 		{
732 732
 			return $output;
733 733
 		}
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 	function procCommunicationDeleteFriendGroup()
743 743
 	{
744 744
 		// Check login information
745
-		if(!Context::get('is_logged'))
745
+		if (!Context::get('is_logged'))
746 746
 		{
747 747
 			return new BaseObject(-1, 'msg_not_logged');
748 748
 		}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		$args->friend_group_srl = Context::get('friend_group_srl');
755 755
 		$args->member_srl = $logged_info->member_srl;
756 756
 		$output = executeQuery('communication.deleteFriendGroup', $args);
757
-		if(!$output->toBool())
757
+		if (!$output->toBool())
758 758
 		{
759 759
 			return $output;
760 760
 		}
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
 				{
111 111
 					return new BaseObject(-1, 'msg_allow_message_to_friend');
112 112
 				}
113
-			}
114
-			else if($receiver_member_info->allow_message == 'N')
113
+			} else if($receiver_member_info->allow_message == 'N')
115 114
 			{
116 115
 				return new BaseObject(-1, 'msg_disallow_message');
117 116
 			}
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
 				htmlFooter();
150 149
 				Context::close();
151 150
 				exit;
152
-			}
153
-			else
151
+			} else
154 152
 			{
155 153
 				$this->setMessage('success_sended');
156 154
 				$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('','act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', '');
@@ -428,8 +426,7 @@  discard block
 block discarded – undo
428 426
 		if($message_type == 'S')
429 427
 		{
430 428
 			$args->sender_srl = $member_srl;
431
-		}
432
-		else
429
+		} else
433 430
 		{
434 431
 			$args->receiver_srl = $member_srl;
435 432
 		}
@@ -656,8 +653,7 @@  discard block
 block discarded – undo
656 653
 			$output = executeQuery('communication.renameFriendGroup', $args);
657 654
 			$msg_code = 'success_updated';
658 655
 			// add if not exists
659
-		}
660
-		else
656
+		} else
661 657
 		{
662 658
 			$output = executeQuery('communication.addFriendGroup', $args);
663 659
 			$msg_code = 'success_registed';
@@ -674,13 +670,11 @@  discard block
 block discarded – undo
674 670
 				htmlFooter();
675 671
 				Context::close();
676 672
 				exit;
677
-			}
678
-			else
673
+			} else
679 674
 			{
680 675
 				return $output;
681 676
 			}
682
-		}
683
-		else
677
+		} else
684 678
 		{
685 679
 			if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
686 680
 			{
@@ -692,8 +686,7 @@  discard block
 block discarded – undo
692 686
 				htmlFooter();
693 687
 				Context::close();
694 688
 				exit;
695
-			}
696
-			else
689
+			} else
697 690
 			{
698 691
 				$this->setMessage($msg_code);
699 692
 			}
Please login to merge, or discard this patch.
modules/trash/trash.admin.controller.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function insertTrash($obj)
19 19
 	{
20
-		if(!Context::get('is_logged'))
20
+		if (!Context::get('is_logged'))
21 21
 		{
22 22
 			return new BaseObject(-1, 'msg_not_permitted');
23 23
 		}
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 		$oTrashVO = new TrashVO();
28 28
 		$oTrashVO = &$obj;
29 29
 
30
-		if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence());
31
-		if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject()));
30
+		if (!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence());
31
+		if (!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject()));
32 32
 		$oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
33 33
 		$oTrashVO->setRemoverSrl($logged_info->member_srl);
34 34
 		$oTrashVO->setRegdate(date('YmdHis'));
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 		$tmpTrashSrls = Context::get('cart');
50 50
 
51 51
 		$trashSrls = array();
52
-		if($isAll != 'true')
52
+		if ($isAll != 'true')
53 53
 		{
54
-			if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls;
54
+			if (is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls;
55 55
 			else $trashSrls = explode('|@|', $tmpTrashSrls);
56 56
 		}
57 57
 
58 58
 		//module relation data delete...
59 59
 		$output = $this->_relationDataDelete($isAll, $trashSrls);
60
-		if(!$output->toBool()) return new BaseObject(-1, $output->message);
60
+		if (!$output->toBool()) return new BaseObject(-1, $output->message);
61 61
 
62
-		if(!$this->_emptyTrash($trashSrls)) return new BaseObject(-1, $lang->fail_empty);
62
+		if (!$this->_emptyTrash($trashSrls)) return new BaseObject(-1, $lang->fail_empty);
63 63
 
64 64
 		$this->setMessage('success_deleted', 'info');
65 65
 
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
 	function _relationDataDelete($isAll, &$trashSrls)
77 77
 	{
78 78
 		$oTrashModel = getModel('trash');
79
-		if($isAll == 'true')
79
+		if ($isAll == 'true')
80 80
 		{
81 81
 			$output = $oTrashModel->getTrashAllList(array());
82
-			if(!$output->toBool())
82
+			if (!$output->toBool())
83 83
 			{
84 84
 				return new BaseObject(-1, $output->message);
85 85
 			}
86 86
 
87
-			if(is_array($output->data))
87
+			if (is_array($output->data))
88 88
 			{
89
-				foreach($output->data as $value)
89
+				foreach ($output->data as $value)
90 90
 				{
91 91
 					$trashSrls[] = $value->getTrashSrl();
92 92
 				}
@@ -97,29 +97,29 @@  discard block
 block discarded – undo
97 97
 			$args = new stdClass();
98 98
 			$args->trashSrl = $trashSrls;
99 99
 			$output = $oTrashModel->getTrashList($args);
100
-			if(!$output->toBool())
100
+			if (!$output->toBool())
101 101
 			{
102 102
 				return new BaseObject(-1, $output->message);
103 103
 			}
104 104
 		}
105 105
 
106
-		if(is_array($output->data))
106
+		if (is_array($output->data))
107 107
 		{
108
-			foreach($output->data as $oTrashVO)
108
+			foreach ($output->data as $oTrashVO)
109 109
 			{
110 110
 				//class file check
111 111
 				$classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule());
112
-				if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory');
112
+				if (!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory');
113 113
 
114 114
 				$classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule());
115 115
 				$classFile = FileHandler::getRealPath($classFile);
116
-				if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file');
116
+				if (!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file');
117 117
 
118 118
 				$oAdminController = getAdminController($oTrashVO->getOriginModule());
119
-				if(!method_exists($oAdminController, 'emptyTrash')) return new BaseObject(-1, 'not exist restore method in module class file');
119
+				if (!method_exists($oAdminController, 'emptyTrash')) return new BaseObject(-1, 'not exist restore method in module class file');
120 120
 
121 121
 				$output2 = $oAdminController->emptyTrash($oTrashVO->getSerializedObject());
122
-				if(!$output2->toBool()) return new BaseObject(-1, $output2->message);
122
+				if (!$output2->toBool()) return new BaseObject(-1, $output2->message);
123 123
 			}
124 124
 		}
125 125
 		return new BaseObject(0, $lang->success_deleted);
@@ -134,33 +134,33 @@  discard block
 block discarded – undo
134 134
 		global $lang;
135 135
 		$trashSrlList = Context::get('cart');
136 136
 
137
-		if(is_array($trashSrlList))
137
+		if (is_array($trashSrlList))
138 138
 		{
139 139
 			// begin transaction
140 140
 			$oDB = &DB::getInstance();
141 141
 			$oDB->begin();
142 142
 			// eache restore method call in each classfile
143
-			foreach($trashSrlList as $value)
143
+			foreach ($trashSrlList as $value)
144 144
 			{
145 145
 				$oTrashModel = getModel('trash');
146 146
 				$output = $oTrashModel->getTrash($value);
147
-				if(!$output->toBool()) return new BaseObject(-1, $output->message);
147
+				if (!$output->toBool()) return new BaseObject(-1, $output->message);
148 148
 
149 149
 				//class file check
150 150
 				$classPath = ModuleHandler::getModulePath($output->data->getOriginModule());
151
-				if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory');
151
+				if (!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory');
152 152
 
153 153
 				$classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule());
154 154
 				$classFile = FileHandler::getRealPath($classFile);
155
-				if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file');
155
+				if (!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file');
156 156
 
157 157
 				$oAdminController = getAdminController($output->data->getOriginModule());
158
-				if(!method_exists($oAdminController, 'restoreTrash')) return new BaseObject(-1, 'not exist restore method in module class file');
158
+				if (!method_exists($oAdminController, 'restoreTrash')) return new BaseObject(-1, 'not exist restore method in module class file');
159 159
 
160 160
 				$originObject = unserialize($output->data->getSerializedObject());
161 161
 				$output = $oAdminController->restoreTrash($originObject);
162 162
 
163
-				if(!$output->toBool())
163
+				if (!$output->toBool())
164 164
 				{
165 165
 					$oDB->rollback();
166 166
 					return new BaseObject(-1, $output->message);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			}
169 169
 
170 170
 			// restore object delete in trash box
171
-			if(!$this->_emptyTrash($trashSrlList)) {
171
+			if (!$this->_emptyTrash($trashSrlList)) {
172 172
 				$oDB->rollback();
173 173
 				return new BaseObject(-1, $lang->fail_empty);
174 174
 			}
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function procTrashAdminGetList()
189 189
 	{
190
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
190
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
191 191
 		$trashSrls = Context::get('trash_srls');
192
-		if($trashSrls) $trashSrlList = explode(',', $trashSrls);
192
+		if ($trashSrls) $trashSrlList = explode(',', $trashSrls);
193 193
 
194
-		if(count($trashSrlList) > 0)
194
+		if (count($trashSrlList) > 0)
195 195
 		{
196 196
 			$oTrashModel = getModel('trash');
197 197
 			$args = new stdClass();
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	function _emptyTrash($trashSrls)
220 220
 	{
221
-		if(!is_array($trashSrls)) return false;
221
+		if (!is_array($trashSrls)) return false;
222 222
 		$args = new stdClass();
223 223
 		$args->trashSrls = $trashSrls;
224 224
 		$output = executeQuery('trash.deleteTrash', $args);
225
-		if(!$output->toBool()) return false;
225
+		if (!$output->toBool()) return false;
226 226
 
227 227
 		return true;
228 228
 	}
Please login to merge, or discard this patch.
Braces   +55 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,8 +27,12 @@  discard block
 block discarded – undo
27 27
 		$oTrashVO = new TrashVO();
28 28
 		$oTrashVO = &$obj;
29 29
 
30
-		if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence());
31
-		if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject()));
30
+		if(!$oTrashVO->getTrashSrl()) {
31
+			$oTrashVO->setTrashSrl(getNextSequence());
32
+		}
33
+		if(!is_string($oTrashVO->getSerializedObject())) {
34
+			$oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject()));
35
+		}
32 36
 		$oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
33 37
 		$oTrashVO->setRemoverSrl($logged_info->member_srl);
34 38
 		$oTrashVO->setRegdate(date('YmdHis'));
@@ -51,15 +55,22 @@  discard block
 block discarded – undo
51 55
 		$trashSrls = array();
52 56
 		if($isAll != 'true')
53 57
 		{
54
-			if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls;
55
-			else $trashSrls = explode('|@|', $tmpTrashSrls);
58
+			if(is_array($tmpTrashSrls)) {
59
+				$trashSrls = $tmpTrashSrls;
60
+			} else {
61
+				$trashSrls = explode('|@|', $tmpTrashSrls);
62
+			}
56 63
 		}
57 64
 
58 65
 		//module relation data delete...
59 66
 		$output = $this->_relationDataDelete($isAll, $trashSrls);
60
-		if(!$output->toBool()) return new BaseObject(-1, $output->message);
67
+		if(!$output->toBool()) {
68
+			return new BaseObject(-1, $output->message);
69
+		}
61 70
 
62
-		if(!$this->_emptyTrash($trashSrls)) return new BaseObject(-1, $lang->fail_empty);
71
+		if(!$this->_emptyTrash($trashSrls)) {
72
+			return new BaseObject(-1, $lang->fail_empty);
73
+		}
63 74
 
64 75
 		$this->setMessage('success_deleted', 'info');
65 76
 
@@ -91,8 +102,7 @@  discard block
 block discarded – undo
91 102
 					$trashSrls[] = $value->getTrashSrl();
92 103
 				}
93 104
 			}
94
-		}
95
-		else
105
+		} else
96 106
 		{
97 107
 			$args = new stdClass();
98 108
 			$args->trashSrl = $trashSrls;
@@ -109,17 +119,25 @@  discard block
 block discarded – undo
109 119
 			{
110 120
 				//class file check
111 121
 				$classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule());
112
-				if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory');
122
+				if(!is_dir(FileHandler::getRealPath($classPath))) {
123
+					return new BaseObject(-1, 'not exist restore module directory');
124
+				}
113 125
 
114 126
 				$classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule());
115 127
 				$classFile = FileHandler::getRealPath($classFile);
116
-				if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file');
128
+				if(!file_exists($classFile)) {
129
+					return new BaseObject(-1, 'not exist restore module class file');
130
+				}
117 131
 
118 132
 				$oAdminController = getAdminController($oTrashVO->getOriginModule());
119
-				if(!method_exists($oAdminController, 'emptyTrash')) return new BaseObject(-1, 'not exist restore method in module class file');
133
+				if(!method_exists($oAdminController, 'emptyTrash')) {
134
+					return new BaseObject(-1, 'not exist restore method in module class file');
135
+				}
120 136
 
121 137
 				$output2 = $oAdminController->emptyTrash($oTrashVO->getSerializedObject());
122
-				if(!$output2->toBool()) return new BaseObject(-1, $output2->message);
138
+				if(!$output2->toBool()) {
139
+					return new BaseObject(-1, $output2->message);
140
+				}
123 141
 			}
124 142
 		}
125 143
 		return new BaseObject(0, $lang->success_deleted);
@@ -144,18 +162,26 @@  discard block
 block discarded – undo
144 162
 			{
145 163
 				$oTrashModel = getModel('trash');
146 164
 				$output = $oTrashModel->getTrash($value);
147
-				if(!$output->toBool()) return new BaseObject(-1, $output->message);
165
+				if(!$output->toBool()) {
166
+					return new BaseObject(-1, $output->message);
167
+				}
148 168
 
149 169
 				//class file check
150 170
 				$classPath = ModuleHandler::getModulePath($output->data->getOriginModule());
151
-				if(!is_dir(FileHandler::getRealPath($classPath))) return new BaseObject(-1, 'not exist restore module directory');
171
+				if(!is_dir(FileHandler::getRealPath($classPath))) {
172
+					return new BaseObject(-1, 'not exist restore module directory');
173
+				}
152 174
 
153 175
 				$classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule());
154 176
 				$classFile = FileHandler::getRealPath($classFile);
155
-				if(!file_exists($classFile)) return new BaseObject(-1, 'not exist restore module class file');
177
+				if(!file_exists($classFile)) {
178
+					return new BaseObject(-1, 'not exist restore module class file');
179
+				}
156 180
 
157 181
 				$oAdminController = getAdminController($output->data->getOriginModule());
158
-				if(!method_exists($oAdminController, 'restoreTrash')) return new BaseObject(-1, 'not exist restore method in module class file');
182
+				if(!method_exists($oAdminController, 'restoreTrash')) {
183
+					return new BaseObject(-1, 'not exist restore method in module class file');
184
+				}
159 185
 
160 186
 				$originObject = unserialize($output->data->getSerializedObject());
161 187
 				$output = $oAdminController->restoreTrash($originObject);
@@ -187,9 +213,13 @@  discard block
 block discarded – undo
187 213
 	 */
188 214
 	function procTrashAdminGetList()
189 215
 	{
190
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
216
+		if(!Context::get('is_logged')) {
217
+			return new BaseObject(-1,'msg_not_permitted');
218
+		}
191 219
 		$trashSrls = Context::get('trash_srls');
192
-		if($trashSrls) $trashSrlList = explode(',', $trashSrls);
220
+		if($trashSrls) {
221
+			$trashSrlList = explode(',', $trashSrls);
222
+		}
193 223
 
194 224
 		if(count($trashSrlList) > 0)
195 225
 		{
@@ -198,8 +228,7 @@  discard block
 block discarded – undo
198 228
 			$args->trashSrl = $trashSrlList;
199 229
 			$output = $oTrashModel->getTrashList($args);
200 230
 			$trashList = $output->data;
201
-		}
202
-		else
231
+		} else
203 232
 		{
204 233
 			global $lang;
205 234
 			$trashList = array();
@@ -218,11 +247,15 @@  discard block
 block discarded – undo
218 247
 	 */
219 248
 	function _emptyTrash($trashSrls)
220 249
 	{
221
-		if(!is_array($trashSrls)) return false;
250
+		if(!is_array($trashSrls)) {
251
+			return false;
252
+		}
222 253
 		$args = new stdClass();
223 254
 		$args->trashSrls = $trashSrls;
224 255
 		$output = executeQuery('trash.deleteTrash', $args);
225
-		if(!$output->toBool()) return false;
256
+		if(!$output->toBool()) {
257
+			return false;
258
+		}
226 259
 
227 260
 		return true;
228 261
 	}
Please login to merge, or discard this patch.