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 — develop ( 93a7ee...26a7e9 )
by gyeong-won
12:02
created
modules/document/document.item.php 2 patches
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function _loadFromDB($load_extra_vars = true)
76 76
 	{
77
-		if(!$this->document_srl) return;
77
+		if (!$this->document_srl) return;
78 78
 
79 79
 		$document_item = false;
80 80
 		$cache_put = false;
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 		// cache controll
85 85
 		$oCacheHandler = CacheHandler::getInstance('object');
86
-		if($oCacheHandler->isSupport())
86
+		if ($oCacheHandler->isSupport())
87 87
 		{
88
-			$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
88
+			$cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl;
89 89
 			$document_item = $oCacheHandler->get($cache_key);
90
-			if($document_item !== false)
90
+			if ($document_item !== false)
91 91
 			{
92 92
 				$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
93 93
 			}
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 		$args->document_srl = $this->document_srl;
98 98
 		$output = executeQuery('document.getDocument', $args, $columnList);
99 99
 
100
-		if($document_item === false)
100
+		if ($document_item === false)
101 101
 		{
102 102
 			$document_item = $output->data;
103 103
 
104 104
 				//insert in cache
105
-			if($document_item && $oCacheHandler->isSupport())
105
+			if ($document_item && $oCacheHandler->isSupport())
106 106
 			{
107 107
 				$oCacheHandler->put($cache_key, $document_item);
108 108
 			}
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 		$this->setAttribute($document_item, $load_extra_vars);
120 120
 	}
121 121
 
122
-	function setAttribute($attribute, $load_extra_vars=true)
122
+	function setAttribute($attribute, $load_extra_vars = true)
123 123
 	{
124
-		if(!$attribute->document_srl)
124
+		if (!$attribute->document_srl)
125 125
 		{
126 126
 			$this->document_srl = null;
127 127
 			return;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$this->adds($attribute);
132 132
 
133 133
 		// Tags
134
-		if($this->get('tags'))
134
+		if ($this->get('tags'))
135 135
 		{
136 136
 			$tag_list = explode(',', $this->get('tags'));
137 137
 			$tag_list = array_map('trim', $tag_list);
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		}
140 140
 
141 141
 		$oDocumentModel = getModel('document');
142
-		if($load_extra_vars)
142
+		if ($load_extra_vars)
143 143
 		{
144 144
 			$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
145 145
 			$oDocumentModel->setToAllDocumentExtraVars();
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 
155 155
 	function isGranted()
156 156
 	{
157
-		if($_SESSION['own_document'][$this->document_srl]) return true;
157
+		if ($_SESSION['own_document'][$this->document_srl]) return true;
158 158
 
159
-		if(!Context::get('is_logged')) return false;
159
+		if (!Context::get('is_logged')) return false;
160 160
 
161 161
 		$logged_info = Context::get('logged_info');
162
-		if($logged_info->is_admin == 'Y') return true;
162
+		if ($logged_info->is_admin == 'Y') return true;
163 163
 
164 164
 		$oModuleModel = getModel('module');
165 165
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
166
-		if($grant->manager) return true;
166
+		if ($grant->manager) return true;
167 167
 
168
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true;
168
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return true;
169 169
 
170 170
 		return false;
171 171
 	}
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 
178 178
 	function isAccessible()
179 179
 	{
180
-		return $_SESSION['accessible'][$this->document_srl]==true?true:false;
180
+		return $_SESSION['accessible'][$this->document_srl] == true ? true : false;
181 181
 	}
182 182
 
183 183
 	function allowComment()
184 184
 	{
185 185
 		// init write, document is not exists. so allow comment status is true
186
-		if(!$this->isExists()) return true;
186
+		if (!$this->isExists()) return true;
187 187
 
188 188
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
189 189
 	}
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	function allowTrackback()
192 192
 	{
193 193
 		static $allow_trackback_status = null;
194
-		if(is_null($allow_trackback_status))
194
+		if (is_null($allow_trackback_status))
195 195
 		{
196 196
 			
197 197
 			// Check the tarckback module exist
198
-			if(!getClass('trackback'))
198
+			if (!getClass('trackback'))
199 199
 			{
200 200
 				$allow_trackback_status = false;
201 201
 			}
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
 				$oModuleModel = getModel('module');
206 206
 				$trackback_config = $oModuleModel->getModuleConfig('trackback');
207 207
 				
208
-				if(!$trackback_config)
208
+				if (!$trackback_config)
209 209
 				{
210 210
 					$trackback_config = new stdClass();
211 211
 				}
212 212
 				
213
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
213
+				if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
+				if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
215 215
 				else
216 216
 				{
217 217
 					$module_srl = $this->get('module_srl');
218 218
 					// Check settings of each module
219 219
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
220
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
220
+					if ($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
+					else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true;
222 222
 				}
223 223
 			}
224 224
 		}
@@ -227,14 +227,14 @@  discard block
 block discarded – undo
227 227
 
228 228
 	function isLocked()
229 229
 	{
230
-		if(!$this->isExists()) return false;
230
+		if (!$this->isExists()) return false;
231 231
 
232 232
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
233 233
 	}
234 234
 
235 235
 	function isEditable()
236 236
 	{
237
-		if($this->isGranted() || !$this->get('member_srl')) return true;
237
+		if ($this->isGranted() || !$this->get('member_srl')) return true;
238 238
 		return false;
239 239
 	}
240 240
 
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 
252 252
 	function useNotify()
253 253
 	{
254
-		return $this->get('notify_message')=='Y' ? true : false;
254
+		return $this->get('notify_message') == 'Y' ? true : false;
255 255
 	}
256 256
 
257 257
 	function doCart()
258 258
 	{
259
-		if(!$this->document_srl) return false;
260
-		if($this->isCarted()) $this->removeCart();
259
+		if (!$this->document_srl) return false;
260
+		if ($this->isCarted()) $this->removeCart();
261 261
 		else $this->addCart();
262 262
 	}
263 263
 
@@ -284,18 +284,18 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	function notify($type, $content)
286 286
 	{
287
-		if(!$this->document_srl) return;
287
+		if (!$this->document_srl) return;
288 288
 		// return if it is not useNotify
289
-		if(!$this->useNotify()) return;
289
+		if (!$this->useNotify()) return;
290 290
 		// Pass if an author is not a logged-in user
291
-		if(!$this->get('member_srl')) return;
291
+		if (!$this->get('member_srl')) return;
292 292
 		// Return if the currently logged-in user is an author
293 293
 		$logged_info = Context::get('logged_info');
294
-		if($logged_info->member_srl == $this->get('member_srl')) return;
294
+		if ($logged_info->member_srl == $this->get('member_srl')) return;
295 295
 		// List variables
296
-		if($type) $title = "[".$type."] ";
296
+		if ($type) $title = "[".$type."] ";
297 297
 		$title .= cut_str(strip_tags($content), 10, '...');
298
-		$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));
298
+		$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));
299 299
 		$receiver_srl = $this->get('member_srl');
300 300
 		$sender_member_srl = $logged_info->member_srl;
301 301
 		// Send a message
@@ -310,26 +310,26 @@  discard block
 block discarded – undo
310 310
 
311 311
 	function getIpAddress()
312 312
 	{
313
-		if($this->isGranted())
313
+		if ($this->isGranted())
314 314
 		{
315 315
 			return $this->get('ipaddress');
316 316
 		}
317 317
 
318
-		return '*' . strstr($this->get('ipaddress'), '.');
318
+		return '*'.strstr($this->get('ipaddress'), '.');
319 319
 	}
320 320
 
321 321
 	function isExistsHomepage()
322 322
 	{
323
-		if(trim($this->get('homepage'))) return true;
323
+		if (trim($this->get('homepage'))) return true;
324 324
 		return false;
325 325
 	}
326 326
 
327 327
 	function getHomepageUrl()
328 328
 	{
329 329
 		$url = trim($this->get('homepage'));
330
-		if(!$url) return;
330
+		if (!$url) return;
331 331
 
332
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
332
+		if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://'.$url;
333 333
 
334 334
 		return $url;
335 335
 	}
@@ -359,52 +359,52 @@  discard block
 block discarded – undo
359 359
 		return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
360 360
 	}
361 361
 
362
-	function getTitleText($cut_size = 0, $tail='...')
362
+	function getTitleText($cut_size = 0, $tail = '...')
363 363
 	{
364
-		if(!$this->document_srl) return;
364
+		if (!$this->document_srl) return;
365 365
 
366
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
366
+		if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
367 367
 		else $title = $this->get('title');
368 368
 
369 369
 		return $title;
370 370
 	}
371 371
 
372
-	function getTitle($cut_size = 0, $tail='...')
372
+	function getTitle($cut_size = 0, $tail = '...')
373 373
 	{
374
-		if(!$this->document_srl) return;
374
+		if (!$this->document_srl) return;
375 375
 
376 376
 		$title = $this->getTitleText($cut_size, $tail);
377 377
 
378 378
 		$attrs = array();
379 379
 		$this->add('title_color', trim($this->get('title_color')));
380
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
381
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
380
+		if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;";
381
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
382 382
 
383
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
383
+		if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
384 384
 		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
385 385
 	}
386 386
 
387 387
 	function getContentText($strlen = 0)
388 388
 	{
389
-		if(!$this->document_srl) return;
389
+		if (!$this->document_srl) return;
390 390
 
391
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
391
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
392 392
 
393 393
 		$result = $this->_checkAccessibleFromStatus();
394
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
394
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
395 395
 
396 396
 		$content = $this->get('content');
397 397
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
398 398
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
399 399
 
400
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
400
+		if ($strlen) return cut_str(strip_tags($content), $strlen, '...');
401 401
 
402 402
 		return htmlspecialchars($content);
403 403
 	}
404 404
 
405 405
 	function _addAllowScriptAccess($m)
406 406
 	{
407
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
407
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
408 408
 		{
409 409
 			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
410 410
 		}
@@ -414,26 +414,26 @@  discard block
 block discarded – undo
414 414
 
415 415
 	function _checkAllowScriptAccess($m)
416 416
 	{
417
-		if($m[1] == 'object')
417
+		if ($m[1] == 'object')
418 418
 		{
419 419
 			$this->allowscriptaccessList[] = 1;
420 420
 		}
421 421
 
422
-		if($m[1] == 'param')
422
+		if ($m[1] == 'param')
423 423
 		{
424
-			if(stripos($m[0], 'allowscriptaccess'))
424
+			if (stripos($m[0], 'allowscriptaccess'))
425 425
 			{
426 426
 				$m[0] = '<param name="allowscriptaccess" value="never"';
427
-				if(substr($m[0], -1) == '/')
427
+				if (substr($m[0], -1) == '/')
428 428
 				{
429 429
 					$m[0] .= '/';
430 430
 				}
431
-				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
431
+				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
432 432
 			}
433 433
 		}
434
-		else if($m[1] == 'embed')
434
+		else if ($m[1] == 'embed')
435 435
 		{
436
-			if(stripos($m[0], 'allowscriptaccess'))
436
+			if (stripos($m[0], 'allowscriptaccess'))
437 437
 			{
438 438
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
439 439
 			}
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
 
448 448
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
449 449
 	{
450
-		if(!$this->document_srl) return;
450
+		if (!$this->document_srl) return;
451 451
 
452
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
452
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
453 453
 
454 454
 		$result = $this->_checkAccessibleFromStatus();
455
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
455
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
456 456
 
457 457
 		$content = $this->get('content');
458
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
458
+		if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
459 459
 
460 460
 		// Define a link if using a rewrite module
461 461
 		$oContext = &Context::getInstance();
462
-		if($oContext->allow_rewrite)
462
+		if ($oContext->allow_rewrite)
463 463
 		{
464
-			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
464
+			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content);
465 465
 		}
466 466
 		// To display a pop-up menu
467
-		if($add_popup_menu)
467
+		if ($add_popup_menu)
468 468
 		{
469 469
 			$content = sprintf(
470 470
 				'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
 			);
474 474
 		}
475 475
 		// If additional content information is set
476
-		if($add_content_info)
476
+		if ($add_content_info)
477 477
 		{
478 478
 			$memberSrl = $this->get('member_srl');
479
-			if($memberSrl < 0)
479
+			if ($memberSrl < 0)
480 480
 			{
481 481
 				$memberSrl = 0;
482 482
 			}
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 		else
494 494
 		{
495
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
495
+			if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
496 496
 		}
497 497
 		// Change the image path to a valid absolute path if resource_realpath is true
498
-		if($resource_realpath)
498
+		if ($resource_realpath)
499 499
 		{
500
-			$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
500
+			$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
501 501
 		}
502 502
 
503 503
 		return $content;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		$content = trim(cut_str($content, $str_size, $tail));
547 547
 
548 548
 		// Replace back < , <, "
549
-		$content = str_replace(array('<', '>', '"'),array('&lt;', '&gt;', '&quot;'), $content);
549
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
550 550
 
551 551
 		return $content;
552 552
 	}
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 	function getRegdateTime()
560 560
 	{
561 561
 		$regdate = $this->get('regdate');
562
-		$year = substr($regdate,0,4);
563
-		$month = substr($regdate,4,2);
564
-		$day = substr($regdate,6,2);
565
-		$hour = substr($regdate,8,2);
566
-		$min = substr($regdate,10,2);
567
-		$sec = substr($regdate,12,2);
568
-		return mktime($hour,$min,$sec,$month,$day,$year);
562
+		$year = substr($regdate, 0, 4);
563
+		$month = substr($regdate, 4, 2);
564
+		$day = substr($regdate, 6, 2);
565
+		$hour = substr($regdate, 8, 2);
566
+		$min = substr($regdate, 10, 2);
567
+		$sec = substr($regdate, 12, 2);
568
+		return mktime($hour, $min, $sec, $month, $day, $year);
569 569
 	}
570 570
 
571 571
 	function getRegdateGM()
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 
576 576
 	function getRegdateDT()
577 577
 	{
578
-		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
578
+		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
579 579
 	}
580 580
 
581 581
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 
586 586
 	function getUpdateTime()
587 587
 	{
588
-		$year = substr($this->get('last_update'),0,4);
589
-		$month = substr($this->get('last_update'),4,2);
590
-		$day = substr($this->get('last_update'),6,2);
591
-		$hour = substr($this->get('last_update'),8,2);
592
-		$min = substr($this->get('last_update'),10,2);
593
-		$sec = substr($this->get('last_update'),12,2);
594
-		return mktime($hour,$min,$sec,$month,$day,$year);
588
+		$year = substr($this->get('last_update'), 0, 4);
589
+		$month = substr($this->get('last_update'), 4, 2);
590
+		$day = substr($this->get('last_update'), 6, 2);
591
+		$hour = substr($this->get('last_update'), 8, 2);
592
+		$min = substr($this->get('last_update'), 10, 2);
593
+		$sec = substr($this->get('last_update'), 12, 2);
594
+		return mktime($hour, $min, $sec, $month, $day, $year);
595 595
 	}
596 596
 
597 597
 	function getUpdateGM()
@@ -601,21 +601,21 @@  discard block
 block discarded – undo
601 601
 
602 602
 	function getUpdateDT()
603 603
 	{
604
-		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
604
+		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
605 605
 	}
606 606
 
607 607
 	function getPermanentUrl()
608 608
 	{
609
-		return getFullUrl('','document_srl',$this->get('document_srl'));
609
+		return getFullUrl('', 'document_srl', $this->get('document_srl'));
610 610
 	}
611 611
 
612 612
 	function getTrackbackUrl()
613 613
 	{
614
-		if(!$this->document_srl) return;
614
+		if (!$this->document_srl) return;
615 615
 
616 616
 		// Generate a key to prevent spams
617 617
 		$oTrackbackModel = getModel('trackback');
618
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
618
+		if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
619 619
 	}
620 620
 
621 621
 	/**
@@ -625,24 +625,24 @@  discard block
 block discarded – undo
625 625
 	function updateReadedCount()
626 626
 	{
627 627
 		$oDocumentController = getController('document');
628
-		if($oDocumentController->updateReadedCount($this))
628
+		if ($oDocumentController->updateReadedCount($this))
629 629
 		{
630 630
 			$readed_count = $this->get('readed_count');
631
-			$this->add('readed_count', $readed_count+1);
631
+			$this->add('readed_count', $readed_count + 1);
632 632
 		}
633 633
 	}
634 634
 
635 635
 	function isExtraVarsExists()
636 636
 	{
637
-		if(!$this->get('module_srl')) return false;
637
+		if (!$this->get('module_srl')) return false;
638 638
 		$oDocumentModel = getModel('document');
639 639
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
640
-		return count($extra_keys)?true:false;
640
+		return count($extra_keys) ? true : false;
641 641
 	}
642 642
 
643 643
 	function getExtraVars()
644 644
 	{
645
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
645
+		if (!$this->get('module_srl') || !$this->document_srl) return null;
646 646
 
647 647
 		$oDocumentModel = getModel('document');
648 648
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	function getExtraValue($idx)
652 652
 	{
653 653
 		$extra_vars = $this->getExtraVars();
654
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
654
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
655 655
 		{
656 656
 			return $extra_vars[$idx]->getValue();
657 657
 		}
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	function getExtraValueHTML($idx)
665 665
 	{
666 666
 		$extra_vars = $this->getExtraVars();
667
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
667
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
668 668
 		{
669 669
 			return $extra_vars[$idx]->getValueHTML();
670 670
 		}
@@ -678,16 +678,16 @@  discard block
 block discarded – undo
678 678
 	{
679 679
 		$extra_vars = $this->getExtraVars();
680 680
 
681
-		if($extra_vars)
681
+		if ($extra_vars)
682 682
 		{
683 683
 			// Handle extra variable(eid)
684
-			foreach($extra_vars as $idx => $key)
684
+			foreach ($extra_vars as $idx => $key)
685 685
 			{
686 686
 				$extra_eid[$key->eid] = $key;
687 687
 			}
688 688
 		}
689 689
 		
690
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
690
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
691 691
 		{
692 692
 			return $extra_eid[$eid]->getValue();
693 693
 		}
@@ -701,12 +701,12 @@  discard block
 block discarded – undo
701 701
 	{
702 702
 		$extra_vars = $this->getExtraVars();
703 703
 		// Handle extra variable(eid)
704
-		foreach($extra_vars as $idx => $key)
704
+		foreach ($extra_vars as $idx => $key)
705 705
 		{
706 706
 			$extra_eid[$key->eid] = $key;
707 707
 		}
708 708
 		
709
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
709
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
710 710
 		{
711 711
 			return $extra_eid[$eid]->getValueHTML();
712 712
 		}
@@ -730,13 +730,13 @@  discard block
 block discarded – undo
730 730
 
731 731
 	function getComments()
732 732
 	{
733
-		if(!$this->getCommentCount()) return;
734
-		if(!$this->isGranted() && $this->isSecret()) return;
733
+		if (!$this->getCommentCount()) return;
734
+		if (!$this->isGranted() && $this->isSecret()) return;
735 735
 		// cpage is a number of comment pages
736 736
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
737 737
 		$cpage = Context::get($cpageStr);
738 738
 
739
-		if(!$cpage)
739
+		if (!$cpage)
740 740
 		{
741 741
 			$cpage = Context::get('cpage');
742 742
 		}
@@ -744,19 +744,19 @@  discard block
 block discarded – undo
744 744
 		// Get a list of comments
745 745
 		$oCommentModel = getModel('comment');
746 746
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
747
-		if(!$output->toBool() || !count($output->data)) return;
747
+		if (!$output->toBool() || !count($output->data)) return;
748 748
 		// Create commentItem object from a comment list
749 749
 		// If admin priviledge is granted on parent posts, you can read its child posts.
750 750
 		$accessible = array();
751 751
 		$comment_list = array();
752
-		foreach($output->data as $key => $val)
752
+		foreach ($output->data as $key => $val)
753 753
 		{
754 754
 			$oCommentItem = new commentItem();
755 755
 			$oCommentItem->setAttribute($val);
756 756
 			// If permission is granted to the post, you can access it temporarily
757
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
757
+			if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
758 758
 			// 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
759
-			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
759
+			if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true)
760 760
 			{
761 761
 				$oCommentItem->setAccessible();
762 762
 			}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		// Variable setting to be displayed on the skin
766 766
 		Context::set($cpageStr, $output->page_navigation->cur_page);
767 767
 		Context::set('cpage', $output->page_navigation->cur_page);
768
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
768
+		if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation;
769 769
 
770 770
 		return $comment_list;
771 771
 	}
@@ -777,9 +777,9 @@  discard block
 block discarded – undo
777 777
 
778 778
 	function getTrackbacks()
779 779
 	{
780
-		if(!$this->document_srl) return;
780
+		if (!$this->document_srl) return;
781 781
 
782
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
782
+		if (!$this->allowTrackback() || !$this->get('trackback_count')) return;
783 783
 
784 784
 		$oTrackbackModel = getModel('trackback');
785 785
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -787,30 +787,30 @@  discard block
 block discarded – undo
787 787
 
788 788
 	function thumbnailExists($width = 80, $height = 0, $type = '')
789 789
 	{
790
-		if(!$this->document_srl) return false;
791
-		if(!$this->getThumbnail($width, $height, $type)) return false;
790
+		if (!$this->document_srl) return false;
791
+		if (!$this->getThumbnail($width, $height, $type)) return false;
792 792
 		return true;
793 793
 	}
794 794
 
795 795
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
796 796
 	{
797 797
 		// Return false if the document doesn't exist
798
-		if(!$this->document_srl) return;
798
+		if (!$this->document_srl) return;
799 799
 
800
-		if($this->isSecret() && !$this->isGranted())
800
+		if ($this->isSecret() && !$this->isGranted())
801 801
 		{
802 802
 			return;
803 803
 		}
804 804
 
805 805
 		// If not specify its height, create a square
806
-		if(!$height) $height = $width;
806
+		if (!$height) $height = $width;
807 807
 		// Return false if neither attachement nor image files in the document
808
-		if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
808
+		if (!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
809 809
 		// Get thumbnai_type information from document module's configuration
810
-		if(!in_array($thumbnail_type, array('crop','ratio')))
810
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
811 811
 		{
812 812
 			$config = $GLOBALS['__document_config__'];
813
-			if(!$config)
813
+			if (!$config)
814 814
 			{
815 815
 				$oDocumentModel = getModel('document');
816 816
 				$config = $oDocumentModel->getDocumentConfig();
@@ -819,13 +819,13 @@  discard block
 block discarded – undo
819 819
 			$thumbnail_type = $config->thumbnail_type;
820 820
 		}
821 821
 		// Define thumbnail information
822
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
822
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
823 823
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
824 824
 		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
825 825
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
826
-		if(file_exists($thumbnail_file))
826
+		if (file_exists($thumbnail_file))
827 827
 		{
828
-			if(filesize($thumbnail_file)<1) return false;
828
+			if (filesize($thumbnail_file) < 1) return false;
829 829
 			else return $thumbnail_url;
830 830
 		}
831 831
 
@@ -834,33 +834,33 @@  discard block
 block discarded – undo
834 834
 		$is_tmp_file = false;
835 835
 
836 836
 		// Find an iamge file among attached files if exists
837
-		if($this->hasUploadedFiles())
837
+		if ($this->hasUploadedFiles())
838 838
 		{
839 839
 			$file_list = $this->getUploadedFiles();
840 840
 
841 841
 			$first_image = null;
842
-			foreach($file_list as $file)
842
+			foreach ($file_list as $file)
843 843
 			{
844
-				if($file->direct_download !== 'Y') continue;
844
+				if ($file->direct_download !== 'Y') continue;
845 845
 
846
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
846
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
847 847
 				{
848 848
 					$source_file = $file->uploaded_filename;
849 849
 					break;
850 850
 				}
851 851
 
852
-				if($first_image) continue;
852
+				if ($first_image) continue;
853 853
 
854
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
854
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
855 855
 				{
856
-					if(file_exists($file->uploaded_filename))
856
+					if (file_exists($file->uploaded_filename))
857 857
 					{
858 858
 						$first_image = $file->uploaded_filename;
859 859
 					}
860 860
 				}
861 861
 			}
862 862
 
863
-			if(!$source_file && $first_image)
863
+			if (!$source_file && $first_image)
864 864
 			{
865 865
 				$source_file = $first_image;
866 866
 			}
@@ -868,32 +868,32 @@  discard block
 block discarded – undo
868 868
 
869 869
 		// If not exists, file an image file from the content
870 870
 		$is_tmp_file = false;
871
-		if(!$source_file)
871
+		if (!$source_file)
872 872
 		{
873 873
 			$random = new Password();
874 874
 			$content = $this->get('content');
875 875
 
876 876
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
877 877
 
878
-			foreach($matches as $target_image)
878
+			foreach ($matches as $target_image)
879 879
 			{
880 880
 				$target_src = trim($target_image[1]);
881
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
881
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
882 882
 
883
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
883
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
884 884
 				{
885 885
 					$target_src = Context::getRequestUri().$target_src;
886 886
 				}
887 887
 
888 888
 				$target_src = htmlspecialchars_decode($target_src);
889 889
 
890
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
890
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
891 891
 				FileHandler::getRemoteFile($target_src, $tmp_file);
892
-				if(!file_exists($tmp_file)) continue;
892
+				if (!file_exists($tmp_file)) continue;
893 893
 
894 894
 				$imageinfo = getimagesize($tmp_file);
895 895
 				list($_w, $_h) = $imageinfo;
896
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
896
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
897 897
 					FileHandler::removeFile($tmp_file);
898 898
 					continue;
899 899
 				}
@@ -904,15 +904,15 @@  discard block
 block discarded – undo
904 904
 			}
905 905
 		}
906 906
 
907
-		if($source_file)
907
+		if ($source_file)
908 908
 		{
909 909
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
910 910
 		}
911
-		if($is_tmp_file) FileHandler::removeFile($source_file);
911
+		if ($is_tmp_file) FileHandler::removeFile($source_file);
912 912
 		// Return its path if a thumbnail is successfully genetated
913
-		if($output) return $thumbnail_url;
913
+		if ($output) return $thumbnail_url;
914 914
 		// Create an empty file not to re-generate the thumbnail
915
-		else FileHandler::writeFile($thumbnail_file, '','w');
915
+		else FileHandler::writeFile($thumbnail_file, '', 'w');
916 916
 
917 917
 		return;
918 918
 	}
@@ -925,21 +925,21 @@  discard block
 block discarded – undo
925 925
 	 */
926 926
 	function getExtraImages($time_interval = 43200)
927 927
 	{
928
-		if(!$this->document_srl) return;
928
+		if (!$this->document_srl) return;
929 929
 		// variables for icon list
930 930
 		$buffs = array();
931 931
 
932 932
 		$check_files = false;
933 933
 
934 934
 		// Check if secret post is
935
-		if($this->isSecret()) $buffs[] = "secret";
935
+		if ($this->isSecret()) $buffs[] = "secret";
936 936
 
937 937
 		// Set the latest time
938
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
938
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
939 939
 
940 940
 		// Check new post
941
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
942
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
941
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
942
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
943 943
 
944 944
 		/*
945 945
 		   $content = $this->get('content');
@@ -962,14 +962,14 @@  discard block
 block discarded – undo
962 962
 		 */
963 963
 
964 964
 		// Check the attachment
965
-		if($this->hasUploadedFiles()) $buffs[] = "file";
965
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
966 966
 
967 967
 		return $buffs;
968 968
 	}
969 969
 
970 970
 	function getStatus()
971 971
 	{
972
-		if(!$this->get('status')) return $this->getDefaultStatus();
972
+		if (!$this->get('status')) return $this->getDefaultStatus();
973 973
 		return $this->get('status');
974 974
 	}
975 975
 
@@ -980,15 +980,15 @@  discard block
 block discarded – undo
980 980
 	 */
981 981
 	function printExtraImages($time_check = 43200)
982 982
 	{
983
-		if(!$this->document_srl) return;
983
+		if (!$this->document_srl) return;
984 984
 		// Get the icon directory
985
-		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
985
+		$path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/');
986 986
 
987 987
 		$buffs = $this->getExtraImages($time_check);
988
-		if(!count($buffs)) return;
988
+		if (!count($buffs)) return;
989 989
 
990 990
 		$buff = array();
991
-		foreach($buffs as $key => $val)
991
+		foreach ($buffs as $key => $val)
992 992
 		{
993 993
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
994 994
 		}
@@ -997,20 +997,20 @@  discard block
 block discarded – undo
997 997
 
998 998
 	function hasUploadedFiles()
999 999
 	{
1000
-		if(!$this->document_srl) return;
1000
+		if (!$this->document_srl) return;
1001 1001
 
1002
-		if($this->isSecret() && !$this->isGranted()) return false;
1003
-		return $this->get('uploaded_count')? true : false;
1002
+		if ($this->isSecret() && !$this->isGranted()) return false;
1003
+		return $this->get('uploaded_count') ? true : false;
1004 1004
 	}
1005 1005
 
1006 1006
 	function getUploadedFiles($sortIndex = 'file_srl')
1007 1007
 	{
1008
-		if(!$this->document_srl) return;
1008
+		if (!$this->document_srl) return;
1009 1009
 
1010
-		if($this->isSecret() && !$this->isGranted()) return;
1011
-		if(!$this->get('uploaded_count')) return;
1010
+		if ($this->isSecret() && !$this->isGranted()) return;
1011
+		if (!$this->get('uploaded_count')) return;
1012 1012
 
1013
-		if(!$this->uploadedFiles[$sortIndex])
1013
+		if (!$this->uploadedFiles[$sortIndex])
1014 1014
 		{
1015 1015
 			$oFileModel = getModel('file');
1016 1016
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 	function getEditor()
1027 1027
 	{
1028 1028
 		$module_srl = $this->get('module_srl');
1029
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1029
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1030 1030
 
1031 1031
 		$oEditorModel = getModel('editor');
1032 1032
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	{
1042 1042
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1043 1043
 		if (!$this->allowComment()) return false;
1044
-		if(!$this->isGranted() && $this->isSecret()) return false;
1044
+		if (!$this->isGranted() && $this->isSecret()) return false;
1045 1045
 
1046 1046
 		return true;
1047 1047
 	}
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 	 */
1053 1053
 	function getCommentEditor()
1054 1054
 	{
1055
-		if(!$this->isEnableComment()) return;
1055
+		if (!$this->isEnableComment()) return;
1056 1056
 
1057 1057
 		$oEditorModel = getModel('editor');
1058 1058
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1064,10 +1064,10 @@  discard block
 block discarded – undo
1064 1064
 	 */
1065 1065
 	function getProfileImage()
1066 1066
 	{
1067
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1067
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1068 1068
 		$oMemberModel = getModel('member');
1069 1069
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1070
-		if(!$profile_info) return;
1070
+		if (!$profile_info) return;
1071 1071
 
1072 1072
 		return $profile_info->src;
1073 1073
 	}
@@ -1079,21 +1079,21 @@  discard block
 block discarded – undo
1079 1079
 	function getSignature()
1080 1080
 	{
1081 1081
 		// Pass if a document doesn't exist
1082
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1082
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1083 1083
 		// Get signature information
1084 1084
 		$oMemberModel = getModel('member');
1085 1085
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1086 1086
 		// Check if a maximum height of signiture is set in the member module
1087
-		if(!isset($GLOBALS['__member_signature_max_height']))
1087
+		if (!isset($GLOBALS['__member_signature_max_height']))
1088 1088
 		{
1089 1089
 			$oModuleModel = getModel('module');
1090 1090
 			$member_config = $oModuleModel->getModuleConfig('member');
1091 1091
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1092 1092
 		}
1093
-		if($signature)
1093
+		if ($signature)
1094 1094
 		{
1095 1095
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1096
-			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);
1096
+			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);
1097 1097
 		}
1098 1098
 
1099 1099
 		return $signature;
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 	 */
1107 1107
 	function replaceResourceRealPath($matches)
1108 1108
 	{
1109
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1109
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1110 1110
 	}
1111 1111
 
1112 1112
 	/**
@@ -1117,19 +1117,19 @@  discard block
 block discarded – undo
1117 1117
 	function _checkAccessibleFromStatus()
1118 1118
 	{
1119 1119
 		$logged_info = Context::get('logged_info');
1120
-		if($logged_info->is_admin == 'Y') return true;
1120
+		if ($logged_info->is_admin == 'Y') return true;
1121 1121
 
1122 1122
 		$status = $this->get('status');
1123
-		if(empty($status)) return false;
1123
+		if (empty($status)) return false;
1124 1124
 
1125 1125
 		$oDocumentModel = getModel('document');
1126 1126
 		$configStatusList = $oDocumentModel->getStatusList();
1127 1127
 
1128
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1128
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1129 1129
 			return true;
1130
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1130
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1131 1131
 		{
1132
-			if($this->get('member_srl') == $logged_info->member_srl)
1132
+			if ($this->get('member_srl') == $logged_info->member_srl)
1133 1133
 				return true;
1134 1134
 		}
1135 1135
 		return false;
Please login to merge, or discard this patch.
Braces   +276 added lines, -113 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	function _loadFromDB($load_extra_vars = true)
76 76
 	{
77
-		if(!$this->document_srl) return;
77
+		if(!$this->document_srl) {
78
+			return;
79
+		}
78 80
 
79 81
 		$document_item = false;
80 82
 		$cache_put = false;
@@ -106,8 +108,7 @@  discard block
 block discarded – undo
106 108
 			{
107 109
 				$oCacheHandler->put($cache_key, $document_item);
108 110
 			}
109
-		}
110
-		else
111
+		} else
111 112
 		{
112 113
 			$document_item->readed_count = $output->data->readed_count;
113 114
 			$document_item->voted_count = $output->data->voted_count;
@@ -154,18 +155,28 @@  discard block
 block discarded – undo
154 155
 
155 156
 	function isGranted()
156 157
 	{
157
-		if($_SESSION['own_document'][$this->document_srl]) return true;
158
+		if($_SESSION['own_document'][$this->document_srl]) {
159
+			return true;
160
+		}
158 161
 
159
-		if(!Context::get('is_logged')) return false;
162
+		if(!Context::get('is_logged')) {
163
+			return false;
164
+		}
160 165
 
161 166
 		$logged_info = Context::get('logged_info');
162
-		if($logged_info->is_admin == 'Y') return true;
167
+		if($logged_info->is_admin == 'Y') {
168
+			return true;
169
+		}
163 170
 
164 171
 		$oModuleModel = getModel('module');
165 172
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
166
-		if($grant->manager) return true;
173
+		if($grant->manager) {
174
+			return true;
175
+		}
167 176
 
168
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return true;
177
+		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) {
178
+			return true;
179
+		}
169 180
 
170 181
 		return false;
171 182
 	}
@@ -183,7 +194,9 @@  discard block
 block discarded – undo
183 194
 	function allowComment()
184 195
 	{
185 196
 		// init write, document is not exists. so allow comment status is true
186
-		if(!$this->isExists()) return true;
197
+		if(!$this->isExists()) {
198
+			return true;
199
+		}
187 200
 
188 201
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
189 202
 	}
@@ -198,8 +211,7 @@  discard block
 block discarded – undo
198 211
 			if(!getClass('trackback'))
199 212
 			{
200 213
 				$allow_trackback_status = false;
201
-			}
202
-			else
214
+			} else
203 215
 			{
204 216
 				// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
205 217
 				$oModuleModel = getModel('module');
@@ -210,15 +222,21 @@  discard block
 block discarded – undo
210 222
 					$trackback_config = new stdClass();
211 223
 				}
212 224
 				
213
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
214
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
215
-				else
225
+				if(!isset($trackback_config->enable_trackback)) {
226
+					$trackback_config->enable_trackback = 'Y';
227
+				}
228
+				if($trackback_config->enable_trackback != 'Y') {
229
+					$allow_trackback_status = false;
230
+				} else
216 231
 				{
217 232
 					$module_srl = $this->get('module_srl');
218 233
 					// Check settings of each module
219 234
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
220
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
221
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
235
+					if($module_config->enable_trackback == 'N') {
236
+						$allow_trackback_status = false;
237
+					} else if($this->get('allow_trackback')=='Y' || !$this->isExists()) {
238
+						$allow_trackback_status = true;
239
+					}
222 240
 				}
223 241
 			}
224 242
 		}
@@ -227,14 +245,18 @@  discard block
 block discarded – undo
227 245
 
228 246
 	function isLocked()
229 247
 	{
230
-		if(!$this->isExists()) return false;
248
+		if(!$this->isExists()) {
249
+			return false;
250
+		}
231 251
 
232 252
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
233 253
 	}
234 254
 
235 255
 	function isEditable()
236 256
 	{
237
-		if($this->isGranted() || !$this->get('member_srl')) return true;
257
+		if($this->isGranted() || !$this->get('member_srl')) {
258
+			return true;
259
+		}
238 260
 		return false;
239 261
 	}
240 262
 
@@ -256,9 +278,14 @@  discard block
 block discarded – undo
256 278
 
257 279
 	function doCart()
258 280
 	{
259
-		if(!$this->document_srl) return false;
260
-		if($this->isCarted()) $this->removeCart();
261
-		else $this->addCart();
281
+		if(!$this->document_srl) {
282
+			return false;
283
+		}
284
+		if($this->isCarted()) {
285
+			$this->removeCart();
286
+		} else {
287
+			$this->addCart();
288
+		}
262 289
 	}
263 290
 
264 291
 	function addCart()
@@ -284,16 +311,26 @@  discard block
 block discarded – undo
284 311
 	 */
285 312
 	function notify($type, $content)
286 313
 	{
287
-		if(!$this->document_srl) return;
314
+		if(!$this->document_srl) {
315
+			return;
316
+		}
288 317
 		// return if it is not useNotify
289
-		if(!$this->useNotify()) return;
318
+		if(!$this->useNotify()) {
319
+			return;
320
+		}
290 321
 		// Pass if an author is not a logged-in user
291
-		if(!$this->get('member_srl')) return;
322
+		if(!$this->get('member_srl')) {
323
+			return;
324
+		}
292 325
 		// Return if the currently logged-in user is an author
293 326
 		$logged_info = Context::get('logged_info');
294
-		if($logged_info->member_srl == $this->get('member_srl')) return;
327
+		if($logged_info->member_srl == $this->get('member_srl')) {
328
+			return;
329
+		}
295 330
 		// List variables
296
-		if($type) $title = "[".$type."] ";
331
+		if($type) {
332
+			$title = "[".$type."] ";
333
+		}
297 334
 		$title .= cut_str(strip_tags($content), 10, '...');
298 335
 		$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));
299 336
 		$receiver_srl = $this->get('member_srl');
@@ -320,16 +357,22 @@  discard block
 block discarded – undo
320 357
 
321 358
 	function isExistsHomepage()
322 359
 	{
323
-		if(trim($this->get('homepage'))) return true;
360
+		if(trim($this->get('homepage'))) {
361
+			return true;
362
+		}
324 363
 		return false;
325 364
 	}
326 365
 
327 366
 	function getHomepageUrl()
328 367
 	{
329 368
 		$url = trim($this->get('homepage'));
330
-		if(!$url) return;
369
+		if(!$url) {
370
+			return;
371
+		}
331 372
 
332
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
373
+		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) {
374
+			$url = 'http://' . $url;
375
+		}
333 376
 
334 377
 		return $url;
335 378
 	}
@@ -361,43 +404,65 @@  discard block
 block discarded – undo
361 404
 
362 405
 	function getTitleText($cut_size = 0, $tail='...')
363 406
 	{
364
-		if(!$this->document_srl) return;
407
+		if(!$this->document_srl) {
408
+			return;
409
+		}
365 410
 
366
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
367
-		else $title = $this->get('title');
411
+		if($cut_size) {
412
+			$title = cut_str($this->get('title'), $cut_size, $tail);
413
+		} else {
414
+			$title = $this->get('title');
415
+		}
368 416
 
369 417
 		return $title;
370 418
 	}
371 419
 
372 420
 	function getTitle($cut_size = 0, $tail='...')
373 421
 	{
374
-		if(!$this->document_srl) return;
422
+		if(!$this->document_srl) {
423
+			return;
424
+		}
375 425
 
376 426
 		$title = $this->getTitleText($cut_size, $tail);
377 427
 
378 428
 		$attrs = array();
379 429
 		$this->add('title_color', trim($this->get('title_color')));
380
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
381
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
430
+		if($this->get('title_bold')=='Y') {
431
+			$attrs[] = "font-weight:bold;";
432
+		}
433
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
434
+			$attrs[] = "color:#".$this->get('title_color');
435
+		}
382 436
 
383
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
384
-		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
437
+		if(count($attrs)) {
438
+			return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
439
+		} else {
440
+			return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
441
+		}
385 442
 	}
386 443
 
387 444
 	function getContentText($strlen = 0)
388 445
 	{
389
-		if(!$this->document_srl) return;
446
+		if(!$this->document_srl) {
447
+			return;
448
+		}
390 449
 
391
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
450
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
451
+			return Context::getLang('msg_is_secret');
452
+		}
392 453
 
393 454
 		$result = $this->_checkAccessibleFromStatus();
394
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
455
+		if($result) {
456
+			$_SESSION['accessible'][$this->document_srl] = true;
457
+		}
395 458
 
396 459
 		$content = $this->get('content');
397 460
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
398 461
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
399 462
 
400
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
463
+		if($strlen) {
464
+			return cut_str(strip_tags($content),$strlen,'...');
465
+		}
401 466
 
402 467
 		return htmlspecialchars($content);
403 468
 	}
@@ -430,14 +495,12 @@  discard block
 block discarded – undo
430 495
 				}
431 496
 				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
432 497
 			}
433
-		}
434
-		else if($m[1] == 'embed')
498
+		} else if($m[1] == 'embed')
435 499
 		{
436 500
 			if(stripos($m[0], 'allowscriptaccess'))
437 501
 			{
438 502
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
439
-			}
440
-			else
503
+			} else
441 504
 			{
442 505
 				$m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]);
443 506
 			}
@@ -447,15 +510,23 @@  discard block
 block discarded – undo
447 510
 
448 511
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
449 512
 	{
450
-		if(!$this->document_srl) return;
513
+		if(!$this->document_srl) {
514
+			return;
515
+		}
451 516
 
452
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
517
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
518
+			return Context::getLang('msg_is_secret');
519
+		}
453 520
 
454 521
 		$result = $this->_checkAccessibleFromStatus();
455
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
522
+		if($result) {
523
+			$_SESSION['accessible'][$this->document_srl] = true;
524
+		}
456 525
 
457 526
 		$content = $this->get('content');
458
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
527
+		if(!$stripEmbedTagException) {
528
+			stripEmbedTagForAdmin($content, $this->get('member_srl'));
529
+		}
459 530
 
460 531
 		// Define a link if using a rewrite module
461 532
 		$oContext = &Context::getInstance();
@@ -489,10 +560,11 @@  discard block
 block discarded – undo
489 560
 				$this->document_srl, $memberSrl
490 561
 			);
491 562
 			// Add xe_content class although accessing content is not required
492
-		}
493
-		else
563
+		} else
494 564
 		{
495
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
565
+			if($add_xe_content_class) {
566
+				$content = sprintf('<div class="xe_content">%s</div>', $content);
567
+			}
496 568
 		}
497 569
 		// Change the image path to a valid absolute path if resource_realpath is true
498 570
 		if($resource_realpath)
@@ -611,11 +683,15 @@  discard block
 block discarded – undo
611 683
 
612 684
 	function getTrackbackUrl()
613 685
 	{
614
-		if(!$this->document_srl) return;
686
+		if(!$this->document_srl) {
687
+			return;
688
+		}
615 689
 
616 690
 		// Generate a key to prevent spams
617 691
 		$oTrackbackModel = getModel('trackback');
618
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
692
+		if($oTrackbackModel) {
693
+			return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
694
+		}
619 695
 	}
620 696
 
621 697
 	/**
@@ -634,7 +710,9 @@  discard block
 block discarded – undo
634 710
 
635 711
 	function isExtraVarsExists()
636 712
 	{
637
-		if(!$this->get('module_srl')) return false;
713
+		if(!$this->get('module_srl')) {
714
+			return false;
715
+		}
638 716
 		$oDocumentModel = getModel('document');
639 717
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
640 718
 		return count($extra_keys)?true:false;
@@ -642,7 +720,9 @@  discard block
 block discarded – undo
642 720
 
643 721
 	function getExtraVars()
644 722
 	{
645
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
723
+		if(!$this->get('module_srl') || !$this->document_srl) {
724
+			return null;
725
+		}
646 726
 
647 727
 		$oDocumentModel = getModel('document');
648 728
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -654,8 +734,7 @@  discard block
 block discarded – undo
654 734
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
655 735
 		{
656 736
 			return $extra_vars[$idx]->getValue();
657
-		}
658
-		else
737
+		} else
659 738
 		{
660 739
 			return '';
661 740
 		}
@@ -667,8 +746,7 @@  discard block
 block discarded – undo
667 746
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
668 747
 		{
669 748
 			return $extra_vars[$idx]->getValueHTML();
670
-		}
671
-		else
749
+		} else
672 750
 		{
673 751
 			return '';
674 752
 		}
@@ -690,8 +768,7 @@  discard block
 block discarded – undo
690 768
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
691 769
 		{
692 770
 			return $extra_eid[$eid]->getValue();
693
-		}
694
-		else
771
+		} else
695 772
 		{
696 773
 			return '';
697 774
 		}
@@ -709,8 +786,7 @@  discard block
 block discarded – undo
709 786
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
710 787
 		{
711 788
 			return $extra_eid[$eid]->getValueHTML();
712
-		}
713
-		else
789
+		} else
714 790
 		{
715 791
 			return '';
716 792
 		}
@@ -730,8 +806,12 @@  discard block
 block discarded – undo
730 806
 
731 807
 	function getComments()
732 808
 	{
733
-		if(!$this->getCommentCount()) return;
734
-		if(!$this->isGranted() && $this->isSecret()) return;
809
+		if(!$this->getCommentCount()) {
810
+			return;
811
+		}
812
+		if(!$this->isGranted() && $this->isSecret()) {
813
+			return;
814
+		}
735 815
 		// cpage is a number of comment pages
736 816
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
737 817
 		$cpage = Context::get($cpageStr);
@@ -744,7 +824,9 @@  discard block
 block discarded – undo
744 824
 		// Get a list of comments
745 825
 		$oCommentModel = getModel('comment');
746 826
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
747
-		if(!$output->toBool() || !count($output->data)) return;
827
+		if(!$output->toBool() || !count($output->data)) {
828
+			return;
829
+		}
748 830
 		// Create commentItem object from a comment list
749 831
 		// If admin priviledge is granted on parent posts, you can read its child posts.
750 832
 		$accessible = array();
@@ -754,7 +836,9 @@  discard block
 block discarded – undo
754 836
 			$oCommentItem = new commentItem();
755 837
 			$oCommentItem->setAttribute($val);
756 838
 			// If permission is granted to the post, you can access it temporarily
757
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
839
+			if($oCommentItem->isGranted()) {
840
+				$accessible[$val->comment_srl] = true;
841
+			}
758 842
 			// 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
759 843
 			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
760 844
 			{
@@ -765,7 +849,9 @@  discard block
 block discarded – undo
765 849
 		// Variable setting to be displayed on the skin
766 850
 		Context::set($cpageStr, $output->page_navigation->cur_page);
767 851
 		Context::set('cpage', $output->page_navigation->cur_page);
768
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
852
+		if($output->total_page>1) {
853
+			$this->comment_page_navigation = $output->page_navigation;
854
+		}
769 855
 
770 856
 		return $comment_list;
771 857
 	}
@@ -777,9 +863,13 @@  discard block
 block discarded – undo
777 863
 
778 864
 	function getTrackbacks()
779 865
 	{
780
-		if(!$this->document_srl) return;
866
+		if(!$this->document_srl) {
867
+			return;
868
+		}
781 869
 
782
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
870
+		if(!$this->allowTrackback() || !$this->get('trackback_count')) {
871
+			return;
872
+		}
783 873
 
784 874
 		$oTrackbackModel = getModel('trackback');
785 875
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -787,15 +877,21 @@  discard block
 block discarded – undo
787 877
 
788 878
 	function thumbnailExists($width = 80, $height = 0, $type = '')
789 879
 	{
790
-		if(!$this->document_srl) return false;
791
-		if(!$this->getThumbnail($width, $height, $type)) return false;
880
+		if(!$this->document_srl) {
881
+			return false;
882
+		}
883
+		if(!$this->getThumbnail($width, $height, $type)) {
884
+			return false;
885
+		}
792 886
 		return true;
793 887
 	}
794 888
 
795 889
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
796 890
 	{
797 891
 		// Return false if the document doesn't exist
798
-		if(!$this->document_srl) return;
892
+		if(!$this->document_srl) {
893
+			return;
894
+		}
799 895
 
800 896
 		if($this->isSecret() && !$this->isGranted())
801 897
 		{
@@ -803,9 +899,13 @@  discard block
 block discarded – undo
803 899
 		}
804 900
 
805 901
 		// If not specify its height, create a square
806
-		if(!$height) $height = $width;
902
+		if(!$height) {
903
+			$height = $width;
904
+		}
807 905
 		// Return false if neither attachement nor image files in the document
808
-		if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
906
+		if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) {
907
+			return;
908
+		}
809 909
 		// Get thumbnai_type information from document module's configuration
810 910
 		if(!in_array($thumbnail_type, array('crop','ratio')))
811 911
 		{
@@ -825,8 +925,11 @@  discard block
 block discarded – undo
825 925
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
826 926
 		if(file_exists($thumbnail_file))
827 927
 		{
828
-			if(filesize($thumbnail_file)<1) return false;
829
-			else return $thumbnail_url;
928
+			if(filesize($thumbnail_file)<1) {
929
+				return false;
930
+			} else {
931
+				return $thumbnail_url;
932
+			}
830 933
 		}
831 934
 
832 935
 		// Target File
@@ -841,7 +944,9 @@  discard block
 block discarded – undo
841 944
 			$first_image = null;
842 945
 			foreach($file_list as $file)
843 946
 			{
844
-				if($file->direct_download !== 'Y') continue;
947
+				if($file->direct_download !== 'Y') {
948
+					continue;
949
+				}
845 950
 
846 951
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
847 952
 				{
@@ -849,7 +954,9 @@  discard block
 block discarded – undo
849 954
 					break;
850 955
 				}
851 956
 
852
-				if($first_image) continue;
957
+				if($first_image) {
958
+					continue;
959
+				}
853 960
 
854 961
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
855 962
 				{
@@ -878,7 +985,9 @@  discard block
 block discarded – undo
878 985
 			foreach($matches as $target_image)
879 986
 			{
880 987
 				$target_src = trim($target_image[1]);
881
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
988
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
989
+					continue;
990
+				}
882 991
 
883 992
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
884 993
 				{
@@ -889,7 +998,9 @@  discard block
 block discarded – undo
889 998
 
890 999
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
891 1000
 				FileHandler::getRemoteFile($target_src, $tmp_file);
892
-				if(!file_exists($tmp_file)) continue;
1001
+				if(!file_exists($tmp_file)) {
1002
+					continue;
1003
+				}
893 1004
 
894 1005
 				$imageinfo = getimagesize($tmp_file);
895 1006
 				list($_w, $_h) = $imageinfo;
@@ -908,11 +1019,17 @@  discard block
 block discarded – undo
908 1019
 		{
909 1020
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
910 1021
 		}
911
-		if($is_tmp_file) FileHandler::removeFile($source_file);
1022
+		if($is_tmp_file) {
1023
+			FileHandler::removeFile($source_file);
1024
+		}
912 1025
 		// Return its path if a thumbnail is successfully genetated
913
-		if($output) return $thumbnail_url;
1026
+		if($output) {
1027
+			return $thumbnail_url;
1028
+		}
914 1029
 		// Create an empty file not to re-generate the thumbnail
915
-		else FileHandler::writeFile($thumbnail_file, '','w');
1030
+		else {
1031
+			FileHandler::writeFile($thumbnail_file, '','w');
1032
+		}
916 1033
 
917 1034
 		return;
918 1035
 	}
@@ -925,21 +1042,28 @@  discard block
 block discarded – undo
925 1042
 	 */
926 1043
 	function getExtraImages($time_interval = 43200)
927 1044
 	{
928
-		if(!$this->document_srl) return;
1045
+		if(!$this->document_srl) {
1046
+			return;
1047
+		}
929 1048
 		// variables for icon list
930 1049
 		$buffs = array();
931 1050
 
932 1051
 		$check_files = false;
933 1052
 
934 1053
 		// Check if secret post is
935
-		if($this->isSecret()) $buffs[] = "secret";
1054
+		if($this->isSecret()) {
1055
+			$buffs[] = "secret";
1056
+		}
936 1057
 
937 1058
 		// Set the latest time
938 1059
 		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
939 1060
 
940 1061
 		// Check new post
941
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
942
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
1062
+		if($this->get('regdate')>$time_check) {
1063
+			$buffs[] = "new";
1064
+		} else if($this->get('last_update')>$time_check) {
1065
+			$buffs[] = "update";
1066
+		}
943 1067
 
944 1068
 		/*
945 1069
 		   $content = $this->get('content');
@@ -962,14 +1086,18 @@  discard block
 block discarded – undo
962 1086
 		 */
963 1087
 
964 1088
 		// Check the attachment
965
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1089
+		if($this->hasUploadedFiles()) {
1090
+			$buffs[] = "file";
1091
+		}
966 1092
 
967 1093
 		return $buffs;
968 1094
 	}
969 1095
 
970 1096
 	function getStatus()
971 1097
 	{
972
-		if(!$this->get('status')) return $this->getDefaultStatus();
1098
+		if(!$this->get('status')) {
1099
+			return $this->getDefaultStatus();
1100
+		}
973 1101
 		return $this->get('status');
974 1102
 	}
975 1103
 
@@ -980,12 +1108,16 @@  discard block
 block discarded – undo
980 1108
 	 */
981 1109
 	function printExtraImages($time_check = 43200)
982 1110
 	{
983
-		if(!$this->document_srl) return;
1111
+		if(!$this->document_srl) {
1112
+			return;
1113
+		}
984 1114
 		// Get the icon directory
985 1115
 		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
986 1116
 
987 1117
 		$buffs = $this->getExtraImages($time_check);
988
-		if(!count($buffs)) return;
1118
+		if(!count($buffs)) {
1119
+			return;
1120
+		}
989 1121
 
990 1122
 		$buff = array();
991 1123
 		foreach($buffs as $key => $val)
@@ -997,18 +1129,28 @@  discard block
 block discarded – undo
997 1129
 
998 1130
 	function hasUploadedFiles()
999 1131
 	{
1000
-		if(!$this->document_srl) return;
1132
+		if(!$this->document_srl) {
1133
+			return;
1134
+		}
1001 1135
 
1002
-		if($this->isSecret() && !$this->isGranted()) return false;
1136
+		if($this->isSecret() && !$this->isGranted()) {
1137
+			return false;
1138
+		}
1003 1139
 		return $this->get('uploaded_count')? true : false;
1004 1140
 	}
1005 1141
 
1006 1142
 	function getUploadedFiles($sortIndex = 'file_srl')
1007 1143
 	{
1008
-		if(!$this->document_srl) return;
1144
+		if(!$this->document_srl) {
1145
+			return;
1146
+		}
1009 1147
 
1010
-		if($this->isSecret() && !$this->isGranted()) return;
1011
-		if(!$this->get('uploaded_count')) return;
1148
+		if($this->isSecret() && !$this->isGranted()) {
1149
+			return;
1150
+		}
1151
+		if(!$this->get('uploaded_count')) {
1152
+			return;
1153
+		}
1012 1154
 
1013 1155
 		if(!$this->uploadedFiles[$sortIndex])
1014 1156
 		{
@@ -1026,7 +1168,9 @@  discard block
 block discarded – undo
1026 1168
 	function getEditor()
1027 1169
 	{
1028 1170
 		$module_srl = $this->get('module_srl');
1029
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1171
+		if(!$module_srl) {
1172
+			$module_srl = Context::get('module_srl');
1173
+		}
1030 1174
 
1031 1175
 		$oEditorModel = getModel('editor');
1032 1176
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1040,8 +1184,12 @@  discard block
 block discarded – undo
1040 1184
 	function isEnableComment()
1041 1185
 	{
1042 1186
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1043
-		if (!$this->allowComment()) return false;
1044
-		if(!$this->isGranted() && $this->isSecret()) return false;
1187
+		if (!$this->allowComment()) {
1188
+			return false;
1189
+		}
1190
+		if(!$this->isGranted() && $this->isSecret()) {
1191
+			return false;
1192
+		}
1045 1193
 
1046 1194
 		return true;
1047 1195
 	}
@@ -1052,7 +1200,9 @@  discard block
 block discarded – undo
1052 1200
 	 */
1053 1201
 	function getCommentEditor()
1054 1202
 	{
1055
-		if(!$this->isEnableComment()) return;
1203
+		if(!$this->isEnableComment()) {
1204
+			return;
1205
+		}
1056 1206
 
1057 1207
 		$oEditorModel = getModel('editor');
1058 1208
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1064,10 +1214,14 @@  discard block
 block discarded – undo
1064 1214
 	 */
1065 1215
 	function getProfileImage()
1066 1216
 	{
1067
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1217
+		if(!$this->isExists() || !$this->get('member_srl')) {
1218
+			return;
1219
+		}
1068 1220
 		$oMemberModel = getModel('member');
1069 1221
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1070
-		if(!$profile_info) return;
1222
+		if(!$profile_info) {
1223
+			return;
1224
+		}
1071 1225
 
1072 1226
 		return $profile_info->src;
1073 1227
 	}
@@ -1079,7 +1233,9 @@  discard block
 block discarded – undo
1079 1233
 	function getSignature()
1080 1234
 	{
1081 1235
 		// Pass if a document doesn't exist
1082
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1236
+		if(!$this->isExists() || !$this->get('member_srl')) {
1237
+			return;
1238
+		}
1083 1239
 		// Get signature information
1084 1240
 		$oMemberModel = getModel('member');
1085 1241
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1093,7 +1249,9 @@  discard block
 block discarded – undo
1093 1249
 		if($signature)
1094 1250
 		{
1095 1251
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1096
-			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);
1252
+			if($max_signature_height) {
1253
+				$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);
1254
+			}
1097 1255
 		}
1098 1256
 
1099 1257
 		return $signature;
@@ -1117,20 +1275,25 @@  discard block
 block discarded – undo
1117 1275
 	function _checkAccessibleFromStatus()
1118 1276
 	{
1119 1277
 		$logged_info = Context::get('logged_info');
1120
-		if($logged_info->is_admin == 'Y') return true;
1278
+		if($logged_info->is_admin == 'Y') {
1279
+			return true;
1280
+		}
1121 1281
 
1122 1282
 		$status = $this->get('status');
1123
-		if(empty($status)) return false;
1283
+		if(empty($status)) {
1284
+			return false;
1285
+		}
1124 1286
 
1125 1287
 		$oDocumentModel = getModel('document');
1126 1288
 		$configStatusList = $oDocumentModel->getStatusList();
1127 1289
 
1128
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1129
-			return true;
1130
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1290
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1291
+					return true;
1292
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1131 1293
 		{
1132
-			if($this->get('member_srl') == $logged_info->member_srl)
1133
-				return true;
1294
+			if($this->get('member_srl') == $logged_info->member_srl) {
1295
+							return true;
1296
+			}
1134 1297
 		}
1135 1298
 		return false;
1136 1299
 	}
Please login to merge, or discard this patch.
modules/document/document.class.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 * Search option to use in admin page
18 18
 	 * @var array
19 19
 	 */
20
-	var $search_option = array('title','content','title_content','user_name',); // /< Search options
20
+	var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options
21 21
 	/**
22 22
 	 * Status list
23 23
 	 * @var array
@@ -34,22 +34,22 @@  discard block
 block discarded – undo
34 34
 		$oModuleController = getController('module');
35 35
 
36 36
 		$oDB = &DB::getInstance();
37
-		$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
38
-		$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
39
-		$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
40
-		$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
41
-		$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
42
-		$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
43
-		$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
44
-		$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true);
45
-		$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
37
+		$oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order"));
38
+		$oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order"));
39
+		$oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count"));
40
+		$oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count"));
41
+		$oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice"));
42
+		$oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl"));
43
+		$oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count"));
44
+		$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true);
45
+		$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true);
46 46
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
47 47
 		$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
48 48
 
49 49
 		// 2009. 01. 29 Added a trigger for additional setup
50 50
 		$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
51 51
 
52
-		if(!is_dir('./files/cache/tmp'))
52
+		if (!is_dir('./files/cache/tmp'))
53 53
 		{
54 54
 			FileHandler::makeDir('./files/cache/tmp');
55 55
 		}
@@ -66,68 +66,68 @@  discard block
 block discarded – undo
66 66
 		$oModuleModel = getModel('module');
67 67
 
68 68
 		// 2007. 7. 25: Add a column(notify_message) for notification
69
-		if(!$oDB->isColumnExists("documents","notify_message")) return true;
69
+		if (!$oDB->isColumnExists("documents", "notify_message")) return true;
70 70
 
71 71
 		// 2007. 8. 23: create a clustered index in the document table
72
-		if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true;
73
-		if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
74
-		if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
75
-		if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
72
+		if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true;
73
+		if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true;
74
+		if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true;
75
+		if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true;
76 76
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
77
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
77
+		if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
78 78
 		// 2007. 10. 25 add parent_srl, expand to the document category
79
-		if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
80
-		if(!$oDB->isColumnExists("document_categories","expand")) return true;
81
-		if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
79
+		if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true;
80
+		if (!$oDB->isColumnExists("document_categories", "expand")) return true;
81
+		if (!$oDB->isColumnExists("document_categories", "group_srls")) return true;
82 82
 		// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
83
-		if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
83
+		if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true;
84 84
 		// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
85
-		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
85
+		if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true;
86 86
 
87 87
 		// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
88
-		if(!$oDB->isColumnExists("documents","extra_vars")) return true;
88
+		if (!$oDB->isColumnExists("documents", "extra_vars")) return true;
89 89
 		// 2008. 04. 23 Add a column(blamed_count)
90
-		if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
91
-		if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
92
-		if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
90
+		if (!$oDB->isColumnExists("documents", "blamed_count")) return true;
91
+		if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true;
92
+		if (!$oDB->isColumnExists("document_voted_log", "point")) return true;
93 93
 		// 2008-12-15 Add a column(color)
94
-		if(!$oDB->isColumnExists("document_categories", "color")) return true;
94
+		if (!$oDB->isColumnExists("document_categories", "color")) return true;
95 95
 
96 96
 		/**
97 97
 		 * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
98 98
 		 */
99
-		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
99
+		if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true;
100 100
 
101
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
101
+		if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
102 102
 		// 2009. 03. 09 Add a column(lang_code) to the documnets table
103
-		if(!$oDB->isColumnExists("documents","lang_code")) return true;
103
+		if (!$oDB->isColumnExists("documents", "lang_code")) return true;
104 104
 		// 2009. 03. 11 check the index in the document_extra_vars table
105
-		if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
105
+		if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
106 106
 
107 107
 		// 2009. 03. 19: Add a column(eid) if not exist in the table
108
-		if(!$oDB->isColumnExists("document_extra_keys","eid")) return true;
109
-		if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
108
+		if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true;
109
+		if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true;
110 110
 
111 111
 		// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
112
-		if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
112
+		if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
113 113
 
114 114
 		//2011. 04. 07 adding description column to document categories
115
-		if(!$oDB->isColumnExists("document_categories","description")) return true;
115
+		if (!$oDB->isColumnExists("document_categories", "description")) return true;
116 116
 
117 117
 		//2011. 05. 23 adding status column to document
118
-		if(!$oDB->isColumnExists('documents', 'status')) return true;
118
+		if (!$oDB->isColumnExists('documents', 'status')) return true;
119 119
 
120 120
 		//2011. 06. 07 check comment status update
121
-		if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
121
+		if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
122 122
 
123 123
 		// 2011. 10. 25 status index check
124
-		if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
124
+		if (!$oDB->isIndexExists("documents", "idx_module_status")) return true;
125 125
 
126 126
 		// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
127
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
127
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
128 128
 
129 129
 		// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
130
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
130
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true;
131 131
 
132 132
 		return false;
133 133
 	}
@@ -143,98 +143,98 @@  discard block
 block discarded – undo
143 143
 		$oModuleController = getController('module');
144 144
 
145 145
 		// 2007. 7. 25: Add a column(notify_message) for notification
146
-		if(!$oDB->isColumnExists("documents","notify_message"))
146
+		if (!$oDB->isColumnExists("documents", "notify_message"))
147 147
 		{
148
-			$oDB->addColumn('documents',"notify_message","char",1);
148
+			$oDB->addColumn('documents', "notify_message", "char", 1);
149 149
 		}
150 150
 
151 151
 		// 2007. 8. 23: create a clustered index in the document table
152
-		if(!$oDB->isIndexExists("documents","idx_module_list_order"))
152
+		if (!$oDB->isIndexExists("documents", "idx_module_list_order"))
153 153
 		{
154
-			$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
154
+			$oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order"));
155 155
 		}
156 156
 
157
-		if(!$oDB->isIndexExists("documents","idx_module_update_order"))
157
+		if (!$oDB->isIndexExists("documents", "idx_module_update_order"))
158 158
 		{
159
-			$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
159
+			$oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order"));
160 160
 		}
161 161
 
162
-		if(!$oDB->isIndexExists("documents","idx_module_readed_count"))
162
+		if (!$oDB->isIndexExists("documents", "idx_module_readed_count"))
163 163
 		{
164
-			$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
164
+			$oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count"));
165 165
 		}
166 166
 
167
-		if(!$oDB->isIndexExists("documents","idx_module_voted_count"))
167
+		if (!$oDB->isIndexExists("documents", "idx_module_voted_count"))
168 168
 		{
169
-			$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
169
+			$oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count"));
170 170
 		}
171 171
 		// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
172
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
172
+		if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
173 173
 			$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
174 174
 		// 2007. 10. 25 add columns(parent_srl, expand) 
175
-		if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
176
-		if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
177
-		if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
175
+		if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0);
176
+		if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N");
177
+		if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text");
178 178
 		// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
179
-		if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
179
+		if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice"));
180 180
 
181 181
 		// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
182
-		if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text');
182
+		if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text');
183 183
 
184 184
 		// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
185
-		if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
185
+		if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl"));
186 186
 		// 2008. 04. 23 Add a column(blamed count)
187
-		if(!$oDB->isColumnExists("documents", "blamed_count"))
187
+		if (!$oDB->isColumnExists("documents", "blamed_count"))
188 188
 		{
189 189
 			$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
190 190
 			$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
191 191
 		}
192 192
 
193
-		if(!$oDB->isIndexExists("documents","idx_module_blamed_count"))
193
+		if (!$oDB->isIndexExists("documents", "idx_module_blamed_count"))
194 194
 		{
195 195
 			$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
196 196
 		}
197 197
 
198
-		if(!$oDB->isColumnExists("document_voted_log", "point"))
198
+		if (!$oDB->isColumnExists("document_voted_log", "point"))
199 199
 			$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
200 200
 
201 201
 
202
-		if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7);
202
+		if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7);
203 203
 
204 204
 		// 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
205
-		if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
205
+		if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10);
206 206
 
207 207
 		// 2009. 01. 29 Added a trigger for additional setup
208
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
208
+		if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
209 209
 			$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
210 210
 		// 2009. 03. 09 Add a column(lang_code) to the documnets table
211
-		if(!$oDB->isColumnExists("documents","lang_code"))
211
+		if (!$oDB->isColumnExists("documents", "lang_code"))
212 212
 		{
213 213
 			$db_info = Context::getDBInfo();
214
-			$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
214
+			$oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code);
215 215
 			$obj->lang_code = $db_info->lang_type;
216 216
 			executeQuery('document.updateDocumentsLangCode', $obj);
217 217
 		}
218 218
 		// 2009. 03. 11 Check the index in the document_extra_vars table
219
-		if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars"))
219
+		if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars"))
220 220
 		{
221
-			$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
221
+			$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true);
222 222
 		}
223 223
 
224
-		if($oDB->isIndexExists("document_extra_vars", "unique_module_vars"))
224
+		if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars"))
225 225
 		{
226 226
 			$oDB->dropIndex("document_extra_vars", "unique_module_vars", true);
227 227
 		}
228 228
 
229 229
 		// 2009. 03. 19: Add a column(eid)
230 230
 		// 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
231
-		if(!$oDB->isColumnExists("document_extra_keys","eid"))
231
+		if (!$oDB->isColumnExists("document_extra_keys", "eid"))
232 232
 		{
233
-			$oDB->addColumn("document_extra_keys","eid","varchar",40);
233
+			$oDB->addColumn("document_extra_keys", "eid", "varchar", 40);
234 234
 
235 235
 			$output = executeQuery('document.getGroupsExtraKeys', $obj);
236
-			if($output->toBool() && $output->data && count($output->data)) {
237
-				foreach($output->data as $extra_keys) {
236
+			if ($output->toBool() && $output->data && count($output->data)) {
237
+				foreach ($output->data as $extra_keys) {
238 238
 					$args->module_srl = $extra_keys->module_srl;
239 239
 					$args->var_idx = $extra_keys->idx;
240 240
 					$args->new_eid = "extra_vars".$extra_keys->idx;
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 			}
244 244
 		}
245 245
 
246
-		if(!$oDB->isColumnExists("document_extra_vars","eid"))
246
+		if (!$oDB->isColumnExists("document_extra_vars", "eid"))
247 247
 		{
248
-			$oDB->addColumn("document_extra_vars","eid","varchar",40);
248
+			$oDB->addColumn("document_extra_vars", "eid", "varchar", 40);
249 249
 			$obj->var_idx = '-1,-2';
250 250
 			$output = executeQuery('document.getGroupsExtraVars', $obj);
251
-			if($output->toBool() && $output->data && count($output->data))
251
+			if ($output->toBool() && $output->data && count($output->data))
252 252
 			{
253
-				foreach($output->data as $extra_vars)
253
+				foreach ($output->data as $extra_vars)
254 254
 				{
255 255
 					$args->module_srl = $extra_vars->module_srl;
256 256
 					$args->var_idx = $extra_vars->idx;
@@ -261,16 +261,16 @@  discard block
 block discarded – undo
261 261
 		}
262 262
 
263 263
 		// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
264
-		if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order"))
264
+		if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order"))
265 265
 		{
266
-			$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false);
266
+			$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false);
267 267
 		}
268 268
 
269 269
 		//2011. 04. 07 adding description column to document categories
270
-		if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0);
270
+		if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0);
271 271
 
272 272
 		//2011. 05. 23 adding status column to document
273
-		if(!$oDB->isColumnExists('documents', 'status'))
273
+		if (!$oDB->isColumnExists('documents', 'status'))
274 274
 		{
275 275
 			$oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC');
276 276
 			$args->is_secret = 'Y';
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 		}
279 279
 
280 280
 		// 2011. 09. 08 drop column document is_secret
281
-		if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
281
+		if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
282 282
 			$oDB->dropColumn('documents', 'is_secret');
283 283
 
284 284
 		//2011. 06. 07 merge column, allow_comment and lock_comment
285
-		if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
285
+		if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
286 286
 		{
287 287
 			$oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW');
288 288
 
@@ -304,28 +304,28 @@  discard block
 block discarded – undo
304 304
 			$output = executeQuery('document.updateDocumentCommentStatus', $args);
305 305
 		}
306 306
 
307
-		if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
307
+		if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
308 308
 			$oDB->dropColumn('documents', 'allow_comment');
309 309
 
310
-		if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
310
+		if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
311 311
 			$oDB->dropColumn('documents', 'lock_comment');
312 312
 
313
-		if(!$oDB->isIndexExists("documents", "idx_module_status"))
314
-			$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
313
+		if (!$oDB->isIndexExists("documents", "idx_module_status"))
314
+			$oDB->addIndex("documents", "idx_module_status", array("module_srl", "status"));
315 315
 
316 316
 		// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied 
317
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
317
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
318 318
 		{
319 319
 			$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
320 320
 		}
321 321
 
322 322
 		// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
323
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
323
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'))
324 324
 		{
325 325
 			$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after');
326 326
 		}
327 327
 
328
-		return new Object(0,'success_updated');
328
+		return new Object(0, 'success_updated');
329 329
 	}
330 330
 
331 331
 	/**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	function recompileCache()
336 336
 	{
337
-		if(!is_dir('./files/cache/tmp'))
337
+		if (!is_dir('./files/cache/tmp'))
338 338
 		{
339 339
 			FileHandler::makeDir('./files/cache/tmp');
340 340
 		}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	function getConfigStatus($key)
366 366
 	{
367
-		if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
367
+		if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
368 368
 		else $this->getDefaultStatus();
369 369
 	}
370 370
 }
Please login to merge, or discard this patch.
modules/comment/comment.item.php 2 patches
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	function _loadFromDB()
51 51
 	{
52
-		if(!$this->comment_srl)
52
+		if (!$this->comment_srl)
53 53
 		{
54 54
 			return;
55 55
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	function setAttribute($attribute)
69 69
 	{
70
-		if(!$attribute->comment_srl)
70
+		if (!$attribute->comment_srl)
71 71
 		{
72 72
 			$this->comment_srl = NULL;
73 73
 			return;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 		$this->adds($attribute);
78 78
 
79 79
 		// define vars on the object for backward compatibility of skins
80
-		if(count($attribute))
80
+		if (count($attribute))
81 81
 		{
82
-			foreach($attribute as $key => $val)
82
+			foreach ($attribute as $key => $val)
83 83
 			{
84 84
 				$this->{$key} = $val;
85 85
 			}
@@ -93,29 +93,29 @@  discard block
 block discarded – undo
93 93
 
94 94
 	function isGranted()
95 95
 	{
96
-		if($_SESSION['own_comment'][$this->comment_srl])
96
+		if ($_SESSION['own_comment'][$this->comment_srl])
97 97
 		{
98 98
 			return TRUE;
99 99
 		}
100 100
 
101
-		if(!Context::get('is_logged'))
101
+		if (!Context::get('is_logged'))
102 102
 		{
103 103
 			return FALSE;
104 104
 		}
105 105
 
106 106
 		$logged_info = Context::get('logged_info');
107
-		if($logged_info->is_admin == 'Y')
107
+		if ($logged_info->is_admin == 'Y')
108 108
 		{
109 109
 			return TRUE;
110 110
 		}
111 111
 
112 112
 		$grant = Context::get('grant');
113
-		if($grant->manager)
113
+		if ($grant->manager)
114 114
 		{
115 115
 			return TRUE;
116 116
 		}
117 117
 
118
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
118
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
119 119
 		{
120 120
 			return TRUE;
121 121
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 	function isEditable()
138 138
 	{
139
-		if($this->isGranted() || !$this->get('member_srl'))
139
+		if ($this->isGranted() || !$this->get('member_srl'))
140 140
 		{
141 141
 			return TRUE;
142 142
 		}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 
151 151
 	function isAccessible()
152 152
 	{
153
-		if($_SESSION['accessibled_comment'][$this->comment_srl])
153
+		if ($_SESSION['accessibled_comment'][$this->comment_srl])
154 154
 		{
155 155
 			return TRUE;
156 156
 		}
157 157
 
158
-		if($this->isGranted() || !$this->isSecret())
158
+		if ($this->isGranted() || !$this->isSecret())
159 159
 		{
160 160
 			$this->setAccessible();
161 161
 			return TRUE;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 		$oDocumentModel = getModel('document');
165 165
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
166
-		if($oDocument->isGranted())
166
+		if ($oDocument->isGranted())
167 167
 		{
168 168
 			$this->setAccessible();
169 169
 			return TRUE;
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
 	function notify($type, $content)
185 185
 	{
186 186
 		// return if not useNotify
187
-		if(!$this->useNotify())
187
+		if (!$this->useNotify())
188 188
 		{
189 189
 			return;
190 190
 		}
191 191
 
192 192
 		// pass if the author is not logged-in user 
193
-		if(!$this->get('member_srl'))
193
+		if (!$this->get('member_srl'))
194 194
 		{
195 195
 			return;
196 196
 		}
197 197
 
198 198
 		// return if the currently logged-in user is an author of the comment.
199 199
 		$logged_info = Context::get('logged_info');
200
-		if($logged_info->member_srl == $this->get('member_srl'))
200
+		if ($logged_info->member_srl == $this->get('member_srl'))
201 201
 		{
202 202
 			return;
203 203
 		}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
208 208
 
209 209
 		// Variables
210
-		if($type)
210
+		if ($type)
211 211
 		{
212
-			$title = "[" . $type . "] ";
212
+			$title = "[".$type."] ";
213 213
 		}
214 214
 
215 215
 		$title .= cut_str(strip_tags($content), 30, '...');
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 
225 225
 	function getIpAddress()
226 226
 	{
227
-		if($this->isGranted())
227
+		if ($this->isGranted())
228 228
 		{
229 229
 			return $this->get('ipaddress');
230 230
 		}
231 231
 
232
-		return '*' . strstr($this->get('ipaddress'), '.');
232
+		return '*'.strstr($this->get('ipaddress'), '.');
233 233
 	}
234 234
 
235 235
 	function isExistsHomepage()
236 236
 	{
237
-		if(trim($this->get('homepage')))
237
+		if (trim($this->get('homepage')))
238 238
 		{
239 239
 			return TRUE;
240 240
 		}
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 	function getHomepageUrl()
246 246
 	{
247 247
 		$url = trim($this->get('homepage'));
248
-		if(!$url)
248
+		if (!$url)
249 249
 		{
250 250
 			return;
251 251
 		}
252 252
 
253
-		if(strncasecmp('http://', $url, 7) !== 0)
253
+		if (strncasecmp('http://', $url, 7) !== 0)
254 254
 		{
255
-			$url = "http://" . $url;
255
+			$url = "http://".$url;
256 256
 		}
257 257
 
258 258
 		return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	function getContentText($strlen = 0)
286 286
 	{
287
-		if($this->isSecret() && !$this->isAccessible())
287
+		if ($this->isSecret() && !$this->isAccessible())
288 288
 		{
289 289
 			return Context::getLang('msg_is_secret');
290 290
 		}
291 291
 
292 292
 		$content = $this->get('content');
293 293
 
294
-		if($strlen)
294
+		if ($strlen)
295 295
 		{
296 296
 			return cut_str(strip_tags($content), $strlen, '...');
297 297
 		}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE)
307 307
 	{
308
-		if($this->isSecret() && !$this->isAccessible())
308
+		if ($this->isSecret() && !$this->isAccessible())
309 309
 		{
310 310
 			return Context::getLang('msg_is_secret');
311 311
 		}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		stripEmbedTagForAdmin($content, $this->get('member_srl'));
315 315
 
316 316
 		// when displaying the comment on the pop-up menu
317
-		if($add_popup_menu && Context::get('is_logged'))
317
+		if ($add_popup_menu && Context::get('is_logged'))
318 318
 		{
319 319
 			$content = sprintf(
320 320
 					'%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do')
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 		}
323 323
 
324 324
 		// if additional information which can access contents is set
325
-		if($add_content_info)
325
+		if ($add_content_info)
326 326
 		{
327 327
 			$memberSrl = $this->get('member_srl');
328
-			if($memberSrl < 0)
328
+			if ($memberSrl < 0)
329 329
 			{
330 330
 				$memberSrl = 0;
331 331
 			}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 		else
338 338
 		{
339
-			if($add_xe_content_class)
339
+			if ($add_xe_content_class)
340 340
 			{
341 341
 				$content = sprintf('<div class="xe_content">%s</div>', $content);
342 342
 			}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 	function getRegdateGM()
398 398
 	{
399
-		return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone'];
399
+		return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone'];
400 400
 	}
401 401
 
402 402
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 	function getPermanentUrl()
408 408
 	{
409
-		return getFullUrl('', 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl');
409
+		return getFullUrl('', 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl');
410 410
 	}
411 411
 
412 412
 	function getUpdateTime()
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
 	function hasUploadedFiles()
429 429
 	{
430
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
430
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
431 431
 		{
432 432
 			return FALSE;
433 433
 		}
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
 
437 437
 	function getUploadedFiles()
438 438
 	{
439
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
439
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
440 440
 		{
441 441
 			return;
442 442
 		}
443 443
 
444
-		if(!$this->get('uploaded_count'))
444
+		if (!$this->get('uploaded_count'))
445 445
 		{
446 446
 			return;
447 447
 		}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	function getEditor()
459 459
 	{
460 460
 		$module_srl = $this->get('module_srl');
461
-		if(!$module_srl)
461
+		if (!$module_srl)
462 462
 		{
463 463
 			$module_srl = Context::get('module_srl');
464 464
 		}
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
 	 */
473 473
 	function getProfileImage()
474 474
 	{
475
-		if(!$this->isExists() || !$this->get('member_srl'))
475
+		if (!$this->isExists() || !$this->get('member_srl'))
476 476
 		{
477 477
 			return;
478 478
 		}
479 479
 		$oMemberModel = getModel('member');
480 480
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
481
-		if(!$profile_info)
481
+		if (!$profile_info)
482 482
 		{
483 483
 			return;
484 484
 		}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	function getSignature()
494 494
 	{
495 495
 		// pass if the posting not exists.
496
-		if(!$this->isExists() || !$this->get('member_srl'))
496
+		if (!$this->isExists() || !$this->get('member_srl'))
497 497
 		{
498 498
 			return;
499 499
 		}
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
504 504
 
505 505
 		// check if max height of the signiture is specified on the member module
506
-		if(!isset($GLOBALS['__member_signature_max_height']))
506
+		if (!isset($GLOBALS['__member_signature_max_height']))
507 507
 		{
508 508
 			$oModuleModel = getModel('module');
509 509
 			$member_config = $oModuleModel->getModuleConfig('member');
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$max_signature_height = $GLOBALS['__member_signature_max_height'];
514 514
 
515
-		if($max_signature_height)
515
+		if ($max_signature_height)
516 516
 		{
517 517
 			$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);
518 518
 		}
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 
523 523
 	function thumbnailExists($width = 80, $height = 0, $type = '')
524 524
 	{
525
-		if(!$this->comment_srl)
525
+		if (!$this->comment_srl)
526 526
 		{
527 527
 			return FALSE;
528 528
 		}
529 529
 
530
-		if(!$this->getThumbnail($width, $height, $type))
530
+		if (!$this->getThumbnail($width, $height, $type))
531 531
 		{
532 532
 			return FALSE;
533 533
 		}
@@ -538,30 +538,30 @@  discard block
 block discarded – undo
538 538
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
539 539
 	{
540 540
 		// return false if no doc exists
541
-		if(!$this->comment_srl)
541
+		if (!$this->comment_srl)
542 542
 		{
543 543
 			return;
544 544
 		}
545 545
 
546
-		if($this->isSecret() && !$this->isGranted())
546
+		if ($this->isSecret() && !$this->isGranted())
547 547
 		{
548 548
 			return;
549 549
 		}
550 550
 
551 551
 		// If signiture height setting is omitted, create a square
552
-		if(!$height)
552
+		if (!$height)
553 553
 		{
554 554
 			$height = $width;
555 555
 		}
556 556
 
557 557
 		// return false if neigher attached file nor image;
558
-		if(!$this->hasUploadedFiles() && !preg_match("!<img!is", $this->get('content')))
558
+		if (!$this->hasUploadedFiles() && !preg_match("!<img!is", $this->get('content')))
559 559
 		{
560 560
 			return;
561 561
 		}
562 562
 
563 563
 		// get thumbail generation info on the doc module configuration.
564
-		if(!in_array($thumbnail_type, array('crop', 'ratio')))
564
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
565 565
 		{
566 566
 			$thumbnail_type = 'crop';
567 567
 		}
@@ -569,12 +569,12 @@  discard block
 block discarded – undo
569 569
 		// Define thumbnail information
570 570
 		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3));
571 571
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
572
-		$thumbnail_url = Context::getRequestUri() . $thumbnail_file;
572
+		$thumbnail_url = Context::getRequestUri().$thumbnail_file;
573 573
 
574 574
 		// return false if a size of existing thumbnail file is 0. otherwise return the file path
575
-		if(file_exists($thumbnail_file))
575
+		if (file_exists($thumbnail_file))
576 576
 		{
577
-			if(filesize($thumbnail_file) < 1)
577
+			if (filesize($thumbnail_file) < 1)
578 578
 			{
579 579
 				return FALSE;
580 580
 			}
@@ -589,33 +589,33 @@  discard block
 block discarded – undo
589 589
 		$is_tmp_file = FALSE;
590 590
 
591 591
 		// find an image file among attached files
592
-		if($this->hasUploadedFiles())
592
+		if ($this->hasUploadedFiles())
593 593
 		{
594 594
 			$file_list = $this->getUploadedFiles();
595 595
 
596 596
 			$first_image = null;
597
-			foreach($file_list as $file)
597
+			foreach ($file_list as $file)
598 598
 			{
599
-				if($file->direct_download !== 'Y') continue;
599
+				if ($file->direct_download !== 'Y') continue;
600 600
 
601
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
601
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
602 602
 				{
603 603
 					$source_file = $file->uploaded_filename;
604 604
 					break;
605 605
 				}
606 606
 
607
-				if($first_image) continue;
607
+				if ($first_image) continue;
608 608
 
609
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
609
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
610 610
 				{
611
-					if(file_exists($file->uploaded_filename))
611
+					if (file_exists($file->uploaded_filename))
612 612
 					{
613 613
 						$first_image = $file->uploaded_filename;
614 614
 					}
615 615
 				}
616 616
 			}
617 617
 
618
-			if(!$source_file && $first_image)
618
+			if (!$source_file && $first_image)
619 619
 			{
620 620
 				$source_file = $first_image;
621 621
 			}
@@ -623,32 +623,32 @@  discard block
 block discarded – undo
623 623
 
624 624
 		// get an image file from the doc content if no file attached. 
625 625
 		$is_tmp_file = false;
626
-		if(!$source_file)
626
+		if (!$source_file)
627 627
 		{
628 628
 			$random = new Password();
629 629
 			$content = $this->get('content');
630 630
 
631 631
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
632 632
 
633
-			foreach($matches as $target_image)
633
+			foreach ($matches as $target_image)
634 634
 			{
635 635
 				$target_src = trim($target_image[1]);
636
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
636
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
637 637
 
638
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
638
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
639 639
 				{
640 640
 					$target_src = Context::getRequestUri().$target_src;
641 641
 				}
642 642
 
643 643
 				$target_src = htmlspecialchars_decode($target_src);
644 644
 
645
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
645
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
646 646
 				FileHandler::getRemoteFile($target_src, $tmp_file);
647
-				if(!file_exists($tmp_file)) continue;
647
+				if (!file_exists($tmp_file)) continue;
648 648
 
649 649
 				$imageinfo = getimagesize($tmp_file);
650 650
 				list($_w, $_h) = $imageinfo;
651
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
651
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
652 652
 					FileHandler::removeFile($tmp_file);
653 653
 					continue;
654 654
 				}
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
 
662 662
 		$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
663 663
 
664
-		if($is_tmp_file)
664
+		if ($is_tmp_file)
665 665
 		{
666 666
 			FileHandler::removeFile($source_file);
667 667
 		}
668 668
 
669 669
 		// return the thumbnail path if successfully generated.
670
-		if($output)
670
+		if ($output)
671 671
 		{
672 672
 			return $thumbnail_url;
673 673
 		}
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -333,8 +333,7 @@  discard block
 block discarded – undo
333 333
 					'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', $this->comment_srl, $memberSrl, $this->comment_srl, $memberSrl, $content, $this->comment_srl, $memberSrl
334 334
 			);
335 335
 			// xe_content class name should be specified although content access is not necessary.
336
-		}
337
-		else
336
+		} else
338 337
 		{
339 338
 			if($add_xe_content_class)
340 339
 			{
@@ -577,8 +576,7 @@  discard block
 block discarded – undo
577 576
 			if(filesize($thumbnail_file) < 1)
578 577
 			{
579 578
 				return FALSE;
580
-			}
581
-			else
579
+			} else
582 580
 			{
583 581
 				return $thumbnail_url;
584 582
 			}
@@ -596,7 +594,9 @@  discard block
 block discarded – undo
596 594
 			$first_image = null;
597 595
 			foreach($file_list as $file)
598 596
 			{
599
-				if($file->direct_download !== 'Y') continue;
597
+				if($file->direct_download !== 'Y') {
598
+					continue;
599
+				}
600 600
 
601 601
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
602 602
 				{
@@ -604,7 +604,9 @@  discard block
 block discarded – undo
604 604
 					break;
605 605
 				}
606 606
 
607
-				if($first_image) continue;
607
+				if($first_image) {
608
+					continue;
609
+				}
608 610
 
609 611
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
610 612
 				{
@@ -633,7 +635,9 @@  discard block
 block discarded – undo
633 635
 			foreach($matches as $target_image)
634 636
 			{
635 637
 				$target_src = trim($target_image[1]);
636
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
638
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
639
+					continue;
640
+				}
637 641
 
638 642
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
639 643
 				{
@@ -644,7 +648,9 @@  discard block
 block discarded – undo
644 648
 
645 649
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
646 650
 				FileHandler::getRemoteFile($target_src, $tmp_file);
647
-				if(!file_exists($tmp_file)) continue;
651
+				if(!file_exists($tmp_file)) {
652
+					continue;
653
+				}
648 654
 
649 655
 				$imageinfo = getimagesize($tmp_file);
650 656
 				list($_w, $_h) = $imageinfo;
Please login to merge, or discard this patch.
modules/comment/comment.class.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/comment/comment.item.php');
4
+require_once(_XE_PATH_.'modules/comment/comment.item.php');
5 5
 
6 6
 /**
7 7
  * comment
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		// 2008. 02. 22 add comment setting when a new module added
37 37
 		$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
38 38
 
39
-		if(!is_dir('./files/cache/tmp'))
39
+		if (!is_dir('./files/cache/tmp'))
40 40
 		{
41 41
 			FileHandler::makeDir('./files/cache/tmp');
42 42
 		}
@@ -53,55 +53,55 @@  discard block
 block discarded – undo
53 53
 		$oDB = DB::getInstance();
54 54
 		$oModuleModel = getModel('module');
55 55
 		// 2007. 10. 17 add a trigger to delete comments together with posting deleted
56
-		if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
56
+		if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
57 57
 		{
58 58
 			return TRUE;
59 59
 		}
60 60
 		// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
61
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
61
+		if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
62 62
 		{
63 63
 			return TRUE;
64 64
 		}
65 65
 		// 2007. 10. 23 add a column for recommendation votes or notification of the comments
66
-		if(!$oDB->isColumnExists("comments", "voted_count"))
66
+		if (!$oDB->isColumnExists("comments", "voted_count"))
67 67
 		{
68 68
 			return TRUE;
69 69
 		}
70
-		if(!$oDB->isColumnExists("comments", "notify_message"))
70
+		if (!$oDB->isColumnExists("comments", "notify_message"))
71 71
 		{
72 72
 			return TRUE;
73 73
 		}
74 74
 		// 2008. 02. 22 add comment setting when a new module added
75
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
75
+		if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
76 76
 		{
77 77
 			return TRUE;
78 78
 		}
79 79
 		// 2008. 05. 14 add a column for blamed count
80
-		if(!$oDB->isColumnExists("comments", "blamed_count"))
80
+		if (!$oDB->isColumnExists("comments", "blamed_count"))
81 81
 		{
82 82
 			return TRUE;
83 83
 		}
84
-		if(!$oDB->isColumnExists("comment_voted_log", "point"))
84
+		if (!$oDB->isColumnExists("comment_voted_log", "point"))
85 85
 		{
86 86
 			return TRUE;
87 87
 		}
88 88
 
89
-		if(!$oDB->isIndexExists("comments", "idx_module_list_order"))
89
+		if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
90 90
 		{
91 91
 			return TRUE;
92 92
 		}
93 93
 		//2012. 02. 24 add comment published status column and index
94
-		if(!$oDB->isColumnExists("comments", "status"))
94
+		if (!$oDB->isColumnExists("comments", "status"))
95 95
 		{
96 96
 			return TRUE;
97 97
 		}
98
-		if(!$oDB->isIndexExists("comments", "idx_status"))
98
+		if (!$oDB->isIndexExists("comments", "idx_status"))
99 99
 		{
100 100
 			return TRUE;
101 101
 		}
102 102
 
103 103
 		// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
104
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
104
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
105 105
 		{
106 106
 			return TRUE;
107 107
 		}
@@ -119,43 +119,43 @@  discard block
 block discarded – undo
119 119
 		$oModuleModel = getModel('module');
120 120
 		$oModuleController = getController('module');
121 121
 		// 2007. 10. 17 add a trigger to delete comments together with posting deleted
122
-		if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
122
+		if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
123 123
 		{
124 124
 			$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
125 125
 		}
126 126
 		// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
127
-		if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
127
+		if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
128 128
 		{
129 129
 			$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
130 130
 		}
131 131
 		// 2007. 10. 23 add a column for recommendation votes or notification of the comments
132
-		if(!$oDB->isColumnExists("comments", "voted_count"))
132
+		if (!$oDB->isColumnExists("comments", "voted_count"))
133 133
 		{
134 134
 			$oDB->addColumn("comments", "voted_count", "number", "11");
135 135
 			$oDB->addIndex("comments", "idx_voted_count", array("voted_count"));
136 136
 		}
137 137
 
138
-		if(!$oDB->isColumnExists("comments", "notify_message"))
138
+		if (!$oDB->isColumnExists("comments", "notify_message"))
139 139
 		{
140 140
 			$oDB->addColumn("comments", "notify_message", "char", "1");
141 141
 		}
142 142
 		// 2008. 02. 22 add comment setting when a new module added
143
-		if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
143
+		if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
144 144
 		{
145 145
 			$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
146 146
 		}
147 147
 		// 2008. 05. 14 add a column for blamed count
148
-		if(!$oDB->isColumnExists("comments", "blamed_count"))
148
+		if (!$oDB->isColumnExists("comments", "blamed_count"))
149 149
 		{
150 150
 			$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, TRUE);
151 151
 			$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
152 152
 		}
153
-		if(!$oDB->isColumnExists("comment_voted_log", "point"))
153
+		if (!$oDB->isColumnExists("comment_voted_log", "point"))
154 154
 		{
155 155
 			$oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, TRUE);
156 156
 		}
157 157
 
158
-		if(!$oDB->isIndexExists("comments", "idx_module_list_order"))
158
+		if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
159 159
 		{
160 160
 			$oDB->addIndex(
161 161
 					"comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 		}
164 164
 
165 165
 		//2012. 02. 24 add comment published status column and index
166
-		if(!$oDB->isColumnExists("comments", "status"))
166
+		if (!$oDB->isColumnExists("comments", "status"))
167 167
 		{
168 168
 			$oDB->addColumn("comments", "status", "number", 1, 1, TRUE);
169 169
 		}
170
-		if(!$oDB->isIndexExists("comments", "idx_status"))
170
+		if (!$oDB->isIndexExists("comments", "idx_status"))
171 171
 		{
172 172
 			$oDB->addIndex(
173 173
 					"comments", "idx_status", array("status", "comment_srl", "module_srl", "document_srl"), TRUE
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		}
176 176
 
177 177
 		// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
178
-		if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
178
+		if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
179 179
 		{
180 180
 			$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
181 181
 		}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	function recompileCache()
191 191
 	{
192
-		if(!is_dir('./files/cache/tmp'))
192
+		if (!is_dir('./files/cache/tmp'))
193 193
 		{
194 194
 			FileHandler::makeDir('./files/cache/tmp');
195 195
 		}
Please login to merge, or discard this patch.
classes/file/FileHandler.class.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function getRealPath($source)
19 19
 	{
20
-		if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
20
+		if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
21 21
 		{
22
-			return _XE_PATH_ . substr($source, 2);
22
+			return _XE_PATH_.substr($source, 2);
23 23
 		}
24 24
 
25 25
 		return $source;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$source_dir = self::getRealPath($source_dir);
42 42
 		$target_dir = self::getRealPath($target_dir);
43
-		if(!is_dir($source_dir))
43
+		if (!is_dir($source_dir))
44 44
 		{
45 45
 			return FALSE;
46 46
 		}
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
 		// generate when no target exists
49 49
 		self::makeDir($target_dir);
50 50
 
51
-		if(substr($source_dir, -1) != DIRECTORY_SEPARATOR)
51
+		if (substr($source_dir, -1) != DIRECTORY_SEPARATOR)
52 52
 		{
53 53
 			$source_dir .= DIRECTORY_SEPARATOR;
54 54
 		}
55 55
 
56
-		if(substr($target_dir, -1) != DIRECTORY_SEPARATOR)
56
+		if (substr($target_dir, -1) != DIRECTORY_SEPARATOR)
57 57
 		{
58 58
 			$target_dir .= DIRECTORY_SEPARATOR;
59 59
 		}
60 60
 
61 61
 		$oDir = dir($source_dir);
62
-		while($file = $oDir->read())
62
+		while ($file = $oDir->read())
63 63
 		{
64
-			if($file{0} == '.')
64
+			if ($file{0} == '.')
65 65
 			{
66 66
 				continue;
67 67
 			}
68 68
 
69
-			if($filter && preg_match($filter, $file))
69
+			if ($filter && preg_match($filter, $file))
70 70
 			{
71 71
 				continue;
72 72
 			}
73 73
 
74
-			if(is_dir($source_dir . $file))
74
+			if (is_dir($source_dir.$file))
75 75
 			{
76
-				self::copyDir($source_dir . $file, $target_dir . $file, $type);
76
+				self::copyDir($source_dir.$file, $target_dir.$file, $type);
77 77
 			}
78 78
 			else
79 79
 			{
80
-				if($type == 'force')
80
+				if ($type == 'force')
81 81
 				{
82
-					@unlink($target_dir . $file);
82
+					@unlink($target_dir.$file);
83 83
 				}
84 84
 				else
85 85
 				{
86
-					if(!file_exists($target_dir . $file))
86
+					if (!file_exists($target_dir.$file))
87 87
 					{
88
-						@copy($source_dir . $file, $target_dir . $file);
88
+						@copy($source_dir.$file, $target_dir.$file);
89 89
 					}
90 90
 				}
91 91
 			}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
 		self::makeDir($target_dir);
112 112
 
113
-		if($force == 'Y')
113
+		if ($force == 'Y')
114 114
 		{
115
-			@unlink($target_dir . DIRECTORY_SEPARATOR . $target);
115
+			@unlink($target_dir.DIRECTORY_SEPARATOR.$target);
116 116
 		}
117 117
 
118
-		@copy($source, $target_dir . DIRECTORY_SEPARATOR . $target);
118
+		@copy($source, $target_dir.DIRECTORY_SEPARATOR.$target);
119 119
 	}
120 120
 
121 121
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	function readFile($filename)
128 128
 	{
129
-		if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
129
+		if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
130 130
 		{
131 131
 			return;
132 132
 		}
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 		self::makeDir($pathinfo['dirname']);
150 150
 
151 151
 		$flags = 0;
152
-		if(strtolower($mode) == 'a')
152
+		if (strtolower($mode) == 'a')
153 153
 		{
154 154
 			$flags = FILE_APPEND;
155 155
 		}
156 156
 
157
-		@file_put_contents($filename, $buff, $flags|LOCK_EX);
157
+		@file_put_contents($filename, $buff, $flags | LOCK_EX);
158 158
 		@chmod($filename, 0644);
159 159
 	}
160 160
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	function moveFile($source, $target)
194 194
 	{
195
-		if(($source = self::exists($source)) !== FALSE)
195
+		if (($source = self::exists($source)) !== FALSE)
196 196
 		{
197 197
 			self::removeFile($target);
198 198
 			return self::rename($source, $target);
@@ -230,35 +230,35 @@  discard block
 block discarded – undo
230 230
 		$path = self::getRealPath($path);
231 231
 		$output = array();
232 232
 
233
-		if(substr($path, -1) != '/')
233
+		if (substr($path, -1) != '/')
234 234
 		{
235 235
 			$path .= '/';
236 236
 		}
237 237
 
238
-		if(!is_dir($path))
238
+		if (!is_dir($path))
239 239
 		{
240 240
 			return $output;
241 241
 		}
242 242
 
243 243
 		$files = scandir($path);
244
-		foreach($files as $file)
244
+		foreach ($files as $file)
245 245
 		{
246
-			if($file{0} == '.' || ($filter && !preg_match($filter, $file)))
246
+			if ($file{0} == '.' || ($filter && !preg_match($filter, $file)))
247 247
 			{
248 248
 				continue;
249 249
 			}
250 250
 
251
-			if($to_lower)
251
+			if ($to_lower)
252 252
 			{
253 253
 				$file = strtolower($file);
254 254
 			}
255 255
 
256
-			if($filter)
256
+			if ($filter)
257 257
 			{
258 258
 				$file = preg_replace($filter, '$1', $file);
259 259
 			}
260 260
 
261
-			if($concat_prefix)
261
+			if ($concat_prefix)
262 262
 			{
263 263
 				$file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file);
264 264
 			}
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	function makeDir($path_string)
281 281
 	{
282
-		if(self::exists($path_string) !== FALSE)
282
+		if (self::exists($path_string) !== FALSE)
283 283
 		{
284 284
 			return TRUE;
285 285
 		}
286 286
 
287
-		if(!ini_get('safe_mode'))
287
+		if (!ini_get('safe_mode'))
288 288
 		{
289 289
 			@mkdir($path_string, 0755, TRUE);
290 290
 			@chmod($path_string, 0755);
@@ -295,35 +295,35 @@  discard block
 block discarded – undo
295 295
 			static $oFtp = NULL;
296 296
 
297 297
 			$ftp_info = Context::getFTPInfo();
298
-			if($oFtp == NULL)
298
+			if ($oFtp == NULL)
299 299
 			{
300
-				if(!Context::isFTPRegisted())
300
+				if (!Context::isFTPRegisted())
301 301
 				{
302 302
 					return;
303 303
 				}
304 304
 
305
-				require_once(_XE_PATH_ . 'libs/ftp.class.php');
305
+				require_once(_XE_PATH_.'libs/ftp.class.php');
306 306
 				$oFtp = new ftp();
307
-				if(!$ftp_info->ftp_host)
307
+				if (!$ftp_info->ftp_host)
308 308
 				{
309 309
 					$ftp_info->ftp_host = "127.0.0.1";
310 310
 				}
311
-				if(!$ftp_info->ftp_port)
311
+				if (!$ftp_info->ftp_port)
312 312
 				{
313 313
 					$ftp_info->ftp_port = 21;
314 314
 				}
315
-				if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
315
+				if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
316 316
 				{
317 317
 					return;
318 318
 				}
319
-				if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
319
+				if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
320 320
 				{
321 321
 					$oFtp->ftp_quit();
322 322
 					return;
323 323
 				}
324 324
 			}
325 325
 
326
-			if(!($ftp_path = $ftp_info->ftp_root_path))
326
+			if (!($ftp_path = $ftp_info->ftp_root_path))
327 327
 			{
328 328
 				$ftp_path = DIRECTORY_SEPARATOR;
329 329
 			}
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
 			$path_list = explode(DIRECTORY_SEPARATOR, $path_string);
333 333
 
334 334
 			$path = _XE_PATH_;
335
-			for($i = 0, $c = count($path_list); $i < $c; $i++)
335
+			for ($i = 0, $c = count($path_list); $i < $c; $i++)
336 336
 			{
337
-				if(!$path_list[$i])
337
+				if (!$path_list[$i])
338 338
 				{
339 339
 					continue;
340 340
 				}
341 341
 
342
-				$path .= $path_list[$i] . DIRECTORY_SEPARATOR;
343
-				$ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR;
344
-				if(!is_dir($path))
342
+				$path .= $path_list[$i].DIRECTORY_SEPARATOR;
343
+				$ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR;
344
+				if (!is_dir($path))
345 345
 				{
346 346
 					$oFtp->ftp_mkdir($ftp_path);
347
-					$oFtp->ftp_site("CHMOD 777 " . $ftp_path);
347
+					$oFtp->ftp_site("CHMOD 777 ".$ftp_path);
348 348
 				}
349 349
 			}
350 350
 		}
@@ -360,23 +360,23 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	function removeDir($path)
362 362
 	{
363
-		if(($path = self::isDir($path)) === FALSE)
363
+		if (($path = self::isDir($path)) === FALSE)
364 364
 		{
365 365
 			return;
366 366
 		}
367 367
 
368
-		if(self::isDir($path))
368
+		if (self::isDir($path))
369 369
 		{
370 370
 			$files = array_diff(scandir($path), array('..', '.'));
371 371
 
372
-			foreach($files as $file)
372
+			foreach ($files as $file)
373 373
 			{
374
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
374
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
375 375
 				{
376 376
 					continue;
377 377
 				}
378 378
 
379
-				if(is_dir($target))
379
+				if (is_dir($target))
380 380
 				{
381 381
 					self::removeDir($target);
382 382
 				}
@@ -401,22 +401,22 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	function removeBlankDir($path)
403 403
 	{
404
-		if(($path = self::isDir($path)) === FALSE)
404
+		if (($path = self::isDir($path)) === FALSE)
405 405
 		{
406 406
 			return;
407 407
 		}
408 408
 
409 409
 		$files = array_diff(scandir($path), array('..', '.'));
410 410
 
411
-		if(count($files) < 1)
411
+		if (count($files) < 1)
412 412
 		{
413 413
 			rmdir($path);
414 414
 			return;
415 415
 		}
416 416
 
417
-		foreach($files as $file)
417
+		foreach ($files as $file)
418 418
 		{
419
-			if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
419
+			if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
420 420
 			{
421 421
 				continue;
422 422
 			}
@@ -435,23 +435,23 @@  discard block
 block discarded – undo
435 435
 	 */
436 436
 	function removeFilesInDir($path)
437 437
 	{
438
-		if(($path = self::getRealPath($path)) === FALSE)
438
+		if (($path = self::getRealPath($path)) === FALSE)
439 439
 		{
440 440
 			return;
441 441
 		}
442 442
 
443
-		if(is_dir($path))
443
+		if (is_dir($path))
444 444
 		{
445 445
 			$files = array_diff(scandir($path), array('..', '.'));
446 446
 
447
-			foreach($files as $file)
447
+			foreach ($files as $file)
448 448
 			{
449
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
449
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
450 450
 				{
451 451
 					continue;
452 452
 				}
453 453
 
454
-				if(is_dir($target))
454
+				if (is_dir($target))
455 455
 				{
456 456
 					self::removeFilesInDir($target);
457 457
 				}
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 		else
465 465
 		{
466
-			if(self::exists($path)) unlink($path);
466
+			if (self::exists($path)) unlink($path);
467 467
 		}
468 468
 
469 469
 	}
@@ -477,22 +477,22 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	function filesize($size)
479 479
 	{
480
-		if(!$size)
480
+		if (!$size)
481 481
 		{
482 482
 			return '0Byte';
483 483
 		}
484 484
 
485
-		if($size === 1)
485
+		if ($size === 1)
486 486
 		{
487 487
 			return '1Byte';
488 488
 		}
489 489
 
490
-		if($size < 1024)
490
+		if ($size < 1024)
491 491
 		{
492
-			return $size . 'Bytes';
492
+			return $size.'Bytes';
493 493
 		}
494 494
 
495
-		if($size >= 1024 && $size < 1024 * 1024)
495
+		if ($size >= 1024 && $size < 1024 * 1024)
496 496
 		{
497 497
 			return sprintf("%0.1fKB", $size / 1024);
498 498
 		}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
519 519
 	{
520
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
520
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
521 521
 		$IDN = new idna_convert(array('idn_version' => 2008));
522 522
 		$url = $IDN->encode($url);
523 523
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 			require_once('HTTP/Request.php');
528 528
 
529 529
 			$parsed_url = parse_url(__PROXY_SERVER__);
530
-			if($parsed_url["host"])
530
+			if ($parsed_url["host"])
531 531
 			{
532 532
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
533 533
 				$oRequest->setMethod('POST');
@@ -537,49 +537,49 @@  discard block
 block discarded – undo
537 537
 			{
538 538
 				$oRequest = new HTTP_Request($url);
539 539
 
540
-				if(count($request_config) && method_exists($oRequest, 'setConfig'))
540
+				if (count($request_config) && method_exists($oRequest, 'setConfig'))
541 541
 				{
542
-					foreach($request_config as $key=>$val)
542
+					foreach ($request_config as $key=>$val)
543 543
 					{
544 544
 						$oRequest->setConfig($key, $val);
545 545
 					}
546 546
 				}
547 547
 
548
-				if(count($headers) > 0)
548
+				if (count($headers) > 0)
549 549
 				{
550
-					foreach($headers as $key => $val)
550
+					foreach ($headers as $key => $val)
551 551
 					{
552 552
 						$oRequest->addHeader($key, $val);
553 553
 					}
554 554
 				}
555
-				if($cookies[$host])
555
+				if ($cookies[$host])
556 556
 				{
557
-					foreach($cookies[$host] as $key => $val)
557
+					foreach ($cookies[$host] as $key => $val)
558 558
 					{
559 559
 						$oRequest->addCookie($key, $val);
560 560
 					}
561 561
 				}
562
-				if(count($post_data) > 0)
562
+				if (count($post_data) > 0)
563 563
 				{
564
-					foreach($post_data as $key => $val)
564
+					foreach ($post_data as $key => $val)
565 565
 					{
566 566
 						$oRequest->addPostData($key, $val);
567 567
 					}
568 568
 				}
569
-				if(!$content_type)
569
+				if (!$content_type)
570 570
 					$oRequest->addHeader('Content-Type', 'text/html');
571 571
 				else
572 572
 					$oRequest->addHeader('Content-Type', $content_type);
573 573
 				$oRequest->setMethod($method);
574
-				if($body)
574
+				if ($body)
575 575
 					$oRequest->setBody($body);
576 576
 			}
577 577
 			
578
-			if(method_exists($oRequest, 'setConfig'))
578
+			if (method_exists($oRequest, 'setConfig'))
579 579
 			{
580 580
 				$oRequest->setConfig('timeout', $timeout);
581 581
 			}
582
-			elseif(property_exists($oRequest, '_timeout'))
582
+			elseif (property_exists($oRequest, '_timeout'))
583 583
 			{
584 584
 				$oRequest->_timeout = $timeout;
585 585
 			}
@@ -589,25 +589,25 @@  discard block
 block discarded – undo
589 589
 			$code = $oRequest->getResponseCode();
590 590
 			$header = $oRequest->getResponseHeader();
591 591
 			$response = $oRequest->getResponseBody();
592
-			if($c = $oRequest->getResponseCookies())
592
+			if ($c = $oRequest->getResponseCookies())
593 593
 			{
594
-				foreach($c as $k => $v)
594
+				foreach ($c as $k => $v)
595 595
 				{
596 596
 					$cookies[$host][$v['name']] = $v['value'];
597 597
 				}
598 598
 			}
599 599
 
600
-			if($code > 300 && $code < 399 && $header['location'])
600
+			if ($code > 300 && $code < 399 && $header['location'])
601 601
 			{
602 602
 				return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
603 603
 			}
604 604
 
605
-			if($code != 200)
605
+			if ($code != 200)
606 606
 				return;
607 607
 
608 608
 			return $response;
609 609
 		}
610
-		catch(Exception $e)
610
+		catch (Exception $e)
611 611
 		{
612 612
 			return NULL;
613 613
 		}
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 	 */
628 628
 	function getRemoteFile($url, $target_filename, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
629 629
 	{
630
-		if(!($body = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers,$cookies,$post_data,$request_config)))
630
+		if (!($body = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config)))
631 631
 		{
632 632
 			return FALSE;
633 633
 		}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	function returnBytes($val)
647 647
 	{
648 648
 		$unit = strtoupper(substr($val, -1));
649
-		$val = (float)$val;
649
+		$val = (float) $val;
650 650
 
651 651
 		switch ($unit)
652 652
 		{
@@ -669,13 +669,13 @@  discard block
 block discarded – undo
669 669
 		$K64 = 65536;
670 670
 		$TWEAKFACTOR = 2.0;
671 671
 		$channels = $imageInfo['channels'];
672
-		if(!$channels)
672
+		if (!$channels)
673 673
 		{
674 674
 			$channels = 6; //for png
675 675
 		}
676
-		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR);
676
+		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR);
677 677
 		$availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage();
678
-		if($availableMemory < $memoryNeeded)
678
+		if ($availableMemory < $memoryNeeded)
679 679
 		{
680 680
 			return FALSE;
681 681
 		}
@@ -702,30 +702,30 @@  discard block
 block discarded – undo
702 702
 		}
703 703
 
704 704
 		$target_file = self::getRealPath($target_file);
705
-		if(!$resize_width)
705
+		if (!$resize_width)
706 706
 		{
707 707
 			$resize_width = 100;
708 708
 		}
709 709
 
710
-		if(!$resize_height)
710
+		if (!$resize_height)
711 711
 		{
712 712
 			$resize_height = $resize_width;
713 713
 		}
714 714
 
715 715
 		// retrieve source image's information
716 716
 		$imageInfo = getimagesize($source_file);
717
-		if(!self::checkMemoryLoadImage($imageInfo))
717
+		if (!self::checkMemoryLoadImage($imageInfo))
718 718
 		{
719 719
 			return FALSE;
720 720
 		}
721 721
 
722 722
 		list($width, $height, $type, $attrs) = $imageInfo;
723
-		if($width < 1 || $height < 1)
723
+		if ($width < 1 || $height < 1)
724 724
 		{
725 725
 			return;
726 726
 		}
727 727
 
728
-		switch($type)
728
+		switch ($type)
729 729
 		{
730 730
 			case '1' :
731 731
 				$type = 'gif';
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 				return;
744 744
 		}
745 745
 
746
-		if(!$target_type)
746
+		if (!$target_type)
747 747
 		{
748 748
 			$target_type = $type;
749 749
 		}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		$height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1;
755 755
 
756 756
 		$per = NULL;
757
-		if($thumbnail_type == 'ratio')
757
+		if ($thumbnail_type == 'ratio')
758 758
 		{
759 759
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
760 760
 			$resize_width = $width * $per;
@@ -767,16 +767,16 @@  discard block
 block discarded – undo
767 767
 
768 768
 		// create temporary image with target size
769 769
 		$thumb = NULL;
770
-		if(function_exists('imagecreateTRUEcolor'))
770
+		if (function_exists('imagecreateTRUEcolor'))
771 771
 		{
772 772
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
773 773
 		}
774
-		else if(function_exists('imagecreate'))
774
+		else if (function_exists('imagecreate'))
775 775
 		{
776 776
 			$thumb = imagecreate($resize_width, $resize_height);
777 777
 		}
778 778
 
779
-		if(!$thumb)
779
+		if (!$thumb)
780 780
 		{
781 781
 			return FALSE;
782 782
 		}
@@ -785,37 +785,37 @@  discard block
 block discarded – undo
785 785
 
786 786
 		// create temporary image having original type
787 787
 		$source = NULL;
788
-		switch($type)
788
+		switch ($type)
789 789
 		{
790 790
 			case 'gif' :
791
-				if(function_exists('imagecreatefromgif'))
791
+				if (function_exists('imagecreatefromgif'))
792 792
 				{
793 793
 					$source = @imagecreatefromgif($source_file);
794 794
 				}
795 795
 				break;
796 796
 			case 'jpeg' :
797 797
 			case 'jpg' :
798
-				if(function_exists('imagecreatefromjpeg'))
798
+				if (function_exists('imagecreatefromjpeg'))
799 799
 				{
800 800
 					$source = @imagecreatefromjpeg($source_file);
801 801
 				}
802 802
 				break;
803 803
 			case 'png' :
804
-				if(function_exists('imagecreatefrompng'))
804
+				if (function_exists('imagecreatefrompng'))
805 805
 				{
806 806
 					$source = @imagecreatefrompng($source_file);
807 807
 				}
808 808
 				break;
809 809
 			case 'wbmp' :
810 810
 			case 'bmp' :
811
-				if(function_exists('imagecreatefromwbmp'))
811
+				if (function_exists('imagecreatefromwbmp'))
812 812
 				{
813 813
 					$source = @imagecreatefromwbmp($source_file);
814 814
 				}
815 815
 				break;
816 816
 		}
817 817
 
818
-		if(!$source)
818
+		if (!$source)
819 819
 		{
820 820
 			imagedestroy($thumb);
821 821
 			return FALSE;
@@ -827,13 +827,13 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$x = 0;
829 829
 		$y = 0;
830
-		if($thumbnail_type == 'crop')
830
+		if ($thumbnail_type == 'crop')
831 831
 		{
832 832
 			$x = (int) ($resize_width / 2 - $new_width / 2);
833 833
 			$y = (int) ($resize_height / 2 - $new_height / 2);
834 834
 		}
835 835
 
836
-		if(function_exists('imagecopyresampled'))
836
+		if (function_exists('imagecopyresampled'))
837 837
 		{
838 838
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
839 839
 		}
@@ -847,30 +847,30 @@  discard block
 block discarded – undo
847 847
 
848 848
 		// write into the file
849 849
 		$output = NULL;
850
-		switch($target_type)
850
+		switch ($target_type)
851 851
 		{
852 852
 			case 'gif' :
853
-				if(function_exists('imagegif'))
853
+				if (function_exists('imagegif'))
854 854
 				{
855 855
 					$output = imagegif($thumb, $target_file);
856 856
 				}
857 857
 				break;
858 858
 			case 'jpeg' :
859 859
 			case 'jpg' :
860
-				if(function_exists('imagejpeg'))
860
+				if (function_exists('imagejpeg'))
861 861
 				{
862 862
 					$output = imagejpeg($thumb, $target_file, 100);
863 863
 				}
864 864
 				break;
865 865
 			case 'png' :
866
-				if(function_exists('imagepng'))
866
+				if (function_exists('imagepng'))
867 867
 				{
868 868
 					$output = imagepng($thumb, $target_file, 9);
869 869
 				}
870 870
 				break;
871 871
 			case 'wbmp' :
872 872
 			case 'bmp' :
873
-				if(function_exists('imagewbmp'))
873
+				if (function_exists('imagewbmp'))
874 874
 				{
875 875
 					$output = imagewbmp($thumb, $target_file, 100);
876 876
 				}
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 		imagedestroy($thumb);
881 881
 		imagedestroy($source);
882 882
 
883
-		if(!$output)
883
+		if (!$output)
884 884
 		{
885 885
 			return FALSE;
886 886
 		}
@@ -898,12 +898,12 @@  discard block
 block discarded – undo
898 898
 	 */
899 899
 	function readIniFile($filename)
900 900
 	{
901
-		if(($filename = self::exists($filename)) === FALSE)
901
+		if (($filename = self::exists($filename)) === FALSE)
902 902
 		{
903 903
 			return FALSE;
904 904
 		}
905 905
 		$arr = parse_ini_file($filename, TRUE);
906
-		if(is_array($arr) && count($arr) > 0)
906
+		if (is_array($arr) && count($arr) > 0)
907 907
 		{
908 908
 			return $arr;
909 909
 		}
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	 */
930 930
 	function writeIniFile($filename, $arr)
931 931
 	{
932
-		if(!is_array($arr) || count($arr) == 0)
932
+		if (!is_array($arr) || count($arr) == 0)
933 933
 		{
934 934
 			return FALSE;
935 935
 		}
@@ -946,19 +946,19 @@  discard block
 block discarded – undo
946 946
 	function _makeIniBuff($arr)
947 947
 	{
948 948
 		$return = array();
949
-		foreach($arr as $key => $val)
949
+		foreach ($arr as $key => $val)
950 950
 		{
951 951
 			// section
952
-			if(is_array($val))
952
+			if (is_array($val))
953 953
 			{
954 954
 				$return[] = sprintf("[%s]", $key);
955
-				foreach($val as $k => $v)
955
+				foreach ($val as $k => $v)
956 956
 				{
957 957
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
958 958
 				}
959 959
 				// value
960 960
 			}
961
-			else if(is_object($val))
961
+			else if (is_object($val))
962 962
 			{
963 963
 				continue;
964 964
 			}
@@ -1033,15 +1033,15 @@  discard block
 block discarded – undo
1033 1033
 	function isWritableDir($path)
1034 1034
 	{
1035 1035
 		$path = self::getRealPath($path);
1036
-		if(is_dir($path)==FALSE)
1036
+		if (is_dir($path) == FALSE)
1037 1037
 		{
1038 1038
 			return FALSE;
1039 1039
 		}
1040 1040
 
1041
-		$checkFile = $path . '/_CheckWritableDir';
1041
+		$checkFile = $path.'/_CheckWritableDir';
1042 1042
 
1043 1043
 		$fp = fopen($checkFile, 'w');
1044
-		if(!is_resource($fp))
1044
+		if (!is_resource($fp))
1045 1045
 		{
1046 1046
 			return FALSE;
1047 1047
 		}
Please login to merge, or discard this patch.