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 ( dfa9c1...93b599 )
by gyeong-won
08:26
created
classes/xml/xmlquery/tags/navigation/LimitTag.class.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	function LimitTag($index)
50 50
 	{
51
-		if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs)
51
+		if ($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs)
52 52
 		{
53
-			if(!isset($index->page->attrs->default))
53
+			if (!isset($index->page->attrs->default))
54 54
 				$index->page->attrs->default = 1;
55
-			if(!isset($index->page_count->attrs->default))
55
+			if (!isset($index->page_count->attrs->default))
56 56
 				$index->page_count->attrs->default = 10;
57 57
 			$this->page = new QueryArgument($index->page);
58 58
 			$this->page_count = new QueryArgument($index->page_count);
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 			$this->arguments[] = $this->page_count;
61 61
 		}
62 62
 
63
-		if(!isset($index->list_count->attrs->default))
63
+		if (!isset($index->list_count->attrs->default))
64 64
 			$index->list_count->attrs->default = 0;
65 65
 		$this->list_count = new QueryArgument($index->list_count);
66 66
 		$this->arguments[] = $this->list_count;
67 67
 		
68
-		if(isset($index->offset) && isset($index->offset->attrs))
68
+		if (isset($index->offset) && isset($index->offset->attrs))
69 69
 		{
70 70
 			$this->offset = new QueryArgument($index->offset);
71 71
 			$this->arguments[] = $this->offset;
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 
75 75
 	function toString()
76 76
 	{
77
-		if($this->page)
77
+		if ($this->page)
78 78
 		{
79 79
 			return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName());
80 80
 		}
81
-		elseif($this->offset)
81
+		elseif ($this->offset)
82 82
 		{
83 83
 			return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName());
84 84
 		}
Please login to merge, or discard this patch.
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,18 +50,21 @@  discard block
 block discarded – undo
50 50
 	{
51 51
 		if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs)
52 52
 		{
53
-			if(!isset($index->page->attrs->default))
54
-				$index->page->attrs->default = 1;
55
-			if(!isset($index->page_count->attrs->default))
56
-				$index->page_count->attrs->default = 10;
53
+			if(!isset($index->page->attrs->default)) {
54
+							$index->page->attrs->default = 1;
55
+			}
56
+			if(!isset($index->page_count->attrs->default)) {
57
+							$index->page_count->attrs->default = 10;
58
+			}
57 59
 			$this->page = new QueryArgument($index->page);
58 60
 			$this->page_count = new QueryArgument($index->page_count);
59 61
 			$this->arguments[] = $this->page;
60 62
 			$this->arguments[] = $this->page_count;
61 63
 		}
62 64
 
63
-		if(!isset($index->list_count->attrs->default))
64
-			$index->list_count->attrs->default = 0;
65
+		if(!isset($index->list_count->attrs->default)) {
66
+					$index->list_count->attrs->default = 0;
67
+		}
65 68
 		$this->list_count = new QueryArgument($index->list_count);
66 69
 		$this->arguments[] = $this->list_count;
67 70
 		
@@ -77,12 +80,10 @@  discard block
 block discarded – undo
77 80
 		if($this->page)
78 81
 		{
79 82
 			return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName());
80
-		}
81
-		elseif($this->offset)
83
+		} elseif($this->offset)
82 84
 		{
83 85
 			return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName());
84
-		}
85
-		else
86
+		} else
86 87
 		{
87 88
 			return sprintf('new Limit(${\'%s_argument\'})', $this->list_count->getArgumentName());
88 89
 		}
Please login to merge, or discard this patch.
classes/db/queryparts/limit/Limit.class.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	function Limit($list_count, $page = NULL, $page_count = NULL, $offset = NULL)
45 45
 	{
46 46
 		$this->list_count = $list_count;
47
-		if($page)
47
+		if ($page)
48 48
 		{
49 49
 			$list_count_value = $list_count->getValue();
50 50
 			$page_value = $page->getValue();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			$this->page_count = $page_count;
53 53
 			$this->page = $page;
54 54
 		}
55
-		elseif($offset)
55
+		elseif ($offset)
56 56
 		{
57 57
 			$this->start = $offset->getValue();
58 58
 		}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	function isPageHandler()
66 66
 	{
67
-		if($this->page)
67
+		if ($this->page)
68 68
 		{
69 69
 			return true;
70 70
 		}
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
 	function toString()
88 88
 	{
89
-		if($this->page || $this->start)
89
+		if ($this->page || $this->start)
90 90
 		{
91
-			return $this->start . ' , ' . $this->list_count->getValue();
91
+			return $this->start.' , '.$this->list_count->getValue();
92 92
 		}
93 93
 		else
94 94
 		{
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
 			$this->start = ($page_value - 1) * $list_count_value;
52 52
 			$this->page_count = $page_count;
53 53
 			$this->page = $page;
54
-		}
55
-		elseif($offset)
54
+		} elseif($offset)
56 55
 		{
57 56
 			$this->start = $offset->getValue();
58 57
 		}
@@ -67,8 +66,7 @@  discard block
 block discarded – undo
67 66
 		if($this->page)
68 67
 		{
69 68
 			return true;
70
-		}
71
-		else
69
+		} else
72 70
 		{
73 71
 			return false;
74 72
 		}
@@ -89,8 +87,7 @@  discard block
 block discarded – undo
89 87
 		if($this->page || $this->start)
90 88
 		{
91 89
 			return $this->start . ' , ' . $this->list_count->getValue();
92
-		}
93
-		else
90
+		} else
94 91
 		{
95 92
 			return $this->list_count->getValue();
96 93
 		}
Please login to merge, or discard this patch.
modules/document/document.item.php 1 patch
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	function _loadFromDB($load_extra_vars = true)
81 81
 	{
82
-		if(!$this->document_srl) return;
82
+		if (!$this->document_srl) return;
83 83
 
84 84
 		$document_item = false;
85 85
 		$cache_put = false;
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 		// cache controll
90 90
 		$oCacheHandler = CacheHandler::getInstance('object');
91
-		if($oCacheHandler->isSupport())
91
+		if ($oCacheHandler->isSupport())
92 92
 		{
93
-			$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
93
+			$cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl;
94 94
 			$document_item = $oCacheHandler->get($cache_key);
95
-			if($document_item !== false)
95
+			if ($document_item !== false)
96 96
 			{
97 97
 				$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
98 98
 			}
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 		$args->document_srl = $this->document_srl;
103 103
 		$output = executeQuery('document.getDocument', $args, $columnList);
104 104
 
105
-		if($document_item === false)
105
+		if ($document_item === false)
106 106
 		{
107 107
 			$document_item = $output->data;
108 108
 
109 109
 				//insert in cache
110
-			if($document_item && $oCacheHandler->isSupport())
110
+			if ($document_item && $oCacheHandler->isSupport())
111 111
 			{
112 112
 				$oCacheHandler->put($cache_key, $document_item);
113 113
 			}
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		$this->setAttribute($document_item, $load_extra_vars);
125 125
 	}
126 126
 
127
-	function setAttribute($attribute, $load_extra_vars=true)
127
+	function setAttribute($attribute, $load_extra_vars = true)
128 128
 	{
129
-		if(!$attribute->document_srl)
129
+		if (!$attribute->document_srl)
130 130
 		{
131 131
 			$this->document_srl = null;
132 132
 			return;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$this->adds($attribute);
137 137
 
138 138
 		// Tags
139
-		if($this->get('tags'))
139
+		if ($this->get('tags'))
140 140
 		{
141 141
 			$tag_list = explode(',', $this->get('tags'));
142 142
 			$tag_list = array_map('trim', $tag_list);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		$oDocumentModel = getModel('document');
147
-		if($load_extra_vars)
147
+		if ($load_extra_vars)
148 148
 		{
149 149
 			$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
150 150
 			$oDocumentModel->setToAllDocumentExtraVars();
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
 
160 160
 	function isGranted()
161 161
 	{
162
-		if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
162
+		if ($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
163 163
 
164
-		if($this->grant_cache !== null)
164
+		if ($this->grant_cache !== null)
165 165
 		{
166 166
 			return $this->grant_cache;
167 167
 		}
168 168
 
169
-		if(!Context::get('is_logged')) return $this->grant_cache = false;
169
+		if (!Context::get('is_logged')) return $this->grant_cache = false;
170 170
 
171 171
 		$logged_info = Context::get('logged_info');
172
-		if($logged_info->is_admin == 'Y') return $this->grant_cache = true;
172
+		if ($logged_info->is_admin == 'Y') return $this->grant_cache = true;
173 173
 
174 174
 		$oModuleModel = getModel('module');
175 175
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
176
-		if($grant->manager) return $this->grant_cache = true;
176
+		if ($grant->manager) return $this->grant_cache = true;
177 177
 
178
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return $this->grant_cache = true;
178
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return $this->grant_cache = true;
179 179
 
180 180
 		return $this->grant_cache = false;
181 181
 	}
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 
189 189
 	function isAccessible()
190 190
 	{
191
-		return $_SESSION['accessible'][$this->document_srl]==true?true:false;
191
+		return $_SESSION['accessible'][$this->document_srl] == true ? true : false;
192 192
 	}
193 193
 
194 194
 	function allowComment()
195 195
 	{
196 196
 		// init write, document is not exists. so allow comment status is true
197
-		if(!$this->isExists()) return true;
197
+		if (!$this->isExists()) return true;
198 198
 
199 199
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
200 200
 	}
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
 	function allowTrackback()
203 203
 	{
204 204
 		static $allow_trackback_status = null;
205
-		if(is_null($allow_trackback_status))
205
+		if (is_null($allow_trackback_status))
206 206
 		{
207 207
 			
208 208
 			// Check the tarckback module exist
209
-			if(!getClass('trackback'))
209
+			if (!getClass('trackback'))
210 210
 			{
211 211
 				$allow_trackback_status = false;
212 212
 			}
@@ -216,20 +216,20 @@  discard block
 block discarded – undo
216 216
 				$oModuleModel = getModel('module');
217 217
 				$trackback_config = $oModuleModel->getModuleConfig('trackback');
218 218
 				
219
-				if(!$trackback_config)
219
+				if (!$trackback_config)
220 220
 				{
221 221
 					$trackback_config = new stdClass();
222 222
 				}
223 223
 				
224
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
224
+				if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
+				if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
226 226
 				else
227 227
 				{
228 228
 					$module_srl = $this->get('module_srl');
229 229
 					// Check settings of each module
230 230
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
231
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
231
+					if ($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
+					else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true;
233 233
 				}
234 234
 			}
235 235
 		}
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 
239 239
 	function isLocked()
240 240
 	{
241
-		if(!$this->isExists()) return false;
241
+		if (!$this->isExists()) return false;
242 242
 
243 243
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
244 244
 	}
245 245
 
246 246
 	function isEditable()
247 247
 	{
248
-		if($this->isGranted() || !$this->get('member_srl')) return true;
248
+		if ($this->isGranted() || !$this->get('member_srl')) return true;
249 249
 		return false;
250 250
 	}
251 251
 
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 
263 263
 	function useNotify()
264 264
 	{
265
-		return $this->get('notify_message')=='Y' ? true : false;
265
+		return $this->get('notify_message') == 'Y' ? true : false;
266 266
 	}
267 267
 
268 268
 	function doCart()
269 269
 	{
270
-		if(!$this->document_srl) return false;
271
-		if($this->isCarted()) $this->removeCart();
270
+		if (!$this->document_srl) return false;
271
+		if ($this->isCarted()) $this->removeCart();
272 272
 		else $this->addCart();
273 273
 	}
274 274
 
@@ -295,18 +295,18 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	function notify($type, $content)
297 297
 	{
298
-		if(!$this->document_srl) return;
298
+		if (!$this->document_srl) return;
299 299
 		// return if it is not useNotify
300
-		if(!$this->useNotify()) return;
300
+		if (!$this->useNotify()) return;
301 301
 		// Pass if an author is not a logged-in user
302
-		if(!$this->get('member_srl')) return;
302
+		if (!$this->get('member_srl')) return;
303 303
 		// Return if the currently logged-in user is an author
304 304
 		$logged_info = Context::get('logged_info');
305
-		if($logged_info->member_srl == $this->get('member_srl')) return;
305
+		if ($logged_info->member_srl == $this->get('member_srl')) return;
306 306
 		// List variables
307
-		if($type) $title = "[".$type."] ";
307
+		if ($type) $title = "[".$type."] ";
308 308
 		$title .= cut_str(strip_tags($content), 10, '...');
309
-		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
309
+		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
310 310
 		$receiver_srl = $this->get('member_srl');
311 311
 		$sender_member_srl = $logged_info->member_srl;
312 312
 		// Send a message
@@ -321,26 +321,26 @@  discard block
 block discarded – undo
321 321
 
322 322
 	function getIpAddress()
323 323
 	{
324
-		if($this->isGranted())
324
+		if ($this->isGranted())
325 325
 		{
326 326
 			return $this->get('ipaddress');
327 327
 		}
328 328
 
329
-		return '*' . strstr($this->get('ipaddress'), '.');
329
+		return '*'.strstr($this->get('ipaddress'), '.');
330 330
 	}
331 331
 
332 332
 	function isExistsHomepage()
333 333
 	{
334
-		if(trim($this->get('homepage'))) return true;
334
+		if (trim($this->get('homepage'))) return true;
335 335
 		return false;
336 336
 	}
337 337
 
338 338
 	function getHomepageUrl()
339 339
 	{
340 340
 		$url = trim($this->get('homepage'));
341
-		if(!$url) return;
341
+		if (!$url) return;
342 342
 
343
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
343
+		if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://'.$url;
344 344
 
345 345
 		return $url;
346 346
 	}
@@ -370,52 +370,52 @@  discard block
 block discarded – undo
370 370
 		return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
371 371
 	}
372 372
 
373
-	function getTitleText($cut_size = 0, $tail='...')
373
+	function getTitleText($cut_size = 0, $tail = '...')
374 374
 	{
375
-		if(!$this->document_srl) return;
375
+		if (!$this->document_srl) return;
376 376
 
377
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
377
+		if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
378 378
 		else $title = $this->get('title');
379 379
 
380 380
 		return $title;
381 381
 	}
382 382
 
383
-	function getTitle($cut_size = 0, $tail='...')
383
+	function getTitle($cut_size = 0, $tail = '...')
384 384
 	{
385
-		if(!$this->document_srl) return;
385
+		if (!$this->document_srl) return;
386 386
 
387 387
 		$title = $this->getTitleText($cut_size, $tail);
388 388
 
389 389
 		$attrs = array();
390 390
 		$this->add('title_color', trim($this->get('title_color')));
391
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
392
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
391
+		if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;";
392
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
393 393
 
394
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
394
+		if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
395 395
 		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
396 396
 	}
397 397
 
398 398
 	function getContentText($strlen = 0)
399 399
 	{
400
-		if(!$this->document_srl) return;
400
+		if (!$this->document_srl) return;
401 401
 
402
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
402
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
403 403
 
404 404
 		$result = $this->_checkAccessibleFromStatus();
405
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
405
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
406 406
 
407 407
 		$content = $this->get('content');
408 408
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
409 409
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
410 410
 
411
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
411
+		if ($strlen) return cut_str(strip_tags($content), $strlen, '...');
412 412
 
413 413
 		return htmlspecialchars($content);
414 414
 	}
415 415
 
416 416
 	function _addAllowScriptAccess($m)
417 417
 	{
418
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
418
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
419 419
 		{
420 420
 			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
421 421
 		}
@@ -425,26 +425,26 @@  discard block
 block discarded – undo
425 425
 
426 426
 	function _checkAllowScriptAccess($m)
427 427
 	{
428
-		if($m[1] == 'object')
428
+		if ($m[1] == 'object')
429 429
 		{
430 430
 			$this->allowscriptaccessList[] = 1;
431 431
 		}
432 432
 
433
-		if($m[1] == 'param')
433
+		if ($m[1] == 'param')
434 434
 		{
435
-			if(stripos($m[0], 'allowscriptaccess'))
435
+			if (stripos($m[0], 'allowscriptaccess'))
436 436
 			{
437 437
 				$m[0] = '<param name="allowscriptaccess" value="never"';
438
-				if(substr($m[0], -1) == '/')
438
+				if (substr($m[0], -1) == '/')
439 439
 				{
440 440
 					$m[0] .= '/';
441 441
 				}
442
-				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
442
+				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
443 443
 			}
444 444
 		}
445
-		else if($m[1] == 'embed')
445
+		else if ($m[1] == 'embed')
446 446
 		{
447
-			if(stripos($m[0], 'allowscriptaccess'))
447
+			if (stripos($m[0], 'allowscriptaccess'))
448 448
 			{
449 449
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
450 450
 			}
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
 
459 459
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
460 460
 	{
461
-		if(!$this->document_srl) return;
461
+		if (!$this->document_srl) return;
462 462
 
463
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
463
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
464 464
 
465 465
 		$result = $this->_checkAccessibleFromStatus();
466
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
466
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
467 467
 
468 468
 		$content = $this->get('content');
469
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
469
+		if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
470 470
 
471 471
 		// Define a link if using a rewrite module
472 472
 		$oContext = &Context::getInstance();
473
-		if($oContext->allow_rewrite)
473
+		if ($oContext->allow_rewrite)
474 474
 		{
475
-			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
475
+			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content);
476 476
 		}
477 477
 		// To display a pop-up menu
478
-		if($add_popup_menu)
478
+		if ($add_popup_menu)
479 479
 		{
480 480
 			$content = sprintf(
481 481
 				'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@@ -484,10 +484,10 @@  discard block
 block discarded – undo
484 484
 			);
485 485
 		}
486 486
 		// If additional content information is set
487
-		if($add_content_info)
487
+		if ($add_content_info)
488 488
 		{
489 489
 			$memberSrl = $this->get('member_srl');
490
-			if($memberSrl < 0)
490
+			if ($memberSrl < 0)
491 491
 			{
492 492
 				$memberSrl = 0;
493 493
 			}
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 		else
505 505
 		{
506
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
506
+			if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
507 507
 		}
508 508
 		// Change the image path to a valid absolute path if resource_realpath is true
509
-		if($resource_realpath)
509
+		if ($resource_realpath)
510 510
 		{
511
-			$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
511
+			$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
512 512
 		}
513 513
 
514 514
 		return $content;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		$content = trim(cut_str($content, $str_size, $tail));
558 558
 
559 559
 		// Replace back < , <, "
560
-		$content = str_replace(array('<', '>', '"'),array('&lt;', '&gt;', '&quot;'), $content);
560
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
561 561
 
562 562
 		return $content;
563 563
 	}
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 	function getRegdateTime()
571 571
 	{
572 572
 		$regdate = $this->get('regdate');
573
-		$year = substr($regdate,0,4);
574
-		$month = substr($regdate,4,2);
575
-		$day = substr($regdate,6,2);
576
-		$hour = substr($regdate,8,2);
577
-		$min = substr($regdate,10,2);
578
-		$sec = substr($regdate,12,2);
579
-		return mktime($hour,$min,$sec,$month,$day,$year);
573
+		$year = substr($regdate, 0, 4);
574
+		$month = substr($regdate, 4, 2);
575
+		$day = substr($regdate, 6, 2);
576
+		$hour = substr($regdate, 8, 2);
577
+		$min = substr($regdate, 10, 2);
578
+		$sec = substr($regdate, 12, 2);
579
+		return mktime($hour, $min, $sec, $month, $day, $year);
580 580
 	}
581 581
 
582 582
 	function getRegdateGM()
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 
587 587
 	function getRegdateDT()
588 588
 	{
589
-		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
589
+		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
590 590
 	}
591 591
 
592 592
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
 
597 597
 	function getUpdateTime()
598 598
 	{
599
-		$year = substr($this->get('last_update'),0,4);
600
-		$month = substr($this->get('last_update'),4,2);
601
-		$day = substr($this->get('last_update'),6,2);
602
-		$hour = substr($this->get('last_update'),8,2);
603
-		$min = substr($this->get('last_update'),10,2);
604
-		$sec = substr($this->get('last_update'),12,2);
605
-		return mktime($hour,$min,$sec,$month,$day,$year);
599
+		$year = substr($this->get('last_update'), 0, 4);
600
+		$month = substr($this->get('last_update'), 4, 2);
601
+		$day = substr($this->get('last_update'), 6, 2);
602
+		$hour = substr($this->get('last_update'), 8, 2);
603
+		$min = substr($this->get('last_update'), 10, 2);
604
+		$sec = substr($this->get('last_update'), 12, 2);
605
+		return mktime($hour, $min, $sec, $month, $day, $year);
606 606
 	}
607 607
 
608 608
 	function getUpdateGM()
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
 
613 613
 	function getUpdateDT()
614 614
 	{
615
-		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
615
+		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
616 616
 	}
617 617
 
618 618
 	function getPermanentUrl()
619 619
 	{
620
-		return getFullUrl('','document_srl',$this->get('document_srl'));
620
+		return getFullUrl('', 'document_srl', $this->get('document_srl'));
621 621
 	}
622 622
 
623 623
 	function getTrackbackUrl()
624 624
 	{
625
-		if(!$this->document_srl) return;
625
+		if (!$this->document_srl) return;
626 626
 
627 627
 		// Generate a key to prevent spams
628 628
 		$oTrackbackModel = getModel('trackback');
629
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
629
+		if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
630 630
 	}
631 631
 
632 632
 	/**
@@ -636,24 +636,24 @@  discard block
 block discarded – undo
636 636
 	function updateReadedCount()
637 637
 	{
638 638
 		$oDocumentController = getController('document');
639
-		if($oDocumentController->updateReadedCount($this))
639
+		if ($oDocumentController->updateReadedCount($this))
640 640
 		{
641 641
 			$readed_count = $this->get('readed_count');
642
-			$this->add('readed_count', $readed_count+1);
642
+			$this->add('readed_count', $readed_count + 1);
643 643
 		}
644 644
 	}
645 645
 
646 646
 	function isExtraVarsExists()
647 647
 	{
648
-		if(!$this->get('module_srl')) return false;
648
+		if (!$this->get('module_srl')) return false;
649 649
 		$oDocumentModel = getModel('document');
650 650
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
651
-		return count($extra_keys)?true:false;
651
+		return count($extra_keys) ? true : false;
652 652
 	}
653 653
 
654 654
 	function getExtraVars()
655 655
 	{
656
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
656
+		if (!$this->get('module_srl') || !$this->document_srl) return null;
657 657
 
658 658
 		$oDocumentModel = getModel('document');
659 659
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	function getExtraValue($idx)
663 663
 	{
664 664
 		$extra_vars = $this->getExtraVars();
665
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
665
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
666 666
 		{
667 667
 			return $extra_vars[$idx]->getValue();
668 668
 		}
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 	function getExtraValueHTML($idx)
676 676
 	{
677 677
 		$extra_vars = $this->getExtraVars();
678
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
678
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
679 679
 		{
680 680
 			return $extra_vars[$idx]->getValueHTML();
681 681
 		}
@@ -689,16 +689,16 @@  discard block
 block discarded – undo
689 689
 	{
690 690
 		$extra_vars = $this->getExtraVars();
691 691
 
692
-		if($extra_vars)
692
+		if ($extra_vars)
693 693
 		{
694 694
 			// Handle extra variable(eid)
695
-			foreach($extra_vars as $idx => $key)
695
+			foreach ($extra_vars as $idx => $key)
696 696
 			{
697 697
 				$extra_eid[$key->eid] = $key;
698 698
 			}
699 699
 		}
700 700
 		
701
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
701
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
702 702
 		{
703 703
 			return $extra_eid[$eid]->getValue();
704 704
 		}
@@ -712,12 +712,12 @@  discard block
 block discarded – undo
712 712
 	{
713 713
 		$extra_vars = $this->getExtraVars();
714 714
 		// Handle extra variable(eid)
715
-		foreach($extra_vars as $idx => $key)
715
+		foreach ($extra_vars as $idx => $key)
716 716
 		{
717 717
 			$extra_eid[$key->eid] = $key;
718 718
 		}
719 719
 		
720
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
720
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
721 721
 		{
722 722
 			return $extra_eid[$eid]->getValueHTML();
723 723
 		}
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
 
742 742
 	function getComments()
743 743
 	{
744
-		if(!$this->getCommentCount()) return;
745
-		if(!$this->isGranted() && $this->isSecret()) return;
744
+		if (!$this->getCommentCount()) return;
745
+		if (!$this->isGranted() && $this->isSecret()) return;
746 746
 		// cpage is a number of comment pages
747 747
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
748 748
 		$cpage = Context::get($cpageStr);
749 749
 
750
-		if(!$cpage)
750
+		if (!$cpage)
751 751
 		{
752 752
 			$cpage = Context::get('cpage');
753 753
 		}
@@ -755,19 +755,19 @@  discard block
 block discarded – undo
755 755
 		// Get a list of comments
756 756
 		$oCommentModel = getModel('comment');
757 757
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
758
-		if(!$output->toBool() || !count($output->data)) return;
758
+		if (!$output->toBool() || !count($output->data)) return;
759 759
 		// Create commentItem object from a comment list
760 760
 		// If admin priviledge is granted on parent posts, you can read its child posts.
761 761
 		$accessible = array();
762 762
 		$comment_list = array();
763
-		foreach($output->data as $key => $val)
763
+		foreach ($output->data as $key => $val)
764 764
 		{
765 765
 			$oCommentItem = new commentItem();
766 766
 			$oCommentItem->setAttribute($val);
767 767
 			// If permission is granted to the post, you can access it temporarily
768
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
768
+			if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
769 769
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
770
-			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
770
+			if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true)
771 771
 			{
772 772
 				$oCommentItem->setAccessible();
773 773
 			}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 		// Variable setting to be displayed on the skin
777 777
 		Context::set($cpageStr, $output->page_navigation->cur_page);
778 778
 		Context::set('cpage', $output->page_navigation->cur_page);
779
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
779
+		if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation;
780 780
 
781 781
 		return $comment_list;
782 782
 	}
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
 
789 789
 	function getTrackbacks()
790 790
 	{
791
-		if(!$this->document_srl) return;
791
+		if (!$this->document_srl) return;
792 792
 
793
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
793
+		if (!$this->allowTrackback() || !$this->get('trackback_count')) return;
794 794
 
795 795
 		$oTrackbackModel = getModel('trackback');
796 796
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -798,47 +798,47 @@  discard block
 block discarded – undo
798 798
 
799 799
 	function thumbnailExists($width = 80, $height = 0, $type = '')
800 800
 	{
801
-		if(!$this->document_srl) return false;
802
-		if(!$this->getThumbnail($width, $height, $type)) return false;
801
+		if (!$this->document_srl) return false;
802
+		if (!$this->getThumbnail($width, $height, $type)) return false;
803 803
 		return true;
804 804
 	}
805 805
 
806 806
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
807 807
 	{
808 808
 		// Return false if the document doesn't exist
809
-		if(!$this->document_srl) return;
809
+		if (!$this->document_srl) return;
810 810
 
811
-		if($this->isSecret() && !$this->isGranted())
811
+		if ($this->isSecret() && !$this->isGranted())
812 812
 		{
813 813
 			return;
814 814
 		}
815 815
 
816 816
 		// If not specify its height, create a square
817
-		if(!$height) $height = $width;
817
+		if (!$height) $height = $width;
818 818
 
819 819
 		// Return false if neither attachement nor image files in the document
820 820
 		$content = $this->get('content');
821
-		if(!$this->get('uploaded_count'))
821
+		if (!$this->get('uploaded_count'))
822 822
 		{
823
-			if(!$content)
823
+			if (!$content)
824 824
 			{
825 825
 				$args = new stdClass();
826 826
 				$args->document_srl = $this->document_srl;
827 827
 				$output = executeQuery('document.getDocument', $args, array('content'));
828
-				if($output->toBool() && $output->data)
828
+				if ($output->toBool() && $output->data)
829 829
 				{
830 830
 					$content = $output->data->content;
831 831
 					$this->add('content', $content);
832 832
 				}
833 833
 			}
834 834
 
835
-			if(!preg_match("!<img!is", $content)) return;
835
+			if (!preg_match("!<img!is", $content)) return;
836 836
 		}
837 837
 		// Get thumbnai_type information from document module's configuration
838
-		if(!in_array($thumbnail_type, array('crop','ratio')))
838
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
839 839
 		{
840 840
 			$config = $GLOBALS['__document_config__'];
841
-			if(!$config)
841
+			if (!$config)
842 842
 			{
843 843
 				$oDocumentModel = getModel('document');
844 844
 				$config = $oDocumentModel->getDocumentConfig();
@@ -848,15 +848,15 @@  discard block
 block discarded – undo
848 848
 		}
849 849
 
850 850
 		// Define thumbnail information
851
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
851
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
852 852
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
853 853
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
854 854
 		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
855 855
 
856 856
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
857
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
857
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
858 858
 		{
859
-			if(filesize($thumbnail_file) < 1)
859
+			if (filesize($thumbnail_file) < 1)
860 860
 			{
861 861
 				return FALSE;
862 862
 			}
@@ -874,64 +874,64 @@  discard block
 block discarded – undo
874 874
 		$is_tmp_file = false;
875 875
 
876 876
 		// Find an iamge file among attached files if exists
877
-		if($this->hasUploadedFiles())
877
+		if ($this->hasUploadedFiles())
878 878
 		{
879 879
 			$file_list = $this->getUploadedFiles();
880 880
 
881 881
 			$first_image = null;
882
-			foreach($file_list as $file)
882
+			foreach ($file_list as $file)
883 883
 			{
884
-				if($file->direct_download !== 'Y') continue;
884
+				if ($file->direct_download !== 'Y') continue;
885 885
 
886
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
886
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
887 887
 				{
888 888
 					$source_file = $file->uploaded_filename;
889 889
 					break;
890 890
 				}
891 891
 
892
-				if($first_image) continue;
892
+				if ($first_image) continue;
893 893
 
894
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
894
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
895 895
 				{
896
-					if(file_exists($file->uploaded_filename))
896
+					if (file_exists($file->uploaded_filename))
897 897
 					{
898 898
 						$first_image = $file->uploaded_filename;
899 899
 					}
900 900
 				}
901 901
 			}
902 902
 
903
-			if(!$source_file && $first_image)
903
+			if (!$source_file && $first_image)
904 904
 			{
905 905
 				$source_file = $first_image;
906 906
 			}
907 907
 		}
908 908
 		// If not exists, file an image file from the content
909 909
 		$is_tmp_file = false;
910
-		if(!$source_file)
910
+		if (!$source_file)
911 911
 		{
912 912
 			$random = new Password();
913 913
 
914 914
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
915 915
 
916
-			foreach($matches as $target_image)
916
+			foreach ($matches as $target_image)
917 917
 			{
918 918
 				$target_src = trim($target_image[1]);
919
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
919
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
920 920
 
921
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
921
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
922 922
 				{
923 923
 					$target_src = Context::getRequestUri().$target_src;
924 924
 				}
925 925
 
926 926
 				$target_src = htmlspecialchars_decode($target_src);
927 927
 
928
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
928
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
929 929
 				FileHandler::getRemoteFile($target_src, $tmp_file);
930
-				if(!file_exists($tmp_file)) continue;
930
+				if (!file_exists($tmp_file)) continue;
931 931
 
932 932
 				$imageinfo = getimagesize($tmp_file);
933 933
 				list($_w, $_h) = $imageinfo;
934
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
934
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
935 935
 					FileHandler::removeFile($tmp_file);
936 936
 					continue;
937 937
 				}
@@ -942,13 +942,13 @@  discard block
 block discarded – undo
942 942
 			}
943 943
 		}
944 944
 
945
-		if($source_file)
945
+		if ($source_file)
946 946
 		{
947 947
 			$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
948 948
 		}
949 949
 
950 950
 		// Remove source file if it was temporary
951
-		if($is_tmp_file)
951
+		if ($is_tmp_file)
952 952
 		{
953 953
 			FileHandler::removeFile($source_file);
954 954
 		}
@@ -957,14 +957,14 @@  discard block
 block discarded – undo
957 957
 		FileHandler::removeFile($thumbnail_lockfile);
958 958
 
959 959
 		// Return the thumbnail path if it was successfully generated
960
-		if($output_file)
960
+		if ($output_file)
961 961
 		{
962 962
 			return $thumbnail_url;
963 963
 		}
964 964
 		// Create an empty file if thumbnail generation failed
965 965
 		else
966 966
 		{
967
-			FileHandler::writeFile($thumbnail_file, '','w');
967
+			FileHandler::writeFile($thumbnail_file, '', 'w');
968 968
 		}
969 969
 
970 970
 		return;
@@ -978,21 +978,21 @@  discard block
 block discarded – undo
978 978
 	 */
979 979
 	function getExtraImages($time_interval = 43200)
980 980
 	{
981
-		if(!$this->document_srl) return;
981
+		if (!$this->document_srl) return;
982 982
 		// variables for icon list
983 983
 		$buffs = array();
984 984
 
985 985
 		$check_files = false;
986 986
 
987 987
 		// Check if secret post is
988
-		if($this->isSecret()) $buffs[] = "secret";
988
+		if ($this->isSecret()) $buffs[] = "secret";
989 989
 
990 990
 		// Set the latest time
991
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
991
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
992 992
 
993 993
 		// Check new post
994
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
995
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
994
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
995
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
996 996
 
997 997
 		/*
998 998
 		   $content = $this->get('content');
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
 		 */
1016 1016
 
1017 1017
 		// Check the attachment
1018
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1018
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
1019 1019
 
1020 1020
 		return $buffs;
1021 1021
 	}
1022 1022
 
1023 1023
 	function getStatus()
1024 1024
 	{
1025
-		if(!$this->get('status')) return $this->getDefaultStatus();
1025
+		if (!$this->get('status')) return $this->getDefaultStatus();
1026 1026
 		return $this->get('status');
1027 1027
 	}
1028 1028
 
@@ -1033,15 +1033,15 @@  discard block
 block discarded – undo
1033 1033
 	 */
1034 1034
 	function printExtraImages($time_check = 43200)
1035 1035
 	{
1036
-		if(!$this->document_srl) return;
1036
+		if (!$this->document_srl) return;
1037 1037
 		// Get the icon directory
1038
-		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
1038
+		$path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/');
1039 1039
 
1040 1040
 		$buffs = $this->getExtraImages($time_check);
1041
-		if(!count($buffs)) return;
1041
+		if (!count($buffs)) return;
1042 1042
 
1043 1043
 		$buff = array();
1044
-		foreach($buffs as $key => $val)
1044
+		foreach ($buffs as $key => $val)
1045 1045
 		{
1046 1046
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1047 1047
 		}
@@ -1050,20 +1050,20 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 	function hasUploadedFiles()
1052 1052
 	{
1053
-		if(!$this->document_srl) return;
1053
+		if (!$this->document_srl) return;
1054 1054
 
1055
-		if($this->isSecret() && !$this->isGranted()) return false;
1056
-		return $this->get('uploaded_count')? true : false;
1055
+		if ($this->isSecret() && !$this->isGranted()) return false;
1056
+		return $this->get('uploaded_count') ? true : false;
1057 1057
 	}
1058 1058
 
1059 1059
 	function getUploadedFiles($sortIndex = 'file_srl')
1060 1060
 	{
1061
-		if(!$this->document_srl) return;
1061
+		if (!$this->document_srl) return;
1062 1062
 
1063
-		if($this->isSecret() && !$this->isGranted()) return;
1064
-		if(!$this->get('uploaded_count')) return;
1063
+		if ($this->isSecret() && !$this->isGranted()) return;
1064
+		if (!$this->get('uploaded_count')) return;
1065 1065
 
1066
-		if(!$this->uploadedFiles[$sortIndex])
1066
+		if (!$this->uploadedFiles[$sortIndex])
1067 1067
 		{
1068 1068
 			$oFileModel = getModel('file');
1069 1069
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 	function getEditor()
1080 1080
 	{
1081 1081
 		$module_srl = $this->get('module_srl');
1082
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1082
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1083 1083
 
1084 1084
 		$oEditorModel = getModel('editor');
1085 1085
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 	{
1095 1095
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1096 1096
 		if (!$this->allowComment()) return false;
1097
-		if(!$this->isGranted() && $this->isSecret()) return false;
1097
+		if (!$this->isGranted() && $this->isSecret()) return false;
1098 1098
 
1099 1099
 		return true;
1100 1100
 	}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	function getCommentEditor()
1107 1107
 	{
1108
-		if(!$this->isEnableComment()) return;
1108
+		if (!$this->isEnableComment()) return;
1109 1109
 
1110 1110
 		$oEditorModel = getModel('editor');
1111 1111
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1117,10 +1117,10 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	function getProfileImage()
1119 1119
 	{
1120
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1120
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1121 1121
 		$oMemberModel = getModel('member');
1122 1122
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1123
-		if(!$profile_info) return;
1123
+		if (!$profile_info) return;
1124 1124
 
1125 1125
 		return $profile_info->src;
1126 1126
 	}
@@ -1132,21 +1132,21 @@  discard block
 block discarded – undo
1132 1132
 	function getSignature()
1133 1133
 	{
1134 1134
 		// Pass if a document doesn't exist
1135
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1135
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1136 1136
 		// Get signature information
1137 1137
 		$oMemberModel = getModel('member');
1138 1138
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1139 1139
 		// Check if a maximum height of signiture is set in the member module
1140
-		if(!isset($GLOBALS['__member_signature_max_height']))
1140
+		if (!isset($GLOBALS['__member_signature_max_height']))
1141 1141
 		{
1142 1142
 			$oModuleModel = getModel('module');
1143 1143
 			$member_config = $oModuleModel->getModuleConfig('member');
1144 1144
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1145 1145
 		}
1146
-		if($signature)
1146
+		if ($signature)
1147 1147
 		{
1148 1148
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1149
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1149
+			if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1150 1150
 		}
1151 1151
 
1152 1152
 		return $signature;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 */
1160 1160
 	function replaceResourceRealPath($matches)
1161 1161
 	{
1162
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1162
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1163 1163
 	}
1164 1164
 
1165 1165
 	/**
@@ -1170,19 +1170,19 @@  discard block
 block discarded – undo
1170 1170
 	function _checkAccessibleFromStatus()
1171 1171
 	{
1172 1172
 		$logged_info = Context::get('logged_info');
1173
-		if($logged_info->is_admin == 'Y') return true;
1173
+		if ($logged_info->is_admin == 'Y') return true;
1174 1174
 
1175 1175
 		$status = $this->get('status');
1176
-		if(empty($status)) return false;
1176
+		if (empty($status)) return false;
1177 1177
 
1178 1178
 		$oDocumentModel = getModel('document');
1179 1179
 		$configStatusList = $oDocumentModel->getStatusList();
1180 1180
 
1181
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1181
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1182 1182
 			return true;
1183
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1183
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1184 1184
 		{
1185
-			if($this->get('member_srl') == $logged_info->member_srl)
1185
+			if ($this->get('member_srl') == $logged_info->member_srl)
1186 1186
 				return true;
1187 1187
 		}
1188 1188
 		return false;
Please login to merge, or discard this patch.
modules/document/document.controller.php 2 patches
Spacing   +367 added lines, -367 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	function procDocumentVoteUp()
26 26
 	{
27
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
27
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
28 28
 
29 29
 		$document_srl = Context::get('target_srl');
30
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
30
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
31 31
 
32 32
 		$oDocumentModel = getModel('document');
33 33
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
34 34
 		$module_srl = $oDocument->get('module_srl');
35
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
35
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
36 36
 
37 37
 		$oModuleModel = getModel('module');
38
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
39
-		if($document_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request');
38
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
39
+		if ($document_config->use_vote_up == 'N') return new Object(-1, 'msg_invalid_request');
40 40
 
41 41
 		$point = 1;
42 42
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	function procDocumentVoteDown()
71 71
 	{
72
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
72
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
73 73
 
74 74
 		$document_srl = Context::get('target_srl');
75
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
75
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
76 76
 
77 77
 		$oDocumentModel = getModel('document');
78 78
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
79 79
 		$module_srl = $oDocument->get('module_srl');
80
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
80
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
81 81
 
82 82
 		$oModuleModel = getModel('module');
83
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
84
-		if($document_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request');
83
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
84
+		if ($document_config->use_vote_down == 'N') return new Object(-1, 'msg_invalid_request');
85 85
 
86 86
 		$point = -1;
87 87
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	function procDocumentDeclare()
97 97
 	{
98
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
98
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
99 99
 
100 100
 		$document_srl = Context::get('target_srl');
101
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
101
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
102 102
 
103 103
 		return $this->declaredDocument($document_srl);
104 104
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$args->history_srl = $history_srl;
141 141
 		$args->module_srl = $module_srl;
142 142
 		$args->document_srl = $document_srl;
143
-		if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
143
+		if (!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
144 144
 		executeQuery("document.deleteHistory", $args);
145 145
 	}
146 146
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	function triggerDeleteModuleDocuments(&$obj)
153 153
 	{
154 154
 		$module_srl = $obj->module_srl;
155
-		if(!$module_srl) return new Object();
155
+		if (!$module_srl) return new Object();
156 156
 		// Delete the document
157 157
 		$oDocumentAdminController = getAdminController('document');
158 158
 		$output = $oDocumentAdminController->deleteModuleDocument($module_srl);
159
-		if(!$output->toBool()) return $output;
159
+		if (!$output->toBool()) return $output;
160 160
 		// Delete the category
161 161
 		$oDocumentController = getController('document');
162 162
 		$output = $oDocumentController->deleteModuleCategory($module_srl);
163
-		if(!$output->toBool()) return $output;
163
+		if (!$output->toBool()) return $output;
164 164
 		// Delete extra key and variable, because module deleted
165 165
 		$this->deleteDocumentExtraKeys($module_srl);
166 166
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	function insertDocument($obj, $manual_inserted = false, $isRestore = false, $isLatest = true)
195 195
 	{
196
-		if(!$manual_inserted && !checkCSRF())
196
+		if (!$manual_inserted && !checkCSRF())
197 197
 		{
198 198
 			return new Object(-1, 'msg_invalid_request');
199 199
 		}
@@ -202,32 +202,32 @@  discard block
 block discarded – undo
202 202
 		$oDB = &DB::getInstance();
203 203
 		$oDB->begin();
204 204
 		// List variables
205
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
206
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
207
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
208
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
209
-		if($obj->homepage) 
205
+		if ($obj->comment_status) $obj->commentStatus = $obj->comment_status;
206
+		if (!$obj->commentStatus) $obj->commentStatus = 'DENY';
207
+		if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
208
+		if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N';
209
+		if ($obj->homepage) 
210 210
 		{
211 211
 			$obj->homepage = removeHackTag($obj->homepage);
212
-			if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
212
+			if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
213 213
 			{
214 214
 				$obj->homepage = 'http://'.$obj->homepage;
215 215
 			}
216 216
 		}
217 217
 		
218
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
219
-		if(!$obj->email_address) $obj->email_address = '';
220
-		if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
218
+		if ($obj->notify_message != 'Y') $obj->notify_message = 'N';
219
+		if (!$obj->email_address) $obj->email_address = '';
220
+		if (!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
221 221
 
222 222
                 // can modify regdate only manager
223 223
                 $grant = Context::get('grant');
224
-		if(!$grant->manager)
224
+		if (!$grant->manager)
225 225
 		{
226 226
 			unset($obj->regdate);
227 227
 		}
228 228
 		
229 229
 		// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
230
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
230
+		if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
231 231
 		// Remove the columns for automatic saving
232 232
 		unset($obj->_saved_doc_srl);
233 233
 		unset($obj->_saved_doc_title);
@@ -235,34 +235,34 @@  discard block
 block discarded – undo
235 235
 		unset($obj->_saved_doc_message);
236 236
 		// Call a trigger (before)
237 237
 		$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 		// Register it if no given document_srl exists
240
-		if(!$obj->document_srl) $obj->document_srl = getNextSequence();
241
-		elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new Object(-1, 'msg_not_permitted');
240
+		if (!$obj->document_srl) $obj->document_srl = getNextSequence();
241
+		elseif (!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new Object(-1, 'msg_not_permitted');
242 242
 
243 243
 		$oDocumentModel = getModel('document');
244 244
 		// Set to 0 if the category_srl doesn't exist
245
-		if($obj->category_srl)
245
+		if ($obj->category_srl)
246 246
 		{
247 247
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
248
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]->grant)
248
+			if (count($category_list) > 0 && !$category_list[$obj->category_srl]->grant)
249 249
 			{
250 250
 				return new Object(-1, 'msg_not_permitted');
251 251
 			}
252
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
252
+			if (count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
253 253
 		}
254 254
 		// Set the read counts and update order.
255
-		if(!$obj->readed_count) $obj->readed_count = 0;
256
-		if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
255
+		if (!$obj->readed_count) $obj->readed_count = 0;
256
+		if ($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
257 257
 		else $obj->update_order = $obj->list_order;
258 258
 		// Check the status of password hash for manually inserting. Apply hashing for otherwise.
259
-		if($obj->password && !$obj->password_is_hashed)
259
+		if ($obj->password && !$obj->password_is_hashed)
260 260
 		{
261 261
 			$obj->password = getModel('member')->hashPassword($obj->password);
262 262
 		}
263 263
 		// Insert member's information only if the member is logged-in and not manually registered.
264 264
 		$logged_info = Context::get('logged_info');
265
-		if(Context::get('is_logged') && !$manual_inserted && !$isRestore)
265
+		if (Context::get('is_logged') && !$manual_inserted && !$isRestore)
266 266
 		{
267 267
 			$obj->member_srl = $logged_info->member_srl;
268 268
 
@@ -276,61 +276,61 @@  discard block
 block discarded – undo
276 276
 		// If the tile is empty, extract string from the contents.
277 277
 		$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
278 278
 		settype($obj->title, "string");
279
-		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
279
+		if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...');
280 280
 		// If no tile extracted from the contents, leave it untitled.
281
-		if($obj->title == '') $obj->title = 'Untitled';
281
+		if ($obj->title == '') $obj->title = 'Untitled';
282 282
 		// Remove XE's own tags from the contents.
283 283
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
284
-		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
284
+		if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
285 285
 		{
286
-			if($obj->use_html != 'Y')
286
+			if ($obj->use_html != 'Y')
287 287
 			{
288 288
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
289 289
 			}
290 290
 			$obj->content = nl2br($obj->content);
291 291
 		}
292 292
 		// Remove iframe and script if not a top adminisrator in the session.
293
-		if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
293
+		if ($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
294 294
 		// An error appears if both log-in info and user name don't exist.
295
-		if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request');
295
+		if (!$logged_info->member_srl && !$obj->nick_name) return new Object(-1, 'msg_invalid_request');
296 296
 
297 297
 		$obj->lang_code = Context::getLangType();
298 298
 		// Insert data into the DB
299
-		if(!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
299
+		if (!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
300 300
 		$output = executeQuery('document.insertDocument', $obj);
301
-		if(!$output->toBool())
301
+		if (!$output->toBool())
302 302
 		{
303 303
 			$oDB->rollback();
304 304
 			return $output;
305 305
 		}
306 306
 		// Insert extra variables if the document successfully inserted.
307 307
 		$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
308
-		if(count($extra_keys))
308
+		if (count($extra_keys))
309 309
 		{
310
-			foreach($extra_keys as $idx => $extra_item)
310
+			foreach ($extra_keys as $idx => $extra_item)
311 311
 			{
312 312
 				$value = NULL;
313
-				if(isset($obj->{'extra_vars'.$idx}))
313
+				if (isset($obj->{'extra_vars'.$idx}))
314 314
 				{
315 315
 					$tmp = $obj->{'extra_vars'.$idx};
316
-					if(is_array($tmp))
316
+					if (is_array($tmp))
317 317
 						$value = implode('|@|', $tmp);
318 318
 					else
319 319
 						$value = trim($tmp);
320 320
 				}
321
-				else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
322
-				if($value == NULL) continue;
321
+				else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
322
+				if ($value == NULL) continue;
323 323
 
324 324
 				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
325 325
 			}
326 326
 		}
327 327
 		// Update the category if the category_srl exists.
328
-		if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
328
+		if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
329 329
 		// Call a trigger (after)
330
-		if($output->toBool())
330
+		if ($output->toBool())
331 331
 		{
332 332
 			$trigger_output = ModuleHandler::triggerCall('document.insertDocument', 'after', $obj);
333
-			if(!$trigger_output->toBool())
333
+			if (!$trigger_output->toBool())
334 334
 			{
335 335
 				$oDB->rollback();
336 336
 				return $trigger_output;
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 		$oDB->commit();
342 342
 
343 343
 		// return
344
-		if(!$manual_inserted)
344
+		if (!$manual_inserted)
345 345
 		{
346 346
 			$this->addGrant($obj->document_srl);
347 347
 		}
348
-		$output->add('document_srl',$obj->document_srl);
349
-		$output->add('category_srl',$obj->category_srl);
348
+		$output->add('document_srl', $obj->document_srl);
349
+		$output->add('category_srl', $obj->category_srl);
350 350
 
351 351
 		return $output;
352 352
 	}
@@ -362,41 +362,41 @@  discard block
 block discarded – undo
362 362
 	{
363 363
 		$logged_info = Context::get('logged_info');
364 364
 
365
-		if(!$manual_updated && !checkCSRF())
365
+		if (!$manual_updated && !checkCSRF())
366 366
 		{
367 367
 			return new Object(-1, 'msg_invalid_request');
368 368
 		}
369 369
 
370
-		if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request');
371
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
372
-		if(!$obj->status) $obj->status = 'PUBLIC';
370
+		if (!$source_obj->document_srl || !$obj->document_srl) return new Object(-1, 'msg_invalied_request');
371
+		if (!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
372
+		if (!$obj->status) $obj->status = 'PUBLIC';
373 373
 
374 374
 		// Call a trigger (before)
375 375
 		$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
376
-		if(!$output->toBool()) return $output;
376
+		if (!$output->toBool()) return $output;
377 377
 
378 378
 		// begin transaction
379 379
 		$oDB = &DB::getInstance();
380 380
 		$oDB->begin();
381 381
 
382 382
 		$oModuleModel = getModel('module');
383
-		if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
383
+		if (!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
384 384
 		$module_srl = $obj->module_srl;
385 385
 		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
386
-		if(!$document_config)
386
+		if (!$document_config)
387 387
 		{
388 388
 			$document_config = new stdClass();
389 389
 		}
390
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
390
+		if (!isset($document_config->use_history)) $document_config->use_history = 'N';
391 391
 		$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
392 392
 
393
-		if($bUseHistory)
393
+		if ($bUseHistory)
394 394
 		{
395 395
 			$args = new stdClass;
396 396
 			$args->history_srl = getNextSequence();
397 397
 			$args->document_srl = $obj->document_srl;
398 398
 			$args->module_srl = $module_srl;
399
-			if($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
399
+			if ($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
400 400
 			$args->nick_name = $source_obj->get('nick_name');
401 401
 			$args->member_srl = $source_obj->get('member_srl');
402 402
 			$args->regdate = $source_obj->get('last_update');
@@ -408,30 +408,30 @@  discard block
 block discarded – undo
408 408
 			$obj->ipaddress = $source_obj->get('ipaddress');
409 409
 		}
410 410
 		// List variables
411
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
412
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
413
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
414
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
415
-		if($obj->homepage)
411
+		if ($obj->comment_status) $obj->commentStatus = $obj->comment_status;
412
+		if (!$obj->commentStatus) $obj->commentStatus = 'DENY';
413
+		if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
414
+		if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N';
415
+		if ($obj->homepage)
416 416
 		{
417 417
 			$obj->homepage = removeHackTag($obj->homepage);
418
-			if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
418
+			if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
419 419
 			{
420 420
 				$obj->homepage = 'http://'.$obj->homepage;
421 421
 			}
422 422
 		}
423 423
 		
424
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
424
+		if ($obj->notify_message != 'Y') $obj->notify_message = 'N';
425 425
 		
426 426
 		// can modify regdate only manager
427 427
                 $grant = Context::get('grant');
428
-		if(!$grant->manager)
428
+		if (!$grant->manager)
429 429
 		{
430 430
 			unset($obj->regdate);
431 431
 		}
432 432
 		
433 433
 		// Serialize the $extra_vars
434
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
434
+		if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
435 435
 		// Remove the columns for automatic saving
436 436
 		unset($obj->_saved_doc_srl);
437 437
 		unset($obj->_saved_doc_title);
@@ -440,23 +440,23 @@  discard block
 block discarded – undo
440 440
 
441 441
 		$oDocumentModel = getModel('document');
442 442
 		// Set the category_srl to 0 if the changed category is not exsiting.
443
-		if($source_obj->get('category_srl')!=$obj->category_srl)
443
+		if ($source_obj->get('category_srl') != $obj->category_srl)
444 444
 		{
445 445
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
446
-			if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
446
+			if (!$category_list[$obj->category_srl]) $obj->category_srl = 0;
447 447
 		}
448 448
 		// Change the update order
449 449
 		$obj->update_order = getNextSequence() * -1;
450 450
 		// Hash the password if it exists
451
-		if($obj->password)
451
+		if ($obj->password)
452 452
 		{
453 453
 			$obj->password = getModel('member')->hashPassword($obj->password);
454 454
 		}
455 455
 
456 456
 		// If an author is identical to the modifier or history is used, use the logged-in user's information.
457
-		if(Context::get('is_logged') && !$manual_updated)
457
+		if (Context::get('is_logged') && !$manual_updated)
458 458
 		{
459
-			if($source_obj->get('member_srl')==$logged_info->member_srl)
459
+			if ($source_obj->get('member_srl') == $logged_info->member_srl)
460 460
 			{
461 461
 				$obj->member_srl = $logged_info->member_srl;
462 462
 				$obj->user_name = htmlspecialchars_decode($logged_info->user_name);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		}
468 468
 
469 469
 		// For the document written by logged-in user however no nick_name exists
470
-		if($source_obj->get('member_srl')&& !$obj->nick_name)
470
+		if ($source_obj->get('member_srl') && !$obj->nick_name)
471 471
 		{
472 472
 			$obj->member_srl = $source_obj->get('member_srl');
473 473
 			$obj->user_name = $source_obj->get('user_name');
@@ -478,24 +478,24 @@  discard block
 block discarded – undo
478 478
 		// If the tile is empty, extract string from the contents.
479 479
 		$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
480 480
 		settype($obj->title, "string");
481
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
481
+		if ($obj->title == '') $obj->title = cut_str(strip_tags($obj->content), 20, '...');
482 482
 		// If no tile extracted from the contents, leave it untitled.
483
-		if($obj->title == '') $obj->title = 'Untitled';
483
+		if ($obj->title == '') $obj->title = 'Untitled';
484 484
 		// Remove XE's own tags from the contents.
485 485
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
486
-		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
486
+		if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
487 487
 		{
488
-			if($obj->use_html != 'Y')
488
+			if ($obj->use_html != 'Y')
489 489
 			{
490 490
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
491 491
 			}
492 492
 			$obj->content = nl2br($obj->content);
493 493
 		}
494 494
 		// Change not extra vars but language code of the original document if document's lang_code is different from author's setting.
495
-		if($source_obj->get('lang_code') != Context::getLangType())
495
+		if ($source_obj->get('lang_code') != Context::getLangType())
496 496
 		{
497 497
 			// Change not extra vars but language code of the original document if document's lang_code doesn't exist.
498
-			if(!$source_obj->get('lang_code'))
498
+			if (!$source_obj->get('lang_code'))
499 499
 			{
500 500
 				$lang_code_args->document_srl = $source_obj->get('document_srl');
501 501
 				$lang_code_args->lang_code = Context::getLangType();
@@ -515,59 +515,59 @@  discard block
 block discarded – undo
515 515
 			}
516 516
 		}
517 517
 		// Remove iframe and script if not a top adminisrator in the session.
518
-		if($logged_info->is_admin != 'Y')
518
+		if ($logged_info->is_admin != 'Y')
519 519
 		{
520 520
 			$obj->content = removeHackTag($obj->content);
521 521
 		}
522 522
 		// if temporary document, regdate is now setting
523
-		if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
523
+		if ($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
524 524
 
525 525
 		// Insert data into the DB
526 526
 		$output = executeQuery('document.updateDocument', $obj);
527
-		if(!$output->toBool())
527
+		if (!$output->toBool())
528 528
 		{
529 529
 			$oDB->rollback();
530 530
 			return $output;
531 531
 		}
532 532
 		// Remove all extra variables
533
-		if(Context::get('act')!='procFileDelete')
533
+		if (Context::get('act') != 'procFileDelete')
534 534
 		{
535 535
 			$this->deleteDocumentExtraVars($source_obj->get('module_srl'), $obj->document_srl, null, Context::getLangType());
536 536
 			// Insert extra variables if the document successfully inserted.
537 537
 			$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
538
-			if(count($extra_keys))
538
+			if (count($extra_keys))
539 539
 			{
540
-				foreach($extra_keys as $idx => $extra_item)
540
+				foreach ($extra_keys as $idx => $extra_item)
541 541
 				{
542 542
 					$value = NULL;
543
-					if(isset($obj->{'extra_vars'.$idx}))
543
+					if (isset($obj->{'extra_vars'.$idx}))
544 544
 					{
545 545
 						$tmp = $obj->{'extra_vars'.$idx};
546
-						if(is_array($tmp))
546
+						if (is_array($tmp))
547 547
 							$value = implode('|@|', $tmp);
548 548
 						else
549 549
 							$value = trim($tmp);
550 550
 					}
551
-					else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
552
-					if($value == NULL) continue;
551
+					else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
552
+					if ($value == NULL) continue;
553 553
 					$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
554 554
 				}
555 555
 			}
556 556
 			// Inert extra vars for multi-language support of title and contents.
557
-			if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
558
-			if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
557
+			if ($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
558
+			if ($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
559 559
 		}
560 560
 		// Update the category if the category_srl exists.
561
-		if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
561
+		if ($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
562 562
 		{
563
-			if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
564
-			if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
563
+			if ($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
564
+			if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
565 565
 		}
566 566
 		// Call a trigger (after)
567
-		if($output->toBool())
567
+		if ($output->toBool())
568 568
 		{
569 569
 			$trigger_output = ModuleHandler::triggerCall('document.updateDocument', 'after', $obj);
570
-			if(!$trigger_output->toBool())
570
+			if (!$trigger_output->toBool())
571 571
 			{
572 572
 				$oDB->rollback();
573 573
 				return $trigger_output;
@@ -577,15 +577,15 @@  discard block
 block discarded – undo
577 577
 		// commit
578 578
 		$oDB->commit();
579 579
 		// Remove the thumbnail file
580
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
580
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
581 581
 
582
-		$output->add('document_srl',$obj->document_srl);
582
+		$output->add('document_srl', $obj->document_srl);
583 583
 		//remove from cache
584 584
 		$oCacheHandler = CacheHandler::getInstance('object');
585
-		if($oCacheHandler->isSupport())
585
+		if ($oCacheHandler->isSupport())
586 586
 		{
587 587
 			//remove document item from cache
588
-			$cache_key = 'document_item:'. getNumberingPath($obj->document_srl) . $obj->document_srl;
588
+			$cache_key = 'document_item:'.getNumberingPath($obj->document_srl).$obj->document_srl;
589 589
 			$oCacheHandler->delete($cache_key);
590 590
 		}
591 591
 
@@ -606,33 +606,33 @@  discard block
 block discarded – undo
606 606
 		$trigger_obj = new stdClass();
607 607
 		$trigger_obj->document_srl = $document_srl;
608 608
 		$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
609
-		if(!$output->toBool()) return $output;
609
+		if (!$output->toBool()) return $output;
610 610
 
611 611
 		// begin transaction
612 612
 		$oDB = &DB::getInstance();
613 613
 		$oDB->begin();
614 614
 
615
-		if(!$isEmptyTrash)
615
+		if (!$isEmptyTrash)
616 616
 		{
617 617
 			// get model object of the document
618 618
 			$oDocumentModel = getModel('document');
619 619
 			// Check if the documnet exists
620 620
 			$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
621 621
 		}
622
-		else if($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists');
622
+		else if ($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists');
623 623
 
624
-		if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
624
+		if (!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
625 625
 		// Check if a permossion is granted
626
-		if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
626
+		if (!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
627 627
 
628 628
 		//if empty trash, document already deleted, therefore document not delete
629 629
 		$args = new stdClass();
630 630
 		$args->document_srl = $document_srl;
631
-		if(!$isEmptyTrash)
631
+		if (!$isEmptyTrash)
632 632
 		{
633 633
 			// Delete the document
634 634
 			$output = executeQuery('document.deleteDocument', $args);
635
-			if(!$output->toBool())
635
+			if (!$output->toBool())
636 636
 			{
637 637
 				$oDB->rollback();
638 638
 				return $output;
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 
644 644
 		$this->deleteDocumentHistory(null, $document_srl, null);
645 645
 		// Update category information if the category_srl exists.
646
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
646
+		if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl'));
647 647
 		// Delete a declared list
648 648
 		executeQuery('document.deleteDeclared', $args);
649 649
 		// Delete extra variable
@@ -651,11 +651,11 @@  discard block
 block discarded – undo
651 651
 
652 652
 		//this
653 653
 		// Call a trigger (after)
654
-		if($output->toBool())
654
+		if ($output->toBool())
655 655
 		{
656 656
 			$trigger_obj = $oDocument->getObjectVars();
657 657
 			$trigger_output = ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj);
658
-			if(!$trigger_output->toBool())
658
+			if (!$trigger_output->toBool())
659 659
 			{
660 660
 				$oDB->rollback();
661 661
 				return $trigger_output;
@@ -667,16 +667,16 @@  discard block
 block discarded – undo
667 667
 		$this->_deleteDocumentVotedLog($args);
668 668
 
669 669
 		// Remove the thumbnail file
670
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($document_srl, 3)));
670
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($document_srl, 3)));
671 671
 
672 672
 		// commit
673 673
 		$oDB->commit();
674 674
 
675 675
 		//remove from cache
676 676
 		$oCacheHandler = CacheHandler::getInstance('object');
677
-		if($oCacheHandler->isSupport())
677
+		if ($oCacheHandler->isSupport())
678 678
 		{
679
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
679
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
680 680
 			$oCacheHandler->delete($cache_key);
681 681
 		}
682 682
 
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	{
724 724
 		$trash_args = new stdClass();
725 725
 		// Get trash_srl if a given trash_srl doesn't exist
726
-		if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
726
+		if (!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
727 727
 		else $trash_args->trash_srl = $obj->trash_srl;
728 728
 		// Get its module_srl which the document belongs to
729 729
 		$oDocumentModel = getModel('document');
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
 		$trash_args->module_srl = $oDocument->get('module_srl');
733 733
 		$obj->module_srl = $oDocument->get('module_srl');
734 734
 		// Cannot throw data from the trash to the trash
735
-		if($trash_args->module_srl == 0) return false;
735
+		if ($trash_args->module_srl == 0) return false;
736 736
 		// Data setting
737 737
 		$trash_args->document_srl = $obj->document_srl;
738 738
 		$trash_args->description = $obj->description;
739 739
 		// Insert member's information only if the member is logged-in and not manually registered.
740
-		if(Context::get('is_logged')&&!$manual_inserted)
740
+		if (Context::get('is_logged') && !$manual_inserted)
741 741
 		{
742 742
 			$logged_info = Context::get('logged_info');
743 743
 			$trash_args->member_srl = $logged_info->member_srl;
@@ -773,14 +773,14 @@  discard block
 block discarded – undo
773 773
 
774 774
 		$oTrashAdminController = getAdminController('trash');
775 775
 		$output = $oTrashAdminController->insertTrash($oTrashVO);
776
-		if(!$output->toBool())
776
+		if (!$output->toBool())
777 777
 		{
778 778
 			$oDB->rollback();
779 779
 			return $output;
780 780
 		}
781 781
 
782 782
 		$output = executeQuery('document.deleteDocument', $trash_args);
783
-		if(!$output->toBool())
783
+		if (!$output->toBool())
784 784
 		{
785 785
 			$oDB->rollback();
786 786
 			return $output;
@@ -793,12 +793,12 @@  discard block
 block discarded – undo
793 793
 		  }*/
794 794
 
795 795
 		// update category
796
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
796
+		if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl'));
797 797
 
798 798
 		// remove thumbnails
799
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
799
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
800 800
 		// Set the attachment to be invalid state
801
-		if($oDocument->hasUploadedFiles())
801
+		if ($oDocument->hasUploadedFiles())
802 802
 		{
803 803
 			$args = new stdClass();
804 804
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -806,10 +806,10 @@  discard block
 block discarded – undo
806 806
 			executeQuery('file.updateFileValid', $args);
807 807
 		}
808 808
 		// Call a trigger (after)
809
-		if($output->toBool())
809
+		if ($output->toBool())
810 810
 		{
811 811
 			$trigger_output = ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj);
812
-			if(!$trigger_output->toBool())
812
+			if (!$trigger_output->toBool())
813 813
 			{
814 814
 				$oDB->rollback();
815 815
 				return $trigger_output;
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 
822 822
 		// Clear cache
823 823
 		$oCacheHandler = CacheHandler::getInstance('object');
824
-		if($oCacheHandler->isSupport())
824
+		if ($oCacheHandler->isSupport())
825 825
 		{
826
-			$cache_key = 'document_item:'. getNumberingPath($oDocument->document_srl) . $oDocument->document_srl;
826
+			$cache_key = 'document_item:'.getNumberingPath($oDocument->document_srl).$oDocument->document_srl;
827 827
 			$oCacheHandler->delete($cache_key);
828 828
 		}
829 829
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 	function updateReadedCount(&$oDocument)
839 839
 	{
840 840
 		// Pass if Crawler access
841
-		if(isCrawler()) return false;
841
+		if (isCrawler()) return false;
842 842
 		
843 843
 		$document_srl = $oDocument->document_srl;
844 844
 		$member_srl = $oDocument->get('member_srl');
@@ -846,19 +846,19 @@  discard block
 block discarded – undo
846 846
 
847 847
 		// Call a trigger when the read count is updated (before)
848 848
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
849
-		if(!$trigger_output->toBool()) return $trigger_output;
849
+		if (!$trigger_output->toBool()) return $trigger_output;
850 850
 
851 851
 		// Pass if read count is increaded on the session information
852
-		if($_SESSION['readed_document'][$document_srl]) return false;
852
+		if ($_SESSION['readed_document'][$document_srl]) return false;
853 853
 
854 854
 		// Pass if the author's IP address is as same as visitor's.
855
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
855
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
856 856
 		{
857 857
 			$_SESSION['readed_document'][$document_srl] = true;
858 858
 			return false;
859 859
 		}
860 860
 		// Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
861
-		if($member_srl && $logged_info->member_srl == $member_srl)
861
+		if ($member_srl && $logged_info->member_srl == $member_srl)
862 862
 		{
863 863
 			$_SESSION['readed_document'][$document_srl] = true;
864 864
 			return false;
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 
875 875
 		// Call a trigger when the read count is updated (after)
876 876
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
877
-		if(!$trigger_output->toBool())
877
+		if (!$trigger_output->toBool())
878 878
 		{
879 879
 			$oDB->rollback();
880 880
 			return $trigger_output;
@@ -883,15 +883,15 @@  discard block
 block discarded – undo
883 883
 		$oDB->commit();
884 884
 
885 885
 		$oCacheHandler = CacheHandler::getInstance('object');
886
-		if($oCacheHandler->isSupport())
886
+		if ($oCacheHandler->isSupport())
887 887
 		{
888 888
 			//remove document item from cache
889
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
889
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
890 890
 			$oCacheHandler->delete($cache_key);
891 891
 		}
892 892
 
893 893
 		// Register session
894
-		if(!$_SESSION['banned_document'][$document_srl]) 
894
+		if (!$_SESSION['banned_document'][$document_srl]) 
895 895
 		{
896 896
 			$_SESSION['readed_document'][$document_srl] = true;
897 897
 		}
@@ -914,21 +914,21 @@  discard block
 block discarded – undo
914 914
 	 */
915 915
 	function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid)
916 916
 	{
917
-		if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request');
917
+		if (!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1, 'msg_invalid_request');
918 918
 
919 919
 		$obj = new stdClass();
920 920
 		$obj->module_srl = $module_srl;
921 921
 		$obj->var_idx = $var_idx;
922 922
 		$obj->var_name = $var_name;
923 923
 		$obj->var_type = $var_type;
924
-		$obj->var_is_required = $var_is_required=='Y'?'Y':'N';
925
-		$obj->var_search = $var_search=='Y'?'Y':'N';
924
+		$obj->var_is_required = $var_is_required == 'Y' ? 'Y' : 'N';
925
+		$obj->var_search = $var_search == 'Y' ? 'Y' : 'N';
926 926
 		$obj->var_default = $var_default;
927 927
 		$obj->var_desc = $var_desc;
928 928
 		$obj->eid = $eid;
929 929
 
930 930
 		$output = executeQuery('document.getDocumentExtraKeys', $obj);
931
-		if(!$output->data)
931
+		if (!$output->data)
932 932
 		{
933 933
 			$output = executeQuery('document.insertDocumentExtraKey', $obj);
934 934
 		}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		}
941 941
 
942 942
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
943
-		if($oCacheHandler->isSupport())
943
+		if ($oCacheHandler->isSupport())
944 944
 		{
945 945
 			$object_key = 'module_document_extra_keys:'.$module_srl;
946 946
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -958,42 +958,42 @@  discard block
 block discarded – undo
958 958
 	 */
959 959
 	function deleteDocumentExtraKeys($module_srl, $var_idx = null)
960 960
 	{
961
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
961
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
962 962
 		$obj = new stdClass();
963 963
 		$obj->module_srl = $module_srl;
964
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
964
+		if (!is_null($var_idx)) $obj->var_idx = $var_idx;
965 965
 
966 966
 		$oDB = DB::getInstance();
967 967
 		$oDB->begin();
968 968
 
969 969
 		$output = $oDB->executeQuery('document.deleteDocumentExtraKeys', $obj);
970
-		if(!$output->toBool())
970
+		if (!$output->toBool())
971 971
 		{
972 972
 			$oDB->rollback();
973 973
 			return $output;
974 974
 		}
975 975
 
976
-		if($var_idx != NULL)
976
+		if ($var_idx != NULL)
977 977
 		{
978 978
 			$output = $oDB->executeQuery('document.updateDocumentExtraKeyIdxOrder', $obj);
979
-			if(!$output->toBool())
979
+			if (!$output->toBool())
980 980
 			{
981 981
 				$oDB->rollback();
982 982
 				return $output;
983 983
 			}
984 984
 		}
985 985
 
986
-		$output =  executeQuery('document.deleteDocumentExtraVars', $obj);
987
-		if(!$output->toBool())
986
+		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
987
+		if (!$output->toBool())
988 988
 		{
989 989
 			$oDB->rollback();
990 990
 			return $output;
991 991
 		}
992 992
 
993
-		if($var_idx != NULL)
993
+		if ($var_idx != NULL)
994 994
 		{
995 995
 			$output = $oDB->executeQuery('document.updateDocumentExtraVarIdxOrder', $obj);
996
-			if(!$output->toBool())
996
+			if (!$output->toBool())
997 997
 			{
998 998
 				$oDB->rollback();
999 999
 				return $output;
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 		$oDB->commit();
1004 1004
 
1005 1005
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
1006
-		if($oCacheHandler->isSupport())
1006
+		if ($oCacheHandler->isSupport())
1007 1007
 		{
1008 1008
 			$object_key = 'module_document_extra_keys:'.$module_srl;
1009 1009
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
 	 */
1026 1026
 	function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '')
1027 1027
 	{
1028
-		if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request');
1029
-		if(!$lang_code) $lang_code = Context::getLangType();
1028
+		if (!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1, 'msg_invalid_request');
1029
+		if (!$lang_code) $lang_code = Context::getLangType();
1030 1030
 
1031 1031
 		$obj = new stdClass;
1032 1032
 		$obj->module_srl = $module_srl;
@@ -1052,10 +1052,10 @@  discard block
 block discarded – undo
1052 1052
 	{
1053 1053
 		$obj = new stdClass();
1054 1054
 		$obj->module_srl = $module_srl;
1055
-		if(!is_null($document_srl)) $obj->document_srl = $document_srl;
1056
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1057
-		if(!is_null($lang_code)) $obj->lang_code = $lang_code;
1058
-		if(!is_null($eid)) $obj->eid = $eid;
1055
+		if (!is_null($document_srl)) $obj->document_srl = $document_srl;
1056
+		if (!is_null($var_idx)) $obj->var_idx = $var_idx;
1057
+		if (!is_null($lang_code)) $obj->lang_code = $lang_code;
1058
+		if (!is_null($eid)) $obj->eid = $eid;
1059 1059
 		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
1060 1060
 		return $output;
1061 1061
 	}
@@ -1069,10 +1069,10 @@  discard block
 block discarded – undo
1069 1069
 	 */
1070 1070
 	function updateVotedCount($document_srl, $point = 1)
1071 1071
 	{
1072
-		if($point > 0) $failed_voted = 'failed_voted';
1072
+		if ($point > 0) $failed_voted = 'failed_voted';
1073 1073
 		else $failed_voted = 'failed_blamed';
1074 1074
 		// Return fail if session already has information about votes
1075
-		if($_SESSION['voted_document'][$document_srl])
1075
+		if ($_SESSION['voted_document'][$document_srl])
1076 1076
 		{
1077 1077
 			return new Object(-1, $failed_voted);
1078 1078
 		}
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 		$oDocumentModel = getModel('document');
1081 1081
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
1082 1082
 		// Pass if the author's IP address is as same as visitor's.
1083
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1083
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1084 1084
 		{
1085 1085
 			$_SESSION['voted_document'][$document_srl] = true;
1086 1086
 			return new Object(-1, $failed_voted);
@@ -1091,10 +1091,10 @@  discard block
 block discarded – undo
1091 1091
 		$member_srl = $oMemberModel->getLoggedMemberSrl();
1092 1092
 
1093 1093
 		// Check if document's author is a member.
1094
-		if($oDocument->get('member_srl'))
1094
+		if ($oDocument->get('member_srl'))
1095 1095
 		{
1096 1096
 			// Pass after registering a session if author's information is same as the currently logged-in user's.
1097
-			if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1097
+			if ($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1098 1098
 			{
1099 1099
 				$_SESSION['voted_document'][$document_srl] = true;
1100 1100
 				return new Object(-1, $failed_voted);
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
 		// Use member_srl for logged-in members and IP address for non-members.
1105 1105
 		$args = new stdClass;
1106
-		if($member_srl)
1106
+		if ($member_srl)
1107 1107
 		{
1108 1108
 			$args->member_srl = $member_srl;
1109 1109
 		}
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 		$args->document_srl = $document_srl;
1115 1115
 		$output = executeQuery('document.getDocumentVotedLogInfo', $args);
1116 1116
 		// Pass after registering a session if log information has vote-up logs
1117
-		if($output->data->count)
1117
+		if ($output->data->count)
1118 1118
 		{
1119 1119
 			$_SESSION['voted_document'][$document_srl] = true;
1120 1120
 			return new Object(-1, $failed_voted);
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 		$oDB->begin();
1126 1126
 
1127 1127
 		// Update the voted count
1128
-		if($point < 0)
1128
+		if ($point < 0)
1129 1129
 		{
1130 1130
 			$args->blamed_count = $oDocument->get('blamed_count') + $point;
1131 1131
 			$output = executeQuery('document.updateBlamedCount', $args);
@@ -1135,11 +1135,11 @@  discard block
 block discarded – undo
1135 1135
 			$args->voted_count = $oDocument->get('voted_count') + $point;
1136 1136
 			$output = executeQuery('document.updateVotedCount', $args);
1137 1137
 		}
1138
-		if(!$output->toBool()) return $output;
1138
+		if (!$output->toBool()) return $output;
1139 1139
 		// Leave logs
1140 1140
 		$args->point = $point;
1141 1141
 		$output = executeQuery('document.insertDocumentVotedLog', $args);
1142
-		if(!$output->toBool()) return $output;
1142
+		if (!$output->toBool()) return $output;
1143 1143
 
1144 1144
 		$obj = new stdClass;
1145 1145
 		$obj->member_srl = $oDocument->get('member_srl');
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 		$obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count');
1151 1151
 		$obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count;
1152 1152
 		$trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj);
1153
-		if(!$trigger_output->toBool())
1153
+		if (!$trigger_output->toBool())
1154 1154
 		{
1155 1155
 			$oDB->rollback();
1156 1156
 			return $trigger_output;
@@ -1159,10 +1159,10 @@  discard block
 block discarded – undo
1159 1159
 		$oDB->commit();
1160 1160
 
1161 1161
 		$oCacheHandler = CacheHandler::getInstance('object');
1162
-		if($oCacheHandler->isSupport())
1162
+		if ($oCacheHandler->isSupport())
1163 1163
 		{
1164 1164
 			//remove document item from cache
1165
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1165
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
1166 1166
 			$oCacheHandler->delete($cache_key);
1167 1167
 		}
1168 1168
 
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 
1172 1172
 		// Return result
1173 1173
 		$output = new Object();
1174
-		if($point > 0)
1174
+		if ($point > 0)
1175 1175
 		{
1176 1176
 			$output->setMessage('success_voted');
1177 1177
 			$output->add('voted_count', $obj->after_point);
@@ -1193,13 +1193,13 @@  discard block
 block discarded – undo
1193 1193
 	function declaredDocument($document_srl)
1194 1194
 	{
1195 1195
 		// Fail if session information already has a reported document
1196
-		if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
1196
+		if ($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
1197 1197
 
1198 1198
 		// Check if previously reported
1199 1199
 		$args = new stdClass();
1200 1200
 		$args->document_srl = $document_srl;
1201 1201
 		$output = executeQuery('document.getDeclaredDocument', $args);
1202
-		if(!$output->toBool()) return $output;
1202
+		if (!$output->toBool()) return $output;
1203 1203
 
1204 1204
 		$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
1205 1205
 
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 		// Call a trigger (before)
1211 1211
 		$trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'before', $trigger_obj);
1212
-		if(!$trigger_output->toBool())
1212
+		if (!$trigger_output->toBool())
1213 1213
 		{
1214 1214
 			return $trigger_output;
1215 1215
 		}
@@ -1219,19 +1219,19 @@  discard block
 block discarded – undo
1219 1219
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
1220 1220
 
1221 1221
 		// Pass if the author's IP address is as same as visitor's.
1222
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
1222
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
1223 1223
 			$_SESSION['declared_document'][$document_srl] = true;
1224 1224
 			return new Object(-1, 'failed_declared');
1225 1225
 		}
1226 1226
 
1227 1227
 		// Check if document's author is a member.
1228
-		if($oDocument->get('member_srl'))
1228
+		if ($oDocument->get('member_srl'))
1229 1229
 		{
1230 1230
 			// Create a member model object
1231 1231
 			$oMemberModel = getModel('member');
1232 1232
 			$member_srl = $oMemberModel->getLoggedMemberSrl();
1233 1233
 			// Pass after registering a session if author's information is same as the currently logged-in user's.
1234
-			if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1234
+			if ($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1235 1235
 			{
1236 1236
 				$_SESSION['declared_document'][$document_srl] = true;
1237 1237
 				return new Object(-1, 'failed_declared');
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
 		// Use member_srl for logged-in members and IP address for non-members.
1242 1242
 		$args = new stdClass;
1243
-		if($member_srl)
1243
+		if ($member_srl)
1244 1244
 		{
1245 1245
 			$args->member_srl = $member_srl;
1246 1246
 		}
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 		$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
1254 1254
 
1255 1255
 		// Pass after registering a sesson if reported/declared documents are in the logs.
1256
-		if($output->data->count)
1256
+		if ($output->data->count)
1257 1257
 		{
1258 1258
 			$_SESSION['declared_document'][$document_srl] = true;
1259 1259
 			return new Object(-1, 'failed_declared');
@@ -1264,23 +1264,23 @@  discard block
 block discarded – undo
1264 1264
 		$oDB->begin();
1265 1265
 
1266 1266
 		// Add the declared document
1267
-		if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1267
+		if ($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1268 1268
 		else $output = executeQuery('document.insertDeclaredDocument', $args);
1269
-		if(!$output->toBool()) return $output;
1269
+		if (!$output->toBool()) return $output;
1270 1270
 		// Leave logs
1271 1271
 		$output = executeQuery('document.insertDocumentDeclaredLog', $args);
1272
-		if(!$output->toBool())
1272
+		if (!$output->toBool())
1273 1273
 		{
1274 1274
 			$oDB->rollback();
1275 1275
 			return $output;
1276 1276
 		}
1277 1277
 
1278
-		$this->add('declared_count', $declared_count+1);
1278
+		$this->add('declared_count', $declared_count + 1);
1279 1279
 
1280 1280
 		// Call a trigger (after)
1281 1281
 		$trigger_obj->declared_count = $declared_count + 1;
1282 1282
 		$trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'after', $trigger_obj);
1283
-		if(!$trigger_output->toBool())
1283
+		if (!$trigger_output->toBool())
1284 1284
 		{
1285 1285
 			$oDB->rollback();
1286 1286
 			return $trigger_output;
@@ -1310,16 +1310,16 @@  discard block
 block discarded – undo
1310 1310
 		$args->document_srl = $document_srl;
1311 1311
 		$args->comment_count = $comment_count;
1312 1312
 
1313
-		if($comment_inserted)
1313
+		if ($comment_inserted)
1314 1314
 		{
1315
-			$args->update_order = -1*getNextSequence();
1315
+			$args->update_order = -1 * getNextSequence();
1316 1316
 			$args->last_updater = $last_updater;
1317 1317
 
1318 1318
 			$oCacheHandler = CacheHandler::getInstance('object');
1319
-			if($oCacheHandler->isSupport())
1319
+			if ($oCacheHandler->isSupport())
1320 1320
 			{
1321 1321
 				//remove document item from cache
1322
-				$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1322
+				$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
1323 1323
 				$oCacheHandler->delete($cache_key);
1324 1324
 			}
1325 1325
 		}
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 		$args->trackback_count = $trackback_count;
1341 1341
 
1342 1342
 		$oCacheHandler = CacheHandler::getInstance('object');
1343
-		if($oCacheHandler->isSupport())
1343
+		if ($oCacheHandler->isSupport())
1344 1344
 		{
1345 1345
 			//remove document item from cache
1346
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1346
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
1347 1347
 			$oCacheHandler->delete($cache_key);
1348 1348
 		}
1349 1349
 
@@ -1358,14 +1358,14 @@  discard block
 block discarded – undo
1358 1358
 	function insertCategory($obj)
1359 1359
 	{
1360 1360
 		// Sort the order to display if a child category is added
1361
-		if($obj->parent_srl)
1361
+		if ($obj->parent_srl)
1362 1362
 		{
1363 1363
 			// Get its parent category
1364 1364
 			$oDocumentModel = getModel('document');
1365 1365
 			$parent_category = $oDocumentModel->getCategory($obj->parent_srl);
1366 1366
 			$obj->list_order = $parent_category->list_order;
1367
-			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1);
1368
-			if(!$obj->category_srl) $obj->category_srl = getNextSequence();
1367
+			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order + 1);
1368
+			if (!$obj->category_srl) $obj->category_srl = getNextSequence();
1369 1369
 		}
1370 1370
 		else
1371 1371
 		{
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 		}
1374 1374
 
1375 1375
 		$output = executeQuery('document.insertCategory', $obj);
1376
-		if($output->toBool())
1376
+		if ($output->toBool())
1377 1377
 		{
1378 1378
 			$output->add('category_srl', $obj->category_srl);
1379 1379
 			$this->makeCategoryFile($obj->module_srl);
@@ -1407,13 +1407,13 @@  discard block
 block discarded – undo
1407 1407
 	{
1408 1408
 		// Create a document model object
1409 1409
 		$oDocumentModel = getModel('document');
1410
-		if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
1410
+		if (!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl, $category_srl);
1411 1411
 
1412 1412
 		$args = new stdClass;
1413 1413
 		$args->category_srl = $category_srl;
1414 1414
 		$args->document_count = $document_count;
1415 1415
 		$output = executeQuery('document.updateCategoryCount', $args);
1416
-		if($output->toBool()) $this->makeCategoryFile($module_srl);
1416
+		if ($output->toBool()) $this->makeCategoryFile($module_srl);
1417 1417
 
1418 1418
 		return $output;
1419 1419
 	}
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 	function updateCategory($obj)
1427 1427
 	{
1428 1428
 		$output = executeQuery('document.updateCategory', $obj);
1429
-		if($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1429
+		if ($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1430 1430
 		return $output;
1431 1431
 	}
1432 1432
 
@@ -1443,32 +1443,32 @@  discard block
 block discarded – undo
1443 1443
 		$category_info = $oDocumentModel->getCategory($category_srl);
1444 1444
 		// Display an error that the category cannot be deleted if it has a child
1445 1445
 		$output = executeQuery('document.getChildCategoryCount', $args);
1446
-		if(!$output->toBool()) return $output;
1447
-		if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child');
1446
+		if (!$output->toBool()) return $output;
1447
+		if ($output->data->count > 0) return new Object(-1, 'msg_cannot_delete_for_child');
1448 1448
 		// Delete a category information
1449 1449
 		$output = executeQuery('document.deleteCategory', $args);
1450
-		if(!$output->toBool()) return $output;
1450
+		if (!$output->toBool()) return $output;
1451 1451
 
1452 1452
 		$this->makeCategoryFile($category_info->module_srl);
1453 1453
 		// remvove cache
1454 1454
 		$oCacheHandler = CacheHandler::getInstance('object');
1455
-		if($oCacheHandler->isSupport())
1455
+		if ($oCacheHandler->isSupport())
1456 1456
 		{
1457 1457
 			$page = 0;
1458
-			while(true) {
1458
+			while (true) {
1459 1459
 				$args = new stdClass();
1460 1460
 				$args->category_srl = $category_srl;
1461 1461
 				$args->list_count = 100;
1462 1462
 				$args->page = ++$page;
1463 1463
 				$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
1464 1464
 
1465
-				if($output->data == array())
1465
+				if ($output->data == array())
1466 1466
 					break;
1467 1467
 
1468
-				foreach($output->data as $val)
1468
+				foreach ($output->data as $val)
1469 1469
 				{
1470 1470
 					//remove document item from cache
1471
-					$cache_key = 'document_item:'. getNumberingPath($val->document_srl) . $val->document_srl;
1471
+					$cache_key = 'document_item:'.getNumberingPath($val->document_srl).$val->document_srl;
1472 1472
 					$oCacheHandler->delete($cache_key);
1473 1473
 				}
1474 1474
 			}
@@ -1515,18 +1515,18 @@  discard block
 block discarded – undo
1515 1515
 		// Seek a full list of categories
1516 1516
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1517 1517
 		$category_srl_list = array_keys($category_list);
1518
-		if(count($category_srl_list)<2) return new Object();
1518
+		if (count($category_srl_list) < 2) return new Object();
1519 1519
 
1520 1520
 		$prev_category = NULL;
1521
-		foreach($category_list as $key => $val)
1521
+		foreach ($category_list as $key => $val)
1522 1522
 		{
1523
-			if($key==$category_srl) break;
1523
+			if ($key == $category_srl) break;
1524 1524
 			$prev_category = $val;
1525 1525
 		}
1526 1526
 		// Return if the previous category doesn't exist
1527
-		if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved'));
1527
+		if (!$prev_category) return new Object(-1, Context::getLang('msg_category_not_moved'));
1528 1528
 		// Return if the selected category is the top level
1529
-		if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved'));
1529
+		if ($category_srl_list[0] == $category_srl) return new Object(-1, Context::getLang('msg_category_not_moved'));
1530 1530
 		// Information of the selected category
1531 1531
 		$cur_args = new stdClass;
1532 1532
 		$cur_args->category_srl = $category_srl;
@@ -1562,15 +1562,15 @@  discard block
 block discarded – undo
1562 1562
 		// Seek a full list of categories
1563 1563
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1564 1564
 		$category_srl_list = array_keys($category_list);
1565
-		if(count($category_srl_list)<2) return new Object();
1565
+		if (count($category_srl_list) < 2) return new Object();
1566 1566
 
1567
-		for($i=0;$i<count($category_srl_list);$i++)
1567
+		for ($i = 0; $i < count($category_srl_list); $i++)
1568 1568
 		{
1569
-			if($category_srl_list[$i]==$category_srl) break;
1569
+			if ($category_srl_list[$i] == $category_srl) break;
1570 1570
 		}
1571 1571
 
1572
-		$next_category_srl = $category_srl_list[$i+1];
1573
-		if(!$category_list[$next_category_srl]) return new Object(-1,Context::getLang('msg_category_not_moved'));
1572
+		$next_category_srl = $category_srl_list[$i + 1];
1573
+		if (!$category_list[$next_category_srl]) return new Object(-1, Context::getLang('msg_category_not_moved'));
1574 1574
 		$next_category = $category_list[$next_category_srl];
1575 1575
 		// Information of the selected category
1576 1576
 		$cur_args = new stdClass;
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 	{
1598 1598
 		$oDocumentModel = getModel('document');
1599 1599
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
1600
-		if(!count($extra_keys)) return;
1600
+		if (!count($extra_keys)) return;
1601 1601
 
1602 1602
 		$js_code = array();
1603 1603
 		$js_code[] = '<script>//<![CDATA[';
@@ -1607,16 +1607,16 @@  discard block
 block discarded – undo
1607 1607
 
1608 1608
 		$logged_info = Context::get('logged_info');
1609 1609
 
1610
-		foreach($extra_keys as $idx => $val)
1610
+		foreach ($extra_keys as $idx => $val)
1611 1611
 		{
1612 1612
 			$idx = $val->idx;
1613
-			if($val->type == 'kr_zip')
1613
+			if ($val->type == 'kr_zip')
1614 1614
 			{
1615 1615
 				$idx .= '[]';
1616 1616
 			}
1617 1617
 			$name = str_ireplace(array('<script', '</script'), array('<scr" + "ipt', '</scr" + "ipt'), $val->name);
1618 1618
 			$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["extra_vars%s","%s"]);', $idx, $name);
1619
-			if($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1619
+			if ($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1620 1620
 		}
1621 1621
 
1622 1622
 		$js_code[] = '})(jQuery);';
@@ -1634,12 +1634,12 @@  discard block
 block discarded – undo
1634 1634
 	function procDocumentInsertCategory($args = null)
1635 1635
 	{
1636 1636
 		// List variables
1637
-		if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
1637
+		if (!$args) $args = Context::gets('module_srl', 'category_srl', 'parent_srl', 'category_title', 'category_description', 'expand', 'group_srls', 'category_color', 'mid');
1638 1638
 		$args->title = $args->category_title;
1639 1639
 		$args->description = $args->category_description;
1640 1640
 		$args->color = $args->category_color;
1641 1641
 
1642
-		if(!$args->module_srl && $args->mid)
1642
+		if (!$args->module_srl && $args->mid)
1643 1643
 		{
1644 1644
 			$mid = $args->mid;
1645 1645
 			unset($args->mid);
@@ -1650,28 +1650,28 @@  discard block
 block discarded – undo
1650 1650
 		$columnList = array('module_srl', 'module');
1651 1651
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1652 1652
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1653
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1653
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1654 1654
 
1655
-		if($args->expand !="Y") $args->expand = "N";
1656
-		if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls);
1655
+		if ($args->expand != "Y") $args->expand = "N";
1656
+		if (!is_array($args->group_srls)) $args->group_srls = str_replace('|@|', ',', $args->group_srls);
1657 1657
 		else $args->group_srls = implode(',', $args->group_srls);
1658
-		$args->parent_srl = (int)$args->parent_srl;
1658
+		$args->parent_srl = (int) $args->parent_srl;
1659 1659
 
1660 1660
 		$oDocumentModel = getModel('document');
1661 1661
 
1662 1662
 		$oDB = &DB::getInstance();
1663 1663
 		$oDB->begin();
1664 1664
 		// Check if already exists
1665
-		if($args->category_srl)
1665
+		if ($args->category_srl)
1666 1666
 		{
1667 1667
 			$category_info = $oDocumentModel->getCategory($args->category_srl);
1668
-			if($category_info->category_srl != $args->category_srl) $args->category_srl = null;
1668
+			if ($category_info->category_srl != $args->category_srl) $args->category_srl = null;
1669 1669
 		}
1670 1670
 		// Update if exists
1671
-		if($args->category_srl)
1671
+		if ($args->category_srl)
1672 1672
 		{
1673 1673
 			$output = $this->updateCategory($args);
1674
-			if(!$output->toBool())
1674
+			if (!$output->toBool())
1675 1675
 			{
1676 1676
 				$oDB->rollback();
1677 1677
 				return $output;
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
 		else
1682 1682
 		{
1683 1683
 			$output = $this->insertCategory($args);
1684
-			if(!$output->toBool())
1684
+			if (!$output->toBool())
1685 1685
 			{
1686 1686
 				$oDB->rollback();
1687 1687
 				return $output;
@@ -1720,11 +1720,11 @@  discard block
 block discarded – undo
1720 1720
 		$columnList = array('module_srl', 'module');
1721 1721
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList);
1722 1722
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1723
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1723
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1724 1724
 
1725 1725
 		// First child of the parent_category_srl
1726 1726
 		$source_args = new stdClass;
1727
-		if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0))
1727
+		if ($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0))
1728 1728
 		{
1729 1729
 			$parent_category = $oDocumentModel->getCategory($parent_category_srl);
1730 1730
 
@@ -1733,30 +1733,30 @@  discard block
 block discarded – undo
1733 1733
 			$args->parent_srl = $parent_category_srl;
1734 1734
 			$output = executeQuery('document.getChildCategoryMinListOrder', $args);
1735 1735
 
1736
-			if(!$output->toBool()) return $output;
1737
-			$args->list_order = (int)$output->data->list_order;
1738
-			if(!$args->list_order) $args->list_order = 0;
1736
+			if (!$output->toBool()) return $output;
1737
+			$args->list_order = (int) $output->data->list_order;
1738
+			if (!$args->list_order) $args->list_order = 0;
1739 1739
 			$args->list_order--;
1740 1740
 
1741 1741
 			$source_args->category_srl = $source_category_srl;
1742 1742
 			$source_args->parent_srl = $parent_category_srl;
1743 1743
 			$source_args->list_order = $args->list_order;
1744 1744
 			$output = $this->updateCategory($source_args);
1745
-			if(!$output->toBool()) return $output;
1745
+			if (!$output->toBool()) return $output;
1746 1746
 			// Sibling of the $target_category_srl
1747 1747
 		}
1748
-		else if($target_category_srl > 0)
1748
+		else if ($target_category_srl > 0)
1749 1749
 		{
1750 1750
 			$target_category = $oDocumentModel->getCategory($target_category_srl);
1751 1751
 			// Move all siblings of the $target_category down
1752
-			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1);
1753
-			if(!$output->toBool()) return $output;
1752
+			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order + 1);
1753
+			if (!$output->toBool()) return $output;
1754 1754
 
1755 1755
 			$source_args->category_srl = $source_category_srl;
1756 1756
 			$source_args->parent_srl = $target_category->parent_srl;
1757
-			$source_args->list_order = $target_category->list_order+1;
1757
+			$source_args->list_order = $target_category->list_order + 1;
1758 1758
 			$output = $this->updateCategory($source_args);
1759
-			if(!$output->toBool()) return $output;
1759
+			if (!$output->toBool()) return $output;
1760 1760
 		}
1761 1761
 		// Re-generate the xml file
1762 1762
 		$xml_file = $this->makeCategoryFile($source_category->module_srl);
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 	function procDocumentDeleteCategory()
1773 1773
 	{
1774 1774
 		// List variables
1775
-		$args = Context::gets('module_srl','category_srl');
1775
+		$args = Context::gets('module_srl', 'category_srl');
1776 1776
 
1777 1777
 		$oDB = &DB::getInstance();
1778 1778
 		$oDB->begin();
@@ -1781,17 +1781,17 @@  discard block
 block discarded – undo
1781 1781
 		$columnList = array('module_srl', 'module');
1782 1782
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1783 1783
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1784
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1784
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1785 1785
 
1786 1786
 		$oDocumentModel = getModel('document');
1787 1787
 		// Get original information
1788 1788
 		$category_info = $oDocumentModel->getCategory($args->category_srl);
1789
-		if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
1789
+		if ($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
1790 1790
 		// Display an error that the category cannot be deleted if it has a child node
1791
-		if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child');
1791
+		if ($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child');
1792 1792
 		// Remove from the DB
1793 1793
 		$output = $this->deleteCategory($args->category_srl);
1794
-		if(!$output->toBool())
1794
+		if (!$output->toBool())
1795 1795
 		{
1796 1796
 			$oDB->rollback();
1797 1797
 			return $output;
@@ -1822,11 +1822,11 @@  discard block
 block discarded – undo
1822 1822
 		$columnList = array('module_srl', 'module');
1823 1823
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1824 1824
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1825
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1825
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1826 1826
 
1827 1827
 		$xml_file = $this->makeCategoryFile($module_srl);
1828 1828
 		// Set return value
1829
-		$this->add('xml_file',$xml_file);
1829
+		$this->add('xml_file', $xml_file);
1830 1830
 	}
1831 1831
 
1832 1832
 	/**
@@ -1837,14 +1837,14 @@  discard block
 block discarded – undo
1837 1837
 	function makeCategoryFile($module_srl)
1838 1838
 	{
1839 1839
 		// Return if there is no information you need for creating a cache file
1840
-		if(!$module_srl) return false;
1840
+		if (!$module_srl) return false;
1841 1841
 		// Get module information (to obtain mid)
1842 1842
 		$oModuleModel = getModel('module');
1843 1843
 		$columnList = array('module_srl', 'mid', 'site_srl');
1844 1844
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1845 1845
 		$mid = $module_info->mid;
1846 1846
 
1847
-		if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
1847
+		if (!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
1848 1848
 		// Cache file's name
1849 1849
 		$xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl);
1850 1850
 		$php_file = sprintf("./files/cache/document_category/%s.php", $module_srl);
@@ -1856,17 +1856,17 @@  discard block
 block discarded – undo
1856 1856
 
1857 1857
 		$category_list = $output->data;
1858 1858
 
1859
-		if(!is_array($category_list)) $category_list = array($category_list);
1859
+		if (!is_array($category_list)) $category_list = array($category_list);
1860 1860
 
1861 1861
 		$category_count = count($category_list);
1862
-		for($i=0;$i<$category_count;$i++)
1862
+		for ($i = 0; $i < $category_count; $i++)
1863 1863
 		{
1864 1864
 			$category_srl = $category_list[$i]->category_srl;
1865
-			if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
1865
+			if (!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
1866 1866
 			$list[$category_srl] = $category_list[$i];
1867 1867
 		}
1868 1868
 		// Create the xml file without node data if no data is obtained
1869
-		if(!$list)
1869
+		if (!$list)
1870 1870
 		{
1871 1871
 			$xml_buff = "<root />";
1872 1872
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1874,12 +1874,12 @@  discard block
 block discarded – undo
1874 1874
 			return $xml_file;
1875 1875
 		}
1876 1876
 		// Change to an array if only a single data is obtained
1877
-		if(!is_array($list)) $list = array($list);
1877
+		if (!is_array($list)) $list = array($list);
1878 1878
 		// Create a tree for loop
1879
-		foreach($list as $category_srl => $node)
1879
+		foreach ($list as $category_srl => $node)
1880 1880
 		{
1881 1881
 			$node->mid = $mid;
1882
-			$parent_srl = (int)$node->parent_srl;
1882
+			$parent_srl = (int) $node->parent_srl;
1883 1883
 			$tree[$parent_srl][$category_srl] = $node;
1884 1884
 		}
1885 1885
 		// A common header to set permissions and groups of the cache file
@@ -1953,13 +1953,13 @@  discard block
 block discarded – undo
1953 1953
 	 */
1954 1954
 	function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff)
1955 1955
 	{
1956
-		if(!$source_node) return;
1956
+		if (!$source_node) return;
1957 1957
 
1958
-		foreach($source_node as $category_srl => $node)
1958
+		foreach ($source_node as $category_srl => $node)
1959 1959
 		{
1960 1960
 			$child_buff = "";
1961 1961
 			// Get data of the child nodes
1962
-			if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
1962
+			if ($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
1963 1963
 			// List variables
1964 1964
 			$expand = $node->expand;
1965 1965
 			$group_srls = $node->group_srls;
@@ -1969,27 +1969,27 @@  discard block
 block discarded – undo
1969 1969
 			$color = $node->color;
1970 1970
 			$description = $node->description;
1971 1971
 			// If node->group_srls value exists
1972
-			if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
1972
+			if ($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $group_srls);
1973 1973
 			else $group_check_code = "true";
1974 1974
 
1975 1975
 			$title = $node->title;
1976 1976
 			$oModuleAdminModel = getAdminModel('module');
1977 1977
 
1978 1978
 			$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
1979
-			if(count($langs))
1979
+			if (count($langs))
1980 1980
 			{
1981
-				foreach($langs as $key => $val)
1981
+				foreach ($langs as $key => $val)
1982 1982
 				{
1983
-					$xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
1983
+					$xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
1984 1984
 				}
1985 1985
 			}
1986 1986
 
1987 1987
 			$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
1988
-			if(count($langx))
1988
+			if (count($langx))
1989 1989
 			{
1990
-				foreach($langx as $key => $val)
1990
+				foreach ($langx as $key => $val)
1991 1991
 				{
1992
-					$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
1992
+					$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)));
1993 1993
 				}
1994 1994
 			}
1995 1995
 
@@ -2002,7 +2002,7 @@  discard block
 block discarded – undo
2002 2002
 				$category_srl,
2003 2003
 				$group_check_code,
2004 2004
 				$category_srl,
2005
-				getUrl('','mid',$node->mid,'category',$category_srl),
2005
+				getUrl('', 'mid', $node->mid, 'category', $category_srl),
2006 2006
 				$expand,
2007 2007
 				htmlspecialchars($color, ENT_COMPAT | ENT_HTML401, 'UTF-8', false),
2008 2008
 				$group_check_code,
@@ -2010,8 +2010,8 @@  discard block
 block discarded – undo
2010 2010
 				$node->document_count
2011 2011
 			);
2012 2012
 
2013
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2014
-			else $buff .=  sprintf('<node %s />', $attribute);
2013
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2014
+			else $buff .= sprintf('<node %s />', $attribute);
2015 2015
 		}
2016 2016
 		return $buff;
2017 2017
 	}
@@ -2030,13 +2030,13 @@  discard block
 block discarded – undo
2030 2030
 	function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff)
2031 2031
 	{
2032 2032
 		$output = array("buff"=>"", "category_srl_list"=>array());
2033
-		if(!$source_node) return $output;
2033
+		if (!$source_node) return $output;
2034 2034
 
2035 2035
 		// Set to an arraty for looping and then generate php script codes to be included
2036
-		foreach($source_node as $category_srl => $node)
2036
+		foreach ($source_node as $category_srl => $node)
2037 2037
 		{
2038 2038
 			// Get data from child nodes first if exist.
2039
-			if($category_srl && $tree[$category_srl]){
2039
+			if ($category_srl && $tree[$category_srl]) {
2040 2040
 				$child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff);
2041 2041
 			} else {
2042 2042
 				$child_output = array("buff"=>"", "category_srl_list"=>array());
@@ -2047,14 +2047,14 @@  discard block
 block discarded – undo
2047 2047
 			$output['category_srl_list'] = array_merge($output['category_srl_list'], $child_output['category_srl_list']);
2048 2048
 
2049 2049
 			// If node->group_srls value exists
2050
-			if($node->group_srls) {
2051
-				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls);
2050
+			if ($node->group_srls) {
2051
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $node->group_srls);
2052 2052
 			} else {
2053 2053
 				$group_check_code = "true";
2054 2054
 			}
2055 2055
 
2056 2056
 			// List variables
2057
-			$selected = '"' . implode('","', $child_output['category_srl_list']) . '"';
2057
+			$selected = '"'.implode('","', $child_output['category_srl_list']).'"';
2058 2058
 			$child_buff = $child_output['buff'];
2059 2059
 			$expand = $node->expand;
2060 2060
 
@@ -2063,32 +2063,32 @@  discard block
 block discarded – undo
2063 2063
 			$oModuleAdminModel = getAdminModel('module');
2064 2064
 			$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
2065 2065
 
2066
-			if(count($langs))
2066
+			if (count($langs))
2067 2067
 			{
2068
-				foreach($langs as $key => $val)
2068
+				foreach ($langs as $key => $val)
2069 2069
 				{
2070 2070
 					$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2071 2071
 					$php_header_buff .= sprintf(
2072 2072
 						'$_titles[%d]["%s"] = "%s"; ',
2073 2073
 						$category_srl,
2074 2074
 						$key,
2075
-						str_replace('"','\\"', $val)
2075
+						str_replace('"', '\\"', $val)
2076 2076
 					);
2077 2077
 				}
2078 2078
 			}
2079 2079
 
2080 2080
 			$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
2081 2081
 
2082
-			if(count($langx))
2082
+			if (count($langx))
2083 2083
 			{
2084
-				foreach($langx as $key => $val)
2084
+				foreach ($langx as $key => $val)
2085 2085
 				{
2086 2086
 					$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2087 2087
 					$php_header_buff .= sprintf(
2088 2088
 						'$_descriptions[%d]["%s"] = "%s"; ',
2089 2089
 						$category_srl,
2090 2090
 						$key,
2091
-						str_replace('"','\\"', $val)
2091
+						str_replace('"', '\\"', $val)
2092 2092
 					);
2093 2093
 				}
2094 2094
 			}
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 			);
2113 2113
 
2114 2114
 			// Generate buff data
2115
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->category_srl, $attribute);
2115
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute);
2116 2116
 		}
2117 2117
 
2118 2118
 		return $output;
@@ -2129,7 +2129,7 @@  discard block
 block discarded – undo
2129 2129
 	function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self')
2130 2130
 	{
2131 2131
 		$document_popup_menu_list = Context::get('document_popup_menu_list');
2132
-		if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2132
+		if (!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2133 2133
 
2134 2134
 		$obj = new stdClass();
2135 2135
 		$obj->url = $url;
@@ -2147,68 +2147,68 @@  discard block
 block discarded – undo
2147 2147
 	 */
2148 2148
 	function procDocumentAddCart()
2149 2149
 	{
2150
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2150
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2151 2151
 
2152 2152
 		// Get document_srl
2153
-		$srls = explode(',',Context::get('srls'));
2154
-		for($i = 0; $i < count($srls); $i++)
2153
+		$srls = explode(',', Context::get('srls'));
2154
+		for ($i = 0; $i < count($srls); $i++)
2155 2155
 		{
2156 2156
 			$srl = trim($srls[$i]);
2157 2157
 
2158
-			if(!$srl) continue;
2158
+			if (!$srl) continue;
2159 2159
 
2160 2160
 			$document_srls[] = $srl;
2161 2161
 		}
2162
-		if(!count($document_srls)) return;
2162
+		if (!count($document_srls)) return;
2163 2163
 
2164 2164
 		// Get module_srl of the documents
2165 2165
 		$args = new stdClass;
2166 2166
 		$args->list_count = count($document_srls);
2167
-		$args->document_srls = implode(',',$document_srls);
2167
+		$args->document_srls = implode(',', $document_srls);
2168 2168
 		$args->order_type = 'asc';
2169 2169
 		$output = executeQueryArray('document.getDocuments', $args);
2170
-		if(!$output->data) return new Object();
2170
+		if (!$output->data) return new Object();
2171 2171
 
2172 2172
 		unset($document_srls);
2173
-		foreach($output->data as $key => $val)
2173
+		foreach ($output->data as $key => $val)
2174 2174
 		{
2175 2175
 			$document_srls[$val->module_srl][] = $val->document_srl;
2176 2176
 		}
2177
-		if(!$document_srls || !count($document_srls)) return new Object();
2177
+		if (!$document_srls || !count($document_srls)) return new Object();
2178 2178
 
2179 2179
 		// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents)
2180 2180
 		$oModuleModel = getModel('module');
2181 2181
 		$module_srls = array_keys($document_srls);
2182
-		for($i=0;$i<count($module_srls);$i++)
2182
+		for ($i = 0; $i < count($module_srls); $i++)
2183 2183
 		{
2184 2184
 			$module_srl = $module_srls[$i];
2185 2185
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
2186 2186
 			$logged_info = Context::get('logged_info');
2187
-			if($logged_info->is_admin != 'Y')
2187
+			if ($logged_info->is_admin != 'Y')
2188 2188
 			{
2189
-				if(!$module_info)
2189
+				if (!$module_info)
2190 2190
 				{
2191 2191
 					unset($document_srls[$module_srl]);
2192 2192
 					continue;
2193 2193
 				}
2194 2194
 				$grant = $oModuleModel->getGrant($module_info, $logged_info);
2195
-				if(!$grant->manager)
2195
+				if (!$grant->manager)
2196 2196
 				{
2197 2197
 					unset($document_srls[$module_srl]);
2198 2198
 					continue;
2199 2199
 				}
2200 2200
 			}
2201 2201
 		}
2202
-		if(!count($document_srls)) return new Object();
2202
+		if (!count($document_srls)) return new Object();
2203 2203
 
2204
-		foreach($document_srls as $module_srl => $documents)
2204
+		foreach ($document_srls as $module_srl => $documents)
2205 2205
 		{
2206 2206
 			$cnt = count($documents);
2207
-			for($i=0;$i<$cnt;$i++)
2207
+			for ($i = 0; $i < $cnt; $i++)
2208 2208
 			{
2209
-				$document_srl = (int)trim($documents[$i]);
2210
-				if(!$document_srls) continue;
2211
-				if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2209
+				$document_srl = (int) trim($documents[$i]);
2210
+				if (!$document_srls) continue;
2211
+				if ($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2212 2212
 				else $_SESSION['document_management'][$document_srl] = true;
2213 2213
 			}
2214 2214
 		}
@@ -2221,9 +2221,9 @@  discard block
 block discarded – undo
2221 2221
 	function procDocumentManageCheckedDocument()
2222 2222
 	{
2223 2223
 		@set_time_limit(0);
2224
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2224
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2225 2225
 
2226
-		if(!checkCSRF())
2226
+		if (!checkCSRF())
2227 2227
 		{
2228 2228
 			return new Object(-1, 'msg_invalid_request');
2229 2229
 		}
@@ -2231,44 +2231,44 @@  discard block
 block discarded – undo
2231 2231
 		$type = Context::get('type');
2232 2232
 		$target_module = Context::get('target_module');
2233 2233
 		$module_srl = Context::get('module_srl');
2234
-		if($target_module && !$module_srl) $module_srl = $target_module;
2234
+		if ($target_module && !$module_srl) $module_srl = $target_module;
2235 2235
 		$category_srl = Context::get('target_category');
2236 2236
 		$message_content = Context::get('message_content');
2237
-		if($message_content) $message_content = nl2br($message_content);
2237
+		if ($message_content) $message_content = nl2br($message_content);
2238 2238
 
2239 2239
 		$cart = Context::get('cart');
2240
-		if(!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2240
+		if (!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2241 2241
 		else $document_srl_list = $cart;
2242 2242
 
2243 2243
 		$document_srl_count = count($document_srl_list);
2244 2244
 
2245 2245
 		$oDocumentModel = getModel('document');
2246 2246
 		$document_items = array();
2247
-		foreach($document_srl_list as $document_srl)
2247
+		foreach ($document_srl_list as $document_srl)
2248 2248
 		{
2249 2249
 			$oDocument = $oDocumentModel->getDocument($document_srl);
2250 2250
 			$document_items[] = $oDocument;
2251
-			if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2251
+			if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2252 2252
 		}
2253 2253
 
2254 2254
 		// Send a message
2255
-		if($message_content)
2255
+		if ($message_content)
2256 2256
 		{
2257 2257
 
2258 2258
 			$oCommunicationController = getController('communication');
2259 2259
 
2260 2260
 			$logged_info = Context::get('logged_info');
2261 2261
 
2262
-			$title = cut_str($message_content,10,'...');
2262
+			$title = cut_str($message_content, 10, '...');
2263 2263
 			$sender_member_srl = $logged_info->member_srl;
2264 2264
 
2265
-			foreach($document_items as $oDocument)
2265
+			foreach ($document_items as $oDocument)
2266 2266
 			{
2267
-				if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue;
2267
+				if (!$oDocument->get('member_srl') || $oDocument->get('member_srl') == $sender_member_srl) continue;
2268 2268
 
2269
-				if($type=='move') $purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2269
+				if ($type == 'move') $purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2270 2270
 				else $purl = "";
2271
-				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2271
+				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s", $message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2272 2272
 
2273 2273
 				$oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false);
2274 2274
 			}
@@ -2278,54 +2278,54 @@  discard block
 block discarded – undo
2278 2278
 		$oSpamController->setAvoidLog();
2279 2279
 
2280 2280
 		$oDocumentAdminController = getAdminController('document');
2281
-		if($type == 'move')
2281
+		if ($type == 'move')
2282 2282
 		{
2283
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2283
+			if (!$module_srl) return new Object(-1, 'fail_to_move');
2284 2284
 
2285 2285
 			$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl);
2286
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2286
+			if (!$output->toBool()) return new Object(-1, 'fail_to_move');
2287 2287
 
2288 2288
 			$msg_code = 'success_moved';
2289 2289
 
2290 2290
 		}
2291
-		else if($type == 'copy')
2291
+		else if ($type == 'copy')
2292 2292
 		{
2293
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2293
+			if (!$module_srl) return new Object(-1, 'fail_to_move');
2294 2294
 
2295 2295
 			$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
2296
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2296
+			if (!$output->toBool()) return new Object(-1, 'fail_to_move');
2297 2297
 
2298 2298
 			$msg_code = 'success_copied';
2299 2299
 		}
2300
-		else if($type =='delete')
2300
+		else if ($type == 'delete')
2301 2301
 		{
2302 2302
 			$oDB = &DB::getInstance();
2303 2303
 			$oDB->begin();
2304
-			for($i=0;$i<$document_srl_count;$i++)
2304
+			for ($i = 0; $i < $document_srl_count; $i++)
2305 2305
 			{
2306 2306
 				$document_srl = $document_srl_list[$i];
2307 2307
 				$output = $this->deleteDocument($document_srl, true);
2308
-				if(!$output->toBool()) return new Object(-1, 'fail_to_delete');
2308
+				if (!$output->toBool()) return new Object(-1, 'fail_to_delete');
2309 2309
 			}
2310 2310
 			$oDB->commit();
2311 2311
 			$msg_code = 'success_deleted';
2312 2312
 		}
2313
-		else if($type == 'trash')
2313
+		else if ($type == 'trash')
2314 2314
 		{
2315 2315
 			$args = new stdClass();
2316 2316
 			$args->description = $message_content;
2317 2317
 
2318 2318
 			$oDB = &DB::getInstance();
2319 2319
 			$oDB->begin();
2320
-			for($i=0;$i<$document_srl_count;$i++) {
2320
+			for ($i = 0; $i < $document_srl_count; $i++) {
2321 2321
 				$args->document_srl = $document_srl_list[$i];
2322 2322
 				$output = $this->moveDocumentToTrash($args);
2323
-				if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
2323
+				if (!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
2324 2324
 			}
2325 2325
 			$oDB->commit();
2326 2326
 			$msg_code = 'success_trashed';
2327 2327
 		}
2328
-		else if($type == 'cancelDeclare')
2328
+		else if ($type == 'cancelDeclare')
2329 2329
 		{
2330 2330
 			$args->document_srl = $document_srl_list;
2331 2331
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
@@ -2347,27 +2347,27 @@  discard block
 block discarded – undo
2347 2347
 	function procDocumentInsertModuleConfig()
2348 2348
 	{
2349 2349
 		$module_srl = Context::get('target_module_srl');
2350
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
2350
+		if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl);
2351 2351
 		else $module_srl = array($module_srl);
2352 2352
 
2353 2353
 		$document_config = new stdClass();
2354 2354
 		$document_config->use_history = Context::get('use_history');
2355
-		if(!$document_config->use_history) $document_config->use_history = 'N';
2355
+		if (!$document_config->use_history) $document_config->use_history = 'N';
2356 2356
 
2357 2357
 		$document_config->use_vote_up = Context::get('use_vote_up');
2358
-		if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2358
+		if (!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2359 2359
 
2360 2360
 		$document_config->use_vote_down = Context::get('use_vote_down');
2361
-		if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2361
+		if (!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2362 2362
 
2363 2363
 		$document_config->use_status = Context::get('use_status');
2364 2364
 
2365 2365
 		$oModuleController = getController('module');
2366
-		for($i=0;$i<count($module_srl);$i++)
2366
+		for ($i = 0; $i < count($module_srl); $i++)
2367 2367
 		{
2368 2368
 			$srl = trim($module_srl[$i]);
2369
-			if(!$srl) continue;
2370
-			$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
2369
+			if (!$srl) continue;
2370
+			$output = $oModuleController->insertModulePartConfig('document', $srl, $document_config);
2371 2371
 		}
2372 2372
 		$this->setError(-1);
2373 2373
 		$this->setMessage('success_updated', 'info');
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 	function procDocumentTempSave()
2384 2384
 	{
2385 2385
 		// Check login information
2386
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
2386
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
2387 2387
 		$module_info = Context::get('module_info');
2388 2388
 		$logged_info = Context::get('logged_info');
2389 2389
 
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
 		unset($obj->is_notice);
2396 2396
 
2397 2397
 		// Extract from beginning part of contents in the guestbook
2398
-		if(!$obj->title)
2398
+		if (!$obj->title)
2399 2399
 		{
2400 2400
 			$obj->title = cut_str(strip_tags($obj->content), 20, '...');
2401 2401
 		}
@@ -2406,13 +2406,13 @@  discard block
 block discarded – undo
2406 2406
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
2407 2407
 
2408 2408
 		// Update if already exists
2409
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
2409
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
2410 2410
 		{
2411
-			if($oDocument->get('module_srl') != $obj->module_srl)
2411
+			if ($oDocument->get('module_srl') != $obj->module_srl)
2412 2412
 			{
2413 2413
 				return new Object(-1, 'msg_invalid_request');
2414 2414
 			}
2415
-			if(!$oDocument->isGranted())
2415
+			if (!$oDocument->isGranted())
2416 2416
 			{
2417 2417
 				return new Object(-1, 'msg_invalid_request');
2418 2418
 			}
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
 			$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
2431 2431
 		}
2432 2432
 		// Set the attachment to be invalid state
2433
-		if($oDocument->hasUploadedFiles())
2433
+		if ($oDocument->hasUploadedFiles())
2434 2434
 		{
2435 2435
 			$args = new stdClass;
2436 2436
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -2448,11 +2448,11 @@  discard block
 block discarded – undo
2448 2448
 	 */
2449 2449
 	function procDocumentGetList()
2450 2450
 	{
2451
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2451
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2452 2452
 		$documentSrls = Context::get('document_srls');
2453
-		if($documentSrls) $documentSrlList = explode(',', $documentSrls);
2453
+		if ($documentSrls) $documentSrlList = explode(',', $documentSrls);
2454 2454
 
2455
-		if(count($documentSrlList) > 0)
2455
+		if (count($documentSrlList) > 0)
2456 2456
 		{
2457 2457
 			$oDocumentModel = getModel('document');
2458 2458
 			$columnList = array('document_srl', 'title', 'nick_name', 'status');
@@ -2476,10 +2476,10 @@  discard block
 block discarded – undo
2476 2476
 	 */
2477 2477
 	function _checkCommentStatusForOldVersion(&$obj)
2478 2478
 	{
2479
-		if(!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2480
-		if(!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2479
+		if (!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2480
+		if (!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2481 2481
 
2482
-		if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2482
+		if ($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2483 2483
 		else $obj->commentStatus = 'DENY';
2484 2484
 	}
2485 2485
 
@@ -2490,8 +2490,8 @@  discard block
 block discarded – undo
2490 2490
 	 */
2491 2491
 	function _checkDocumentStatusForOldVersion(&$obj)
2492 2492
 	{
2493
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2494
-		if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2493
+		if (!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2494
+		if (!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2495 2495
 	}
2496 2496
 
2497 2497
 	public function updateUploaedCount($documentSrlList)
@@ -2499,10 +2499,10 @@  discard block
 block discarded – undo
2499 2499
 		$oDocumentModel = getModel('document');
2500 2500
 		$oFileModel = getModel('file');
2501 2501
 
2502
-		if(is_array($documentSrlList))
2502
+		if (is_array($documentSrlList))
2503 2503
 		{
2504 2504
 			$documentSrlList = array_unique($documentSrlList);
2505
-			foreach($documentSrlList AS $key => $documentSrl)
2505
+			foreach ($documentSrlList AS $key => $documentSrl)
2506 2506
 			{
2507 2507
 				$fileCount = $oFileModel->getFilesCount($documentSrl);
2508 2508
 				$args = new stdClass();
@@ -2523,14 +2523,14 @@  discard block
 block discarded – undo
2523 2523
 		$oDocumentModel = getModel('document');
2524 2524
 		$documentExtraKeys = $oDocumentModel->getExtraKeys($obj->originModuleSrl);
2525 2525
 
2526
-		if(is_array($documentExtraKeys) && is_array($obj->moduleSrlList))
2526
+		if (is_array($documentExtraKeys) && is_array($obj->moduleSrlList))
2527 2527
 		{
2528
-			$oDocumentController=getController('document');
2529
-			foreach($obj->moduleSrlList AS $key=>$value)
2528
+			$oDocumentController = getController('document');
2529
+			foreach ($obj->moduleSrlList AS $key=>$value)
2530 2530
 			{
2531
-				foreach($documentExtraKeys AS $extraItem)
2531
+				foreach ($documentExtraKeys AS $extraItem)
2532 2532
 				{
2533
-					$oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required , $extraItem->search , $extraItem->default , $extraItem->desc, $extraItem->eid) ;
2533
+					$oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required, $extraItem->search, $extraItem->default, $extraItem->desc, $extraItem->eid);
2534 2534
 				}
2535 2535
 			}
2536 2536
 		}
@@ -2542,9 +2542,9 @@  discard block
 block discarded – undo
2542 2542
 		$documentConfig = $oModuleModel->getModulePartConfig('document', $obj->originModuleSrl);
2543 2543
 
2544 2544
 		$oModuleController = getController('module');
2545
-		if(is_array($obj->moduleSrlList))
2545
+		if (is_array($obj->moduleSrlList))
2546 2546
 		{
2547
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
2547
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
2548 2548
 			{
2549 2549
 				$oModuleController->insertModulePartConfig('document', $moduleSrl, $documentConfig);
2550 2550
 			}
Please login to merge, or discard this patch.
Braces   +535 added lines, -216 removed lines patch added patch discarded remove patch
@@ -24,19 +24,27 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	function procDocumentVoteUp()
26 26
 	{
27
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
27
+		if(!Context::get('is_logged')) {
28
+			return new Object(-1, 'msg_invalid_request');
29
+		}
28 30
 
29 31
 		$document_srl = Context::get('target_srl');
30
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
32
+		if(!$document_srl) {
33
+			return new Object(-1, 'msg_invalid_request');
34
+		}
31 35
 
32 36
 		$oDocumentModel = getModel('document');
33 37
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
34 38
 		$module_srl = $oDocument->get('module_srl');
35
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
39
+		if(!$module_srl) {
40
+			return new Object(-1, 'msg_invalid_request');
41
+		}
36 42
 
37 43
 		$oModuleModel = getModel('module');
38 44
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
39
-		if($document_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request');
45
+		if($document_config->use_vote_up=='N') {
46
+			return new Object(-1, 'msg_invalid_request');
47
+		}
40 48
 
41 49
 		$point = 1;
42 50
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -69,19 +77,27 @@  discard block
 block discarded – undo
69 77
 	 */
70 78
 	function procDocumentVoteDown()
71 79
 	{
72
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
80
+		if(!Context::get('is_logged')) {
81
+			return new Object(-1, 'msg_invalid_request');
82
+		}
73 83
 
74 84
 		$document_srl = Context::get('target_srl');
75
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
85
+		if(!$document_srl) {
86
+			return new Object(-1, 'msg_invalid_request');
87
+		}
76 88
 
77 89
 		$oDocumentModel = getModel('document');
78 90
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
79 91
 		$module_srl = $oDocument->get('module_srl');
80
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
92
+		if(!$module_srl) {
93
+			return new Object(-1, 'msg_invalid_request');
94
+		}
81 95
 
82 96
 		$oModuleModel = getModel('module');
83 97
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
84
-		if($document_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request');
98
+		if($document_config->use_vote_down=='N') {
99
+			return new Object(-1, 'msg_invalid_request');
100
+		}
85 101
 
86 102
 		$point = -1;
87 103
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -95,10 +111,14 @@  discard block
 block discarded – undo
95 111
 	 */
96 112
 	function procDocumentDeclare()
97 113
 	{
98
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
114
+		if(!Context::get('is_logged')) {
115
+			return new Object(-1, 'msg_invalid_request');
116
+		}
99 117
 
100 118
 		$document_srl = Context::get('target_srl');
101
-		if(!$document_srl) return new Object(-1, 'msg_invalid_request');
119
+		if(!$document_srl) {
120
+			return new Object(-1, 'msg_invalid_request');
121
+		}
102 122
 
103 123
 		return $this->declaredDocument($document_srl);
104 124
 	}
@@ -140,7 +160,9 @@  discard block
 block discarded – undo
140 160
 		$args->history_srl = $history_srl;
141 161
 		$args->module_srl = $module_srl;
142 162
 		$args->document_srl = $document_srl;
143
-		if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
163
+		if(!$args->history_srl && !$args->module_srl && !$args->document_srl) {
164
+			return;
165
+		}
144 166
 		executeQuery("document.deleteHistory", $args);
145 167
 	}
146 168
 
@@ -152,15 +174,21 @@  discard block
 block discarded – undo
152 174
 	function triggerDeleteModuleDocuments(&$obj)
153 175
 	{
154 176
 		$module_srl = $obj->module_srl;
155
-		if(!$module_srl) return new Object();
177
+		if(!$module_srl) {
178
+			return new Object();
179
+		}
156 180
 		// Delete the document
157 181
 		$oDocumentAdminController = getAdminController('document');
158 182
 		$output = $oDocumentAdminController->deleteModuleDocument($module_srl);
159
-		if(!$output->toBool()) return $output;
183
+		if(!$output->toBool()) {
184
+			return $output;
185
+		}
160 186
 		// Delete the category
161 187
 		$oDocumentController = getController('document');
162 188
 		$output = $oDocumentController->deleteModuleCategory($module_srl);
163
-		if(!$output->toBool()) return $output;
189
+		if(!$output->toBool()) {
190
+			return $output;
191
+		}
164 192
 		// Delete extra key and variable, because module deleted
165 193
 		$this->deleteDocumentExtraKeys($module_srl);
166 194
 
@@ -202,10 +230,18 @@  discard block
 block discarded – undo
202 230
 		$oDB = &DB::getInstance();
203 231
 		$oDB->begin();
204 232
 		// List variables
205
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
206
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
207
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
208
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
233
+		if($obj->comment_status) {
234
+			$obj->commentStatus = $obj->comment_status;
235
+		}
236
+		if(!$obj->commentStatus) {
237
+			$obj->commentStatus = 'DENY';
238
+		}
239
+		if($obj->commentStatus == 'DENY') {
240
+			$this->_checkCommentStatusForOldVersion($obj);
241
+		}
242
+		if($obj->allow_trackback!='Y') {
243
+			$obj->allow_trackback = 'N';
244
+		}
209 245
 		if($obj->homepage) 
210 246
 		{
211 247
 			$obj->homepage = removeHackTag($obj->homepage);
@@ -215,9 +251,15 @@  discard block
 block discarded – undo
215 251
 			}
216 252
 		}
217 253
 		
218
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
219
-		if(!$obj->email_address) $obj->email_address = '';
220
-		if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
254
+		if($obj->notify_message != 'Y') {
255
+			$obj->notify_message = 'N';
256
+		}
257
+		if(!$obj->email_address) {
258
+			$obj->email_address = '';
259
+		}
260
+		if(!$isRestore) {
261
+			$obj->ipaddress = $_SERVER['REMOTE_ADDR'];
262
+		}
221 263
 
222 264
                 // can modify regdate only manager
223 265
                 $grant = Context::get('grant');
@@ -227,7 +269,9 @@  discard block
 block discarded – undo
227 269
 		}
228 270
 		
229 271
 		// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
230
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
272
+		if(!is_string($obj->extra_vars)) {
273
+			$obj->extra_vars = serialize($obj->extra_vars);
274
+		}
231 275
 		// Remove the columns for automatic saving
232 276
 		unset($obj->_saved_doc_srl);
233 277
 		unset($obj->_saved_doc_title);
@@ -235,10 +279,15 @@  discard block
 block discarded – undo
235 279
 		unset($obj->_saved_doc_message);
236 280
 		// Call a trigger (before)
237 281
 		$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
238
-		if(!$output->toBool()) return $output;
282
+		if(!$output->toBool()) {
283
+			return $output;
284
+		}
239 285
 		// Register it if no given document_srl exists
240
-		if(!$obj->document_srl) $obj->document_srl = getNextSequence();
241
-		elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new Object(-1, 'msg_not_permitted');
286
+		if(!$obj->document_srl) {
287
+			$obj->document_srl = getNextSequence();
288
+		} elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) {
289
+			return new Object(-1, 'msg_not_permitted');
290
+		}
242 291
 
243 292
 		$oDocumentModel = getModel('document');
244 293
 		// Set to 0 if the category_srl doesn't exist
@@ -249,12 +298,19 @@  discard block
 block discarded – undo
249 298
 			{
250 299
 				return new Object(-1, 'msg_not_permitted');
251 300
 			}
252
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
301
+			if(count($category_list) > 0 && !$category_list[$obj->category_srl]) {
302
+				$obj->category_srl = 0;
303
+			}
253 304
 		}
254 305
 		// Set the read counts and update order.
255
-		if(!$obj->readed_count) $obj->readed_count = 0;
256
-		if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
257
-		else $obj->update_order = $obj->list_order;
306
+		if(!$obj->readed_count) {
307
+			$obj->readed_count = 0;
308
+		}
309
+		if($isLatest) {
310
+			$obj->update_order = $obj->list_order = $obj->document_srl * -1;
311
+		} else {
312
+			$obj->update_order = $obj->list_order;
313
+		}
258 314
 		// Check the status of password hash for manually inserting. Apply hashing for otherwise.
259 315
 		if($obj->password && !$obj->password_is_hashed)
260 316
 		{
@@ -276,9 +332,13 @@  discard block
 block discarded – undo
276 332
 		// If the tile is empty, extract string from the contents.
277 333
 		$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
278 334
 		settype($obj->title, "string");
279
-		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
335
+		if($obj->title == '') {
336
+			$obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
337
+		}
280 338
 		// If no tile extracted from the contents, leave it untitled.
281
-		if($obj->title == '') $obj->title = 'Untitled';
339
+		if($obj->title == '') {
340
+			$obj->title = 'Untitled';
341
+		}
282 342
 		// Remove XE's own tags from the contents.
283 343
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
284 344
 		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
@@ -290,13 +350,19 @@  discard block
 block discarded – undo
290 350
 			$obj->content = nl2br($obj->content);
291 351
 		}
292 352
 		// Remove iframe and script if not a top adminisrator in the session.
293
-		if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
353
+		if($logged_info->is_admin != 'Y') {
354
+			$obj->content = removeHackTag($obj->content);
355
+		}
294 356
 		// An error appears if both log-in info and user name don't exist.
295
-		if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request');
357
+		if(!$logged_info->member_srl && !$obj->nick_name) {
358
+			return new Object(-1,'msg_invalid_request');
359
+		}
296 360
 
297 361
 		$obj->lang_code = Context::getLangType();
298 362
 		// Insert data into the DB
299
-		if(!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
363
+		if(!$obj->status) {
364
+			$this->_checkDocumentStatusForOldVersion($obj);
365
+		}
300 366
 		$output = executeQuery('document.insertDocument', $obj);
301 367
 		if(!$output->toBool())
302 368
 		{
@@ -313,19 +379,25 @@  discard block
 block discarded – undo
313 379
 				if(isset($obj->{'extra_vars'.$idx}))
314 380
 				{
315 381
 					$tmp = $obj->{'extra_vars'.$idx};
316
-					if(is_array($tmp))
317
-						$value = implode('|@|', $tmp);
318
-					else
319
-						$value = trim($tmp);
382
+					if(is_array($tmp)) {
383
+											$value = implode('|@|', $tmp);
384
+					} else {
385
+											$value = trim($tmp);
386
+					}
387
+				} else if(isset($obj->{$extra_item->name})) {
388
+					$value = trim($obj->{$extra_item->name});
389
+				}
390
+				if($value == NULL) {
391
+					continue;
320 392
 				}
321
-				else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
322
-				if($value == NULL) continue;
323 393
 
324 394
 				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
325 395
 			}
326 396
 		}
327 397
 		// Update the category if the category_srl exists.
328
-		if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
398
+		if($obj->category_srl) {
399
+			$this->updateCategoryCount($obj->module_srl, $obj->category_srl);
400
+		}
329 401
 		// Call a trigger (after)
330 402
 		if($output->toBool())
331 403
 		{
@@ -367,27 +439,39 @@  discard block
 block discarded – undo
367 439
 			return new Object(-1, 'msg_invalid_request');
368 440
 		}
369 441
 
370
-		if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request');
371
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
372
-		if(!$obj->status) $obj->status = 'PUBLIC';
442
+		if(!$source_obj->document_srl || !$obj->document_srl) {
443
+			return new Object(-1,'msg_invalied_request');
444
+		}
445
+		if(!$obj->status && $obj->is_secret == 'Y') {
446
+			$obj->status = 'SECRET';
447
+		}
448
+		if(!$obj->status) {
449
+			$obj->status = 'PUBLIC';
450
+		}
373 451
 
374 452
 		// Call a trigger (before)
375 453
 		$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
376
-		if(!$output->toBool()) return $output;
454
+		if(!$output->toBool()) {
455
+			return $output;
456
+		}
377 457
 
378 458
 		// begin transaction
379 459
 		$oDB = &DB::getInstance();
380 460
 		$oDB->begin();
381 461
 
382 462
 		$oModuleModel = getModel('module');
383
-		if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
463
+		if(!$obj->module_srl) {
464
+			$obj->module_srl = $source_obj->get('module_srl');
465
+		}
384 466
 		$module_srl = $obj->module_srl;
385 467
 		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
386 468
 		if(!$document_config)
387 469
 		{
388 470
 			$document_config = new stdClass();
389 471
 		}
390
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
472
+		if(!isset($document_config->use_history)) {
473
+			$document_config->use_history = 'N';
474
+		}
391 475
 		$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
392 476
 
393 477
 		if($bUseHistory)
@@ -396,22 +480,31 @@  discard block
 block discarded – undo
396 480
 			$args->history_srl = getNextSequence();
397 481
 			$args->document_srl = $obj->document_srl;
398 482
 			$args->module_srl = $module_srl;
399
-			if($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
483
+			if($document_config->use_history == 'Y') {
484
+				$args->content = $source_obj->get('content');
485
+			}
400 486
 			$args->nick_name = $source_obj->get('nick_name');
401 487
 			$args->member_srl = $source_obj->get('member_srl');
402 488
 			$args->regdate = $source_obj->get('last_update');
403 489
 			$args->ipaddress = $source_obj->get('ipaddress');
404 490
 			$output = executeQuery("document.insertHistory", $args);
405
-		}
406
-		else
491
+		} else
407 492
 		{
408 493
 			$obj->ipaddress = $source_obj->get('ipaddress');
409 494
 		}
410 495
 		// List variables
411
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
412
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
413
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
414
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
496
+		if($obj->comment_status) {
497
+			$obj->commentStatus = $obj->comment_status;
498
+		}
499
+		if(!$obj->commentStatus) {
500
+			$obj->commentStatus = 'DENY';
501
+		}
502
+		if($obj->commentStatus == 'DENY') {
503
+			$this->_checkCommentStatusForOldVersion($obj);
504
+		}
505
+		if($obj->allow_trackback!='Y') {
506
+			$obj->allow_trackback = 'N';
507
+		}
415 508
 		if($obj->homepage)
416 509
 		{
417 510
 			$obj->homepage = removeHackTag($obj->homepage);
@@ -421,7 +514,9 @@  discard block
 block discarded – undo
421 514
 			}
422 515
 		}
423 516
 		
424
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
517
+		if($obj->notify_message != 'Y') {
518
+			$obj->notify_message = 'N';
519
+		}
425 520
 		
426 521
 		// can modify regdate only manager
427 522
                 $grant = Context::get('grant');
@@ -431,7 +526,9 @@  discard block
 block discarded – undo
431 526
 		}
432 527
 		
433 528
 		// Serialize the $extra_vars
434
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
529
+		if(!is_string($obj->extra_vars)) {
530
+			$obj->extra_vars = serialize($obj->extra_vars);
531
+		}
435 532
 		// Remove the columns for automatic saving
436 533
 		unset($obj->_saved_doc_srl);
437 534
 		unset($obj->_saved_doc_title);
@@ -443,7 +540,9 @@  discard block
 block discarded – undo
443 540
 		if($source_obj->get('category_srl')!=$obj->category_srl)
444 541
 		{
445 542
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
446
-			if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
543
+			if(!$category_list[$obj->category_srl]) {
544
+				$obj->category_srl = 0;
545
+			}
447 546
 		}
448 547
 		// Change the update order
449 548
 		$obj->update_order = getNextSequence() * -1;
@@ -478,9 +577,13 @@  discard block
 block discarded – undo
478 577
 		// If the tile is empty, extract string from the contents.
479 578
 		$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
480 579
 		settype($obj->title, "string");
481
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
580
+		if($obj->title == '') {
581
+			$obj->title = cut_str(strip_tags($obj->content),20,'...');
582
+		}
482 583
 		// If no tile extracted from the contents, leave it untitled.
483
-		if($obj->title == '') $obj->title = 'Untitled';
584
+		if($obj->title == '') {
585
+			$obj->title = 'Untitled';
586
+		}
484 587
 		// Remove XE's own tags from the contents.
485 588
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
486 589
 		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
@@ -500,8 +603,7 @@  discard block
 block discarded – undo
500 603
 				$lang_code_args->document_srl = $source_obj->get('document_srl');
501 604
 				$lang_code_args->lang_code = Context::getLangType();
502 605
 				$output = executeQuery('document.updateDocumentsLangCode', $lang_code_args);
503
-			}
504
-			else
606
+			} else
505 607
 			{
506 608
 				$extra_content = new stdClass;
507 609
 				$extra_content->title = $obj->title;
@@ -520,7 +622,9 @@  discard block
 block discarded – undo
520 622
 			$obj->content = removeHackTag($obj->content);
521 623
 		}
522 624
 		// if temporary document, regdate is now setting
523
-		if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
625
+		if($source_obj->get('status') == $this->getConfigStatus('temp')) {
626
+			$obj->regdate = date('YmdHis');
627
+		}
524 628
 
525 629
 		// Insert data into the DB
526 630
 		$output = executeQuery('document.updateDocument', $obj);
@@ -543,25 +647,37 @@  discard block
 block discarded – undo
543 647
 					if(isset($obj->{'extra_vars'.$idx}))
544 648
 					{
545 649
 						$tmp = $obj->{'extra_vars'.$idx};
546
-						if(is_array($tmp))
547
-							$value = implode('|@|', $tmp);
548
-						else
549
-							$value = trim($tmp);
650
+						if(is_array($tmp)) {
651
+													$value = implode('|@|', $tmp);
652
+						} else {
653
+													$value = trim($tmp);
654
+						}
655
+					} else if(isset($obj->{$extra_item->name})) {
656
+						$value = trim($obj->{$extra_item->name});
657
+					}
658
+					if($value == NULL) {
659
+						continue;
550 660
 					}
551
-					else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
552
-					if($value == NULL) continue;
553 661
 					$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
554 662
 				}
555 663
 			}
556 664
 			// Inert extra vars for multi-language support of title and contents.
557
-			if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
558
-			if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
665
+			if($extra_content->title) {
666
+				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
667
+			}
668
+			if($extra_content->content) {
669
+				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
670
+			}
559 671
 		}
560 672
 		// Update the category if the category_srl exists.
561 673
 		if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
562 674
 		{
563
-			if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
564
-			if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
675
+			if($source_obj->get('category_srl') != $obj->category_srl) {
676
+				$this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
677
+			}
678
+			if($obj->category_srl) {
679
+				$this->updateCategoryCount($obj->module_srl, $obj->category_srl);
680
+			}
565 681
 		}
566 682
 		// Call a trigger (after)
567 683
 		if($output->toBool())
@@ -606,7 +722,9 @@  discard block
 block discarded – undo
606 722
 		$trigger_obj = new stdClass();
607 723
 		$trigger_obj->document_srl = $document_srl;
608 724
 		$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
609
-		if(!$output->toBool()) return $output;
725
+		if(!$output->toBool()) {
726
+			return $output;
727
+		}
610 728
 
611 729
 		// begin transaction
612 730
 		$oDB = &DB::getInstance();
@@ -618,12 +736,17 @@  discard block
 block discarded – undo
618 736
 			$oDocumentModel = getModel('document');
619 737
 			// Check if the documnet exists
620 738
 			$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
739
+		} else if($isEmptyTrash && $oDocument == null) {
740
+			return new Object(-1, 'document is not exists');
621 741
 		}
622
-		else if($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists');
623 742
 
624
-		if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
743
+		if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) {
744
+			return new Object(-1, 'msg_invalid_document');
745
+		}
625 746
 		// Check if a permossion is granted
626
-		if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
747
+		if(!$oDocument->isGranted()) {
748
+			return new Object(-1, 'msg_not_permitted');
749
+		}
627 750
 
628 751
 		//if empty trash, document already deleted, therefore document not delete
629 752
 		$args = new stdClass();
@@ -643,7 +766,9 @@  discard block
 block discarded – undo
643 766
 
644 767
 		$this->deleteDocumentHistory(null, $document_srl, null);
645 768
 		// Update category information if the category_srl exists.
646
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
769
+		if($oDocument->get('category_srl')) {
770
+			$this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
771
+		}
647 772
 		// Delete a declared list
648 773
 		executeQuery('document.deleteDeclared', $args);
649 774
 		// Delete extra variable
@@ -723,8 +848,11 @@  discard block
 block discarded – undo
723 848
 	{
724 849
 		$trash_args = new stdClass();
725 850
 		// Get trash_srl if a given trash_srl doesn't exist
726
-		if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
727
-		else $trash_args->trash_srl = $obj->trash_srl;
851
+		if(!$obj->trash_srl) {
852
+			$trash_args->trash_srl = getNextSequence();
853
+		} else {
854
+			$trash_args->trash_srl = $obj->trash_srl;
855
+		}
728 856
 		// Get its module_srl which the document belongs to
729 857
 		$oDocumentModel = getModel('document');
730 858
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl);
@@ -732,7 +860,9 @@  discard block
 block discarded – undo
732 860
 		$trash_args->module_srl = $oDocument->get('module_srl');
733 861
 		$obj->module_srl = $oDocument->get('module_srl');
734 862
 		// Cannot throw data from the trash to the trash
735
-		if($trash_args->module_srl == 0) return false;
863
+		if($trash_args->module_srl == 0) {
864
+			return false;
865
+		}
736 866
 		// Data setting
737 867
 		$trash_args->document_srl = $obj->document_srl;
738 868
 		$trash_args->description = $obj->description;
@@ -793,7 +923,9 @@  discard block
 block discarded – undo
793 923
 		  }*/
794 924
 
795 925
 		// update category
796
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
926
+		if($oDocument->get('category_srl')) {
927
+			$this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
928
+		}
797 929
 
798 930
 		// remove thumbnails
799 931
 		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
@@ -838,7 +970,9 @@  discard block
 block discarded – undo
838 970
 	function updateReadedCount(&$oDocument)
839 971
 	{
840 972
 		// Pass if Crawler access
841
-		if(isCrawler()) return false;
973
+		if(isCrawler()) {
974
+			return false;
975
+		}
842 976
 		
843 977
 		$document_srl = $oDocument->document_srl;
844 978
 		$member_srl = $oDocument->get('member_srl');
@@ -846,10 +980,14 @@  discard block
 block discarded – undo
846 980
 
847 981
 		// Call a trigger when the read count is updated (before)
848 982
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
849
-		if(!$trigger_output->toBool()) return $trigger_output;
983
+		if(!$trigger_output->toBool()) {
984
+			return $trigger_output;
985
+		}
850 986
 
851 987
 		// Pass if read count is increaded on the session information
852
-		if($_SESSION['readed_document'][$document_srl]) return false;
988
+		if($_SESSION['readed_document'][$document_srl]) {
989
+			return false;
990
+		}
853 991
 
854 992
 		// Pass if the author's IP address is as same as visitor's.
855 993
 		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
@@ -914,7 +1052,9 @@  discard block
 block discarded – undo
914 1052
 	 */
915 1053
 	function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid)
916 1054
 	{
917
-		if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request');
1055
+		if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) {
1056
+			return new Object(-1,'msg_invalid_request');
1057
+		}
918 1058
 
919 1059
 		$obj = new stdClass();
920 1060
 		$obj->module_srl = $module_srl;
@@ -931,8 +1071,7 @@  discard block
 block discarded – undo
931 1071
 		if(!$output->data)
932 1072
 		{
933 1073
 			$output = executeQuery('document.insertDocumentExtraKey', $obj);
934
-		}
935
-		else
1074
+		} else
936 1075
 		{
937 1076
 			$output = executeQuery('document.updateDocumentExtraKey', $obj);
938 1077
 			// Update the extra var(eid)
@@ -958,10 +1097,14 @@  discard block
 block discarded – undo
958 1097
 	 */
959 1098
 	function deleteDocumentExtraKeys($module_srl, $var_idx = null)
960 1099
 	{
961
-		if(!$module_srl) return new Object(-1,'msg_invalid_request');
1100
+		if(!$module_srl) {
1101
+			return new Object(-1,'msg_invalid_request');
1102
+		}
962 1103
 		$obj = new stdClass();
963 1104
 		$obj->module_srl = $module_srl;
964
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1105
+		if(!is_null($var_idx)) {
1106
+			$obj->var_idx = $var_idx;
1107
+		}
965 1108
 
966 1109
 		$oDB = DB::getInstance();
967 1110
 		$oDB->begin();
@@ -1025,8 +1168,12 @@  discard block
 block discarded – undo
1025 1168
 	 */
1026 1169
 	function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '')
1027 1170
 	{
1028
-		if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request');
1029
-		if(!$lang_code) $lang_code = Context::getLangType();
1171
+		if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) {
1172
+			return new Object(-1,'msg_invalid_request');
1173
+		}
1174
+		if(!$lang_code) {
1175
+			$lang_code = Context::getLangType();
1176
+		}
1030 1177
 
1031 1178
 		$obj = new stdClass;
1032 1179
 		$obj->module_srl = $module_srl;
@@ -1052,10 +1199,18 @@  discard block
 block discarded – undo
1052 1199
 	{
1053 1200
 		$obj = new stdClass();
1054 1201
 		$obj->module_srl = $module_srl;
1055
-		if(!is_null($document_srl)) $obj->document_srl = $document_srl;
1056
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1057
-		if(!is_null($lang_code)) $obj->lang_code = $lang_code;
1058
-		if(!is_null($eid)) $obj->eid = $eid;
1202
+		if(!is_null($document_srl)) {
1203
+			$obj->document_srl = $document_srl;
1204
+		}
1205
+		if(!is_null($var_idx)) {
1206
+			$obj->var_idx = $var_idx;
1207
+		}
1208
+		if(!is_null($lang_code)) {
1209
+			$obj->lang_code = $lang_code;
1210
+		}
1211
+		if(!is_null($eid)) {
1212
+			$obj->eid = $eid;
1213
+		}
1059 1214
 		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
1060 1215
 		return $output;
1061 1216
 	}
@@ -1069,8 +1224,11 @@  discard block
 block discarded – undo
1069 1224
 	 */
1070 1225
 	function updateVotedCount($document_srl, $point = 1)
1071 1226
 	{
1072
-		if($point > 0) $failed_voted = 'failed_voted';
1073
-		else $failed_voted = 'failed_blamed';
1227
+		if($point > 0) {
1228
+			$failed_voted = 'failed_voted';
1229
+		} else {
1230
+			$failed_voted = 'failed_blamed';
1231
+		}
1074 1232
 		// Return fail if session already has information about votes
1075 1233
 		if($_SESSION['voted_document'][$document_srl])
1076 1234
 		{
@@ -1106,8 +1264,7 @@  discard block
 block discarded – undo
1106 1264
 		if($member_srl)
1107 1265
 		{
1108 1266
 			$args->member_srl = $member_srl;
1109
-		}
1110
-		else
1267
+		} else
1111 1268
 		{
1112 1269
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
1113 1270
 		}
@@ -1129,17 +1286,20 @@  discard block
 block discarded – undo
1129 1286
 		{
1130 1287
 			$args->blamed_count = $oDocument->get('blamed_count') + $point;
1131 1288
 			$output = executeQuery('document.updateBlamedCount', $args);
1132
-		}
1133
-		else
1289
+		} else
1134 1290
 		{
1135 1291
 			$args->voted_count = $oDocument->get('voted_count') + $point;
1136 1292
 			$output = executeQuery('document.updateVotedCount', $args);
1137 1293
 		}
1138
-		if(!$output->toBool()) return $output;
1294
+		if(!$output->toBool()) {
1295
+			return $output;
1296
+		}
1139 1297
 		// Leave logs
1140 1298
 		$args->point = $point;
1141 1299
 		$output = executeQuery('document.insertDocumentVotedLog', $args);
1142
-		if(!$output->toBool()) return $output;
1300
+		if(!$output->toBool()) {
1301
+			return $output;
1302
+		}
1143 1303
 
1144 1304
 		$obj = new stdClass;
1145 1305
 		$obj->member_srl = $oDocument->get('member_srl');
@@ -1175,8 +1335,7 @@  discard block
 block discarded – undo
1175 1335
 		{
1176 1336
 			$output->setMessage('success_voted');
1177 1337
 			$output->add('voted_count', $obj->after_point);
1178
-		}
1179
-		else
1338
+		} else
1180 1339
 		{
1181 1340
 			$output->setMessage('success_blamed');
1182 1341
 			$output->add('blamed_count', $obj->after_point);
@@ -1193,13 +1352,17 @@  discard block
 block discarded – undo
1193 1352
 	function declaredDocument($document_srl)
1194 1353
 	{
1195 1354
 		// Fail if session information already has a reported document
1196
-		if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
1355
+		if($_SESSION['declared_document'][$document_srl]) {
1356
+			return new Object(-1, 'failed_declared');
1357
+		}
1197 1358
 
1198 1359
 		// Check if previously reported
1199 1360
 		$args = new stdClass();
1200 1361
 		$args->document_srl = $document_srl;
1201 1362
 		$output = executeQuery('document.getDeclaredDocument', $args);
1202
-		if(!$output->toBool()) return $output;
1363
+		if(!$output->toBool()) {
1364
+			return $output;
1365
+		}
1203 1366
 
1204 1367
 		$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
1205 1368
 
@@ -1243,8 +1406,7 @@  discard block
 block discarded – undo
1243 1406
 		if($member_srl)
1244 1407
 		{
1245 1408
 			$args->member_srl = $member_srl;
1246
-		}
1247
-		else
1409
+		} else
1248 1410
 		{
1249 1411
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
1250 1412
 		}
@@ -1264,9 +1426,14 @@  discard block
 block discarded – undo
1264 1426
 		$oDB->begin();
1265 1427
 
1266 1428
 		// Add the declared document
1267
-		if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1268
-		else $output = executeQuery('document.insertDeclaredDocument', $args);
1269
-		if(!$output->toBool()) return $output;
1429
+		if($declared_count > 0) {
1430
+			$output = executeQuery('document.updateDeclaredDocument', $args);
1431
+		} else {
1432
+			$output = executeQuery('document.insertDeclaredDocument', $args);
1433
+		}
1434
+		if(!$output->toBool()) {
1435
+			return $output;
1436
+		}
1270 1437
 		// Leave logs
1271 1438
 		$output = executeQuery('document.insertDocumentDeclaredLog', $args);
1272 1439
 		if(!$output->toBool())
@@ -1365,9 +1532,10 @@  discard block
 block discarded – undo
1365 1532
 			$parent_category = $oDocumentModel->getCategory($obj->parent_srl);
1366 1533
 			$obj->list_order = $parent_category->list_order;
1367 1534
 			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1);
1368
-			if(!$obj->category_srl) $obj->category_srl = getNextSequence();
1369
-		}
1370
-		else
1535
+			if(!$obj->category_srl) {
1536
+				$obj->category_srl = getNextSequence();
1537
+			}
1538
+		} else
1371 1539
 		{
1372 1540
 			$obj->list_order = $obj->category_srl = getNextSequence();
1373 1541
 		}
@@ -1407,13 +1575,17 @@  discard block
 block discarded – undo
1407 1575
 	{
1408 1576
 		// Create a document model object
1409 1577
 		$oDocumentModel = getModel('document');
1410
-		if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
1578
+		if(!$document_count) {
1579
+			$document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
1580
+		}
1411 1581
 
1412 1582
 		$args = new stdClass;
1413 1583
 		$args->category_srl = $category_srl;
1414 1584
 		$args->document_count = $document_count;
1415 1585
 		$output = executeQuery('document.updateCategoryCount', $args);
1416
-		if($output->toBool()) $this->makeCategoryFile($module_srl);
1586
+		if($output->toBool()) {
1587
+			$this->makeCategoryFile($module_srl);
1588
+		}
1417 1589
 
1418 1590
 		return $output;
1419 1591
 	}
@@ -1426,7 +1598,9 @@  discard block
 block discarded – undo
1426 1598
 	function updateCategory($obj)
1427 1599
 	{
1428 1600
 		$output = executeQuery('document.updateCategory', $obj);
1429
-		if($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1601
+		if($output->toBool()) {
1602
+			$this->makeCategoryFile($obj->module_srl);
1603
+		}
1430 1604
 		return $output;
1431 1605
 	}
1432 1606
 
@@ -1443,11 +1617,17 @@  discard block
 block discarded – undo
1443 1617
 		$category_info = $oDocumentModel->getCategory($category_srl);
1444 1618
 		// Display an error that the category cannot be deleted if it has a child
1445 1619
 		$output = executeQuery('document.getChildCategoryCount', $args);
1446
-		if(!$output->toBool()) return $output;
1447
-		if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child');
1620
+		if(!$output->toBool()) {
1621
+			return $output;
1622
+		}
1623
+		if($output->data->count>0) {
1624
+			return new Object(-1, 'msg_cannot_delete_for_child');
1625
+		}
1448 1626
 		// Delete a category information
1449 1627
 		$output = executeQuery('document.deleteCategory', $args);
1450
-		if(!$output->toBool()) return $output;
1628
+		if(!$output->toBool()) {
1629
+			return $output;
1630
+		}
1451 1631
 
1452 1632
 		$this->makeCategoryFile($category_info->module_srl);
1453 1633
 		// remvove cache
@@ -1462,8 +1642,9 @@  discard block
 block discarded – undo
1462 1642
 				$args->page = ++$page;
1463 1643
 				$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
1464 1644
 
1465
-				if($output->data == array())
1466
-					break;
1645
+				if($output->data == array()) {
1646
+									break;
1647
+				}
1467 1648
 
1468 1649
 				foreach($output->data as $val)
1469 1650
 				{
@@ -1515,18 +1696,26 @@  discard block
 block discarded – undo
1515 1696
 		// Seek a full list of categories
1516 1697
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1517 1698
 		$category_srl_list = array_keys($category_list);
1518
-		if(count($category_srl_list)<2) return new Object();
1699
+		if(count($category_srl_list)<2) {
1700
+			return new Object();
1701
+		}
1519 1702
 
1520 1703
 		$prev_category = NULL;
1521 1704
 		foreach($category_list as $key => $val)
1522 1705
 		{
1523
-			if($key==$category_srl) break;
1706
+			if($key==$category_srl) {
1707
+				break;
1708
+			}
1524 1709
 			$prev_category = $val;
1525 1710
 		}
1526 1711
 		// Return if the previous category doesn't exist
1527
-		if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved'));
1712
+		if(!$prev_category) {
1713
+			return new Object(-1,Context::getLang('msg_category_not_moved'));
1714
+		}
1528 1715
 		// Return if the selected category is the top level
1529
-		if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved'));
1716
+		if($category_srl_list[0]==$category_srl) {
1717
+			return new Object(-1,Context::getLang('msg_category_not_moved'));
1718
+		}
1530 1719
 		// Information of the selected category
1531 1720
 		$cur_args = new stdClass;
1532 1721
 		$cur_args->category_srl = $category_srl;
@@ -1562,15 +1751,21 @@  discard block
 block discarded – undo
1562 1751
 		// Seek a full list of categories
1563 1752
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1564 1753
 		$category_srl_list = array_keys($category_list);
1565
-		if(count($category_srl_list)<2) return new Object();
1754
+		if(count($category_srl_list)<2) {
1755
+			return new Object();
1756
+		}
1566 1757
 
1567 1758
 		for($i=0;$i<count($category_srl_list);$i++)
1568 1759
 		{
1569
-			if($category_srl_list[$i]==$category_srl) break;
1760
+			if($category_srl_list[$i]==$category_srl) {
1761
+				break;
1762
+			}
1570 1763
 		}
1571 1764
 
1572 1765
 		$next_category_srl = $category_srl_list[$i+1];
1573
-		if(!$category_list[$next_category_srl]) return new Object(-1,Context::getLang('msg_category_not_moved'));
1766
+		if(!$category_list[$next_category_srl]) {
1767
+			return new Object(-1,Context::getLang('msg_category_not_moved'));
1768
+		}
1574 1769
 		$next_category = $category_list[$next_category_srl];
1575 1770
 		// Information of the selected category
1576 1771
 		$cur_args = new stdClass;
@@ -1597,7 +1792,9 @@  discard block
 block discarded – undo
1597 1792
 	{
1598 1793
 		$oDocumentModel = getModel('document');
1599 1794
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
1600
-		if(!count($extra_keys)) return;
1795
+		if(!count($extra_keys)) {
1796
+			return;
1797
+		}
1601 1798
 
1602 1799
 		$js_code = array();
1603 1800
 		$js_code[] = '<script>//<![CDATA[';
@@ -1616,7 +1813,9 @@  discard block
 block discarded – undo
1616 1813
 			}
1617 1814
 			$name = str_ireplace(array('<script', '</script'), array('<scr" + "ipt', '</scr" + "ipt'), $val->name);
1618 1815
 			$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["extra_vars%s","%s"]);', $idx, $name);
1619
-			if($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1816
+			if($val->is_required == 'Y') {
1817
+				$js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1818
+			}
1620 1819
 		}
1621 1820
 
1622 1821
 		$js_code[] = '})(jQuery);';
@@ -1634,7 +1833,9 @@  discard block
 block discarded – undo
1634 1833
 	function procDocumentInsertCategory($args = null)
1635 1834
 	{
1636 1835
 		// List variables
1637
-		if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
1836
+		if(!$args) {
1837
+			$args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
1838
+		}
1638 1839
 		$args->title = $args->category_title;
1639 1840
 		$args->description = $args->category_description;
1640 1841
 		$args->color = $args->category_color;
@@ -1650,11 +1851,18 @@  discard block
 block discarded – undo
1650 1851
 		$columnList = array('module_srl', 'module');
1651 1852
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1652 1853
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1653
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1854
+		if(!$grant->manager) {
1855
+			return new Object(-1,'msg_not_permitted');
1856
+		}
1654 1857
 
1655
-		if($args->expand !="Y") $args->expand = "N";
1656
-		if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls);
1657
-		else $args->group_srls = implode(',', $args->group_srls);
1858
+		if($args->expand !="Y") {
1859
+			$args->expand = "N";
1860
+		}
1861
+		if(!is_array($args->group_srls)) {
1862
+			$args->group_srls = str_replace('|@|',',',$args->group_srls);
1863
+		} else {
1864
+			$args->group_srls = implode(',', $args->group_srls);
1865
+		}
1658 1866
 		$args->parent_srl = (int)$args->parent_srl;
1659 1867
 
1660 1868
 		$oDocumentModel = getModel('document');
@@ -1665,7 +1873,9 @@  discard block
 block discarded – undo
1665 1873
 		if($args->category_srl)
1666 1874
 		{
1667 1875
 			$category_info = $oDocumentModel->getCategory($args->category_srl);
1668
-			if($category_info->category_srl != $args->category_srl) $args->category_srl = null;
1876
+			if($category_info->category_srl != $args->category_srl) {
1877
+				$args->category_srl = null;
1878
+			}
1669 1879
 		}
1670 1880
 		// Update if exists
1671 1881
 		if($args->category_srl)
@@ -1677,8 +1887,7 @@  discard block
 block discarded – undo
1677 1887
 				return $output;
1678 1888
 			}
1679 1889
 			// Insert if not exist
1680
-		}
1681
-		else
1890
+		} else
1682 1891
 		{
1683 1892
 			$output = $this->insertCategory($args);
1684 1893
 			if(!$output->toBool())
@@ -1720,7 +1929,9 @@  discard block
 block discarded – undo
1720 1929
 		$columnList = array('module_srl', 'module');
1721 1930
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList);
1722 1931
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1723
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1932
+		if(!$grant->manager) {
1933
+			return new Object(-1,'msg_not_permitted');
1934
+		}
1724 1935
 
1725 1936
 		// First child of the parent_category_srl
1726 1937
 		$source_args = new stdClass;
@@ -1733,30 +1944,39 @@  discard block
 block discarded – undo
1733 1944
 			$args->parent_srl = $parent_category_srl;
1734 1945
 			$output = executeQuery('document.getChildCategoryMinListOrder', $args);
1735 1946
 
1736
-			if(!$output->toBool()) return $output;
1947
+			if(!$output->toBool()) {
1948
+				return $output;
1949
+			}
1737 1950
 			$args->list_order = (int)$output->data->list_order;
1738
-			if(!$args->list_order) $args->list_order = 0;
1951
+			if(!$args->list_order) {
1952
+				$args->list_order = 0;
1953
+			}
1739 1954
 			$args->list_order--;
1740 1955
 
1741 1956
 			$source_args->category_srl = $source_category_srl;
1742 1957
 			$source_args->parent_srl = $parent_category_srl;
1743 1958
 			$source_args->list_order = $args->list_order;
1744 1959
 			$output = $this->updateCategory($source_args);
1745
-			if(!$output->toBool()) return $output;
1960
+			if(!$output->toBool()) {
1961
+				return $output;
1962
+			}
1746 1963
 			// Sibling of the $target_category_srl
1747
-		}
1748
-		else if($target_category_srl > 0)
1964
+		} else if($target_category_srl > 0)
1749 1965
 		{
1750 1966
 			$target_category = $oDocumentModel->getCategory($target_category_srl);
1751 1967
 			// Move all siblings of the $target_category down
1752 1968
 			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1);
1753
-			if(!$output->toBool()) return $output;
1969
+			if(!$output->toBool()) {
1970
+				return $output;
1971
+			}
1754 1972
 
1755 1973
 			$source_args->category_srl = $source_category_srl;
1756 1974
 			$source_args->parent_srl = $target_category->parent_srl;
1757 1975
 			$source_args->list_order = $target_category->list_order+1;
1758 1976
 			$output = $this->updateCategory($source_args);
1759
-			if(!$output->toBool()) return $output;
1977
+			if(!$output->toBool()) {
1978
+				return $output;
1979
+			}
1760 1980
 		}
1761 1981
 		// Re-generate the xml file
1762 1982
 		$xml_file = $this->makeCategoryFile($source_category->module_srl);
@@ -1781,14 +2001,20 @@  discard block
 block discarded – undo
1781 2001
 		$columnList = array('module_srl', 'module');
1782 2002
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1783 2003
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1784
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2004
+		if(!$grant->manager) {
2005
+			return new Object(-1,'msg_not_permitted');
2006
+		}
1785 2007
 
1786 2008
 		$oDocumentModel = getModel('document');
1787 2009
 		// Get original information
1788 2010
 		$category_info = $oDocumentModel->getCategory($args->category_srl);
1789
-		if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
2011
+		if($category_info->parent_srl) {
2012
+			$parent_srl = $category_info->parent_srl;
2013
+		}
1790 2014
 		// Display an error that the category cannot be deleted if it has a child node
1791
-		if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child');
2015
+		if($oDocumentModel->getCategoryChlidCount($args->category_srl)) {
2016
+			return new Object(-1, 'msg_cannot_delete_for_child');
2017
+		}
1792 2018
 		// Remove from the DB
1793 2019
 		$output = $this->deleteCategory($args->category_srl);
1794 2020
 		if(!$output->toBool())
@@ -1822,7 +2048,9 @@  discard block
 block discarded – undo
1822 2048
 		$columnList = array('module_srl', 'module');
1823 2049
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1824 2050
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1825
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
2051
+		if(!$grant->manager) {
2052
+			return new Object(-1,'msg_not_permitted');
2053
+		}
1826 2054
 
1827 2055
 		$xml_file = $this->makeCategoryFile($module_srl);
1828 2056
 		// Set return value
@@ -1837,14 +2065,18 @@  discard block
 block discarded – undo
1837 2065
 	function makeCategoryFile($module_srl)
1838 2066
 	{
1839 2067
 		// Return if there is no information you need for creating a cache file
1840
-		if(!$module_srl) return false;
2068
+		if(!$module_srl) {
2069
+			return false;
2070
+		}
1841 2071
 		// Get module information (to obtain mid)
1842 2072
 		$oModuleModel = getModel('module');
1843 2073
 		$columnList = array('module_srl', 'mid', 'site_srl');
1844 2074
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1845 2075
 		$mid = $module_info->mid;
1846 2076
 
1847
-		if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
2077
+		if(!is_dir('./files/cache/document_category')) {
2078
+			FileHandler::makeDir('./files/cache/document_category');
2079
+		}
1848 2080
 		// Cache file's name
1849 2081
 		$xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl);
1850 2082
 		$php_file = sprintf("./files/cache/document_category/%s.php", $module_srl);
@@ -1856,13 +2088,17 @@  discard block
 block discarded – undo
1856 2088
 
1857 2089
 		$category_list = $output->data;
1858 2090
 
1859
-		if(!is_array($category_list)) $category_list = array($category_list);
2091
+		if(!is_array($category_list)) {
2092
+			$category_list = array($category_list);
2093
+		}
1860 2094
 
1861 2095
 		$category_count = count($category_list);
1862 2096
 		for($i=0;$i<$category_count;$i++)
1863 2097
 		{
1864 2098
 			$category_srl = $category_list[$i]->category_srl;
1865
-			if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
2099
+			if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) {
2100
+				$category_list[$i]->group_srls = '';
2101
+			}
1866 2102
 			$list[$category_srl] = $category_list[$i];
1867 2103
 		}
1868 2104
 		// Create the xml file without node data if no data is obtained
@@ -1874,7 +2110,9 @@  discard block
 block discarded – undo
1874 2110
 			return $xml_file;
1875 2111
 		}
1876 2112
 		// Change to an array if only a single data is obtained
1877
-		if(!is_array($list)) $list = array($list);
2113
+		if(!is_array($list)) {
2114
+			$list = array($list);
2115
+		}
1878 2116
 		// Create a tree for loop
1879 2117
 		foreach($list as $category_srl => $node)
1880 2118
 		{
@@ -1953,13 +2191,17 @@  discard block
 block discarded – undo
1953 2191
 	 */
1954 2192
 	function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff)
1955 2193
 	{
1956
-		if(!$source_node) return;
2194
+		if(!$source_node) {
2195
+			return;
2196
+		}
1957 2197
 
1958 2198
 		foreach($source_node as $category_srl => $node)
1959 2199
 		{
1960 2200
 			$child_buff = "";
1961 2201
 			// Get data of the child nodes
1962
-			if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
2202
+			if($category_srl && $tree[$category_srl]) {
2203
+				$child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
2204
+			}
1963 2205
 			// List variables
1964 2206
 			$expand = $node->expand;
1965 2207
 			$group_srls = $node->group_srls;
@@ -1969,8 +2211,11 @@  discard block
 block discarded – undo
1969 2211
 			$color = $node->color;
1970 2212
 			$description = $node->description;
1971 2213
 			// If node->group_srls value exists
1972
-			if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
1973
-			else $group_check_code = "true";
2214
+			if($group_srls) {
2215
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
2216
+			} else {
2217
+				$group_check_code = "true";
2218
+			}
1974 2219
 
1975 2220
 			$title = $node->title;
1976 2221
 			$oModuleAdminModel = getAdminModel('module');
@@ -2010,8 +2255,11 @@  discard block
 block discarded – undo
2010 2255
 				$node->document_count
2011 2256
 			);
2012 2257
 
2013
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2014
-			else $buff .=  sprintf('<node %s />', $attribute);
2258
+			if($child_buff) {
2259
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2260
+			} else {
2261
+				$buff .=  sprintf('<node %s />', $attribute);
2262
+			}
2015 2263
 		}
2016 2264
 		return $buff;
2017 2265
 	}
@@ -2030,7 +2278,9 @@  discard block
 block discarded – undo
2030 2278
 	function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff)
2031 2279
 	{
2032 2280
 		$output = array("buff"=>"", "category_srl_list"=>array());
2033
-		if(!$source_node) return $output;
2281
+		if(!$source_node) {
2282
+			return $output;
2283
+		}
2034 2284
 
2035 2285
 		// Set to an arraty for looping and then generate php script codes to be included
2036 2286
 		foreach($source_node as $category_srl => $node)
@@ -2129,7 +2379,9 @@  discard block
 block discarded – undo
2129 2379
 	function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self')
2130 2380
 	{
2131 2381
 		$document_popup_menu_list = Context::get('document_popup_menu_list');
2132
-		if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2382
+		if(!is_array($document_popup_menu_list)) {
2383
+			$document_popup_menu_list = array();
2384
+		}
2133 2385
 
2134 2386
 		$obj = new stdClass();
2135 2387
 		$obj->url = $url;
@@ -2147,7 +2399,9 @@  discard block
 block discarded – undo
2147 2399
 	 */
2148 2400
 	function procDocumentAddCart()
2149 2401
 	{
2150
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
2402
+		if(!Context::get('is_logged')) {
2403
+			return new Object(-1, 'msg_not_permitted');
2404
+		}
2151 2405
 
2152 2406
 		// Get document_srl
2153 2407
 		$srls = explode(',',Context::get('srls'));
@@ -2155,11 +2409,15 @@  discard block
 block discarded – undo
2155 2409
 		{
2156 2410
 			$srl = trim($srls[$i]);
2157 2411
 
2158
-			if(!$srl) continue;
2412
+			if(!$srl) {
2413
+				continue;
2414
+			}
2159 2415
 
2160 2416
 			$document_srls[] = $srl;
2161 2417
 		}
2162
-		if(!count($document_srls)) return;
2418
+		if(!count($document_srls)) {
2419
+			return;
2420
+		}
2163 2421
 
2164 2422
 		// Get module_srl of the documents
2165 2423
 		$args = new stdClass;
@@ -2167,14 +2425,18 @@  discard block
 block discarded – undo
2167 2425
 		$args->document_srls = implode(',',$document_srls);
2168 2426
 		$args->order_type = 'asc';
2169 2427
 		$output = executeQueryArray('document.getDocuments', $args);
2170
-		if(!$output->data) return new Object();
2428
+		if(!$output->data) {
2429
+			return new Object();
2430
+		}
2171 2431
 
2172 2432
 		unset($document_srls);
2173 2433
 		foreach($output->data as $key => $val)
2174 2434
 		{
2175 2435
 			$document_srls[$val->module_srl][] = $val->document_srl;
2176 2436
 		}
2177
-		if(!$document_srls || !count($document_srls)) return new Object();
2437
+		if(!$document_srls || !count($document_srls)) {
2438
+			return new Object();
2439
+		}
2178 2440
 
2179 2441
 		// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents)
2180 2442
 		$oModuleModel = getModel('module');
@@ -2199,7 +2461,9 @@  discard block
 block discarded – undo
2199 2461
 				}
2200 2462
 			}
2201 2463
 		}
2202
-		if(!count($document_srls)) return new Object();
2464
+		if(!count($document_srls)) {
2465
+			return new Object();
2466
+		}
2203 2467
 
2204 2468
 		foreach($document_srls as $module_srl => $documents)
2205 2469
 		{
@@ -2207,9 +2471,14 @@  discard block
 block discarded – undo
2207 2471
 			for($i=0;$i<$cnt;$i++)
2208 2472
 			{
2209 2473
 				$document_srl = (int)trim($documents[$i]);
2210
-				if(!$document_srls) continue;
2211
-				if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2212
-				else $_SESSION['document_management'][$document_srl] = true;
2474
+				if(!$document_srls) {
2475
+					continue;
2476
+				}
2477
+				if($_SESSION['document_management'][$document_srl]) {
2478
+					unset($_SESSION['document_management'][$document_srl]);
2479
+				} else {
2480
+					$_SESSION['document_management'][$document_srl] = true;
2481
+				}
2213 2482
 			}
2214 2483
 		}
2215 2484
 	}
@@ -2221,7 +2490,9 @@  discard block
 block discarded – undo
2221 2490
 	function procDocumentManageCheckedDocument()
2222 2491
 	{
2223 2492
 		@set_time_limit(0);
2224
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2493
+		if(!Context::get('is_logged')) {
2494
+			return new Object(-1,'msg_not_permitted');
2495
+		}
2225 2496
 
2226 2497
 		if(!checkCSRF())
2227 2498
 		{
@@ -2231,14 +2502,21 @@  discard block
 block discarded – undo
2231 2502
 		$type = Context::get('type');
2232 2503
 		$target_module = Context::get('target_module');
2233 2504
 		$module_srl = Context::get('module_srl');
2234
-		if($target_module && !$module_srl) $module_srl = $target_module;
2505
+		if($target_module && !$module_srl) {
2506
+			$module_srl = $target_module;
2507
+		}
2235 2508
 		$category_srl = Context::get('target_category');
2236 2509
 		$message_content = Context::get('message_content');
2237
-		if($message_content) $message_content = nl2br($message_content);
2510
+		if($message_content) {
2511
+			$message_content = nl2br($message_content);
2512
+		}
2238 2513
 
2239 2514
 		$cart = Context::get('cart');
2240
-		if(!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2241
-		else $document_srl_list = $cart;
2515
+		if(!is_array($cart)) {
2516
+			$document_srl_list = explode('|@|', $cart);
2517
+		} else {
2518
+			$document_srl_list = $cart;
2519
+		}
2242 2520
 
2243 2521
 		$document_srl_count = count($document_srl_list);
2244 2522
 
@@ -2248,7 +2526,9 @@  discard block
 block discarded – undo
2248 2526
 		{
2249 2527
 			$oDocument = $oDocumentModel->getDocument($document_srl);
2250 2528
 			$document_items[] = $oDocument;
2251
-			if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2529
+			if(!$oDocument->isGranted()) {
2530
+				return $this->stop('msg_not_permitted');
2531
+			}
2252 2532
 		}
2253 2533
 
2254 2534
 		// Send a message
@@ -2264,10 +2544,15 @@  discard block
 block discarded – undo
2264 2544
 
2265 2545
 			foreach($document_items as $oDocument)
2266 2546
 			{
2267
-				if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue;
2547
+				if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) {
2548
+					continue;
2549
+				}
2268 2550
 
2269
-				if($type=='move') $purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2270
-				else $purl = "";
2551
+				if($type=='move') {
2552
+					$purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2553
+				} else {
2554
+					$purl = "";
2555
+				}
2271 2556
 				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2272 2557
 
2273 2558
 				$oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false);
@@ -2280,24 +2565,30 @@  discard block
 block discarded – undo
2280 2565
 		$oDocumentAdminController = getAdminController('document');
2281 2566
 		if($type == 'move')
2282 2567
 		{
2283
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2568
+			if(!$module_srl) {
2569
+				return new Object(-1, 'fail_to_move');
2570
+			}
2284 2571
 
2285 2572
 			$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl);
2286
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2573
+			if(!$output->toBool()) {
2574
+				return new Object(-1, 'fail_to_move');
2575
+			}
2287 2576
 
2288 2577
 			$msg_code = 'success_moved';
2289 2578
 
2290
-		}
2291
-		else if($type == 'copy')
2579
+		} else if($type == 'copy')
2292 2580
 		{
2293
-			if(!$module_srl) return new Object(-1, 'fail_to_move');
2581
+			if(!$module_srl) {
2582
+				return new Object(-1, 'fail_to_move');
2583
+			}
2294 2584
 
2295 2585
 			$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
2296
-			if(!$output->toBool()) return new Object(-1, 'fail_to_move');
2586
+			if(!$output->toBool()) {
2587
+				return new Object(-1, 'fail_to_move');
2588
+			}
2297 2589
 
2298 2590
 			$msg_code = 'success_copied';
2299
-		}
2300
-		else if($type =='delete')
2591
+		} else if($type =='delete')
2301 2592
 		{
2302 2593
 			$oDB = &DB::getInstance();
2303 2594
 			$oDB->begin();
@@ -2305,12 +2596,13 @@  discard block
 block discarded – undo
2305 2596
 			{
2306 2597
 				$document_srl = $document_srl_list[$i];
2307 2598
 				$output = $this->deleteDocument($document_srl, true);
2308
-				if(!$output->toBool()) return new Object(-1, 'fail_to_delete');
2599
+				if(!$output->toBool()) {
2600
+					return new Object(-1, 'fail_to_delete');
2601
+				}
2309 2602
 			}
2310 2603
 			$oDB->commit();
2311 2604
 			$msg_code = 'success_deleted';
2312
-		}
2313
-		else if($type == 'trash')
2605
+		} else if($type == 'trash')
2314 2606
 		{
2315 2607
 			$args = new stdClass();
2316 2608
 			$args->description = $message_content;
@@ -2320,12 +2612,13 @@  discard block
 block discarded – undo
2320 2612
 			for($i=0;$i<$document_srl_count;$i++) {
2321 2613
 				$args->document_srl = $document_srl_list[$i];
2322 2614
 				$output = $this->moveDocumentToTrash($args);
2323
-				if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash');
2615
+				if(!$output || !$output->toBool()) {
2616
+					return new Object(-1, 'fail_to_trash');
2617
+				}
2324 2618
 			}
2325 2619
 			$oDB->commit();
2326 2620
 			$msg_code = 'success_trashed';
2327
-		}
2328
-		else if($type == 'cancelDeclare')
2621
+		} else if($type == 'cancelDeclare')
2329 2622
 		{
2330 2623
 			$args->document_srl = $document_srl_list;
2331 2624
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
@@ -2347,18 +2640,27 @@  discard block
 block discarded – undo
2347 2640
 	function procDocumentInsertModuleConfig()
2348 2641
 	{
2349 2642
 		$module_srl = Context::get('target_module_srl');
2350
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
2351
-		else $module_srl = array($module_srl);
2643
+		if(preg_match('/^([0-9,]+)$/',$module_srl)) {
2644
+			$module_srl = explode(',',$module_srl);
2645
+		} else {
2646
+			$module_srl = array($module_srl);
2647
+		}
2352 2648
 
2353 2649
 		$document_config = new stdClass();
2354 2650
 		$document_config->use_history = Context::get('use_history');
2355
-		if(!$document_config->use_history) $document_config->use_history = 'N';
2651
+		if(!$document_config->use_history) {
2652
+			$document_config->use_history = 'N';
2653
+		}
2356 2654
 
2357 2655
 		$document_config->use_vote_up = Context::get('use_vote_up');
2358
-		if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2656
+		if(!$document_config->use_vote_up) {
2657
+			$document_config->use_vote_up = 'Y';
2658
+		}
2359 2659
 
2360 2660
 		$document_config->use_vote_down = Context::get('use_vote_down');
2361
-		if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2661
+		if(!$document_config->use_vote_down) {
2662
+			$document_config->use_vote_down = 'Y';
2663
+		}
2362 2664
 
2363 2665
 		$document_config->use_status = Context::get('use_status');
2364 2666
 
@@ -2366,7 +2668,9 @@  discard block
 block discarded – undo
2366 2668
 		for($i=0;$i<count($module_srl);$i++)
2367 2669
 		{
2368 2670
 			$srl = trim($module_srl[$i]);
2369
-			if(!$srl) continue;
2671
+			if(!$srl) {
2672
+				continue;
2673
+			}
2370 2674
 			$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
2371 2675
 		}
2372 2676
 		$this->setError(-1);
@@ -2383,7 +2687,9 @@  discard block
 block discarded – undo
2383 2687
 	function procDocumentTempSave()
2384 2688
 	{
2385 2689
 		// Check login information
2386
-		if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
2690
+		if(!Context::get('is_logged')) {
2691
+			return new Object(-1, 'msg_not_logged');
2692
+		}
2387 2693
 		$module_info = Context::get('module_info');
2388 2694
 		$logged_info = Context::get('logged_info');
2389 2695
 
@@ -2421,8 +2727,7 @@  discard block
 block discarded – undo
2421 2727
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
2422 2728
 			$msg_code = 'success_updated';
2423 2729
 			// Otherwise, get a new
2424
-		}
2425
-		else
2730
+		} else
2426 2731
 		{
2427 2732
 			$output = $oDocumentController->insertDocument($obj);
2428 2733
 			$msg_code = 'success_registed';
@@ -2448,17 +2753,20 @@  discard block
 block discarded – undo
2448 2753
 	 */
2449 2754
 	function procDocumentGetList()
2450 2755
 	{
2451
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
2756
+		if(!Context::get('is_logged')) {
2757
+			return new Object(-1,'msg_not_permitted');
2758
+		}
2452 2759
 		$documentSrls = Context::get('document_srls');
2453
-		if($documentSrls) $documentSrlList = explode(',', $documentSrls);
2760
+		if($documentSrls) {
2761
+			$documentSrlList = explode(',', $documentSrls);
2762
+		}
2454 2763
 
2455 2764
 		if(count($documentSrlList) > 0)
2456 2765
 		{
2457 2766
 			$oDocumentModel = getModel('document');
2458 2767
 			$columnList = array('document_srl', 'title', 'nick_name', 'status');
2459 2768
 			$documentList = $oDocumentModel->getDocuments($documentSrlList, $this->grant->is_admin, false, $columnList);
2460
-		}
2461
-		else
2769
+		} else
2462 2770
 		{
2463 2771
 			global $lang;
2464 2772
 			$documentList = array();
@@ -2476,11 +2784,18 @@  discard block
 block discarded – undo
2476 2784
 	 */
2477 2785
 	function _checkCommentStatusForOldVersion(&$obj)
2478 2786
 	{
2479
-		if(!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2480
-		if(!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2787
+		if(!isset($obj->allow_comment)) {
2788
+			$obj->allow_comment = 'N';
2789
+		}
2790
+		if(!isset($obj->lock_comment)) {
2791
+			$obj->lock_comment = 'N';
2792
+		}
2481 2793
 
2482
-		if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2483
-		else $obj->commentStatus = 'DENY';
2794
+		if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') {
2795
+			$obj->commentStatus = 'ALLOW';
2796
+		} else {
2797
+			$obj->commentStatus = 'DENY';
2798
+		}
2484 2799
 	}
2485 2800
 
2486 2801
 	/**
@@ -2490,8 +2805,12 @@  discard block
 block discarded – undo
2490 2805
 	 */
2491 2806
 	function _checkDocumentStatusForOldVersion(&$obj)
2492 2807
 	{
2493
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2494
-		if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2808
+		if(!$obj->status && $obj->is_secret == 'Y') {
2809
+			$obj->status = $this->getConfigStatus('secret');
2810
+		}
2811
+		if(!$obj->status && $obj->is_secret != 'Y') {
2812
+			$obj->status = $this->getConfigStatus('public');
2813
+		}
2495 2814
 	}
2496 2815
 
2497 2816
 	public function updateUploaedCount($documentSrlList)
Please login to merge, or discard this patch.
modules/comment/comment.controller.php 1 patch
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	function procCommentVoteUp()
29 29
 	{
30
-		if(!Context::get('is_logged'))
30
+		if (!Context::get('is_logged'))
31 31
 		{
32 32
 			return new Object(-1, 'msg_invalid_request');
33 33
 		}
34 34
 
35 35
 		$comment_srl = Context::get('target_srl');
36
-		if(!$comment_srl)
36
+		if (!$comment_srl)
37 37
 		{
38 38
 			return new Object(-1, 'msg_invalid_request');
39 39
 		}
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
 		$oCommentModel = getModel('comment');
42 42
 		$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
43 43
 		$module_srl = $oComment->get('module_srl');
44
-		if(!$module_srl)
44
+		if (!$module_srl)
45 45
 		{
46 46
 			return new Object(-1, 'msg_invalid_request');
47 47
 		}
48 48
 
49 49
 		$oModuleModel = getModel('module');
50 50
 		$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
51
-		if($comment_config->use_vote_up == 'N')
51
+		if ($comment_config->use_vote_up == 'N')
52 52
 		{
53 53
 			return new Object(-1, 'msg_invalid_request');
54 54
 		}
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	function procCommentVoteDown()
67 67
 	{
68
-		if(!Context::get('is_logged'))
68
+		if (!Context::get('is_logged'))
69 69
 		{
70 70
 			return new Object(-1, 'msg_invalid_request');
71 71
 		}
72 72
 
73 73
 		$comment_srl = Context::get('target_srl');
74
-		if(!$comment_srl)
74
+		if (!$comment_srl)
75 75
 		{
76 76
 			return new Object(-1, 'msg_invalid_request');
77 77
 		}
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
 		$oCommentModel = getModel('comment');
80 80
 		$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
81 81
 		$module_srl = $oComment->get('module_srl');
82
-		if(!$module_srl)
82
+		if (!$module_srl)
83 83
 		{
84 84
 			return new Object(-1, 'msg_invalid_request');
85 85
 		}
86 86
 
87 87
 		$oModuleModel = getModel('module');
88 88
 		$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
89
-		if($comment_config->use_vote_down == 'N')
89
+		if ($comment_config->use_vote_down == 'N')
90 90
 		{
91 91
 			return new Object(-1, 'msg_invalid_request');
92 92
 		}
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	function procCommentDeclare()
105 105
 	{
106
-		if(!Context::get('is_logged'))
106
+		if (!Context::get('is_logged'))
107 107
 		{
108 108
 			return new Object(-1, 'msg_invalid_request');
109 109
 		}
110 110
 
111 111
 		$comment_srl = Context::get('target_srl');
112
-		if(!$comment_srl)
112
+		if (!$comment_srl)
113 113
 		{
114 114
 			return new Object(-1, 'msg_invalid_request');
115 115
 		}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	function triggerDeleteDocumentComments(&$obj)
125 125
 	{
126 126
 		$document_srl = $obj->document_srl;
127
-		if(!$document_srl)
127
+		if (!$document_srl)
128 128
 		{
129 129
 			return new Object();
130 130
 		}
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	function triggerDeleteModuleComments(&$obj)
140 140
 	{
141 141
 		$module_srl = $obj->module_srl;
142
-		if(!$module_srl)
142
+		if (!$module_srl)
143 143
 		{
144 144
 			return new Object();
145 145
 		}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	function isModuleUsingPublishValidation($module_srl = NULL)
168 168
 	{
169
-		if($module_srl == NULL)
169
+		if ($module_srl == NULL)
170 170
 		{
171 171
 			return FALSE;
172 172
 		}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
176 176
 		$module_part_config = $oModuleModel->getModulePartConfig('comment', $module_info->module_srl);
177 177
 		$use_validation = FALSE;
178
-		if(isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation == "Y")
178
+		if (isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation == "Y")
179 179
 		{
180 180
 			$use_validation = TRUE;
181 181
 		}
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	function insertComment($obj, $manual_inserted = FALSE)
192 192
 	{
193
-		if(!$manual_inserted && !checkCSRF())
193
+		if (!$manual_inserted && !checkCSRF())
194 194
 		{
195 195
 			return new Object(-1, 'msg_invalid_request');
196 196
 		}
197 197
 
198
-		if(!is_object($obj))
198
+		if (!is_object($obj))
199 199
 		{
200 200
 			$obj = new stdClass();
201 201
 		}
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 		// check if comment's module is using comment validation and set the publish status to 0 (false)
204 204
 		// for inserting query, otherwise default is 1 (true - means comment is published)
205 205
 		$using_validation = $this->isModuleUsingPublishValidation($obj->module_srl);
206
-		if(!$manual_inserted)
206
+		if (!$manual_inserted)
207 207
 		{
208
-			if(Context::get('is_logged'))
208
+			if (Context::get('is_logged'))
209 209
 			{
210 210
 				$logged_info = Context::get('logged_info');
211
-				if($logged_info->is_admin == 'Y')
211
+				if ($logged_info->is_admin == 'Y')
212 212
 				{
213 213
 					$is_admin = TRUE;
214 214
 				}
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 			$is_admin = FALSE;
224 224
 		}
225 225
 
226
-		if(!$using_validation)
226
+		if (!$using_validation)
227 227
 		{
228 228
 			$obj->status = 1;
229 229
 		}
230 230
 		else
231 231
 		{
232
-			if($is_admin)
232
+			if ($is_admin)
233 233
 			{
234 234
 				$obj->status = 1;
235 235
 			}
@@ -242,14 +242,14 @@  discard block
 block discarded – undo
242 242
 
243 243
 		// call a trigger (before)
244 244
 		$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
245
-		if(!$output->toBool())
245
+		if (!$output->toBool())
246 246
 		{
247 247
 			return $output;
248 248
 		}
249 249
 
250 250
 		// check if a posting of the corresponding document_srl exists
251 251
 		$document_srl = $obj->document_srl;
252
-		if(!$document_srl)
252
+		if (!$document_srl)
253 253
 		{
254 254
 			return new Object(-1, 'msg_invalid_document');
255 255
 		}
@@ -258,36 +258,36 @@  discard block
 block discarded – undo
258 258
 		$oDocumentModel = getModel('document');
259 259
 
260 260
 		// even for manual_inserted if password exists, hash it.
261
-		if($obj->password)
261
+		if ($obj->password)
262 262
 		{
263 263
 			$obj->password = getModel('member')->hashPassword($obj->password);
264 264
 		}
265 265
 
266 266
 		// get the original posting
267
-		if(!$manual_inserted)
267
+		if (!$manual_inserted)
268 268
 		{
269 269
 			$oDocument = $oDocumentModel->getDocument($document_srl);
270 270
 
271
-			if($document_srl != $oDocument->document_srl)
271
+			if ($document_srl != $oDocument->document_srl)
272 272
 			{
273 273
 				return new Object(-1, 'msg_invalid_document');
274 274
 			}
275
-			if($oDocument->isLocked())
275
+			if ($oDocument->isLocked())
276 276
 			{
277 277
 				return new Object(-1, 'msg_invalid_request');
278 278
 			}
279 279
 
280
-			if($obj->homepage)
280
+			if ($obj->homepage)
281 281
 			{
282 282
 				$obj->homepage = removeHackTag($obj->homepage);
283
-				if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
283
+				if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
284 284
 				{
285 285
 					$obj->homepage = 'http://'.$obj->homepage;
286 286
 				}
287 287
 			}
288 288
 
289 289
 			// input the member's information if logged-in
290
-			if(Context::get('is_logged'))
290
+			if (Context::get('is_logged'))
291 291
 			{
292 292
 				$logged_info = Context::get('logged_info');
293 293
 				$obj->member_srl = $logged_info->member_srl;
@@ -302,16 +302,16 @@  discard block
 block discarded – undo
302 302
 		}
303 303
 
304 304
 		// error display if neither of log-in info and user name exist.
305
-		if(!$logged_info->member_srl && !$obj->nick_name)
305
+		if (!$logged_info->member_srl && !$obj->nick_name)
306 306
 		{
307 307
 			return new Object(-1, 'msg_invalid_request');
308 308
 		}
309 309
 
310
-		if(!$obj->comment_srl)
310
+		if (!$obj->comment_srl)
311 311
 		{
312 312
 			$obj->comment_srl = getNextSequence();
313 313
 		}
314
-		elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) 
314
+		elseif (!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) 
315 315
 		{
316 316
 			return new Object(-1, 'msg_not_permitted');
317 317
 		}
@@ -322,32 +322,32 @@  discard block
 block discarded – undo
322 322
 		// remove XE's own tags from the contents
323 323
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
324 324
 
325
-		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
325
+		if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
326 326
 		{
327
-			if($obj->use_html != 'Y')
327
+			if ($obj->use_html != 'Y')
328 328
 			{
329 329
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
330 330
 			}
331 331
 			$obj->content = nl2br($obj->content);
332 332
 		}
333 333
 
334
-		if(!$obj->regdate)
334
+		if (!$obj->regdate)
335 335
 		{
336 336
 			$obj->regdate = date("YmdHis");
337 337
 		}
338 338
 
339 339
 		// remove iframe and script if not a top administrator on the session.
340
-		if($logged_info->is_admin != 'Y')
340
+		if ($logged_info->is_admin != 'Y')
341 341
 		{
342 342
 			$obj->content = removeHackTag($obj->content);
343 343
 		}
344 344
 
345
-		if(!$obj->notify_message)
345
+		if (!$obj->notify_message)
346 346
 		{
347 347
 			$obj->notify_message = 'N';
348 348
 		}
349 349
 
350
-		if(!$obj->is_secret)
350
+		if (!$obj->is_secret)
351 351
 		{
352 352
 			$obj->is_secret = 'N';
353 353
 		}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		$list_args->regdate = $obj->regdate;
365 365
 
366 366
 		// If parent comment doesn't exist, set data directly
367
-		if(!$obj->parent_srl)
367
+		if (!$obj->parent_srl)
368 368
 		{
369 369
 			$list_args->head = $list_args->arrange = $obj->comment_srl;
370 370
 			$list_args->depth = 0;
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 			$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
379 379
 
380 380
 			// return if no parent comment exists
381
-			if(!$parent_output->toBool() || !$parent_output->data)
381
+			if (!$parent_output->toBool() || !$parent_output->data)
382 382
 			{
383 383
 				return;
384 384
 			}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 			$list_args->depth = $parent->depth + 1;
390 390
 
391 391
 			// if the depth of comments is less than 2, execute insert.
392
-			if($list_args->depth < 2)
392
+			if ($list_args->depth < 2)
393 393
 			{
394 394
 				$list_args->arrange = $obj->comment_srl;
395 395
 				// if the depth of comments is greater than 2, execute update.
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 				$p_args->depth = $parent->depth;
404 404
 				$output = executeQuery('comment.getCommentParentNextSibling', $p_args);
405 405
 
406
-				if($output->data->arrange)
406
+				if ($output->data->arrange)
407 407
 				{
408 408
 					$list_args->arrange = $output->data->arrange;
409 409
 					$output = executeQuery('comment.updateCommentListArrange', $list_args);
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 		}
417 417
 
418 418
 		$output = executeQuery('comment.insertCommentList', $list_args);
419
-		if(!$output->toBool())
419
+		if (!$output->toBool())
420 420
 		{
421 421
 			return $output;
422 422
 		}
423 423
 
424 424
 		// insert comment
425 425
 		$output = executeQuery('comment.insertComment', $obj);
426
-		if(!$output->toBool())
426
+		if (!$output->toBool())
427 427
 		{
428 428
 			$oDB->rollback();
429 429
 			return $output;
@@ -439,29 +439,29 @@  discard block
 block discarded – undo
439 439
 		$oDocumentController = getController('document');
440 440
 
441 441
 		// Update the number of comments in the post
442
-		if(!$using_validation)
442
+		if (!$using_validation)
443 443
 		{
444 444
 			$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE);
445 445
 		}
446 446
 		else
447 447
 		{
448
-			if($is_admin)
448
+			if ($is_admin)
449 449
 			{
450 450
 				$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE);
451 451
 			}
452 452
 		}
453 453
 
454 454
 		// grant autority of the comment
455
-		if(!$manual_inserted)
455
+		if (!$manual_inserted)
456 456
 		{
457 457
 			$this->addGrant($obj->comment_srl);
458 458
 		}
459 459
 
460 460
 		// call a trigger(after)
461
-		if($output->toBool())
461
+		if ($output->toBool())
462 462
 		{
463 463
 			$trigger_output = ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
464
-			if(!$trigger_output->toBool())
464
+			if (!$trigger_output->toBool())
465 465
 			{
466 466
 				$oDB->rollback();
467 467
 				return $trigger_output;
@@ -471,16 +471,16 @@  discard block
 block discarded – undo
471 471
 		// commit
472 472
 		$oDB->commit();
473 473
 
474
-		if(!$manual_inserted)
474
+		if (!$manual_inserted)
475 475
 		{
476 476
 			// send a message if notify_message option in enabled in the original article
477 477
 			$oDocument->notify(Context::getLang('comment'), $obj->content);
478 478
 
479 479
 			// send a message if notify_message option in enabled in the original comment
480
-			if($obj->parent_srl)
480
+			if ($obj->parent_srl)
481 481
 			{
482 482
 				$oParent = $oCommentModel->getComment($obj->parent_srl);
483
-				if($oParent->get('member_srl') != $oDocument->get('member_srl'))
483
+				if ($oParent->get('member_srl') != $oDocument->get('member_srl'))
484 484
 				{
485 485
 					$oParent->notify(Context::getLang('comment'), $obj->content);
486 486
 				}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl);
509 509
 
510 510
 		$oMemberModel = getModel("member");
511
-		if(isset($obj->member_srl) && !is_null($obj->member_srl))
511
+		if (isset($obj->member_srl) && !is_null($obj->member_srl))
512 512
 		{
513 513
 			$member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->member_srl);
514 514
 		}
@@ -528,47 +528,47 @@  discard block
 block discarded – undo
528 528
 		$module_info = $oModuleModel->getModuleInfoByDocumentSrl($obj->document_srl);
529 529
 
530 530
 		// If there is no problem to register comment then send an email to all admin were set in module admin panel
531
-		if($module_info->admin_mail && $member_info->is_admin != 'Y')
531
+		if ($module_info->admin_mail && $member_info->is_admin != 'Y')
532 532
 		{
533 533
 			$oMail = new Mail();
534 534
 			$oMail->setSender($obj->email_address, $obj->email_address);
535
-			$mail_title = "[XE - " . Context::get('mid') . "] A new comment was posted on document: \"" . $oDocument->getTitleText() . "\"";
535
+			$mail_title = "[XE - ".Context::get('mid')."] A new comment was posted on document: \"".$oDocument->getTitleText()."\"";
536 536
 			$oMail->setTitle($mail_title);
537
-			$url_comment = getFullUrl('','document_srl',$obj->document_srl).'#comment_'.$obj->comment_srl;
538
-			if($using_validation)
537
+			$url_comment = getFullUrl('', 'document_srl', $obj->document_srl).'#comment_'.$obj->comment_srl;
538
+			if ($using_validation)
539 539
 			{
540 540
 				$url_approve = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminChangePublishedStatusChecked', 'cart[]', $obj->comment_srl, 'will_publish', '1', 'search_target', 'is_published', 'search_keyword', 'N');
541 541
 				$url_trash = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminDeleteChecked', 'cart[]', $obj->comment_srl, 'search_target', 'is_trash', 'search_keyword', 'true');
542 542
 				$mail_content = "
543
-					A new comment on the document \"" . $oDocument->getTitleText() . "\" is waiting for your approval.
543
+					A new comment on the document \"" . $oDocument->getTitleText()."\" is waiting for your approval.
544 544
 					<br />
545 545
 					<br />
546
-					Author: " . $member_info->nick_name . "
547
-					<br />Author e-mail: " . $member_info->email_address . "
548
-					<br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a>
546
+					Author: " . $member_info->nick_name."
547
+					<br />Author e-mail: " . $member_info->email_address."
548
+					<br />From : <a href=\"" . $url_comment."\">".$url_comment."</a>
549 549
 					<br />Comment:
550
-					<br />\"" . $obj->content . "\"
550
+					<br />\"" . $obj->content."\"
551 551
 					<br />Document:
552
-					<br />\"" . $oDocument->getContentText(). "\"
552
+					<br />\"" . $oDocument->getContentText()."\"
553 553
 					<br />
554 554
 					<br />
555
-					Approve it: <a href=\"" . $url_approve . "\">" . $url_approve . "</a>
556
-					<br />Trash it: <a href=\"" . $url_trash . "\">" . $url_trash . "</a>
557
-					<br />Currently " . $nr_comments_not_approved . " comments on \"" . Context::get('mid') . "\" module are waiting for approval. Please visit the moderation panel:
558
-					<br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "\">" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "</a>
555
+					Approve it: <a href=\"" . $url_approve."\">".$url_approve."</a>
556
+					<br />Trash it: <a href=\"" . $url_trash."\">".$url_trash."</a>
557
+					<br />Currently " . $nr_comments_not_approved." comments on \"".Context::get('mid')."\" module are waiting for approval. Please visit the moderation panel:
558
+					<br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl)."\">".getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl)."</a>
559 559
 					";
560 560
 				$oMail->setContent($mail_content);
561 561
 			}
562 562
 			else
563 563
 			{
564 564
 				$mail_content = "
565
-					Author: " . $member_info->nick_name . "
566
-					<br />Author e-mail: " . $member_info->email_address . "
567
-					<br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a>
565
+					Author: " . $member_info->nick_name."
566
+					<br />Author e-mail: " . $member_info->email_address."
567
+					<br />From : <a href=\"" . $url_comment."\">".$url_comment."</a>
568 568
 					<br />Comment:
569
-					<br />\"" . $obj->content . "\"
569
+					<br />\"" . $obj->content."\"
570 570
 					<br />Document:
571
-					<br />\"" . $oDocument->getContentText(). "\"
571
+					<br />\"" . $oDocument->getContentText()."\"
572 572
 					";
573 573
 				$oMail->setContent($mail_content);
574 574
 
@@ -597,10 +597,10 @@  discard block
 block discarded – undo
597 597
 			$target_mail = explode(',', $admins_emails);
598 598
 
599 599
 			// send email to all admins - START
600
-			for($i = 0; $i < count($target_mail); $i++)
600
+			for ($i = 0; $i < count($target_mail); $i++)
601 601
 			{
602 602
 				$email_address = trim($target_mail[$i]);
603
-				if(!$email_address)
603
+				if (!$email_address)
604 604
 				{
605 605
 					continue;
606 606
 				}
@@ -646,12 +646,12 @@  discard block
 block discarded – undo
646 646
 	 */
647 647
 	function updateComment($obj, $is_admin = FALSE, $manual_updated = FALSE)
648 648
 	{
649
-		if(!$manual_updated && !checkCSRF())
649
+		if (!$manual_updated && !checkCSRF())
650 650
 		{
651 651
 			return new Object(-1, 'msg_invalid_request');
652 652
 		}
653 653
 
654
-		if(!is_object($obj))
654
+		if (!is_object($obj))
655 655
 		{
656 656
 			$obj = new stdClass();
657 657
 		}
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
 		// call a trigger (before)
662 662
 		$output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj);
663
-		if(!$output->toBool())
663
+		if (!$output->toBool())
664 664
 		{
665 665
 			return $output;
666 666
 		}
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 
671 671
 		// get the original data
672 672
 		$source_obj = $oCommentModel->getComment($obj->comment_srl);
673
-		if(!$source_obj->getMemberSrl())
673
+		if (!$source_obj->getMemberSrl())
674 674
 		{
675 675
 			$obj->member_srl = $source_obj->get('member_srl');
676 676
 			$obj->user_name = $source_obj->get('user_name');
@@ -680,30 +680,30 @@  discard block
 block discarded – undo
680 680
 		}
681 681
 
682 682
 		// check if permission is granted
683
-		if(!$is_admin && !$source_obj->isGranted())
683
+		if (!$is_admin && !$source_obj->isGranted())
684 684
 		{
685 685
 			return new Object(-1, 'msg_not_permitted');
686 686
 		}
687 687
 
688
-		if($obj->password)
688
+		if ($obj->password)
689 689
 		{
690 690
 			$obj->password = getModel('member')->hashPassword($obj->password);
691 691
 		}
692 692
 
693
-		if($obj->homepage) 
693
+		if ($obj->homepage) 
694 694
 		{
695 695
 			$obj->homepage = removeHackTag($obj->homepage);
696
-			if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
696
+			if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
697 697
 			{
698 698
 				$obj->homepage = 'http://'.$obj->homepage;
699 699
 			}
700 700
 		}
701 701
 
702 702
 		// set modifier's information if logged-in and posting author and modifier are matched.
703
-		if(Context::get('is_logged'))
703
+		if (Context::get('is_logged'))
704 704
 		{
705 705
 			$logged_info = Context::get('logged_info');
706
-			if($source_obj->member_srl == $logged_info->member_srl)
706
+			if ($source_obj->member_srl == $logged_info->member_srl)
707 707
 			{
708 708
 				$obj->member_srl = $logged_info->member_srl;
709 709
 				$obj->user_name = $logged_info->user_name;
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 		}
715 715
 
716 716
 		// if nick_name of the logged-in author doesn't exist
717
-		if($source_obj->get('member_srl') && !$obj->nick_name)
717
+		if ($source_obj->get('member_srl') && !$obj->nick_name)
718 718
 		{
719 719
 			$obj->member_srl = $source_obj->get('member_srl');
720 720
 			$obj->user_name = $source_obj->get('user_name');
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 			$obj->homepage = $source_obj->get('homepage');
724 724
 		}
725 725
 
726
-		if(!$obj->content)
726
+		if (!$obj->content)
727 727
 		{
728 728
 			$obj->content = $source_obj->get('content');
729 729
 		}
@@ -731,9 +731,9 @@  discard block
 block discarded – undo
731 731
 		// remove XE's wn tags from contents
732 732
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
733 733
 
734
-		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
734
+		if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
735 735
 		{
736
-			if($obj->use_html != 'Y')
736
+			if ($obj->use_html != 'Y')
737 737
 			{
738 738
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
739 739
 			}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 		}
742 742
 
743 743
 		// remove iframe and script if not a top administrator on the session
744
-		if($logged_info->is_admin != 'Y')
744
+		if ($logged_info->is_admin != 'Y')
745 745
 		{
746 746
 			$obj->content = removeHackTag($obj->content);
747 747
 		}
@@ -752,17 +752,17 @@  discard block
 block discarded – undo
752 752
 
753 753
 		// Update
754 754
 		$output = executeQuery('comment.updateComment', $obj);
755
-		if(!$output->toBool())
755
+		if (!$output->toBool())
756 756
 		{
757 757
 			$oDB->rollback();
758 758
 			return $output;
759 759
 		}
760 760
 
761 761
 		// call a trigger (after)
762
-		if($output->toBool())
762
+		if ($output->toBool())
763 763
 		{
764 764
 			$trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj);
765
-			if(!$trigger_output->toBool())
765
+			if (!$trigger_output->toBool())
766 766
 			{
767 767
 				$oDB->rollback();
768 768
 				return $trigger_output;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
 		// check if comment already exists
793 793
 		$comment = $oCommentModel->getComment($comment_srl);
794
-		if($comment->comment_srl != $comment_srl)
794
+		if ($comment->comment_srl != $comment_srl)
795 795
 		{
796 796
 			return new Object(-1, 'msg_invalid_request');
797 797
 		}
@@ -800,28 +800,28 @@  discard block
 block discarded – undo
800 800
 
801 801
 		// call a trigger (before)
802 802
 		$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
803
-		if(!$output->toBool())
803
+		if (!$output->toBool())
804 804
 		{
805 805
 			return $output;
806 806
 		}
807 807
 
808 808
 		// check if permission is granted
809
-		if(!$is_admin && !$comment->isGranted())
809
+		if (!$is_admin && !$comment->isGranted())
810 810
 		{
811 811
 			return new Object(-1, 'msg_not_permitted');
812 812
 		}
813 813
 
814 814
 		// check if child comment exists on the comment
815 815
 		$childs = $oCommentModel->getChildComments($comment_srl);
816
-		if(count($childs) > 0)
816
+		if (count($childs) > 0)
817 817
 		{
818 818
 			$deleteAllComment = TRUE;
819
-			if(!$is_admin)
819
+			if (!$is_admin)
820 820
 			{
821 821
 				$logged_info = Context::get('logged_info');
822
-				foreach($childs as $val)
822
+				foreach ($childs as $val)
823 823
 				{
824
-					if($val->member_srl != $logged_info->member_srl)
824
+					if ($val->member_srl != $logged_info->member_srl)
825 825
 					{
826 826
 						$deleteAllComment = FALSE;
827 827
 						break;
@@ -829,16 +829,16 @@  discard block
 block discarded – undo
829 829
 				}
830 830
 			}
831 831
 
832
-			if(!$deleteAllComment)
832
+			if (!$deleteAllComment)
833 833
 			{
834 834
 				return new Object(-1, 'fail_to_delete_have_children');
835 835
 			}
836 836
 			else
837 837
 			{
838
-				foreach($childs as $val)
838
+				foreach ($childs as $val)
839 839
 				{
840 840
 					$output = $this->deleteComment($val->comment_srl, $is_admin, $isMoveToTrash);
841
-					if(!$output->toBool())
841
+					if (!$output->toBool())
842 842
 					{
843 843
 						return $output;
844 844
 					}
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 		$args = new stdClass();
855 855
 		$args->comment_srl = $comment_srl;
856 856
 		$output = executeQuery('comment.deleteComment', $args);
857
-		if(!$output->toBool())
857
+		if (!$output->toBool())
858 858
 		{
859 859
 			$oDB->rollback();
860 860
 			return $output;
@@ -866,14 +866,14 @@  discard block
 block discarded – undo
866 866
 		$comment_count = $oCommentModel->getCommentCount($document_srl);
867 867
 
868 868
 		// only document is exists
869
-		if(isset($comment_count))
869
+		if (isset($comment_count))
870 870
 		{
871 871
 			// create the controller object of the document
872 872
 			$oDocumentController = getController('document');
873 873
 
874 874
 			// update comment count of the article posting
875 875
 			$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, NULL, FALSE);
876
-			if(!$output->toBool())
876
+			if (!$output->toBool())
877 877
 			{
878 878
 				$oDB->rollback();
879 879
 				return $output;
@@ -881,11 +881,11 @@  discard block
 block discarded – undo
881 881
 		}
882 882
 
883 883
 		// call a trigger (after)
884
-		if($output->toBool())
884
+		if ($output->toBool())
885 885
 		{
886 886
 			$comment->isMoveToTrash = $isMoveToTrash;
887 887
 			$trigger_output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
888
-			if(!$trigger_output->toBool())
888
+			if (!$trigger_output->toBool())
889 889
 			{
890 890
 				$oDB->rollback();
891 891
 				return $trigger_output;
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 			unset($comment->isMoveToTrash);
894 894
 		}
895 895
 
896
-		if(!$isMoveToTrash)
896
+		if (!$isMoveToTrash)
897 897
 		{
898 898
 			$this->_deleteDeclaredComments($args);
899 899
 			$this->_deleteVotedComments($args);
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 		$oCommentModel = getModel('comment');
938 938
 
939 939
 		// check if permission is granted
940
-		if(is_object($obj))
940
+		if (is_object($obj))
941 941
 		{
942 942
 			$oDocument = new documentItem();
943 943
 			$oDocument->setAttribute($obj);
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 			$oDocument = $oDocumentModel->getDocument($document_srl);
948 948
 		}
949 949
 
950
-		if(!$oDocument->isExists() || !$oDocument->isGranted())
950
+		if (!$oDocument->isExists() || !$oDocument->isGranted())
951 951
 		{
952 952
 			return new Object(-1, 'msg_not_permitted');
953 953
 		}
@@ -956,23 +956,23 @@  discard block
 block discarded – undo
956 956
 		$args = new stdClass();
957 957
 		$args->document_srl = $document_srl;
958 958
 		$comments = executeQueryArray('comment.getAllComments', $args);
959
-		if($comments->data)
959
+		if ($comments->data)
960 960
 		{
961 961
 			$commentSrlList = array();
962
-			foreach($comments->data as $comment)
962
+			foreach ($comments->data as $comment)
963 963
 			{
964 964
 				$commentSrlList[] = $comment->comment_srl;
965 965
 
966 966
 				// call a trigger (before)
967 967
 				$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
968
-				if(!$output->toBool())
968
+				if (!$output->toBool())
969 969
 				{
970 970
 					continue;
971 971
 				}
972 972
 
973 973
 				// call a trigger (after)
974 974
 				$output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
975
-				if(!$output->toBool())
975
+				if (!$output->toBool())
976 976
 				{
977 977
 					continue;
978 978
 				}
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 		// delete the comment
983 983
 		$args->document_srl = $document_srl;
984 984
 		$output = executeQuery('comment.deleteComments', $args);
985
-		if(!$output->toBool())
985
+		if (!$output->toBool())
986 986
 		{
987 987
 			return $output;
988 988
 		}
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 		$output = executeQuery('comment.deleteCommentsList', $args);
992 992
 
993 993
 		//delete declared, declared_log, voted_log
994
-		if(is_array($commentSrlList) && count($commentSrlList) > 0)
994
+		if (is_array($commentSrlList) && count($commentSrlList) > 0)
995 995
 		{
996 996
 			$args = new stdClass();
997 997
 			$args->comment_srl = join(',', $commentSrlList);
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 	 */
1032 1032
 	function updateVotedCount($comment_srl, $point = 1)
1033 1033
 	{
1034
-		if($point > 0)
1034
+		if ($point > 0)
1035 1035
 		{
1036 1036
 			$failed_voted = 'failed_voted';
1037 1037
 			$success_message = 'success_voted';
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 		}
1044 1044
 
1045 1045
 		// invalid vote if vote info exists in the session info.
1046
-		if($_SESSION['voted_comment'][$comment_srl])
1046
+		if ($_SESSION['voted_comment'][$comment_srl])
1047 1047
 		{
1048 1048
 			return new Object(-1, $failed_voted);
1049 1049
 		}
@@ -1052,21 +1052,21 @@  discard block
 block discarded – undo
1052 1052
 		$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
1053 1053
 
1054 1054
 		// invalid vote if both ip addresses between author's and the current user are same.
1055
-		if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1055
+		if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1056 1056
 		{
1057 1057
 			$_SESSION['voted_comment'][$comment_srl] = TRUE;
1058 1058
 			return new Object(-1, $failed_voted);
1059 1059
 		}
1060 1060
 
1061 1061
 		// if the comment author is a member
1062
-		if($oComment->get('member_srl'))
1062
+		if ($oComment->get('member_srl'))
1063 1063
 		{
1064 1064
 			// create the member model object
1065 1065
 			$oMemberModel = getModel('member');
1066 1066
 			$member_srl = $oMemberModel->getLoggedMemberSrl();
1067 1067
 
1068 1068
 			// session registered if the author information matches to the current logged-in user's.
1069
-			if($member_srl && $member_srl == abs($oComment->get('member_srl')))
1069
+			if ($member_srl && $member_srl == abs($oComment->get('member_srl')))
1070 1070
 			{
1071 1071
 				$_SESSION['voted_comment'][$comment_srl] = TRUE;
1072 1072
 				return new Object(-1, $failed_voted);
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 		$args = new stdClass();
1077 1077
 
1078 1078
 		// If logged-in, use the member_srl. otherwise use the ipaddress.
1079
-		if($member_srl)
1079
+		if ($member_srl)
1080 1080
 		{
1081 1081
 			$args->member_srl = $member_srl;
1082 1082
 		}
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 		$output = executeQuery('comment.getCommentVotedLogInfo', $args);
1090 1090
 
1091 1091
 		// session registered if log info contains recommendation vote log.
1092
-		if($output->data->count)
1092
+		if ($output->data->count)
1093 1093
 		{
1094 1094
 			$_SESSION['voted_comment'][$comment_srl] = TRUE;
1095 1095
 			return new Object(-1, $failed_voted);
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		$oDB->begin();
1101 1101
 
1102 1102
 		// update the number of votes
1103
-		if($point < 0)
1103
+		if ($point < 0)
1104 1104
 		{
1105 1105
 			$args->blamed_count = $oComment->get('blamed_count') + $point;
1106 1106
 			$output = executeQuery('comment.updateBlamedCount', $args);
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 		$obj->before_point = ($point < 0) ? $oComment->get('blamed_count') : $oComment->get('voted_count');
1125 1125
 		$obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count;
1126 1126
 		$trigger_output = ModuleHandler::triggerCall('comment.updateVotedCount', 'after', $obj);
1127
-		if(!$trigger_output->toBool())
1127
+		if (!$trigger_output->toBool())
1128 1128
 		{
1129 1129
 			$oDB->rollback();
1130 1130
 			return $trigger_output;
@@ -1137,7 +1137,7 @@  discard block
 block discarded – undo
1137 1137
 
1138 1138
 		// Return the result
1139 1139
 		$output = new Object(0, $success_message);
1140
-		if($point > 0)
1140
+		if ($point > 0)
1141 1141
 		{
1142 1142
 			$output->add('voted_count', $obj->after_point);
1143 1143
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 	function declaredComment($comment_srl)
1158 1158
 	{
1159 1159
 		// Fail if session information already has a reported document
1160
-		if($_SESSION['declared_comment'][$comment_srl])
1160
+		if ($_SESSION['declared_comment'][$comment_srl])
1161 1161
 		{
1162 1162
 			return new Object(-1, 'failed_declared');
1163 1163
 		}
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 		$args = new stdClass();
1167 1167
 		$args->comment_srl = $comment_srl;
1168 1168
 		$output = executeQuery('comment.getDeclaredComment', $args);
1169
-		if(!$output->toBool())
1169
+		if (!$output->toBool())
1170 1170
 		{
1171 1171
 			return $output;
1172 1172
 		}
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 
1179 1179
 		// Call a trigger (before)
1180 1180
 		$trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj);
1181
-		if(!$trigger_output->toBool())
1181
+		if (!$trigger_output->toBool())
1182 1182
 		{
1183 1183
 			return $trigger_output;
1184 1184
 		}
@@ -1188,21 +1188,21 @@  discard block
 block discarded – undo
1188 1188
 		$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
1189 1189
 
1190 1190
 		// failed if both ip addresses between author's and the current user are same.
1191
-		if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1191
+		if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1192 1192
 		{
1193 1193
 			$_SESSION['declared_comment'][$comment_srl] = TRUE;
1194 1194
 			return new Object(-1, 'failed_declared');
1195 1195
 		}
1196 1196
 
1197 1197
 		// if the comment author is a member
1198
-		if($oComment->get('member_srl'))
1198
+		if ($oComment->get('member_srl'))
1199 1199
 		{
1200 1200
 			// create the member model object
1201 1201
 			$oMemberModel = getModel('member');
1202 1202
 			$member_srl = $oMemberModel->getLoggedMemberSrl();
1203 1203
 
1204 1204
 			// session registered if the author information matches to the current logged-in user's.
1205
-			if($member_srl && $member_srl == abs($oComment->get('member_srl')))
1205
+			if ($member_srl && $member_srl == abs($oComment->get('member_srl')))
1206 1206
 			{
1207 1207
 				$_SESSION['declared_comment'][$comment_srl] = TRUE;
1208 1208
 				return new Object(-1, 'failed_declared');
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
 		}
1211 1211
 
1212 1212
 		// If logged-in, use the member_srl. otherwise use the ipaddress.
1213
-		if($member_srl)
1213
+		if ($member_srl)
1214 1214
 		{
1215 1215
 			$args->member_srl = $member_srl;
1216 1216
 		}
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 		$log_output = executeQuery('comment.getCommentDeclaredLogInfo', $args);
1223 1223
 
1224 1224
 		// session registered if log info contains report log.
1225
-		if($log_output->data->count)
1225
+		if ($log_output->data->count)
1226 1226
 		{
1227 1227
 			$_SESSION['declared_comment'][$comment_srl] = TRUE;
1228 1228
 			return new Object(-1, 'failed_declared');
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 		$oDB->begin();
1234 1234
 
1235 1235
 		// execute insert
1236
-		if($output->data->declared_count > 0)
1236
+		if ($output->data->declared_count > 0)
1237 1237
 		{
1238 1238
 			$output = executeQuery('comment.updateDeclaredComment', $args);
1239 1239
 		}
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 			$output = executeQuery('comment.insertDeclaredComment', $args);
1243 1243
 		}
1244 1244
 
1245
-		if(!$output->toBool())
1245
+		if (!$output->toBool())
1246 1246
 		{
1247 1247
 			$oDB->rollback();
1248 1248
 			return $output;
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 		// Call a trigger (after)
1255 1255
 		$trigger_obj->declared_count = $declared_count + 1;
1256 1256
 		$trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'after', $trigger_obj);
1257
-		if(!$trigger_output->toBool())
1257
+		if (!$trigger_output->toBool())
1258 1258
 		{
1259 1259
 			$oDB->rollback();
1260 1260
 			return $trigger_output;
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 	function addCommentPopupMenu($url, $str, $icon = '', $target = 'self')
1280 1280
 	{
1281 1281
 		$comment_popup_menu_list = Context::get('comment_popup_menu_list');
1282
-		if(!is_array($comment_popup_menu_list))
1282
+		if (!is_array($comment_popup_menu_list))
1283 1283
 		{
1284 1284
 			$comment_popup_menu_list = array();
1285 1285
 		}
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	function procCommentInsertModuleConfig()
1302 1302
 	{
1303 1303
 		$module_srl = Context::get('target_module_srl');
1304
-		if(preg_match('/^([0-9,]+)$/', $module_srl))
1304
+		if (preg_match('/^([0-9,]+)$/', $module_srl))
1305 1305
 		{
1306 1306
 			$module_srl = explode(',', $module_srl);
1307 1307
 		}
@@ -1312,33 +1312,33 @@  discard block
 block discarded – undo
1312 1312
 
1313 1313
 		$comment_config = new stdClass();
1314 1314
 		$comment_config->comment_count = (int) Context::get('comment_count');
1315
-		if(!$comment_config->comment_count)
1315
+		if (!$comment_config->comment_count)
1316 1316
 		{
1317 1317
 			$comment_config->comment_count = 50;
1318 1318
 		}
1319 1319
 
1320 1320
 		$comment_config->use_vote_up = Context::get('use_vote_up');
1321
-		if(!$comment_config->use_vote_up)
1321
+		if (!$comment_config->use_vote_up)
1322 1322
 		{
1323 1323
 			$comment_config->use_vote_up = 'Y';
1324 1324
 		}
1325 1325
 
1326 1326
 		$comment_config->use_vote_down = Context::get('use_vote_down');
1327
-		if(!$comment_config->use_vote_down)
1327
+		if (!$comment_config->use_vote_down)
1328 1328
 		{
1329 1329
 			$comment_config->use_vote_down = 'Y';
1330 1330
 		}
1331 1331
 
1332 1332
 		$comment_config->use_comment_validation = Context::get('use_comment_validation');
1333
-		if(!$comment_config->use_comment_validation)
1333
+		if (!$comment_config->use_comment_validation)
1334 1334
 		{
1335 1335
 			$comment_config->use_comment_validation = 'N';
1336 1336
 		}
1337 1337
 
1338
-		for($i = 0; $i < count($module_srl); $i++)
1338
+		for ($i = 0; $i < count($module_srl); $i++)
1339 1339
 		{
1340 1340
 			$srl = trim($module_srl[$i]);
1341
-			if(!$srl)
1341
+			if (!$srl)
1342 1342
 			{
1343 1343
 				continue;
1344 1344
 			}
@@ -1372,25 +1372,25 @@  discard block
 block discarded – undo
1372 1372
 	 */
1373 1373
 	function procCommentGetList()
1374 1374
 	{
1375
-		if(!Context::get('is_logged'))
1375
+		if (!Context::get('is_logged'))
1376 1376
 		{
1377 1377
 			return new Object(-1, 'msg_not_permitted');
1378 1378
 		}
1379 1379
 
1380 1380
 		$commentSrls = Context::get('comment_srls');
1381
-		if($commentSrls)
1381
+		if ($commentSrls)
1382 1382
 		{
1383 1383
 			$commentSrlList = explode(',', $commentSrls);
1384 1384
 		}
1385 1385
 
1386
-		if(count($commentSrlList) > 0)
1386
+		if (count($commentSrlList) > 0)
1387 1387
 		{
1388 1388
 			$oCommentModel = getModel('comment');
1389 1389
 			$commentList = $oCommentModel->getComments($commentSrlList);
1390 1390
 
1391
-			if(is_array($commentList))
1391
+			if (is_array($commentList))
1392 1392
 			{
1393
-				foreach($commentList as $value)
1393
+				foreach ($commentList as $value)
1394 1394
 				{
1395 1395
 					$value->content = strip_tags($value->content);
1396 1396
 				}
@@ -1415,9 +1415,9 @@  discard block
 block discarded – undo
1415 1415
 		$commentConfig = $oModuleModel->getModulePartConfig('comment', $obj->originModuleSrl);
1416 1416
 
1417 1417
 		$oModuleController = getController('module');
1418
-		if(is_array($obj->moduleSrlList))
1418
+		if (is_array($obj->moduleSrlList))
1419 1419
 		{
1420
-			foreach($obj->moduleSrlList as $moduleSrl)
1420
+			foreach ($obj->moduleSrlList as $moduleSrl)
1421 1421
 			{
1422 1422
 				$oModuleController->insertModulePartConfig('comment', $moduleSrl, $commentConfig);
1423 1423
 			}
Please login to merge, or discard this patch.
modules/board/board.controller.php 2 patches
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 	function procBoardInsertDocument()
24 24
 	{
25 25
 		// check grant
26
-		if($this->module_info->module != "board")
26
+		if ($this->module_info->module != "board")
27 27
 		{
28 28
 			return new Object(-1, "msg_invalid_request");
29 29
 		}
30
-		if(!$this->grant->write_document)
30
+		if (!$this->grant->write_document)
31 31
 		{
32 32
 			return new Object(-1, 'msg_not_permitted');
33 33
 		}
@@ -36,29 +36,29 @@  discard block
 block discarded – undo
36 36
 		// setup variables
37 37
 		$obj = Context::getRequestVars();
38 38
 		$obj->module_srl = $this->module_srl;
39
-		if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N';
39
+		if ($obj->is_notice != 'Y' || !$this->grant->manager) $obj->is_notice = 'N';
40 40
 		$obj->commentStatus = $obj->comment_status;
41 41
 
42 42
 		$oModuleModel = getModel('module');
43 43
 		$module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl);
44
-		if($module_config->mobile_use_editor === 'Y')
44
+		if ($module_config->mobile_use_editor === 'Y')
45 45
 		{
46
-			if(!isset($obj->use_editor)) $obj->use_editor = 'Y';
47
-			if(!isset($obj->use_html)) $obj->use_html = 'Y';
46
+			if (!isset($obj->use_editor)) $obj->use_editor = 'Y';
47
+			if (!isset($obj->use_html)) $obj->use_html = 'Y';
48 48
 		}
49 49
 		else
50 50
 		{
51
-			if(!isset($obj->use_editor)) $obj->use_editor = 'N';
52
-			if(!isset($obj->use_html)) $obj->use_html = 'N';
51
+			if (!isset($obj->use_editor)) $obj->use_editor = 'N';
52
+			if (!isset($obj->use_html)) $obj->use_html = 'N';
53 53
 		}
54 54
 
55 55
 		settype($obj->title, "string");
56
-		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
56
+		if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...');
57 57
 		//setup dpcument title tp 'Untitled'
58
-		if($obj->title == '') $obj->title = 'Untitled';
58
+		if ($obj->title == '') $obj->title = 'Untitled';
59 59
 
60 60
 		// unset document style if the user is not the document manager
61
-		if(!$this->grant->manager)
61
+		if (!$this->grant->manager)
62 62
 		{
63 63
 			unset($obj->title_color);
64 64
 			unset($obj->title_bold);
@@ -75,24 +75,24 @@  discard block
 block discarded – undo
75 75
 
76 76
 		// update the document if it is existed
77 77
 		$is_update = false;
78
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
78
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
79 79
 		{
80 80
 			$is_update = true;
81 81
 		}
82 82
 
83 83
 		// if use anonymous is true
84
-		if($this->module_info->use_anonymous == 'Y')
84
+		if ($this->module_info->use_anonymous == 'Y')
85 85
 		{
86 86
 			$this->module_info->admin_mail = '';
87 87
 			$obj->notify_message = 'N';
88
-			if($is_update===false)
88
+			if ($is_update === false)
89 89
 			{
90
-				$obj->member_srl = -1*$logged_info->member_srl;
90
+				$obj->member_srl = -1 * $logged_info->member_srl;
91 91
 			}
92 92
 			$obj->email_address = $obj->homepage = $obj->user_id = '';
93 93
 			$obj->user_name = $obj->nick_name = 'anonymous';
94 94
 			$bAnonymous = true;
95
-			if($is_update===false)
95
+			if ($is_update === false)
96 96
 			{
97 97
 				$oDocument->add('member_srl', $obj->member_srl);
98 98
 			}
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
 			$bAnonymous = false;
103 103
 		}
104 104
 
105
-		if($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET'))
105
+		if ($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET'))
106 106
 		{
107 107
 			$use_status = explode('|@|', $this->module_info->use_status);
108
-			if(!is_array($use_status) || !in_array('SECRET', $use_status))
108
+			if (!is_array($use_status) || !in_array('SECRET', $use_status))
109 109
 			{
110 110
 				unset($obj->is_secret);
111 111
 				$obj->status = 'PUBLIC';
@@ -113,24 +113,24 @@  discard block
 block discarded – undo
113 113
 		}
114 114
 
115 115
 		// update the document if it is existed
116
-		if($is_update)
116
+		if ($is_update)
117 117
 		{
118
-			if(!$oDocument->isGranted())
118
+			if (!$oDocument->isGranted())
119 119
 			{
120
-				return new Object(-1,'msg_not_permitted');
120
+				return new Object(-1, 'msg_not_permitted');
121 121
 			}
122 122
 
123
-			if($this->module_info->use_anonymous == 'Y') {
123
+			if ($this->module_info->use_anonymous == 'Y') {
124 124
 				$obj->member_srl = abs($oDocument->get('member_srl')) * -1;
125 125
 				$oDocument->add('member_srl', $obj->member_srl);
126 126
 			}
127 127
 
128
-			if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
128
+			if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false)
129 129
 			{
130
-				return new Object(-1,'msg_protect_content');
130
+				return new Object(-1, 'msg_protect_content');
131 131
 			}
132 132
 
133
-			if(!$this->grant->manager)
133
+			if (!$this->grant->manager)
134 134
 			{
135 135
 				// notice & document style same as before if not manager
136 136
 				$obj->is_notice = $oDocument->get('is_notice');
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			}
140 140
 			
141 141
 			// modify list_order if document status is temp
142
-			if($oDocument->get('status') == 'TEMP')
142
+			if ($oDocument->get('status') == 'TEMP')
143 143
 			{
144 144
 				$obj->last_update = $obj->regdate = date('YmdHis');
145 145
 				$obj->update_order = $obj->list_order = (getNextSequence() * -1);
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
 			$obj->document_srl = $output->get('document_srl');
156 156
 
157 157
 			// send an email to admin user
158
-			if($output->toBool() && $this->module_info->admin_mail)
158
+			if ($output->toBool() && $this->module_info->admin_mail)
159 159
 			{
160 160
 				$oModuleModel = getModel('module');
161 161
 				$member_config = $oModuleModel->getModuleConfig('member');
162 162
 				
163 163
 				$oMail = new Mail();
164 164
 				$oMail->setTitle($obj->title);
165
-				$oMail->setContent( sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('','document_srl',$obj->document_srl), getFullUrl('','document_srl',$obj->document_srl), $obj->content));
165
+				$oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content));
166 166
 				$oMail->setSender($obj->user_name ? $obj->user_name : 'anonymous', $obj->email_address ? $obj->email_address : $member_config->webmaster_email);
167 167
 
168
-				$target_mail = explode(',',$this->module_info->admin_mail);
169
-				for($i=0;$i<count($target_mail);$i++)
168
+				$target_mail = explode(',', $this->module_info->admin_mail);
169
+				for ($i = 0; $i < count($target_mail); $i++)
170 170
 				{
171 171
 					$email_address = trim($target_mail[$i]);
172
-					if(!$email_address) continue;
172
+					if (!$email_address) continue;
173 173
 					$oMail->setReceiptor($email_address, $email_address);
174 174
 					$oMail->send();
175 175
 				}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		}
178 178
 
179 179
 		// if there is an error
180
-		if(!$output->toBool())
180
+		if (!$output->toBool())
181 181
 		{
182 182
 			return $output;
183 183
 		}
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		$this->add('document_srl', $output->get('document_srl'));
188 188
 
189 189
 		// alert a message
190
-		if(Context::get('xeVirtualRequestMethod') !== 'xml')
190
+		if (Context::get('xeVirtualRequestMethod') !== 'xml')
191 191
 		{
192 192
 			$this->setMessage($msg_code);
193 193
 		}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		$document_srl = Context::get('document_srl');
203 203
 
204 204
 		// if the document is not existed
205
-		if(!$document_srl)
205
+		if (!$document_srl)
206 206
 		{
207 207
 			return $this->doError('msg_invalid_document');
208 208
 		}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		$oDocumentModel = &getModel('document');
211 211
 		$oDocument = $oDocumentModel->getDocument($document_srl);
212 212
 		// check protect content
213
-		if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false)
213
+		if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false)
214 214
 		{
215 215
 			return new Object(-1, 'msg_protect_content');
216 216
 		}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
 		// delete the document
222 222
 		$output = $oDocumentController->deleteDocument($document_srl, $this->grant->manager);
223
-		if(!$output->toBool())
223
+		if (!$output->toBool())
224 224
 		{
225 225
 			return $output;
226 226
 		}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '', 'page', Context::get('page'), 'document_srl', ''));
230 230
 		$this->add('mid', Context::get('mid'));
231 231
 		$this->add('page', Context::get('page'));
232
-		if(Context::get('xeVirtualRequestMethod') !== 'xml')
232
+		if (Context::get('xeVirtualRequestMethod') !== 'xml')
233 233
 		{
234 234
 			$this->setMessage('success_deleted');
235 235
 		}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	function procBoardInsertComment()
254 254
 	{
255 255
 		// check grant
256
-		if(!$this->grant->write_comment)
256
+		if (!$this->grant->write_comment)
257 257
 		{
258 258
 			return new Object(-1, 'msg_not_permitted');
259 259
 		}
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 		$obj = Context::getRequestVars();
264 264
 		$obj->module_srl = $this->module_srl;
265 265
 
266
-		if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
267
-		if(!is_array($this->module_info->use_status))
266
+		if (!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
267
+		if (!is_array($this->module_info->use_status))
268 268
 		{
269 269
 			$this->module_info->use_status = explode('|@|', $this->module_info->use_status);
270 270
 		}
271 271
 
272
-		if(in_array('SECRET', $this->module_info->use_status))
272
+		if (in_array('SECRET', $this->module_info->use_status))
273 273
 		{
274 274
 			$this->module_info->secret = 'Y';
275 275
 		}
@@ -281,31 +281,31 @@  discard block
 block discarded – undo
281 281
 
282 282
 		$oModuleModel = getModel('module');
283 283
 		$module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl);
284
-		if($module_config->mobile_use_editor === 'Y')
284
+		if ($module_config->mobile_use_editor === 'Y')
285 285
 		{
286
-			if(!isset($obj->use_editor)) $obj->use_editor = 'Y';
287
-			if(!isset($obj->use_html)) $obj->use_html = 'Y';
286
+			if (!isset($obj->use_editor)) $obj->use_editor = 'Y';
287
+			if (!isset($obj->use_html)) $obj->use_html = 'Y';
288 288
 		}
289 289
 		else
290 290
 		{
291
-			if(!isset($obj->use_editor)) $obj->use_editor = 'N';
292
-			if(!isset($obj->use_html)) $obj->use_html = 'N';
291
+			if (!isset($obj->use_editor)) $obj->use_editor = 'N';
292
+			if (!isset($obj->use_html)) $obj->use_html = 'N';
293 293
 		}
294 294
 
295 295
 		// check if the doument is existed
296 296
 		$oDocumentModel = getModel('document');
297 297
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl);
298
-		if(!$oDocument->isExists())
298
+		if (!$oDocument->isExists())
299 299
 		{
300
-			return new Object(-1,'msg_not_founded');
300
+			return new Object(-1, 'msg_not_founded');
301 301
 		}
302 302
 
303 303
 		// For anonymous use, remove writer's information and notifying information
304
-		if($this->module_info->use_anonymous == 'Y')
304
+		if ($this->module_info->use_anonymous == 'Y')
305 305
 		{
306 306
 			$this->module_info->admin_mail = '';
307 307
 			$obj->notify_message = 'N';
308
-			$obj->member_srl = -1*$logged_info->member_srl;
308
+			$obj->member_srl = -1 * $logged_info->member_srl;
309 309
 			$obj->email_address = $obj->homepage = $obj->user_id = '';
310 310
 			$obj->user_name = $obj->nick_name = 'anonymous';
311 311
 			$bAnonymous = true;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 
324 324
 		// check the comment is existed
325 325
 		// if the comment is not existed, then generate a new sequence
326
-		if(!$obj->comment_srl)
326
+		if (!$obj->comment_srl)
327 327
 		{
328 328
 			$obj->comment_srl = getNextSequence();
329 329
 		} else {
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		}
332 332
 
333 333
 		// if comment_srl is not existed, then insert the comment
334
-		if($comment->comment_srl != $obj->comment_srl)
334
+		if ($comment->comment_srl != $obj->comment_srl)
335 335
 		{
336 336
 
337 337
 			// parent_srl is existed
338
-			if($obj->parent_srl)
338
+			if ($obj->parent_srl)
339 339
 			{
340 340
 				$parent_comment = $oCommentModel->getComment($obj->parent_srl);
341
-				if(!$parent_comment->comment_srl)
341
+				if (!$parent_comment->comment_srl)
342 342
 				{
343 343
 					return new Object(-1, 'msg_invalid_request');
344 344
 				}
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
 		// update the comment if it is not existed
353 353
 		} else {
354 354
 			// check the grant
355
-			if(!$comment->isGranted())
355
+			if (!$comment->isGranted())
356 356
 			{
357
-				return new Object(-1,'msg_not_permitted');
357
+				return new Object(-1, 'msg_not_permitted');
358 358
 			}
359 359
 
360 360
 			$obj->parent_srl = $comment->parent_srl;
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
 			$comment_srl = $obj->comment_srl;
363 363
 		}
364 364
 
365
-		if(!$output->toBool())
365
+		if (!$output->toBool())
366 366
 		{
367 367
 			return $output;
368 368
 		}
369 369
 
370
-		if(Context::get('xeVirtualRequestMethod') !== 'xml')
370
+		if (Context::get('xeVirtualRequestMethod') !== 'xml')
371 371
 		{
372 372
 			$this->setMessage('success_registed');
373 373
 		}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	{
384 384
 		// get the comment_srl
385 385
 		$comment_srl = Context::get('comment_srl');
386
-		if(!$comment_srl)
386
+		if (!$comment_srl)
387 387
 		{
388 388
 			return $this->doError('msg_invalid_request');
389 389
 		}
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		$oCommentController = getController('comment');
393 393
 
394 394
 		$output = $oCommentController->deleteComment($comment_srl, $this->grant->manager);
395
-		if(!$output->toBool())
395
+		if (!$output->toBool())
396 396
 		{
397 397
 			return $output;
398 398
 		}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		$this->add('mid', Context::get('mid'));
401 401
 		$this->add('page', Context::get('page'));
402 402
 		$this->add('document_srl', $output->get('document_srl'));
403
-		if(Context::get('xeVirtualRequestMethod') !== 'xml')
403
+		if (Context::get('xeVirtualRequestMethod') !== 'xml')
404 404
 		{
405 405
 			$this->setMessage('success_deleted');
406 406
 		}
@@ -416,10 +416,10 @@  discard block
 block discarded – undo
416 416
 		// generate trackback module controller object
417 417
 		$oTrackbackController = getController('trackback');
418 418
 
419
-		if(!$oTrackbackController) return;
419
+		if (!$oTrackbackController) return;
420 420
 
421 421
 		$output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager);
422
-		if(!$output->toBool())
422
+		if (!$output->toBool())
423 423
 		{
424 424
 			return $output;
425 425
 		}
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		$this->add('mid', Context::get('mid'));
428 428
 		$this->add('page', Context::get('page'));
429 429
 		$this->add('document_srl', $output->get('document_srl'));
430
-		if(Context::get('xeVirtualRequestMethod') !== 'xml')
430
+		if (Context::get('xeVirtualRequestMethod') !== 'xml')
431 431
 		{
432 432
 			$this->setMessage('success_deleted');
433 433
 		}
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 		$oMemberModel = getModel('member');
447 447
 
448 448
 		// if the comment exists
449
-		if($comment_srl)
449
+		if ($comment_srl)
450 450
 		{
451 451
 			// get the comment information
452 452
 			$oCommentModel = getModel('comment');
453 453
 			$oComment = $oCommentModel->getComment($comment_srl);
454
-			if(!$oComment->isExists())
454
+			if (!$oComment->isExists())
455 455
 			{
456 456
 				return new Object(-1, 'msg_invalid_request');
457 457
 			}
458 458
 
459 459
 			// compare the comment password and the user input password
460
-			if(!$oMemberModel->isValidPassword($oComment->get('password'),$password))
460
+			if (!$oMemberModel->isValidPassword($oComment->get('password'), $password))
461 461
 			{
462 462
 				return new Object(-1, 'msg_invalid_password');
463 463
 			}
@@ -467,13 +467,13 @@  discard block
 block discarded – undo
467 467
 			 // get the document information
468 468
 			$oDocumentModel = getModel('document');
469 469
 			$oDocument = $oDocumentModel->getDocument($document_srl);
470
-			if(!$oDocument->isExists())
470
+			if (!$oDocument->isExists())
471 471
 			{
472 472
 				return new Object(-1, 'msg_invalid_request');
473 473
 			}
474 474
 
475 475
 			// compare the document password and the user input password
476
-			if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password))
476
+			if (!$oMemberModel->isValidPassword($oDocument->get('password'), $password))
477 477
 			{
478 478
 				return new Object(-1, 'msg_invalid_password');
479 479
 			}
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 		$member_srl = Context::get('target_srl');
491 491
 		$mid = Context::get('cur_mid');
492 492
 
493
-		if(!$member_srl || !$mid)
493
+		if (!$member_srl || !$mid)
494 494
 		{
495 495
 			return new Object();
496 496
 		}
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
 		$columnList = array('module');
503 503
 		$cur_module_info = $oModuleModel->getModuleInfoByMid($mid, 0, $columnList);
504 504
 
505
-		if($cur_module_info->module != 'board')
505
+		if ($cur_module_info->module != 'board')
506 506
 		{
507 507
 			return new Object();
508 508
 		}
509 509
 
510 510
 		// get the member information
511
-		if($member_srl == $logged_info->member_srl)
511
+		if ($member_srl == $logged_info->member_srl)
512 512
 		{
513 513
 			$member_info = $logged_info;
514 514
 		} else {
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
 			$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
517 517
 		}
518 518
 
519
-		if(!$member_info->user_id)
519
+		if (!$member_info->user_id)
520 520
 		{
521 521
 			return new Object();
522 522
 		}
523 523
 
524 524
 		//search
525
-		$url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name);
525
+		$url = getUrl('', 'mid', $mid, 'search_target', 'nick_name', 'search_keyword', $member_info->nick_name);
526 526
 		$oMemberController = getController('member');
527 527
 		$oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', '');
528 528
 
Please login to merge, or discard this patch.
Braces   +47 added lines, -24 removed lines patch added patch discarded remove patch
@@ -36,26 +36,39 @@  discard block
 block discarded – undo
36 36
 		// setup variables
37 37
 		$obj = Context::getRequestVars();
38 38
 		$obj->module_srl = $this->module_srl;
39
-		if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N';
39
+		if($obj->is_notice!='Y'||!$this->grant->manager) {
40
+			$obj->is_notice = 'N';
41
+		}
40 42
 		$obj->commentStatus = $obj->comment_status;
41 43
 
42 44
 		$oModuleModel = getModel('module');
43 45
 		$module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl);
44 46
 		if($module_config->mobile_use_editor === 'Y')
45 47
 		{
46
-			if(!isset($obj->use_editor)) $obj->use_editor = 'Y';
47
-			if(!isset($obj->use_html)) $obj->use_html = 'Y';
48
-		}
49
-		else
48
+			if(!isset($obj->use_editor)) {
49
+				$obj->use_editor = 'Y';
50
+			}
51
+			if(!isset($obj->use_html)) {
52
+				$obj->use_html = 'Y';
53
+			}
54
+		} else
50 55
 		{
51
-			if(!isset($obj->use_editor)) $obj->use_editor = 'N';
52
-			if(!isset($obj->use_html)) $obj->use_html = 'N';
56
+			if(!isset($obj->use_editor)) {
57
+				$obj->use_editor = 'N';
58
+			}
59
+			if(!isset($obj->use_html)) {
60
+				$obj->use_html = 'N';
61
+			}
53 62
 		}
54 63
 
55 64
 		settype($obj->title, "string");
56
-		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
65
+		if($obj->title == '') {
66
+			$obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
67
+		}
57 68
 		//setup dpcument title tp 'Untitled'
58
-		if($obj->title == '') $obj->title = 'Untitled';
69
+		if($obj->title == '') {
70
+			$obj->title = 'Untitled';
71
+		}
59 72
 
60 73
 		// unset document style if the user is not the document manager
61 74
 		if(!$this->grant->manager)
@@ -96,8 +109,7 @@  discard block
 block discarded – undo
96 109
 			{
97 110
 				$oDocument->add('member_srl', $obj->member_srl);
98 111
 			}
99
-		}
100
-		else
112
+		} else
101 113
 		{
102 114
 			$bAnonymous = false;
103 115
 		}
@@ -169,7 +181,9 @@  discard block
 block discarded – undo
169 181
 				for($i=0;$i<count($target_mail);$i++)
170 182
 				{
171 183
 					$email_address = trim($target_mail[$i]);
172
-					if(!$email_address) continue;
184
+					if(!$email_address) {
185
+						continue;
186
+					}
173 187
 					$oMail->setReceiptor($email_address, $email_address);
174 188
 					$oMail->send();
175 189
 				}
@@ -263,7 +277,9 @@  discard block
 block discarded – undo
263 277
 		$obj = Context::getRequestVars();
264 278
 		$obj->module_srl = $this->module_srl;
265 279
 
266
-		if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
280
+		if(!$this->module_info->use_status) {
281
+			$this->module_info->use_status = 'PUBLIC';
282
+		}
267 283
 		if(!is_array($this->module_info->use_status))
268 284
 		{
269 285
 			$this->module_info->use_status = explode('|@|', $this->module_info->use_status);
@@ -272,8 +288,7 @@  discard block
 block discarded – undo
272 288
 		if(in_array('SECRET', $this->module_info->use_status))
273 289
 		{
274 290
 			$this->module_info->secret = 'Y';
275
-		}
276
-		else
291
+		} else
277 292
 		{
278 293
 			unset($obj->is_secret);
279 294
 			$this->module_info->secret = 'N';
@@ -283,13 +298,20 @@  discard block
 block discarded – undo
283 298
 		$module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl);
284 299
 		if($module_config->mobile_use_editor === 'Y')
285 300
 		{
286
-			if(!isset($obj->use_editor)) $obj->use_editor = 'Y';
287
-			if(!isset($obj->use_html)) $obj->use_html = 'Y';
288
-		}
289
-		else
301
+			if(!isset($obj->use_editor)) {
302
+				$obj->use_editor = 'Y';
303
+			}
304
+			if(!isset($obj->use_html)) {
305
+				$obj->use_html = 'Y';
306
+			}
307
+		} else
290 308
 		{
291
-			if(!isset($obj->use_editor)) $obj->use_editor = 'N';
292
-			if(!isset($obj->use_html)) $obj->use_html = 'N';
309
+			if(!isset($obj->use_editor)) {
310
+				$obj->use_editor = 'N';
311
+			}
312
+			if(!isset($obj->use_html)) {
313
+				$obj->use_html = 'N';
314
+			}
293 315
 		}
294 316
 
295 317
 		// check if the doument is existed
@@ -309,8 +331,7 @@  discard block
 block discarded – undo
309 331
 			$obj->email_address = $obj->homepage = $obj->user_id = '';
310 332
 			$obj->user_name = $obj->nick_name = 'anonymous';
311 333
 			$bAnonymous = true;
312
-		}
313
-		else
334
+		} else
314 335
 		{
315 336
 			$bAnonymous = false;
316 337
 		}
@@ -416,7 +437,9 @@  discard block
 block discarded – undo
416 437
 		// generate trackback module controller object
417 438
 		$oTrackbackController = getController('trackback');
418 439
 
419
-		if(!$oTrackbackController) return;
440
+		if(!$oTrackbackController) {
441
+			return;
442
+		}
420 443
 
421 444
 		$output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager);
422 445
 		if(!$output->toBool())
Please login to merge, or discard this patch.
modules/admin/admin.admin.model.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -956,10 +956,10 @@
 block discarded – undo
956 956
 
957 957
 		$file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
958 958
 		if(!$file_exsit && $default === true)
959
-        {
960
-            $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
961
-        }
962
-        elseif($file_exsit)
959
+		{
960
+			$icon_url = './modules/admin/tpl/img/' . $default_icon_name;
961
+		}
962
+		elseif($file_exsit)
963 963
 		{
964 964
 			$default_url = Context::getDefaultUrl();
965 965
 			if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
Please login to merge, or discard this patch.
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$ftp_info = Context::getRequestVars();
32 32
 
33
-		if(!$ftp_info->ftp_host)
33
+		if (!$ftp_info->ftp_host)
34 34
 		{
35 35
 			$ftp_info->ftp_host = "127.0.0.1";
36 36
 		}
37 37
 
38
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
38
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
39 39
 		{
40 40
 			$ftp_info->ftp_port = '22';
41 41
 		}
42 42
 
43 43
 		$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
44
-		if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
44
+		if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
45 45
 		{
46 46
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
47 47
 		}
@@ -58,29 +58,29 @@  discard block
 block discarded – undo
58 58
 		$path_candidate = array();
59 59
 
60 60
 		$temp = '';
61
-		foreach($path_info as $path)
61
+		foreach ($path_info as $path)
62 62
 		{
63
-			$temp = '/' . $path . $temp;
63
+			$temp = '/'.$path.$temp;
64 64
 			$path_candidate[] = $temp;
65 65
 		}
66 66
 
67 67
 		// try
68
-		foreach($path_candidate as $path)
68
+		foreach ($path_candidate as $path)
69 69
 		{
70 70
 			// upload check file
71
-			if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html'))
71
+			if (!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path.'ftp_check.html'))
72 72
 			{
73 73
 				continue;
74 74
 			}
75 75
 
76 76
 			// get check file
77
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
77
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
78 78
 
79 79
 			// delete temp check file
80
-			@ssh2_sftp_unlink($sftp, $path . 'ftp_check.html');
80
+			@ssh2_sftp_unlink($sftp, $path.'ftp_check.html');
81 81
 
82 82
 			// found
83
-			if($result == $pin)
83
+			if ($result == $pin)
84 84
 			{
85 85
 				$found_path = $path;
86 86
 				break;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
91 91
 
92
-		if($found_path)
92
+		if ($found_path)
93 93
 		{
94 94
 			$this->add('found_path', $found_path);
95 95
 		}
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 	{
100 100
 		$ftp_info = Context::getRequestVars();
101 101
 
102
-		if(!$ftp_info->ftp_host)
102
+		if (!$ftp_info->ftp_host)
103 103
 		{
104 104
 			$ftp_info->ftp_host = "127.0.0.1";
105 105
 		}
106 106
 
107
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
107
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
108 108
 		{
109 109
 			$ftp_info->ftp_port = '22';
110 110
 		}
111 111
 
112 112
 		$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
113
-		if(!$connection)
113
+		if (!$connection)
114 114
 		{
115 115
 			return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
116 116
 		}
117 117
 
118 118
 		$login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password);
119
-		if(!$login_result)
119
+		if (!$login_result)
120 120
 		{
121 121
 			ftp_close($connection);
122 122
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
@@ -133,29 +133,29 @@  discard block
 block discarded – undo
133 133
 		$path_candidate = array();
134 134
 
135 135
 		$temp = '';
136
-		foreach($path_info as $path)
136
+		foreach ($path_info as $path)
137 137
 		{
138
-			$temp = '/' . $path . $temp;
138
+			$temp = '/'.$path.$temp;
139 139
 			$path_candidate[] = $temp;
140 140
 		}
141 141
 
142 142
 		// try
143
-		foreach($path_candidate as $path)
143
+		foreach ($path_candidate as $path)
144 144
 		{
145 145
 			// upload check file
146
-			if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY))
146
+			if (!ftp_put($connection, $path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY))
147 147
 			{
148 148
 				continue;
149 149
 			}
150 150
 
151 151
 			// get check file
152
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
152
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
153 153
 
154 154
 			// delete temp check file
155
-			ftp_delete($connection, $path . 'ftp_check.html');
155
+			ftp_delete($connection, $path.'ftp_check.html');
156 156
 
157 157
 			// found
158
-			if($result == $pin)
158
+			if ($result == $pin)
159 159
 			{
160 160
 				$found_path = $path;
161 161
 				break;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
166 166
 
167
-		if($found_path)
167
+		if ($found_path)
168 168
 		{
169 169
 			$this->add('found_path', $found_path);
170 170
 		}
@@ -175,39 +175,39 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	function getAdminFTPPath()
177 177
 	{
178
-		Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
178
+		Context::loadLang(_XE_PATH_.'modules/autoinstall/lang');
179 179
 		@set_time_limit(5);
180
-		require_once(_XE_PATH_ . 'libs/ftp.class.php');
180
+		require_once(_XE_PATH_.'libs/ftp.class.php');
181 181
 
182 182
 		$ftp_info = Context::getRequestVars();
183 183
 
184
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
184
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password)
185 185
 		{
186 186
 			return new Object(1, 'msg_ftp_invalid_auth_info');
187 187
 		}
188 188
 
189
-		if(!$ftp_info->ftp_host)
189
+		if (!$ftp_info->ftp_host)
190 190
 		{
191 191
 			$ftp_info->ftp_host = '127.0.0.1';
192 192
 		}
193 193
 
194
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
194
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
195 195
 		{
196 196
 			$ftp_info->ftp_port = '21';
197 197
 		}
198 198
 
199
-		if($ftp_info->sftp == 'Y')
199
+		if ($ftp_info->sftp == 'Y')
200 200
 		{
201
-			if(!function_exists('ssh2_sftp'))
201
+			if (!function_exists('ssh2_sftp'))
202 202
 			{
203 203
 				return new Object(-1, 'disable_sftp_support');
204 204
 			}
205 205
 			return $this->getSFTPPath();
206 206
 		}
207 207
 
208
-		if($ftp_info->ftp_pasv == 'N')
208
+		if ($ftp_info->ftp_pasv == 'N')
209 209
 		{
210
-			if(function_exists('ftp_connect'))
210
+			if (function_exists('ftp_connect'))
211 211
 			{
212 212
 				return $this->getFTPPath();
213 213
 			}
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 
217 217
 		$oFTP = new ftp();
218
-		if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
218
+		if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
219 219
 		{
220 220
 			return new Object(1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
221 221
 		}
222 222
 
223
-		if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
223
+		if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
224 224
 		{
225 225
 			return new Object(1, 'msg_ftp_invalid_auth_info');
226 226
 		}
@@ -236,29 +236,29 @@  discard block
 block discarded – undo
236 236
 		$path_candidate = array();
237 237
 
238 238
 		$temp = '';
239
-		foreach($path_info as $path)
239
+		foreach ($path_info as $path)
240 240
 		{
241
-			$temp = '/' . $path . $temp;
241
+			$temp = '/'.$path.$temp;
242 242
 			$path_candidate[] = $temp;
243 243
 		}
244 244
 
245 245
 		// try
246
-		foreach($path_candidate as $path)
246
+		foreach ($path_candidate as $path)
247 247
 		{
248 248
 			// upload check file
249
-			if(!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check')))
249
+			if (!$oFTP->ftp_put($path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check')))
250 250
 			{
251 251
 				continue;
252 252
 			}
253 253
 
254 254
 			// get check file
255
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
255
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
256 256
 
257 257
 			// delete temp check file
258
-			$oFTP->ftp_delete($path . 'ftp_check.html');
258
+			$oFTP->ftp_delete($path.'ftp_check.html');
259 259
 
260 260
 			// found
261
-			if($result == $pin)
261
+			if ($result == $pin)
262 262
 			{
263 263
 				$found_path = $path;
264 264
 				break;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
269 269
 
270
-		if($found_path)
270
+		if ($found_path)
271 271
 		{
272 272
 			$this->add('found_path', $found_path);
273 273
 		}
@@ -280,27 +280,27 @@  discard block
 block discarded – undo
280 280
 	function getSFTPList()
281 281
 	{
282 282
 		$ftp_info = Context::getRequestVars();
283
-		if(!$ftp_info->ftp_host)
283
+		if (!$ftp_info->ftp_host)
284 284
 		{
285 285
 			$ftp_info->ftp_host = "127.0.0.1";
286 286
 		}
287 287
 		$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
288
-		if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
288
+		if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
289 289
 		{
290 290
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
291 291
 		}
292 292
 
293 293
 		$sftp = ssh2_sftp($connection);
294
-		$curpwd = "ssh2.sftp://$sftp" . $this->pwd;
294
+		$curpwd = "ssh2.sftp://$sftp".$this->pwd;
295 295
 		$dh = @opendir($curpwd);
296
-		if(!$dh)
296
+		if (!$dh)
297 297
 		{
298 298
 			return new Object(-1, 'msg_ftp_invalid_path');
299 299
 		}
300 300
 		$list = array();
301
-		while(($file = readdir($dh)) !== FALSE)
301
+		while (($file = readdir($dh)) !== FALSE)
302 302
 		{
303
-			if(is_dir($curpwd . $file))
303
+			if (is_dir($curpwd.$file))
304 304
 			{
305 305
 				$file .= "/";
306 306
 			}
@@ -320,32 +320,32 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	function getAdminFTPList()
322 322
 	{
323
-		Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
323
+		Context::loadLang(_XE_PATH_.'modules/autoinstall/lang');
324 324
 		@set_time_limit(5);
325 325
 
326
-		require_once(_XE_PATH_ . 'libs/ftp.class.php');
326
+		require_once(_XE_PATH_.'libs/ftp.class.php');
327 327
 
328 328
 		$ftp_info = Context::getRequestVars();
329
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
329
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password)
330 330
 		{
331 331
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
332 332
 		}
333 333
 
334 334
 		$this->pwd = $ftp_info->ftp_root_path;
335 335
 
336
-		if(!$ftp_info->ftp_host)
336
+		if (!$ftp_info->ftp_host)
337 337
 		{
338 338
 			$ftp_info->ftp_host = "127.0.0.1";
339 339
 		}
340 340
 
341
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
341
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
342 342
 		{
343 343
 			$ftp_info->ftp_port = "21";
344 344
 		}
345 345
 
346
-		if($ftp_info->sftp == 'Y')
346
+		if ($ftp_info->sftp == 'Y')
347 347
 		{
348
-			if(!function_exists('ssh2_sftp'))
348
+			if (!function_exists('ssh2_sftp'))
349 349
 			{
350 350
 				return new Object(-1, 'disable_sftp_support');
351 351
 			}
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 		}
354 354
 
355 355
 		$oFtp = new ftp();
356
-		if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
356
+		if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
357 357
 		{
358
-			if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
358
+			if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
359 359
 			{
360 360
 				$_list = $oFtp->ftp_rawlist($this->pwd);
361 361
 				$oFtp->ftp_quit();
@@ -367,17 +367,17 @@  discard block
 block discarded – undo
367 367
 		}
368 368
 		$list = array();
369 369
 
370
-		if($_list)
370
+		if ($_list)
371 371
 		{
372
-			foreach($_list as $k => $v)
372
+			foreach ($_list as $k => $v)
373 373
 			{
374 374
 				$src = new stdClass();
375 375
 				$src->data = $v;
376 376
 				$res = Context::convertEncoding($src);
377 377
 				$v = $res->data;
378
-				if(strpos($v, 'd') === 0 || strpos($v, '<DIR>'))
378
+				if (strpos($v, 'd') === 0 || strpos($v, '<DIR>'))
379 379
 				{
380
-					$list[] = substr(strrchr($v, ' '), 1) . '/';
380
+					$list[] = substr(strrchr($v, ' '), 1).'/';
381 381
 				}
382 382
 			}
383 383
 		}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			, 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget')
401 401
 			, 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image')
402 402
 			, 'layout' => array('default')
403
-			, 'widget' => array('content', 'language_select', 'login_info','mcontent')
403
+			, 'widget' => array('content', 'language_select', 'login_info', 'mcontent')
404 404
 			, 'widgetstyle' => array(),
405 405
 		);
406 406
 		$info = array();
@@ -420,86 +420,86 @@  discard block
 block discarded – undo
420 420
 		$info['use_ssl'] = $db_info->use_ssl;
421 421
 		
422 422
 		$info['phpext'] = '';
423
-		foreach(get_loaded_extensions() as $ext)
423
+		foreach (get_loaded_extensions() as $ext)
424 424
 		{
425 425
 			$ext = strtolower($ext);
426
-			if(in_array($ext, $skip['ext']))
426
+			if (in_array($ext, $skip['ext']))
427 427
 			{
428 428
 				continue;
429 429
 			}
430
-			$info['phpext'] .= '|' . $ext;
430
+			$info['phpext'] .= '|'.$ext;
431 431
 		}
432 432
 		$info['phpext'] = substr($info['phpext'], 1);
433 433
 
434 434
 		$info['module'] = '';
435 435
 		$oModuleModel = getModel('module');
436 436
 		$module_list = $oModuleModel->getModuleList();
437
-		if($module_list) foreach($module_list as $module)
437
+		if ($module_list) foreach ($module_list as $module)
438 438
 		{
439
-			if(in_array($module->module, $skip['module']))
439
+			if (in_array($module->module, $skip['module']))
440 440
 			{
441 441
 				continue;
442 442
 			}
443
-			$info['module'] .= '|' . $module->module;
443
+			$info['module'] .= '|'.$module->module;
444 444
 		}
445 445
 		$info['module'] = substr($info['module'], 1);
446 446
 
447 447
 		$info['addon'] = '';
448 448
 		$oAddonAdminModel = getAdminModel('addon');
449 449
 		$addon_list = $oAddonAdminModel->getAddonList();
450
-		if($addon_list) foreach($addon_list as $addon)
450
+		if ($addon_list) foreach ($addon_list as $addon)
451 451
 		{
452
-			if(in_array($addon->addon, $skip['addon']))
452
+			if (in_array($addon->addon, $skip['addon']))
453 453
 			{
454 454
 				continue;
455 455
 			}
456
-			$info['addon'] .= '|' . $addon->addon;
456
+			$info['addon'] .= '|'.$addon->addon;
457 457
 		}
458 458
 		$info['addon'] = substr($info['addon'], 1);
459 459
 
460 460
 		$info['layout'] = "";
461 461
 		$oLayoutModel = getModel('layout');
462 462
 		$layout_list = $oLayoutModel->getDownloadedLayoutList();
463
-		if($layout_list) foreach($layout_list as $layout)
463
+		if ($layout_list) foreach ($layout_list as $layout)
464 464
 		{
465
-			if(in_array($layout->layout, $skip['layout']))
465
+			if (in_array($layout->layout, $skip['layout']))
466 466
 			{
467 467
 				continue;
468 468
 			}
469
-			$info['layout'] .= '|' . $layout->layout;
469
+			$info['layout'] .= '|'.$layout->layout;
470 470
 		}
471 471
 		$info['layout'] = substr($info['layout'], 1);
472 472
 
473 473
 		$info['widget'] = "";
474 474
 		$oWidgetModel = getModel('widget');
475 475
 		$widget_list = $oWidgetModel->getDownloadedWidgetList();
476
-		if($widget_list) foreach($widget_list as $widget)
476
+		if ($widget_list) foreach ($widget_list as $widget)
477 477
 		{
478
-			if(in_array($widget->widget, $skip['widget']))
478
+			if (in_array($widget->widget, $skip['widget']))
479 479
 			{
480 480
 				continue;
481 481
 			}
482
-			$info['widget'] .= '|' . $widget->widget;
482
+			$info['widget'] .= '|'.$widget->widget;
483 483
 		}
484 484
 		$info['widget'] = substr($info['widget'], 1);
485 485
 
486 486
 		$info['widgetstyle'] = "";
487 487
 		$oWidgetModel = getModel('widget');
488 488
 		$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
489
-		if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle)
489
+		if ($widgetstyle_list) foreach ($widgetstyle_list as $widgetstyle)
490 490
 		{
491
-			if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
491
+			if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
492 492
 			{
493 493
 				continue;
494 494
 			}
495
-			$info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle;
495
+			$info['widgetstyle'] .= '|'.$widgetstyle->widgetStyle;
496 496
 		}
497 497
 		$info['widgetstyle'] = substr($info['widgetstyle'], 1);
498 498
 
499 499
 		$param = '';
500
-		foreach($info as $k => $v)
500
+		foreach ($info as $k => $v)
501 501
 		{
502
-			if($v)
502
+			if ($v)
503 503
 			{
504 504
 				$param .= sprintf('&%s=%s', $k, urlencode($v));
505 505
 			}
@@ -515,13 +515,13 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	function getThemeList()
517 517
 	{
518
-		$path = _XE_PATH_ . 'themes';
518
+		$path = _XE_PATH_.'themes';
519 519
 		$list = FileHandler::readDir($path);
520 520
 
521 521
 		$theme_info = array();
522
-		if(count($list) > 0)
522
+		if (count($list) > 0)
523 523
 		{
524
-			foreach($list as $val)
524
+			foreach ($list as $val)
525 525
 			{
526 526
 				$theme_info[$val] = $this->getThemeInfo($val);
527 527
 			}
@@ -538,20 +538,20 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	function getThemeInfo($theme_name, $layout_list = NULL)
540 540
 	{
541
-		if($GLOBALS['__ThemeInfo__'][$theme_name])
541
+		if ($GLOBALS['__ThemeInfo__'][$theme_name])
542 542
 		{
543 543
 			return $GLOBALS['__ThemeInfo__'][$theme_name];
544 544
 		}
545 545
 
546
-		$info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml';
547
-		if(!file_exists($info_file))
546
+		$info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml';
547
+		if (!file_exists($info_file))
548 548
 		{
549 549
 			return;
550 550
 		}
551 551
 
552 552
 		$oXmlParser = new XmlParser();
553 553
 		$_xml_obj = $oXmlParser->loadXmlFile($info_file);
554
-		if(!$_xml_obj->theme)
554
+		if (!$_xml_obj->theme)
555 555
 		{
556 556
 			return;
557 557
 		}
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
 		$theme_info = new stdClass();
563 563
 		$theme_info->name = $theme_name;
564 564
 		$theme_info->title = $xml_obj->title->body;
565
-		$thumbnail = './themes/' . $theme_name . '/thumbnail.png';
565
+		$thumbnail = './themes/'.$theme_name.'/thumbnail.png';
566 566
 		$theme_info->thumbnail = (FileHandler::exists($thumbnail)) ? $thumbnail : NULL;
567 567
 		$theme_info->version = $xml_obj->version->body;
568 568
 		$date_obj = new stdClass();
569 569
 		sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
570 570
 		$theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
571 571
 		$theme_info->description = $xml_obj->description->body;
572
-		$theme_info->path = './themes/' . $theme_name . '/';
572
+		$theme_info->path = './themes/'.$theme_name.'/';
573 573
 
574
-		if(!is_array($xml_obj->publisher))
574
+		if (!is_array($xml_obj->publisher))
575 575
 		{
576 576
 			$publisher_list = array();
577 577
 			$publisher_list[] = $xml_obj->publisher;
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 		}
583 583
 
584 584
 		$theme_info->publisher = array();
585
-		foreach($publisher_list as $publisher)
585
+		foreach ($publisher_list as $publisher)
586 586
 		{
587 587
 			$publisher_obj = new stdClass();
588 588
 			$publisher_obj->name = $publisher->name->body;
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 		$layout_path = $layout->directory->attrs->path;
596 596
 		$layout_parse = explode('/', $layout_path);
597 597
 		$layout_info = new stdClass();
598
-		switch($layout_parse[1])
598
+		switch ($layout_parse[1])
599 599
 		{
600 600
 			case 'themes' :
601
-					$layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1];
601
+					$layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse) - 1];
602 602
 					break;
603 603
 
604 604
 			case 'layouts' :
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 		$oLayoutModel = getModel('layout');
616 616
 		$layout_info_list = array();
617 617
 		$layout_list = $oLayoutModel->getLayoutList($site_info->site_srl);
618
-		if($layout_list)
618
+		if ($layout_list)
619 619
 		{
620
-			foreach($layout_list as $val)
620
+			foreach ($layout_list as $val)
621 621
 			{
622
-				if($val->layout == $layout_info->name)
622
+				if ($val->layout == $layout_info->name)
623 623
 				{
624 624
 					$is_new_layout = FALSE;
625 625
 					$layout_info->layout_srl = $val->layout_srl;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 			}
629 629
 		}
630 630
 
631
-		if($is_new_layout)
631
+		if ($is_new_layout)
632 632
 		{
633 633
 			$site_module_info = Context::get('site_module_info');
634 634
 			$args = new stdClass();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		$theme_info->layout_info = $layout_info;
647 647
 
648 648
 		$skin_infos = $xml_obj->skininfos;
649
-		if(is_array($skin_infos->skininfo))
649
+		if (is_array($skin_infos->skininfo))
650 650
 		{
651 651
 			$skin_list = $skin_infos->skininfo;
652 652
 		}
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
 
658 658
 		$oModuleModel = getModel('module');
659 659
 		$skins = array();
660
-		foreach($skin_list as $val)
660
+		foreach ($skin_list as $val)
661 661
 		{
662 662
 			$skin_info = new stdClass();
663 663
 			unset($skin_parse);
664 664
 			$skin_parse = explode('/', $val->directory->attrs->path);
665
-			switch($skin_parse[1])
665
+			switch ($skin_parse[1])
666 666
 			{
667 667
 				case 'themes' :
668 668
 						$is_theme = TRUE;
669 669
 						$module_name = $skin_parse[count($skin_parse) - 1];
670
-						$skin_info->name = $theme_name . '|@|' . $module_name;
670
+						$skin_info->name = $theme_name.'|@|'.$module_name;
671 671
 						break;
672 672
 
673 673
 				case 'modules' :
@@ -681,9 +681,9 @@  discard block
 block discarded – undo
681 681
 			$skin_info->is_theme = $is_theme;
682 682
 			$skins[$module_name] = $skin_info;
683 683
 
684
-			if($is_theme)
684
+			if ($is_theme)
685 685
 			{
686
-				if(!$GLOBALS['__ThemeModuleSkin__'][$module_name])
686
+				if (!$GLOBALS['__ThemeModuleSkin__'][$module_name])
687 687
 				{
688 688
 					$GLOBALS['__ThemeModuleSkin__'][$module_name] = array();
689 689
 					$GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array();
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	function getModulesSkinList()
707 707
 	{
708
-		if($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__'])
708
+		if ($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__'])
709 709
 		{
710 710
 			return $GLOBALS['__ThemeModuleSkin__'];
711 711
 		}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		sort($searched_list);
714 714
 
715 715
 		$searched_count = count($searched_list);
716
-		if(!$searched_count)
716
+		if (!$searched_count)
717 717
 		{
718 718
 			return;
719 719
 		}
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 		$exceptionModule = array('editor', 'poll', 'homepage', 'textyle');
722 722
 
723 723
 		$oModuleModel = getModel('module');
724
-		foreach($searched_list as $val)
724
+		foreach ($searched_list as $val)
725 725
 		{
726
-			$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $val);
726
+			$skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$val);
727 727
 
728
-			if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule))
728
+			if (is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule))
729 729
 			{
730
-				if(!$GLOBALS['__ThemeModuleSkin__'][$val])
730
+				if (!$GLOBALS['__ThemeModuleSkin__'][$val])
731 731
 				{
732 732
 					$GLOBALS['__ThemeModuleSkin__'][$val] = array();
733 733
 					$moduleInfo = $oModuleModel->getModuleInfoXml($val);
@@ -752,22 +752,22 @@  discard block
 block discarded – undo
752 752
 		$cacheFile = sprintf('./files/cache/menu/admin_lang/adminMenu.%s.lang.php', $currentLang);
753 753
 
754 754
 		// Update if no cache file exists or it is older than xml file
755
-		if(!is_readable($cacheFile))
755
+		if (!is_readable($cacheFile))
756 756
 		{
757 757
 			$lang = new stdClass();
758 758
 			$oModuleModel = getModel('module');
759 759
 			$installed_module_list = $oModuleModel->getModulesXmlInfo();
760 760
 
761 761
 			$this->gnbLangBuffer = '<?php $lang = new stdClass();';
762
-			foreach($installed_module_list AS $key => $value)
762
+			foreach ($installed_module_list AS $key => $value)
763 763
 			{
764 764
 				$moduleActionInfo = $oModuleModel->getModuleActionXml($value->module);
765
-				if(is_object($moduleActionInfo->menu))
765
+				if (is_object($moduleActionInfo->menu))
766 766
 				{
767
-					foreach($moduleActionInfo->menu AS $key2 => $value2)
767
+					foreach ($moduleActionInfo->menu AS $key2 => $value2)
768 768
 					{
769 769
 						$lang->menu_gnb_sub[$key2] = $value2->title;
770
-						$this->gnbLangBuffer .=sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title);
770
+						$this->gnbLangBuffer .= sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title);
771 771
 					}
772 772
 				}
773 773
 			}
@@ -793,19 +793,19 @@  discard block
 block discarded – undo
793 793
 		$args = new stdClass();
794 794
 		$args->site_srl = $siteSrl;
795 795
 		$output = executeQueryArray('admin.getFavoriteList', $args);
796
-		if(!$output->toBool())
796
+		if (!$output->toBool())
797 797
 		{
798 798
 			return $output;
799 799
 		}
800
-		if(!$output->data)
800
+		if (!$output->data)
801 801
 		{
802 802
 			return new Object();
803 803
 		}
804 804
 
805
-		if($isGetModuleInfo && is_array($output->data))
805
+		if ($isGetModuleInfo && is_array($output->data))
806 806
 		{
807 807
 			$oModuleModel = getModel('module');
808
-			foreach($output->data AS $key => $value)
808
+			foreach ($output->data AS $key => $value)
809 809
 			{
810 810
 				$moduleInfo = $oModuleModel->getModuleInfoXml($value->module);
811 811
 				$output->data[$key]->admin_index_act = $moduleInfo->admin_index_act;
@@ -830,13 +830,13 @@  discard block
 block discarded – undo
830 830
 		$args->site_srl = $siteSrl;
831 831
 		$args->module = $module;
832 832
 		$output = executeQuery('admin.getFavorite', $args);
833
-		if(!$output->toBool())
833
+		if (!$output->toBool())
834 834
 		{
835 835
 			return $output;
836 836
 		}
837 837
 
838 838
 		$returnObject = new Object();
839
-		if($output->data)
839
+		if ($output->data)
840 840
 		{
841 841
 			$returnObject->add('result', TRUE);
842 842
 			$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl);
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 	 */
856 856
 	function getSiteAllList()
857 857
 	{
858
-		if(Context::get('domain'))
858
+		if (Context::get('domain'))
859 859
 		{
860 860
 			$domain = Context::get('domain');
861 861
 		}
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 	function getAllSitesThatHaveModules($domain = NULL)
873 873
 	{
874 874
 		$args = new stdClass();
875
-		if($domain)
875
+		if ($domain)
876 876
 		{
877 877
 			$args->domain = $domain;
878 878
 		}
@@ -880,31 +880,31 @@  discard block
 block discarded – undo
880 880
 
881 881
 		$siteList = array();
882 882
 		$output = executeQueryArray('admin.getSiteAllList', $args, $columnList);
883
-		if($output->toBool())
883
+		if ($output->toBool())
884 884
 		{
885 885
 			$siteList = $output->data;
886 886
 		}
887 887
 
888 888
 		$oModuleModel = getModel('module');
889
-		foreach($siteList as $key => $value)
889
+		foreach ($siteList as $key => $value)
890 890
 		{
891 891
 			$args->site_srl = $value->site_srl;
892 892
 			$list = $oModuleModel->getModuleSrlList($args);
893 893
 
894
-			if(!is_array($list))
894
+			if (!is_array($list))
895 895
 			{
896 896
 				$list = array($list);
897 897
 			}
898 898
 
899
-			foreach($list as $k => $v)
899
+			foreach ($list as $k => $v)
900 900
 			{
901
-				if(!is_dir(_XE_PATH_ . 'modules/' . $v->module))
901
+				if (!is_dir(_XE_PATH_.'modules/'.$v->module))
902 902
 				{
903 903
 					unset($list[$k]);
904 904
 				}
905 905
 			}
906 906
 
907
-			if(!count($list))
907
+			if (!count($list))
908 908
 			{
909 909
 				unset($siteList[$key]);
910 910
 			}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	{
922 922
 		$args = new stdClass();
923 923
 
924
-		if($date)
924
+		if ($date)
925 925
 		{
926 926
 			$args->regDate = date('Ymd', strtotime($date));
927 927
 		}
928 928
 
929 929
 		$output = executeQuery('admin.getSiteCountByDate', $args);
930
-		if(!$output->toBool())
930
+		if (!$output->toBool())
931 931
 		{
932 932
 			return 0;
933 933
 		}
@@ -949,21 +949,21 @@  discard block
 block discarded – undo
949 949
 	{
950 950
 		$site_info = Context::get('site_module_info');
951 951
 		$virtual_site = '';
952
-		if($site_info->site_srl) 
952
+		if ($site_info->site_srl) 
953 953
 		{
954
-			$virtual_site = $site_info->site_srl . '/';
954
+			$virtual_site = $site_info->site_srl.'/';
955 955
 		}
956 956
 
957
-		$file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
958
-		if(!$file_exsit && $default === true)
957
+		$file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
958
+		if (!$file_exsit && $default === true)
959 959
         {
960
-            $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
960
+            $icon_url = './modules/admin/tpl/img/'.$default_icon_name;
961 961
         }
962
-        elseif($file_exsit)
962
+        elseif ($file_exsit)
963 963
 		{
964 964
 			$default_url = Context::getDefaultUrl();
965
-			if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
966
-			$icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname;
965
+			if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
966
+			$icon_url = $default_url.'/files/attach/xeicon/'.$virtual_site.$iconname;
967 967
 		}
968 968
 		return $icon_url;
969 969
 	}
Please login to merge, or discard this patch.
Braces   +26 added lines, -22 removed lines patch added patch discarded remove patch
@@ -303,8 +303,7 @@  discard block
 block discarded – undo
303 303
 			if(is_dir($curpwd . $file))
304 304
 			{
305 305
 				$file .= "/";
306
-			}
307
-			else
306
+			} else
308 307
 			{
309 308
 				continue;
310 309
 			}
@@ -359,8 +358,7 @@  discard block
 block discarded – undo
359 358
 			{
360 359
 				$_list = $oFtp->ftp_rawlist($this->pwd);
361 360
 				$oFtp->ftp_quit();
362
-			}
363
-			else
361
+			} else
364 362
 			{
365 363
 				return new Object(-1, 'msg_ftp_invalid_auth_info');
366 364
 			}
@@ -380,8 +378,7 @@  discard block
 block discarded – undo
380 378
 					$list[] = substr(strrchr($v, ' '), 1) . '/';
381 379
 				}
382 380
 			}
383
-		}
384
-		else
381
+		} else
385 382
 		{
386 383
 			return new Object(-1, 'msg_ftp_no_directory');
387 384
 		}
@@ -434,11 +431,13 @@  discard block
 block discarded – undo
434 431
 		$info['module'] = '';
435 432
 		$oModuleModel = getModel('module');
436 433
 		$module_list = $oModuleModel->getModuleList();
437
-		if($module_list) foreach($module_list as $module)
434
+		if($module_list) {
435
+			foreach($module_list as $module)
438 436
 		{
439 437
 			if(in_array($module->module, $skip['module']))
440 438
 			{
441 439
 				continue;
440
+		}
442 441
 			}
443 442
 			$info['module'] .= '|' . $module->module;
444 443
 		}
@@ -447,11 +446,13 @@  discard block
 block discarded – undo
447 446
 		$info['addon'] = '';
448 447
 		$oAddonAdminModel = getAdminModel('addon');
449 448
 		$addon_list = $oAddonAdminModel->getAddonList();
450
-		if($addon_list) foreach($addon_list as $addon)
449
+		if($addon_list) {
450
+			foreach($addon_list as $addon)
451 451
 		{
452 452
 			if(in_array($addon->addon, $skip['addon']))
453 453
 			{
454 454
 				continue;
455
+		}
455 456
 			}
456 457
 			$info['addon'] .= '|' . $addon->addon;
457 458
 		}
@@ -460,11 +461,13 @@  discard block
 block discarded – undo
460 461
 		$info['layout'] = "";
461 462
 		$oLayoutModel = getModel('layout');
462 463
 		$layout_list = $oLayoutModel->getDownloadedLayoutList();
463
-		if($layout_list) foreach($layout_list as $layout)
464
+		if($layout_list) {
465
+			foreach($layout_list as $layout)
464 466
 		{
465 467
 			if(in_array($layout->layout, $skip['layout']))
466 468
 			{
467 469
 				continue;
470
+		}
468 471
 			}
469 472
 			$info['layout'] .= '|' . $layout->layout;
470 473
 		}
@@ -473,11 +476,13 @@  discard block
 block discarded – undo
473 476
 		$info['widget'] = "";
474 477
 		$oWidgetModel = getModel('widget');
475 478
 		$widget_list = $oWidgetModel->getDownloadedWidgetList();
476
-		if($widget_list) foreach($widget_list as $widget)
479
+		if($widget_list) {
480
+			foreach($widget_list as $widget)
477 481
 		{
478 482
 			if(in_array($widget->widget, $skip['widget']))
479 483
 			{
480 484
 				continue;
485
+		}
481 486
 			}
482 487
 			$info['widget'] .= '|' . $widget->widget;
483 488
 		}
@@ -486,11 +491,13 @@  discard block
 block discarded – undo
486 491
 		$info['widgetstyle'] = "";
487 492
 		$oWidgetModel = getModel('widget');
488 493
 		$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
489
-		if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle)
494
+		if($widgetstyle_list) {
495
+			foreach($widgetstyle_list as $widgetstyle)
490 496
 		{
491 497
 			if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
492 498
 			{
493 499
 				continue;
500
+		}
494 501
 			}
495 502
 			$info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle;
496 503
 		}
@@ -575,8 +582,7 @@  discard block
 block discarded – undo
575 582
 		{
576 583
 			$publisher_list = array();
577 584
 			$publisher_list[] = $xml_obj->publisher;
578
-		}
579
-		else
585
+		} else
580 586
 		{
581 587
 			$publisher_list = $xml_obj->publisher;
582 588
 		}
@@ -649,8 +655,7 @@  discard block
 block discarded – undo
649 655
 		if(is_array($skin_infos->skininfo))
650 656
 		{
651 657
 			$skin_list = $skin_infos->skininfo;
652
-		}
653
-		else
658
+		} else
654 659
 		{
655 660
 			$skin_list = array($skin_infos->skininfo);
656 661
 		}
@@ -773,8 +778,7 @@  discard block
 block discarded – undo
773 778
 			}
774 779
 			$this->gnbLangBuffer .= ' ?>';
775 780
 			FileHandler::writeFile($cacheFile, $this->gnbLangBuffer);
776
-		}
777
-		else
781
+		} else
778 782
 		{
779 783
 			include $cacheFile;
780 784
 		}
@@ -840,8 +844,7 @@  discard block
 block discarded – undo
840 844
 		{
841 845
 			$returnObject->add('result', TRUE);
842 846
 			$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl);
843
-		}
844
-		else
847
+		} else
845 848
 		{
846 849
 			$returnObject->add('result', FALSE);
847 850
 		}
@@ -958,11 +961,12 @@  discard block
 block discarded – undo
958 961
 		if(!$file_exsit && $default === true)
959 962
         {
960 963
             $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
961
-        }
962
-        elseif($file_exsit)
964
+        } elseif($file_exsit)
963 965
 		{
964 966
 			$default_url = Context::getDefaultUrl();
965
-			if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
967
+			if($default_url && substr_compare($default_url, '/', -1) === 0) {
968
+				$default_url = substr($default_url, 0, -1);
969
+			}
966 970
 			$icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname;
967 971
 		}
968 972
 		return $icon_url;
Please login to merge, or discard this patch.
modules/install/install.controller.php 2 patches
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	function init()
18 18
 	{
19 19
 		// Error occurs if already installed
20
-		if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
20
+		if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled())
21 21
 		{
22 22
 			$this->stop('msg_already_installed');
23 23
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	function _procDBSetting()
87 87
 	{
88 88
 		// Get DB-related variables
89
-		$con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix');
89
+		$con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix');
90 90
 
91 91
 		$db_info = new stdClass();
92 92
 		$db_info->master_db = get_object_vars($con_string);
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 		// Check if available to connect to the DB
102 102
 		$oDB = &DB::getInstance();
103 103
 		$output = $oDB->getError();
104
-		if(!$output->toBool()) return $output;
105
-		if(!$oDB->isConnected()) return $oDB->getError();
104
+		if (!$output->toBool()) return $output;
105
+		if (!$oDB->isConnected()) return $oDB->getError();
106 106
 
107 107
 		// Create a db temp config file
108
-		if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed');
108
+		if (!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed');
109 109
 
110
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
110
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
111 111
 		{
112 112
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm');
113 113
 			header('location:'.$returnUrl);
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	function procConfigSetting()
122 122
 	{
123 123
 		// Get variables
124
-		$config_info = Context::gets('use_rewrite','time_zone');
125
-		if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
124
+		$config_info = Context::gets('use_rewrite', 'time_zone');
125
+		if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N';
126 126
 
127 127
 		// Create a db temp config file
128
-		if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed');
128
+		if (!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed');
129 129
 
130
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
130
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
131 131
 		{
132 132
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm');
133 133
 			header('location:'.$returnUrl);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	function procInstall()
142 142
 	{
143 143
 		// Check if it is already installed
144
-		if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
144
+		if (Context::isInstalled()) return new Object(-1, 'msg_already_installed');
145 145
 
146 146
 		// Assign a temporary administrator when installing
147 147
 		$logged_info = new stdClass();
@@ -149,15 +149,15 @@  discard block
 block discarded – undo
149 149
 		Context::set('logged_info', $logged_info);
150 150
 
151 151
 		// check install config
152
-		if(Context::get('install_config'))
152
+		if (Context::get('install_config'))
153 153
 		{
154 154
 			$db_info = $this->_makeDbInfoByInstallConfig();
155 155
 		}
156 156
 		// install by default XE UI
157 157
 		else
158 158
 		{
159
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
160
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
159
+			if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
160
+			if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
161 161
 		}
162 162
 
163 163
 		// Set DB type and information
@@ -165,30 +165,30 @@  discard block
 block discarded – undo
165 165
 		// Create DB Instance
166 166
 		$oDB = &DB::getInstance();
167 167
 		// Check if available to connect to the DB
168
-		if(!$oDB->isConnected()) return $oDB->getError();
168
+		if (!$oDB->isConnected()) return $oDB->getError();
169 169
 
170 170
 		// Install all the modules
171 171
 		try {
172 172
 			$oDB->begin();
173 173
 			$this->installDownloadedModule();
174 174
 			$oDB->commit();
175
-		} catch(Exception $e) {
175
+		} catch (Exception $e) {
176 176
 			$oDB->rollback();
177 177
 			return new Object(-1, $e->getMessage());
178 178
 		}
179 179
 
180 180
 		// Create a config file
181
-		if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed');
181
+		if (!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed');
182 182
 
183 183
 		// load script
184
-		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
185
-		if(count($scripts)>0)
184
+		$scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/');
185
+		if (count($scripts) > 0)
186 186
 		{
187 187
 			sort($scripts);
188
-			foreach($scripts as $script)
188
+			foreach ($scripts as $script)
189 189
 			{
190 190
 				$script_path = FileHandler::getRealPath('./modules/install/script/');
191
-				$output = include($script_path . $script);
191
+				$output = include($script_path.$script);
192 192
 			}
193 193
 		}
194 194
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
 		unset($_SESSION['use_rewrite']);
203 203
 
204
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
204
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
205 205
 		{
206 206
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
207 207
 			header('location:'.$returnUrl);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$db_info->use_rewrite = Context::get('use_rewrite');
232 232
 		$db_info->time_zone = Context::get('time_zone');
233 233
 
234
-		if($_SERVER['HTTPS'] == 'on')
234
+		if ($_SERVER['HTTPS'] == 'on')
235 235
 		{
236 236
 			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT'];
237 237
 			$https_port = (!$https_port != 443) ? $https_port : null;
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT'];
242 242
 			$http_port = (!$http_port != 80) ? $http_port : null;
243 243
 		}
244
-		if($http_port) $db_info->http_port = $http_port;
245
-		if($https_port) $db_info->https_port = $https_port;
244
+		if ($http_port) $db_info->http_port = $http_port;
245
+		if ($https_port) $db_info->https_port = $https_port;
246 246
 
247 247
 		return $db_info;
248 248
 	}
@@ -252,57 +252,57 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	function procInstallFTP()
254 254
 	{
255
-		if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
256
-		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
257
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
258
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
259
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
260
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
255
+		if (Context::isInstalled()) return new Object(-1, 'msg_already_installed');
256
+		$ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path');
257
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
258
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
259
+		if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
260
+		if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
261 261
 
262 262
 		$buff = array('<?php if(!defined("__XE__")) exit();');
263 263
 		$buff[] = "\$ftp_info = new stdClass();";
264
-		foreach($ftp_info as $key => $val)
264
+		foreach ($ftp_info as $key => $val)
265 265
 		{
266
-			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val));
266
+			$buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val));
267 267
 		}
268 268
 
269 269
 		// If safe_mode
270
-		if(ini_get('safe_mode'))
270
+		if (ini_get('safe_mode'))
271 271
 		{
272
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
272
+			if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed');
273 273
 
274 274
 			require_once(_XE_PATH_.'libs/ftp.class.php');
275 275
 			$oFtp = new ftp();
276
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
276
+			if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
277 277
 
278
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
278
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
279 279
 			{
280 280
 				$oFtp->ftp_quit();
281
-				return new Object(-1,'msg_ftp_invalid_auth_info');
281
+				return new Object(-1, 'msg_ftp_invalid_auth_info');
282 282
 			}
283 283
 
284
-			if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
284
+			if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files'))
285 285
 			{
286 286
 				$oFtp->ftp_quit();
287
-				return new Object(-1,'msg_ftp_mkdir_fail');
287
+				return new Object(-1, 'msg_ftp_mkdir_fail');
288 288
 			}
289 289
 
290
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
290
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files'))
291 291
 			{
292 292
 				$oFtp->ftp_quit();
293
-				return new Object(-1,'msg_ftp_chmod_fail');
293
+				return new Object(-1, 'msg_ftp_chmod_fail');
294 294
 			}
295 295
 
296
-			if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
296
+			if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config'))
297 297
 			{
298 298
 				$oFtp->ftp_quit();
299
-				return new Object(-1,'msg_ftp_mkdir_fail');
299
+				return new Object(-1, 'msg_ftp_mkdir_fail');
300 300
 			}
301 301
 
302
-			if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
302
+			if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config'))
303 303
 			{
304 304
 				$oFtp->ftp_quit();
305
-				return new Object(-1,'msg_ftp_chmod_fail');
305
+				return new Object(-1, 'msg_ftp_chmod_fail');
306 306
 			}
307 307
 
308 308
 			$oFtp->ftp_quit();
@@ -313,31 +313,31 @@  discard block
 block discarded – undo
313 313
 
314 314
 	function procInstallCheckFtp()
315 315
 	{
316
-		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
317
-		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
318
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
319
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
316
+		$ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp');
317
+		$ftp_info->ftp_port = (int) $ftp_info->ftp_port;
318
+		if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
319
+		if (!$ftp_info->sftp) $ftp_info->sftp = 'N';
320 320
 
321
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
321
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed');
322 322
 
323
-		if($ftp_info->sftp == 'Y')
323
+		if ($ftp_info->sftp == 'Y')
324 324
 		{
325 325
 			$connection = ssh2_connect('localhost', $ftp_info->ftp_port);
326
-			if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
326
+			if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
327 327
 			{
328
-				return new Object(-1,'msg_ftp_invalid_auth_info');
328
+				return new Object(-1, 'msg_ftp_invalid_auth_info');
329 329
 			}
330 330
 		}
331 331
 		else
332 332
 		{
333 333
 			require_once(_XE_PATH_.'libs/ftp.class.php');
334 334
 			$oFtp = new ftp();
335
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
335
+			if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
336 336
 
337
-			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
337
+			if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
338 338
 			{
339 339
 				$oFtp->ftp_quit();
340
-				return new Object(-1,'msg_ftp_invalid_auth_info');
340
+				return new Object(-1, 'msg_ftp_invalid_auth_info');
341 341
 			}
342 342
 			$oFtp->ftp_quit();
343 343
 		}
@@ -354,36 +354,36 @@  discard block
 block discarded – undo
354 354
 		$checklist = array();
355 355
 		// 0. check your version of php (5.2.4 or higher)
356 356
 		$checklist['php_version'] = true;
357
-		if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
357
+		if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<'))
358 358
 		{
359 359
 			$checklist['php_version'] = false;
360 360
 		}
361 361
 
362
-		if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
362
+		if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<'))
363 363
 		{
364 364
 			Context::set('phpversion_warning', true);
365 365
 		}
366 366
 
367 367
 		// 1. Check permission
368
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
368
+		if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true;
369 369
 		else $checklist['permission'] = false;
370 370
 		// 2. Check if xml_parser_create exists
371
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
371
+		if (function_exists('xml_parser_create')) $checklist['xml'] = true;
372 372
 		else $checklist['xml'] = false;
373 373
 		// 3. Check if ini_get (session.auto_start) == 1
374
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
374
+		if (ini_get('session.auto_start') != 1) $checklist['session'] = true;
375 375
 		else $checklist['session'] = false;
376 376
 		// 4. Check if iconv exists
377
-		if(function_exists('iconv')) $checklist['iconv'] = true;
377
+		if (function_exists('iconv')) $checklist['iconv'] = true;
378 378
 		else $checklist['iconv'] = false;
379 379
 		// 5. Check gd(imagecreatefromgif function)
380
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
380
+		if (function_exists('imagecreatefromgif')) $checklist['gd'] = true;
381 381
 		else $checklist['gd'] = false;
382 382
 		// 6. Check DB
383
-		if(DB::getEnableList()) $checklist['db'] = true;
383
+		if (DB::getEnableList()) $checklist['db'] = true;
384 384
 		else $checklist['db'] = false;
385 385
 
386
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
386
+		if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
387 387
 		else $install_enable = true;
388 388
 
389 389
 		// Save the checked result to the Context
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
 		$license_agreement = ($vars->license_agreement == 'Y') ? true : false;
405 405
 
406
-		if($license_agreement)
406
+		if ($license_agreement)
407 407
 		{
408 408
 			$currentTime = $_SERVER['REQUEST_TIME'];
409 409
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 			return new Object(-1, 'msg_must_accept_license_agreement');
415 415
 		}
416 416
 
417
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
417
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
418 418
 		{
419 419
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv');
420 420
 			$this->setRedirectUrl($returnUrl);
@@ -437,25 +437,25 @@  discard block
 block discarded – undo
437 437
 		$hostname = $_SERVER['SERVER_NAME'];
438 438
 		$port = $_SERVER['SERVER_PORT'];
439 439
 		$str_port = '';
440
-		if($port)
440
+		if ($port)
441 441
 		{
442
-			$str_port = ':' . $port;
442
+			$str_port = ':'.$port;
443 443
 		}
444 444
 
445 445
 		$tmpPath = $_SERVER['DOCUMENT_ROOT'];
446 446
 
447 447
 		//if DIRECTORY_SEPARATOR is not /(IIS)
448
-		if(DIRECTORY_SEPARATOR !== '/')
448
+		if (DIRECTORY_SEPARATOR !== '/')
449 449
 		{
450 450
 			//change to slash for compare
451 451
 			$tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']);
452 452
 		}
453 453
 
454
-		$query = "/JUST/CHECK/REWRITE/" . $checkFilePath;
454
+		$query = "/JUST/CHECK/REWRITE/".$checkFilePath;
455 455
 		$currentPath = str_replace($tmpPath, "", _XE_PATH_);
456
-		if($currentPath != "")
456
+		if ($currentPath != "")
457 457
 		{
458
-			$query = $currentPath . $query;
458
+			$query = $currentPath.$query;
459 459
 		}
460 460
 		$requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query);
461 461
 		$requestConfig = array();
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			'./files/cache/template_compiled',
481 481
 		);
482 482
 
483
-		foreach($directory_list as $dir)
483
+		foreach ($directory_list as $dir)
484 484
 		{
485 485
 			FileHandler::makeDir($dir);
486 486
 		}
@@ -496,57 +496,57 @@  discard block
 block discarded – undo
496 496
 		$oModuleModel = getModel('module');
497 497
 		// Create a table ny finding schemas/*.xml file in each module
498 498
 		$module_list = FileHandler::readDir('./modules/', NULL, false, true);
499
-		foreach($module_list as $module_path)
499
+		foreach ($module_list as $module_path)
500 500
 		{
501 501
 			// Get module name
502
-			$tmp_arr = explode('/',$module_path);
503
-			$module = $tmp_arr[count($tmp_arr)-1];
502
+			$tmp_arr = explode('/', $module_path);
503
+			$module = $tmp_arr[count($tmp_arr) - 1];
504 504
 
505 505
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
506
-			if(!$xml_info) continue;
506
+			if (!$xml_info) continue;
507 507
 			$modules[$xml_info->category][] = $module;
508 508
 		}
509 509
 		// Install "module" module in advance
510
-		$this->installModule('module','./modules/module');
510
+		$this->installModule('module', './modules/module');
511 511
 		$oModule = getClass('module');
512
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
512
+		if ($oModule->checkUpdate()) $oModule->moduleUpdate();
513 513
 		// Determine the order of module installation depending on category
514
-		$install_step = array('system','content','member');
514
+		$install_step = array('system', 'content', 'member');
515 515
 		// Install all the remaining modules
516
-		foreach($install_step as $category)
516
+		foreach ($install_step as $category)
517 517
 		{
518
-			if(count($modules[$category]))
518
+			if (count($modules[$category]))
519 519
 			{
520
-				foreach($modules[$category] as $module)
520
+				foreach ($modules[$category] as $module)
521 521
 				{
522
-					if($module == 'module') continue;
522
+					if ($module == 'module') continue;
523 523
 					$this->installModule($module, sprintf('./modules/%s', $module));
524 524
 
525 525
 					$oModule = getClass($module);
526
-					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
526
+					if (is_object($oModule) && method_exists($oModule, 'checkUpdate'))
527 527
 					{
528
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
528
+						if ($oModule->checkUpdate()) $oModule->moduleUpdate();
529 529
 					}
530 530
 				}
531 531
 				unset($modules[$category]);
532 532
 			}
533 533
 		}
534 534
 		// Install all the remaining modules
535
-		if(count($modules))
535
+		if (count($modules))
536 536
 		{
537
-			foreach($modules as $category => $module_list)
537
+			foreach ($modules as $category => $module_list)
538 538
 			{
539
-				if(count($module_list))
539
+				if (count($module_list))
540 540
 				{
541
-					foreach($module_list as $module)
541
+					foreach ($module_list as $module)
542 542
 					{
543
-						if($module == 'module') continue;
543
+						if ($module == 'module') continue;
544 544
 						$this->installModule($module, sprintf('./modules/%s', $module));
545 545
 
546 546
 						$oModule = getClass($module);
547
-						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
547
+						if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
548 548
 						{
549
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
549
+							if ($oModule->checkUpdate()) $oModule->moduleUpdate();
550 550
 						}
551 551
 					}
552 552
 				}
@@ -568,31 +568,31 @@  discard block
 block discarded – undo
568 568
 		$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
569 569
 
570 570
 		$file_cnt = count($schema_files);
571
-		for($i=0;$i<$file_cnt;$i++)
571
+		for ($i = 0; $i < $file_cnt; $i++)
572 572
 		{
573 573
 			$file = trim($schema_files[$i]);
574
-			if(!$file || substr($file,-4)!='.xml') continue;
574
+			if (!$file || substr($file, -4) != '.xml') continue;
575 575
 			$output = $oDB->createTableByXmlFile($file);
576
-			if($output === false)
576
+			if ($output === false)
577 577
 				throw new Exception('msg_create_table_failed');
578 578
 		}
579 579
 		// Create a table and module instance and then execute install() method
580 580
 		unset($oModule);
581 581
 		$oModule = getClass($module);
582
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
582
+		if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
583 583
 		return new Object();
584 584
 	}
585 585
 
586 586
 	function _getDBConfigFileContents($db_info)
587 587
 	{
588
-		if(substr($db_info->master_db['db_table_prefix'], -1) != '_')
588
+		if (substr($db_info->master_db['db_table_prefix'], -1) != '_')
589 589
 		{
590 590
 			$db_info->master_db['db_table_prefix'] .= '_';
591 591
 		}
592 592
 
593
-		foreach($db_info->slave_db as &$slave)
593
+		foreach ($db_info->slave_db as &$slave)
594 594
 		{
595
-			if(substr($slave['db_table_prefix'], -1) != '_')
595
+			if (substr($slave['db_table_prefix'], -1) != '_')
596 596
 			{
597 597
 				$slave['db_table_prefix'] .= '_';
598 598
 			}
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 
601 601
 		$buff = array();
602 602
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
603
-		$buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';';
603
+		$buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';';
604 604
 
605 605
 		return implode(PHP_EOL, $buff);
606 606
 	}
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
 		$db_tmp_config_file = $this->db_tmp_config_file;
615 615
 
616 616
 		$db_info = Context::getDBInfo();
617
-		if(!$db_info) return;
617
+		if (!$db_info) return;
618 618
 
619 619
 		$buff = $this->_getDBConfigFileContents($db_info);
620 620
 
621 621
 		FileHandler::writeFile($db_tmp_config_file, $buff);
622 622
 
623
-		if(@file_exists($db_tmp_config_file)) return true;
623
+		if (@file_exists($db_tmp_config_file)) return true;
624 624
 		return false;
625 625
 	}
626 626
 
@@ -633,14 +633,14 @@  discard block
 block discarded – undo
633 633
 		$etc_tmp_config_file = $this->etc_tmp_config_file;
634 634
 
635 635
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n";
636
-		foreach($config_info as $key => $val)
636
+		foreach ($config_info as $key => $val)
637 637
 		{
638
-			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
638
+			$buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
639 639
 		}
640 640
 
641 641
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
642 642
 
643
-		if(@file_exists($etc_tmp_config_file)) return true;
643
+		if (@file_exists($etc_tmp_config_file)) return true;
644 644
 		return false;
645 645
 	}
646 646
 
@@ -655,13 +655,13 @@  discard block
 block discarded – undo
655 655
 			//if(file_exists($config_file)) return;
656 656
 
657 657
 			$db_info = Context::getDBInfo();
658
-			if(!$db_info) return;
658
+			if (!$db_info) return;
659 659
 
660 660
 			$buff = $this->_getDBConfigFileContents($db_info);
661 661
 
662 662
 			FileHandler::writeFile($config_file, $buff);
663 663
 
664
-			if(@file_exists($config_file))
664
+			if (@file_exists($config_file))
665 665
 			{
666 666
 				FileHandler::removeFile($this->db_tmp_config_file);
667 667
 				FileHandler::removeFile($this->etc_tmp_config_file);
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 	function installByConfig($install_config_file)
677 677
 	{
678 678
 		include $install_config_file;
679
-		if(!is_array($auto_config)) return false;
679
+		if (!is_array($auto_config)) return false;
680 680
 
681 681
 		$auto_config['module'] = 'install';
682 682
 		$auto_config['act'] = 'procInstall';
@@ -684,22 +684,22 @@  discard block
 block discarded – undo
684 684
 		$fstr = "<%s><![CDATA[%s]]></%s>\r\n";
685 685
 		$fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n";
686 686
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
687
-		foreach($auto_config as $k => $v)
687
+		foreach ($auto_config as $k => $v)
688 688
 		{
689
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
689
+			if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k);
690 690
 		}
691 691
 		$body .= "</params>\r\n</methodCall>";
692 692
 
693
-		$header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body);
693
+		$header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body);
694 694
 		$fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5);
695 695
 
696
-		if($fp)
696
+		if ($fp)
697 697
 		{
698 698
 			fputs($fp, $header);
699
-			while(!feof($fp))
699
+			while (!feof($fp))
700 700
 			{
701 701
 				$line = trim(fgets($fp, 4096));
702
-				if(strncmp('<error>', $line, 7) === 0)
702
+				if (strncmp('<error>', $line, 7) === 0)
703 703
 				{
704 704
 					fclose($fp);
705 705
 					return false;
Please login to merge, or discard this patch.
Braces   +149 added lines, -58 removed lines patch added patch discarded remove patch
@@ -101,11 +101,17 @@  discard block
 block discarded – undo
101 101
 		// Check if available to connect to the DB
102 102
 		$oDB = &DB::getInstance();
103 103
 		$output = $oDB->getError();
104
-		if(!$output->toBool()) return $output;
105
-		if(!$oDB->isConnected()) return $oDB->getError();
104
+		if(!$output->toBool()) {
105
+			return $output;
106
+		}
107
+		if(!$oDB->isConnected()) {
108
+			return $oDB->getError();
109
+		}
106 110
 
107 111
 		// Create a db temp config file
108
-		if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed');
112
+		if(!$this->makeDBConfigFile()) {
113
+			return new Object(-1, 'msg_install_failed');
114
+		}
109 115
 
110 116
 		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
111 117
 		{
@@ -122,10 +128,14 @@  discard block
 block discarded – undo
122 128
 	{
123 129
 		// Get variables
124 130
 		$config_info = Context::gets('use_rewrite','time_zone');
125
-		if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N';
131
+		if($config_info->use_rewrite!='Y') {
132
+			$config_info->use_rewrite = 'N';
133
+		}
126 134
 
127 135
 		// Create a db temp config file
128
-		if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed');
136
+		if(!$this->makeEtcConfigFile($config_info)) {
137
+			return new Object(-1, 'msg_install_failed');
138
+		}
129 139
 
130 140
 		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
131 141
 		{
@@ -141,7 +151,9 @@  discard block
 block discarded – undo
141 151
 	function procInstall()
142 152
 	{
143 153
 		// Check if it is already installed
144
-		if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
154
+		if(Context::isInstalled()) {
155
+			return new Object(-1, 'msg_already_installed');
156
+		}
145 157
 
146 158
 		// Assign a temporary administrator when installing
147 159
 		$logged_info = new stdClass();
@@ -156,8 +168,12 @@  discard block
 block discarded – undo
156 168
 		// install by default XE UI
157 169
 		else
158 170
 		{
159
-			if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file;
160
-			if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file;
171
+			if(FileHandler::exists($this->db_tmp_config_file)) {
172
+				include $this->db_tmp_config_file;
173
+			}
174
+			if(FileHandler::exists($this->etc_tmp_config_file)) {
175
+				include $this->etc_tmp_config_file;
176
+			}
161 177
 		}
162 178
 
163 179
 		// Set DB type and information
@@ -165,7 +181,9 @@  discard block
 block discarded – undo
165 181
 		// Create DB Instance
166 182
 		$oDB = &DB::getInstance();
167 183
 		// Check if available to connect to the DB
168
-		if(!$oDB->isConnected()) return $oDB->getError();
184
+		if(!$oDB->isConnected()) {
185
+			return $oDB->getError();
186
+		}
169 187
 
170 188
 		// Install all the modules
171 189
 		try {
@@ -178,7 +196,9 @@  discard block
 block discarded – undo
178 196
 		}
179 197
 
180 198
 		// Create a config file
181
-		if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed');
199
+		if(!$this->makeConfigFile()) {
200
+			return new Object(-1, 'msg_install_failed');
201
+		}
182 202
 
183 203
 		// load script
184 204
 		$scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/');
@@ -235,14 +255,17 @@  discard block
 block discarded – undo
235 255
 		{
236 256
 			$https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT'];
237 257
 			$https_port = (!$https_port != 443) ? $https_port : null;
238
-		}
239
-		else
258
+		} else
240 259
 		{
241 260
 			$http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT'];
242 261
 			$http_port = (!$http_port != 80) ? $http_port : null;
243 262
 		}
244
-		if($http_port) $db_info->http_port = $http_port;
245
-		if($https_port) $db_info->https_port = $https_port;
263
+		if($http_port) {
264
+			$db_info->http_port = $http_port;
265
+		}
266
+		if($https_port) {
267
+			$db_info->https_port = $https_port;
268
+		}
246 269
 
247 270
 		return $db_info;
248 271
 	}
@@ -252,12 +275,20 @@  discard block
 block discarded – undo
252 275
 	 */
253 276
 	function procInstallFTP()
254 277
 	{
255
-		if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
278
+		if(Context::isInstalled()) {
279
+			return new Object(-1, 'msg_already_installed');
280
+		}
256 281
 		$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
257 282
 		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
258
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
259
-		if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
260
-		if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
283
+		if(!$ftp_info->ftp_port) {
284
+			$ftp_info->ftp_port = 21;
285
+		}
286
+		if(!$ftp_info->ftp_host) {
287
+			$ftp_info->ftp_host = '127.0.0.1';
288
+		}
289
+		if(!$ftp_info->ftp_root_path) {
290
+			$ftp_info->ftp_root_path = '/';
291
+		}
261 292
 
262 293
 		$buff = array('<?php if(!defined("__XE__")) exit();');
263 294
 		$buff[] = "\$ftp_info = new stdClass();";
@@ -269,11 +300,15 @@  discard block
 block discarded – undo
269 300
 		// If safe_mode
270 301
 		if(ini_get('safe_mode'))
271 302
 		{
272
-			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
303
+			if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
304
+				return new Object(-1,'msg_safe_mode_ftp_needed');
305
+			}
273 306
 
274 307
 			require_once(_XE_PATH_.'libs/ftp.class.php');
275 308
 			$oFtp = new ftp();
276
-			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
309
+			if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) {
310
+				return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
311
+			}
277 312
 
278 313
 			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
279 314
 			{
@@ -315,10 +350,16 @@  discard block
 block discarded – undo
315 350
 	{
316 351
 		$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp');
317 352
 		$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
318
-		if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
319
-		if(!$ftp_info->sftp) $ftp_info->sftp = 'N';
353
+		if(!$ftp_info->ftp_port) {
354
+			$ftp_info->ftp_port = 21;
355
+		}
356
+		if(!$ftp_info->sftp) {
357
+			$ftp_info->sftp = 'N';
358
+		}
320 359
 
321
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
360
+		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) {
361
+			return new Object(-1,'msg_safe_mode_ftp_needed');
362
+		}
322 363
 
323 364
 		if($ftp_info->sftp == 'Y')
324 365
 		{
@@ -327,12 +368,13 @@  discard block
 block discarded – undo
327 368
 			{
328 369
 				return new Object(-1,'msg_ftp_invalid_auth_info');
329 370
 			}
330
-		}
331
-		else
371
+		} else
332 372
 		{
333 373
 			require_once(_XE_PATH_.'libs/ftp.class.php');
334 374
 			$oFtp = new ftp();
335
-			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
375
+			if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) {
376
+				return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost'));
377
+			}
336 378
 
337 379
 			if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
338 380
 			{
@@ -365,26 +407,47 @@  discard block
 block discarded – undo
365 407
 		}
366 408
 
367 409
 		// 1. Check permission
368
-		if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
369
-		else $checklist['permission'] = false;
410
+		if(is_writable('./')||is_writable('./files')) {
411
+			$checklist['permission'] = true;
412
+		} else {
413
+			$checklist['permission'] = false;
414
+		}
370 415
 		// 2. Check if xml_parser_create exists
371
-		if(function_exists('xml_parser_create')) $checklist['xml'] = true;
372
-		else $checklist['xml'] = false;
416
+		if(function_exists('xml_parser_create')) {
417
+			$checklist['xml'] = true;
418
+		} else {
419
+			$checklist['xml'] = false;
420
+		}
373 421
 		// 3. Check if ini_get (session.auto_start) == 1
374
-		if(ini_get('session.auto_start')!=1) $checklist['session'] = true;
375
-		else $checklist['session'] = false;
422
+		if(ini_get('session.auto_start')!=1) {
423
+			$checklist['session'] = true;
424
+		} else {
425
+			$checklist['session'] = false;
426
+		}
376 427
 		// 4. Check if iconv exists
377
-		if(function_exists('iconv')) $checklist['iconv'] = true;
378
-		else $checklist['iconv'] = false;
428
+		if(function_exists('iconv')) {
429
+			$checklist['iconv'] = true;
430
+		} else {
431
+			$checklist['iconv'] = false;
432
+		}
379 433
 		// 5. Check gd(imagecreatefromgif function)
380
-		if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
381
-		else $checklist['gd'] = false;
434
+		if(function_exists('imagecreatefromgif')) {
435
+			$checklist['gd'] = true;
436
+		} else {
437
+			$checklist['gd'] = false;
438
+		}
382 439
 		// 6. Check DB
383
-		if(DB::getEnableList()) $checklist['db'] = true;
384
-		else $checklist['db'] = false;
440
+		if(DB::getEnableList()) {
441
+			$checklist['db'] = true;
442
+		} else {
443
+			$checklist['db'] = false;
444
+		}
385 445
 
386
-		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false;
387
-		else $install_enable = true;
446
+		if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) {
447
+			$install_enable = false;
448
+		} else {
449
+			$install_enable = true;
450
+		}
388 451
 
389 452
 		// Save the checked result to the Context
390 453
 		Context::set('checklist', $checklist);
@@ -407,8 +470,7 @@  discard block
 block discarded – undo
407 470
 		{
408 471
 			$currentTime = $_SERVER['REQUEST_TIME'];
409 472
 			FileHandler::writeFile($this->flagLicenseAgreement, $currentTime);
410
-		}
411
-		else
473
+		} else
412 474
 		{
413 475
 			FileHandler::removeFile($this->flagLicenseAgreement);
414 476
 			return new Object(-1, 'msg_must_accept_license_agreement');
@@ -503,13 +565,17 @@  discard block
 block discarded – undo
503 565
 			$module = $tmp_arr[count($tmp_arr)-1];
504 566
 
505 567
 			$xml_info = $oModuleModel->getModuleInfoXml($module);
506
-			if(!$xml_info) continue;
568
+			if(!$xml_info) {
569
+				continue;
570
+			}
507 571
 			$modules[$xml_info->category][] = $module;
508 572
 		}
509 573
 		// Install "module" module in advance
510 574
 		$this->installModule('module','./modules/module');
511 575
 		$oModule = getClass('module');
512
-		if($oModule->checkUpdate()) $oModule->moduleUpdate();
576
+		if($oModule->checkUpdate()) {
577
+			$oModule->moduleUpdate();
578
+		}
513 579
 		// Determine the order of module installation depending on category
514 580
 		$install_step = array('system','content','member');
515 581
 		// Install all the remaining modules
@@ -519,13 +585,17 @@  discard block
 block discarded – undo
519 585
 			{
520 586
 				foreach($modules[$category] as $module)
521 587
 				{
522
-					if($module == 'module') continue;
588
+					if($module == 'module') {
589
+						continue;
590
+					}
523 591
 					$this->installModule($module, sprintf('./modules/%s', $module));
524 592
 
525 593
 					$oModule = getClass($module);
526 594
 					if(is_object($oModule) && method_exists($oModule, 'checkUpdate'))
527 595
 					{
528
-						if($oModule->checkUpdate()) $oModule->moduleUpdate();
596
+						if($oModule->checkUpdate()) {
597
+							$oModule->moduleUpdate();
598
+						}
529 599
 					}
530 600
 				}
531 601
 				unset($modules[$category]);
@@ -540,13 +610,17 @@  discard block
 block discarded – undo
540 610
 				{
541 611
 					foreach($module_list as $module)
542 612
 					{
543
-						if($module == 'module') continue;
613
+						if($module == 'module') {
614
+							continue;
615
+						}
544 616
 						$this->installModule($module, sprintf('./modules/%s', $module));
545 617
 
546 618
 						$oModule = getClass($module);
547 619
 						if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate'))
548 620
 						{
549
-							if($oModule->checkUpdate()) $oModule->moduleUpdate();
621
+							if($oModule->checkUpdate()) {
622
+								$oModule->moduleUpdate();
623
+							}
550 624
 						}
551 625
 					}
552 626
 				}
@@ -571,15 +645,20 @@  discard block
 block discarded – undo
571 645
 		for($i=0;$i<$file_cnt;$i++)
572 646
 		{
573 647
 			$file = trim($schema_files[$i]);
574
-			if(!$file || substr($file,-4)!='.xml') continue;
648
+			if(!$file || substr($file,-4)!='.xml') {
649
+				continue;
650
+			}
575 651
 			$output = $oDB->createTableByXmlFile($file);
576
-			if($output === false)
577
-				throw new Exception('msg_create_table_failed');
652
+			if($output === false) {
653
+							throw new Exception('msg_create_table_failed');
654
+			}
578 655
 		}
579 656
 		// Create a table and module instance and then execute install() method
580 657
 		unset($oModule);
581 658
 		$oModule = getClass($module);
582
-		if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
659
+		if(method_exists($oModule, 'moduleInstall')) {
660
+			$oModule->moduleInstall();
661
+		}
583 662
 		return new Object();
584 663
 	}
585 664
 
@@ -614,13 +693,17 @@  discard block
 block discarded – undo
614 693
 		$db_tmp_config_file = $this->db_tmp_config_file;
615 694
 
616 695
 		$db_info = Context::getDBInfo();
617
-		if(!$db_info) return;
696
+		if(!$db_info) {
697
+			return;
698
+		}
618 699
 
619 700
 		$buff = $this->_getDBConfigFileContents($db_info);
620 701
 
621 702
 		FileHandler::writeFile($db_tmp_config_file, $buff);
622 703
 
623
-		if(@file_exists($db_tmp_config_file)) return true;
704
+		if(@file_exists($db_tmp_config_file)) {
705
+			return true;
706
+		}
624 707
 		return false;
625 708
 	}
626 709
 
@@ -640,7 +723,9 @@  discard block
 block discarded – undo
640 723
 
641 724
 		FileHandler::writeFile($etc_tmp_config_file, $buff);
642 725
 
643
-		if(@file_exists($etc_tmp_config_file)) return true;
726
+		if(@file_exists($etc_tmp_config_file)) {
727
+			return true;
728
+		}
644 729
 		return false;
645 730
 	}
646 731
 
@@ -655,7 +740,9 @@  discard block
 block discarded – undo
655 740
 			//if(file_exists($config_file)) return;
656 741
 
657 742
 			$db_info = Context::getDBInfo();
658
-			if(!$db_info) return;
743
+			if(!$db_info) {
744
+				return;
745
+			}
659 746
 
660 747
 			$buff = $this->_getDBConfigFileContents($db_info);
661 748
 
@@ -676,7 +763,9 @@  discard block
 block discarded – undo
676 763
 	function installByConfig($install_config_file)
677 764
 	{
678 765
 		include $install_config_file;
679
-		if(!is_array($auto_config)) return false;
766
+		if(!is_array($auto_config)) {
767
+			return false;
768
+		}
680 769
 
681 770
 		$auto_config['module'] = 'install';
682 771
 		$auto_config['act'] = 'procInstall';
@@ -686,7 +775,9 @@  discard block
 block discarded – undo
686 775
 		$body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n";
687 776
 		foreach($auto_config as $k => $v)
688 777
 		{
689
-			if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k);
778
+			if(!in_array($k,array('host','port','path'))) {
779
+				$body .= sprintf($fstr,$k,$v,$k);
780
+			}
690 781
 		}
691 782
 		$body .= "</params>\r\n</methodCall>";
692 783
 
Please login to merge, or discard this patch.
classes/context/Context.class.php 2 patches
Spacing   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 			
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if ($sess = $_POST[session_name()]) session_id($sess);
345 345
 		session_start();
346 346
 
347 347
 		// set authentication information in Context and session
348
-		if(self::isInstalled())
348
+		if (self::isInstalled())
349 349
 		{
350 350
 			$oModuleModel = getModel('module');
351 351
 			$oModuleModel->loadModuleExtends();
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 			$oMemberModel = getModel('member');
354 354
 			$oMemberController = getController('member');
355 355
 
356
-			if($oMemberController && $oMemberModel)
356
+			if ($oMemberController && $oMemberModel)
357 357
 			{
358 358
 				// if signed in, validate it.
359
-				if($oMemberModel->isLogged())
359
+				if ($oMemberModel->isLogged())
360 360
 				{
361 361
 					$oMemberController->setSessionInfo();
362 362
 				}
363 363
 				// check auto sign-in
364
-				elseif($_COOKIE['xeak'])
364
+				elseif ($_COOKIE['xeak'])
365 365
 				{
366 366
 					$oMemberController->doAutologin();
367 367
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		// load common language file
375 375
 		$this->lang = &$GLOBALS['lang'];
376
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
376
+		$this->loadLang(_XE_PATH_.'common/lang/');
377 377
 
378 378
 		// check if using rewrite module
379 379
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -381,28 +381,28 @@  discard block
 block discarded – undo
381 381
 		// set locations for javascript use
382 382
 		$url = array();
383 383
 		$current_url = self::getRequestUri();
384
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
384
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
385 385
 		{
386
-			if($this->get_vars)
386
+			if ($this->get_vars)
387 387
 			{
388 388
 				$url = array();
389
-				foreach($this->get_vars as $key => $val)
389
+				foreach ($this->get_vars as $key => $val)
390 390
 				{
391
-					if(is_array($val) && count($val) > 0)
391
+					if (is_array($val) && count($val) > 0)
392 392
 					{
393
-						foreach($val as $k => $v)
393
+						foreach ($val as $k => $v)
394 394
 						{
395
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
395
+							$url[] = $key.'['.$k.']='.urlencode($v);
396 396
 						}
397 397
 					}
398
-					elseif($val)
398
+					elseif ($val)
399 399
 					{
400
-						$url[] = $key . '=' . urlencode($val);
400
+						$url[] = $key.'='.urlencode($val);
401 401
 					}
402 402
 				}
403 403
 
404 404
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
405
+				if ($url) $current_url .= '?'.join('&', $url);
406 406
 			}
407 407
 			else
408 408
 			{
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 		$this->set('current_url', $current_url);
418 418
 		$this->set('request_uri', self::getRequestUri());
419 419
 
420
-		if(strpos($current_url, 'xn--') !== FALSE)
420
+		if (strpos($current_url, 'xn--') !== FALSE)
421 421
 		{
422 422
 			$this->set('current_url', self::decodeIdna($current_url));
423 423
 		}
424 424
 
425
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
425
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
426 426
 		{
427 427
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
428 428
 		}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	{
448 448
 		$self = self::getInstance();
449 449
 
450
-		if(!$self->isInstalled())
450
+		if (!$self->isInstalled())
451 451
 		{
452 452
 			return;
453 453
 		}
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 		include($self::getConfigFile());
456 456
 
457 457
 		// If master_db information does not exist, the config file needs to be updated
458
-		if(!isset($db_info->master_db))
458
+		if (!isset($db_info->master_db))
459 459
 		{
460 460
 			$db_info->master_db = array();
461 461
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
474 474
 			unset($db_info->db_table_prefix);
475 475
 
476
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
476
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
477 477
 			{
478 478
 				$db_info->master_db["db_table_prefix"] .= '_';
479 479
 			}
@@ -485,33 +485,33 @@  discard block
 block discarded – undo
485 485
 			$oInstallController->makeConfigFile();
486 486
 		}
487 487
 
488
-		if(!$db_info->use_prepared_statements)
488
+		if (!$db_info->use_prepared_statements)
489 489
 		{
490 490
 			$db_info->use_prepared_statements = 'Y';
491 491
 		}
492 492
 
493
-		if(!$db_info->time_zone)
493
+		if (!$db_info->time_zone)
494 494
 			$db_info->time_zone = date('O');
495 495
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
496 496
 
497
-		if($db_info->qmail_compatibility != 'Y')
497
+		if ($db_info->qmail_compatibility != 'Y')
498 498
 			$db_info->qmail_compatibility = 'N';
499 499
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
500 500
 
501
-		if(!$db_info->use_db_session)
501
+		if (!$db_info->use_db_session)
502 502
 			$db_info->use_db_session = 'N';
503
-		if(!$db_info->use_ssl)
503
+		if (!$db_info->use_ssl)
504 504
 			$db_info->use_ssl = 'none';
505 505
 		$this->set('_use_ssl', $db_info->use_ssl);
506 506
 
507 507
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
508 508
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
509 509
 
510
-		if(!$db_info->sitelock_whitelist) {
510
+		if (!$db_info->sitelock_whitelist) {
511 511
 			$db_info->sitelock_whitelist = '127.0.0.1';
512 512
 		}
513 513
 
514
-		if(is_string($db_info->sitelock_whitelist)) {
514
+		if (is_string($db_info->sitelock_whitelist)) {
515 515
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
516 516
 		}
517 517
 
@@ -582,10 +582,10 @@  discard block
 block discarded – undo
582 582
 	function loadLangSupported()
583 583
 	{
584 584
 		static $lang_supported = null;
585
-		if(!$lang_supported)
585
+		if (!$lang_supported)
586 586
 		{
587
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
588
-			foreach($langs as $val)
587
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
588
+			foreach ($langs as $val)
589 589
 			{
590 590
 				list($lang_prefix, $lang_text) = explode(',', $val);
591 591
 				$lang_text = trim($lang_text);
@@ -603,17 +603,17 @@  discard block
 block discarded – undo
603 603
 	function loadLangSelected()
604 604
 	{
605 605
 		static $lang_selected = null;
606
-		if(!$lang_selected)
606
+		if (!$lang_selected)
607 607
 		{
608
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
609
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
610
-			if(!FileHandler::hasContent($selected_lang_file))
608
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
609
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
610
+			if (!FileHandler::hasContent($selected_lang_file))
611 611
 			{
612
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
612
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
613 613
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
614 614
 			}
615 615
 
616
-			if(!FileHandler::hasContent($selected_lang_file))
616
+			if (!FileHandler::hasContent($selected_lang_file))
617 617
 			{
618 618
 				$buff = FileHandler::readFile($orig_lang_file);
619 619
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 			else
623 623
 			{
624 624
 				$langs = file($selected_lang_file);
625
-				foreach($langs as $val)
625
+				foreach ($langs as $val)
626 626
 				{
627 627
 					list($lang_prefix, $lang_text) = explode(',', $val);
628 628
 					$lang_text = trim($lang_text);
@@ -641,56 +641,56 @@  discard block
 block discarded – undo
641 641
 	function checkSSO()
642 642
 	{
643 643
 		// pass if it's not GET request or XE is not yet installed
644
-		if($this->db_info->use_sso != 'Y' || isCrawler())
644
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
645 645
 		{
646 646
 			return TRUE;
647 647
 		}
648 648
 		$checkActList = array('rss' => 1, 'atom' => 1);
649
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
649
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
650 650
 		{
651 651
 			return TRUE;
652 652
 		}
653 653
 
654 654
 		// pass if default URL is not set
655 655
 		$default_url = trim($this->db_info->default_url);
656
-		if(!$default_url)
656
+		if (!$default_url)
657 657
 		{
658 658
 			return TRUE;
659 659
 		}
660 660
 
661
-		if(substr_compare($default_url, '/', -1) !== 0)
661
+		if (substr_compare($default_url, '/', -1) !== 0)
662 662
 		{
663 663
 			$default_url .= '/';
664 664
 		}
665 665
 
666 666
 		// for sites recieving SSO valdiation
667
-		if($default_url == self::getRequestUri())
667
+		if ($default_url == self::getRequestUri())
668 668
 		{
669
-			if(self::get('url'))
669
+			if (self::get('url'))
670 670
 			{
671 671
 				$url = base64_decode(self::get('url'));
672 672
 				$url_info = parse_url($url);
673
-				if(!Password::checkSignature($url, self::get('sig')))
673
+				if (!Password::checkSignature($url, self::get('sig')))
674 674
 				{
675 675
 					echo self::get('lang')->msg_invalid_request;
676 676
 					return false;
677 677
 				}
678 678
 
679 679
 				$oModuleModel = getModel('module');
680
-				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
680
+				$domain = $url_info['host'].$url_info['path'];
681
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
682 682
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 683
 
684
-				if($site_info->site_srl)
684
+				if ($site_info->site_srl)
685 685
 				{
686
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687
-				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
686
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
687
+				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']);
688 688
 				}
689 689
 				else
690 690
 				{
691 691
 					$redirect_url = $url;
692 692
 				}
693
-				header('location:' . $redirect_url);
693
+				header('location:'.$redirect_url);
694 694
 
695 695
 				return FALSE;
696 696
 			}
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 		else
700 700
 		{
701 701
 			// result handling : set session_name()
702
-			if($session_name = self::get('SSOID'))
702
+			if ($session_name = self::get('SSOID'))
703 703
 			{
704
-				if(!Password::checkSignature($session_name, self::get('sig')))
704
+				if (!Password::checkSignature($session_name, self::get('sig')))
705 705
 				{
706 706
 					echo self::get('lang')->msg_invalid_request;
707 707
 					return false;
@@ -710,17 +710,17 @@  discard block
 block discarded – undo
710 710
 				setcookie(session_name(), $session_name);
711 711
 
712 712
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
713
-				header('location:' . $url);
713
+				header('location:'.$url);
714 714
 				return FALSE;
715 715
 				// send SSO request
716 716
 			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
717
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 718
 			{
719 719
 				setcookie('sso', md5(self::getRequestUri()));
720 720
 				$origin_url = self::getRequestUrl();
721 721
 				$origin_sig = Password::createSignature($origin_url);
722 722
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
723
-				header('location:' . $url);
723
+				header('location:'.$url);
724 724
 				return FALSE;
725 725
 			}
726 726
 		}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	{
748 748
 		$self = self::getInstance();
749 749
 
750
-		if(!$self->isFTPRegisted())
750
+		if (!$self->isFTPRegisted())
751 751
 		{
752 752
 			return null;
753 753
 		}
@@ -765,15 +765,15 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	function addBrowserTitle($site_title)
767 767
 	{
768
-		if(!$site_title)
768
+		if (!$site_title)
769 769
 		{
770 770
 			return;
771 771
 		}
772 772
 		$self = self::getInstance();
773 773
 
774
-		if($self->site_title)
774
+		if ($self->site_title)
775 775
 		{
776
-			$self->site_title .= ' - ' . $site_title;
776
+			$self->site_title .= ' - '.$site_title;
777 777
 		}
778 778
 		else
779 779
 		{
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 	 */
790 790
 	function setBrowserTitle($site_title)
791 791
 	{
792
-		if(!$site_title)
792
+		if (!$site_title)
793 793
 		{
794 794
 			return;
795 795
 		}
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 		$oModuleModel = getModel('module');
822 822
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
823 823
 
824
-		if(isset($moduleConfig->siteTitle))
824
+		if (isset($moduleConfig->siteTitle))
825 825
 		{
826 826
 			return $moduleConfig->siteTitle;
827 827
 		}
@@ -848,30 +848,30 @@  discard block
 block discarded – undo
848 848
 		global $lang;
849 849
 
850 850
 		$self = self::getInstance();
851
-		if(!$self->lang_type)
851
+		if (!$self->lang_type)
852 852
 		{
853 853
 			return;
854 854
 		}
855
-		if(!is_object($lang))
855
+		if (!is_object($lang))
856 856
 		{
857 857
 			$lang = new stdClass;
858 858
 		}
859 859
 
860
-		if(!($filename = $self->_loadXmlLang($path)))
860
+		if (!($filename = $self->_loadXmlLang($path)))
861 861
 		{
862 862
 			$filename = $self->_loadPhpLang($path);
863 863
 		}
864 864
 
865
-		if(!is_array($self->loaded_lang_files))
865
+		if (!is_array($self->loaded_lang_files))
866 866
 		{
867 867
 			$self->loaded_lang_files = array();
868 868
 		}
869
-		if(in_array($filename, $self->loaded_lang_files))
869
+		if (in_array($filename, $self->loaded_lang_files))
870 870
 		{
871 871
 			return;
872 872
 		}
873 873
 
874
-		if($filename && is_readable($filename))
874
+		if ($filename && is_readable($filename))
875 875
 		{
876 876
 			$self->loaded_lang_files[] = $filename;
877 877
 			include($filename);
@@ -892,24 +892,24 @@  discard block
 block discarded – undo
892 892
 	{
893 893
 		global $lang;
894 894
 
895
-		if(!$path) return;
895
+		if (!$path) return;
896 896
 
897
-		$_path = 'eval://' . $path;
897
+		$_path = 'eval://'.$path;
898 898
 
899
-		if(in_array($_path, $this->loaded_lang_files))
899
+		if (in_array($_path, $this->loaded_lang_files))
900 900
 		{
901 901
 			return;
902 902
 		}
903 903
 
904
-		if(substr_compare($path, '/', -1) !== 0)
904
+		if (substr_compare($path, '/', -1) !== 0)
905 905
 		{
906 906
 			$path .= '/';
907 907
 		}
908 908
 
909
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
909
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
910 910
 		$content = $oXmlLangParser->getCompileContent();
911 911
 
912
-		if($content)
912
+		if ($content)
913 913
 		{
914 914
 			$this->loaded_lang_files[] = $_path;
915 915
 			eval($content);
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	function _loadXmlLang($path)
926 926
 	{
927
-		if(!$path) return;
927
+		if (!$path) return;
928 928
 
929
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
929
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
930 930
 		return $oXmlLangParser->compile();
931 931
 	}
932 932
 
@@ -938,22 +938,22 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	function _loadPhpLang($path)
940 940
 	{
941
-		if(!$path) return;
941
+		if (!$path) return;
942 942
 
943
-		if(substr_compare($path, '/', -1) !== 0)
943
+		if (substr_compare($path, '/', -1) !== 0)
944 944
 		{
945 945
 			$path .= '/';
946 946
 		}
947
-		$path_tpl = $path . '%s.lang.php';
947
+		$path_tpl = $path.'%s.lang.php';
948 948
 		$file = sprintf($path_tpl, $this->lang_type);
949 949
 
950 950
 		$langs = array('ko', 'en'); // this will be configurable.
951
-		while(!is_readable($file) && $langs[0])
951
+		while (!is_readable($file) && $langs[0])
952 952
 		{
953 953
 			$file = sprintf($path_tpl, array_shift($langs));
954 954
 		}
955 955
 
956
-		if(!is_readable($file))
956
+		if (!is_readable($file))
957 957
 		{
958 958
 			return FALSE;
959 959
 		}
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
 	 */
996 996
 	function getLang($code)
997 997
 	{
998
-		if(!$code)
998
+		if (!$code)
999 999
 		{
1000 1000
 			return;
1001 1001
 		}
1002
-		if($GLOBALS['lang']->{$code})
1002
+		if ($GLOBALS['lang']->{$code})
1003 1003
 		{
1004 1004
 			return $GLOBALS['lang']->{$code};
1005 1005
 		}
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 */
1016 1016
 	function setLang($code, $val)
1017 1017
 	{
1018
-		if(!isset($GLOBALS['lang']))
1018
+		if (!isset($GLOBALS['lang']))
1019 1019
 		{
1020 1020
 			$GLOBALS['lang'] = new stdClass();
1021 1021
 		}
@@ -1043,17 +1043,17 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		$obj = clone $source_obj;
1045 1045
 
1046
-		foreach($charset_list as $charset)
1046
+		foreach ($charset_list as $charset)
1047 1047
 		{
1048
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1048
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1049 1049
 			$flag = self::checkConvertFlag($flag = TRUE);
1050
-			if($flag)
1050
+			if ($flag)
1051 1051
 			{
1052
-				if($charset == 'UTF-8')
1052
+				if ($charset == 'UTF-8')
1053 1053
 				{
1054 1054
 					return $obj;
1055 1055
 				}
1056
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1056
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1057 1057
 				return $obj;
1058 1058
 			}
1059 1059
 		}
@@ -1072,11 +1072,11 @@  discard block
 block discarded – undo
1072 1072
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1073 1073
 	{
1074 1074
 		static $flag = TRUE;
1075
-		if($charset)
1075
+		if ($charset)
1076 1076
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1077
+			if (is_array($val))
1078
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1079
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1080 1080
 			else $flag = FALSE;
1081 1081
 		}
1082 1082
 		else
@@ -1100,9 +1100,9 @@  discard block
 block discarded – undo
1100 1100
 	{
1101 1101
 		if (is_array($val))
1102 1102
 		{
1103
-			array_walk($val,'Context::doConvertEncoding',$charset);
1103
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1104 1104
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1105
+		else $val = iconv($charset, 'UTF-8', $val);
1106 1106
 	}
1107 1107
 
1108 1108
 	/**
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 	 */
1114 1114
 	function convertEncodingStr($str)
1115 1115
 	{
1116
-        if(!$str) return null;
1116
+        if (!$str) return null;
1117 1117
 		$obj = new stdClass();
1118 1118
 		$obj->str = $str;
1119 1119
 		$obj = self::convertEncoding($obj);
@@ -1122,9 +1122,9 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
 	function decodeIdna($domain)
1124 1124
 	{
1125
-		if(strpos($domain, 'xn--') !== FALSE)
1125
+		if (strpos($domain, 'xn--') !== FALSE)
1126 1126
 		{
1127
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1127
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1128 1128
 			$IDN = new idna_convert(array('idn_version' => 2008));
1129 1129
 			$domain = $IDN->decode($domain);
1130 1130
 		}
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	{
1156 1156
 		$self = self::getInstance();
1157 1157
 
1158
-		if($self->response_method)
1158
+		if ($self->response_method)
1159 1159
 		{
1160 1160
 			return $self->response_method;
1161 1161
 		}
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1196 1196
 
1197 1197
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1198
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1198
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1199 1199
 		{
1200 1200
 			$this->isSuccessInit = FALSE;
1201 1201
 		}
@@ -1208,30 +1208,30 @@  discard block
 block discarded – undo
1208 1208
 	 */
1209 1209
 	function _setRequestArgument()
1210 1210
 	{
1211
-		if(!count($_REQUEST))
1211
+		if (!count($_REQUEST))
1212 1212
 		{
1213 1213
 			return;
1214 1214
 		}
1215 1215
 
1216 1216
 		$requestMethod = $this->getRequestMethod();
1217
-		foreach($_REQUEST as $key => $val)
1217
+		foreach ($_REQUEST as $key => $val)
1218 1218
 		{
1219
-			if($val === '' || self::get($key))
1219
+			if ($val === '' || self::get($key))
1220 1220
 			{
1221 1221
 				continue;
1222 1222
 			}
1223 1223
 			$key = htmlentities($key);
1224 1224
 			$val = $this->_filterRequestVar($key, $val);
1225 1225
 
1226
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1226
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1227 1227
 			{
1228 1228
 				$set_to_vars = TRUE;
1229 1229
 			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1230
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1231 1231
 			{
1232 1232
 				$set_to_vars = TRUE;
1233 1233
 			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1234
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1235
 			{
1236 1236
 				$set_to_vars = TRUE;
1237 1237
 			}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 				$set_to_vars = FALSE;
1241 1241
 			}
1242 1242
 
1243
-			if($set_to_vars)
1243
+			if ($set_to_vars)
1244 1244
 			{
1245 1245
 				$this->_recursiveCheckVar($val);
1246 1246
 			}
@@ -1251,20 +1251,20 @@  discard block
 block discarded – undo
1251 1251
 
1252 1252
 	function _recursiveCheckVar($val)
1253 1253
 	{
1254
-		if(is_string($val))
1254
+		if (is_string($val))
1255 1255
 		{
1256
-			foreach($this->patterns as $pattern)
1256
+			foreach ($this->patterns as $pattern)
1257 1257
 			{
1258
-				if(preg_match($pattern, $val))
1258
+				if (preg_match($pattern, $val))
1259 1259
 				{
1260 1260
 					$this->isSuccessInit = FALSE;
1261 1261
 					return;
1262 1262
 				}
1263 1263
 			}
1264 1264
 		}
1265
-		else if(is_array($val))
1265
+		else if (is_array($val))
1266 1266
 		{
1267
-			foreach($val as $val2)
1267
+			foreach ($val as $val2)
1268 1268
 			{
1269 1269
 				$this->_recursiveCheckVar($val2);
1270 1270
 			}
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	function _setJSONRequestArgument()
1280 1280
 	{
1281
-		if($this->getRequestMethod() != 'JSON')
1281
+		if ($this->getRequestMethod() != 'JSON')
1282 1282
 		{
1283 1283
 			return;
1284 1284
 		}
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 		$params = array();
1287 1287
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1288 1288
 
1289
-		foreach($params as $key => $val)
1289
+		foreach ($params as $key => $val)
1290 1290
 		{
1291 1291
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1292 1292
 		}
@@ -1299,13 +1299,13 @@  discard block
 block discarded – undo
1299 1299
 	 */
1300 1300
 	function _setXmlRpcArgument()
1301 1301
 	{
1302
-		if($this->getRequestMethod() != 'XMLRPC')
1302
+		if ($this->getRequestMethod() != 'XMLRPC')
1303 1303
 		{
1304 1304
 			return;
1305 1305
 		}
1306 1306
 
1307 1307
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1308
-		if(Security::detectingXEE($xml))
1308
+		if (Security::detectingXEE($xml))
1309 1309
 		{
1310 1310
 			header("HTTP/1.0 400 Bad Request");
1311 1311
 			exit;
@@ -1317,12 +1317,12 @@  discard block
 block discarded – undo
1317 1317
 		$params = $xml_obj->methodcall->params;
1318 1318
 		unset($params->node_name, $params->attrs, $params->body);
1319 1319
 
1320
-		if(!count(get_object_vars($params)))
1320
+		if (!count(get_object_vars($params)))
1321 1321
 		{
1322 1322
 			return;
1323 1323
 		}
1324 1324
 
1325
-		foreach($params as $key => $val)
1325
+		foreach ($params as $key => $val)
1326 1326
 		{
1327 1327
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1328 1328
 		}
@@ -1337,10 +1337,10 @@  discard block
 block discarded – undo
1337 1337
 	 */
1338 1338
 	function _filterXmlVars($key, $val)
1339 1339
 	{
1340
-		if(is_array($val))
1340
+		if (is_array($val))
1341 1341
 		{
1342 1342
 			$stack = array();
1343
-			foreach($val as $k => $v)
1343
+			foreach ($val as $k => $v)
1344 1344
 			{
1345 1345
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1346 1346
 			}
@@ -1350,20 +1350,20 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
 		$body = $val->body;
1352 1352
 		unset($val->node_name, $val->attrs, $val->body);
1353
-		if(!count(get_object_vars($val)))
1353
+		if (!count(get_object_vars($val)))
1354 1354
 		{
1355 1355
 			return $this->_filterRequestVar($key, $body, 0);
1356 1356
 		}
1357 1357
 
1358 1358
 		$stack = new stdClass();
1359
-		foreach($val as $k => $v)
1359
+		foreach ($val as $k => $v)
1360 1360
 		{
1361 1361
 			$output = $this->_filterXmlVars($k, $v);
1362
-			if(is_object($v) && $v->attrs->type == 'array')
1362
+			if (is_object($v) && $v->attrs->type == 'array')
1363 1363
 			{
1364 1364
 				$output = array($output);
1365 1365
 			}
1366
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1366
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1367 1367
 			{
1368 1368
 				return $output;
1369 1369
 			}
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 			$stack->{$k} = $output;
1372 1372
 		}
1373 1373
 
1374
-		if(!count(get_object_vars($stack)))
1374
+		if (!count(get_object_vars($stack)))
1375 1375
 		{
1376 1376
 			return NULL;
1377 1377
 		}
@@ -1390,32 +1390,32 @@  discard block
 block discarded – undo
1390 1390
 	 */
1391 1391
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1392 1392
 	{
1393
-		if(!($isArray = is_array($val)))
1393
+		if (!($isArray = is_array($val)))
1394 1394
 		{
1395 1395
 			$val = array($val);
1396 1396
 		}
1397 1397
 
1398 1398
 		$result = array();
1399
-		foreach($val as $k => $v)
1399
+		foreach ($val as $k => $v)
1400 1400
 		{
1401 1401
 			$k = htmlentities($k);
1402
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1402
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1403
 			{
1404 1404
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405 1405
 			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1406
+			elseif ($key === 'mid' || $key === 'search_keyword')
1407 1407
 			{
1408 1408
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409 1409
 			}
1410
-			elseif($key === 'vid')
1410
+			elseif ($key === 'vid')
1411 1411
 			{
1412 1412
 				$result[$k] = urlencode($v);
1413 1413
 			}
1414
-			elseif($key === 'xe_validator_id')
1414
+			elseif ($key === 'xe_validator_id')
1415 1415
 			{
1416 1416
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417 1417
 			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1418
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1419
 			{
1420 1420
 				unset($result[$k]);
1421 1421
 			}
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 			{
1424 1424
 				$result[$k] = $v;
1425 1425
 
1426
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1426
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1427 1427
 				{
1428 1428
 					if (is_array($result[$k]))
1429 1429
 					{
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 					}
1436 1436
 				}
1437 1437
 
1438
-				if(is_array($result[$k]))
1438
+				if (is_array($result[$k]))
1439 1439
 				{
1440 1440
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441 1441
 				}
@@ -1467,17 +1467,17 @@  discard block
 block discarded – undo
1467 1467
 	 */
1468 1468
 	function _setUploadedArgument()
1469 1469
 	{
1470
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1470
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1471 1471
 		{
1472 1472
 			return;
1473 1473
 		}
1474 1474
 
1475
-		foreach($_FILES as $key => $val)
1475
+		foreach ($_FILES as $key => $val)
1476 1476
 		{
1477 1477
 			$tmp_name = $val['tmp_name'];
1478
-			if(!is_array($tmp_name))
1478
+			if (!is_array($tmp_name))
1479 1479
 			{
1480
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1480
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1481 1481
 				{
1482 1482
 					continue;
1483 1483
 				}
@@ -1490,9 +1490,9 @@  discard block
 block discarded – undo
1490 1490
 				$files = array();
1491 1491
 				$count_files = count($tmp_name);
1492 1492
 
1493
-				for($i = 0; $i < $count_files; $i++)
1493
+				for ($i = 0; $i < $count_files; $i++)
1494 1494
 				{
1495
-					if($val['size'][$i] > 0)
1495
+					if ($val['size'][$i] > 0)
1496 1496
 					{
1497 1497
 						$file = array();
1498 1498
 						$file['name'] = $val['name'][$i];
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 						$files[] = $file;
1504 1504
 					}
1505 1505
 				}
1506
-				if($files) $this->set($key, $files, TRUE);
1506
+				if ($files) $this->set($key, $files, TRUE);
1507 1507
 			}
1508 1508
 		}
1509 1509
 	}
@@ -1525,16 +1525,16 @@  discard block
 block discarded – undo
1525 1525
 	function getRequestUrl()
1526 1526
 	{
1527 1527
 		static $url = null;
1528
-		if(is_null($url))
1528
+		if (is_null($url))
1529 1529
 		{
1530 1530
 			$url = self::getRequestUri();
1531
-			if(count($_GET) > 0)
1531
+			if (count($_GET) > 0)
1532 1532
 			{
1533
-				foreach($_GET as $key => $val)
1533
+				foreach ($_GET as $key => $val)
1534 1534
 				{
1535
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1535
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1536 1536
 				}
1537
-				$url .= '?' . join('&', $vars);
1537
+				$url .= '?'.join('&', $vars);
1538 1538
 			}
1539 1539
 		}
1540 1540
 		return $url;
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
 		$self = self::getInstance();
1550 1550
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1551 1551
 
1552
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1552
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1553 1553
 		{
1554 1554
 			unset($js_callback_func);
1555 1555
 			unset($_GET['xe_js_callback']);
@@ -1577,22 +1577,22 @@  discard block
 block discarded – undo
1577 1577
 		$self = self::getInstance();
1578 1578
 
1579 1579
 		// retrieve virtual site information
1580
-		if(is_null($site_module_info))
1580
+		if (is_null($site_module_info))
1581 1581
 		{
1582 1582
 			$site_module_info = self::get('site_module_info');
1583 1583
 		}
1584 1584
 
1585 1585
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1586
-		if($domain && isSiteID($domain))
1586
+		if ($domain && isSiteID($domain))
1587 1587
 		{
1588 1588
 			$vid = $domain;
1589 1589
 			$domain = '';
1590 1590
 		}
1591 1591
 
1592 1592
 		// If $domain, $vid are not set, use current site information
1593
-		if(!$domain && !$vid)
1593
+		if (!$domain && !$vid)
1594 1594
 		{
1595
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1595
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1596 1596
 			{
1597 1597
 				$vid = $site_module_info->domain;
1598 1598
 			}
@@ -1603,21 +1603,21 @@  discard block
 block discarded – undo
1603 1603
 		}
1604 1604
 
1605 1605
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1606
-		if($domain)
1606
+		if ($domain)
1607 1607
 		{
1608 1608
 			$domain_info = parse_url($domain);
1609
-			if(is_null($current_info))
1609
+			if (is_null($current_info))
1610 1610
 			{
1611
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1611
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1612 1612
 			}
1613
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1613
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1614 1614
 			{
1615 1615
 				unset($domain);
1616 1616
 			}
1617 1617
 			else
1618 1618
 			{
1619 1619
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1620
-				if(substr_compare($domain, '/', -1) !== 0)
1620
+				if (substr_compare($domain, '/', -1) !== 0)
1621 1621
 				{
1622 1622
 					$domain .= '/';
1623 1623
 				}
@@ -1627,10 +1627,10 @@  discard block
 block discarded – undo
1627 1627
 		$get_vars = array();
1628 1628
 
1629 1629
 		// If there is no GET variables or first argument is '' to reset variables
1630
-		if(!$self->get_vars || $args_list[0] == '')
1630
+		if (!$self->get_vars || $args_list[0] == '')
1631 1631
 		{
1632 1632
 			// rearrange args_list
1633
-			if(is_array($args_list) && $args_list[0] == '')
1633
+			if (is_array($args_list) && $args_list[0] == '')
1634 1634
 			{
1635 1635
 				array_shift($args_list);
1636 1636
 			}
@@ -1642,13 +1642,13 @@  discard block
 block discarded – undo
1642 1642
 		}
1643 1643
 
1644 1644
 		// arrange args_list
1645
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1645
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1646 1646
 		{
1647 1647
 			$key = $args_list[$i];
1648 1648
 			$val = trim($args_list[$i + 1]);
1649 1649
 
1650 1650
 			// If value is not set, remove the key
1651
-			if(!isset($val) || !strlen($val))
1651
+			if (!isset($val) || !strlen($val))
1652 1652
 			{
1653 1653
 				unset($get_vars[$key]);
1654 1654
 				continue;
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
 
1660 1660
 		// remove vid, rnd
1661 1661
 		unset($get_vars['rnd']);
1662
-		if($vid)
1662
+		if ($vid)
1663 1663
 		{
1664 1664
 			$get_vars['vid'] = $vid;
1665 1665
 		}
@@ -1676,17 +1676,17 @@  discard block
 block discarded – undo
1676 1676
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1677 1677
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1678 1678
 		);
1679
-		if($act_alias[$act])
1679
+		if ($act_alias[$act])
1680 1680
 		{
1681 1681
 			$get_vars['act'] = $act_alias[$act];
1682 1682
 		}
1683 1683
 
1684 1684
 		// organize URL
1685 1685
 		$query = '';
1686
-		if(count($get_vars) > 0)
1686
+		if (count($get_vars) > 0)
1687 1687
 		{
1688 1688
 			// if using rewrite mod
1689
-			if($self->allow_rewrite)
1689
+			if ($self->allow_rewrite)
1690 1690
 			{
1691 1691
 				$var_keys = array_keys($get_vars);
1692 1692
 				sort($var_keys);
@@ -1706,8 +1706,8 @@  discard block
 block discarded – undo
1706 1706
 					'vid' => $vid,
1707 1707
 					'mid' => $mid,
1708 1708
 					'mid.vid' => "$vid/$mid",
1709
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1710
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1709
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1710
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1711 1711
 					'document_srl' => $srl,
1712 1712
 					'document_srl.mid' => "$mid/$srl",
1713 1713
 					'document_srl.vid' => "$vid/$srl",
@@ -1724,66 +1724,66 @@  discard block
 block discarded – undo
1724 1724
 				$query = $target_map[$target];
1725 1725
 			}
1726 1726
 
1727
-			if(!$query)
1727
+			if (!$query)
1728 1728
 			{
1729 1729
 				$queries = array();
1730
-				foreach($get_vars as $key => $val)
1730
+				foreach ($get_vars as $key => $val)
1731 1731
 				{
1732
-					if(is_array($val) && count($val) > 0)
1732
+					if (is_array($val) && count($val) > 0)
1733 1733
 					{
1734
-						foreach($val as $k => $v)
1734
+						foreach ($val as $k => $v)
1735 1735
 						{
1736
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1736
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1737 1737
 						}
1738 1738
 					}
1739
-					elseif(!is_array($val))
1739
+					elseif (!is_array($val))
1740 1740
 					{
1741
-						$queries[] = $key . '=' . urlencode($val);
1741
+						$queries[] = $key.'='.urlencode($val);
1742 1742
 					}
1743 1743
 				}
1744
-				if(count($queries) > 0)
1744
+				if (count($queries) > 0)
1745 1745
 				{
1746
-					$query = 'index.php?' . join('&', $queries);
1746
+					$query = 'index.php?'.join('&', $queries);
1747 1747
 				}
1748 1748
 			}
1749 1749
 		}
1750 1750
 
1751 1751
 		// If using SSL always
1752 1752
 		$_use_ssl = $self->get('_use_ssl');
1753
-		if($_use_ssl == 'always')
1753
+		if ($_use_ssl == 'always')
1754 1754
 		{
1755
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1755
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1756 1756
 			// optional SSL use
1757 1757
 		}
1758
-		elseif($_use_ssl == 'optional')
1758
+		elseif ($_use_ssl == 'optional')
1759 1759
 		{
1760 1760
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1761
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1761
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1762 1762
 			// no SSL
1763 1763
 		}
1764 1764
 		else
1765 1765
 		{
1766 1766
 			// currently on SSL but target is not based on SSL
1767
-			if($_SERVER['HTTPS'] == 'on')
1767
+			if ($_SERVER['HTTPS'] == 'on')
1768 1768
 			{
1769
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1769
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1770 1770
 			}
1771
-			else if($domain) // if $domain is set
1771
+			else if ($domain) // if $domain is set
1772 1772
 			{
1773
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1773
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1774 1774
 			}
1775 1775
 			else
1776 1776
 			{
1777
-				$query = getScriptPath() . $query;
1777
+				$query = getScriptPath().$query;
1778 1778
 			}
1779 1779
 		}
1780 1780
 
1781
-		if(!$encode)
1781
+		if (!$encode)
1782 1782
 		{
1783 1783
 			return $query;
1784 1784
 		}
1785 1785
 
1786
-		if(!$autoEncode)
1786
+		if (!$autoEncode)
1787 1787
 		{
1788 1788
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1789 1789
 		}
@@ -1792,16 +1792,16 @@  discard block
 block discarded – undo
1792 1792
 		$encode_queries = array();
1793 1793
 		$parsedUrl = parse_url($query);
1794 1794
 		parse_str($parsedUrl['query'], $output);
1795
-		foreach($output as $key => $value)
1795
+		foreach ($output as $key => $value)
1796 1796
 		{
1797
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1797
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1798 1798
 			{
1799 1799
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1800 1800
 			}
1801
-			$encode_queries[] = $key . '=' . $value;
1801
+			$encode_queries[] = $key.'='.$value;
1802 1802
 		}
1803 1803
 
1804
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1804
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1805 1805
 	}
1806 1806
 
1807 1807
 	/**
@@ -1816,17 +1816,17 @@  discard block
 block discarded – undo
1816 1816
 		static $url = array();
1817 1817
 
1818 1818
 		// Check HTTP Request
1819
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1819
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1820 1820
 		{
1821 1821
 			return;
1822 1822
 		}
1823 1823
 
1824
-		if(self::get('_use_ssl') == 'always')
1824
+		if (self::get('_use_ssl') == 'always')
1825 1825
 		{
1826 1826
 			$ssl_mode = ENFORCE_SSL;
1827 1827
 		}
1828 1828
 
1829
-		if($domain)
1829
+		if ($domain)
1830 1830
 		{
1831 1831
 			$domain_key = md5($domain);
1832 1832
 		}
@@ -1835,14 +1835,14 @@  discard block
 block discarded – undo
1835 1835
 			$domain_key = 'default';
1836 1836
 		}
1837 1837
 
1838
-		if(isset($url[$ssl_mode][$domain_key]))
1838
+		if (isset($url[$ssl_mode][$domain_key]))
1839 1839
 		{
1840 1840
 			return $url[$ssl_mode][$domain_key];
1841 1841
 		}
1842 1842
 
1843 1843
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1844 1844
 
1845
-		switch($ssl_mode)
1845
+		switch ($ssl_mode)
1846 1846
 		{
1847 1847
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1848 1848
 				break;
@@ -1852,34 +1852,34 @@  discard block
 block discarded – undo
1852 1852
 				break;
1853 1853
 		}
1854 1854
 
1855
-		if($domain)
1855
+		if ($domain)
1856 1856
 		{
1857 1857
 			$target_url = trim($domain);
1858
-			if(substr_compare($target_url, '/', -1) !== 0)
1858
+			if (substr_compare($target_url, '/', -1) !== 0)
1859 1859
 			{
1860
-				$target_url.= '/';
1860
+				$target_url .= '/';
1861 1861
 			}
1862 1862
 		}
1863 1863
 		else
1864 1864
 		{
1865
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1865
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1866 1866
 		}
1867 1867
 
1868
-		$url_info = parse_url('http://' . $target_url);
1868
+		$url_info = parse_url('http://'.$target_url);
1869 1869
 
1870
-		if($current_use_ssl != $use_ssl)
1870
+		if ($current_use_ssl != $use_ssl)
1871 1871
 		{
1872 1872
 			unset($url_info['port']);
1873 1873
 		}
1874 1874
 
1875
-		if($use_ssl)
1875
+		if ($use_ssl)
1876 1876
 		{
1877 1877
 			$port = self::get('_https_port');
1878
-			if($port && $port != 443)
1878
+			if ($port && $port != 443)
1879 1879
 			{
1880 1880
 				$url_info['port'] = $port;
1881 1881
 			}
1882
-			elseif($url_info['port'] == 443)
1882
+			elseif ($url_info['port'] == 443)
1883 1883
 			{
1884 1884
 				unset($url_info['port']);
1885 1885
 			}
@@ -1887,17 +1887,17 @@  discard block
 block discarded – undo
1887 1887
 		else
1888 1888
 		{
1889 1889
 			$port = self::get('_http_port');
1890
-			if($port && $port != 80)
1890
+			if ($port && $port != 80)
1891 1891
 			{
1892 1892
 				$url_info['port'] = $port;
1893 1893
 			}
1894
-			elseif($url_info['port'] == 80)
1894
+			elseif ($url_info['port'] == 80)
1895 1895
 			{
1896 1896
 				unset($url_info['port']);
1897 1897
 			}
1898 1898
 		}
1899 1899
 
1900
-		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']);
1900
+		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']);
1901 1901
 
1902 1902
 		return $url[$ssl_mode][$domain_key];
1903 1903
 	}
@@ -1914,16 +1914,16 @@  discard block
 block discarded – undo
1914 1914
 	{
1915 1915
 		$self = self::getInstance();
1916 1916
 		$self->context->{$key} = $val;
1917
-		if($set_to_get_vars === FALSE)
1917
+		if ($set_to_get_vars === FALSE)
1918 1918
 		{
1919 1919
 			return;
1920 1920
 		}
1921
-		if($val === NULL || $val === '')
1921
+		if ($val === NULL || $val === '')
1922 1922
 		{
1923 1923
 			unset($self->get_vars->{$key});
1924 1924
 			return;
1925 1925
 		}
1926
-		if($set_to_get_vars || $self->get_vars->{$key})
1926
+		if ($set_to_get_vars || $self->get_vars->{$key})
1927 1927
 		{
1928 1928
 			$self->get_vars->{$key} = $val;
1929 1929
 		}
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
 	{
1940 1940
 		$self = self::getInstance();
1941 1941
 
1942
-		if(!isset($self->context->{$key}))
1942
+		if (!isset($self->context->{$key}))
1943 1943
 		{
1944 1944
 			return null;
1945 1945
 		}
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 	function gets()
1955 1955
 	{
1956 1956
 		$num_args = func_num_args();
1957
-		if($num_args < 1)
1957
+		if ($num_args < 1)
1958 1958
 		{
1959 1959
 			return;
1960 1960
 		}
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
 
1963 1963
 		$args_list = func_get_args();
1964 1964
 		$output = new stdClass();
1965
-		foreach($args_list as $v)
1965
+		foreach ($args_list as $v)
1966 1966
 		{
1967 1967
 			$output->{$v} = $self->get($v);
1968 1968
 		}
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
 	function getRequestVars()
1989 1989
 	{
1990 1990
 		$self = self::getInstance();
1991
-		if($self->get_vars)
1991
+		if ($self->get_vars)
1992 1992
 		{
1993 1993
 			return clone($self->get_vars);
1994 1994
 		}
@@ -2005,13 +2005,13 @@  discard block
 block discarded – undo
2005 2005
 	{
2006 2006
 		$self = self::getInstance();
2007 2007
 
2008
-		if(!is_readable($self->sslActionCacheFile))
2008
+		if (!is_readable($self->sslActionCacheFile))
2009 2009
 		{
2010 2010
 			$buff = '<?php if(!defined("__XE__"))exit;';
2011 2011
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2012 2012
 		}
2013 2013
 
2014
-		if(!isset($self->ssl_actions[$action]))
2014
+		if (!isset($self->ssl_actions[$action]))
2015 2015
 		{
2016 2016
 			$self->ssl_actions[$action] = 1;
2017 2017
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2029,16 +2029,16 @@  discard block
 block discarded – undo
2029 2029
 	{
2030 2030
 		$self = self::getInstance();
2031 2031
 
2032
-		if(!is_readable($self->sslActionCacheFile))
2032
+		if (!is_readable($self->sslActionCacheFile))
2033 2033
 		{
2034 2034
 			unset($self->ssl_actions);
2035 2035
 			$buff = '<?php if(!defined("__XE__"))exit;';
2036 2036
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2037 2037
 		}
2038 2038
 
2039
-		foreach($action_array as $action)
2039
+		foreach ($action_array as $action)
2040 2040
 		{
2041
-			if(!isset($self->ssl_actions[$action]))
2041
+			if (!isset($self->ssl_actions[$action]))
2042 2042
 			{
2043 2043
 				$self->ssl_actions[$action] = 1;
2044 2044
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2057,7 +2057,7 @@  discard block
 block discarded – undo
2057 2057
 	{
2058 2058
 		$self = self::getInstance();
2059 2059
 
2060
-		if($self->isExistsSSLAction($action))
2060
+		if ($self->isExistsSSLAction($action))
2061 2061
 		{
2062 2062
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2063 2063
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
 	function getSSLActions()
2075 2075
 	{
2076 2076
 		$self = self::getInstance();
2077
-		if($self->getSslStatus() == 'optional')
2077
+		if ($self->getSslStatus() == 'optional')
2078 2078
 		{
2079 2079
 			return $self->ssl_actions;
2080 2080
 		}
@@ -2101,12 +2101,12 @@  discard block
 block discarded – undo
2101 2101
 	 */
2102 2102
 	function normalizeFilePath($file)
2103 2103
 	{
2104
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2104
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2105 2105
 		{
2106
-			$file = './' . $file;
2106
+			$file = './'.$file;
2107 2107
 		}
2108 2108
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2109
-		while(strpos($file, '/../') !== FALSE)
2109
+		while (strpos($file, '/../') !== FALSE)
2110 2110
 		{
2111 2111
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2112 2112
 		}
@@ -2125,13 +2125,13 @@  discard block
 block discarded – undo
2125 2125
 	{
2126 2126
 		$file = self::normalizeFilePath($file);
2127 2127
 		$script_path = getScriptPath();
2128
-		if(strpos($file, './') === 0)
2128
+		if (strpos($file, './') === 0)
2129 2129
 		{
2130
-			$file = $script_path . substr($file, 2);
2130
+			$file = $script_path.substr($file, 2);
2131 2131
 		}
2132
-		elseif(strpos($file, '../') === 0)
2132
+		elseif (strpos($file, '../') === 0)
2133 2133
 		{
2134
-			$file = self::normalizeFilePath($script_path . $file);
2134
+			$file = self::normalizeFilePath($script_path.$file);
2135 2135
 		}
2136 2136
 
2137 2137
 		return $file;
@@ -2201,12 +2201,12 @@  discard block
 block discarded – undo
2201 2201
 	 */
2202 2202
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2203 2203
 	{
2204
-		if($isRuleset)
2204
+		if ($isRuleset)
2205 2205
 		{
2206
-			if(strpos($file, '#') !== FALSE)
2206
+			if (strpos($file, '#') !== FALSE)
2207 2207
 			{
2208 2208
 				$file = str_replace('#', '', $file);
2209
-				if(!is_readable($file))
2209
+				if (!is_readable($file))
2210 2210
 				{
2211 2211
 					$file = $autoPath;
2212 2212
 				}
@@ -2271,9 +2271,9 @@  discard block
 block discarded – undo
2271 2271
 		ksort($files);
2272 2272
 		$files = array_values($files);
2273 2273
 		$filenames = array();
2274
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2274
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2275 2275
 		{
2276
-			if(in_array($files[$i]['file'], $filenames))
2276
+			if (in_array($files[$i]['file'], $filenames))
2277 2277
 			{
2278 2278
 				unset($files[$i]);
2279 2279
 			}
@@ -2358,14 +2358,14 @@  discard block
 block discarded – undo
2358 2358
 	 */
2359 2359
 	function getJavascriptPluginInfo($pluginName)
2360 2360
 	{
2361
-		if($plugin_name == 'ui.datepicker')
2361
+		if ($plugin_name == 'ui.datepicker')
2362 2362
 		{
2363 2363
 			$plugin_name = 'ui';
2364 2364
 		}
2365 2365
 
2366
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2367
-		$info_file = $plugin_path . 'plugin.load';
2368
-		if(!is_readable($info_file))
2366
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2367
+		$info_file = $plugin_path.'plugin.load';
2368
+		if (!is_readable($info_file))
2369 2369
 		{
2370 2370
 			return;
2371 2371
 		}
@@ -2375,32 +2375,32 @@  discard block
 block discarded – undo
2375 2375
 		$result->jsList = array();
2376 2376
 		$result->cssList = array();
2377 2377
 
2378
-		foreach($list as $filename)
2378
+		foreach ($list as $filename)
2379 2379
 		{
2380 2380
 			$filename = trim($filename);
2381
-			if(!$filename)
2381
+			if (!$filename)
2382 2382
 			{
2383 2383
 				continue;
2384 2384
 			}
2385 2385
 
2386
-			if(strncasecmp('./', $filename, 2) === 0)
2386
+			if (strncasecmp('./', $filename, 2) === 0)
2387 2387
 			{
2388 2388
 				$filename = substr($filename, 2);
2389 2389
 			}
2390 2390
 
2391
-			if(substr_compare($filename, '.js', -3) === 0)
2391
+			if (substr_compare($filename, '.js', -3) === 0)
2392 2392
 			{
2393
-				$result->jsList[] = $plugin_path . $filename;
2393
+				$result->jsList[] = $plugin_path.$filename;
2394 2394
 			}
2395
-			elseif(substr_compare($filename, '.css', -4) === 0)
2395
+			elseif (substr_compare($filename, '.css', -4) === 0)
2396 2396
 			{
2397
-				$result->cssList[] = $plugin_path . $filename;
2397
+				$result->cssList[] = $plugin_path.$filename;
2398 2398
 			}
2399 2399
 		}
2400 2400
 
2401
-		if(is_dir($plugin_path . 'lang'))
2401
+		if (is_dir($plugin_path.'lang'))
2402 2402
 		{
2403
-			$result->langPath = $plugin_path . 'lang';
2403
+			$result->langPath = $plugin_path.'lang';
2404 2404
 		}
2405 2405
 
2406 2406
 		return $result;
@@ -2416,50 +2416,50 @@  discard block
 block discarded – undo
2416 2416
 		static $loaded_plugins = array();
2417 2417
 
2418 2418
 		$self = self::getInstance();
2419
-		if($plugin_name == 'ui.datepicker')
2419
+		if ($plugin_name == 'ui.datepicker')
2420 2420
 		{
2421 2421
 			$plugin_name = 'ui';
2422 2422
 		}
2423 2423
 
2424
-		if($loaded_plugins[$plugin_name])
2424
+		if ($loaded_plugins[$plugin_name])
2425 2425
 		{
2426 2426
 			return;
2427 2427
 		}
2428 2428
 		$loaded_plugins[$plugin_name] = TRUE;
2429 2429
 
2430
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2431
-		$info_file = $plugin_path . 'plugin.load';
2432
-		if(!is_readable($info_file))
2430
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2431
+		$info_file = $plugin_path.'plugin.load';
2432
+		if (!is_readable($info_file))
2433 2433
 		{
2434 2434
 			return;
2435 2435
 		}
2436 2436
 
2437 2437
 		$list = file($info_file);
2438
-		foreach($list as $filename)
2438
+		foreach ($list as $filename)
2439 2439
 		{
2440 2440
 			$filename = trim($filename);
2441
-			if(!$filename)
2441
+			if (!$filename)
2442 2442
 			{
2443 2443
 				continue;
2444 2444
 			}
2445 2445
 
2446
-			if(strncasecmp('./', $filename, 2) === 0)
2446
+			if (strncasecmp('./', $filename, 2) === 0)
2447 2447
 			{
2448 2448
 				$filename = substr($filename, 2);
2449 2449
 			}
2450
-			if(substr_compare($filename, '.js', -3) === 0)
2450
+			if (substr_compare($filename, '.js', -3) === 0)
2451 2451
 			{
2452
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2452
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2453 2453
 			}
2454
-			if(substr_compare($filename, '.css', -4) === 0)
2454
+			if (substr_compare($filename, '.css', -4) === 0)
2455 2455
 			{
2456
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2456
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2457 2457
 			}
2458 2458
 		}
2459 2459
 
2460
-		if(is_dir($plugin_path . 'lang'))
2460
+		if (is_dir($plugin_path.'lang'))
2461 2461
 		{
2462
-			$self->loadLang($plugin_path . 'lang');
2462
+			$self->loadLang($plugin_path.'lang');
2463 2463
 		}
2464 2464
 	}
2465 2465
 
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 	function addHtmlHeader($header)
2473 2473
 	{
2474 2474
 		$self = self::getInstance();
2475
-		$self->html_header .= "\n" . $header;
2475
+		$self->html_header .= "\n".$header;
2476 2476
 	}
2477 2477
 
2478 2478
 	function clearHtmlHeader()
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
 	function addBodyHeader($header)
2525 2525
 	{
2526 2526
 		$self = self::getInstance();
2527
-		$self->body_header .= "\n" . $header;
2527
+		$self->body_header .= "\n".$header;
2528 2528
 	}
2529 2529
 
2530 2530
 	/**
@@ -2546,7 +2546,7 @@  discard block
 block discarded – undo
2546 2546
 	function addHtmlFooter($footer)
2547 2547
 	{
2548 2548
 		$self = self::getInstance();
2549
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2549
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2550 2550
 	}
2551 2551
 
2552 2552
 	/**
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
 	 */
2568 2568
 	function getConfigFile()
2569 2569
 	{
2570
-		return _XE_PATH_ . 'files/config/db.config.php';
2570
+		return _XE_PATH_.'files/config/db.config.php';
2571 2571
 	}
2572 2572
 
2573 2573
 	/**
@@ -2577,7 +2577,7 @@  discard block
 block discarded – undo
2577 2577
 	 */
2578 2578
 	function getFTPConfigFile()
2579 2579
 	{
2580
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2580
+		return _XE_PATH_.'files/config/ftp.config.php';
2581 2581
 	}
2582 2582
 
2583 2583
 	/**
@@ -2629,14 +2629,14 @@  discard block
 block discarded – undo
2629 2629
 		$_path = explode('/', $path);
2630 2630
 		$_base = explode('/', $base_url);
2631 2631
 
2632
-		if(!$_base[count($_base) - 1])
2632
+		if (!$_base[count($_base) - 1])
2633 2633
 		{
2634 2634
 			array_pop($_base);
2635 2635
 		}
2636 2636
 
2637
-		foreach($_xe as $idx => $dir)
2637
+		foreach ($_xe as $idx => $dir)
2638 2638
 		{
2639
-			if($_path[0] != $dir)
2639
+			if ($_path[0] != $dir)
2640 2640
 			{
2641 2641
 				break;
2642 2642
 			}
@@ -2644,9 +2644,9 @@  discard block
 block discarded – undo
2644 2644
 		}
2645 2645
 
2646 2646
 		$idx = count($_xe) - $idx - 1;
2647
-		while($idx--)
2647
+		while ($idx--)
2648 2648
 		{
2649
-			if(count($_base) > 0)
2649
+			if (count($_base) > 0)
2650 2650
 			{
2651 2651
 				array_shift($_base);
2652 2652
 			}
@@ -2656,13 +2656,13 @@  discard block
 block discarded – undo
2656 2656
 			}
2657 2657
 		}
2658 2658
 
2659
-		if(count($_base) > 0)
2659
+		if (count($_base) > 0)
2660 2660
 		{
2661 2661
 			array_unshift($_path, join('/', $_base));
2662 2662
 		}
2663 2663
 
2664
-		$path = '/' . join('/', $_path);
2665
-		if(substr_compare($path, '/', -1) !== 0)
2664
+		$path = '/'.join('/', $_path);
2665
+		if (substr_compare($path, '/', -1) !== 0)
2666 2666
 		{
2667 2667
 			$path .= '/';
2668 2668
 		}
@@ -2677,13 +2677,13 @@  discard block
 block discarded – undo
2677 2677
 	{
2678 2678
 		$self = self::getInstance();
2679 2679
 
2680
-		if(!is_array($self->meta_tags))
2680
+		if (!is_array($self->meta_tags))
2681 2681
 		{
2682 2682
 			$self->meta_tags = array();
2683 2683
 		}
2684 2684
 
2685 2685
 		$ret = array();
2686
-		foreach($self->meta_tags as $key => $val)
2686
+		foreach ($self->meta_tags as $key => $val)
2687 2687
 		{
2688 2688
 			list($name, $is_http_equiv) = explode("\t", $key);
2689 2689
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2704 2704
 	{
2705 2705
 		$self = self::getInstance();
2706
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2706
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2707 2707
 	}
2708 2708
 
2709 2709
 }
Please login to merge, or discard this patch.
Braces   +90 added lines, -103 removed lines patch added patch discarded remove patch
@@ -230,7 +230,9 @@  discard block
 block discarded – undo
230 230
 		$this->loadDBInfo();
231 231
 		if($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if(is_array($this->db_info->sitelock_whitelist)) {
234
+				$whitelist = $this->db_info->sitelock_whitelist;
235
+			}
234 236
 
235 237
 			if(!IpFilter::filter($whitelist))
236 238
 			{
@@ -245,8 +247,7 @@  discard block
 block discarded – undo
245 247
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
246 248
 				{
247 249
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
248
-				}
249
-				else
250
+				} else
250 251
 				{
251 252
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
252 253
 				}
@@ -303,8 +304,7 @@  discard block
 block discarded – undo
303 304
 			{
304 305
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 306
 			}
306
-		}
307
-		elseif($_COOKIE['lang_type'])
307
+		} elseif($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
@@ -341,7 +341,9 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if($sess = $_POST[session_name()]) {
345
+			session_id($sess);
346
+		}
345 347
 		session_start();
346 348
 
347 349
 		// set authentication information in Context and session
@@ -394,22 +396,21 @@  discard block
 block discarded – undo
394 396
 						{
395 397
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396 398
 						}
397
-					}
398
-					elseif($val)
399
+					} elseif($val)
399 400
 					{
400 401
 						$url[] = $key . '=' . urlencode($val);
401 402
 					}
402 403
 				}
403 404
 
404 405
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
406
-			}
407
-			else
406
+				if($url) {
407
+					$current_url .= '?' . join('&', $url);
408
+				}
409
+			} else
408 410
 			{
409 411
 				$current_url = $this->getUrl();
410 412
 			}
411
-		}
412
-		else
413
+		} else
413 414
 		{
414 415
 			$current_url = self::getRequestUri();
415 416
 		}
@@ -490,18 +491,22 @@  discard block
 block discarded – undo
490 491
 			$db_info->use_prepared_statements = 'Y';
491 492
 		}
492 493
 
493
-		if(!$db_info->time_zone)
494
-			$db_info->time_zone = date('O');
494
+		if(!$db_info->time_zone) {
495
+					$db_info->time_zone = date('O');
496
+		}
495 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
496 498
 
497
-		if($db_info->qmail_compatibility != 'Y')
498
-			$db_info->qmail_compatibility = 'N';
499
+		if($db_info->qmail_compatibility != 'Y') {
500
+					$db_info->qmail_compatibility = 'N';
501
+		}
499 502
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
500 503
 
501
-		if(!$db_info->use_db_session)
502
-			$db_info->use_db_session = 'N';
503
-		if(!$db_info->use_ssl)
504
-			$db_info->use_ssl = 'none';
504
+		if(!$db_info->use_db_session) {
505
+					$db_info->use_db_session = 'N';
506
+		}
507
+		if(!$db_info->use_ssl) {
508
+					$db_info->use_ssl = 'none';
509
+		}
505 510
 		$this->set('_use_ssl', $db_info->use_ssl);
506 511
 
507 512
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -618,8 +623,7 @@  discard block
 block discarded – undo
618 623
 				$buff = FileHandler::readFile($orig_lang_file);
619 624
 				FileHandler::writeFile($selected_lang_file, $buff);
620 625
 				$lang_selected = self::loadLangSupported();
621
-			}
622
-			else
626
+			} else
623 627
 			{
624 628
 				$langs = file($selected_lang_file);
625 629
 				foreach($langs as $val)
@@ -678,15 +682,16 @@  discard block
 block discarded – undo
678 682
 
679 683
 				$oModuleModel = getModel('module');
680 684
 				$domain = $url_info['host'] . $url_info['path'];
681
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
685
+				if(substr_compare($domain, '/', -1) === 0) {
686
+					$domain = substr($domain, 0, -1);
687
+				}
682 688
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
683 689
 
684 690
 				if($site_info->site_srl)
685 691
 				{
686 692
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
687 693
 				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
688
-				}
689
-				else
694
+				} else
690 695
 				{
691 696
 					$redirect_url = $url;
692 697
 				}
@@ -695,8 +700,7 @@  discard block
 block discarded – undo
695 700
 				return FALSE;
696 701
 			}
697 702
 			// for sites requesting SSO validation
698
-		}
699
-		else
703
+		} else
700 704
 		{
701 705
 			// result handling : set session_name()
702 706
 			if($session_name = self::get('SSOID'))
@@ -713,8 +717,7 @@  discard block
 block discarded – undo
713 717
 				header('location:' . $url);
714 718
 				return FALSE;
715 719
 				// send SSO request
716
-			}
717
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
720
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
718 721
 			{
719 722
 				setcookie('sso', md5(self::getRequestUri()));
720 723
 				$origin_url = self::getRequestUrl();
@@ -774,8 +777,7 @@  discard block
 block discarded – undo
774 777
 		if($self->site_title)
775 778
 		{
776 779
 			$self->site_title .= ' - ' . $site_title;
777
-		}
778
-		else
780
+		} else
779 781
 		{
780 782
 			$self->site_title = $site_title;
781 783
 		}
@@ -875,8 +877,7 @@  discard block
 block discarded – undo
875 877
 		{
876 878
 			$self->loaded_lang_files[] = $filename;
877 879
 			include($filename);
878
-		}
879
-		else
880
+		} else
880 881
 		{
881 882
 			$self->_evalxmlLang($path);
882 883
 		}
@@ -892,7 +893,9 @@  discard block
 block discarded – undo
892 893
 	{
893 894
 		global $lang;
894 895
 
895
-		if(!$path) return;
896
+		if(!$path) {
897
+			return;
898
+		}
896 899
 
897 900
 		$_path = 'eval://' . $path;
898 901
 
@@ -924,7 +927,9 @@  discard block
 block discarded – undo
924 927
 	 */
925 928
 	function _loadXmlLang($path)
926 929
 	{
927
-		if(!$path) return;
930
+		if(!$path) {
931
+			return;
932
+		}
928 933
 
929 934
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
930 935
 		return $oXmlLangParser->compile();
@@ -938,7 +943,9 @@  discard block
 block discarded – undo
938 943
 	 */
939 944
 	function _loadPhpLang($path)
940 945
 	{
941
-		if(!$path) return;
946
+		if(!$path) {
947
+			return;
948
+		}
942 949
 
943 950
 		if(substr_compare($path, '/', -1) !== 0)
944 951
 		{
@@ -1074,12 +1081,14 @@  discard block
 block discarded – undo
1074 1081
 		static $flag = TRUE;
1075 1082
 		if($charset)
1076 1083
 		{
1077
-			if(is_array($val))
1078
-				array_walk($val,'Context::checkConvertFlag',$charset);
1079
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1080
-			else $flag = FALSE;
1081
-		}
1082
-		else
1084
+			if(is_array($val)) {
1085
+							array_walk($val,'Context::checkConvertFlag',$charset);
1086
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1087
+				$flag = FALSE;
1088
+			} else {
1089
+				$flag = FALSE;
1090
+			}
1091
+		} else
1083 1092
 		{
1084 1093
 			$return = $flag;
1085 1094
 			$flag = TRUE;
@@ -1101,8 +1110,9 @@  discard block
 block discarded – undo
1101 1110
 		if (is_array($val))
1102 1111
 		{
1103 1112
 			array_walk($val,'Context::doConvertEncoding',$charset);
1113
+		} else {
1114
+			$val = iconv($charset,'UTF-8',$val);
1104 1115
 		}
1105
-		else $val = iconv($charset,'UTF-8',$val);
1106 1116
 	}
1107 1117
 
1108 1118
 	/**
@@ -1113,7 +1123,9 @@  discard block
 block discarded – undo
1113 1123
 	 */
1114 1124
 	function convertEncodingStr($str)
1115 1125
 	{
1116
-        if(!$str) return null;
1126
+        if(!$str) {
1127
+        	return null;
1128
+        }
1117 1129
 		$obj = new stdClass();
1118 1130
 		$obj->str = $str;
1119 1131
 		$obj = self::convertEncoding($obj);
@@ -1226,16 +1238,13 @@  discard block
 block discarded – undo
1226 1238
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1227 1239
 			{
1228 1240
 				$set_to_vars = TRUE;
1229
-			}
1230
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1241
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1231 1242
 			{
1232 1243
 				$set_to_vars = TRUE;
1233
-			}
1234
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1244
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1235 1245
 			{
1236 1246
 				$set_to_vars = TRUE;
1237
-			}
1238
-			else
1247
+			} else
1239 1248
 			{
1240 1249
 				$set_to_vars = FALSE;
1241 1250
 			}
@@ -1261,8 +1270,7 @@  discard block
 block discarded – undo
1261 1270
 					return;
1262 1271
 				}
1263 1272
 			}
1264
-		}
1265
-		else if(is_array($val))
1273
+		} else if(is_array($val))
1266 1274
 		{
1267 1275
 			foreach($val as $val2)
1268 1276
 			{
@@ -1402,24 +1410,19 @@  discard block
 block discarded – undo
1402 1410
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1403 1411
 			{
1404 1412
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1405
-			}
1406
-			elseif($key === 'mid' || $key === 'search_keyword')
1413
+			} elseif($key === 'mid' || $key === 'search_keyword')
1407 1414
 			{
1408 1415
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1409
-			}
1410
-			elseif($key === 'vid')
1416
+			} elseif($key === 'vid')
1411 1417
 			{
1412 1418
 				$result[$k] = urlencode($v);
1413
-			}
1414
-			elseif($key === 'xe_validator_id')
1419
+			} elseif($key === 'xe_validator_id')
1415 1420
 			{
1416 1421
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1417
-			}
1418
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1422
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1419 1423
 			{
1420 1424
 				unset($result[$k]);
1421
-			}
1422
-			else
1425
+			} else
1423 1426
 			{
1424 1427
 				$result[$k] = $v;
1425 1428
 
@@ -1428,8 +1431,7 @@  discard block
 block discarded – undo
1428 1431
 					if (is_array($result[$k]))
1429 1432
 					{
1430 1433
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1431
-					}
1432
-					else
1434
+					} else
1433 1435
 					{
1434 1436
 						$result[$k] = stripslashes($result[$k]);
1435 1437
 					}
@@ -1438,8 +1440,7 @@  discard block
 block discarded – undo
1438 1440
 				if(is_array($result[$k]))
1439 1441
 				{
1440 1442
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1441
-				}
1442
-				else
1443
+				} else
1443 1444
 				{
1444 1445
 					$result[$k] = trim($result[$k]);
1445 1446
 				}
@@ -1484,8 +1485,7 @@  discard block
 block discarded – undo
1484 1485
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1485 1486
 				$this->set($key, $val, TRUE);
1486 1487
 				$this->is_uploaded = TRUE;
1487
-			}
1488
-			else
1488
+			} else
1489 1489
 			{
1490 1490
 				$files = array();
1491 1491
 				$count_files = count($tmp_name);
@@ -1503,7 +1503,9 @@  discard block
 block discarded – undo
1503 1503
 						$files[] = $file;
1504 1504
 					}
1505 1505
 				}
1506
-				if($files) $this->set($key, $files, TRUE);
1506
+				if($files) {
1507
+					$this->set($key, $files, TRUE);
1508
+				}
1507 1509
 			}
1508 1510
 		}
1509 1511
 	}
@@ -1595,8 +1597,7 @@  discard block
 block discarded – undo
1595 1597
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1596 1598
 			{
1597 1599
 				$vid = $site_module_info->domain;
1598
-			}
1599
-			else
1600
+			} else
1600 1601
 			{
1601 1602
 				$domain = $site_module_info->domain;
1602 1603
 			}
@@ -1613,8 +1614,7 @@  discard block
 block discarded – undo
1613 1614
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1614 1615
 			{
1615 1616
 				unset($domain);
1616
-			}
1617
-			else
1617
+			} else
1618 1618
 			{
1619 1619
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1620 1620
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1634,8 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 			{
1635 1635
 				array_shift($args_list);
1636 1636
 			}
1637
-		}
1638
-		else
1637
+		} else
1639 1638
 		{
1640 1639
 			// Otherwise, make GET variables into array
1641 1640
 			$get_vars = get_object_vars($self->get_vars);
@@ -1662,8 +1661,7 @@  discard block
 block discarded – undo
1662 1661
 		if($vid)
1663 1662
 		{
1664 1663
 			$get_vars['vid'] = $vid;
1665
-		}
1666
-		else
1664
+		} else
1667 1665
 		{
1668 1666
 			unset($get_vars['vid']);
1669 1667
 		}
@@ -1735,8 +1733,7 @@  discard block
 block discarded – undo
1735 1733
 						{
1736 1734
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1737 1735
 						}
1738
-					}
1739
-					elseif(!is_array($val))
1736
+					} elseif(!is_array($val))
1740 1737
 					{
1741 1738
 						$queries[] = $key . '=' . urlencode($val);
1742 1739
 					}
@@ -1754,25 +1751,23 @@  discard block
 block discarded – undo
1754 1751
 		{
1755 1752
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1756 1753
 			// optional SSL use
1757
-		}
1758
-		elseif($_use_ssl == 'optional')
1754
+		} elseif($_use_ssl == 'optional')
1759 1755
 		{
1760 1756
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1761 1757
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1762 1758
 			// no SSL
1763
-		}
1764
-		else
1759
+		} else
1765 1760
 		{
1766 1761
 			// currently on SSL but target is not based on SSL
1767 1762
 			if($_SERVER['HTTPS'] == 'on')
1768 1763
 			{
1769 1764
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1770
-			}
1771
-			else if($domain) // if $domain is set
1765
+			} else if($domain) {
1766
+				// if $domain is set
1772 1767
 			{
1773 1768
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1774 1769
 			}
1775
-			else
1770
+			} else
1776 1771
 			{
1777 1772
 				$query = getScriptPath() . $query;
1778 1773
 			}
@@ -1829,8 +1824,7 @@  discard block
 block discarded – undo
1829 1824
 		if($domain)
1830 1825
 		{
1831 1826
 			$domain_key = md5($domain);
1832
-		}
1833
-		else
1827
+		} else
1834 1828
 		{
1835 1829
 			$domain_key = 'default';
1836 1830
 		}
@@ -1859,8 +1853,7 @@  discard block
 block discarded – undo
1859 1853
 			{
1860 1854
 				$target_url.= '/';
1861 1855
 			}
1862
-		}
1863
-		else
1856
+		} else
1864 1857
 		{
1865 1858
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1866 1859
 		}
@@ -1878,20 +1871,17 @@  discard block
 block discarded – undo
1878 1871
 			if($port && $port != 443)
1879 1872
 			{
1880 1873
 				$url_info['port'] = $port;
1881
-			}
1882
-			elseif($url_info['port'] == 443)
1874
+			} elseif($url_info['port'] == 443)
1883 1875
 			{
1884 1876
 				unset($url_info['port']);
1885 1877
 			}
1886
-		}
1887
-		else
1878
+		} else
1888 1879
 		{
1889 1880
 			$port = self::get('_http_port');
1890 1881
 			if($port && $port != 80)
1891 1882
 			{
1892 1883
 				$url_info['port'] = $port;
1893
-			}
1894
-			elseif($url_info['port'] == 80)
1884
+			} elseif($url_info['port'] == 80)
1895 1885
 			{
1896 1886
 				unset($url_info['port']);
1897 1887
 			}
@@ -2128,8 +2118,7 @@  discard block
 block discarded – undo
2128 2118
 		if(strpos($file, './') === 0)
2129 2119
 		{
2130 2120
 			$file = $script_path . substr($file, 2);
2131
-		}
2132
-		elseif(strpos($file, '../') === 0)
2121
+		} elseif(strpos($file, '../') === 0)
2133 2122
 		{
2134 2123
 			$file = self::normalizeFilePath($script_path . $file);
2135 2124
 		}
@@ -2391,8 +2380,7 @@  discard block
 block discarded – undo
2391 2380
 			if(substr_compare($filename, '.js', -3) === 0)
2392 2381
 			{
2393 2382
 				$result->jsList[] = $plugin_path . $filename;
2394
-			}
2395
-			elseif(substr_compare($filename, '.css', -4) === 0)
2383
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2396 2384
 			{
2397 2385
 				$result->cssList[] = $plugin_path . $filename;
2398 2386
 			}
@@ -2649,8 +2637,7 @@  discard block
 block discarded – undo
2649 2637
 			if(count($_base) > 0)
2650 2638
 			{
2651 2639
 				array_shift($_base);
2652
-			}
2653
-			else
2640
+			} else
2654 2641
 			{
2655 2642
 				array_unshift($_base, '..');
2656 2643
 			}
Please login to merge, or discard this patch.