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 ( cac676...2c1c8e )
by gyeong-won
24:40 queued 13:58
created
modules/member/member.api.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	/**
25 25
 	 * Arrange Contents
26 26
 	 *
27
-	 * @param array $content_list
27
+	 * @param string $content_list
28 28
 	 *
29 29
 	 * @return array
30 30
 	 */
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * Arrange Contents
43 43
 	 *
44
-	 * @param array $content_list
44
+	 * @param array $content
45 45
 	 *
46 46
 	 * @return array
47 47
 	 */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 	function dispSavedDocumentList(&$oModule)
18 18
 	{
19 19
 		$document_list = $this->arrangeContentList(Context::get('document_list'));
20
-		$oModule->add('document_list',$document_list);
21
-		$oModule->add('page_navigation',Context::get('page_navigation'));
20
+		$oModule->add('document_list', $document_list);
21
+		$oModule->add('page_navigation', Context::get('page_navigation'));
22 22
 	}
23 23
 
24 24
 	/**
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 	function arrangeContentList($content_list)
32 32
 	{
33 33
 		$output = array();
34
-		if(count($content_list))
34
+		if (count($content_list))
35 35
 		{
36
-			foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val);
36
+			foreach ($content_list as $key => $val) $output[] = $this->arrangeContent($val);
37 37
 		}
38 38
 		return $output;
39 39
 	}
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	function arrangeContent($content)
49 49
 	{
50 50
 		$output = null;
51
-		if($content)
51
+		if ($content)
52 52
 		{
53
-			$output= $content->gets('document_srl','category_srl','nick_name','user_id','user_name','title','content','tags','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status');
53
+			$output = $content->gets('document_srl', 'category_srl', 'nick_name', 'user_id', 'user_name', 'title', 'content', 'tags', 'voted_count', 'blamed_count', 'comment_count', 'regdate', 'last_update', 'extra_vars', 'status');
54 54
 		}
55 55
 		return $output;
56 56
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@
 block discarded – undo
33 33
 		$output = array();
34 34
 		if(count($content_list))
35 35
 		{
36
-			foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val);
36
+			foreach($content_list as $key => $val) {
37
+				$output[] = $this->arrangeContent($val);
38
+			}
37 39
 		}
38 40
 		return $output;
39 41
 	}
Please login to merge, or discard this patch.
modules/member/member.model.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -297,6 +297,7 @@
 block discarded – undo
297 297
 
298 298
 	/**
299 299
 	 * @brief Return member information with member_srl
300
+	 * @param string $member_srl
300 301
 	 */
301 302
 	function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array())
302 303
 	{
Please login to merge, or discard this patch.
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	{
27 27
 		static $member_config;
28 28
 
29
-		if($member_config)
29
+		if ($member_config)
30 30
 		{
31 31
 			return $member_config;
32 32
 		}
@@ -35,47 +35,47 @@  discard block
 block discarded – undo
35 35
 		$oModuleModel = getModel('module');
36 36
 		$config = $oModuleModel->getModuleConfig('member');
37 37
 
38
-		if(!$config->signupForm || !is_array($config->signupForm))
38
+		if (!$config->signupForm || !is_array($config->signupForm))
39 39
 		{
40 40
 			$oMemberAdminController = getAdminController('member');
41 41
 			$identifier = ($config->identifier) ? $config->identifier : 'email_address';
42 42
 			$config->signupForm = $oMemberAdminController->createSignupForm($identifier);
43 43
 		}
44 44
 		//for multi language
45
-		foreach($config->signupForm AS $key=>$value)
45
+		foreach ($config->signupForm AS $key=>$value)
46 46
 		{
47 47
 			$config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title;
48
-			if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y';
49
-			if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N';
48
+			if ($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y';
49
+			if ($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N';
50 50
 		}
51 51
 
52 52
 		// Get terms of user
53 53
 		$config->agreement = memberModel::_getAgreement();
54 54
 
55
-		if(!$config->webmaster_name) $config->webmaster_name = 'webmaster';
55
+		if (!$config->webmaster_name) $config->webmaster_name = 'webmaster';
56 56
 
57
-		if(!$config->image_name_max_width) $config->image_name_max_width = 90;
58
-		if(!$config->image_name_max_height) $config->image_name_max_height = 20;
59
-		if(!$config->image_name_max_filesize) $config->image_name_max_filesize = null;
60
-		if(!$config->image_mark_max_width) $config->image_mark_max_width = 20;
61
-		if(!$config->image_mark_max_height) $config->image_mark_max_height = 20;
62
-		if(!$config->image_mark_max_filesize) $config->image_mark_max_filesize = null;
63
-		if(!$config->profile_image_max_width) $config->profile_image_max_width = 90;
64
-		if(!$config->profile_image_max_height) $config->profile_image_max_height = 90;
65
-		if(!$config->profile_image_max_filesize) $config->profile_image_max_filesize = null;
57
+		if (!$config->image_name_max_width) $config->image_name_max_width = 90;
58
+		if (!$config->image_name_max_height) $config->image_name_max_height = 20;
59
+		if (!$config->image_name_max_filesize) $config->image_name_max_filesize = null;
60
+		if (!$config->image_mark_max_width) $config->image_mark_max_width = 20;
61
+		if (!$config->image_mark_max_height) $config->image_mark_max_height = 20;
62
+		if (!$config->image_mark_max_filesize) $config->image_mark_max_filesize = null;
63
+		if (!$config->profile_image_max_width) $config->profile_image_max_width = 90;
64
+		if (!$config->profile_image_max_height) $config->profile_image_max_height = 90;
65
+		if (!$config->profile_image_max_filesize) $config->profile_image_max_filesize = null;
66 66
 
67
-		if(!$config->skin) $config->skin = 'default';
68
-		if(!$config->colorset) $config->colorset = 'white';
69
-		if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor';
70
-		if(!$config->group_image_mark) $config->group_image_mark = "N";
67
+		if (!$config->skin) $config->skin = 'default';
68
+		if (!$config->colorset) $config->colorset = 'white';
69
+		if (!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor';
70
+		if (!$config->group_image_mark) $config->group_image_mark = "N";
71 71
 
72
-		if(!$config->identifier) $config->identifier = 'user_id';
72
+		if (!$config->identifier) $config->identifier = 'user_id';
73 73
 
74
-		if(!$config->max_error_count) $config->max_error_count = 10;
75
-		if(!$config->max_error_count_time) $config->max_error_count_time = 300;
74
+		if (!$config->max_error_count) $config->max_error_count = 10;
75
+		if (!$config->max_error_count_time) $config->max_error_count_time = 300;
76 76
 
77
-		if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor';
78
-		if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono';
77
+		if (!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor';
78
+		if (!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono';
79 79
 
80 80
 		$member_config = $config;
81 81
 
@@ -84,24 +84,24 @@  discard block
 block discarded – undo
84 84
 
85 85
 	function _getAgreement()
86 86
 	{
87
-		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
88
-		if(is_readable($agreement_file))
87
+		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt';
88
+		if (is_readable($agreement_file))
89 89
 		{
90 90
 			return FileHandler::readFile($agreement_file);
91 91
 		}
92 92
 
93 93
 		$db_info = Context::getDBInfo();
94
-		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $db_info->lang_type . '.txt';
95
-		if(is_readable($agreement_file))
94
+		$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$db_info->lang_type.'.txt';
95
+		if (is_readable($agreement_file))
96 96
 		{
97 97
 			return FileHandler::readFile($agreement_file);
98 98
 		}
99 99
 
100 100
 		$lang_selected = Context::loadLangSelected();
101
-		foreach($lang_selected as $key => $val)
101
+		foreach ($lang_selected as $key => $val)
102 102
 		{
103
-			$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $key . '.txt';
104
-			if(is_readable($agreement_file))
103
+			$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$key.'.txt';
104
+			if (is_readable($agreement_file))
105 105
 			{
106 106
 				return FileHandler::readFile($agreement_file);
107 107
 			}
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 		$logged_info = Context::get('logged_info');
122 122
 		$act = Context::get('cur_act');
123 123
 		// When click user's own nickname
124
-		if($member_srl == $logged_info->member_srl) $member_info = $logged_info;
124
+		if ($member_srl == $logged_info->member_srl) $member_info = $logged_info;
125 125
 		// When click other's nickname
126 126
 		else $member_info = $this->getMemberInfoByMemberSrl($member_srl);
127 127
 
128 128
 		$member_srl = $member_info->member_srl;
129
-		if(!$member_srl) return;
129
+		if (!$member_srl) return;
130 130
 		// List variables
131 131
 		$user_id = $member_info->user_id;
132 132
 		$user_name = $member_info->user_name;
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
 
136 136
 		$oMemberController = getController('member');
137 137
 		// Display member information (Don't display to non-logged user)
138
-		if($logged_info->member_srl)
138
+		if ($logged_info->member_srl)
139 139
 		{
140
-			$url = getUrl('','mid',$mid,'act','dispMemberInfo','member_srl',$member_srl);
141
-			$oMemberController->addMemberPopupMenu($url,'cmd_view_member_info',$icon_path,'self');
140
+			$url = getUrl('', 'mid', $mid, 'act', 'dispMemberInfo', 'member_srl', $member_srl);
141
+			$oMemberController->addMemberPopupMenu($url, 'cmd_view_member_info', $icon_path, 'self');
142 142
 		}
143 143
 		// When click other's nickname
144
-		if($member_srl != $logged_info->member_srl && $logged_info->member_srl)
144
+		if ($member_srl != $logged_info->member_srl && $logged_info->member_srl)
145 145
 		{
146 146
 			// Get email config
147
-			foreach($this->module_config->signupForm as $field)
147
+			foreach ($this->module_config->signupForm as $field)
148 148
 			{
149
-				if($field->name == 'email_address')
149
+				if ($field->name == 'email_address')
150 150
 				{
151 151
 					$email_config = $field;
152 152
 					break;
@@ -154,36 +154,36 @@  discard block
 block discarded – undo
154 154
 			}
155 155
 
156 156
 			// Send an email only if email address is public
157
-			if(($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address)
157
+			if (($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address)
158 158
 			{
159 159
 				$url = 'mailto:'.htmlspecialchars($member_info->email_address, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
160
-				$oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path);
160
+				$oMemberController->addMemberPopupMenu($url, 'cmd_send_email', $icon_path);
161 161
 			}
162 162
 		}
163 163
 		// View homepage info
164
-		if($member_info->homepage)
164
+		if ($member_info->homepage)
165 165
 			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank');
166 166
 		// View blog info
167
-		if($member_info->blog)
167
+		if ($member_info->blog)
168 168
 			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank');
169 169
 		// Call a trigger (after)
170 170
 		ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null);
171 171
 		// Display a menu for editting member info to a top administrator
172
-		if($logged_info->is_admin == 'Y')
172
+		if ($logged_info->is_admin == 'Y')
173 173
 		{
174
-			$url = getUrl('','module','admin','act','dispMemberAdminInsert','member_srl',$member_srl);
175
-			$oMemberController->addMemberPopupMenu($url,'cmd_manage_member_info',$icon_path,'MemberModifyInfo');
174
+			$url = getUrl('', 'module', 'admin', 'act', 'dispMemberAdminInsert', 'member_srl', $member_srl);
175
+			$oMemberController->addMemberPopupMenu($url, 'cmd_manage_member_info', $icon_path, 'MemberModifyInfo');
176 176
 
177
-			$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','member_srl','search_keyword',$member_srl);
178
-			$oMemberController->addMemberPopupMenu($url,'cmd_trace_document',$icon_path,'TraceMemberDocument');
177
+			$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl);
178
+			$oMemberController->addMemberPopupMenu($url, 'cmd_trace_document', $icon_path, 'TraceMemberDocument');
179 179
 
180
-			$url = getUrl('','module','admin','act','dispCommentAdminList','search_target','member_srl','search_keyword',$member_srl);
181
-			$oMemberController->addMemberPopupMenu($url,'cmd_trace_comment',$icon_path,'TraceMemberComment');
180
+			$url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl);
181
+			$oMemberController->addMemberPopupMenu($url, 'cmd_trace_comment', $icon_path, 'TraceMemberComment');
182 182
 		}
183 183
 		// Change a language of pop-up menu
184 184
 		$menus = Context::get('member_popup_menu_list');
185 185
 		$menus_count = count($menus);
186
-		for($i=0;$i<$menus_count;$i++)
186
+		for ($i = 0; $i < $menus_count; $i++)
187 187
 		{
188 188
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
189 189
 		}
@@ -195,16 +195,16 @@  discard block
 block discarded – undo
195 195
 	 * @brief Check if logged-in
196 196
 	 */
197 197
 	function isLogged() {
198
-		if($_SESSION['is_logged'])
198
+		if ($_SESSION['is_logged'])
199 199
 		{
200
-			if(Mobile::isFromMobilePhone())
200
+			if (Mobile::isFromMobilePhone())
201 201
 			{
202 202
 				return true;
203 203
 			}
204
-			elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
204
+			elseif (filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
205 205
 			{
206 206
 				// IPv6: require same /48
207
-				if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0)
207
+				if (strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0)
208 208
 				{
209 209
 					return true;
210 210
 				}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 			else
213 213
 			{
214 214
 				// IPv4: require same /24
215
-				if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8)
215
+				if (ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8)
216 216
 				{
217 217
 					return true;
218 218
 				}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	function getLoggedInfo()
230 230
 	{
231 231
 		// Return session info if session info is requested and the user is logged-in
232
-		if($this->isLogged())
232
+		if ($this->isLogged())
233 233
 		{
234 234
 			$logged_info = Context::get('logged_info');
235 235
 			// Admin/Group list defined depending on site_module_info
236 236
 			$site_module_info = Context::get('site_module_info');
237
-			if($site_module_info->site_srl)
237
+			if ($site_module_info->site_srl)
238 238
 			{
239 239
 				$logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl);
240 240
 				// Add is_site_admin bool variable into logged_info if site_administrator is
241 241
 				$oModuleModel = getModel('module');
242
-				if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true;
242
+				if ($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true;
243 243
 				else $logged_info->is_site_admin = false;
244 244
 			}
245 245
 			else
246 246
 			{
247 247
 				// Register a default group if the site doesn't have a member group
248
-				if(count($logged_info->group_list) === 0)
248
+				if (count($logged_info->group_list) === 0)
249 249
 				{
250 250
 					$default_group = $this->getDefaultGroup(0);
251 251
 					$oMemberController = getController('member');
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	function getMemberInfoByUserID($user_id, $columnList = array())
270 270
 	{
271
-		if(!$user_id) return;
271
+		if (!$user_id) return;
272 272
 
273 273
 		$args = new stdClass;
274 274
 		$args->user_id = $user_id;
275 275
 		$output = executeQuery('member.getMemberInfo', $args);
276
-		if(!$output->toBool()) return $output;
277
-		if(!$output->data) return;
276
+		if (!$output->toBool()) return $output;
277
+		if (!$output->data) return;
278 278
 
279 279
 		$member_info = $this->arrangeMemberInfo($output->data);
280 280
 
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	function getMemberInfoByEmailAddress($email_address)
288 288
 	{
289
-		if(!$email_address) return;
289
+		if (!$email_address) return;
290 290
 
291 291
 		$args = new stdClass();
292 292
 		
293
-		$db_info = Context::getDBInfo ();
294
-		if($db_info->master_db['db_type'] == "cubrid")
293
+		$db_info = Context::getDBInfo();
294
+		if ($db_info->master_db['db_type'] == "cubrid")
295 295
 		{
296 296
 			$args->email_address = strtolower($email_address);
297 297
 			$output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args);
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 			$output = executeQuery('member.getMemberInfoByEmailAddress', $args);
303 303
 		}
304 304
 		
305
-		if(!$output->toBool()) return $output;
306
-		if(!$output->data) return;
305
+		if (!$output->toBool()) return $output;
306
+		if (!$output->data) return;
307 307
 
308 308
 		$member_info = $this->arrangeMemberInfo($output->data);
309 309
 		return $member_info;
@@ -314,36 +314,36 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array())
316 316
 	{
317
-		if(!$member_srl) return;
317
+		if (!$member_srl) return;
318 318
 
319 319
 		//columnList size zero... get full member info
320
-		if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0)
320
+		if (!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0)
321 321
 		{
322 322
 			$GLOBALS['__member_info__'][$member_srl] = false;
323 323
 
324 324
 			$oCacheHandler = CacheHandler::getInstance('object');
325
-			if($oCacheHandler->isSupport())
325
+			if ($oCacheHandler->isSupport())
326 326
 			{
327 327
 				$columnList = array();
328
-				$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
328
+				$object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl;
329 329
 				$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
330 330
 				$GLOBALS['__member_info__'][$member_srl] = $oCacheHandler->get($cache_key);
331 331
 			}
332 332
 
333
-			if($GLOBALS['__member_info__'][$member_srl] === false)
333
+			if ($GLOBALS['__member_info__'][$member_srl] === false)
334 334
 			{
335 335
 				$args = new stdClass();
336 336
 				$args->member_srl = $member_srl;
337 337
 				$output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList);
338
-				if(!$output->data) 
338
+				if (!$output->data) 
339 339
 				{
340
-					if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass);
340
+					if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass);
341 341
 					return;
342 342
 				}
343 343
 				$this->arrangeMemberInfo($output->data, $site_srl);
344 344
 
345 345
 				//insert in cache
346
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
346
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
347 347
 			}
348 348
 		}
349 349
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	function arrangeMemberInfo($info, $site_srl = 0)
357 357
 	{
358
-		if(!$GLOBALS['__member_info__'][$info->member_srl])
358
+		if (!$GLOBALS['__member_info__'][$info->member_srl])
359 359
 		{
360 360
 			$oModuleModel = getModel('module');
361 361
 			$config = $oModuleModel->getModuleConfig('member');
@@ -364,25 +364,25 @@  discard block
 block discarded – undo
364 364
 			$info->profile_image = $this->getProfileImage($info->member_srl);
365 365
 			$info->image_name = $this->getImageName($info->member_srl);
366 366
 			$info->image_mark = $this->getImageMark($info->member_srl);
367
-			if($config->group_image_mark=='Y')
367
+			if ($config->group_image_mark == 'Y')
368 368
 			{
369
-				$info->group_mark = $this->getGroupImageMark($info->member_srl,$site_srl);
369
+				$info->group_mark = $this->getGroupImageMark($info->member_srl, $site_srl);
370 370
 			}
371 371
 			$info->signature = $this->getSignature($info->member_srl);
372 372
 			$info->group_list = $this->getMemberGroups($info->member_srl, $site_srl);
373 373
 
374 374
 			$extra_vars = unserialize($info->extra_vars);
375 375
 			unset($info->extra_vars);
376
-			if($extra_vars)
376
+			if ($extra_vars)
377 377
 			{
378
-				foreach($extra_vars as $key => $val)
378
+				foreach ($extra_vars as $key => $val)
379 379
 				{
380
-					if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val);
381
-					if(!$info->{$key}) $info->{$key} = $val;
380
+					if (!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val);
381
+					if (!$info->{$key}) $info->{$key} = $val;
382 382
 				}
383 383
 			}
384 384
 
385
-			if(strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer))
385
+			if (strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer))
386 386
 			{
387 387
 				$info->find_account_answer = null;
388 388
 			}
@@ -394,13 +394,13 @@  discard block
 block discarded – undo
394 394
 			$info->homepage = strip_tags($info->homepage);
395 395
 			$info->blog = strip_tags($info->blog);
396 396
 
397
-			if($extra_vars)
397
+			if ($extra_vars)
398 398
 			{
399
-				foreach($extra_vars as $key => $val)
399
+				foreach ($extra_vars as $key => $val)
400 400
 				{
401
-					if(is_array($val))
401
+					if (is_array($val))
402 402
 					{
403
-						$oSecurity->encodeHTML($key . '.');
403
+						$oSecurity->encodeHTML($key.'.');
404 404
 					}
405 405
 					else
406 406
 					{
@@ -411,12 +411,12 @@  discard block
 block discarded – undo
411 411
 
412 412
 			// Check format.
413 413
 			$oValidator = new Validator();
414
-			if(!$oValidator->applyRule('url', $info->homepage))
414
+			if (!$oValidator->applyRule('url', $info->homepage))
415 415
 			{
416 416
 				$info->homepage = '';
417 417
 			}
418 418
 
419
-			if(!$oValidator->applyRule('url', $info->blog))
419
+			if (!$oValidator->applyRule('url', $info->blog))
420 420
 			{
421 421
 				$info->blog = '';
422 422
 			}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	function getLoggedMemberSrl()
467 467
 	{
468
-		if(!$this->isLogged()) return;
468
+		if (!$this->isLogged()) return;
469 469
 		return $_SESSION['member_srl'];
470 470
 	}
471 471
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	function getLoggedUserID()
476 476
 	{
477
-		if(!$this->isLogged()) return;
477
+		if (!$this->isLogged()) return;
478 478
 		$logged_info = Context::get('logged_info');
479 479
 		return $logged_info->user_id;
480 480
 	}
@@ -489,16 +489,16 @@  discard block
 block discarded – undo
489 489
 		// cache controll
490 490
 		$group_list = false;
491 491
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
492
-		if($oCacheHandler->isSupport())
492
+		if ($oCacheHandler->isSupport())
493 493
 		{
494
-			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_'.$site_srl;
494
+			$object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl;
495 495
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
496 496
 			$group_list = $oCacheHandler->get($cache_key);
497 497
 		}
498 498
 
499
-		if(!$member_groups[$member_srl][$site_srl] || $force_reload)
499
+		if (!$member_groups[$member_srl][$site_srl] || $force_reload)
500 500
 		{
501
-			if($group_list === false)
501
+			if ($group_list === false)
502 502
 			{
503 503
 				$args = new stdClass();
504 504
 				$args->member_srl = $member_srl;
@@ -506,11 +506,11 @@  discard block
 block discarded – undo
506 506
 				$output = executeQueryArray('member.getMemberGroups', $args);
507 507
 				$group_list = $output->data;
508 508
 				//insert in cache
509
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
509
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
510 510
 			}
511
-			if(!$group_list) return array();
511
+			if (!$group_list) return array();
512 512
 
513
-			foreach($group_list as $group)
513
+			foreach ($group_list as $group)
514 514
 			{
515 515
 				$result[$group->group_srl] = $group->title;
516 516
 			}
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
 	 */
525 525
 	function getMembersGroups($member_srls, $site_srl = 0)
526 526
 	{
527
-		$args->member_srls = implode(',',$member_srls);
527
+		$args->member_srls = implode(',', $member_srls);
528 528
 		$args->site_srl = $site_srl;
529 529
 		$args->sort_index = 'list_order';
530 530
 		$output = executeQueryArray('member.getMembersGroups', $args);
531
-		if(!$output->data) return array();
531
+		if (!$output->data) return array();
532 532
 
533 533
 		$result = array();
534
-		foreach($output->data as $key=>$val)
534
+		foreach ($output->data as $key=>$val)
535 535
 		{
536 536
 			$result[$val->member_srl][] = $val->title;
537 537
 		}
@@ -545,21 +545,21 @@  discard block
 block discarded – undo
545 545
 	{
546 546
 		$default_group = false;
547 547
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
548
-		if($oCacheHandler->isSupport())
548
+		if ($oCacheHandler->isSupport())
549 549
 		{
550 550
 			$columnList = array();
551
-			$object_key = 'default_group_' . $site_srl;
551
+			$object_key = 'default_group_'.$site_srl;
552 552
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
553 553
 			$default_group = $oCacheHandler->get($cache_key);
554 554
 		}
555 555
 
556
-		if($default_group === false)
556
+		if ($default_group === false)
557 557
 		{
558 558
 			$args = new stdClass();
559 559
 			$args->site_srl = $site_srl;
560 560
 			$output = executeQuery('member.getDefaultGroup', $args, $columnList);
561 561
 			$default_group = $output->data;
562
-			if($oCacheHandler->isSupport())
562
+			if ($oCacheHandler->isSupport())
563 563
 			{
564 564
 				$oCacheHandler->put($cache_key, $default_group);
565 565
 			}
@@ -593,25 +593,25 @@  discard block
 block discarded – undo
593 593
 	 */
594 594
 	function getGroups($site_srl = 0)
595 595
 	{
596
-		if(!$GLOBALS['__group_info__'][$site_srl])
596
+		if (!$GLOBALS['__group_info__'][$site_srl])
597 597
 		{
598 598
 			$result = array();
599 599
 
600
-			if(!isset($site_srl))
600
+			if (!isset($site_srl))
601 601
 			{
602 602
 				$site_srl = 0;
603 603
 			}
604 604
 
605 605
 			$group_list = false;
606 606
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
607
-			if($oCacheHandler->isSupport())
607
+			if ($oCacheHandler->isSupport())
608 608
 			{
609 609
 				$object_key = 'member_groups:site_'.$site_srl;
610 610
 				$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
611 611
 				$group_list = $oCacheHandler->get($cache_key);
612 612
 			}
613 613
 
614
-			if($group_list === false)
614
+			if ($group_list === false)
615 615
 			{
616 616
 				$args = new stdClass();
617 617
 				$args->site_srl = $site_srl;
@@ -620,16 +620,16 @@  discard block
 block discarded – undo
620 620
 				$output = executeQueryArray('member.getGroups', $args);
621 621
 				$group_list = $output->data;
622 622
 				//insert in cache
623
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
623
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
624 624
 			}
625 625
 
626
-			if(!$group_list)
626
+			if (!$group_list)
627 627
 			{
628 628
 				return array();
629 629
 			}
630 630
 
631 631
 
632
-			foreach($group_list as $val)
632
+			foreach ($group_list as $val)
633 633
 			{
634 634
 				$result[$val->group_srl] = $val;
635 635
 			}
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 		// Set to ignore if a super administrator.
661 661
 		$logged_info = Context::get('logged_info');
662 662
 
663
-		if(!$this->join_form_list)
663
+		if (!$this->join_form_list)
664 664
 		{
665 665
 			// Argument setting to sort list_order column
666 666
 			$args = new stdClass();
@@ -668,11 +668,11 @@  discard block
 block discarded – undo
668 668
 			$output = executeQuery('member.getJoinFormList', $args);
669 669
 			// NULL if output data deosn't exist
670 670
 			$join_form_list = $output->data;
671
-			if(!$join_form_list) return NULL;
671
+			if (!$join_form_list) return NULL;
672 672
 			// Need to unserialize because serialized array is inserted into DB in case of default_value
673
-			if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
673
+			if (!is_array($join_form_list)) $join_form_list = array($join_form_list);
674 674
 			$join_form_count = count($join_form_list);
675
-			for($i=0;$i<$join_form_count;$i++)
675
+			for ($i = 0; $i < $join_form_count; $i++)
676 676
 			{
677 677
 				$join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name);
678 678
 
@@ -684,10 +684,10 @@  discard block
 block discarded – undo
684 684
 				// Add language variable
685 685
 				$lang->extend_vars[$column_name] = $column_title;
686 686
 				// unserialize if the data type if checkbox, select and so on
687
-				if(in_array($column_type, array('checkbox','select','radio')))
687
+				if (in_array($column_type, array('checkbox', 'select', 'radio')))
688 688
 				{
689 689
 					$join_form_list[$i]->default_value = unserialize($default_value);
690
-					if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
690
+					if (!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
691 691
 				}
692 692
 				else
693 693
 				{
@@ -699,16 +699,16 @@  discard block
 block discarded – undo
699 699
 			$this->join_form_list = $list;
700 700
 		}
701 701
 		// Get object style if the filter_response is true
702
-		if($filter_response && count($this->join_form_list))
702
+		if ($filter_response && count($this->join_form_list))
703 703
 		{
704
-			foreach($this->join_form_list as $key => $val)
704
+			foreach ($this->join_form_list as $key => $val)
705 705
 			{
706
-				if($val->is_active != 'Y') continue;
706
+				if ($val->is_active != 'Y') continue;
707 707
 				unset($obj);
708 708
 				$obj->type = $val->column_type;
709 709
 				$obj->name = $val->column_name;
710 710
 				$obj->lang = $val->column_title;
711
-				if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false;
711
+				if ($logged_info->is_admin != 'Y') $obj->required = $val->required == 'Y' ?true:false;
712 712
 				else $obj->required = false;
713 713
 				$filter_output[] = $obj;
714 714
 
@@ -735,15 +735,15 @@  discard block
 block discarded – undo
735 735
 		$args->sort_index = "list_order";
736 736
 		$output = executeQueryArray('member.getJoinFormList', $args);
737 737
 
738
-		if(!$output->toBool())
738
+		if (!$output->toBool())
739 739
 		{
740 740
 			return array();
741 741
 		}
742 742
 
743 743
 		$joinFormList = array();
744
-		foreach($output->data as $val)
744
+		foreach ($output->data as $val)
745 745
 		{
746
-			if($val->is_active != 'Y')
746
+			if ($val->is_active != 'Y')
747 747
 			{
748 748
 				continue;
749 749
 			}
@@ -760,20 +760,20 @@  discard block
 block discarded – undo
760 760
 	function getCombineJoinForm($member_info)
761 761
 	{
762 762
 		$extend_form_list = $this->getJoinFormlist();
763
-		if(!$extend_form_list) return;
763
+		if (!$extend_form_list) return;
764 764
 		// Member info is open only to an administrator and him/herself when is_private is true.
765 765
 		$logged_info = Context::get('logged_info');
766 766
 
767
-		foreach($extend_form_list as $srl => $item)
767
+		foreach ($extend_form_list as $srl => $item)
768 768
 		{
769 769
 			$column_name = $item->column_name;
770 770
 			$value = $member_info->{$column_name};
771 771
 
772 772
 			// Change values depening on the type of extend form
773
-			switch($item->column_type)
773
+			switch ($item->column_type)
774 774
 			{
775 775
 				case 'checkbox' :
776
-					if($value && !is_array($value)) $value = array($value);
776
+					if ($value && !is_array($value)) $value = array($value);
777 777
 					break;
778 778
 				case 'text' :
779 779
 				case 'homepage' :
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 
788 788
 			$extend_form_list[$srl]->value = $value;
789 789
 
790
-			if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true;
790
+			if ($member_info->{'open_'.$column_name} == 'Y') $extend_form_list[$srl]->is_opened = true;
791 791
 			else $extend_form_list[$srl]->is_opened = false;
792 792
 		}
793 793
 		return $extend_form_list;
@@ -801,12 +801,12 @@  discard block
 block discarded – undo
801 801
 		$args->member_join_form_srl = $member_join_form_srl;
802 802
 		$output = executeQuery('member.getJoinForm', $args);
803 803
 		$join_form = $output->data;
804
-		if(!$join_form) return NULL;
804
+		if (!$join_form) return NULL;
805 805
 
806 806
 		$column_type = $join_form->column_type;
807 807
 		$default_value = $join_form->default_value;
808 808
 
809
-		if(in_array($column_type, array('checkbox','select','radio')))
809
+		if (in_array($column_type, array('checkbox', 'select', 'radio')))
810 810
 		{
811 811
 			$join_form->default_value = unserialize($default_value);
812 812
 		}
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 	 */
824 824
 	function getDeniedIDList()
825 825
 	{
826
-		if(!$this->denied_id_list)
826
+		if (!$this->denied_id_list)
827 827
 		{
828 828
 			$args->sort_index = "list_order";
829 829
 			$args->page = Context::get('page');
@@ -839,14 +839,14 @@  discard block
 block discarded – undo
839 839
 	function getDeniedIDs()
840 840
 	{
841 841
 		$output = executeQueryArray('member.getDeniedIDs');
842
-		if(!$output->toBool()) return array();
842
+		if (!$output->toBool()) return array();
843 843
 		return $output->data;
844 844
 	}
845 845
 
846 846
 	function getDeniedNickNames()
847 847
 	{
848 848
 		$output = executeQueryArray('member.getDeniedNickNames');
849
-		if(!$output->toBool())
849
+		if (!$output->toBool())
850 850
 		{
851 851
 			return array();
852 852
 		}
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 		$args = new stdClass();
863 863
 		$args->user_id = $user_id;
864 864
 		$output = executeQuery('member.chkDeniedID', $args);
865
-		if($output->data->count) return true;
865
+		if ($output->data->count) return true;
866 866
 		return false;
867 867
 	}
868 868
 
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 		$args = new stdClass();
875 875
 		$args->nick_name = $nickName;
876 876
 		$output = executeQuery('member.chkDeniedNickName', $args);
877
-		if($output->data->count) return true;
878
-		if(!$output->toBool())
877
+		if ($output->data->count) return true;
878
+		if (!$output->toBool())
879 879
 		{
880 880
 			return true;
881 881
 		}
@@ -886,20 +886,20 @@  discard block
 block discarded – undo
886 886
 	 */
887 887
 	function getProfileImage($member_srl)
888 888
 	{
889
-		if(!isset($GLOBALS['__member_info__']['profile_image'][$member_srl]))
889
+		if (!isset($GLOBALS['__member_info__']['profile_image'][$member_srl]))
890 890
 		{
891 891
 			$GLOBALS['__member_info__']['profile_image'][$member_srl] = null;
892
-			$exts = array('gif','jpg','png');
893
-			for($i=0;$i<3;$i++)
892
+			$exts = array('gif', 'jpg', 'png');
893
+			for ($i = 0; $i < 3; $i++)
894 894
 			{
895 895
 				$image_name_file = sprintf('files/member_extra_info/profile_image/%s%d.%s', getNumberingPath($member_srl), $member_srl, $exts[$i]);
896
-				if(file_exists($image_name_file))
896
+				if (file_exists($image_name_file))
897 897
 				{
898 898
 					list($width, $height, $type, $attrs) = getimagesize($image_name_file);
899 899
 					$info = new stdClass();
900 900
 					$info->width = $width;
901 901
 					$info->height = $height;
902
-					$info->src = Context::getRequestUri().$image_name_file . '?' . date('YmdHis', filemtime($image_name_file));
902
+					$info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file));
903 903
 					$info->file = './'.$image_name_file;
904 904
 					$GLOBALS['__member_info__']['profile_image'][$member_srl] = $info;
905 905
 					break;
@@ -915,16 +915,16 @@  discard block
 block discarded – undo
915 915
 	 */
916 916
 	function getImageName($member_srl)
917 917
 	{
918
-		if(!isset($GLOBALS['__member_info__']['image_name'][$member_srl]))
918
+		if (!isset($GLOBALS['__member_info__']['image_name'][$member_srl]))
919 919
 		{
920 920
 			$image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
921
-			if(file_exists($image_name_file))
921
+			if (file_exists($image_name_file))
922 922
 			{
923 923
 				list($width, $height, $type, $attrs) = getimagesize($image_name_file);
924 924
 				$info = new stdClass;
925 925
 				$info->width = $width;
926 926
 				$info->height = $height;
927
-				$info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file));
927
+				$info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file));
928 928
 				$info->file = './'.$image_name_file;
929 929
 				$GLOBALS['__member_info__']['image_name'][$member_srl] = $info;
930 930
 			}
@@ -938,15 +938,15 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	function getImageMark($member_srl)
940 940
 	{
941
-		if(!isset($GLOBALS['__member_info__']['image_mark'][$member_srl]))
941
+		if (!isset($GLOBALS['__member_info__']['image_mark'][$member_srl]))
942 942
 		{
943 943
 			$image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl);
944
-			if(file_exists($image_mark_file))
944
+			if (file_exists($image_mark_file))
945 945
 			{
946 946
 				list($width, $height, $type, $attrs) = getimagesize($image_mark_file);
947 947
 				$info->width = $width;
948 948
 				$info->height = $height;
949
-				$info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file));
949
+				$info->src = Context::getRequestUri().$image_mark_file.'?'.date('YmdHis', filemtime($image_mark_file));
950 950
 				$info->file = './'.$image_mark_file;
951 951
 				$GLOBALS['__member_info__']['image_mark'][$member_srl] = $info;
952 952
 			}
@@ -960,27 +960,27 @@  discard block
 block discarded – undo
960 960
 	/**
961 961
 	 * @brief Get the image mark of the group
962 962
 	 */
963
-	function getGroupImageMark($member_srl,$site_srl=0)
963
+	function getGroupImageMark($member_srl, $site_srl = 0)
964 964
 	{
965
-		if(!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl]))
965
+		if (!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl]))
966 966
 		{
967 967
 			$oModuleModel = getModel('module');
968 968
 			$config = $oModuleModel->getModuleConfig('member');
969
-			if($config->group_image_mark!='Y')
969
+			if ($config->group_image_mark != 'Y')
970 970
 			{
971 971
 				return null;
972 972
 			}
973
-			$member_group = $this->getMemberGroups($member_srl,$site_srl);
973
+			$member_group = $this->getMemberGroups($member_srl, $site_srl);
974 974
 			$groups_info = $this->getGroups($site_srl);
975
-			if(count($member_group) > 0 && is_array($member_group))
975
+			if (count($member_group) > 0 && is_array($member_group))
976 976
 			{
977 977
 				$memberGroups = array_keys($member_group);
978 978
 
979
-				foreach($groups_info as $group_srl=>$group_info)
979
+				foreach ($groups_info as $group_srl=>$group_info)
980 980
 				{
981
-					if(in_array($group_srl, $memberGroups))
981
+					if (in_array($group_srl, $memberGroups))
982 982
 					{
983
-						if($group_info->image_mark)
983
+						if ($group_info->image_mark)
984 984
 						{
985 985
 							$info = new stdClass();
986 986
 							$info->title = $group_info->title;
@@ -1004,10 +1004,10 @@  discard block
 block discarded – undo
1004 1004
 	 */
1005 1005
 	function getSignature($member_srl)
1006 1006
 	{
1007
-		if(!isset($GLOBALS['__member_info__']['signature'][$member_srl]))
1007
+		if (!isset($GLOBALS['__member_info__']['signature'][$member_srl]))
1008 1008
 		{
1009 1009
 			$filename = sprintf('files/member_extra_info/signature/%s%d.signature.php', getNumberingPath($member_srl), $member_srl);
1010
-			if(file_exists($filename))
1010
+			if (file_exists($filename))
1011 1011
 			{
1012 1012
 				$buff = FileHandler::readFile($filename);
1013 1013
 				$signature = preg_replace('/<\?.*?\?>/', '', $buff);
@@ -1025,10 +1025,10 @@  discard block
 block discarded – undo
1025 1025
 	 * @param int $member_srl Set this to member_srl when comparing a member's password (optional)
1026 1026
 	 * @return bool
1027 1027
 	 */
1028
-	function isValidPassword($hashed_password, $password_text, $member_srl=null)
1028
+	function isValidPassword($hashed_password, $password_text, $member_srl = null)
1029 1029
 	{
1030 1030
 		// False if no password in entered
1031
-		if(!$password_text)
1031
+		if (!$password_text)
1032 1032
 		{
1033 1033
 			return false;
1034 1034
 		}
@@ -1037,31 +1037,31 @@  discard block
 block discarded – undo
1037 1037
 		$oPassword = new Password();
1038 1038
 		$current_algorithm = $oPassword->checkAlgorithm($hashed_password);
1039 1039
 		$match = $oPassword->checkPassword($password_text, $hashed_password, $current_algorithm);
1040
-		if(!$match)
1040
+		if (!$match)
1041 1041
 		{
1042 1042
 			return false;
1043 1043
 		}
1044 1044
 		
1045 1045
 		// Update the encryption method if necessary
1046 1046
 		$config = $this->getMemberConfig();
1047
-		if($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N')
1047
+		if ($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N')
1048 1048
 		{
1049 1049
 			$need_upgrade = false;
1050 1050
 			
1051
-			if(!$need_upgrade)
1051
+			if (!$need_upgrade)
1052 1052
 			{
1053 1053
 				$required_algorithm = $oPassword->getCurrentlySelectedAlgorithm();
1054
-				if($required_algorithm !== $current_algorithm) $need_upgrade = true;
1054
+				if ($required_algorithm !== $current_algorithm) $need_upgrade = true;
1055 1055
 			}
1056 1056
 			
1057
-			if(!$need_upgrade)
1057
+			if (!$need_upgrade)
1058 1058
 			{
1059 1059
 				$required_work_factor = $oPassword->getWorkFactor();
1060 1060
 				$current_work_factor = $oPassword->checkWorkFactor($hashed_password);
1061
-				if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true;
1061
+				if ($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true;
1062 1062
 			}
1063 1063
 			
1064
-			if($need_upgrade === true)
1064
+			if ($need_upgrade === true)
1065 1065
 			{
1066 1066
 				$args = new stdClass();
1067 1067
 				$args->member_srl = $member_srl;
@@ -1089,27 +1089,27 @@  discard block
 block discarded – undo
1089 1089
 	function checkPasswordStrength($password, $strength)
1090 1090
 	{
1091 1091
 		$logged_info = Context::get('logged_info');
1092
-		if($logged_info->is_admin == 'Y') return true;
1092
+		if ($logged_info->is_admin == 'Y') return true;
1093 1093
 		
1094
-		if($strength == NULL)
1094
+		if ($strength == NULL)
1095 1095
 		{
1096 1096
 			$config = $this->getMemberConfig();
1097
-			$strength = $config->password_strength?$config->password_strength:'normal';
1097
+			$strength = $config->password_strength ? $config->password_strength : 'normal';
1098 1098
 		}
1099 1099
 		
1100 1100
 		$length = strlen($password);
1101 1101
 		
1102 1102
 		switch ($strength) {
1103 1103
 			case 'high':
1104
-				if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false;
1104
+				if ($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false;
1105 1105
 				/* no break */
1106 1106
 				
1107 1107
 			case 'normal':
1108
-				if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false;
1108
+				if ($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false;
1109 1109
 				break;
1110 1110
 				
1111 1111
 			case 'low':
1112
-				if($length < 4) return false;
1112
+				if ($length < 4) return false;
1113 1113
 				break; 
1114 1114
 		}
1115 1115
 		
@@ -1120,11 +1120,11 @@  discard block
 block discarded – undo
1120 1120
 	{
1121 1121
 		$groupSrl = 0;
1122 1122
 		$output = $this->getGroups($site_srl);
1123
-		if(is_array($output))
1123
+		if (is_array($output))
1124 1124
 		{
1125
-			foreach($output AS $key=>$value)
1125
+			foreach ($output AS $key=>$value)
1126 1126
 			{
1127
-				if($value->is_admin == 'Y')
1127
+				if ($value->is_admin == 'Y')
1128 1128
 				{
1129 1129
 					$groupSrl = $value->group_srl;
1130 1130
 					break;
Please login to merge, or discard this patch.
Braces   +211 added lines, -86 removed lines patch added patch discarded remove patch
@@ -45,37 +45,79 @@  discard block
 block discarded – undo
45 45
 		foreach($config->signupForm AS $key=>$value)
46 46
 		{
47 47
 			$config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title;
48
-			if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y';
49
-			if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N';
48
+			if($config->signupForm[$key]->isPublic != 'N') {
49
+				$config->signupForm[$key]->isPublic = 'Y';
50
+			}
51
+			if($value->name == 'find_account_question') {
52
+				$config->signupForm[$key]->isPublic = 'N';
53
+			}
50 54
 		}
51 55
 
52 56
 		// Get terms of user
53 57
 		$config->agreement = memberModel::_getAgreement();
54 58
 
55
-		if(!$config->webmaster_name) $config->webmaster_name = 'webmaster';
59
+		if(!$config->webmaster_name) {
60
+			$config->webmaster_name = 'webmaster';
61
+		}
56 62
 
57
-		if(!$config->image_name_max_width) $config->image_name_max_width = 90;
58
-		if(!$config->image_name_max_height) $config->image_name_max_height = 20;
59
-		if(!$config->image_name_max_filesize) $config->image_name_max_filesize = null;
60
-		if(!$config->image_mark_max_width) $config->image_mark_max_width = 20;
61
-		if(!$config->image_mark_max_height) $config->image_mark_max_height = 20;
62
-		if(!$config->image_mark_max_filesize) $config->image_mark_max_filesize = null;
63
-		if(!$config->profile_image_max_width) $config->profile_image_max_width = 90;
64
-		if(!$config->profile_image_max_height) $config->profile_image_max_height = 90;
65
-		if(!$config->profile_image_max_filesize) $config->profile_image_max_filesize = null;
63
+		if(!$config->image_name_max_width) {
64
+			$config->image_name_max_width = 90;
65
+		}
66
+		if(!$config->image_name_max_height) {
67
+			$config->image_name_max_height = 20;
68
+		}
69
+		if(!$config->image_name_max_filesize) {
70
+			$config->image_name_max_filesize = null;
71
+		}
72
+		if(!$config->image_mark_max_width) {
73
+			$config->image_mark_max_width = 20;
74
+		}
75
+		if(!$config->image_mark_max_height) {
76
+			$config->image_mark_max_height = 20;
77
+		}
78
+		if(!$config->image_mark_max_filesize) {
79
+			$config->image_mark_max_filesize = null;
80
+		}
81
+		if(!$config->profile_image_max_width) {
82
+			$config->profile_image_max_width = 90;
83
+		}
84
+		if(!$config->profile_image_max_height) {
85
+			$config->profile_image_max_height = 90;
86
+		}
87
+		if(!$config->profile_image_max_filesize) {
88
+			$config->profile_image_max_filesize = null;
89
+		}
66 90
 
67
-		if(!$config->skin) $config->skin = 'default';
68
-		if(!$config->colorset) $config->colorset = 'white';
69
-		if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor';
70
-		if(!$config->group_image_mark) $config->group_image_mark = "N";
91
+		if(!$config->skin) {
92
+			$config->skin = 'default';
93
+		}
94
+		if(!$config->colorset) {
95
+			$config->colorset = 'white';
96
+		}
97
+		if(!$config->editor_skin || $config->editor_skin == 'default') {
98
+			$config->editor_skin = 'ckeditor';
99
+		}
100
+		if(!$config->group_image_mark) {
101
+			$config->group_image_mark = "N";
102
+		}
71 103
 
72
-		if(!$config->identifier) $config->identifier = 'user_id';
104
+		if(!$config->identifier) {
105
+			$config->identifier = 'user_id';
106
+		}
73 107
 
74
-		if(!$config->max_error_count) $config->max_error_count = 10;
75
-		if(!$config->max_error_count_time) $config->max_error_count_time = 300;
108
+		if(!$config->max_error_count) {
109
+			$config->max_error_count = 10;
110
+		}
111
+		if(!$config->max_error_count_time) {
112
+			$config->max_error_count_time = 300;
113
+		}
76 114
 
77
-		if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor';
78
-		if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono';
115
+		if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') {
116
+			$config->signature_editor_skin = 'ckeditor';
117
+		}
118
+		if(!$config->sel_editor_colorset) {
119
+			$config->sel_editor_colorset = 'moono';
120
+		}
79 121
 
80 122
 		$member_config = $config;
81 123
 
@@ -121,12 +163,18 @@  discard block
 block discarded – undo
121 163
 		$logged_info = Context::get('logged_info');
122 164
 		$act = Context::get('cur_act');
123 165
 		// When click user's own nickname
124
-		if($member_srl == $logged_info->member_srl) $member_info = $logged_info;
166
+		if($member_srl == $logged_info->member_srl) {
167
+			$member_info = $logged_info;
168
+		}
125 169
 		// When click other's nickname
126
-		else $member_info = $this->getMemberInfoByMemberSrl($member_srl);
170
+		else {
171
+			$member_info = $this->getMemberInfoByMemberSrl($member_srl);
172
+		}
127 173
 
128 174
 		$member_srl = $member_info->member_srl;
129
-		if(!$member_srl) return;
175
+		if(!$member_srl) {
176
+			return;
177
+		}
130 178
 		// List variables
131 179
 		$user_id = $member_info->user_id;
132 180
 		$user_name = $member_info->user_name;
@@ -161,11 +209,13 @@  discard block
 block discarded – undo
161 209
 			}
162 210
 		}
163 211
 		// View homepage info
164
-		if($member_info->homepage)
165
-			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank');
212
+		if($member_info->homepage) {
213
+					$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'homepage', '', 'blank');
214
+		}
166 215
 		// View blog info
167
-		if($member_info->blog)
168
-			$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank');
216
+		if($member_info->blog) {
217
+					$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 'blog', '', 'blank');
218
+		}
169 219
 		// Call a trigger (after)
170 220
 		ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null);
171 221
 		// Display a menu for editting member info to a top administrator
@@ -200,16 +250,14 @@  discard block
 block discarded – undo
200 250
 			if(Mobile::isFromMobilePhone())
201 251
 			{
202 252
 				return true;
203
-			}
204
-			elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
253
+			} elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
205 254
 			{
206 255
 				// IPv6: require same /48
207 256
 				if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0)
208 257
 				{
209 258
 					return true;
210 259
 				}
211
-			}
212
-			else
260
+			} else
213 261
 			{
214 262
 				// IPv4: require same /24
215 263
 				if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8)
@@ -239,10 +287,12 @@  discard block
 block discarded – undo
239 287
 				$logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl);
240 288
 				// Add is_site_admin bool variable into logged_info if site_administrator is
241 289
 				$oModuleModel = getModel('module');
242
-				if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true;
243
-				else $logged_info->is_site_admin = false;
244
-			}
245
-			else
290
+				if($oModuleModel->isSiteAdmin($logged_info)) {
291
+					$logged_info->is_site_admin = true;
292
+				} else {
293
+					$logged_info->is_site_admin = false;
294
+				}
295
+			} else
246 296
 			{
247 297
 				// Register a default group if the site doesn't have a member group
248 298
 				if(count($logged_info->group_list) === 0)
@@ -268,13 +318,19 @@  discard block
 block discarded – undo
268 318
 	 */
269 319
 	function getMemberInfoByUserID($user_id, $columnList = array())
270 320
 	{
271
-		if(!$user_id) return;
321
+		if(!$user_id) {
322
+			return;
323
+		}
272 324
 
273 325
 		$args = new stdClass;
274 326
 		$args->user_id = $user_id;
275 327
 		$output = executeQuery('member.getMemberInfo', $args);
276
-		if(!$output->toBool()) return $output;
277
-		if(!$output->data) return;
328
+		if(!$output->toBool()) {
329
+			return $output;
330
+		}
331
+		if(!$output->data) {
332
+			return;
333
+		}
278 334
 
279 335
 		$member_info = $this->arrangeMemberInfo($output->data);
280 336
 
@@ -286,7 +342,9 @@  discard block
 block discarded – undo
286 342
 	 */
287 343
 	function getMemberInfoByEmailAddress($email_address)
288 344
 	{
289
-		if(!$email_address) return;
345
+		if(!$email_address) {
346
+			return;
347
+		}
290 348
 
291 349
 		$args = new stdClass();
292 350
 		
@@ -295,15 +353,18 @@  discard block
 block discarded – undo
295 353
 		{
296 354
 			$args->email_address = strtolower($email_address);
297 355
 			$output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args);
298
-		}
299
-		else
356
+		} else
300 357
 		{
301 358
 			$args->email_address = $email_address;
302 359
 			$output = executeQuery('member.getMemberInfoByEmailAddress', $args);
303 360
 		}
304 361
 		
305
-		if(!$output->toBool()) return $output;
306
-		if(!$output->data) return;
362
+		if(!$output->toBool()) {
363
+			return $output;
364
+		}
365
+		if(!$output->data) {
366
+			return;
367
+		}
307 368
 
308 369
 		$member_info = $this->arrangeMemberInfo($output->data);
309 370
 		return $member_info;
@@ -314,7 +375,9 @@  discard block
 block discarded – undo
314 375
 	 */
315 376
 	function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array())
316 377
 	{
317
-		if(!$member_srl) return;
378
+		if(!$member_srl) {
379
+			return;
380
+		}
318 381
 
319 382
 		//columnList size zero... get full member info
320 383
 		if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0)
@@ -337,13 +400,17 @@  discard block
 block discarded – undo
337 400
 				$output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList);
338 401
 				if(!$output->data) 
339 402
 				{
340
-					if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass);
403
+					if($oCacheHandler->isSupport()) {
404
+						$oCacheHandler->put($cache_key, new stdClass);
405
+					}
341 406
 					return;
342 407
 				}
343 408
 				$this->arrangeMemberInfo($output->data, $site_srl);
344 409
 
345 410
 				//insert in cache
346
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
411
+				if($oCacheHandler->isSupport()) {
412
+					$oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]);
413
+				}
347 414
 			}
348 415
 		}
349 416
 
@@ -377,8 +444,12 @@  discard block
 block discarded – undo
377 444
 			{
378 445
 				foreach($extra_vars as $key => $val)
379 446
 				{
380
-					if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val);
381
-					if(!$info->{$key}) $info->{$key} = $val;
447
+					if(!is_array($val) && strpos($val, '|@|') !== FALSE) {
448
+						$val = explode('|@|', $val);
449
+					}
450
+					if(!$info->{$key}) {
451
+						$info->{$key} = $val;
452
+					}
382 453
 				}
383 454
 			}
384 455
 
@@ -401,8 +472,7 @@  discard block
 block discarded – undo
401 472
 					if(is_array($val))
402 473
 					{
403 474
 						$oSecurity->encodeHTML($key . '.');
404
-					}
405
-					else
475
+					} else
406 476
 					{
407 477
 						$oSecurity->encodeHTML($key);
408 478
 					}
@@ -465,7 +535,9 @@  discard block
 block discarded – undo
465 535
 	 */
466 536
 	function getLoggedMemberSrl()
467 537
 	{
468
-		if(!$this->isLogged()) return;
538
+		if(!$this->isLogged()) {
539
+			return;
540
+		}
469 541
 		return $_SESSION['member_srl'];
470 542
 	}
471 543
 
@@ -474,7 +546,9 @@  discard block
 block discarded – undo
474 546
 	 */
475 547
 	function getLoggedUserID()
476 548
 	{
477
-		if(!$this->isLogged()) return;
549
+		if(!$this->isLogged()) {
550
+			return;
551
+		}
478 552
 		$logged_info = Context::get('logged_info');
479 553
 		return $logged_info->user_id;
480 554
 	}
@@ -506,9 +580,13 @@  discard block
 block discarded – undo
506 580
 				$output = executeQueryArray('member.getMemberGroups', $args);
507 581
 				$group_list = $output->data;
508 582
 				//insert in cache
509
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
583
+				if($oCacheHandler->isSupport()) {
584
+					$oCacheHandler->put($cache_key, $group_list);
585
+				}
586
+			}
587
+			if(!$group_list) {
588
+				return array();
510 589
 			}
511
-			if(!$group_list) return array();
512 590
 
513 591
 			foreach($group_list as $group)
514 592
 			{
@@ -528,7 +606,9 @@  discard block
 block discarded – undo
528 606
 		$args->site_srl = $site_srl;
529 607
 		$args->sort_index = 'list_order';
530 608
 		$output = executeQueryArray('member.getMembersGroups', $args);
531
-		if(!$output->data) return array();
609
+		if(!$output->data) {
610
+			return array();
611
+		}
532 612
 
533 613
 		$result = array();
534 614
 		foreach($output->data as $key=>$val)
@@ -620,7 +700,9 @@  discard block
 block discarded – undo
620 700
 				$output = executeQueryArray('member.getGroups', $args);
621 701
 				$group_list = $output->data;
622 702
 				//insert in cache
623
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list);
703
+				if($oCacheHandler->isSupport()) {
704
+					$oCacheHandler->put($cache_key, $group_list);
705
+				}
624 706
 			}
625 707
 
626 708
 			if(!$group_list)
@@ -668,9 +750,13 @@  discard block
 block discarded – undo
668 750
 			$output = executeQuery('member.getJoinFormList', $args);
669 751
 			// NULL if output data deosn't exist
670 752
 			$join_form_list = $output->data;
671
-			if(!$join_form_list) return NULL;
753
+			if(!$join_form_list) {
754
+				return NULL;
755
+			}
672 756
 			// Need to unserialize because serialized array is inserted into DB in case of default_value
673
-			if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
757
+			if(!is_array($join_form_list)) {
758
+				$join_form_list = array($join_form_list);
759
+			}
674 760
 			$join_form_count = count($join_form_list);
675 761
 			for($i=0;$i<$join_form_count;$i++)
676 762
 			{
@@ -687,9 +773,10 @@  discard block
 block discarded – undo
687 773
 				if(in_array($column_type, array('checkbox','select','radio')))
688 774
 				{
689 775
 					$join_form_list[$i]->default_value = unserialize($default_value);
690
-					if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
691
-				}
692
-				else
776
+					if(!$join_form_list[$i]->default_value[0]) {
777
+						$join_form_list[$i]->default_value = '';
778
+					}
779
+				} else
693 780
 				{
694 781
 					$join_form_list[$i]->default_value = '';
695 782
 				}
@@ -703,13 +790,18 @@  discard block
 block discarded – undo
703 790
 		{
704 791
 			foreach($this->join_form_list as $key => $val)
705 792
 			{
706
-				if($val->is_active != 'Y') continue;
793
+				if($val->is_active != 'Y') {
794
+					continue;
795
+				}
707 796
 				unset($obj);
708 797
 				$obj->type = $val->column_type;
709 798
 				$obj->name = $val->column_name;
710 799
 				$obj->lang = $val->column_title;
711
-				if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false;
712
-				else $obj->required = false;
800
+				if($logged_info->is_admin != 'Y') {
801
+					$obj->required = $val->required=='Y'?true:false;
802
+				} else {
803
+					$obj->required = false;
804
+				}
713 805
 				$filter_output[] = $obj;
714 806
 
715 807
 				unset($open_obj);
@@ -760,7 +852,9 @@  discard block
 block discarded – undo
760 852
 	function getCombineJoinForm($member_info)
761 853
 	{
762 854
 		$extend_form_list = $this->getJoinFormlist();
763
-		if(!$extend_form_list) return;
855
+		if(!$extend_form_list) {
856
+			return;
857
+		}
764 858
 		// Member info is open only to an administrator and him/herself when is_private is true.
765 859
 		$logged_info = Context::get('logged_info');
766 860
 
@@ -773,7 +867,9 @@  discard block
 block discarded – undo
773 867
 			switch($item->column_type)
774 868
 			{
775 869
 				case 'checkbox' :
776
-					if($value && !is_array($value)) $value = array($value);
870
+					if($value && !is_array($value)) {
871
+						$value = array($value);
872
+					}
777 873
 					break;
778 874
 				case 'text' :
779 875
 				case 'homepage' :
@@ -787,8 +883,11 @@  discard block
 block discarded – undo
787 883
 
788 884
 			$extend_form_list[$srl]->value = $value;
789 885
 
790
-			if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true;
791
-			else $extend_form_list[$srl]->is_opened = false;
886
+			if($member_info->{'open_'.$column_name}=='Y') {
887
+				$extend_form_list[$srl]->is_opened = true;
888
+			} else {
889
+				$extend_form_list[$srl]->is_opened = false;
890
+			}
792 891
 		}
793 892
 		return $extend_form_list;
794 893
 	}
@@ -801,7 +900,9 @@  discard block
 block discarded – undo
801 900
 		$args->member_join_form_srl = $member_join_form_srl;
802 901
 		$output = executeQuery('member.getJoinForm', $args);
803 902
 		$join_form = $output->data;
804
-		if(!$join_form) return NULL;
903
+		if(!$join_form) {
904
+			return NULL;
905
+		}
805 906
 
806 907
 		$column_type = $join_form->column_type;
807 908
 		$default_value = $join_form->default_value;
@@ -809,8 +910,7 @@  discard block
 block discarded – undo
809 910
 		if(in_array($column_type, array('checkbox','select','radio')))
810 911
 		{
811 912
 			$join_form->default_value = unserialize($default_value);
812
-		}
813
-		else
913
+		} else
814 914
 		{
815 915
 			$join_form->default_value = '';
816 916
 		}
@@ -839,7 +939,9 @@  discard block
 block discarded – undo
839 939
 	function getDeniedIDs()
840 940
 	{
841 941
 		$output = executeQueryArray('member.getDeniedIDs');
842
-		if(!$output->toBool()) return array();
942
+		if(!$output->toBool()) {
943
+			return array();
944
+		}
843 945
 		return $output->data;
844 946
 	}
845 947
 
@@ -862,7 +964,9 @@  discard block
 block discarded – undo
862 964
 		$args = new stdClass();
863 965
 		$args->user_id = $user_id;
864 966
 		$output = executeQuery('member.chkDeniedID', $args);
865
-		if($output->data->count) return true;
967
+		if($output->data->count) {
968
+			return true;
969
+		}
866 970
 		return false;
867 971
 	}
868 972
 
@@ -874,7 +978,9 @@  discard block
 block discarded – undo
874 978
 		$args = new stdClass();
875 979
 		$args->nick_name = $nickName;
876 980
 		$output = executeQuery('member.chkDeniedNickName', $args);
877
-		if($output->data->count) return true;
981
+		if($output->data->count) {
982
+			return true;
983
+		}
878 984
 		if(!$output->toBool())
879 985
 		{
880 986
 			return true;
@@ -927,8 +1033,9 @@  discard block
 block discarded – undo
927 1033
 				$info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file));
928 1034
 				$info->file = './'.$image_name_file;
929 1035
 				$GLOBALS['__member_info__']['image_name'][$member_srl] = $info;
1036
+			} else {
1037
+				$GLOBALS['__member_info__']['image_name'][$member_srl] = null;
930 1038
 			}
931
-			else $GLOBALS['__member_info__']['image_name'][$member_srl] = null;
932 1039
 		}
933 1040
 		return $GLOBALS['__member_info__']['image_name'][$member_srl];
934 1041
 	}
@@ -949,8 +1056,9 @@  discard block
 block discarded – undo
949 1056
 				$info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file));
950 1057
 				$info->file = './'.$image_mark_file;
951 1058
 				$GLOBALS['__member_info__']['image_mark'][$member_srl] = $info;
1059
+			} else {
1060
+				$GLOBALS['__member_info__']['image_mark'][$member_srl] = null;
952 1061
 			}
953
-			else $GLOBALS['__member_info__']['image_mark'][$member_srl] = null;
954 1062
 		}
955 1063
 
956 1064
 		return $GLOBALS['__member_info__']['image_mark'][$member_srl];
@@ -992,9 +1100,13 @@  discard block
 block discarded – undo
992 1100
 					}
993 1101
 				}
994 1102
 			}
995
-			if (!$info) $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N';
1103
+			if (!$info) {
1104
+				$GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N';
1105
+			}
1106
+		}
1107
+		if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') {
1108
+			return null;
996 1109
 		}
997
-		if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') return null;
998 1110
 
999 1111
 		return $GLOBALS['__member_info__']['group_image_mark'][$member_srl];
1000 1112
 	}
@@ -1012,8 +1124,9 @@  discard block
 block discarded – undo
1012 1124
 				$buff = FileHandler::readFile($filename);
1013 1125
 				$signature = preg_replace('/<\?.*?\?>/', '', $buff);
1014 1126
 				$GLOBALS['__member_info__']['signature'][$member_srl] = $signature;
1127
+			} else {
1128
+				$GLOBALS['__member_info__']['signature'][$member_srl] = null;
1015 1129
 			}
1016
-			else $GLOBALS['__member_info__']['signature'][$member_srl] = null;
1017 1130
 		}
1018 1131
 		return $GLOBALS['__member_info__']['signature'][$member_srl];
1019 1132
 	}
@@ -1051,14 +1164,18 @@  discard block
 block discarded – undo
1051 1164
 			if(!$need_upgrade)
1052 1165
 			{
1053 1166
 				$required_algorithm = $oPassword->getCurrentlySelectedAlgorithm();
1054
-				if($required_algorithm !== $current_algorithm) $need_upgrade = true;
1167
+				if($required_algorithm !== $current_algorithm) {
1168
+					$need_upgrade = true;
1169
+				}
1055 1170
 			}
1056 1171
 			
1057 1172
 			if(!$need_upgrade)
1058 1173
 			{
1059 1174
 				$required_work_factor = $oPassword->getWorkFactor();
1060 1175
 				$current_work_factor = $oPassword->checkWorkFactor($hashed_password);
1061
-				if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true;
1176
+				if($current_work_factor !== false && $required_work_factor > $current_work_factor) {
1177
+					$need_upgrade = true;
1178
+				}
1062 1179
 			}
1063 1180
 			
1064 1181
 			if($need_upgrade === true)
@@ -1089,7 +1206,9 @@  discard block
 block discarded – undo
1089 1206
 	function checkPasswordStrength($password, $strength)
1090 1207
 	{
1091 1208
 		$logged_info = Context::get('logged_info');
1092
-		if($logged_info->is_admin == 'Y') return true;
1209
+		if($logged_info->is_admin == 'Y') {
1210
+			return true;
1211
+		}
1093 1212
 		
1094 1213
 		if($strength == NULL)
1095 1214
 		{
@@ -1101,15 +1220,21 @@  discard block
 block discarded – undo
1101 1220
 		
1102 1221
 		switch ($strength) {
1103 1222
 			case 'high':
1104
-				if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false;
1223
+				if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) {
1224
+					return false;
1225
+				}
1105 1226
 				/* no break */
1106 1227
 				
1107 1228
 			case 'normal':
1108
-				if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false;
1229
+				if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) {
1230
+					return false;
1231
+				}
1109 1232
 				break;
1110 1233
 				
1111 1234
 			case 'low':
1112
-				if($length < 4) return false;
1235
+				if($length < 4) {
1236
+					return false;
1237
+				}
1113 1238
 				break; 
1114 1239
 		}
1115 1240
 		
Please login to merge, or discard this patch.
modules/menu/menu.mobile.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@
 block discarded – undo
18 18
 
19 19
 	/**
20 20
 	 * Menu depth arrange
21
+	 * @param integer $depth
21 22
 	 * @return void
22 23
 	 */
23 24
 	function straightenMenu($menu_item, $depth)
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,14 +22,18 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	function straightenMenu($menu_item, $depth)
24 24
 	{
25
-		if(!$menu_item['link']) return;
25
+		if(!$menu_item['link']) {
26
+			return;
27
+		}
26 28
 		$obj = new stdClass;
27 29
 		$obj->href = $menu_item['href'];
28 30
 		$obj->depth = $depth;
29 31
 		$obj->text = $menu_item['text'];
30 32
 		$obj->open_window = $menu_item['open_window'];
31 33
 		$this->result[] = $obj;
32
-		if(!$menu_item['list']) return;
34
+		if(!$menu_item['list']) {
35
+			return;
36
+		}
33 37
 		foreach($menu_item['list'] as $item)
34 38
 		{
35 39
 			$this->straightenMenu($item, $depth+1);
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
 			$menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php';
59 63
 		}
60 64
 
61
-		if(file_exists($menu_info->php_file)) @include($menu_info->php_file);
65
+		if(file_exists($menu_info->php_file)) {
66
+			@include($menu_info->php_file);
67
+		}
62 68
 		if(is_array($menu->list))
63 69
 		{
64 70
 			foreach($menu->list as $menu_item)
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	function straightenMenu($menu_item, $depth)
24 24
 	{
25
-		if(!$menu_item['link']) return;
25
+		if (!$menu_item['link']) return;
26 26
 		$obj = new stdClass;
27 27
 		$obj->href = $menu_item['href'];
28 28
 		$obj->depth = $depth;
29 29
 		$obj->text = $menu_item['text'];
30 30
 		$obj->open_window = $menu_item['open_window'];
31 31
 		$this->result[] = $obj;
32
-		if(!$menu_item['list']) return;
33
-		foreach($menu_item['list'] as $item)
32
+		if (!$menu_item['list']) return;
33
+		foreach ($menu_item['list'] as $item)
34 34
 		{
35
-			$this->straightenMenu($item, $depth+1);
35
+			$this->straightenMenu($item, $depth + 1);
36 36
 		}
37 37
 	}
38 38
 
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 	function dispMenuMenu()
44 44
 	{
45 45
 		$menu_srl = Context::get('menu_srl');
46
-		$oAdminModel =& getAdminModel('menu');
46
+		$oAdminModel = & getAdminModel('menu');
47 47
 		$menu_info = $oAdminModel->getMenu($menu_srl);
48 48
 
49
-		if(!$menu_srl)
49
+		if (!$menu_srl)
50 50
 		{
51 51
 			$oMenuAdminController = getAdminController('menu');
52 52
 			$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
53 53
 
54
-			if(file_exists($homeMenuCacheFile))
54
+			if (file_exists($homeMenuCacheFile))
55 55
 			{
56 56
 				@include($homeMenuCacheFile);
57 57
 			}
58 58
 			$menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php';
59 59
 		}
60 60
 
61
-		if(file_exists($menu_info->php_file)) @include($menu_info->php_file);
62
-		if(is_array($menu->list))
61
+		if (file_exists($menu_info->php_file)) @include($menu_info->php_file);
62
+		if (is_array($menu->list))
63 63
 		{
64
-			foreach($menu->list as $menu_item)
64
+			foreach ($menu->list as $menu_item)
65 65
 			{
66 66
 				$this->straightenMenu($menu_item, 0);
67 67
 			}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 		Context::set('menu', $this->result);	
71 71
 
72
-		$this->setTemplatePath(sprintf("%stpl/",$this->module_path));
72
+		$this->setTemplatePath(sprintf("%stpl/", $this->module_path));
73 73
 		$this->setTemplateFile('menu.html');
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
modules/module/module.admin.controller.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -260,6 +260,9 @@  discard block
 block discarded – undo
260 260
 		return $module_srl;
261 261
 	}
262 262
 
263
+	/**
264
+	 * @param boolean $isProc
265
+	 */
263 266
 	private function _returnByProc($isProc, $msg='msg_invalid_request')
264 267
 	{
265 268
 		if(!$isProc)
@@ -938,6 +941,9 @@  discard block
 block discarded – undo
938 941
 
939 942
 	}
940 943
 
944
+	/**
945
+	 * @param string $skinVars
946
+	 */
941 947
 	public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL)
942 948
 	{
943 949
 		if(!$moduleSrl && !$mid)
Please login to merge, or discard this patch.
Spacing   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if (!$output->toBool()) return $output;
26 26
 
27 27
 		$this->setMessage("success_registed");
28 28
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	function procModuleAdminUpdateCategory()
37 37
 	{
38 38
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
39
+		if (!$output->toBool()) return $output;
40 40
 
41 41
 		$this->setMessage('success_updated');
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	function procModuleAdminDeleteCategory()
51 51
 	{
52 52
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
53
+		if (!$output->toBool()) return $output;
54 54
 
55 55
 		$this->setMessage('success_deleted');
56 56
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	function procModuleAdminCopyModule($args = NULL)
86 86
 	{
87 87
 		$isProc = false;
88
-		if(!$args)
88
+		if (!$args)
89 89
 		{
90 90
 			$isProc = true;
91 91
 			// Get information of the target module to copy
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
 			$module_srl = $args->module_srl;
98 98
 		}
99 99
 
100
-		if(!$module_srl)
100
+		if (!$module_srl)
101 101
 		{
102 102
 			return $this->_returnByProc($isProc);
103 103
 		}
104 104
 
105 105
 		// Get module name to create and browser title
106 106
 		$clones = array();
107
-		for($i=1;$i<=10;$i++)
107
+		for ($i = 1; $i <= 10; $i++)
108 108
 		{
109 109
 			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid');
110
+			if (!$mid) continue;
111
+			if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid');
112 112
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
113
+			if (!$mid) continue;
114
+			if ($mid && !$browser_title) $browser_title = $mid;
115 115
 			$clones[$mid] = $browser_title;
116 116
 		}
117
-		if(count($clones) < 1)
117
+		if (count($clones) < 1)
118 118
 		{
119 119
 			return $this->_returnByProc($isProc);
120 120
 		}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 		$module_args->module_srl = $module_srl;
130 130
 		$output = executeQueryArray('module.getModuleGrants', $module_args);
131 131
 		$grant = array();
132
-		if($output->data)
132
+		if ($output->data)
133 133
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
134
+			foreach ($output->data as $val) $grant[$val->name][] = $val->group_srl;
135 135
 		}
136 136
 
137 137
 		// get Extra Vars
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 		$extra_args->module_srl = $module_srl;
140 140
 		$extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args);
141 141
 		$extra_vars = new stdClass();
142
-		if($extra_output->toBool() && is_array($extra_output->data))
142
+		if ($extra_output->toBool() && is_array($extra_output->data))
143 143
 		{
144
-			foreach($extra_output->data as $info)
144
+			foreach ($extra_output->data as $info)
145 145
 			{
146 146
 				$extra_vars->{$info->name} = $info->value;
147 147
 			}
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 		$tmpModuleSkinVars = $oModuleModel->getModuleSkinVars($module_srl);
151 151
 		$tmpModuleMobileSkinVars = $oModuleModel->getModuleMobileSkinVars($module_srl);
152 152
 
153
-		if($tmpModuleSkinVars)
153
+		if ($tmpModuleSkinVars)
154 154
 		{
155
-			foreach($tmpModuleSkinVars as $key=>$value)
155
+			foreach ($tmpModuleSkinVars as $key=>$value)
156 156
 			{
157 157
 				$moduleSkinVars->{$key} = $value->value;
158 158
 			}
159 159
 		}
160 160
 
161
-		if($tmpModuleMobileSkinVars)
161
+		if ($tmpModuleMobileSkinVars)
162 162
 		{
163
-			foreach($tmpModuleMobileSkinVars as $key=>$value)
163
+			foreach ($tmpModuleMobileSkinVars as $key=>$value)
164 164
 			{
165 165
 				$moduleMobileSkinVars->{$key} = $value->value;
166 166
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		$triggerObj->moduleSrlList = array();
175 175
 
176 176
 		$errorLog = array();
177
-		foreach($clones as $mid => $browser_title)
177
+		foreach ($clones as $mid => $browser_title)
178 178
 		{
179 179
 			$clone_args = new stdClass;
180 180
 			$clone_args = clone $module_info;
@@ -188,29 +188,29 @@  discard block
 block discarded – undo
188 188
 			// Create a module
189 189
 			$output = $oModuleController->insertModule($clone_args);
190 190
 
191
-			if(!$output->toBool())
191
+			if (!$output->toBool())
192 192
 			{
193
-				$errorLog[] = $mid . ' : '. $output->message;
193
+				$errorLog[] = $mid.' : '.$output->message;
194 194
 				continue;
195 195
 			}
196 196
 			$module_srl = $output->get('module_srl');
197 197
 
198
-			if($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
198
+			if ($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
199 199
 			{
200 200
 				// copy document
201 201
 				$oDocumentAdminController = getAdminController('document');
202 202
 				$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->document_srl), $module_srl, $module_info->category_srl);
203 203
 				$document_srls = $copyOutput->get('copied_srls');
204
-				if($document_srls && count($document_srls) > 0)
204
+				if ($document_srls && count($document_srls) > 0)
205 205
 				{
206 206
 					$extra_vars->document_srl = array_pop($document_srls);
207 207
 				}
208 208
 
209
-				if($extra_vars->mdocument_srl)
209
+				if ($extra_vars->mdocument_srl)
210 210
 				{
211 211
 					$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl);
212 212
 					$copiedSrls = $copyOutput->get('copied_srls');
213
-					if($copiedSrls && count($copiedSrls) > 0)
213
+					if ($copiedSrls && count($copiedSrls) > 0)
214 214
 					{
215 215
 						$extra_vars->mdocument_srl = array_pop($copiedSrls);
216 216
 					}
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 			}
219 219
 
220 220
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
221
+			if (count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
+			if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
223 223
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
224
+			if ($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
+			if ($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
226 226
 
227 227
 			$triggerObj->moduleSrlList[] = $module_srl;
228 228
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$oDB->commit();
233 233
 
234
-		if(count($errorLog) > 0)
234
+		if (count($errorLog) > 0)
235 235
 		{
236 236
 			$message = implode('\n', $errorLog);
237 237
 			$this->setMessage($message);
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 			$this->setMessage('success_registed');
243 243
 		}
244 244
 
245
-		if($isProc)
245
+		if ($isProc)
246 246
 		{
247
-			if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
247
+			if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
248 248
 			{
249 249
 				global $lang;
250 250
 				htmlHeader();
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 		return $module_srl;
261 261
 	}
262 262
 
263
-	private function _returnByProc($isProc, $msg='msg_invalid_request')
263
+	private function _returnByProc($isProc, $msg = 'msg_invalid_request')
264 264
 	{
265
-		if(!$isProc)
265
+		if (!$isProc)
266 266
 			return;
267 267
 		else
268 268
 		{
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
 		// Get information of the module
283 283
 		$columnList = array('module_srl', 'module');
284 284
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new BaseObject(-1,'msg_invalid_request');
285
+		if (!$module_info) return new BaseObject(-1, 'msg_invalid_request');
286 286
 		// Register Admin ID
287 287
 		$oModuleController->deleteAdminId($module_srl);
288 288
 		$admin_member = Context::get('admin_member');
289
-		if($admin_member)
289
+		if ($admin_member)
290 290
 		{
291
-			$admin_members = explode(',',$admin_member);
292
-			foreach($admin_members as $admin_id)
291
+			$admin_members = explode(',', $admin_member);
292
+			foreach ($admin_members as $admin_id)
293 293
 			{
294 294
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
295
+				if (!$admin_id) continue;
296 296
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 297
 			}
298 298
 		}
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 		$grant_list->manager->default = 'manager';
308 308
 
309 309
 		$grant = new stdClass();
310
-		foreach($grant_list as $grant_name => $grant_info)
310
+		foreach ($grant_list as $grant_name => $grant_info)
311 311
 		{
312 312
 			// Get the default value
313 313
 			$default = Context::get($grant_name.'_default');
314 314
 			// -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users
315 315
 			$grant->{$grant_name} = array();
316
-			if(strlen($default))
316
+			if (strlen($default))
317 317
 			{
318 318
 				$grant->{$grant_name}[] = $default;
319 319
 				continue;
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 			else
323 323
 			{
324 324
 				$group_srls = Context::get($grant_name);
325
-				if($group_srls)
325
+				if ($group_srls)
326 326
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
327
+					if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
328
+					elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
329 329
 					else $group_srls = array($group_srls);
330 330
 					$grant->{$grant_name} = $group_srls;
331 331
 				}
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 		$args = new stdClass();
339 339
 		$args->module_srl = $module_srl;
340 340
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
341
+		if (!$output->toBool()) return $output;
342 342
 		// Permissions stored in the DB
343
-		foreach($grant as $grant_name => $group_srls)
343
+		foreach ($grant as $grant_name => $group_srls)
344 344
 		{
345
-			foreach($group_srls as $val)
345
+			foreach ($group_srls as $val)
346 346
 			{
347 347
 				$args = new stdClass();
348 348
 				$args->module_srl = $module_srl;
349 349
 				$args->name = $grant_name;
350 350
 				$args->group_srl = $val;
351 351
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
352
+				if (!$output->toBool()) return $output;
353 353
 			}
354 354
 		}
355 355
 		$this->setMessage('success_registed');
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 		$oModuleModel = getModel('module');
369 369
 		$columnList = array('module_srl', 'module', 'skin', 'mskin', 'is_skin_fix', 'is_mskin_fix');
370 370
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
371
-		if($module_info->module_srl)
371
+		if ($module_info->module_srl)
372 372
 		{
373
-			if($mode === 'M')
373
+			if ($mode === 'M')
374 374
 			{
375
-				if($module_info->is_mskin_fix == 'Y')
375
+				if ($module_info->is_mskin_fix == 'Y')
376 376
 				{
377 377
 					$skin = $module_info->mskin;
378 378
 				}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			}
384 384
 			else
385 385
 			{
386
-				if($module_info->is_skin_fix == 'Y')
386
+				if ($module_info->is_skin_fix == 'Y')
387 387
 				{
388 388
 					$skin = $module_info->skin;
389 389
 				}
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 			}
395 395
 
396 396
 			// Get skin information (to check extra_vars)
397
-			$module_path = _XE_PATH_ . 'modules/'.$module_info->module;
397
+			$module_path = _XE_PATH_.'modules/'.$module_info->module;
398 398
 
399
-			if($mode === 'M')
399
+			if ($mode === 'M')
400 400
 			{
401 401
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 402
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
@@ -417,35 +417,35 @@  discard block
 block discarded – undo
417 417
 			unset($obj->module);
418 418
 			unset($obj->_mode);
419 419
 			// Separately handle if a type of extra_vars is an image in the original skin_info
420
-			if($skin_info->extra_vars)
420
+			if ($skin_info->extra_vars)
421 421
 			{
422
-				foreach($skin_info->extra_vars as $vars)
422
+				foreach ($skin_info->extra_vars as $vars)
423 423
 				{
424
-					if($vars->type!='image') continue;
424
+					if ($vars->type != 'image') continue;
425 425
 
426 426
 					$image_obj = $obj->{$vars->name};
427 427
 					// Get a variable to delete
428 428
 					$del_var = $obj->{"del_".$vars->name};
429 429
 					unset($obj->{"del_".$vars->name});
430
-					if($del_var == 'Y')
430
+					if ($del_var == 'Y')
431 431
 					{
432 432
 						FileHandler::removeFile($skin_vars[$vars->name]->value);
433 433
 						continue;
434 434
 					}
435 435
 					// Use the previous data if not uploaded
436
-					if(!$image_obj['tmp_name'])
436
+					if (!$image_obj['tmp_name'])
437 437
 					{
438 438
 						$obj->{$vars->name} = $skin_vars[$vars->name]->value;
439 439
 						continue;
440 440
 					}
441 441
 					// Ignore if the file is not successfully uploaded
442
-					if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
442
+					if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
443 443
 					{
444 444
 						unset($obj->{$vars->name});
445 445
 						continue;
446 446
 					}
447 447
 					// Ignore if the file is not an image
448
-					if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
448
+					if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
449 449
 					{
450 450
 						unset($obj->{$vars->name});
451 451
 						continue;
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 					// Upload the file to a path
454 454
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 455
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
456
+					if (!FileHandler::makeDir($path)) return false;
457 457
 
458 458
 					$filename = $path.$image_obj['name'];
459 459
 					// Move the file
460
-					if(!move_uploaded_file($image_obj['tmp_name'], $filename))
460
+					if (!move_uploaded_file($image_obj['tmp_name'], $filename))
461 461
 					{
462 462
 						unset($obj->{$vars->name});
463 463
 						continue;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			*/
482 482
 			$oModuleController = getController('module');
483 483
 
484
-			if($mode === 'M')
484
+			if ($mode === 'M')
485 485
 			{
486 486
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487 487
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			{
490 490
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 491
 			}
492
-			if(!$output->toBool())
492
+			if (!$output->toBool())
493 493
 			{
494 494
 				return $output;
495 495
 			}
@@ -506,29 +506,29 @@  discard block
 block discarded – undo
506 506
 	{
507 507
 		$vars = Context::getRequestVars();
508 508
 
509
-		if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request');
509
+		if (!$vars->module_srls) return new BaseObject(-1, 'msg_invalid_request');
510 510
 
511
-		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request');
511
+		$module_srls = explode(',', $vars->module_srls);
512
+		if (count($module_srls) < 1) return new BaseObject(-1, 'msg_invalid_request');
513 513
 
514 514
 		$oModuleModel = getModel('module');
515
-		$oModuleController= getController('module');
515
+		$oModuleController = getController('module');
516 516
 		$columnList = array('module_srl', 'module', 'menu_srl', 'site_srl', 'mid', 'browser_title', 'is_default', 'content', 'mcontent', 'open_rss', 'regdate');
517
-		$updateList = array('module_category_srl','layout_srl','skin','mlayout_srl','mskin','description','header_text','footer_text', 'use_mobile');
518
-		foreach($updateList as $key=>$val)
517
+		$updateList = array('module_category_srl', 'layout_srl', 'skin', 'mlayout_srl', 'mskin', 'description', 'header_text', 'footer_text', 'use_mobile');
518
+		foreach ($updateList as $key=>$val)
519 519
 		{
520
-			if(!strlen($vars->{$val}))
520
+			if (!strlen($vars->{$val}))
521 521
 			{
522 522
 				unset($updateList[$key]);
523 523
 				$columnList[] = $val;
524 524
 			}
525 525
 		}
526 526
 
527
-		foreach($module_srls as $module_srl)
527
+		foreach ($module_srls as $module_srl)
528 528
 		{
529 529
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
530 530
 
531
-			foreach($updateList as $val)
531
+			foreach ($updateList as $val)
532 532
 			{
533 533
 				$module_info->{$val} = $vars->{$val};
534 534
 			}
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->setMessage('success_registed');
539
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
539
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
540 540
 		{
541
-			if(Context::get('success_return_url'))
541
+			if (Context::get('success_return_url'))
542 542
 			{
543 543
 				$this->setRedirectUrl(Context::get('success_return_url'));
544 544
 			}
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
 	function procModuleAdminModuleGrantSetup()
562 562
 	{
563 563
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
564
+		if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
565 565
 
566
-		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request');
566
+		$modules = explode(',', $module_srls);
567
+		if (count($modules) < 1) return new BaseObject(-1, 'msg_invalid_request');
568 568
 
569 569
 		$oModuleController = getController('module');
570 570
 		$oModuleModel = getModel('module');
@@ -581,13 +581,13 @@  discard block
 block discarded – undo
581 581
 
582 582
 		$grant = new stdClass;
583 583
 
584
-		foreach($grant_list as $grant_name => $grant_info)
584
+		foreach ($grant_list as $grant_name => $grant_info)
585 585
 		{
586 586
 			// Get the default value
587 587
 			$default = Context::get($grant_name.'_default');
588 588
 			// -1 = Sign only, 0 = all users
589 589
 			$grant->{$grant_name} = array();
590
-			if(strlen($default))
590
+			if (strlen($default))
591 591
 			{
592 592
 				$grant->{$grant_name}[] = $default;
593 593
 				continue;
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
 			else
597 597
 			{
598 598
 				$group_srls = Context::get($grant_name);
599
-				if($group_srls)
599
+				if ($group_srls)
600 600
 				{
601
-					if(!is_array($group_srls))
601
+					if (!is_array($group_srls))
602 602
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
603
+						if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
604
+						elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
605 605
 						else $group_srls = array($group_srls);
606 606
 					}
607 607
 					$grant->{$grant_name} = $group_srls;
@@ -612,30 +612,30 @@  discard block
 block discarded – undo
612 612
 		}
613 613
 
614 614
 		// Stored in the DB
615
-		foreach($modules as $module_srl)
615
+		foreach ($modules as $module_srl)
616 616
 		{
617 617
 			$args = new stdClass();
618 618
 			$args->module_srl = $module_srl;
619 619
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
620
+			if (!$output->toBool()) continue;
621 621
 			// Permissions stored in the DB
622
-			foreach($grant as $grant_name => $group_srls)
622
+			foreach ($grant as $grant_name => $group_srls)
623 623
 			{
624
-				foreach($group_srls as $val)
624
+				foreach ($group_srls as $val)
625 625
 				{
626 626
 					$args = new stdClass();
627 627
 					$args->module_srl = $module_srl;
628 628
 					$args->name = $grant_name;
629 629
 					$args->group_srl = $val;
630 630
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
631
+					if (!$output->toBool()) return $output;
632 632
 				}
633 633
 			}
634 634
 		}
635 635
 		$this->setMessage('success_registed');
636
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
636
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
637 637
 		{
638
-			if(Context::get('success_return_url'))
638
+			if (Context::get('success_return_url'))
639 639
 			{
640 640
 				$this->setRedirectUrl(Context::get('success_return_url'));
641 641
 			}
@@ -662,38 +662,38 @@  discard block
 block discarded – undo
662 662
 		$target = Context::get('target');
663 663
 		$module = Context::get('module');
664 664
 		$args = new stdClass();
665
-		$args->site_srl = (int)$site_module_info->site_srl;
666
-		$args->name = str_replace(' ','_',Context::get('lang_code'));
667
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
665
+		$args->site_srl = (int) $site_module_info->site_srl;
666
+		$args->name = str_replace(' ', '_', Context::get('lang_code'));
667
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
668
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
669 669
 
670 670
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
671
+		if (empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
672 672
 
673
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
673
+		if (!$args->name) return new BaseObject(-1, 'msg_invalid_request');
674 674
 		// Check whether a language code exists
675 675
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
676
+		if (!$output->toBool()) return $output;
677 677
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
678
+		if ($output->data) $output = executeQuery('module.deleteLang', $args);
679
+		if (!$output->toBool()) return $output;
680 680
 		// Enter
681 681
 		$lang_supported = Context::get('lang_supported');
682
-		foreach($lang_supported as $key => $val)
682
+		foreach ($lang_supported as $key => $val)
683 683
 		{
684 684
 			$args->lang_code = $key;
685 685
 			$args->value = trim(Context::get($key));
686 686
 
687 687
 			// if request method is json, strip slashes
688
-			if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
688
+			if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
689 689
 			{
690 690
 				$args->value = stripslashes($args->value);
691 691
 			}
692 692
 
693
-			if($args->value)
693
+			if ($args->value)
694 694
 			{
695 695
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
696
+				if (!$output->toBool()) return $output;
697 697
 			}
698 698
 		}
699 699
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -713,14 +713,14 @@  discard block
 block discarded – undo
713 713
 		// Get language code
714 714
 		$site_module_info = Context::get('site_module_info');
715 715
 		$args = new stdClass();
716
-		$args->site_srl = (int)$site_module_info->site_srl;
717
-		$args->name = str_replace(' ','_',Context::get('name'));
718
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
716
+		$args->site_srl = (int) $site_module_info->site_srl;
717
+		$args->name = str_replace(' ', '_', Context::get('name'));
718
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
719
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
720
+		if (!$args->name) return new BaseObject(-1, 'msg_invalid_request');
721 721
 
722 722
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
723
+		if (!$output->toBool()) return $output;
724 724
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 725
 
726 726
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 
732 732
 	function procModuleAdminGetList()
733 733
 	{
734
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
734
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
735 735
 
736 736
 		$oModuleController = getController('module');
737 737
 		$oModuleModel = getModel('module');
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
 		$args = new stdClass;
745 745
 		$logged_info = Context::get('logged_info');
746 746
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
747
+		if ($site_keyword) $args->site_keyword = $site_keyword;
748 748
 
749
-		if(!$site_srl)
749
+		if (!$site_srl)
750 750
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
751
+			if ($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
+			else $args->site_srl = (int) $site_module_info->site_srl;
753 753
 		}
754 754
 		else $args->site_srl = $site_srl;
755 755
 
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
 		// Get a list of modules at the site
760 760
 		$output = executeQueryArray('module.getSiteModules', $args);
761 761
 		$mid_list = array();
762
-		if(count($output->data) > 0)
762
+		if (count($output->data) > 0)
763 763
 		{
764
-			foreach($output->data as $val)
764
+			foreach ($output->data as $val)
765 765
 			{
766 766
 				$module = trim($val->module);
767
-				if(!$module) continue;
767
+				if (!$module) continue;
768 768
 
769 769
 				// replace user defined lang.
770 770
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 				$obj->browser_title = $val->browser_title;
776 776
 				$obj->mid = $val->mid;
777 777
 				$obj->module_category_srl = $val->module_category_srl;
778
-				if($val->module_category_srl > 0)
778
+				if ($val->module_category_srl > 0)
779 779
 				{
780 780
 					$moduleCategorySrl[] = $val->module_category_srl;
781 781
 				}
@@ -787,23 +787,23 @@  discard block
 block discarded – undo
787 787
 		$moduleCategorySrl = array_unique($moduleCategorySrl);
788 788
 		$output = $oModuleModel->getModuleCategories($moduleCategorySrl);
789 789
 		$categoryNameList = array();
790
-		if(is_array($output))
790
+		if (is_array($output))
791 791
 		{
792
-			foreach($output as $value)
792
+			foreach ($output as $value)
793 793
 			{
794 794
 				$categoryNameList[$value->module_category_srl] = $value->title;
795 795
 			}
796 796
 		}
797 797
 
798 798
 		$selected_module = Context::get('selected_module');
799
-		if(count($mid_list) > 0)
799
+		if (count($mid_list) > 0)
800 800
 		{
801
-			foreach($mid_list as $module => $val)
801
+			foreach ($mid_list as $module => $val)
802 802
 			{
803
-				if(!$selected_module) $selected_module = $module;
803
+				if (!$selected_module) $selected_module = $module;
804 804
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 805
 
806
-				if(!$xml_info)
806
+				if (!$xml_info)
807 807
 				{
808 808
 					unset($mid_list[$module]);
809 809
 					continue;
@@ -812,14 +812,14 @@  discard block
 block discarded – undo
812 812
 				$mid_list[$module]->title = $xml_info->title;
813 813
 
814 814
 				// change module category srl to title
815
-				if(is_array($val->list))
815
+				if (is_array($val->list))
816 816
 				{
817
-					foreach($val->list as $key=>$value)
817
+					foreach ($val->list as $key=>$value)
818 818
 					{
819
-						if($value->module_category_srl > 0)
819
+						if ($value->module_category_srl > 0)
820 820
 						{
821 821
 							$categorySrl = $mid_list[$module]->list[$key]->module_category_srl;
822
-							if(isset($categoryNameList[$categorySrl]))
822
+							if (isset($categoryNameList[$categorySrl]))
823 823
 							{
824 824
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 825
 							}
@@ -847,20 +847,20 @@  discard block
 block discarded – undo
847 847
 		$args = new stdClass();
848 848
 
849 849
 		// Get the language file of the current site
850
-		if(!$site_srl)
850
+		if (!$site_srl)
851 851
 		{
852 852
 			$site_module_info = Context::get('site_module_info');
853
-			$args->site_srl = (int)$site_module_info->site_srl;
853
+			$args->site_srl = (int) $site_module_info->site_srl;
854 854
 		}
855 855
 		else
856 856
 		{
857 857
 			$args->site_srl = $site_srl;
858 858
 		}
859 859
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
860
+		if (!$output->toBool() || !$output->data) return;
861 861
 
862 862
 		$langMap = array();
863
-		foreach($output->data as $lang)
863
+		foreach ($output->data as $lang)
864 864
 		{
865 865
 			$langMap[$lang->lang_code][$lang->name] = $lang->value;
866 866
 		}
@@ -869,29 +869,29 @@  discard block
 block discarded – undo
869 869
 		$dbInfo = Context::getDBInfo();
870 870
 		$defaultLang = $dbInfo->lang_type;
871 871
 
872
-		if(!is_array($langMap[$defaultLang]))
872
+		if (!is_array($langMap[$defaultLang]))
873 873
 		{
874 874
 			$langMap[$defaultLang] = array();
875 875
 		}
876 876
 
877 877
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
878 878
 
879
-		foreach($lang_supported as $langCode => $langName)
879
+		foreach ($lang_supported as $langCode => $langName)
880 880
 		{
881
-			if(!is_array($langMap[$langCode]))
881
+			if (!is_array($langMap[$langCode]))
882 882
 			{
883 883
 				$langMap[$langCode] = array();
884 884
 			}
885 885
 
886 886
 			$langMap[$langCode] += $langMap[$defaultLang];
887
-			foreach($lang_supported as $targetLangCode => $targetLangName)
887
+			foreach ($lang_supported as $targetLangCode => $targetLangName)
888 888
 			{
889
-				if($langCode == $targetLangCode || $langCode == $defaultLang)
889
+				if ($langCode == $targetLangCode || $langCode == $defaultLang)
890 890
 				{
891 891
 					continue;
892 892
 				}
893 893
 
894
-				if(!is_array($langMap[$targetLangCode]))
894
+				if (!is_array($langMap[$targetLangCode]))
895 895
 				{
896 896
 					$langMap[$targetLangCode] = array();
897 897
 				}
@@ -899,9 +899,9 @@  discard block
 block discarded – undo
899 899
 				$langMap[$langCode] += $langMap[$targetLangCode];
900 900
 			}
901 901
 
902
-			if($oCacheHandler->isSupport())
902
+			if ($oCacheHandler->isSupport())
903 903
 			{
904
-				$object_key = 'user_defined_langs:' . $args->site_srl . ':' . $langCode;
904
+				$object_key = 'user_defined_langs:'.$args->site_srl.':'.$langCode;
905 905
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
906 906
 				$oCacheHandler->put($cache_key, $langMap[$langCode]);
907 907
 			}
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 
923 923
 		$isSkinFix = Context::get('is_skin_fix');
924 924
 
925
-		if($isSkinFix)
925
+		if ($isSkinFix)
926 926
 		{
927 927
 			$isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y';
928 928
 		}
@@ -938,14 +938,14 @@  discard block
 block discarded – undo
938 938
 
939 939
 	public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL)
940 940
 	{
941
-		if(!$moduleSrl && !$mid)
941
+		if (!$moduleSrl && !$mid)
942 942
 		{
943 943
 			return $this->stop(-1, 'msg_invalid_request');
944 944
 		}
945 945
 
946 946
 		$oModuleModel = getModel('module');
947 947
 
948
-		if($mid)
948
+		if ($mid)
949 949
 		{
950 950
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
951 951
 		}
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
955 955
 		}
956 956
 
957
-		if(!$moduleInfo)
957
+		if (!$moduleInfo)
958 958
 		{
959 959
 			return $this->stop(-1, 'msg_module_not_exists');
960 960
 		}
@@ -963,26 +963,26 @@  discard block
 block discarded – undo
963 963
 		$layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl';
964 964
 		$skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix';
965 965
 
966
-		if(strlen($layoutSrl))
966
+		if (strlen($layoutSrl))
967 967
 		{
968 968
 			$moduleInfo->{$layoutTargetValue} = $layoutSrl;
969 969
 		}
970 970
 
971
-		if(strlen($isSkinFix))
971
+		if (strlen($isSkinFix))
972 972
 		{
973 973
 			$moduleInfo->{$skinFixTargetValue} = $isSkinFix;
974 974
 		}
975 975
 
976
-		if($isSkinFix == 'Y')
976
+		if ($isSkinFix == 'Y')
977 977
 		{
978 978
 			$moduleInfo->{$skinTargetValue} = $skinName;
979 979
 			$skinVars = json_decode($skinVars);
980 980
 
981
-			if(is_array($skinVars))
981
+			if (is_array($skinVars))
982 982
 			{
983
-				foreach($skinVars as $key => $val)
983
+				foreach ($skinVars as $key => $val)
984 984
 				{
985
-					if(empty($val))
985
+					if (empty($val))
986 986
 					{
987 987
 						continue;
988 988
 					}
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 		$menuItemSrl = Context::get('menu_item_srl');
1004 1004
 		$useMobile = Context::get('use_mobile');
1005 1005
 
1006
-		if(!$menuItemSrl)
1006
+		if (!$menuItemSrl)
1007 1007
 		{
1008 1008
 			return $this->stop(-1, 'msg_invalid_request');
1009 1009
 		}
Please login to merge, or discard this patch.
Braces   +155 added lines, -79 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if(!$output->toBool()) {
26
+			return $output;
27
+		}
26 28
 
27 29
 		$this->setMessage("success_registed");
28 30
 
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
 	function procModuleAdminUpdateCategory()
37 39
 	{
38 40
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
41
+		if(!$output->toBool()) {
42
+			return $output;
43
+		}
40 44
 
41 45
 		$this->setMessage('success_updated');
42 46
 
@@ -50,7 +54,9 @@  discard block
 block discarded – undo
50 54
 	function procModuleAdminDeleteCategory()
51 55
 	{
52 56
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
57
+		if(!$output->toBool()) {
58
+			return $output;
59
+		}
54 60
 
55 61
 		$this->setMessage('success_deleted');
56 62
 
@@ -91,8 +97,7 @@  discard block
 block discarded – undo
91 97
 			// Get information of the target module to copy
92 98
 			$module_srl = Context::get('module_srl');
93 99
 			$args = Context::getRequestVars();
94
-		}
95
-		else
100
+		} else
96 101
 		{
97 102
 			$module_srl = $args->module_srl;
98 103
 		}
@@ -107,11 +112,19 @@  discard block
 block discarded – undo
107 112
 		for($i=1;$i<=10;$i++)
108 113
 		{
109 114
 			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid');
115
+			if(!$mid) {
116
+				continue;
117
+			}
118
+			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) {
119
+				return new BaseObject(-1, 'msg_limit_mid');
120
+			}
112 121
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
122
+			if(!$mid) {
123
+				continue;
124
+			}
125
+			if($mid && !$browser_title) {
126
+				$browser_title = $mid;
127
+			}
115 128
 			$clones[$mid] = $browser_title;
116 129
 		}
117 130
 		if(count($clones) < 1)
@@ -131,7 +144,9 @@  discard block
 block discarded – undo
131 144
 		$grant = array();
132 145
 		if($output->data)
133 146
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
147
+			foreach($output->data as $val) {
148
+				$grant[$val->name][] = $val->group_srl;
149
+			}
135 150
 		}
136 151
 
137 152
 		// get Extra Vars
@@ -218,11 +233,19 @@  discard block
 block discarded – undo
218 233
 			}
219 234
 
220 235
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
236
+			if(count($grant) > 0) {
237
+				$oModuleController->insertModuleGrants($module_srl, $grant);
238
+			}
239
+			if($extra_vars) {
240
+				$oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
241
+			}
223 242
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
243
+			if($moduleSkinVars) {
244
+				$oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
245
+			}
246
+			if($moduleMobileSkinVars) {
247
+				$oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
248
+			}
226 249
 
227 250
 			$triggerObj->moduleSrlList[] = $module_srl;
228 251
 		}
@@ -235,8 +258,7 @@  discard block
 block discarded – undo
235 258
 		{
236 259
 			$message = implode('\n', $errorLog);
237 260
 			$this->setMessage($message);
238
-		}
239
-		else
261
+		} else
240 262
 		{
241 263
 			$message = $lang->success_registed;
242 264
 			$this->setMessage('success_registed');
@@ -262,9 +284,9 @@  discard block
 block discarded – undo
262 284
 
263 285
 	private function _returnByProc($isProc, $msg='msg_invalid_request')
264 286
 	{
265
-		if(!$isProc)
266
-			return;
267
-		else
287
+		if(!$isProc) {
288
+					return;
289
+		} else
268 290
 		{
269 291
 			return new BaseObject(-1, $msg);
270 292
 		}
@@ -282,7 +304,9 @@  discard block
 block discarded – undo
282 304
 		// Get information of the module
283 305
 		$columnList = array('module_srl', 'module');
284 306
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new BaseObject(-1,'msg_invalid_request');
307
+		if(!$module_info) {
308
+			return new BaseObject(-1,'msg_invalid_request');
309
+		}
286 310
 		// Register Admin ID
287 311
 		$oModuleController->deleteAdminId($module_srl);
288 312
 		$admin_member = Context::get('admin_member');
@@ -292,7 +316,9 @@  discard block
 block discarded – undo
292 316
 			foreach($admin_members as $admin_id)
293 317
 			{
294 318
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
319
+				if(!$admin_id) {
320
+					continue;
321
+				}
296 322
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 323
 			}
298 324
 		}
@@ -318,15 +344,18 @@  discard block
 block discarded – undo
318 344
 				$grant->{$grant_name}[] = $default;
319 345
 				continue;
320 346
 				// users in a particular group
321
-			}
322
-			else
347
+			} else
323 348
 			{
324 349
 				$group_srls = Context::get($grant_name);
325 350
 				if($group_srls)
326 351
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
329
-					else $group_srls = array($group_srls);
352
+					if(strpos($group_srls,'|@|')!==false) {
353
+						$group_srls = explode('|@|',$group_srls);
354
+					} elseif(strpos($group_srls,',')!==false) {
355
+						$group_srls = explode(',',$group_srls);
356
+					} else {
357
+						$group_srls = array($group_srls);
358
+					}
330 359
 					$grant->{$grant_name} = $group_srls;
331 360
 				}
332 361
 				continue;
@@ -338,7 +367,9 @@  discard block
 block discarded – undo
338 367
 		$args = new stdClass();
339 368
 		$args->module_srl = $module_srl;
340 369
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
370
+		if(!$output->toBool()) {
371
+			return $output;
372
+		}
342 373
 		// Permissions stored in the DB
343 374
 		foreach($grant as $grant_name => $group_srls)
344 375
 		{
@@ -349,7 +380,9 @@  discard block
 block discarded – undo
349 380
 				$args->name = $grant_name;
350 381
 				$args->group_srl = $val;
351 382
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
383
+				if(!$output->toBool()) {
384
+					return $output;
385
+				}
353 386
 			}
354 387
 		}
355 388
 		$this->setMessage('success_registed');
@@ -375,19 +408,16 @@  discard block
 block discarded – undo
375 408
 				if($module_info->is_mskin_fix == 'Y')
376 409
 				{
377 410
 					$skin = $module_info->mskin;
378
-				}
379
-				else
411
+				} else
380 412
 				{
381 413
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M');
382 414
 				}
383
-			}
384
-			else
415
+			} else
385 416
 			{
386 417
 				if($module_info->is_skin_fix == 'Y')
387 418
 				{
388 419
 					$skin = $module_info->skin;
389
-				}
390
-				else
420
+				} else
391 421
 				{
392 422
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P');
393 423
 				}
@@ -400,8 +430,7 @@  discard block
 block discarded – undo
400 430
 			{
401 431
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 432
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
403
-			}
404
-			else
433
+			} else
405 434
 			{
406 435
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
407 436
 				$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
@@ -421,7 +450,9 @@  discard block
 block discarded – undo
421 450
 			{
422 451
 				foreach($skin_info->extra_vars as $vars)
423 452
 				{
424
-					if($vars->type!='image') continue;
453
+					if($vars->type!='image') {
454
+						continue;
455
+					}
425 456
 
426 457
 					$image_obj = $obj->{$vars->name};
427 458
 					// Get a variable to delete
@@ -453,7 +484,9 @@  discard block
 block discarded – undo
453 484
 					// Upload the file to a path
454 485
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 486
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
487
+					if(!FileHandler::makeDir($path)) {
488
+						return false;
489
+					}
457 490
 
458 491
 					$filename = $path.$image_obj['name'];
459 492
 					// Move the file
@@ -484,8 +517,7 @@  discard block
 block discarded – undo
484 517
 			if($mode === 'M')
485 518
 			{
486 519
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487
-			}
488
-			else
520
+			} else
489 521
 			{
490 522
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 523
 			}
@@ -506,10 +538,14 @@  discard block
 block discarded – undo
506 538
 	{
507 539
 		$vars = Context::getRequestVars();
508 540
 
509
-		if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request');
541
+		if(!$vars->module_srls) {
542
+			return new BaseObject(-1,'msg_invalid_request');
543
+		}
510 544
 
511 545
 		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request');
546
+		if(count($module_srls) < 1) {
547
+			return new BaseObject(-1,'msg_invalid_request');
548
+		}
513 549
 
514 550
 		$oModuleModel = getModel('module');
515 551
 		$oModuleController= getController('module');
@@ -541,8 +577,7 @@  discard block
 block discarded – undo
541 577
 			if(Context::get('success_return_url'))
542 578
 			{
543 579
 				$this->setRedirectUrl(Context::get('success_return_url'));
544
-			}
545
-			else
580
+			} else
546 581
 			{
547 582
 				global $lang;
548 583
 				htmlHeader();
@@ -561,10 +596,14 @@  discard block
 block discarded – undo
561 596
 	function procModuleAdminModuleGrantSetup()
562 597
 	{
563 598
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
599
+		if(!$module_srls) {
600
+			return new BaseObject(-1,'msg_invalid_request');
601
+		}
565 602
 
566 603
 		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request');
604
+		if(count($modules) < 1) {
605
+			return new BaseObject(-1,'msg_invalid_request');
606
+		}
568 607
 
569 608
 		$oModuleController = getController('module');
570 609
 		$oModuleModel = getModel('module');
@@ -592,17 +631,20 @@  discard block
 block discarded – undo
592 631
 				$grant->{$grant_name}[] = $default;
593 632
 				continue;
594 633
 				// Users in a particular group
595
-			}
596
-			else
634
+			} else
597 635
 			{
598 636
 				$group_srls = Context::get($grant_name);
599 637
 				if($group_srls)
600 638
 				{
601 639
 					if(!is_array($group_srls))
602 640
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
605
-						else $group_srls = array($group_srls);
641
+						if(strpos($group_srls,'|@|')!==false) {
642
+							$group_srls = explode('|@|',$group_srls);
643
+						} elseif(strpos($group_srls,',')!==false) {
644
+							$group_srls = explode(',',$group_srls);
645
+						} else {
646
+							$group_srls = array($group_srls);
647
+						}
606 648
 					}
607 649
 					$grant->{$grant_name} = $group_srls;
608 650
 				}
@@ -617,7 +659,9 @@  discard block
 block discarded – undo
617 659
 			$args = new stdClass();
618 660
 			$args->module_srl = $module_srl;
619 661
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
662
+			if(!$output->toBool()) {
663
+				continue;
664
+			}
621 665
 			// Permissions stored in the DB
622 666
 			foreach($grant as $grant_name => $group_srls)
623 667
 			{
@@ -628,7 +672,9 @@  discard block
 block discarded – undo
628 672
 					$args->name = $grant_name;
629 673
 					$args->group_srl = $val;
630 674
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
675
+					if(!$output->toBool()) {
676
+						return $output;
677
+					}
632 678
 				}
633 679
 			}
634 680
 		}
@@ -638,8 +684,7 @@  discard block
 block discarded – undo
638 684
 			if(Context::get('success_return_url'))
639 685
 			{
640 686
 				$this->setRedirectUrl(Context::get('success_return_url'));
641
-			}
642
-			else
687
+			} else
643 688
 			{
644 689
 				global $lang;
645 690
 				htmlHeader();
@@ -665,18 +710,30 @@  discard block
 block discarded – undo
665 710
 		$args->site_srl = (int)$site_module_info->site_srl;
666 711
 		$args->name = str_replace(' ','_',Context::get('lang_code'));
667 712
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
713
+		if(!empty($args->lang_name)) {
714
+			$args->name = $args->lang_name;
715
+		}
669 716
 
670 717
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
718
+		if(empty($args->name)) {
719
+			$args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
720
+		}
672 721
 
673
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
722
+		if(!$args->name) {
723
+			return new BaseObject(-1,'msg_invalid_request');
724
+		}
674 725
 		// Check whether a language code exists
675 726
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
727
+		if(!$output->toBool()) {
728
+			return $output;
729
+		}
677 730
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
731
+		if($output->data) {
732
+			$output = executeQuery('module.deleteLang', $args);
733
+		}
734
+		if(!$output->toBool()) {
735
+			return $output;
736
+		}
680 737
 		// Enter
681 738
 		$lang_supported = Context::get('lang_supported');
682 739
 		foreach($lang_supported as $key => $val)
@@ -693,7 +750,9 @@  discard block
 block discarded – undo
693 750
 			if($args->value)
694 751
 			{
695 752
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
753
+				if(!$output->toBool()) {
754
+					return $output;
755
+				}
697 756
 			}
698 757
 		}
699 758
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -716,11 +775,17 @@  discard block
 block discarded – undo
716 775
 		$args->site_srl = (int)$site_module_info->site_srl;
717 776
 		$args->name = str_replace(' ','_',Context::get('name'));
718 777
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
778
+		if(!empty($args->lang_name)) {
779
+			$args->name = $args->lang_name;
780
+		}
781
+		if(!$args->name) {
782
+			return new BaseObject(-1,'msg_invalid_request');
783
+		}
721 784
 
722 785
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
786
+		if(!$output->toBool()) {
787
+			return $output;
788
+		}
724 789
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 790
 
726 791
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +796,9 @@  discard block
 block discarded – undo
731 796
 
732 797
 	function procModuleAdminGetList()
733 798
 	{
734
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
799
+		if(!Context::get('is_logged')) {
800
+			return new BaseObject(-1, 'msg_not_permitted');
801
+		}
735 802
 
736 803
 		$oModuleController = getController('module');
737 804
 		$oModuleModel = getModel('module');
@@ -744,14 +811,20 @@  discard block
 block discarded – undo
744 811
 		$args = new stdClass;
745 812
 		$logged_info = Context::get('logged_info');
746 813
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
814
+		if($site_keyword) {
815
+			$args->site_keyword = $site_keyword;
816
+		}
748 817
 
749 818
 		if(!$site_srl)
750 819
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
820
+			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) {
821
+				$args->site_srl = 0;
822
+			} else {
823
+				$args->site_srl = (int)$site_module_info->site_srl;
824
+			}
825
+		} else {
826
+			$args->site_srl = $site_srl;
753 827
 		}
754
-		else $args->site_srl = $site_srl;
755 828
 
756 829
 		$args->sort_index1 = 'sites.domain';
757 830
 
@@ -764,7 +837,9 @@  discard block
 block discarded – undo
764 837
 			foreach($output->data as $val)
765 838
 			{
766 839
 				$module = trim($val->module);
767
-				if(!$module) continue;
840
+				if(!$module) {
841
+					continue;
842
+				}
768 843
 
769 844
 				// replace user defined lang.
770 845
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -800,7 +875,9 @@  discard block
 block discarded – undo
800 875
 		{
801 876
 			foreach($mid_list as $module => $val)
802 877
 			{
803
-				if(!$selected_module) $selected_module = $module;
878
+				if(!$selected_module) {
879
+					$selected_module = $module;
880
+				}
804 881
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 882
 
806 883
 				if(!$xml_info)
@@ -823,8 +900,7 @@  discard block
 block discarded – undo
823 900
 							{
824 901
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 902
 							}
826
-						}
827
-						else
903
+						} else
828 904
 						{
829 905
 							$mid_list[$module]->list[$key]->module_category_srl = Context::getLang('none_category');
830 906
 						}
@@ -851,13 +927,14 @@  discard block
 block discarded – undo
851 927
 		{
852 928
 			$site_module_info = Context::get('site_module_info');
853 929
 			$args->site_srl = (int)$site_module_info->site_srl;
854
-		}
855
-		else
930
+		} else
856 931
 		{
857 932
 			$args->site_srl = $site_srl;
858 933
 		}
859 934
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
935
+		if(!$output->toBool() || !$output->data) {
936
+			return;
937
+		}
861 938
 
862 939
 		$langMap = array();
863 940
 		foreach($output->data as $lang)
@@ -948,8 +1025,7 @@  discard block
 block discarded – undo
948 1025
 		if($mid)
949 1026
 		{
950 1027
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
951
-		}
952
-		else
1028
+		} else
953 1029
 		{
954 1030
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
955 1031
 		}
Please login to merge, or discard this patch.
modules/module/module.admin.model.php 3 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@  discard block
 block discarded – undo
56 56
 		return $output;
57 57
 	}
58 58
 
59
+	/**
60
+	 * @param string $modulePath
61
+	 */
59 62
 	function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL)
60 63
 	{
61 64
 		if($modulePath)
@@ -306,7 +309,7 @@  discard block
 block discarded – undo
306 309
 	 * Skin setting page for the module
307 310
 	 *
308 311
 	 * @param $module_srl sequence of module
309
-	 * @param $mode P or M
312
+	 * @param string $mode P or M
310 313
 	 * @return string The HTML code
311 314
 	 */
312 315
 	function _getModuleSkinHTML($module_srl, $mode)
@@ -395,6 +398,7 @@  discard block
 block discarded – undo
395 398
 	/**
396 399
 	 * @brief Get values for a particular language code
397 400
 	 * Return its corresponding value if lang_code is specified. Otherwise return $name.
401
+	 * @param string $name
398 402
 	 */
399 403
 	function getLangCode($site_srl, $name, $isFullLanguage = FALSE)
400 404
 	{
@@ -513,6 +517,7 @@  discard block
 block discarded – undo
513 517
 
514 518
 	/**
515 519
 	 * @brief Return current lang list
520
+	 * @param stdClass $args
516 521
 	 */
517 522
 	function getLangListByLangcode($args)
518 523
 	{
Please login to merge, or discard this patch.
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/module/module.controller.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -933,6 +933,7 @@  discard block
 block discarded – undo
933 933
 
934 934
 	/**
935 935
 	 * @brief Insert skin vars to a module
936
+	 * @param string $mode
936 937
 	 */
937 938
 	function _insertModuleSkinVars($module_srl, $obj, $mode)
938 939
 	{
@@ -1006,6 +1007,7 @@  discard block
 block discarded – undo
1006 1007
 
1007 1008
 	/**
1008 1009
 	 * @brief Remove skin vars of a module
1010
+	 * @param string $mode
1009 1011
 	 */
1010 1012
 	function _deleteModuleSkinVars($module_srl, $mode)
1011 1013
 	{
@@ -1242,6 +1244,7 @@  discard block
 block discarded – undo
1242 1244
 
1243 1245
 	/**
1244 1246
 	 * @brief Update a file into the file box
1247
+	 * @param stdClass $vars
1245 1248
 	 */
1246 1249
 	function updateModuleFileBox($vars)
1247 1250
 	{
@@ -1283,6 +1286,7 @@  discard block
 block discarded – undo
1283 1286
 
1284 1287
 	/**
1285 1288
 	 * @brief Add a file into the file box
1289
+	 * @param stdClass $vars
1286 1290
 	 */
1287 1291
 	function insertModuleFileBox($vars)
1288 1292
 	{
@@ -1336,6 +1340,9 @@  discard block
 block discarded – undo
1336 1340
 		if(!$output->toBool()) return $output;
1337 1341
 	}
1338 1342
 
1343
+	/**
1344
+	 * @param stdClass $vars
1345
+	 */
1339 1346
 	function deleteModuleFileBox($vars)
1340 1347
 	{
1341 1348
 		// delete real file
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		$output = executeQuery('module.insertActionForward', $args);
30 30
 
31 31
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
32
-		if($oCacheHandler->isSupport())
32
+		if ($oCacheHandler->isSupport())
33 33
 		{
34 34
 			$cache_key = 'action_forward';
35 35
 			$oCacheHandler->delete($cache_key);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$output = executeQuery('module.deleteActionForward', $args);
52 52
 
53 53
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
54
-		if($oCacheHandler->isSupport())
54
+		if ($oCacheHandler->isSupport())
55 55
 		{
56 56
 			$cache_key = 'action_forward';
57 57
 			$oCacheHandler->delete($cache_key);
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		$args->called_position = $called_position;
76 76
 
77 77
 		$output = executeQuery('module.insertTrigger', $args);
78
-		if($output->toBool())
78
+		if ($output->toBool())
79 79
 		{
80 80
 			//remove from cache
81 81
 			$GLOBALS['__triggers__'] = NULL;
82 82
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
83
-			if($oCacheHandler->isSupport())
83
+			if ($oCacheHandler->isSupport())
84 84
 			{
85 85
 				$cache_key = 'triggers';
86 86
 				$oCacheHandler->delete($cache_key);
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 		$args->called_position = $called_position;
105 105
 
106 106
 		$output = executeQuery('module.deleteTrigger', $args);
107
-		if($output->toBool())
107
+		if ($output->toBool())
108 108
 		{
109 109
 			//remove from cache
110 110
 			$GLOBALS['__triggers__'] = NULL;
111 111
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
112
-			if($oCacheHandler->isSupport())
112
+			if ($oCacheHandler->isSupport())
113 113
 			{
114 114
 				$cache_key = 'triggers';
115 115
 				$oCacheHandler->delete($cache_key);
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 		$args->module = $module;
130 130
 
131 131
 		$output = executeQuery('module.deleteModuleTriggers', $args);
132
-		if($output->toBool())
132
+		if ($output->toBool())
133 133
 		{
134 134
 			//remove from cache
135 135
 			$GLOBALS['__triggers__'] = NULL;
136 136
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
137
-			if($oCacheHandler->isSupport())
137
+			if ($oCacheHandler->isSupport())
138 138
 			{
139 139
 				$cache_key = 'triggers';
140 140
 				$oCacheHandler->delete($cache_key);
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	 * @brief Add module extend
149 149
 	 *
150 150
 	 */
151
-	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
151
+	function insertModuleExtend($parent_module, $extend_module, $type, $kind = '')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if ($kind != 'admin') $kind = '';
154
+		if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false;
155
+		if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false;
156 156
 
157 157
 		$cache_file = './files/config/module_extend.php';
158 158
 		FileHandler::removeFile($cache_file);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$args->kind = $kind;
165 165
 
166 166
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
167
+		if ($output->data->count > 0) return false;
168 168
 
169 169
 		$output = executeQuery('module.insertModuleExtend', $args);
170 170
 		return $output;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @brief Delete module extend
175 175
 	 *
176 176
 	 */
177
-	function deleteModuleExtend($parent_module, $extend_module, $type, $kind='')
177
+	function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '')
178 178
 	{
179 179
 		$cache_file = './files/config/module_extend.php';
180 180
 		FileHandler::removeFile($cache_file);
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 		$oModuleModel = getModel('module');
200 200
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 201
 
202
-		if(!$origin_config) $origin_config = new stdClass;
202
+		if (!$origin_config) $origin_config = new stdClass;
203 203
 
204
-		foreach($config as $key => $val)
204
+		foreach ($config as $key => $val)
205 205
 		{
206 206
 			$origin_config->{$key} = $val;
207 207
 		}
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	function insertModuleConfig($module, $config, $site_srl = 0)
217 217
 	{
218
-		$args =new stdClass();
218
+		$args = new stdClass();
219 219
 		$args->module = $module;
220 220
 		$args->config = serialize($config);
221 221
 		$args->site_srl = $site_srl;
222 222
 
223 223
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
224
+		if (!$output->toBool()) return $output;
225 225
 
226 226
 		$output = executeQuery('module.insertModuleConfig', $args);
227 227
 
228 228
 		//remove from cache
229 229
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
230
-		if($oCacheHandler->isSupport())
230
+		if ($oCacheHandler->isSupport())
231 231
 		{
232 232
 			$oCacheHandler->invalidateGroupKey('site_and_module');
233 233
 		}
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 		$args->config = serialize($config);
247 247
 
248 248
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
249
+		if (!$output->toBool()) return $output;
250 250
 
251 251
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 252
 
253 253
 		//remove from cache
254 254
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
255
-		if($oCacheHandler->isSupport())
255
+		if ($oCacheHandler->isSupport())
256 256
 		{
257 257
 			$oCacheHandler->invalidateGroupKey('site_and_module');
258 258
 		}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	function insertSite($domain, $index_module_srl)
267 267
 	{
268
-		if(isSiteID($domain))
268
+		if (isSiteID($domain))
269 269
 		{
270 270
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid');
271
+			if ($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1, 'msg_already_registed_vid');
272 272
 		}
273 273
 		else
274 274
 		{
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 		$columnList = array('modules.site_srl');
285 285
 		$oModuleModel = getModel('module');
286 286
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new BaseObject(-1,'msg_already_registed_vid');
287
+		if ($output) return new BaseObject(-1, 'msg_already_registed_vid');
288 288
 
289 289
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
290
+		if (!$output->toBool()) return $output;
291 291
 
292 292
 		$output->add('site_srl', $args->site_srl);
293 293
 		return $output;
@@ -302,32 +302,32 @@  discard block
 block discarded – undo
302 302
 		$columnList = array('sites.site_srl', 'sites.domain');
303 303
 		$site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList);
304 304
 
305
-		if(!$args->domain && $site_info->site_srl == $args->site_srl)
305
+		if (!$args->domain && $site_info->site_srl == $args->site_srl)
306 306
 		{
307 307
 			$args->domain = $site_info->domain;
308 308
 		}
309 309
 
310
-		if($site_info->domain != $args->domain)
310
+		if ($site_info->domain != $args->domain)
311 311
 		{
312 312
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid');
313
+			if ($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1, 'msg_already_registed_domain');
314
+			if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1, 'msg_already_registed_vid');
315 315
 
316
-			if($args->domain && !isSiteID($args->domain))
316
+			if ($args->domain && !isSiteID($args->domain))
317 317
 			{
318 318
 				$args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain;
319 319
 			}
320 320
 		}
321 321
 		$output = executeQuery('module.updateSite', $args);
322 322
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
323
+		if ($args->site_srl == 0) $vid = '';
324
+		else $vid = $args->domain;
325 325
 
326 326
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 327
 		$mid = $module_info->mid;
328 328
 
329 329
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
330
-		if($oCacheHandler->isSupport())
330
+		if ($oCacheHandler->isSupport())
331 331
 		{
332 332
 			$oCacheHandler->invalidateGroupKey('site_and_module');
333 333
 		}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		unset($args->act);
346 346
 		unset($args->page);
347 347
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid');
348
+		if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid');
349 349
 		// Test variables (separate basic vars and other vars in modules)
350 350
 		$extra_vars = clone($args);
351 351
 		unset($extra_vars->module_srl);
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	function insertModule($args)
381 381
 	{
382
-		if(isset($args->isMenuCreate))
382
+		if (isset($args->isMenuCreate))
383 383
 		{
384 384
 			$isMenuCreate = $args->isMenuCreate;
385 385
 		}
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
 		}
390 390
 
391 391
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
392
+		if (!$output->toBool()) return $output;
393 393
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
394
+		if (!$args->site_srl) $args->site_srl = 0;
395 395
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists');
396
+		if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists');
397 397
 
398 398
 		// begin transaction
399 399
 		$oDB = &DB::getInstance();
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 		$skin_vars = new stdClass();
405 405
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 406
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
407
+		if (!$args->module_srl) $args->module_srl = getNextSequence();
408 408
 
409 409
 		// default value
410
-		if($args->skin == '/USE_DEFAULT/')
410
+		if ($args->skin == '/USE_DEFAULT/')
411 411
 		{
412 412
 			$args->is_skin_fix = 'N';
413 413
 		}
414 414
 		else
415 415
 		{
416
-			if(isset($args->is_skin_fix))
416
+			if (isset($args->is_skin_fix))
417 417
 			{
418 418
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419 419
 			}
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 			}
424 424
 		}
425 425
 
426
-		if($args->mskin == '/USE_DEFAULT/')
426
+		if ($args->mskin == '/USE_DEFAULT/')
427 427
 		{
428 428
 			$args->is_mskin_fix = 'N';
429 429
 		}
430 430
 		else
431 431
 		{
432
-			if(isset($args->is_mskin_fix))
432
+			if (isset($args->is_mskin_fix))
433 433
 			{
434 434
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435 435
 			}
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
 
444 444
 		$args->browser_title = strip_tags($args->browser_title);
445 445
 
446
-		if($isMenuCreate === TRUE)
446
+		if ($isMenuCreate === TRUE)
447 447
 		{
448 448
 			$menuArgs = new stdClass;
449 449
 			$menuArgs->menu_srl = $args->menu_srl;
450 450
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
451 451
 
452 452
 			// if menu is not created, create menu also. and does not supported that in virtual site.
453
-			if(!$menuOutput->data && !$args->site_srl)
453
+			if (!$menuOutput->data && !$args->site_srl)
454 454
 			{
455 455
 				$oMenuAdminModel = getAdminModel('menu');
456 456
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 				$menuArgs->listorder = $args->menu_item_srl * -1;
469 469
 
470 470
 				$menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs);
471
-				if(!$menuItemOutput->toBool())
471
+				if (!$menuItemOutput->toBool())
472 472
 				{
473 473
 					$oDB->rollback();
474 474
 					return $menuItemOutput;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 		// Insert a module
482 482
 		$args->menu_srl = $menuArgs->menu_srl;
483 483
 		$output = executeQuery('module.insertModule', $args);
484
-		if(!$output->toBool())
484
+		if (!$output->toBool())
485 485
 		{
486 486
 			$oDB->rollback();
487 487
 			return $output;
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 		$oDB->commit();
494 494
 
495 495
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
496
-		if($oCacheHandler->isSupport())
496
+		if ($oCacheHandler->isSupport())
497 497
 		{
498 498
 			$oCacheHandler->invalidateGroupKey('site_and_module');
499 499
 		}
500 500
 
501
-		$output->add('module_srl',$args->module_srl);
501
+		$output->add('module_srl', $args->module_srl);
502 502
 		return $output;
503 503
 	}
504 504
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	function updateModule($args)
509 509
 	{
510
-		if(isset($args->isMenuCreate))
510
+		if (isset($args->isMenuCreate))
511 511
 		{
512 512
 			$isMenuCreate = $args->isMenuCreate;
513 513
 		}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		}
518 518
 		
519 519
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
520
-		if(!$output->toBool()) return $output;
520
+		if (!$output->toBool()) return $output;
521 521
 		// begin transaction
522 522
 		$oDB = &DB::getInstance();
523 523
 		$oDB->begin();
@@ -526,29 +526,29 @@  discard block
 block discarded – undo
526 526
 		$columnList = array('module_srl', 'site_srl', 'browser_title', 'mid');
527 527
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
528 528
 
529
-		if(!$args->site_srl || !$args->browser_title)
529
+		if (!$args->site_srl || !$args->browser_title)
530 530
 		{
531
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
532
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
531
+			if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl;
532
+			if (!$args->browser_title) $args->browser_title = $module_info->browser_title;
533 533
 		}
534 534
 
535 535
 		$args->browser_title = strip_tags($args->browser_title);
536 536
 
537 537
 		$output = executeQuery('module.isExistsModuleName', $args);
538
-		if(!$output->toBool() || $output->data->count)
538
+		if (!$output->toBool() || $output->data->count)
539 539
 		{
540 540
 			$oDB->rollback();
541 541
 			return new BaseObject(-1, 'msg_module_name_exists');
542 542
 		}
543 543
 
544 544
 		// default value
545
-		if($args->skin == '/USE_DEFAULT/')
545
+		if ($args->skin == '/USE_DEFAULT/')
546 546
 		{
547 547
 			$args->is_skin_fix = 'N';
548 548
 		}
549 549
 		else
550 550
 		{
551
-			if(isset($args->is_skin_fix))
551
+			if (isset($args->is_skin_fix))
552 552
 			{
553 553
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
554 554
 			}
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 			}
559 559
 		}
560 560
 
561
-		if($args->mskin == '/USE_DEFAULT/')
561
+		if ($args->mskin == '/USE_DEFAULT/')
562 562
 		{
563 563
 			$args->is_mskin_fix = 'N';
564 564
 		}
565 565
 		else
566 566
 		{
567
-			if(isset($args->is_mskin_fix))
567
+			if (isset($args->is_mskin_fix))
568 568
 			{
569 569
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
570 570
 			}
@@ -574,27 +574,27 @@  discard block
 block discarded – undo
574 574
 			}
575 575
 		}
576 576
 		$output = executeQuery('module.updateModule', $args);
577
-		if(!$output->toBool())
577
+		if (!$output->toBool())
578 578
 		{
579 579
 			$oDB->rollback();
580 580
 			return $output;
581 581
 		}
582 582
 
583
-		if($isMenuCreate === TRUE)
583
+		if ($isMenuCreate === TRUE)
584 584
 		{
585 585
 			$menuArgs = new stdClass;
586 586
 			$menuArgs->url = $module_info->mid;
587 587
 			$menuArgs->site_srl = $module_info->site_srl;
588 588
 			$menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs);
589
-			if($menuOutput->data && count($menuOutput->data))
589
+			if ($menuOutput->data && count($menuOutput->data))
590 590
 			{
591 591
 				$oMenuAdminController = getAdminController('menu');
592
-				foreach($menuOutput->data as $itemInfo)
592
+				foreach ($menuOutput->data as $itemInfo)
593 593
 				{
594 594
 					$itemInfo->url = $args->mid;
595 595
 	
596 596
 					$updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo);
597
-					if(!$updateMenuItemOutput->toBool())
597
+					if (!$updateMenuItemOutput->toBool())
598 598
 					{
599 599
 						$oDB->rollback();
600 600
 						return $updateMenuItemOutput;
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 		}
605 605
 
606 606
 		// if mid changed, change mid of success_return_url to new mid
607
-		if($module_info->mid != $args->mid && Context::get('success_return_url'))
607
+		if ($module_info->mid != $args->mid && Context::get('success_return_url'))
608 608
 		{
609 609
 			changeValueInUrl('mid', $args->mid, $module_info->mid);
610 610
 		}
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 
615 615
 		$oDB->commit();
616 616
 
617
-		$output->add('module_srl',$args->module_srl);
617
+		$output->add('module_srl', $args->module_srl);
618 618
 
619 619
 		//remove from cache
620 620
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
621
-		if($oCacheHandler->isSupport())
621
+		if ($oCacheHandler->isSupport())
622 622
 		{
623 623
 			$oCacheHandler->invalidateGroupKey('site_and_module');
624 624
 		}
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 		$args->update_id = $update_id;
638 638
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
639 639
 
640
-		if(!!$output->error) return false;
640
+		if (!!$output->error) return false;
641 641
 
642 642
 		return true;
643 643
 	}
@@ -652,11 +652,11 @@  discard block
 block discarded – undo
652 652
 		$args->site_srl = $site_srl;
653 653
 		$args->layout_srl = $layout_srl;
654 654
 		$output = executeQuery('module.updateModuleSite', $args);
655
-		if(!$output->toBool()) return $output;
655
+		if (!$output->toBool()) return $output;
656 656
 
657 657
 		//remove from cache
658 658
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
659
-		if($oCacheHandler->isSupport())
659
+		if ($oCacheHandler->isSupport())
660 660
 		{
661 661
 			$oCacheHandler->invalidateGroupKey('site_and_module');
662 662
 		}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 */
672 672
 	function deleteModule($module_srl, $site_srl = 0)
673 673
 	{
674
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
674
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
675 675
 
676 676
 		$site_module_info = Context::get('site_module_info');
677 677
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		$args = new stdClass();
682 682
 		$args->url = $output->mid;
683 683
 		$args->is_shortcut = 'N';
684
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
684
+		if (!$site_srl) $args->site_srl = $site_module_info->site_srl;
685 685
 		else $args->site_srl = $site_srl;
686 686
 
687 687
 		unset($output);
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
 		$menuOutput = $oMenuAdminModel->getMenuList($args);
691 691
 
692 692
 		// get menu_srl by site_srl
693
-		if(is_array($menuOutput->data))
693
+		if (is_array($menuOutput->data))
694 694
 		{
695
-			foreach($menuOutput->data AS $key=>$value)
695
+			foreach ($menuOutput->data AS $key=>$value)
696 696
 			{
697 697
 				$args->menu_srl = $value->menu_srl;
698 698
 				break;
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$output = executeQuery('menu.getMenuItemByUrl', $args);
703 703
 		// menu delete
704
-		if($output->data)
704
+		if ($output->data)
705 705
 		{
706 706
 			unset($args);
707 707
 			$args = new stdClass;
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			$oMenuAdminController = getAdminController('menu');
713 713
 			$output = $oMenuAdminController->deleteItem($args);
714 714
 
715
-			if($output->isSuccess)
715
+			if ($output->isSuccess)
716 716
 			{
717 717
 				return new BaseObject(0, 'success_deleted');
718 718
 			}
@@ -734,19 +734,19 @@  discard block
 block discarded – undo
734 734
 	 */
735 735
 	public function onlyDeleteModule($module_srl)
736 736
 	{
737
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
737
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
738 738
 
739 739
 		// check start module
740 740
 		$oModuleModel = getModel('module');
741 741
 		$columnList = array('sites.index_module_srl');
742 742
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
743
-		if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
743
+		if ($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
744 744
 
745 745
 		// Call a trigger (before)
746 746
 		$trigger_obj = new stdClass();
747 747
 		$trigger_obj->module_srl = $module_srl;
748 748
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
749
-		if(!$output->toBool()) return $output;
749
+		if (!$output->toBool()) return $output;
750 750
 
751 751
 		// begin transaction
752 752
 		$oDB = &DB::getInstance();
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		$args->module_srl = $module_srl;
757 757
 		// Delete module information from the DB
758 758
 		$output = executeQuery('module.deleteModule', $args);
759
-		if(!$output->toBool())
759
+		if (!$output->toBool())
760 760
 		{
761 761
 			$oDB->rollback();
762 762
 			return $output;
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 		// Remove the module manager
771 771
 		$this->deleteAdminId($module_srl);
772 772
 		// Call a trigger (after)
773
-		if($output->toBool())
773
+		if ($output->toBool())
774 774
 		{
775 775
 			$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
776
-			if(!$trigger_output->toBool())
776
+			if (!$trigger_output->toBool())
777 777
 			{
778 778
 				$oDB->rollback();
779 779
 				return $trigger_output;
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
 		//remove from cache
787 787
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
788
-		if($oCacheHandler->isSupport())
788
+		if ($oCacheHandler->isSupport())
789 789
 		{
790 790
 			$oCacheHandler->invalidateGroupKey('site_and_module');
791 791
 		}
@@ -807,10 +807,10 @@  discard block
 block discarded – undo
807 807
 	function clearDefaultModule()
808 808
 	{
809 809
 		$output = executeQuery('module.clearDefaultModule');
810
-		if(!$output->toBool()) return $output;
810
+		if (!$output->toBool()) return $output;
811 811
 
812 812
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
813
-		if($oCacheHandler->isSupport())
813
+		if ($oCacheHandler->isSupport())
814 814
 		{
815 815
 			$oCacheHandler->invalidateGroupKey('site_and_module');
816 816
 		}
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$output = executeQuery('module.updateModuleMenu', $args);
827 827
 
828 828
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
829
-		if($oCacheHandler->isSupport())
829
+		if ($oCacheHandler->isSupport())
830 830
 		{
831 831
 			$oCacheHandler->invalidateGroupKey('site_and_module');
832 832
 		}
@@ -839,15 +839,15 @@  discard block
 block discarded – undo
839 839
 	 */
840 840
 	function updateModuleLayout($layout_srl, $menu_srl_list)
841 841
 	{
842
-		if(!count($menu_srl_list)) return;
842
+		if (!count($menu_srl_list)) return;
843 843
 
844 844
 		$args = new stdClass;
845 845
 		$args->layout_srl = $layout_srl;
846
-		$args->menu_srls = implode(',',$menu_srl_list);
846
+		$args->menu_srls = implode(',', $menu_srl_list);
847 847
 		$output = executeQuery('module.updateModuleLayout', $args);
848 848
 
849 849
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
850
-		if($oCacheHandler->isSupport())
850
+		if ($oCacheHandler->isSupport())
851 851
 		{
852 852
 			$oCacheHandler->invalidateGroupKey('site_and_module');
853 853
 		}
@@ -866,37 +866,37 @@  discard block
 block discarded – undo
866 866
 
867 867
 		$output = executeQuery('module.deleteSiteAdmin', $args);
868 868
 
869
-		if(!$output->toBool()) return $output;
869
+		if (!$output->toBool()) return $output;
870 870
 		// Get user id of an administrator
871
-		if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
872
-		foreach($arr_admins as $key => $user_id)
871
+		if (!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
872
+		foreach ($arr_admins as $key => $user_id)
873 873
 		{
874
-			if(!trim($user_id)) continue;
874
+			if (!trim($user_id)) continue;
875 875
 			$admins[] = trim($user_id);
876 876
 		}
877
-		if(!count($admins)) return new BaseObject();
877
+		if (!count($admins)) return new BaseObject();
878 878
 
879 879
 		$oMemberModel = getModel('member');
880 880
 		$member_config = $oMemberModel->getMemberConfig();
881
-		if($member_config->identifier == 'email_address')
881
+		if ($member_config->identifier == 'email_address')
882 882
 		{
883
-			$args->email_address = '\''.implode('\',\'',$admins).'\'';
883
+			$args->email_address = '\''.implode('\',\'', $admins).'\'';
884 884
 		}
885 885
 		else
886 886
 		{
887
-			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
887
+			$args->user_ids = '\''.implode('\',\'', $admins).'\'';
888 888
 		}
889 889
 		$output = executeQueryArray('module.getAdminSrls', $args);
890
-		if(!$output->toBool()||!$output->data) return $output;
890
+		if (!$output->toBool() || !$output->data) return $output;
891 891
 
892
-		foreach($output->data as $key => $val)
892
+		foreach ($output->data as $key => $val)
893 893
 		{
894 894
 			unset($args);
895 895
 			$args = new stdClass;
896 896
 			$args->site_srl = $site_srl;
897 897
 			$args->member_srl = $val->member_srl;
898 898
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
899
-			if(!$output->toBool()) return $output;
899
+			if (!$output->toBool()) return $output;
900 900
 		}
901 901
 		return new BaseObject();
902 902
 	}
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
 		$oMemberModel = getModel('member');
910 910
 		$member_config = $oMemberModel->getMemberConfig();
911 911
 
912
-		if($member_config->identifier == 'email_address')
912
+		if ($member_config->identifier == 'email_address')
913 913
 			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
914 914
 		else
915 915
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
916 916
 
917
-		if(!$member_info->member_srl) return;
917
+		if (!$member_info->member_srl) return;
918 918
 		$args = new stdClass();
919 919
 		$args->module_srl = $module_srl;
920 920
 		$args->member_srl = $member_info->member_srl;
@@ -929,11 +929,11 @@  discard block
 block discarded – undo
929 929
 		$args = new stdClass();
930 930
 		$args->module_srl = $module_srl;
931 931
 
932
-		if($admin_id)
932
+		if ($admin_id)
933 933
 		{
934 934
 			$oMemberModel = getModel('member');
935 935
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
936
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
936
+			if ($member_info->member_srl) $args->member_srl = $member_info->member_srl;
937 937
 		}
938 938
 		return executeQuery('module.deleteAdminId', $args);
939 939
 	}
@@ -970,18 +970,18 @@  discard block
 block discarded – undo
970 970
 		$oDB->begin();
971 971
 
972 972
 		$output = $this->_deleteModuleSkinVars($module_srl, $mode);
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			$oDB->rollback();
976 976
 			return $output;
977 977
 		}
978 978
 
979 979
 		getDestroyXeVars($obj);
980
-		if(!$obj || !count($obj)) return new BaseObject();
980
+		if (!$obj || !count($obj)) return new BaseObject();
981 981
 
982 982
 		$args = new stdClass;
983 983
 		$args->module_srl = $module_srl;
984
-		foreach($obj as $key => $val)
984
+		foreach ($obj as $key => $val)
985 985
 		{
986 986
 			// #17927989 For an old board which used the old blog module
987 987
 			// it often saved menu item(stdClass) on the skin info column
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
 
993 993
 			$args->name = trim($key);
994 994
 			$args->value = trim($val);
995
-			if(!$args->name || !$args->value) continue;
995
+			if (!$args->name || !$args->value) continue;
996 996
 
997
-			if($mode === 'P')
997
+			if ($mode === 'P')
998 998
 			{
999 999
 				$output = executeQuery('module.insertModuleSkinVars', $args);
1000 1000
 			}
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			{
1003 1003
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
1004 1004
 			}
1005
-			if(!$output->toBool())
1005
+			if (!$output->toBool())
1006 1006
 			{
1007 1007
 				return $output;
1008 1008
 				$oDB->rollback();
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 		$args->module_srl = $module_srl;
1042 1042
 		$mode = $mode === 'P' ? 'P' : 'M';
1043 1043
 
1044
-		if($mode === 'P')
1044
+		if ($mode === 'P')
1045 1045
 		{
1046 1046
 			$object_key = 'module_skin_vars:'.$module_srl;
1047 1047
 			$query = 'module.deleteModuleSkinVars';
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 		//remove from cache
1056 1056
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1057 1057
 		$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1058
-		if($oCacheHandler->isSupport())
1058
+		if ($oCacheHandler->isSupport())
1059 1059
 		{
1060 1060
 			$oCacheHandler->delete($cache_key);
1061 1061
 		}
@@ -1070,22 +1070,22 @@  discard block
 block discarded – undo
1070 1070
 	{
1071 1071
 		$this->deleteModuleExtraVars($module_srl);
1072 1072
 		getDestroyXeVars($obj);
1073
-		if(!$obj || !count($obj)) return;
1073
+		if (!$obj || !count($obj)) return;
1074 1074
 
1075
-		foreach($obj as $key => $val)
1075
+		foreach ($obj as $key => $val)
1076 1076
 		{
1077
-			if(is_object($val) || is_array($val)) continue;
1077
+			if (is_object($val) || is_array($val)) continue;
1078 1078
 
1079 1079
 			$args = new stdClass();
1080 1080
 			$args->module_srl = $module_srl;
1081 1081
 			$args->name = trim($key);
1082 1082
 			$args->value = trim($val);
1083
-			if(!$args->name || !$args->value) continue;
1083
+			if (!$args->name || !$args->value) continue;
1084 1084
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1085 1085
 		}
1086 1086
 
1087 1087
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1088
-		if($oCacheHandler->isSupport())
1088
+		if ($oCacheHandler->isSupport())
1089 1089
 		{
1090 1090
 			$object_key = 'module_extra_vars:'.$module_srl;
1091 1091
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 		//remove from cache
1106 1106
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1107
-		if($oCacheHandler->isSupport())
1107
+		if ($oCacheHandler->isSupport())
1108 1108
 		{
1109 1109
 			$object_key = 'module_extra_vars:'.$module_srl;
1110 1110
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1120,19 +1120,19 @@  discard block
 block discarded – undo
1120 1120
 	function insertModuleGrants($module_srl, $obj)
1121 1121
 	{
1122 1122
 		$this->deleteModuleGrants($module_srl);
1123
-		if(!$obj || !count($obj)) return;
1123
+		if (!$obj || !count($obj)) return;
1124 1124
 
1125
-		foreach($obj as $name => $val)
1125
+		foreach ($obj as $name => $val)
1126 1126
 		{
1127
-			if(!$val || !count($val)) continue;
1127
+			if (!$val || !count($val)) continue;
1128 1128
 
1129
-			foreach($val as $group_srl)
1129
+			foreach ($val as $group_srl)
1130 1130
 			{
1131 1131
 				$args = new stdClass();
1132 1132
 				$args->module_srl = $module_srl;
1133 1133
 				$args->name = $name;
1134 1134
 				$args->group_srl = trim($group_srl);
1135
-				if(!$args->name || !$args->group_srl) continue;
1135
+				if (!$args->name || !$args->group_srl) continue;
1136 1136
 				executeQuery('module.insertModuleGrant', $args);
1137 1137
 			}
1138 1138
 		}
@@ -1153,9 +1153,9 @@  discard block
 block discarded – undo
1153 1153
 	 */
1154 1154
 	function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
1155 1155
 	{
1156
-		if($isReplaceLangCode)
1156
+		if ($isReplaceLangCode)
1157 1157
 		{
1158
-			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
1158
+			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output);
1159 1159
 		}
1160 1160
 	}
1161 1161
 
@@ -1164,29 +1164,29 @@  discard block
 block discarded – undo
1164 1164
 		static $lang = false;
1165 1165
 
1166 1166
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1167
-		if($lang === false && $oCacheHandler->isSupport())
1167
+		if ($lang === false && $oCacheHandler->isSupport())
1168 1168
 		{
1169 1169
 			$site_module_info = Context::get('site_module_info');
1170
-			if(!$site_module_info)
1170
+			if (!$site_module_info)
1171 1171
 			{
1172 1172
 				$oModuleModel = getModel('module');
1173 1173
 				$site_module_info = $oModuleModel->getDefaultMid();
1174 1174
 				Context::set('site_module_info', $site_module_info);
1175 1175
 			}
1176 1176
 
1177
-			$object_key = 'user_defined_langs:' . $site_module_info->site_srl . ':' . Context::getLangType();
1177
+			$object_key = 'user_defined_langs:'.$site_module_info->site_srl.':'.Context::getLangType();
1178 1178
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1179 1179
 			$lang = $oCacheHandler->get($cache_key);
1180 1180
 
1181
-			if($lang === false) {
1181
+			if ($lang === false) {
1182 1182
 				$oModuleAdminController = getAdminController('module');
1183 1183
 				$lang = $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
1184 1184
 			}
1185 1185
 		}
1186 1186
 
1187
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1187
+		if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1188 1188
 
1189
-		return str_replace('$user_lang->','',$matches[0]);
1189
+		return str_replace('$user_lang->', '', $matches[0]);
1190 1190
 	}
1191 1191
 
1192 1192
 
@@ -1199,17 +1199,17 @@  discard block
 block discarded – undo
1199 1199
 		if ($ajax) Context::setRequestMethod('JSON');
1200 1200
 
1201 1201
 		$logged_info = Context::get('logged_info');
1202
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1202
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1203 1203
 
1204
-		$vars = Context::gets('addfile','filter');
1204
+		$vars = Context::gets('addfile', 'filter');
1205 1205
 		$attributeNames = Context::get('attribute_name');
1206 1206
 		$attributeValues = Context::get('attribute_value');
1207
-		if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1207
+		if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1208 1208
 		{
1209 1209
 			$attributes = array();
1210
-			foreach($attributeNames as $no => $name)
1210
+			foreach ($attributeNames as $no => $name)
1211 1211
 			{
1212
-				if(empty($name))
1212
+				if (empty($name))
1213 1213
 				{
1214 1214
 					continue;
1215 1215
 				}
@@ -1221,16 +1221,16 @@  discard block
 block discarded – undo
1221 1221
 		$vars->comment = $attributes;
1222 1222
 		$module_filebox_srl = Context::get('module_filebox_srl');
1223 1223
 
1224
-		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1224
+		$ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1225 1225
 		$vars->ext = $ext;
1226
-		if($vars->filter) $filter = explode(',',$vars->filter);
1227
-		else $filter = array('jpg','jpeg','gif','png');
1228
-		if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured');
1226
+		if ($vars->filter) $filter = explode(',', $vars->filter);
1227
+		else $filter = array('jpg', 'jpeg', 'gif', 'png');
1228
+		if (!in_array($ext, $filter)) return new BaseObject(-1, 'msg_error_occured');
1229 1229
 
1230 1230
 		$vars->member_srl = $logged_info->member_srl;
1231 1231
 
1232 1232
 		// update
1233
-		if($module_filebox_srl > 0)
1233
+		if ($module_filebox_srl > 0)
1234 1234
 		{
1235 1235
 			$vars->module_filebox_srl = $module_filebox_srl;
1236 1236
 			$output = $this->updateModuleFileBox($vars);
@@ -1238,10 +1238,10 @@  discard block
 block discarded – undo
1238 1238
 		// insert
1239 1239
 		else
1240 1240
 		{
1241
-			if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1241
+			if (!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1242 1242
 			$addfile = Context::get('addfile');
1243
-			if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1244
-			if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1243
+			if (!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1244
+			if ($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1245 1245
 			$output = $this->insertModuleFileBox($vars);
1246 1246
 		}
1247 1247
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 		}
1256 1256
 		else
1257 1257
 		{
1258
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1258
+			if ($output) $this->add('save_filename', $output->get('save_filename'));
1259 1259
 			else $this->add('save_filename', '');
1260 1260
 		}
1261 1261
 	}
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 	{
1268 1268
 		$args = new stdClass;
1269 1269
 		// have file
1270
-		if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1270
+		if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1271 1271
 		{
1272 1272
 			$oModuleModel = getModel('module');
1273 1273
 			$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
@@ -1276,18 +1276,18 @@  discard block
 block discarded – undo
1276 1276
 			$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1277 1277
 			FileHandler::makeDir($path);
1278 1278
 
1279
-			$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
1279
+			$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext);
1280 1280
 			$tmp = $vars->addfile['tmp_name'];
1281 1281
 
1282 1282
 			// Check uploaded file
1283
-			if(!checkUploadedFile($tmp)) return false;
1283
+			if (!checkUploadedFile($tmp)) return false;
1284 1284
 
1285
-			if(!@move_uploaded_file($tmp, $save_filename))
1285
+			if (!@move_uploaded_file($tmp, $save_filename))
1286 1286
 			{
1287 1287
 				return false;
1288 1288
 			}
1289 1289
 
1290
-			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1290
+			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1291 1291
 			$args->filename = $save_filename;
1292 1292
 			$args->filesize = $vars->addfile['size'];
1293 1293
 		}
@@ -1313,14 +1313,14 @@  discard block
 block discarded – undo
1313 1313
 		$oModuleModel = getModel('module');
1314 1314
 		$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1315 1315
 		FileHandler::makeDir($path);
1316
-		$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext);
1316
+		$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext);
1317 1317
 		$tmp = $vars->addfile['tmp_name'];
1318 1318
 
1319 1319
 		// Check uploaded file
1320
-		if(!checkUploadedFile($tmp)) return false;
1320
+		if (!checkUploadedFile($tmp)) return false;
1321 1321
 
1322 1322
 		// upload
1323
-		if(!@move_uploaded_file($tmp, $save_filename))
1323
+		if (!@move_uploaded_file($tmp, $save_filename))
1324 1324
 		{
1325 1325
 			return false;
1326 1326
 		}
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
 		$args->member_srl = $vars->member_srl;
1332 1332
 		$args->comment = $vars->comment;
1333 1333
 		$args->filename = $save_filename;
1334
-		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1334
+		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1335 1335
 		$args->filesize = $vars->addfile['size'];
1336 1336
 
1337 1337
 		$output = executeQuery('module.insertModuleFileBox', $args);
@@ -1346,14 +1346,14 @@  discard block
 block discarded – undo
1346 1346
 	function procModuleFileBoxDelete()
1347 1347
 	{
1348 1348
 		$logged_info = Context::get('logged_info');
1349
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1349
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1350 1350
 
1351 1351
 		$module_filebox_srl = Context::get('module_filebox_srl');
1352
-		if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1352
+		if (!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1353 1353
 		$vars = new stdClass();
1354 1354
 		$vars->module_filebox_srl = $module_filebox_srl;
1355 1355
 		$output = $this->deleteModuleFileBox($vars);
1356
-		if(!$output->toBool()) return $output;
1356
+		if (!$output->toBool()) return $output;
1357 1357
 	}
1358 1358
 
1359 1359
 	function deleteModuleFileBox($vars)
@@ -1376,11 +1376,11 @@  discard block
 block discarded – undo
1376 1376
 		$this->unlockTimeoutPassed();
1377 1377
 		$args = new stdClass;
1378 1378
 		$args->lock_name = $lock_name;
1379
-		if(!$timeout) $timeout = 60;
1379
+		if (!$timeout) $timeout = 60;
1380 1380
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1381
-		if($member_srl) $args->member_srl = $member_srl;
1381
+		if ($member_srl) $args->member_srl = $member_srl;
1382 1382
 		$output = executeQuery('module.insertLock', $args);
1383
-		if($output->toBool())
1383
+		if ($output->toBool())
1384 1384
 		{
1385 1385
 			$output->add('lock_name', $lock_name);
1386 1386
 			$output->add('deadline', $args->deadline);
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		$output = executeQuery('module.updateModuleInSites', $args);
1410 1410
 
1411 1411
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1412
-		if($oCacheHandler->isSupport())
1412
+		if ($oCacheHandler->isSupport())
1413 1413
 		{
1414 1414
 			$oCacheHandler->invalidateGroupKey('site_and_module');
1415 1415
 		}
Please login to merge, or discard this patch.
Braces   +221 added lines, -104 removed lines patch added patch discarded remove patch
@@ -150,9 +150,15 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if($kind != 'admin') {
154
+			$kind = '';
155
+		}
156
+		if(!in_array($type,array('model','controller','view','api','mobile'))) {
157
+			return false;
158
+		}
159
+		if(in_array($parent_module, array('module','addon','widget','layout'))) {
160
+			return false;
161
+		}
156 162
 
157 163
 		$cache_file = './files/config/module_extend.php';
158 164
 		FileHandler::removeFile($cache_file);
@@ -164,7 +170,9 @@  discard block
 block discarded – undo
164 170
 		$args->kind = $kind;
165 171
 
166 172
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
173
+		if($output->data->count>0) {
174
+			return false;
175
+		}
168 176
 
169 177
 		$output = executeQuery('module.insertModuleExtend', $args);
170 178
 		return $output;
@@ -199,7 +207,9 @@  discard block
 block discarded – undo
199 207
 		$oModuleModel = getModel('module');
200 208
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 209
 
202
-		if(!$origin_config) $origin_config = new stdClass;
210
+		if(!$origin_config) {
211
+			$origin_config = new stdClass;
212
+		}
203 213
 
204 214
 		foreach($config as $key => $val)
205 215
 		{
@@ -221,7 +231,9 @@  discard block
 block discarded – undo
221 231
 		$args->site_srl = $site_srl;
222 232
 
223 233
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
234
+		if(!$output->toBool()) {
235
+			return $output;
236
+		}
225 237
 
226 238
 		$output = executeQuery('module.insertModuleConfig', $args);
227 239
 
@@ -246,7 +258,9 @@  discard block
 block discarded – undo
246 258
 		$args->config = serialize($config);
247 259
 
248 260
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
261
+		if(!$output->toBool()) {
262
+			return $output;
263
+		}
250 264
 
251 265
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 266
 
@@ -268,9 +282,10 @@  discard block
 block discarded – undo
268 282
 		if(isSiteID($domain))
269 283
 		{
270 284
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid');
272
-		}
273
-		else
285
+			if($oModuleModel->isIDExists($domain, 0)) {
286
+				return new BaseObject(-1,'msg_already_registed_vid');
287
+			}
288
+		} else
274 289
 		{
275 290
 			$domain = strtolower($domain);
276 291
 		}
@@ -284,10 +299,14 @@  discard block
 block discarded – undo
284 299
 		$columnList = array('modules.site_srl');
285 300
 		$oModuleModel = getModel('module');
286 301
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new BaseObject(-1,'msg_already_registed_vid');
302
+		if($output) {
303
+			return new BaseObject(-1,'msg_already_registed_vid');
304
+		}
288 305
 
289 306
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
307
+		if(!$output->toBool()) {
308
+			return $output;
309
+		}
291 310
 
292 311
 		$output->add('site_srl', $args->site_srl);
293 312
 		return $output;
@@ -310,8 +329,12 @@  discard block
 block discarded – undo
310 329
 		if($site_info->domain != $args->domain)
311 330
 		{
312 331
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid');
332
+			if($info->site_srl && $info->site_srl != $args->site_srl) {
333
+				return new BaseObject(-1,'msg_already_registed_domain');
334
+			}
335
+			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) {
336
+				return new BaseObject(-1,'msg_already_registed_vid');
337
+			}
315 338
 
316 339
 			if($args->domain && !isSiteID($args->domain))
317 340
 			{
@@ -320,8 +343,11 @@  discard block
 block discarded – undo
320 343
 		}
321 344
 		$output = executeQuery('module.updateSite', $args);
322 345
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
346
+		if($args->site_srl == 0) {
347
+			$vid='';
348
+		} else {
349
+			$vid=$args->domain;
350
+		}
325 351
 
326 352
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 353
 		$mid = $module_info->mid;
@@ -345,7 +371,9 @@  discard block
 block discarded – undo
345 371
 		unset($args->act);
346 372
 		unset($args->page);
347 373
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid');
374
+		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) {
375
+			return new BaseObject(-1, 'msg_limit_mid');
376
+		}
349 377
 		// Test variables (separate basic vars and other vars in modules)
350 378
 		$extra_vars = clone($args);
351 379
 		unset($extra_vars->module_srl);
@@ -382,18 +410,23 @@  discard block
 block discarded – undo
382 410
 		if(isset($args->isMenuCreate))
383 411
 		{
384 412
 			$isMenuCreate = $args->isMenuCreate;
385
-		}
386
-		else
413
+		} else
387 414
 		{
388 415
 			$isMenuCreate = TRUE;
389 416
 		}
390 417
 
391 418
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
419
+		if(!$output->toBool()) {
420
+			return $output;
421
+		}
393 422
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
423
+		if(!$args->site_srl) {
424
+			$args->site_srl = 0;
425
+		}
395 426
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists');
427
+		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) {
428
+			return new BaseObject(-1, 'msg_module_name_exists');
429
+		}
397 430
 
398 431
 		// begin transaction
399 432
 		$oDB = &DB::getInstance();
@@ -404,20 +437,20 @@  discard block
 block discarded – undo
404 437
 		$skin_vars = new stdClass();
405 438
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 439
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
440
+		if(!$args->module_srl) {
441
+			$args->module_srl = getNextSequence();
442
+		}
408 443
 
409 444
 		// default value
410 445
 		if($args->skin == '/USE_DEFAULT/')
411 446
 		{
412 447
 			$args->is_skin_fix = 'N';
413
-		}
414
-		else
448
+		} else
415 449
 		{
416 450
 			if(isset($args->is_skin_fix))
417 451
 			{
418 452
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419
-			}
420
-			else
453
+			} else
421 454
 			{
422 455
 				$args->is_skin_fix = 'Y';
423 456
 			}
@@ -426,14 +459,12 @@  discard block
 block discarded – undo
426 459
 		if($args->mskin == '/USE_DEFAULT/')
427 460
 		{
428 461
 			$args->is_mskin_fix = 'N';
429
-		}
430
-		else
462
+		} else
431 463
 		{
432 464
 			if(isset($args->is_mskin_fix))
433 465
 			{
434 466
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435
-			}
436
-			else
467
+			} else
437 468
 			{
438 469
 				$args->is_mskin_fix = 'Y';
439 470
 			}
@@ -510,14 +541,15 @@  discard block
 block discarded – undo
510 541
 		if(isset($args->isMenuCreate))
511 542
 		{
512 543
 			$isMenuCreate = $args->isMenuCreate;
513
-		}
514
-		else
544
+		} else
515 545
 		{
516 546
 			$isMenuCreate = TRUE;
517 547
 		}
518 548
 		
519 549
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
520
-		if(!$output->toBool()) return $output;
550
+		if(!$output->toBool()) {
551
+			return $output;
552
+		}
521 553
 		// begin transaction
522 554
 		$oDB = &DB::getInstance();
523 555
 		$oDB->begin();
@@ -528,8 +560,12 @@  discard block
 block discarded – undo
528 560
 
529 561
 		if(!$args->site_srl || !$args->browser_title)
530 562
 		{
531
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
532
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
563
+			if(!$args->site_srl) {
564
+				$args->site_srl = (int)$module_info->site_srl;
565
+			}
566
+			if(!$args->browser_title) {
567
+				$args->browser_title = $module_info->browser_title;
568
+			}
533 569
 		}
534 570
 
535 571
 		$args->browser_title = strip_tags($args->browser_title);
@@ -545,14 +581,12 @@  discard block
 block discarded – undo
545 581
 		if($args->skin == '/USE_DEFAULT/')
546 582
 		{
547 583
 			$args->is_skin_fix = 'N';
548
-		}
549
-		else
584
+		} else
550 585
 		{
551 586
 			if(isset($args->is_skin_fix))
552 587
 			{
553 588
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
554
-			}
555
-			else
589
+			} else
556 590
 			{
557 591
 				$args->is_skin_fix = 'Y';
558 592
 			}
@@ -561,14 +595,12 @@  discard block
 block discarded – undo
561 595
 		if($args->mskin == '/USE_DEFAULT/')
562 596
 		{
563 597
 			$args->is_mskin_fix = 'N';
564
-		}
565
-		else
598
+		} else
566 599
 		{
567 600
 			if(isset($args->is_mskin_fix))
568 601
 			{
569 602
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
570
-			}
571
-			else
603
+			} else
572 604
 			{
573 605
 				$args->is_mskin_fix = 'Y';
574 606
 			}
@@ -637,7 +669,9 @@  discard block
 block discarded – undo
637 669
 		$args->update_id = $update_id;
638 670
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
639 671
 
640
-		if(!!$output->error) return false;
672
+		if(!!$output->error) {
673
+			return false;
674
+		}
641 675
 
642 676
 		return true;
643 677
 	}
@@ -652,7 +686,9 @@  discard block
 block discarded – undo
652 686
 		$args->site_srl = $site_srl;
653 687
 		$args->layout_srl = $layout_srl;
654 688
 		$output = executeQuery('module.updateModuleSite', $args);
655
-		if(!$output->toBool()) return $output;
689
+		if(!$output->toBool()) {
690
+			return $output;
691
+		}
656 692
 
657 693
 		//remove from cache
658 694
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -671,7 +707,9 @@  discard block
 block discarded – undo
671 707
 	 */
672 708
 	function deleteModule($module_srl, $site_srl = 0)
673 709
 	{
674
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
710
+		if(!$module_srl) {
711
+			return new BaseObject(-1,'msg_invalid_request');
712
+		}
675 713
 
676 714
 		$site_module_info = Context::get('site_module_info');
677 715
 
@@ -681,8 +719,11 @@  discard block
 block discarded – undo
681 719
 		$args = new stdClass();
682 720
 		$args->url = $output->mid;
683 721
 		$args->is_shortcut = 'N';
684
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
685
-		else $args->site_srl = $site_srl;
722
+		if(!$site_srl) {
723
+			$args->site_srl = $site_module_info->site_srl;
724
+		} else {
725
+			$args->site_srl = $site_srl;
726
+		}
686 727
 
687 728
 		unset($output);
688 729
 
@@ -715,8 +756,7 @@  discard block
 block discarded – undo
715 756
 			if($output->isSuccess)
716 757
 			{
717 758
 				return new BaseObject(0, 'success_deleted');
718
-			}
719
-			else
759
+			} else
720 760
 			{
721 761
 				return new BaseObject($output->error, $output->message);
722 762
 			}
@@ -734,19 +774,25 @@  discard block
 block discarded – undo
734 774
 	 */
735 775
 	public function onlyDeleteModule($module_srl)
736 776
 	{
737
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
777
+		if(!$module_srl) {
778
+			return new BaseObject(-1,'msg_invalid_request');
779
+		}
738 780
 
739 781
 		// check start module
740 782
 		$oModuleModel = getModel('module');
741 783
 		$columnList = array('sites.index_module_srl');
742 784
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
743
-		if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
785
+		if($module_srl == $start_module->index_module_srl) {
786
+			return new BaseObject(-1, 'msg_cannot_delete_startmodule');
787
+		}
744 788
 
745 789
 		// Call a trigger (before)
746 790
 		$trigger_obj = new stdClass();
747 791
 		$trigger_obj->module_srl = $module_srl;
748 792
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
749
-		if(!$output->toBool()) return $output;
793
+		if(!$output->toBool()) {
794
+			return $output;
795
+		}
750 796
 
751 797
 		// begin transaction
752 798
 		$oDB = &DB::getInstance();
@@ -807,7 +853,9 @@  discard block
 block discarded – undo
807 853
 	function clearDefaultModule()
808 854
 	{
809 855
 		$output = executeQuery('module.clearDefaultModule');
810
-		if(!$output->toBool()) return $output;
856
+		if(!$output->toBool()) {
857
+			return $output;
858
+		}
811 859
 
812 860
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
813 861
 		if($oCacheHandler->isSupport())
@@ -839,7 +887,9 @@  discard block
 block discarded – undo
839 887
 	 */
840 888
 	function updateModuleLayout($layout_srl, $menu_srl_list)
841 889
 	{
842
-		if(!count($menu_srl_list)) return;
890
+		if(!count($menu_srl_list)) {
891
+			return;
892
+		}
843 893
 
844 894
 		$args = new stdClass;
845 895
 		$args->layout_srl = $layout_srl;
@@ -866,28 +916,37 @@  discard block
 block discarded – undo
866 916
 
867 917
 		$output = executeQuery('module.deleteSiteAdmin', $args);
868 918
 
869
-		if(!$output->toBool()) return $output;
919
+		if(!$output->toBool()) {
920
+			return $output;
921
+		}
870 922
 		// Get user id of an administrator
871
-		if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
923
+		if(!is_array($arr_admins) || !count($arr_admins)) {
924
+			return new BaseObject();
925
+		}
872 926
 		foreach($arr_admins as $key => $user_id)
873 927
 		{
874
-			if(!trim($user_id)) continue;
928
+			if(!trim($user_id)) {
929
+				continue;
930
+			}
875 931
 			$admins[] = trim($user_id);
876 932
 		}
877
-		if(!count($admins)) return new BaseObject();
933
+		if(!count($admins)) {
934
+			return new BaseObject();
935
+		}
878 936
 
879 937
 		$oMemberModel = getModel('member');
880 938
 		$member_config = $oMemberModel->getMemberConfig();
881 939
 		if($member_config->identifier == 'email_address')
882 940
 		{
883 941
 			$args->email_address = '\''.implode('\',\'',$admins).'\'';
884
-		}
885
-		else
942
+		} else
886 943
 		{
887 944
 			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
888 945
 		}
889 946
 		$output = executeQueryArray('module.getAdminSrls', $args);
890
-		if(!$output->toBool()||!$output->data) return $output;
947
+		if(!$output->toBool()||!$output->data) {
948
+			return $output;
949
+		}
891 950
 
892 951
 		foreach($output->data as $key => $val)
893 952
 		{
@@ -896,7 +955,9 @@  discard block
 block discarded – undo
896 955
 			$args->site_srl = $site_srl;
897 956
 			$args->member_srl = $val->member_srl;
898 957
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
899
-			if(!$output->toBool()) return $output;
958
+			if(!$output->toBool()) {
959
+				return $output;
960
+			}
900 961
 		}
901 962
 		return new BaseObject();
902 963
 	}
@@ -909,12 +970,15 @@  discard block
 block discarded – undo
909 970
 		$oMemberModel = getModel('member');
910 971
 		$member_config = $oMemberModel->getMemberConfig();
911 972
 
912
-		if($member_config->identifier == 'email_address')
913
-			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
914
-		else
915
-			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
973
+		if($member_config->identifier == 'email_address') {
974
+					$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
975
+		} else {
976
+					$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
977
+		}
916 978
 
917
-		if(!$member_info->member_srl) return;
979
+		if(!$member_info->member_srl) {
980
+			return;
981
+		}
918 982
 		$args = new stdClass();
919 983
 		$args->module_srl = $module_srl;
920 984
 		$args->member_srl = $member_info->member_srl;
@@ -933,7 +997,9 @@  discard block
 block discarded – undo
933 997
 		{
934 998
 			$oMemberModel = getModel('member');
935 999
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
936
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
1000
+			if($member_info->member_srl) {
1001
+				$args->member_srl = $member_info->member_srl;
1002
+			}
937 1003
 		}
938 1004
 		return executeQuery('module.deleteAdminId', $args);
939 1005
 	}
@@ -977,7 +1043,9 @@  discard block
 block discarded – undo
977 1043
 		}
978 1044
 
979 1045
 		getDestroyXeVars($obj);
980
-		if(!$obj || !count($obj)) return new BaseObject();
1046
+		if(!$obj || !count($obj)) {
1047
+			return new BaseObject();
1048
+		}
981 1049
 
982 1050
 		$args = new stdClass;
983 1051
 		$args->module_srl = $module_srl;
@@ -987,18 +1055,23 @@  discard block
 block discarded – undo
987 1055
 			// it often saved menu item(stdClass) on the skin info column
988 1056
 			// When updating the module on XE core 1.2.0 later versions, it occurs an error
989 1057
 			// fixed the error
990
-			if (is_object($val)) continue;
991
-			if (is_array($val)) $val = serialize($val);
1058
+			if (is_object($val)) {
1059
+				continue;
1060
+			}
1061
+			if (is_array($val)) {
1062
+				$val = serialize($val);
1063
+			}
992 1064
 
993 1065
 			$args->name = trim($key);
994 1066
 			$args->value = trim($val);
995
-			if(!$args->name || !$args->value) continue;
1067
+			if(!$args->name || !$args->value) {
1068
+				continue;
1069
+			}
996 1070
 
997 1071
 			if($mode === 'P')
998 1072
 			{
999 1073
 				$output = executeQuery('module.insertModuleSkinVars', $args);
1000
-			}
1001
-			else
1074
+			} else
1002 1075
 			{
1003 1076
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
1004 1077
 			}
@@ -1045,8 +1118,7 @@  discard block
 block discarded – undo
1045 1118
 		{
1046 1119
 			$object_key = 'module_skin_vars:'.$module_srl;
1047 1120
 			$query = 'module.deleteModuleSkinVars';
1048
-		}
1049
-		else
1121
+		} else
1050 1122
 		{
1051 1123
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1052 1124
 			$query = 'module.deleteModuleMobileSkinVars';
@@ -1070,17 +1142,23 @@  discard block
 block discarded – undo
1070 1142
 	{
1071 1143
 		$this->deleteModuleExtraVars($module_srl);
1072 1144
 		getDestroyXeVars($obj);
1073
-		if(!$obj || !count($obj)) return;
1145
+		if(!$obj || !count($obj)) {
1146
+			return;
1147
+		}
1074 1148
 
1075 1149
 		foreach($obj as $key => $val)
1076 1150
 		{
1077
-			if(is_object($val) || is_array($val)) continue;
1151
+			if(is_object($val) || is_array($val)) {
1152
+				continue;
1153
+			}
1078 1154
 
1079 1155
 			$args = new stdClass();
1080 1156
 			$args->module_srl = $module_srl;
1081 1157
 			$args->name = trim($key);
1082 1158
 			$args->value = trim($val);
1083
-			if(!$args->name || !$args->value) continue;
1159
+			if(!$args->name || !$args->value) {
1160
+				continue;
1161
+			}
1084 1162
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1085 1163
 		}
1086 1164
 
@@ -1120,11 +1198,15 @@  discard block
 block discarded – undo
1120 1198
 	function insertModuleGrants($module_srl, $obj)
1121 1199
 	{
1122 1200
 		$this->deleteModuleGrants($module_srl);
1123
-		if(!$obj || !count($obj)) return;
1201
+		if(!$obj || !count($obj)) {
1202
+			return;
1203
+		}
1124 1204
 
1125 1205
 		foreach($obj as $name => $val)
1126 1206
 		{
1127
-			if(!$val || !count($val)) continue;
1207
+			if(!$val || !count($val)) {
1208
+				continue;
1209
+			}
1128 1210
 
1129 1211
 			foreach($val as $group_srl)
1130 1212
 			{
@@ -1132,7 +1214,9 @@  discard block
 block discarded – undo
1132 1214
 				$args->module_srl = $module_srl;
1133 1215
 				$args->name = $name;
1134 1216
 				$args->group_srl = trim($group_srl);
1135
-				if(!$args->name || !$args->group_srl) continue;
1217
+				if(!$args->name || !$args->group_srl) {
1218
+					continue;
1219
+				}
1136 1220
 				executeQuery('module.insertModuleGrant', $args);
1137 1221
 			}
1138 1222
 		}
@@ -1184,7 +1268,9 @@  discard block
 block discarded – undo
1184 1268
 			}
1185 1269
 		}
1186 1270
 
1187
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1271
+		if(!Context::get($matches[1]) && $lang[$matches[1]]) {
1272
+			return $lang[$matches[1]];
1273
+		}
1188 1274
 
1189 1275
 		return str_replace('$user_lang->','',$matches[0]);
1190 1276
 	}
@@ -1196,10 +1282,14 @@  discard block
 block discarded – undo
1196 1282
 	function procModuleFileBoxAdd()
1197 1283
 	{
1198 1284
 		$ajax = Context::get('ajax');
1199
-		if ($ajax) Context::setRequestMethod('JSON');
1285
+		if ($ajax) {
1286
+			Context::setRequestMethod('JSON');
1287
+		}
1200 1288
 
1201 1289
 		$logged_info = Context::get('logged_info');
1202
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1290
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1291
+			return new BaseObject(-1, 'msg_not_permitted');
1292
+		}
1203 1293
 
1204 1294
 		$vars = Context::gets('addfile','filter');
1205 1295
 		$attributeNames = Context::get('attribute_name');
@@ -1223,9 +1313,14 @@  discard block
 block discarded – undo
1223 1313
 
1224 1314
 		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1225 1315
 		$vars->ext = $ext;
1226
-		if($vars->filter) $filter = explode(',',$vars->filter);
1227
-		else $filter = array('jpg','jpeg','gif','png');
1228
-		if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured');
1316
+		if($vars->filter) {
1317
+			$filter = explode(',',$vars->filter);
1318
+		} else {
1319
+			$filter = array('jpg','jpeg','gif','png');
1320
+		}
1321
+		if(!in_array($ext,$filter)) {
1322
+			return new BaseObject(-1, 'msg_error_occured');
1323
+		}
1229 1324
 
1230 1325
 		$vars->member_srl = $logged_info->member_srl;
1231 1326
 
@@ -1238,10 +1333,16 @@  discard block
 block discarded – undo
1238 1333
 		// insert
1239 1334
 		else
1240 1335
 		{
1241
-			if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1336
+			if(!Context::isUploaded()) {
1337
+				return new BaseObject(-1, 'msg_error_occured');
1338
+			}
1242 1339
 			$addfile = Context::get('addfile');
1243
-			if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1244
-			if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1340
+			if(!is_uploaded_file($addfile['tmp_name'])) {
1341
+				return new BaseObject(-1, 'msg_error_occured');
1342
+			}
1343
+			if($vars->addfile['error'] != 0) {
1344
+				return new BaseObject(-1, 'msg_error_occured');
1345
+			}
1245 1346
 			$output = $this->insertModuleFileBox($vars);
1246 1347
 		}
1247 1348
 
@@ -1252,11 +1353,13 @@  discard block
 block discarded – undo
1252 1353
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox');
1253 1354
 			$this->setRedirectUrl($returnUrl);
1254 1355
 			return;
1255
-		}
1256
-		else
1356
+		} else
1257 1357
 		{
1258
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1259
-			else $this->add('save_filename', '');
1358
+			if($output) {
1359
+				$this->add('save_filename', $output->get('save_filename'));
1360
+			} else {
1361
+				$this->add('save_filename', '');
1362
+			}
1260 1363
 		}
1261 1364
 	}
1262 1365
 
@@ -1280,7 +1383,9 @@  discard block
 block discarded – undo
1280 1383
 			$tmp = $vars->addfile['tmp_name'];
1281 1384
 
1282 1385
 			// Check uploaded file
1283
-			if(!checkUploadedFile($tmp)) return false;
1386
+			if(!checkUploadedFile($tmp)) {
1387
+				return false;
1388
+			}
1284 1389
 
1285 1390
 			if(!@move_uploaded_file($tmp, $save_filename))
1286 1391
 			{
@@ -1317,7 +1422,9 @@  discard block
 block discarded – undo
1317 1422
 		$tmp = $vars->addfile['tmp_name'];
1318 1423
 
1319 1424
 		// Check uploaded file
1320
-		if(!checkUploadedFile($tmp)) return false;
1425
+		if(!checkUploadedFile($tmp)) {
1426
+			return false;
1427
+		}
1321 1428
 
1322 1429
 		// upload
1323 1430
 		if(!@move_uploaded_file($tmp, $save_filename))
@@ -1346,14 +1453,20 @@  discard block
 block discarded – undo
1346 1453
 	function procModuleFileBoxDelete()
1347 1454
 	{
1348 1455
 		$logged_info = Context::get('logged_info');
1349
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1456
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1457
+			return new BaseObject(-1, 'msg_not_permitted');
1458
+		}
1350 1459
 
1351 1460
 		$module_filebox_srl = Context::get('module_filebox_srl');
1352
-		if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1461
+		if(!$module_filebox_srl) {
1462
+			return new BaseObject(-1, 'msg_invalid_request');
1463
+		}
1353 1464
 		$vars = new stdClass();
1354 1465
 		$vars->module_filebox_srl = $module_filebox_srl;
1355 1466
 		$output = $this->deleteModuleFileBox($vars);
1356
-		if(!$output->toBool()) return $output;
1467
+		if(!$output->toBool()) {
1468
+			return $output;
1469
+		}
1357 1470
 	}
1358 1471
 
1359 1472
 	function deleteModuleFileBox($vars)
@@ -1376,9 +1489,13 @@  discard block
 block discarded – undo
1376 1489
 		$this->unlockTimeoutPassed();
1377 1490
 		$args = new stdClass;
1378 1491
 		$args->lock_name = $lock_name;
1379
-		if(!$timeout) $timeout = 60;
1492
+		if(!$timeout) {
1493
+			$timeout = 60;
1494
+		}
1380 1495
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1381
-		if($member_srl) $args->member_srl = $member_srl;
1496
+		if($member_srl) {
1497
+			$args->member_srl = $member_srl;
1498
+		}
1382 1499
 		$output = executeQuery('module.insertLock', $args);
1383 1500
 		if($output->toBool())
1384 1501
 		{
Please login to merge, or discard this patch.
modules/page/page.view.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -129,6 +129,8 @@  discard block
 block discarded – undo
129 129
 
130 130
 	/**
131 131
 	 * @brief Save the file and return if a file is requested by http
132
+	 * @param integer $caching_interval
133
+	 * @param string $cache_file
132 134
 	 */
133 135
 	function getHtmlPage($path, $caching_interval, $cache_file)
134 136
 	{
@@ -167,6 +169,8 @@  discard block
 block discarded – undo
167 169
 
168 170
 	/**
169 171
 	 * @brief Create a cache file in order to include if it is an internal file
172
+	 * @param integer $caching_interval
173
+	 * @param string $cache_file
170 174
 	 */
171 175
 	function executeFile($target_file, $caching_interval, $cache_file)
172 176
 	{
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -22,18 +22,18 @@  discard block
 block discarded – undo
22 22
 		// Get a template path (page in the administrative template tpl putting together)
23 23
 		$this->setTemplatePath($this->module_path.'tpl');
24 24
 
25
-		switch($this->module_info->page_type)
25
+		switch ($this->module_info->page_type)
26 26
 		{
27 27
 			case 'WIDGET' :
28 28
 				{
29 29
 					$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
30
-					$this->interval = (int)($this->module_info->page_caching_interval);
30
+					$this->interval = (int) ($this->module_info->page_caching_interval);
31 31
 					break;
32 32
 				}
33 33
 			case 'OUTSIDE' :
34 34
 				{
35 35
 					$this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getSslStatus());
36
-					$this->interval = (int)($this->module_info->page_caching_interval);
36
+					$this->interval = (int) ($this->module_info->page_caching_interval);
37 37
 					$this->path = $this->module_info->path;
38 38
 					break;
39 39
 				}
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	function dispPageIndex()
47 47
 	{
48 48
 		// Variables used in the template Context:: set()
49
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
49
+		if ($this->module_srl) Context::set('module_srl', $this->module_srl);
50 50
 
51 51
 		$page_type_name = strtolower($this->module_info->page_type);
52
-		$method = '_get' . ucfirst($page_type_name) . 'Content';
53
-		if(method_exists($this, $method)) $page_content = $this->{$method}();
52
+		$method = '_get'.ucfirst($page_type_name).'Content';
53
+		if (method_exists($this, $method)) $page_content = $this->{$method}();
54 54
 		else return new BaseObject(-1, sprintf('%s method is not exists', $method));
55 55
 
56 56
 		Context::set('module_info', $this->module_info);
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 
62 62
 	function _getWidgetContent()
63 63
 	{
64
-		if($this->interval>0)
64
+		if ($this->interval > 0)
65 65
 		{
66
-			if(!file_exists($this->cache_file)) $mtime = 0;
66
+			if (!file_exists($this->cache_file)) $mtime = 0;
67 67
 			else $mtime = filemtime($this->cache_file);
68 68
 
69
-			if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME'])
69
+			if ($mtime + $this->interval * 60 > $_SERVER['REQUEST_TIME'])
70 70
 			{
71 71
 				$page_content = FileHandler::readFile($this->cache_file); 
72 72
 				$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		}
81 81
 		else
82 82
 		{
83
-			if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
83
+			if (file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
84 84
 			$page_content = $this->module_info->content;
85 85
 		}
86 86
 		return $page_content;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		$oDocumentModel = getModel('document');
94 94
 		$oDocument = $oDocumentModel->getDocument(0, true);
95 95
 
96
-		if($this->module_info->document_srl)
96
+		if ($this->module_info->document_srl)
97 97
 		{
98 98
 			$document_srl = $this->module_info->document_srl;
99 99
 			$oDocument->setDocument($document_srl);
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	function _getOutsideContent()
119 119
 	{
120 120
 		// check if it is http or internal file
121
-		if($this->path)
121
+		if ($this->path)
122 122
 		{
123
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
123
+			if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
124 124
 			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
125 125
 		}
126 126
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	function getHtmlPage($path, $caching_interval, $cache_file)
134 134
 	{
135 135
 		// Verify cache
136
-		if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME'])
136
+		if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME'])
137 137
 		{
138 138
 			$content = FileHandler::readFile($cache_file);
139 139
 		}
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 		$content = $buff->content;
155 155
 		// Extract a title
156 156
 		$title = $oPageController->getTitle($content);
157
-		if($title) Context::setBrowserTitle($title);
157
+		if ($title) Context::setBrowserTitle($title);
158 158
 		// Extract header script
159 159
 		$head_script = $oPageController->getHeadScript($content);
160
-		if($head_script) Context::addHtmlHeader($head_script);
160
+		if ($head_script) Context::addHtmlHeader($head_script);
161 161
 		// Extract content from the body
162 162
 		$body_script = $oPageController->getBodyScript($content);
163
-		if(!$body_script) $body_script = $content;
163
+		if (!$body_script) $body_script = $content;
164 164
 
165 165
 		return $content;
166 166
 	}
@@ -171,32 +171,32 @@  discard block
 block discarded – undo
171 171
 	function executeFile($target_file, $caching_interval, $cache_file)
172 172
 	{
173 173
 		// Cancel if the file doesn't exist
174
-		if(!file_exists(FileHandler::getRealPath($target_file))) return;
174
+		if (!file_exists(FileHandler::getRealPath($target_file))) return;
175 175
 
176 176
 		// Get a path and filename
177
-		$tmp_path = explode('/',$cache_file);
178
-		$filename = $tmp_path[count($tmp_path)-1];
179
-		$filepath = preg_replace('/'.$filename."$/i","",$cache_file);
177
+		$tmp_path = explode('/', $cache_file);
178
+		$filename = $tmp_path[count($tmp_path) - 1];
179
+		$filepath = preg_replace('/'.$filename."$/i", "", $cache_file);
180 180
 		$cache_file = FileHandler::getRealPath($cache_file);
181 181
 
182 182
 		$level = ob_get_level();
183 183
 		// Verify cache
184
-		if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file))
184
+		if ($caching_interval < 1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval * 60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file) < filemtime($target_file))
185 185
 		{
186
-			if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
186
+			if (file_exists($cache_file)) FileHandler::removeFile($cache_file);
187 187
 
188 188
 			// Read a target file and get content
189 189
 			ob_start();
190 190
 			include(FileHandler::getRealPath($target_file));
191 191
 			$content = ob_get_clean();
192 192
 			// Replace relative path to the absolute path 
193
-			$this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/';
194
-			$content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content);
195
-			$content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content);
193
+			$this->path = str_replace('\\', '/', realpath(dirname($target_file))).'/';
194
+			$content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is', array($this, '_replacePath'), $content);
195
+			$content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is', array($this, '_replacePath'), $content);
196 196
 
197 197
 			FileHandler::writeFile($cache_file, $content);
198 198
 			// Include and then Return the result
199
-			if(!file_exists($cache_file)) return;
199
+			if (!file_exists($cache_file)) return;
200 200
 			// Attempt to compile
201 201
 			$oTemplate = &TemplateHandler::getInstance();
202 202
 			$script = $oTemplate->compileDirect($filepath, $filename);
@@ -223,20 +223,20 @@  discard block
 block discarded – undo
223 223
 		$val = trim($matches[3]);
224 224
 		// Pass if the path is external or starts with /, #, { characters
225 225
 		// /=absolute path, #=hash in a page, {=Template syntax
226
-		if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val))
226
+		if (strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i', $val))
227 227
 		{
228 228
 				return $matches[0];
229 229
 			// In case of  .. , get a path
230 230
 		}
231
-		else if(strncasecmp('..', $val, 2) === 0)
231
+		else if (strncasecmp('..', $val, 2) === 0)
232 232
 		{
233 233
 			$p = Context::pathToUrl($this->path);
234
-			return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
234
+			return sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]);
235 235
 		}
236 236
 
237
-		if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2);
237
+		if (strncasecmp('..', $val, 2) === 0) $val = substr($val, 2);
238 238
 		$p = Context::pathToUrl($this->path);
239
-		$path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
239
+		$path = sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]);
240 240
 
241 241
 		return $path;
242 242
 	}
Please login to merge, or discard this patch.
Braces   +47 added lines, -25 removed lines patch added patch discarded remove patch
@@ -46,12 +46,17 @@  discard block
 block discarded – undo
46 46
 	function dispPageIndex()
47 47
 	{
48 48
 		// Variables used in the template Context:: set()
49
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
49
+		if($this->module_srl) {
50
+			Context::set('module_srl',$this->module_srl);
51
+		}
50 52
 
51 53
 		$page_type_name = strtolower($this->module_info->page_type);
52 54
 		$method = '_get' . ucfirst($page_type_name) . 'Content';
53
-		if(method_exists($this, $method)) $page_content = $this->{$method}();
54
-		else return new BaseObject(-1, sprintf('%s method is not exists', $method));
55
+		if(method_exists($this, $method)) {
56
+			$page_content = $this->{$method}();
57
+		} else {
58
+			return new BaseObject(-1, sprintf('%s method is not exists', $method));
59
+		}
55 60
 
56 61
 		Context::set('module_info', $this->module_info);
57 62
 		Context::set('page_content', $page_content);
@@ -63,24 +68,27 @@  discard block
 block discarded – undo
63 68
 	{
64 69
 		if($this->interval>0)
65 70
 		{
66
-			if(!file_exists($this->cache_file)) $mtime = 0;
67
-			else $mtime = filemtime($this->cache_file);
71
+			if(!file_exists($this->cache_file)) {
72
+				$mtime = 0;
73
+			} else {
74
+				$mtime = filemtime($this->cache_file);
75
+			}
68 76
 
69 77
 			if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME'])
70 78
 			{
71 79
 				$page_content = FileHandler::readFile($this->cache_file); 
72 80
 				$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
73
-			}
74
-			else
81
+			} else
75 82
 			{
76 83
 				$oWidgetController = getController('widget');
77 84
 				$page_content = $oWidgetController->transWidgetCode($this->module_info->content);
78 85
 				FileHandler::writeFile($this->cache_file, $page_content);
79 86
 			}
80
-		}
81
-		else
87
+		} else
82 88
 		{
83
-			if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
89
+			if(file_exists($this->cache_file)) {
90
+				FileHandler::removeFile($this->cache_file);
91
+			}
84 92
 			$page_content = $this->module_info->content;
85 93
 		}
86 94
 		return $page_content;
@@ -104,8 +112,7 @@  discard block
 block discarded – undo
104 112
 		if ($this->module_info->skin)
105 113
 		{
106 114
 			$templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin));
107
-		}
108
-		else
115
+		} else
109 116
 		{
110 117
 			$templatePath = ($this->module_path.'skins/default');
111 118
 		}
@@ -120,8 +127,11 @@  discard block
 block discarded – undo
120 127
 		// check if it is http or internal file
121 128
 		if($this->path)
122 129
 		{
123
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
124
-			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
130
+			if(preg_match("/^([a-z]+):\/\//i",$this->path)) {
131
+				$content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
132
+			} else {
133
+				$content = $this->executeFile($this->path, $this->interval, $this->cache_file);
134
+			}
125 135
 		}
126 136
 
127 137
 		return $content;
@@ -136,8 +146,7 @@  discard block
 block discarded – undo
136 146
 		if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME'])
137 147
 		{
138 148
 			$content = FileHandler::readFile($cache_file);
139
-		}
140
-		else
149
+		} else
141 150
 		{
142 151
 			FileHandler::getRemoteFile($path, $cache_file);
143 152
 			$content = FileHandler::readFile($cache_file);
@@ -154,13 +163,19 @@  discard block
 block discarded – undo
154 163
 		$content = $buff->content;
155 164
 		// Extract a title
156 165
 		$title = $oPageController->getTitle($content);
157
-		if($title) Context::setBrowserTitle($title);
166
+		if($title) {
167
+			Context::setBrowserTitle($title);
168
+		}
158 169
 		// Extract header script
159 170
 		$head_script = $oPageController->getHeadScript($content);
160
-		if($head_script) Context::addHtmlHeader($head_script);
171
+		if($head_script) {
172
+			Context::addHtmlHeader($head_script);
173
+		}
161 174
 		// Extract content from the body
162 175
 		$body_script = $oPageController->getBodyScript($content);
163
-		if(!$body_script) $body_script = $content;
176
+		if(!$body_script) {
177
+			$body_script = $content;
178
+		}
164 179
 
165 180
 		return $content;
166 181
 	}
@@ -171,7 +186,9 @@  discard block
 block discarded – undo
171 186
 	function executeFile($target_file, $caching_interval, $cache_file)
172 187
 	{
173 188
 		// Cancel if the file doesn't exist
174
-		if(!file_exists(FileHandler::getRealPath($target_file))) return;
189
+		if(!file_exists(FileHandler::getRealPath($target_file))) {
190
+			return;
191
+		}
175 192
 
176 193
 		// Get a path and filename
177 194
 		$tmp_path = explode('/',$cache_file);
@@ -183,7 +200,9 @@  discard block
 block discarded – undo
183 200
 		// Verify cache
184 201
 		if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file))
185 202
 		{
186
-			if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
203
+			if(file_exists($cache_file)) {
204
+				FileHandler::removeFile($cache_file);
205
+			}
187 206
 
188 207
 			// Read a target file and get content
189 208
 			ob_start();
@@ -196,7 +215,9 @@  discard block
 block discarded – undo
196 215
 
197 216
 			FileHandler::writeFile($cache_file, $content);
198 217
 			// Include and then Return the result
199
-			if(!file_exists($cache_file)) return;
218
+			if(!file_exists($cache_file)) {
219
+				return;
220
+			}
200 221
 			// Attempt to compile
201 222
 			$oTemplate = &TemplateHandler::getInstance();
202 223
 			$script = $oTemplate->compileDirect($filepath, $filename);
@@ -227,14 +248,15 @@  discard block
 block discarded – undo
227 248
 		{
228 249
 				return $matches[0];
229 250
 			// In case of  .. , get a path
230
-		}
231
-		else if(strncasecmp('..', $val, 2) === 0)
251
+		} else if(strncasecmp('..', $val, 2) === 0)
232 252
 		{
233 253
 			$p = Context::pathToUrl($this->path);
234 254
 			return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
235 255
 		}
236 256
 
237
-		if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2);
257
+		if(strncasecmp('..', $val, 2) === 0) {
258
+			$val = substr($val,2);
259
+		}
238 260
 		$p = Context::pathToUrl($this->path);
239 261
 		$path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
240 262
 
Please login to merge, or discard this patch.
modules/point/point.controller.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -478,6 +478,7 @@
 block discarded – undo
478 478
 
479 479
 	/**
480 480
 	 * @brief Set points
481
+	 * @param string $mode
481 482
 	 */
482 483
 	function setPoint($member_srl, $point, $mode = null)
483 484
 	{
Please login to merge, or discard this patch.
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		$point = $config->signup_point;
32 32
 		// Increase the point
33 33
 		$cur_point += $point;
34
-		$this->setPoint($member_srl,$cur_point, 'signup');
34
+		$this->setPoint($member_srl, $cur_point, 'signup');
35 35
 
36 36
 		return new BaseObject();
37 37
 	}
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	function triggerAfterLogin(&$obj)
43 43
 	{
44 44
 		$member_srl = $obj->member_srl;
45
-		if(!$member_srl) return new BaseObject();
45
+		if (!$member_srl) return new BaseObject();
46 46
 		// If the last login is not today, give the points
47
-		if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject();
47
+		if (substr($obj->last_login, 0, 8) == date("Ymd")) return new BaseObject();
48 48
 		// Get the point module information
49 49
 		$oModuleModel = getModel('module');
50 50
 		$config = $oModuleModel->getModuleConfig('point');
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$point = $config->login_point;
56 56
 		// Increase the point
57 57
 		$cur_point += $point;
58
-		$this->setPoint($member_srl,$cur_point);
58
+		$this->setPoint($member_srl, $cur_point);
59 59
 
60 60
 		return new BaseObject();
61 61
 	}
@@ -66,30 +66,30 @@  discard block
 block discarded – undo
66 66
 	function triggerInsertDocument(&$obj)
67 67
 	{
68 68
 		$oDocumentModel = getModel('document');
69
-		if($obj->status != $oDocumentModel->getConfigStatus('temp'))
69
+		if ($obj->status != $oDocumentModel->getConfigStatus('temp'))
70 70
 		{
71 71
 			$module_srl = $obj->module_srl;
72 72
 			$member_srl = $obj->member_srl;
73
-			if(!$module_srl || !$member_srl) return new BaseObject();
73
+			if (!$module_srl || !$member_srl) return new BaseObject();
74 74
 			// The fix to disable giving points for saving the document temporarily
75
-			if($module_srl == $member_srl) return new BaseObject();
75
+			if ($module_srl == $member_srl) return new BaseObject();
76 76
 			// Get the point module information
77 77
 			$oModuleModel = getModel('module');
78 78
 			$config = $oModuleModel->getModuleConfig('point');
79
-			$module_config = $oModuleModel->getModulePartConfig('point',$module_srl);
79
+			$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
80 80
 			// Get the points of the member
81 81
 			$oPointModel = getModel('point');
82 82
 			$cur_point = $oPointModel->getPoint($member_srl, true);
83 83
 
84 84
 			$point = $module_config['insert_document'];
85
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
85
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
86 86
 			$cur_point += $point;
87 87
 			// Add points for attaching a file
88 88
 			$point = $module_config['upload_file'];
89
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
89
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
+			if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
91 91
 			// Increase the point
92
-			$this->setPoint($member_srl,$cur_point);
92
+			$this->setPoint($member_srl, $cur_point);
93 93
 		}
94 94
 
95 95
 		return new BaseObject();
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
 		$oDocument = $oDocumentModel->getDocument($document_srl);
107 107
 
108 108
 		// if status is TEMP or PUBLIC... give not point, only status is empty
109
-		if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
109
+		if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
110 110
 		{
111 111
 			$oModuleModel = getModel('module');
112 112
 
113 113
 			// Get the point module information
114 114
 			$config = $oModuleModel->getModuleConfig('point');
115
-			$module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl);
115
+			$module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl);
116 116
 			// Get the points of the member
117 117
 			$oPointModel = getModel('point');
118 118
 			$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
119 119
 
120 120
 			$point = $module_config['insert_document'];
121
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
121
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
122 122
 			$cur_point += $point;
123 123
 			// Add points for attaching a file
124 124
 			$point = $module_config['upload_file'];
125
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
125
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
+			if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
127 127
 			// Increase the point
128 128
 			$this->setPoint($oDocument->get('member_srl'), $cur_point);
129 129
 		}
@@ -141,42 +141,42 @@  discard block
 block discarded – undo
141 141
 
142 142
 		$oDocumentModel = getModel('document');
143 143
 		$oDocument = $oDocumentModel->getDocument($document_srl);
144
-		if(!$oDocument->isExists()) return new BaseObject();
144
+		if (!$oDocument->isExists()) return new BaseObject();
145 145
 		// Get the point module information
146 146
 		$oModuleModel = getModel('module');
147 147
 		$config = $oModuleModel->getModuleConfig('point');
148
-		$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
148
+		$module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl'));
149 149
 		// The process related to clearing the post comments
150 150
 		$comment_point = $module_config['insert_comment'];
151
-		if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
151
+		if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
152 152
 		// If there are comment points, attempt to deduct
153
-		if($comment_point>0) return new BaseObject();
153
+		if ($comment_point > 0) return new BaseObject();
154 154
 		// Get all the comments related to this post
155 155
 		$cp_args = new stdClass();
156 156
 		$cp_args->document_srl = $document_srl;
157 157
 		$output = executeQueryArray('point.getCommentUsers', $cp_args);
158 158
 		// Return if there is no object
159
-		if(!$output->data) return new BaseObject();
159
+		if (!$output->data) return new BaseObject();
160 160
 		// Organize the member number
161 161
 		$member_srls = array();
162 162
 		$cnt = count($output->data);
163
-		for($i=0;$i<$cnt;$i++)
163
+		for ($i = 0; $i < $cnt; $i++)
164 164
 		{
165
-			if($output->data[$i]->member_srl<1) continue;
165
+			if ($output->data[$i]->member_srl < 1) continue;
166 166
 			$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
167 167
 		}
168 168
 		// Remove the member number who has written the original post
169
-		if($member_srl) unset($member_srls[abs($member_srl)]);
170
-		if(!count($member_srls)) return new BaseObject();
169
+		if ($member_srl) unset($member_srls[abs($member_srl)]);
170
+		if (!count($member_srls)) return new BaseObject();
171 171
 		// Remove all the points for each member
172 172
 		$oPointModel = getModel('point');
173 173
 		// Get the points
174 174
 		$point = $module_config['download_file'];
175
-		foreach($member_srls as $member_srl => $cnt)
175
+		foreach ($member_srls as $member_srl => $cnt)
176 176
 		{
177 177
 			$cur_point = $oPointModel->getPoint($member_srl, true);
178 178
 			$cur_point -= $cnt * $comment_point;
179
-			$this->setPoint($member_srl,$cur_point);
179
+			$this->setPoint($member_srl, $cur_point);
180 180
 		}
181 181
 
182 182
 		return new BaseObject();
@@ -189,15 +189,15 @@  discard block
 block discarded – undo
189 189
 	{
190 190
 		$oDocumentModel = getModel('document');
191 191
 
192
-		if($obj->status != $oDocumentModel->getConfigStatus('temp'))
192
+		if ($obj->status != $oDocumentModel->getConfigStatus('temp'))
193 193
 		{
194 194
 			$module_srl = $obj->module_srl;
195 195
 			$member_srl = $obj->member_srl;
196 196
 			// The process related to clearing the post object
197
-			if(!$module_srl || !$member_srl) return new BaseObject();
197
+			if (!$module_srl || !$member_srl) return new BaseObject();
198 198
 			// Run only when logged in
199 199
 			$logged_info = Context::get('logged_info');
200
-			if(!$logged_info->member_srl) return new BaseObject();
200
+			if (!$logged_info->member_srl) return new BaseObject();
201 201
 			// Get the points of the member
202 202
 			$oPointModel = getModel('point');
203 203
 			$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
 			$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
208 208
 
209 209
 			$point = $module_config['insert_document'];
210
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
210
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
211 211
 			// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
212
-			if($point < 0) return new BaseObject();
212
+			if ($point < 0) return new BaseObject();
213 213
 			$cur_point -= $point;
214 214
 			// Increase the point
215
-			$this->setPoint($member_srl,$cur_point);
215
+			$this->setPoint($member_srl, $cur_point);
216 216
 		}
217 217
 
218 218
 		return new BaseObject();
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 	{
226 226
 		$module_srl = $obj->module_srl;
227 227
 		$member_srl = $obj->member_srl;
228
-		if(!$module_srl || !$member_srl) return new BaseObject();
228
+		if (!$module_srl || !$member_srl) return new BaseObject();
229 229
 		// Do not increase the points if the member is the author of the post
230 230
 		$document_srl = $obj->document_srl;
231 231
 		$oDocumentModel = getModel('document');
232 232
 		$oDocument = $oDocumentModel->getDocument($document_srl);
233
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject();
233
+		if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new BaseObject();
234 234
 		// Get the point module information
235 235
 		$oModuleModel = getModel('module');
236 236
 		$config = $oModuleModel->getModuleConfig('point');
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 		$cur_point = $oPointModel->getPoint($member_srl, true);
241 241
 
242 242
 		$point = $module_config['insert_comment'];
243
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
243
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
244 244
 		// Increase the point
245 245
 		$cur_point += $point;
246
-		$this->setPoint($member_srl,$cur_point);
246
+		$this->setPoint($member_srl, $cur_point);
247 247
 
248 248
 		return new BaseObject();
249 249
 	}
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 		$module_srl = $obj->module_srl;
261 261
 		$member_srl = abs($obj->member_srl);
262 262
 		$document_srl = $obj->document_srl;
263
-		if(!$module_srl || !$member_srl) return new BaseObject();
263
+		if (!$module_srl || !$member_srl) return new BaseObject();
264 264
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
265 265
 		$oDocument = $oDocumentModel->getDocument($document_srl);
266
-		if(!$oDocument->isExists()) return new BaseObject();
267
-		if($oDocument->get('member_srl')==$member_srl) return new BaseObject();
266
+		if (!$oDocument->isExists()) return new BaseObject();
267
+		if ($oDocument->get('member_srl') == $member_srl) return new BaseObject();
268 268
 		// Get the point module information
269 269
 		$config = $oModuleModel->getModuleConfig('point');
270 270
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 		$cur_point = $oPointModel->getPoint($member_srl, true);
273 273
 
274 274
 		$point = $module_config['insert_comment'];
275
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
275
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
276 276
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
277
-		if($point < 0) return new BaseObject();
277
+		if ($point < 0) return new BaseObject();
278 278
 		// Increase the point
279 279
 		$cur_point -= $point;
280
-		$this->setPoint($member_srl,$cur_point);
280
+		$this->setPoint($member_srl, $cur_point);
281 281
 
282 282
 		return new BaseObject();
283 283
 	}
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	function triggerDeleteFile(&$obj)
299 299
 	{
300
-		if($obj->isvalid != 'Y') return new BaseObject();
300
+		if ($obj->isvalid != 'Y') return new BaseObject();
301 301
 
302 302
 		$module_srl = $obj->module_srl;
303 303
 		$member_srl = $obj->member_srl;
304
-		if(!$module_srl || !$member_srl) return new BaseObject();
304
+		if (!$module_srl || !$member_srl) return new BaseObject();
305 305
 		// Get the point module information
306 306
 		$oModuleModel = getModel('module');
307 307
 		$config = $oModuleModel->getModuleConfig('point');
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 		$cur_point = $oPointModel->getPoint($member_srl, true);
312 312
 
313 313
 		$point = $module_config['upload_file'];
314
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
314
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
315 315
 		// Increase the point
316 316
 		$cur_point -= $point;
317
-		$this->setPoint($member_srl,$cur_point);
317
+		$this->setPoint($member_srl, $cur_point);
318 318
 
319 319
 		return new BaseObject();
320 320
 	}
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 		$logged_info = Context::get('logged_info');
328 328
 		$member_srl = $logged_info->member_srl;
329 329
 		$module_srl = $obj->module_srl;
330
-		if(!$module_srl) return new BaseObject();
330
+		if (!$module_srl) return new BaseObject();
331 331
 
332 332
 		// Pass if it is your file
333
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject();
333
+		if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject();
334 334
 		$oModuleModel = getModel('module');
335 335
 		$config = $oModuleModel->getModuleConfig('point');
336 336
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 		}
345 345
 
346 346
 		// If the user is not logged in and download requires points, deny access.
347
-		if(!Context::get('is_logged'))
347
+		if (!Context::get('is_logged'))
348 348
 		{
349
-			if($config->disable_download == 'Y' && $point)
349
+			if ($config->disable_download == 'Y' && $point)
350 350
 			{
351
-				return new BaseObject(-1,'msg_not_permitted_download');
351
+				return new BaseObject(-1, 'msg_not_permitted_download');
352 352
 			}
353 353
 			else
354 354
 			{
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		// If the member does not have enough points, deny access.
364 364
 		if ($config->disable_download == 'Y' && $cur_point + $point < 0)
365 365
 		{
366
-			return new BaseObject(-1,'msg_cannot_download');
366
+			return new BaseObject(-1, 'msg_cannot_download');
367 367
 		}
368 368
 
369 369
 		// Otherwise, points will be adjusted after downloading (triggerDownloadFile).
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
 	{
378 378
 		// Run only when logged in
379 379
 		$logged_info = Context::get('logged_info');
380
-		if(!$logged_info->member_srl) return new BaseObject();
380
+		if (!$logged_info->member_srl) return new BaseObject();
381 381
 		$module_srl = $obj->module_srl;
382 382
 		$member_srl = $logged_info->member_srl;
383
-		if(!$module_srl) return new BaseObject();
383
+		if (!$module_srl) return new BaseObject();
384 384
 
385 385
 		// Pass if it is your file
386
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject();
386
+		if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject();
387 387
 
388 388
 		// Get the point module information
389 389
 		$oModuleModel = getModel('module');
@@ -424,22 +424,22 @@  discard block
 block discarded – undo
424 424
 		// Get the original author number
425 425
 		$target_member_srl = abs($obj->get('member_srl'));
426 426
 		// Pass without increasing the hits if the viewer is the same as the author
427
-		if($target_member_srl == $member_srl) return new BaseObject();
427
+		if ($target_member_srl == $member_srl) return new BaseObject();
428 428
 		// Get the point information for each module
429 429
 		$config = $oModuleModel->getModuleConfig('point');
430 430
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
431 431
 		// Get hits points
432 432
 		$point = $module_config['read_document'];
433
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
433
+		if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
434 434
 		// Pass if there are no requested points
435
-		if(!$point) return new BaseObject();
435
+		if (!$point) return new BaseObject();
436 436
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
437
-		if($member_srl)
437
+		if ($member_srl)
438 438
 		{
439 439
 			$args->member_srl = $member_srl;
440 440
 			$args->document_srl = $obj->document_srl;
441 441
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
442
-			if($output->data->count) return new BaseObject();
442
+			if ($output->data->count) return new BaseObject();
443 443
 			$cur_point = $oPointModel->getPoint($member_srl, true);
444 444
 		}
445 445
 		else
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 		$config = $oModuleModel->getModuleConfig('point');
451 451
 		// When the requested points are negative, compared it with the current point
452 452
 		$_SESSION['banned_document'][$obj->document_srl] = false;
453
-		if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point)
453
+		if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point)
454 454
 		{
455 455
 			$message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point);
456 456
 			$obj->add('content', $message);
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
 			return new BaseObject(-1, $message);
459 459
 		}
460 460
 		// If not logged in, pass
461
-		if(!$logged_info->member_srl) return new BaseObject();
461
+		if (!$logged_info->member_srl) return new BaseObject();
462 462
 		// Pass, if there are no requested points
463
-		if(!$point) return new BaseObject();
463
+		if (!$point) return new BaseObject();
464 464
 		// If the read record is missing, leave it
465 465
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
466 466
 		// Increase the point
467 467
 		$cur_point += $point;
468
-		$this->setPoint($member_srl,$cur_point);
468
+		$this->setPoint($member_srl, $cur_point);
469 469
 
470 470
 		return new BaseObject();
471 471
 	}
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	{
478 478
 		$module_srl = $obj->module_srl;
479 479
 		$member_srl = $obj->member_srl;
480
-		if(!$module_srl || !$member_srl) return new BaseObject();
480
+		if (!$module_srl || !$member_srl) return new BaseObject();
481 481
 
482 482
 		$oModuleModel = getModel('module');
483 483
 		$config = $oModuleModel->getModuleConfig('point');
@@ -486,21 +486,21 @@  discard block
 block discarded – undo
486 486
 		$oPointModel = getModel('point');
487 487
 		$cur_point = $oPointModel->getPoint($member_srl, true);
488 488
 
489
-		if( $obj->point > 0 )
489
+		if ($obj->point > 0)
490 490
 		{
491 491
 			$point = $module_config['voted'];
492
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
492
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->voted;
493 493
 		}
494 494
 		else
495 495
 		{
496 496
 			$point = $module_config['blamed'];
497
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
497
+			if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
498 498
 		}
499 499
 
500
-		if(!$point) return new BaseObject();
500
+		if (!$point) return new BaseObject();
501 501
 		// Increase the point
502 502
 		$cur_point += $point;
503
-		$this->setPoint($member_srl,$cur_point);
503
+		$this->setPoint($member_srl, $cur_point);
504 504
 
505 505
 		return new BaseObject();
506 506
 	}
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	{
513 513
 		$member_srl = abs($member_srl);
514 514
 		$mode_arr = array('add', 'minus', 'update', 'signup');
515
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
515
+		if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update';
516 516
 
517 517
 		// Get configuration information
518 518
 		$oMemberModel = getModel('member');
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		$args->member_srl = $member_srl;
530 530
 		$args->point = $current_point;
531 531
 
532
-		switch($mode)
532
+		switch ($mode)
533 533
 		{
534 534
 			case 'add' :
535 535
 				$args->point += $point;
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 				$args->point = $point;
543 543
 				break;
544 544
 		}
545
-		if($args->point < 0) $args->point = 0;
545
+		if ($args->point < 0) $args->point = 0;
546 546
 		$point = $args->point;
547 547
 
548 548
 		// Call a trigger (before)
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 		$trigger_obj->current_level = $current_level;
554 554
 		$trigger_obj->set_point = $point;
555 555
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj);
556
-		if(!$trigger_output->toBool())
556
+		if (!$trigger_output->toBool())
557 557
 		{
558 558
 			return $trigger_output;
559 559
 		}
@@ -564,19 +564,19 @@  discard block
 block discarded – undo
564 564
 
565 565
 		// If there are points, update, if no, insert
566 566
 		$oPointModel = getModel('point');
567
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
567
+		if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
568 568
 		else executeQuery("point.insertPoint", $args);
569 569
 
570 570
 		// Get a new level
571 571
 		$level = $oPointModel->getLevel($point, $config->level_step);
572 572
 
573 573
 		// If existing level and a new one are different attempt to set a point group
574
-		if($level != $current_level)
574
+		if ($level != $current_level)
575 575
 		{
576 576
 			// Check if the level, for which the current points are prepared, is calculate and set the correct group
577 577
 			$point_group = $config->point_group;
578 578
 			// If the point group exists
579
-			if($point_group && is_array($point_group) && count($point_group) )
579
+			if ($point_group && is_array($point_group) && count($point_group))
580 580
 			{
581 581
 				// Get the default group
582 582
 				$default_group = $oMemberModel->getDefaultGroup();
@@ -586,29 +586,29 @@  discard block
 block discarded – undo
586 586
 
587 587
 				asort($point_group);
588 588
 				// Reset group after initialization
589
-				if($config->group_reset != 'N')
589
+				if ($config->group_reset != 'N')
590 590
 				{
591 591
 					// If the new level is in the right group
592
-					if(in_array($level, $point_group))
592
+					if (in_array($level, $point_group))
593 593
 					{
594 594
 						// Delete all groups except the one which the current level belongs to
595
-						foreach($point_group as $group_srl => $target_level)
595
+						foreach ($point_group as $group_srl => $target_level)
596 596
 						{
597 597
 							$del_group_list[] = $group_srl;
598
-							if($target_level == $level) $new_group_list[] = $group_srl;
598
+							if ($target_level == $level) $new_group_list[] = $group_srl;
599 599
 						}
600 600
 					}
601 601
 					// Otherwise, in case the level is reduced, add the recent group
602 602
 					else
603 603
 					{
604 604
 						$i = $level;
605
-						while($i > 0)
605
+						while ($i > 0)
606 606
 						{
607
-							if(in_array($i, $point_group))
607
+							if (in_array($i, $point_group))
608 608
 							{
609
-								foreach($point_group as $group_srl => $target_level)
609
+								foreach ($point_group as $group_srl => $target_level)
610 610
 								{
611
-									if($target_level == $i)
611
+									if ($target_level == $i)
612 612
 									{
613 613
 										$new_group_list[] = $group_srl;
614 614
 									}
@@ -619,9 +619,9 @@  discard block
 block discarded – undo
619 619
 						}
620 620
 					}
621 621
 					// Delete the group of a level which is higher than the current level
622
-					foreach($point_group as $group_srl => $target_level)
622
+					foreach ($point_group as $group_srl => $target_level)
623 623
 					{
624
-						if($target_level > $level) $del_group_list[] = $group_srl;
624
+						if ($target_level > $level) $del_group_list[] = $group_srl;
625 625
 					}
626 626
 					$del_group_list[] = $default_group->group_srl;
627 627
 				}
@@ -629,16 +629,16 @@  discard block
 block discarded – undo
629 629
 				else
630 630
 				{
631 631
 					// Check until the current level by rotating setting the configurations of the point groups
632
-					foreach($point_group as $group_srl => $target_level)
632
+					foreach ($point_group as $group_srl => $target_level)
633 633
 					{
634 634
 						$del_group_list[] = $group_srl;
635
-						if($target_level <= $level) $new_group_list[] = $group_srl;
635
+						if ($target_level <= $level) $new_group_list[] = $group_srl;
636 636
 					}
637 637
 				}
638 638
 				// If there is no a new group, granted the default group
639
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
639
+				if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
640 640
 				// Remove linkage group
641
-				if($del_group_list && count($del_group_list))
641
+				if ($del_group_list && count($del_group_list))
642 642
 				{
643 643
 					$del_group_args = new stdClass;
644 644
 					$del_group_args->member_srl = $member_srl;
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 					$del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args);
647 647
 				}
648 648
 				// Grant a new group
649
-				foreach($new_group_list as $group_srl)
649
+				foreach ($new_group_list as $group_srl)
650 650
 				{
651 651
 					$new_group_args = new stdClass;
652 652
 					$new_group_args->member_srl = $member_srl;
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 		$trigger_obj->del_group_list = $del_group_list;
662 662
 		$trigger_obj->new_level = $level;
663 663
 		$trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj);
664
-		if(!$trigger_output->toBool())
664
+		if (!$trigger_output->toBool())
665 665
 		{
666 666
 			$oDB->rollback();
667 667
 			return $trigger_output;
@@ -677,17 +677,17 @@  discard block
 block discarded – undo
677 677
 		FileHandler::writeFile($cache_filename, $point);
678 678
 
679 679
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
680
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
680
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
681 681
 		{
682
-			$object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0';
682
+			$object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0';
683 683
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
684 684
 			$oCacheHandler->delete($cache_key);
685 685
 		}
686 686
 
687 687
 		$oCacheHandler = CacheHandler::getInstance('object');
688
-		if($new_group_list && $del_group_list && $oCacheHandler->isSupport())
688
+		if ($new_group_list && $del_group_list && $oCacheHandler->isSupport())
689 689
 		{
690
-			$object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl;
690
+			$object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl;
691 691
 			$cache_key = $oCacheHandler->getGroupKey('member', $object_key);
692 692
 			$oCacheHandler->delete($cache_key);
693 693
 		}
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
 		$pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl);
702 702
 
703 703
 		$oModuleController = getController('module');
704
-		if(is_array($obj->moduleSrlList))
704
+		if (is_array($obj->moduleSrlList))
705 705
 		{
706
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
706
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
707 707
 			{
708 708
 				$oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig);
709 709
 			}
Please login to merge, or discard this patch.
Braces   +169 added lines, -65 removed lines patch added patch discarded remove patch
@@ -42,9 +42,13 @@  discard block
 block discarded – undo
42 42
 	function triggerAfterLogin(&$obj)
43 43
 	{
44 44
 		$member_srl = $obj->member_srl;
45
-		if(!$member_srl) return new BaseObject();
45
+		if(!$member_srl) {
46
+			return new BaseObject();
47
+		}
46 48
 		// If the last login is not today, give the points
47
-		if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject();
49
+		if(substr($obj->last_login,0,8)==date("Ymd")) {
50
+			return new BaseObject();
51
+		}
48 52
 		// Get the point module information
49 53
 		$oModuleModel = getModel('module');
50 54
 		$config = $oModuleModel->getModuleConfig('point');
@@ -70,9 +74,13 @@  discard block
 block discarded – undo
70 74
 		{
71 75
 			$module_srl = $obj->module_srl;
72 76
 			$member_srl = $obj->member_srl;
73
-			if(!$module_srl || !$member_srl) return new BaseObject();
77
+			if(!$module_srl || !$member_srl) {
78
+				return new BaseObject();
79
+			}
74 80
 			// The fix to disable giving points for saving the document temporarily
75
-			if($module_srl == $member_srl) return new BaseObject();
81
+			if($module_srl == $member_srl) {
82
+				return new BaseObject();
83
+			}
76 84
 			// Get the point module information
77 85
 			$oModuleModel = getModel('module');
78 86
 			$config = $oModuleModel->getModuleConfig('point');
@@ -82,12 +90,18 @@  discard block
 block discarded – undo
82 90
 			$cur_point = $oPointModel->getPoint($member_srl, true);
83 91
 
84 92
 			$point = $module_config['insert_document'];
85
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
93
+			if(strlen($point) == 0 && !is_int($point)) {
94
+				$point = $config->insert_document;
95
+			}
86 96
 			$cur_point += $point;
87 97
 			// Add points for attaching a file
88 98
 			$point = $module_config['upload_file'];
89
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
90
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
99
+			if(strlen($point) == 0 && !is_int($point)) {
100
+				$point = $config->upload_file;
101
+			}
102
+			if($obj->uploaded_count) {
103
+				$cur_point += $point * $obj->uploaded_count;
104
+			}
91 105
 			// Increase the point
92 106
 			$this->setPoint($member_srl,$cur_point);
93 107
 		}
@@ -118,12 +132,18 @@  discard block
 block discarded – undo
118 132
 			$cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true);
119 133
 
120 134
 			$point = $module_config['insert_document'];
121
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
135
+			if(strlen($point) == 0 && !is_int($point)) {
136
+				$point = $config->insert_document;
137
+			}
122 138
 			$cur_point += $point;
123 139
 			// Add points for attaching a file
124 140
 			$point = $module_config['upload_file'];
125
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
126
-			if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count;
141
+			if(strlen($point) == 0 && !is_int($point)) {
142
+				$point = $config->upload_file;
143
+			}
144
+			if($obj->uploaded_count) {
145
+				$cur_point += $point * $obj->uploaded_count;
146
+			}
127 147
 			// Increase the point
128 148
 			$this->setPoint($oDocument->get('member_srl'), $cur_point);
129 149
 		}
@@ -141,33 +161,47 @@  discard block
 block discarded – undo
141 161
 
142 162
 		$oDocumentModel = getModel('document');
143 163
 		$oDocument = $oDocumentModel->getDocument($document_srl);
144
-		if(!$oDocument->isExists()) return new BaseObject();
164
+		if(!$oDocument->isExists()) {
165
+			return new BaseObject();
166
+		}
145 167
 		// Get the point module information
146 168
 		$oModuleModel = getModel('module');
147 169
 		$config = $oModuleModel->getModuleConfig('point');
148 170
 		$module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl'));
149 171
 		// The process related to clearing the post comments
150 172
 		$comment_point = $module_config['insert_comment'];
151
-		if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment;
173
+		if(strlen($comment_point) == 0 && !is_int($comment_point)) {
174
+			$comment_point = $config->insert_comment;
175
+		}
152 176
 		// If there are comment points, attempt to deduct
153
-		if($comment_point>0) return new BaseObject();
177
+		if($comment_point>0) {
178
+			return new BaseObject();
179
+		}
154 180
 		// Get all the comments related to this post
155 181
 		$cp_args = new stdClass();
156 182
 		$cp_args->document_srl = $document_srl;
157 183
 		$output = executeQueryArray('point.getCommentUsers', $cp_args);
158 184
 		// Return if there is no object
159
-		if(!$output->data) return new BaseObject();
185
+		if(!$output->data) {
186
+			return new BaseObject();
187
+		}
160 188
 		// Organize the member number
161 189
 		$member_srls = array();
162 190
 		$cnt = count($output->data);
163 191
 		for($i=0;$i<$cnt;$i++)
164 192
 		{
165
-			if($output->data[$i]->member_srl<1) continue;
193
+			if($output->data[$i]->member_srl<1) {
194
+				continue;
195
+			}
166 196
 			$member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count;
167 197
 		}
168 198
 		// Remove the member number who has written the original post
169
-		if($member_srl) unset($member_srls[abs($member_srl)]);
170
-		if(!count($member_srls)) return new BaseObject();
199
+		if($member_srl) {
200
+			unset($member_srls[abs($member_srl)]);
201
+		}
202
+		if(!count($member_srls)) {
203
+			return new BaseObject();
204
+		}
171 205
 		// Remove all the points for each member
172 206
 		$oPointModel = getModel('point');
173 207
 		// Get the points
@@ -194,10 +228,14 @@  discard block
 block discarded – undo
194 228
 			$module_srl = $obj->module_srl;
195 229
 			$member_srl = $obj->member_srl;
196 230
 			// The process related to clearing the post object
197
-			if(!$module_srl || !$member_srl) return new BaseObject();
231
+			if(!$module_srl || !$member_srl) {
232
+				return new BaseObject();
233
+			}
198 234
 			// Run only when logged in
199 235
 			$logged_info = Context::get('logged_info');
200
-			if(!$logged_info->member_srl) return new BaseObject();
236
+			if(!$logged_info->member_srl) {
237
+				return new BaseObject();
238
+			}
201 239
 			// Get the points of the member
202 240
 			$oPointModel = getModel('point');
203 241
 			$cur_point = $oPointModel->getPoint($member_srl, true);
@@ -207,9 +245,13 @@  discard block
 block discarded – undo
207 245
 			$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
208 246
 
209 247
 			$point = $module_config['insert_document'];
210
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document;
248
+			if(strlen($point) == 0 && !is_int($point)) {
249
+				$point = $config->insert_document;
250
+			}
211 251
 			// if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article
212
-			if($point < 0) return new BaseObject();
252
+			if($point < 0) {
253
+				return new BaseObject();
254
+			}
213 255
 			$cur_point -= $point;
214 256
 			// Increase the point
215 257
 			$this->setPoint($member_srl,$cur_point);
@@ -225,12 +267,16 @@  discard block
 block discarded – undo
225 267
 	{
226 268
 		$module_srl = $obj->module_srl;
227 269
 		$member_srl = $obj->member_srl;
228
-		if(!$module_srl || !$member_srl) return new BaseObject();
270
+		if(!$module_srl || !$member_srl) {
271
+			return new BaseObject();
272
+		}
229 273
 		// Do not increase the points if the member is the author of the post
230 274
 		$document_srl = $obj->document_srl;
231 275
 		$oDocumentModel = getModel('document');
232 276
 		$oDocument = $oDocumentModel->getDocument($document_srl);
233
-		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject();
277
+		if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) {
278
+			return new BaseObject();
279
+		}
234 280
 		// Get the point module information
235 281
 		$oModuleModel = getModel('module');
236 282
 		$config = $oModuleModel->getModuleConfig('point');
@@ -240,7 +286,9 @@  discard block
 block discarded – undo
240 286
 		$cur_point = $oPointModel->getPoint($member_srl, true);
241 287
 
242 288
 		$point = $module_config['insert_comment'];
243
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
289
+		if(strlen($point) == 0 && !is_int($point)) {
290
+			$point = $config->insert_comment;
291
+		}
244 292
 		// Increase the point
245 293
 		$cur_point += $point;
246 294
 		$this->setPoint($member_srl,$cur_point);
@@ -260,11 +308,17 @@  discard block
 block discarded – undo
260 308
 		$module_srl = $obj->module_srl;
261 309
 		$member_srl = abs($obj->member_srl);
262 310
 		$document_srl = $obj->document_srl;
263
-		if(!$module_srl || !$member_srl) return new BaseObject();
311
+		if(!$module_srl || !$member_srl) {
312
+			return new BaseObject();
313
+		}
264 314
 		// Get the original article (if the original article is missing or if the member is its author, do not apply the points)
265 315
 		$oDocument = $oDocumentModel->getDocument($document_srl);
266
-		if(!$oDocument->isExists()) return new BaseObject();
267
-		if($oDocument->get('member_srl')==$member_srl) return new BaseObject();
316
+		if(!$oDocument->isExists()) {
317
+			return new BaseObject();
318
+		}
319
+		if($oDocument->get('member_srl')==$member_srl) {
320
+			return new BaseObject();
321
+		}
268 322
 		// Get the point module information
269 323
 		$config = $oModuleModel->getModuleConfig('point');
270 324
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
@@ -272,9 +326,13 @@  discard block
 block discarded – undo
272 326
 		$cur_point = $oPointModel->getPoint($member_srl, true);
273 327
 
274 328
 		$point = $module_config['insert_comment'];
275
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment;
329
+		if(strlen($point) == 0 && !is_int($point)) {
330
+			$point = $config->insert_comment;
331
+		}
276 332
 		// if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment
277
-		if($point < 0) return new BaseObject();
333
+		if($point < 0) {
334
+			return new BaseObject();
335
+		}
278 336
 		// Increase the point
279 337
 		$cur_point -= $point;
280 338
 		$this->setPoint($member_srl,$cur_point);
@@ -297,11 +355,15 @@  discard block
 block discarded – undo
297 355
 	 */
298 356
 	function triggerDeleteFile(&$obj)
299 357
 	{
300
-		if($obj->isvalid != 'Y') return new BaseObject();
358
+		if($obj->isvalid != 'Y') {
359
+			return new BaseObject();
360
+		}
301 361
 
302 362
 		$module_srl = $obj->module_srl;
303 363
 		$member_srl = $obj->member_srl;
304
-		if(!$module_srl || !$member_srl) return new BaseObject();
364
+		if(!$module_srl || !$member_srl) {
365
+			return new BaseObject();
366
+		}
305 367
 		// Get the point module information
306 368
 		$oModuleModel = getModel('module');
307 369
 		$config = $oModuleModel->getModuleConfig('point');
@@ -311,7 +373,9 @@  discard block
 block discarded – undo
311 373
 		$cur_point = $oPointModel->getPoint($member_srl, true);
312 374
 
313 375
 		$point = $module_config['upload_file'];
314
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file;
376
+		if(strlen($point) == 0 && !is_int($point)) {
377
+			$point = $config->upload_file;
378
+		}
315 379
 		// Increase the point
316 380
 		$cur_point -= $point;
317 381
 		$this->setPoint($member_srl,$cur_point);
@@ -327,18 +391,21 @@  discard block
 block discarded – undo
327 391
 		$logged_info = Context::get('logged_info');
328 392
 		$member_srl = $logged_info->member_srl;
329 393
 		$module_srl = $obj->module_srl;
330
-		if(!$module_srl) return new BaseObject();
394
+		if(!$module_srl) {
395
+			return new BaseObject();
396
+		}
331 397
 
332 398
 		// Pass if it is your file
333
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject();
399
+		if($member_srl && abs($obj->member_srl) == $member_srl) {
400
+			return new BaseObject();
401
+		}
334 402
 		$oModuleModel = getModel('module');
335 403
 		$config = $oModuleModel->getModuleConfig('point');
336 404
 		$module_config = $oModuleModel->getModulePartConfig('point', $module_srl);
337 405
 		if (isset($module_config['download_file']))
338 406
 		{
339 407
 			$point = intval($module_config['download_file']);
340
-		}
341
-		else
408
+		} else
342 409
 		{
343 410
 			$point = intval($config->download_file);
344 411
 		}
@@ -349,8 +416,7 @@  discard block
 block discarded – undo
349 416
 			if($config->disable_download == 'Y' && $point)
350 417
 			{
351 418
 				return new BaseObject(-1,'msg_not_permitted_download');
352
-			}
353
-			else
419
+			} else
354 420
 			{
355 421
 				return new BaseObject();
356 422
 			}
@@ -377,13 +443,19 @@  discard block
 block discarded – undo
377 443
 	{
378 444
 		// Run only when logged in
379 445
 		$logged_info = Context::get('logged_info');
380
-		if(!$logged_info->member_srl) return new BaseObject();
446
+		if(!$logged_info->member_srl) {
447
+			return new BaseObject();
448
+		}
381 449
 		$module_srl = $obj->module_srl;
382 450
 		$member_srl = $logged_info->member_srl;
383
-		if(!$module_srl) return new BaseObject();
451
+		if(!$module_srl) {
452
+			return new BaseObject();
453
+		}
384 454
 
385 455
 		// Pass if it is your file
386
-		if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject();
456
+		if($member_srl && abs($obj->member_srl) == $member_srl) {
457
+			return new BaseObject();
458
+		}
387 459
 
388 460
 		// Get the point module information
389 461
 		$oModuleModel = getModel('module');
@@ -392,8 +464,7 @@  discard block
 block discarded – undo
392 464
 		if (isset($module_config['download_file']))
393 465
 		{
394 466
 			$point = intval($module_config['download_file']);
395
-		}
396
-		else
467
+		} else
397 468
 		{
398 469
 			$point = intval($config->download_file);
399 470
 		}
@@ -424,25 +495,32 @@  discard block
 block discarded – undo
424 495
 		// Get the original author number
425 496
 		$target_member_srl = abs($obj->get('member_srl'));
426 497
 		// Pass without increasing the hits if the viewer is the same as the author
427
-		if($target_member_srl == $member_srl) return new BaseObject();
498
+		if($target_member_srl == $member_srl) {
499
+			return new BaseObject();
500
+		}
428 501
 		// Get the point information for each module
429 502
 		$config = $oModuleModel->getModuleConfig('point');
430 503
 		$module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl'));
431 504
 		// Get hits points
432 505
 		$point = $module_config['read_document'];
433
-		if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document;
506
+		if(strlen($point) == 0 && !is_int($point)) {
507
+			$point = $config->read_document;
508
+		}
434 509
 		// Pass if there are no requested points
435
-		if(!$point) return new BaseObject();
510
+		if(!$point) {
511
+			return new BaseObject();
512
+		}
436 513
 		// In case of a registered member, if it is read but cannot just pass, then get the current points
437 514
 		if($member_srl)
438 515
 		{
439 516
 			$args->member_srl = $member_srl;
440 517
 			$args->document_srl = $obj->document_srl;
441 518
 			$output = executeQuery('document.getDocumentReadedLogInfo', $args);
442
-			if($output->data->count) return new BaseObject();
519
+			if($output->data->count) {
520
+				return new BaseObject();
521
+			}
443 522
 			$cur_point = $oPointModel->getPoint($member_srl, true);
444
-		}
445
-		else
523
+		} else
446 524
 		{
447 525
 			$cur_point = 0;
448 526
 		}
@@ -458,9 +536,13 @@  discard block
 block discarded – undo
458 536
 			return new BaseObject(-1, $message);
459 537
 		}
460 538
 		// If not logged in, pass
461
-		if(!$logged_info->member_srl) return new BaseObject();
539
+		if(!$logged_info->member_srl) {
540
+			return new BaseObject();
541
+		}
462 542
 		// Pass, if there are no requested points
463
-		if(!$point) return new BaseObject();
543
+		if(!$point) {
544
+			return new BaseObject();
545
+		}
464 546
 		// If the read record is missing, leave it
465 547
 		$output = executeQuery('document.insertDocumentReadedLog', $args);
466 548
 		// Increase the point
@@ -477,7 +559,9 @@  discard block
 block discarded – undo
477 559
 	{
478 560
 		$module_srl = $obj->module_srl;
479 561
 		$member_srl = $obj->member_srl;
480
-		if(!$module_srl || !$member_srl) return new BaseObject();
562
+		if(!$module_srl || !$member_srl) {
563
+			return new BaseObject();
564
+		}
481 565
 
482 566
 		$oModuleModel = getModel('module');
483 567
 		$config = $oModuleModel->getModuleConfig('point');
@@ -489,15 +573,20 @@  discard block
 block discarded – undo
489 573
 		if( $obj->point > 0 )
490 574
 		{
491 575
 			$point = $module_config['voted'];
492
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->voted;
493
-		}
494
-		else
576
+			if(strlen($point) == 0 && !is_int($point)) {
577
+				$point = $config->voted;
578
+			}
579
+		} else
495 580
 		{
496 581
 			$point = $module_config['blamed'];
497
-			if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed;
582
+			if(strlen($point) == 0 && !is_int($point)) {
583
+				$point = $config->blamed;
584
+			}
498 585
 		}
499 586
 
500
-		if(!$point) return new BaseObject();
587
+		if(!$point) {
588
+			return new BaseObject();
589
+		}
501 590
 		// Increase the point
502 591
 		$cur_point += $point;
503 592
 		$this->setPoint($member_srl,$cur_point);
@@ -512,7 +601,9 @@  discard block
 block discarded – undo
512 601
 	{
513 602
 		$member_srl = abs($member_srl);
514 603
 		$mode_arr = array('add', 'minus', 'update', 'signup');
515
-		if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update';
604
+		if(!$mode || !in_array($mode,$mode_arr)) {
605
+			$mode = 'update';
606
+		}
516 607
 
517 608
 		// Get configuration information
518 609
 		$oMemberModel = getModel('member');
@@ -542,7 +633,9 @@  discard block
 block discarded – undo
542 633
 				$args->point = $point;
543 634
 				break;
544 635
 		}
545
-		if($args->point < 0) $args->point = 0;
636
+		if($args->point < 0) {
637
+			$args->point = 0;
638
+		}
546 639
 		$point = $args->point;
547 640
 
548 641
 		// Call a trigger (before)
@@ -564,8 +657,11 @@  discard block
 block discarded – undo
564 657
 
565 658
 		// If there are points, update, if no, insert
566 659
 		$oPointModel = getModel('point');
567
-		if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args);
568
-		else executeQuery("point.insertPoint", $args);
660
+		if($oPointModel->isExistsPoint($member_srl)) {
661
+			executeQuery("point.updatePoint", $args);
662
+		} else {
663
+			executeQuery("point.insertPoint", $args);
664
+		}
569 665
 
570 666
 		// Get a new level
571 667
 		$level = $oPointModel->getLevel($point, $config->level_step);
@@ -595,7 +691,9 @@  discard block
 block discarded – undo
595 691
 						foreach($point_group as $group_srl => $target_level)
596 692
 						{
597 693
 							$del_group_list[] = $group_srl;
598
-							if($target_level == $level) $new_group_list[] = $group_srl;
694
+							if($target_level == $level) {
695
+								$new_group_list[] = $group_srl;
696
+							}
599 697
 						}
600 698
 					}
601 699
 					// Otherwise, in case the level is reduced, add the recent group
@@ -621,7 +719,9 @@  discard block
 block discarded – undo
621 719
 					// Delete the group of a level which is higher than the current level
622 720
 					foreach($point_group as $group_srl => $target_level)
623 721
 					{
624
-						if($target_level > $level) $del_group_list[] = $group_srl;
722
+						if($target_level > $level) {
723
+							$del_group_list[] = $group_srl;
724
+						}
625 725
 					}
626 726
 					$del_group_list[] = $default_group->group_srl;
627 727
 				}
@@ -632,11 +732,15 @@  discard block
 block discarded – undo
632 732
 					foreach($point_group as $group_srl => $target_level)
633 733
 					{
634 734
 						$del_group_list[] = $group_srl;
635
-						if($target_level <= $level) $new_group_list[] = $group_srl;
735
+						if($target_level <= $level) {
736
+							$new_group_list[] = $group_srl;
737
+						}
636 738
 					}
637 739
 				}
638 740
 				// If there is no a new group, granted the default group
639
-				if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl;
741
+				if(!$new_group_list[0]) {
742
+					$new_group_list[0] = $default_group->group_srl;
743
+				}
640 744
 				// Remove linkage group
641 745
 				if($del_group_list && count($del_group_list))
642 746
 				{
Please login to merge, or discard this patch.
modules/poll/poll.admin.controller.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -85,6 +85,7 @@
 block discarded – undo
85 85
 
86 86
 	/**
87 87
 	 * @brief Delete the poll (when several questions are registered in one poll, delete this question)
88
+	 * @param string $poll_index_srl
88 89
 	 */
89 90
 	function deletePollTitle($poll_index_srl) 
90 91
 	{
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 		// Display an error no post is selected
41 41
 		$cart = Context::get('cart');
42 42
 
43
-		if(is_array($cart)) $poll_srl_list = $cart;
44
-		else $poll_srl_list= explode('|@|', $cart);
43
+		if (is_array($cart)) $poll_srl_list = $cart;
44
+		else $poll_srl_list = explode('|@|', $cart);
45 45
 
46 46
 		$poll_count = count($poll_srl_list);
47
-		if(!$poll_count) return $this->stop('msg_cart_is_null');
47
+		if (!$poll_count) return $this->stop('msg_cart_is_null');
48 48
 		// Delete the post
49
-		for($i=0;$i<$poll_count;$i++)
49
+		for ($i = 0; $i < $poll_count; $i++)
50 50
 		{
51 51
 			$poll_index_srl = trim($poll_srl_list[$i]);
52
-			if(!$poll_index_srl) continue;
52
+			if (!$poll_index_srl) continue;
53 53
 
54 54
 			$output = $this->deletePollTitle($poll_index_srl, true);
55
-			if(!$output->toBool()) return $output;
55
+			if (!$output->toBool()) return $output;
56 56
 		}
57 57
 
58
-		$this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) );
58
+		$this->setMessage(sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count));
59 59
 
60 60
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminList');
61 61
 		$this->setRedirectUrl($returnUrl);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 	function procPollAdminAddCart()
65 65
 	{
66
-		$poll_index_srl = (int)Context::get('poll_index_srl');
66
+		$poll_index_srl = (int) Context::get('poll_index_srl');
67 67
 
68 68
 		$oPollAdminModel = getAdminModel('poll');
69 69
 		//$columnList = array('comment_srl');
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 
74 74
 		$output = $oPollAdminModel->getPollList($args);
75 75
 
76
-		if(is_array($output->data))
76
+		if (is_array($output->data))
77 77
 		{
78
-			foreach($output->data AS $key=>$value)
78
+			foreach ($output->data AS $key=>$value)
79 79
 			{
80
-				if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
80
+				if ($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
81 81
 				else $_SESSION['poll_management'][$value->poll_index_srl] = true;
82 82
 			}
83 83
 		}
@@ -97,36 +97,36 @@  discard block
 block discarded – undo
97 97
 		$oDB->begin();
98 98
 
99 99
 		$output = executeQueryArray('poll.getPollByDeletePollTitle', $args);
100
-		if($output->toBool() && $output->data && $output->data[0]->count == 1)
100
+		if ($output->toBool() && $output->data && $output->data[0]->count == 1)
101 101
 		{
102 102
 			$dargs->poll_srl = $output->data[0]->poll_srl;
103 103
 		}
104 104
 
105 105
 		$output = $oDB->executeQuery('poll.deletePollTitle', $args);
106
-		if(!$output)
106
+		if (!$output)
107 107
 		{
108 108
 			$oDB->rollback();
109 109
 			return $output;
110 110
 		}
111 111
 
112 112
 		$output = $oDB->executeQuery('poll.deletePollItem', $args);
113
-		if(!$output)
113
+		if (!$output)
114 114
 		{
115 115
 			$oDB->rollback();
116 116
 			return $output;
117 117
 		}
118 118
 
119
-		if($dargs->poll_srl)
119
+		if ($dargs->poll_srl)
120 120
 		{
121 121
 			$output = executeQuery('poll.deletePoll', $dargs);
122
-			if(!$output)
122
+			if (!$output)
123 123
 			{
124 124
 				$oDB->rollback();
125 125
 				return $output;
126 126
 			}
127 127
 
128 128
 			$output = executeQuery('poll.deletePollLog', $dargs);
129
-			if(!$output)
129
+			if (!$output)
130 130
 			{
131 131
 				$oDB->rollback();
132 132
 				return $output;
@@ -149,21 +149,21 @@  discard block
 block discarded – undo
149 149
 		$oDB->begin();
150 150
 
151 151
 		$output = $oDB->executeQuery('poll.deletePoll', $args);
152
-		if(!$output)
152
+		if (!$output)
153 153
 		{
154 154
 			$oDB->rollback();
155 155
 			return $output;
156 156
 		}
157 157
 
158 158
 		$output = $oDB->executeQuery('poll.deletePollTitle', $args);
159
-		if(!$output)
159
+		if (!$output)
160 160
 		{
161 161
 			$oDB->rollback();
162 162
 			return $output;
163 163
 		}
164 164
 
165 165
 		$output = $oDB->executeQuery('poll.deletePollItem', $args);
166
-		if(!$output)
166
+		if (!$output)
167 167
 		{
168 168
 			$oDB->rollback();
169 169
 			return $output;
Please login to merge, or discard this patch.
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,19 +40,28 @@  discard block
 block discarded – undo
40 40
 		// Display an error no post is selected
41 41
 		$cart = Context::get('cart');
42 42
 
43
-		if(is_array($cart)) $poll_srl_list = $cart;
44
-		else $poll_srl_list= explode('|@|', $cart);
43
+		if(is_array($cart)) {
44
+			$poll_srl_list = $cart;
45
+		} else {
46
+			$poll_srl_list= explode('|@|', $cart);
47
+		}
45 48
 
46 49
 		$poll_count = count($poll_srl_list);
47
-		if(!$poll_count) return $this->stop('msg_cart_is_null');
50
+		if(!$poll_count) {
51
+			return $this->stop('msg_cart_is_null');
52
+		}
48 53
 		// Delete the post
49 54
 		for($i=0;$i<$poll_count;$i++)
50 55
 		{
51 56
 			$poll_index_srl = trim($poll_srl_list[$i]);
52
-			if(!$poll_index_srl) continue;
57
+			if(!$poll_index_srl) {
58
+				continue;
59
+			}
53 60
 
54 61
 			$output = $this->deletePollTitle($poll_index_srl, true);
55
-			if(!$output->toBool()) return $output;
62
+			if(!$output->toBool()) {
63
+				return $output;
64
+			}
56 65
 		}
57 66
 
58 67
 		$this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) );
@@ -77,8 +86,11 @@  discard block
 block discarded – undo
77 86
 		{
78 87
 			foreach($output->data AS $key=>$value)
79 88
 			{
80
-				if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
81
-				else $_SESSION['poll_management'][$value->poll_index_srl] = true;
89
+				if($_SESSION['poll_management'][$value->poll_index_srl]) {
90
+					unset($_SESSION['poll_management'][$value->poll_index_srl]);
91
+				} else {
92
+					$_SESSION['poll_management'][$value->poll_index_srl] = true;
93
+				}
82 94
 			}
83 95
 		}
84 96
 	}
Please login to merge, or discard this patch.