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 ( 82b3e6...7b4c95 )
by gyeong-won
11:17
created
modules/document/document.item.php 2 patches
Spacing   +180 added lines, -180 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,47 +787,47 @@  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
 
808 808
 		// Return false if neither attachement nor image files in the document
809 809
 		$content = $this->get('content');
810
-		if(!$this->get('uploaded_count'))
810
+		if (!$this->get('uploaded_count'))
811 811
 		{
812
-			if(!$content)
812
+			if (!$content)
813 813
 			{
814 814
 				$args = new stdClass();
815 815
 				$args->document_srl = $this->document_srl;
816 816
 				$output = executeQuery('document.getDocument', $args, array('content'));
817
-				if($output->toBool() && $output->data)
817
+				if ($output->toBool() && $output->data)
818 818
 				{
819 819
 					$content = $output->data->content;
820 820
 					$this->add('content', $content);
821 821
 				}
822 822
 			}
823 823
 
824
-			if(!preg_match("!<img!is", $content)) return;
824
+			if (!preg_match("!<img!is", $content)) return;
825 825
 		}
826 826
 		// Get thumbnai_type information from document module's configuration
827
-		if(!in_array($thumbnail_type, array('crop','ratio')))
827
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
828 828
 		{
829 829
 			$config = $GLOBALS['__document_config__'];
830
-			if(!$config)
830
+			if (!$config)
831 831
 			{
832 832
 				$oDocumentModel = getModel('document');
833 833
 				$config = $oDocumentModel->getDocumentConfig();
@@ -836,13 +836,13 @@  discard block
 block discarded – undo
836 836
 			$thumbnail_type = $config->thumbnail_type;
837 837
 		}
838 838
 		// Define thumbnail information
839
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
839
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
840 840
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
841 841
 		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
842 842
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
843
-		if(file_exists($thumbnail_file))
843
+		if (file_exists($thumbnail_file))
844 844
 		{
845
-			if(filesize($thumbnail_file)<1) return false;
845
+			if (filesize($thumbnail_file) < 1) return false;
846 846
 			else return $thumbnail_url;
847 847
 		}
848 848
 
@@ -851,64 +851,64 @@  discard block
 block discarded – undo
851 851
 		$is_tmp_file = false;
852 852
 
853 853
 		// Find an iamge file among attached files if exists
854
-		if($this->hasUploadedFiles())
854
+		if ($this->hasUploadedFiles())
855 855
 		{
856 856
 			$file_list = $this->getUploadedFiles();
857 857
 
858 858
 			$first_image = null;
859
-			foreach($file_list as $file)
859
+			foreach ($file_list as $file)
860 860
 			{
861
-				if($file->direct_download !== 'Y') continue;
861
+				if ($file->direct_download !== 'Y') continue;
862 862
 
863
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
863
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
864 864
 				{
865 865
 					$source_file = $file->uploaded_filename;
866 866
 					break;
867 867
 				}
868 868
 
869
-				if($first_image) continue;
869
+				if ($first_image) continue;
870 870
 
871
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
871
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
872 872
 				{
873
-					if(file_exists($file->uploaded_filename))
873
+					if (file_exists($file->uploaded_filename))
874 874
 					{
875 875
 						$first_image = $file->uploaded_filename;
876 876
 					}
877 877
 				}
878 878
 			}
879 879
 
880
-			if(!$source_file && $first_image)
880
+			if (!$source_file && $first_image)
881 881
 			{
882 882
 				$source_file = $first_image;
883 883
 			}
884 884
 		}
885 885
 		// If not exists, file an image file from the content
886 886
 		$is_tmp_file = false;
887
-		if(!$source_file)
887
+		if (!$source_file)
888 888
 		{
889 889
 			$random = new Password();
890 890
 
891 891
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
892 892
 
893
-			foreach($matches as $target_image)
893
+			foreach ($matches as $target_image)
894 894
 			{
895 895
 				$target_src = trim($target_image[1]);
896
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
896
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
897 897
 
898
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
898
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
899 899
 				{
900 900
 					$target_src = Context::getRequestUri().$target_src;
901 901
 				}
902 902
 
903 903
 				$target_src = htmlspecialchars_decode($target_src);
904 904
 
905
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
905
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
906 906
 				FileHandler::getRemoteFile($target_src, $tmp_file);
907
-				if(!file_exists($tmp_file)) continue;
907
+				if (!file_exists($tmp_file)) continue;
908 908
 
909 909
 				$imageinfo = getimagesize($tmp_file);
910 910
 				list($_w, $_h) = $imageinfo;
911
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
911
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
912 912
 					FileHandler::removeFile($tmp_file);
913 913
 					continue;
914 914
 				}
@@ -919,15 +919,15 @@  discard block
 block discarded – undo
919 919
 			}
920 920
 		}
921 921
 
922
-		if($source_file)
922
+		if ($source_file)
923 923
 		{
924 924
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
925 925
 		}
926
-		if($is_tmp_file) FileHandler::removeFile($source_file);
926
+		if ($is_tmp_file) FileHandler::removeFile($source_file);
927 927
 		// Return its path if a thumbnail is successfully genetated
928
-		if($output) return $thumbnail_url;
928
+		if ($output) return $thumbnail_url;
929 929
 		// Create an empty file not to re-generate the thumbnail
930
-		else FileHandler::writeFile($thumbnail_file, '','w');
930
+		else FileHandler::writeFile($thumbnail_file, '', 'w');
931 931
 
932 932
 		return;
933 933
 	}
@@ -940,21 +940,21 @@  discard block
 block discarded – undo
940 940
 	 */
941 941
 	function getExtraImages($time_interval = 43200)
942 942
 	{
943
-		if(!$this->document_srl) return;
943
+		if (!$this->document_srl) return;
944 944
 		// variables for icon list
945 945
 		$buffs = array();
946 946
 
947 947
 		$check_files = false;
948 948
 
949 949
 		// Check if secret post is
950
-		if($this->isSecret()) $buffs[] = "secret";
950
+		if ($this->isSecret()) $buffs[] = "secret";
951 951
 
952 952
 		// Set the latest time
953
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
953
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
954 954
 
955 955
 		// Check new post
956
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
957
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
956
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
957
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
958 958
 
959 959
 		/*
960 960
 		   $content = $this->get('content');
@@ -977,14 +977,14 @@  discard block
 block discarded – undo
977 977
 		 */
978 978
 
979 979
 		// Check the attachment
980
-		if($this->hasUploadedFiles()) $buffs[] = "file";
980
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
981 981
 
982 982
 		return $buffs;
983 983
 	}
984 984
 
985 985
 	function getStatus()
986 986
 	{
987
-		if(!$this->get('status')) return $this->getDefaultStatus();
987
+		if (!$this->get('status')) return $this->getDefaultStatus();
988 988
 		return $this->get('status');
989 989
 	}
990 990
 
@@ -995,15 +995,15 @@  discard block
 block discarded – undo
995 995
 	 */
996 996
 	function printExtraImages($time_check = 43200)
997 997
 	{
998
-		if(!$this->document_srl) return;
998
+		if (!$this->document_srl) return;
999 999
 		// Get the icon directory
1000
-		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
1000
+		$path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/');
1001 1001
 
1002 1002
 		$buffs = $this->getExtraImages($time_check);
1003
-		if(!count($buffs)) return;
1003
+		if (!count($buffs)) return;
1004 1004
 
1005 1005
 		$buff = array();
1006
-		foreach($buffs as $key => $val)
1006
+		foreach ($buffs as $key => $val)
1007 1007
 		{
1008 1008
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1009 1009
 		}
@@ -1012,20 +1012,20 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 	function hasUploadedFiles()
1014 1014
 	{
1015
-		if(!$this->document_srl) return;
1015
+		if (!$this->document_srl) return;
1016 1016
 
1017
-		if($this->isSecret() && !$this->isGranted()) return false;
1018
-		return $this->get('uploaded_count')? true : false;
1017
+		if ($this->isSecret() && !$this->isGranted()) return false;
1018
+		return $this->get('uploaded_count') ? true : false;
1019 1019
 	}
1020 1020
 
1021 1021
 	function getUploadedFiles($sortIndex = 'file_srl')
1022 1022
 	{
1023
-		if(!$this->document_srl) return;
1023
+		if (!$this->document_srl) return;
1024 1024
 
1025
-		if($this->isSecret() && !$this->isGranted()) return;
1026
-		if(!$this->get('uploaded_count')) return;
1025
+		if ($this->isSecret() && !$this->isGranted()) return;
1026
+		if (!$this->get('uploaded_count')) return;
1027 1027
 
1028
-		if(!$this->uploadedFiles[$sortIndex])
1028
+		if (!$this->uploadedFiles[$sortIndex])
1029 1029
 		{
1030 1030
 			$oFileModel = getModel('file');
1031 1031
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	function getEditor()
1042 1042
 	{
1043 1043
 		$module_srl = $this->get('module_srl');
1044
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1044
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1045 1045
 
1046 1046
 		$oEditorModel = getModel('editor');
1047 1047
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	{
1057 1057
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1058 1058
 		if (!$this->allowComment()) return false;
1059
-		if(!$this->isGranted() && $this->isSecret()) return false;
1059
+		if (!$this->isGranted() && $this->isSecret()) return false;
1060 1060
 
1061 1061
 		return true;
1062 1062
 	}
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 	 */
1068 1068
 	function getCommentEditor()
1069 1069
 	{
1070
-		if(!$this->isEnableComment()) return;
1070
+		if (!$this->isEnableComment()) return;
1071 1071
 
1072 1072
 		$oEditorModel = getModel('editor');
1073 1073
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1079,10 +1079,10 @@  discard block
 block discarded – undo
1079 1079
 	 */
1080 1080
 	function getProfileImage()
1081 1081
 	{
1082
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1082
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1083 1083
 		$oMemberModel = getModel('member');
1084 1084
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1085
-		if(!$profile_info) return;
1085
+		if (!$profile_info) return;
1086 1086
 
1087 1087
 		return $profile_info->src;
1088 1088
 	}
@@ -1094,21 +1094,21 @@  discard block
 block discarded – undo
1094 1094
 	function getSignature()
1095 1095
 	{
1096 1096
 		// Pass if a document doesn't exist
1097
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1097
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1098 1098
 		// Get signature information
1099 1099
 		$oMemberModel = getModel('member');
1100 1100
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1101 1101
 		// Check if a maximum height of signiture is set in the member module
1102
-		if(!isset($GLOBALS['__member_signature_max_height']))
1102
+		if (!isset($GLOBALS['__member_signature_max_height']))
1103 1103
 		{
1104 1104
 			$oModuleModel = getModel('module');
1105 1105
 			$member_config = $oModuleModel->getModuleConfig('member');
1106 1106
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1107 1107
 		}
1108
-		if($signature)
1108
+		if ($signature)
1109 1109
 		{
1110 1110
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1111
-			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);
1111
+			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);
1112 1112
 		}
1113 1113
 
1114 1114
 		return $signature;
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 	 */
1122 1122
 	function replaceResourceRealPath($matches)
1123 1123
 	{
1124
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1124
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1125 1125
 	}
1126 1126
 
1127 1127
 	/**
@@ -1132,19 +1132,19 @@  discard block
 block discarded – undo
1132 1132
 	function _checkAccessibleFromStatus()
1133 1133
 	{
1134 1134
 		$logged_info = Context::get('logged_info');
1135
-		if($logged_info->is_admin == 'Y') return true;
1135
+		if ($logged_info->is_admin == 'Y') return true;
1136 1136
 
1137 1137
 		$status = $this->get('status');
1138
-		if(empty($status)) return false;
1138
+		if (empty($status)) return false;
1139 1139
 
1140 1140
 		$oDocumentModel = getModel('document');
1141 1141
 		$configStatusList = $oDocumentModel->getStatusList();
1142 1142
 
1143
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1143
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1144 1144
 			return true;
1145
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1145
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1146 1146
 		{
1147
-			if($this->get('member_srl') == $logged_info->member_srl)
1147
+			if ($this->get('member_srl') == $logged_info->member_srl)
1148 1148
 				return true;
1149 1149
 		}
1150 1150
 		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,7 +899,9 @@  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
 
808 906
 		// Return false if neither attachement nor image files in the document
809 907
 		$content = $this->get('content');
@@ -821,7 +919,9 @@  discard block
 block discarded – undo
821 919
 				}
822 920
 			}
823 921
 
824
-			if(!preg_match("!<img!is", $content)) return;
922
+			if(!preg_match("!<img!is", $content)) {
923
+				return;
924
+			}
825 925
 		}
826 926
 		// Get thumbnai_type information from document module's configuration
827 927
 		if(!in_array($thumbnail_type, array('crop','ratio')))
@@ -842,8 +942,11 @@  discard block
 block discarded – undo
842 942
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
843 943
 		if(file_exists($thumbnail_file))
844 944
 		{
845
-			if(filesize($thumbnail_file)<1) return false;
846
-			else return $thumbnail_url;
945
+			if(filesize($thumbnail_file)<1) {
946
+				return false;
947
+			} else {
948
+				return $thumbnail_url;
949
+			}
847 950
 		}
848 951
 
849 952
 		// Target File
@@ -858,7 +961,9 @@  discard block
 block discarded – undo
858 961
 			$first_image = null;
859 962
 			foreach($file_list as $file)
860 963
 			{
861
-				if($file->direct_download !== 'Y') continue;
964
+				if($file->direct_download !== 'Y') {
965
+					continue;
966
+				}
862 967
 
863 968
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
864 969
 				{
@@ -866,7 +971,9 @@  discard block
 block discarded – undo
866 971
 					break;
867 972
 				}
868 973
 
869
-				if($first_image) continue;
974
+				if($first_image) {
975
+					continue;
976
+				}
870 977
 
871 978
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
872 979
 				{
@@ -893,7 +1000,9 @@  discard block
 block discarded – undo
893 1000
 			foreach($matches as $target_image)
894 1001
 			{
895 1002
 				$target_src = trim($target_image[1]);
896
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
1003
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
1004
+					continue;
1005
+				}
897 1006
 
898 1007
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
899 1008
 				{
@@ -904,7 +1013,9 @@  discard block
 block discarded – undo
904 1013
 
905 1014
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
906 1015
 				FileHandler::getRemoteFile($target_src, $tmp_file);
907
-				if(!file_exists($tmp_file)) continue;
1016
+				if(!file_exists($tmp_file)) {
1017
+					continue;
1018
+				}
908 1019
 
909 1020
 				$imageinfo = getimagesize($tmp_file);
910 1021
 				list($_w, $_h) = $imageinfo;
@@ -923,11 +1034,17 @@  discard block
 block discarded – undo
923 1034
 		{
924 1035
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
925 1036
 		}
926
-		if($is_tmp_file) FileHandler::removeFile($source_file);
1037
+		if($is_tmp_file) {
1038
+			FileHandler::removeFile($source_file);
1039
+		}
927 1040
 		// Return its path if a thumbnail is successfully genetated
928
-		if($output) return $thumbnail_url;
1041
+		if($output) {
1042
+			return $thumbnail_url;
1043
+		}
929 1044
 		// Create an empty file not to re-generate the thumbnail
930
-		else FileHandler::writeFile($thumbnail_file, '','w');
1045
+		else {
1046
+			FileHandler::writeFile($thumbnail_file, '','w');
1047
+		}
931 1048
 
932 1049
 		return;
933 1050
 	}
@@ -940,21 +1057,28 @@  discard block
 block discarded – undo
940 1057
 	 */
941 1058
 	function getExtraImages($time_interval = 43200)
942 1059
 	{
943
-		if(!$this->document_srl) return;
1060
+		if(!$this->document_srl) {
1061
+			return;
1062
+		}
944 1063
 		// variables for icon list
945 1064
 		$buffs = array();
946 1065
 
947 1066
 		$check_files = false;
948 1067
 
949 1068
 		// Check if secret post is
950
-		if($this->isSecret()) $buffs[] = "secret";
1069
+		if($this->isSecret()) {
1070
+			$buffs[] = "secret";
1071
+		}
951 1072
 
952 1073
 		// Set the latest time
953 1074
 		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
954 1075
 
955 1076
 		// Check new post
956
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
957
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
1077
+		if($this->get('regdate')>$time_check) {
1078
+			$buffs[] = "new";
1079
+		} else if($this->get('last_update')>$time_check) {
1080
+			$buffs[] = "update";
1081
+		}
958 1082
 
959 1083
 		/*
960 1084
 		   $content = $this->get('content');
@@ -977,14 +1101,18 @@  discard block
 block discarded – undo
977 1101
 		 */
978 1102
 
979 1103
 		// Check the attachment
980
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1104
+		if($this->hasUploadedFiles()) {
1105
+			$buffs[] = "file";
1106
+		}
981 1107
 
982 1108
 		return $buffs;
983 1109
 	}
984 1110
 
985 1111
 	function getStatus()
986 1112
 	{
987
-		if(!$this->get('status')) return $this->getDefaultStatus();
1113
+		if(!$this->get('status')) {
1114
+			return $this->getDefaultStatus();
1115
+		}
988 1116
 		return $this->get('status');
989 1117
 	}
990 1118
 
@@ -995,12 +1123,16 @@  discard block
 block discarded – undo
995 1123
 	 */
996 1124
 	function printExtraImages($time_check = 43200)
997 1125
 	{
998
-		if(!$this->document_srl) return;
1126
+		if(!$this->document_srl) {
1127
+			return;
1128
+		}
999 1129
 		// Get the icon directory
1000 1130
 		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
1001 1131
 
1002 1132
 		$buffs = $this->getExtraImages($time_check);
1003
-		if(!count($buffs)) return;
1133
+		if(!count($buffs)) {
1134
+			return;
1135
+		}
1004 1136
 
1005 1137
 		$buff = array();
1006 1138
 		foreach($buffs as $key => $val)
@@ -1012,18 +1144,28 @@  discard block
 block discarded – undo
1012 1144
 
1013 1145
 	function hasUploadedFiles()
1014 1146
 	{
1015
-		if(!$this->document_srl) return;
1147
+		if(!$this->document_srl) {
1148
+			return;
1149
+		}
1016 1150
 
1017
-		if($this->isSecret() && !$this->isGranted()) return false;
1151
+		if($this->isSecret() && !$this->isGranted()) {
1152
+			return false;
1153
+		}
1018 1154
 		return $this->get('uploaded_count')? true : false;
1019 1155
 	}
1020 1156
 
1021 1157
 	function getUploadedFiles($sortIndex = 'file_srl')
1022 1158
 	{
1023
-		if(!$this->document_srl) return;
1159
+		if(!$this->document_srl) {
1160
+			return;
1161
+		}
1024 1162
 
1025
-		if($this->isSecret() && !$this->isGranted()) return;
1026
-		if(!$this->get('uploaded_count')) return;
1163
+		if($this->isSecret() && !$this->isGranted()) {
1164
+			return;
1165
+		}
1166
+		if(!$this->get('uploaded_count')) {
1167
+			return;
1168
+		}
1027 1169
 
1028 1170
 		if(!$this->uploadedFiles[$sortIndex])
1029 1171
 		{
@@ -1041,7 +1183,9 @@  discard block
 block discarded – undo
1041 1183
 	function getEditor()
1042 1184
 	{
1043 1185
 		$module_srl = $this->get('module_srl');
1044
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1186
+		if(!$module_srl) {
1187
+			$module_srl = Context::get('module_srl');
1188
+		}
1045 1189
 
1046 1190
 		$oEditorModel = getModel('editor');
1047 1191
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1055,8 +1199,12 @@  discard block
 block discarded – undo
1055 1199
 	function isEnableComment()
1056 1200
 	{
1057 1201
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1058
-		if (!$this->allowComment()) return false;
1059
-		if(!$this->isGranted() && $this->isSecret()) return false;
1202
+		if (!$this->allowComment()) {
1203
+			return false;
1204
+		}
1205
+		if(!$this->isGranted() && $this->isSecret()) {
1206
+			return false;
1207
+		}
1060 1208
 
1061 1209
 		return true;
1062 1210
 	}
@@ -1067,7 +1215,9 @@  discard block
 block discarded – undo
1067 1215
 	 */
1068 1216
 	function getCommentEditor()
1069 1217
 	{
1070
-		if(!$this->isEnableComment()) return;
1218
+		if(!$this->isEnableComment()) {
1219
+			return;
1220
+		}
1071 1221
 
1072 1222
 		$oEditorModel = getModel('editor');
1073 1223
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1079,10 +1229,14 @@  discard block
 block discarded – undo
1079 1229
 	 */
1080 1230
 	function getProfileImage()
1081 1231
 	{
1082
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1232
+		if(!$this->isExists() || !$this->get('member_srl')) {
1233
+			return;
1234
+		}
1083 1235
 		$oMemberModel = getModel('member');
1084 1236
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1085
-		if(!$profile_info) return;
1237
+		if(!$profile_info) {
1238
+			return;
1239
+		}
1086 1240
 
1087 1241
 		return $profile_info->src;
1088 1242
 	}
@@ -1094,7 +1248,9 @@  discard block
 block discarded – undo
1094 1248
 	function getSignature()
1095 1249
 	{
1096 1250
 		// Pass if a document doesn't exist
1097
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1251
+		if(!$this->isExists() || !$this->get('member_srl')) {
1252
+			return;
1253
+		}
1098 1254
 		// Get signature information
1099 1255
 		$oMemberModel = getModel('member');
1100 1256
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1108,7 +1264,9 @@  discard block
 block discarded – undo
1108 1264
 		if($signature)
1109 1265
 		{
1110 1266
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1111
-			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);
1267
+			if($max_signature_height) {
1268
+				$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);
1269
+			}
1112 1270
 		}
1113 1271
 
1114 1272
 		return $signature;
@@ -1132,20 +1290,25 @@  discard block
 block discarded – undo
1132 1290
 	function _checkAccessibleFromStatus()
1133 1291
 	{
1134 1292
 		$logged_info = Context::get('logged_info');
1135
-		if($logged_info->is_admin == 'Y') return true;
1293
+		if($logged_info->is_admin == 'Y') {
1294
+			return true;
1295
+		}
1136 1296
 
1137 1297
 		$status = $this->get('status');
1138
-		if(empty($status)) return false;
1298
+		if(empty($status)) {
1299
+			return false;
1300
+		}
1139 1301
 
1140 1302
 		$oDocumentModel = getModel('document');
1141 1303
 		$configStatusList = $oDocumentModel->getStatusList();
1142 1304
 
1143
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1144
-			return true;
1145
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1305
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1306
+					return true;
1307
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1146 1308
 		{
1147
-			if($this->get('member_srl') == $logged_info->member_srl)
1148
-				return true;
1309
+			if($this->get('member_srl') == $logged_info->member_srl) {
1310
+							return true;
1311
+			}
1149 1312
 		}
1150 1313
 		return false;
1151 1314
 	}
Please login to merge, or discard this patch.
modules/comment/comment.item.php 2 patches
Spacing   +72 added lines, -72 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,42 +538,42 @@  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
 		$content = $this->get('content');
558
-		if(!$this->hasUploadedFiles())
558
+		if (!$this->hasUploadedFiles())
559 559
 		{
560
-			if(!$content)
560
+			if (!$content)
561 561
 			{
562 562
 				$args = new stdClass();
563 563
 				$args->comment_srl = $this->comment_srl;
564 564
 				$output = executeQuery('document.getComment', $args, array('content'));
565
-				if($output->toBool() && $output->data)
565
+				if ($output->toBool() && $output->data)
566 566
 				{
567 567
 					$content = $output->data->content;
568 568
 					$this->add('content', $content);
569 569
 				}
570 570
 			}
571 571
 
572
-			if(!preg_match("!<img!is", $content)) return;
572
+			if (!preg_match("!<img!is", $content)) return;
573 573
 		}
574 574
 
575 575
 		// get thumbail generation info on the doc module configuration.
576
-		if(!in_array($thumbnail_type, array('crop', 'ratio')))
576
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
577 577
 		{
578 578
 			$thumbnail_type = 'crop';
579 579
 		}
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 		// Define thumbnail information
582 582
 		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3));
583 583
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
584
-		$thumbnail_url = Context::getRequestUri() . $thumbnail_file;
584
+		$thumbnail_url = Context::getRequestUri().$thumbnail_file;
585 585
 
586 586
 		// return false if a size of existing thumbnail file is 0. otherwise return the file path
587
-		if(file_exists($thumbnail_file))
587
+		if (file_exists($thumbnail_file))
588 588
 		{
589
-			if(filesize($thumbnail_file) < 1)
589
+			if (filesize($thumbnail_file) < 1)
590 590
 			{
591 591
 				return FALSE;
592 592
 			}
@@ -601,33 +601,33 @@  discard block
 block discarded – undo
601 601
 		$is_tmp_file = FALSE;
602 602
 
603 603
 		// find an image file among attached files
604
-		if($this->hasUploadedFiles())
604
+		if ($this->hasUploadedFiles())
605 605
 		{
606 606
 			$file_list = $this->getUploadedFiles();
607 607
 
608 608
 			$first_image = null;
609
-			foreach($file_list as $file)
609
+			foreach ($file_list as $file)
610 610
 			{
611
-				if($file->direct_download !== 'Y') continue;
611
+				if ($file->direct_download !== 'Y') continue;
612 612
 
613
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
613
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
614 614
 				{
615 615
 					$source_file = $file->uploaded_filename;
616 616
 					break;
617 617
 				}
618 618
 
619
-				if($first_image) continue;
619
+				if ($first_image) continue;
620 620
 
621
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
621
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
622 622
 				{
623
-					if(file_exists($file->uploaded_filename))
623
+					if (file_exists($file->uploaded_filename))
624 624
 					{
625 625
 						$first_image = $file->uploaded_filename;
626 626
 					}
627 627
 				}
628 628
 			}
629 629
 
630
-			if(!$source_file && $first_image)
630
+			if (!$source_file && $first_image)
631 631
 			{
632 632
 				$source_file = $first_image;
633 633
 			}
@@ -635,31 +635,31 @@  discard block
 block discarded – undo
635 635
 
636 636
 		// get an image file from the doc content if no file attached. 
637 637
 		$is_tmp_file = false;
638
-		if(!$source_file)
638
+		if (!$source_file)
639 639
 		{
640 640
 			$random = new Password();
641 641
 
642 642
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
643 643
 
644
-			foreach($matches as $target_image)
644
+			foreach ($matches as $target_image)
645 645
 			{
646 646
 				$target_src = trim($target_image[1]);
647
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
647
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
648 648
 
649
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
649
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
650 650
 				{
651 651
 					$target_src = Context::getRequestUri().$target_src;
652 652
 				}
653 653
 
654 654
 				$target_src = htmlspecialchars_decode($target_src);
655 655
 
656
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
656
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
657 657
 				FileHandler::getRemoteFile($target_src, $tmp_file);
658
-				if(!file_exists($tmp_file)) continue;
658
+				if (!file_exists($tmp_file)) continue;
659 659
 
660 660
 				$imageinfo = getimagesize($tmp_file);
661 661
 				list($_w, $_h) = $imageinfo;
662
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
662
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
663 663
 					FileHandler::removeFile($tmp_file);
664 664
 					continue;
665 665
 				}
@@ -672,13 +672,13 @@  discard block
 block discarded – undo
672 672
 
673 673
 		$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
674 674
 
675
-		if($is_tmp_file)
675
+		if ($is_tmp_file)
676 676
 		{
677 677
 			FileHandler::removeFile($source_file);
678 678
 		}
679 679
 
680 680
 		// return the thumbnail path if successfully generated.
681
-		if($output)
681
+		if ($output)
682 682
 		{
683 683
 			return $thumbnail_url;
684 684
 		}
Please login to merge, or discard this patch.
Braces   +17 added lines, -9 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
 			{
@@ -569,7 +568,9 @@  discard block
 block discarded – undo
569 568
 				}
570 569
 			}
571 570
 
572
-			if(!preg_match("!<img!is", $content)) return;
571
+			if(!preg_match("!<img!is", $content)) {
572
+				return;
573
+			}
573 574
 		}
574 575
 
575 576
 		// get thumbail generation info on the doc module configuration.
@@ -589,8 +590,7 @@  discard block
 block discarded – undo
589 590
 			if(filesize($thumbnail_file) < 1)
590 591
 			{
591 592
 				return FALSE;
592
-			}
593
-			else
593
+			} else
594 594
 			{
595 595
 				return $thumbnail_url;
596 596
 			}
@@ -608,7 +608,9 @@  discard block
 block discarded – undo
608 608
 			$first_image = null;
609 609
 			foreach($file_list as $file)
610 610
 			{
611
-				if($file->direct_download !== 'Y') continue;
611
+				if($file->direct_download !== 'Y') {
612
+					continue;
613
+				}
612 614
 
613 615
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
614 616
 				{
@@ -616,7 +618,9 @@  discard block
 block discarded – undo
616 618
 					break;
617 619
 				}
618 620
 
619
-				if($first_image) continue;
621
+				if($first_image) {
622
+					continue;
623
+				}
620 624
 
621 625
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
622 626
 				{
@@ -644,7 +648,9 @@  discard block
 block discarded – undo
644 648
 			foreach($matches as $target_image)
645 649
 			{
646 650
 				$target_src = trim($target_image[1]);
647
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
651
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
652
+					continue;
653
+				}
648 654
 
649 655
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
650 656
 				{
@@ -655,7 +661,9 @@  discard block
 block discarded – undo
655 661
 
656 662
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
657 663
 				FileHandler::getRemoteFile($target_src, $tmp_file);
658
-				if(!file_exists($tmp_file)) continue;
664
+				if(!file_exists($tmp_file)) {
665
+					continue;
666
+				}
659 667
 
660 668
 				$imageinfo = getimagesize($tmp_file);
661 669
 				list($_w, $_h) = $imageinfo;
Please login to merge, or discard this patch.