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 ( 8b5229...44de49 )
by gyeong-won
48:49
created
modules/document/document.item.php 2 patches
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	function _loadFromDB($load_extra_vars = true)
81 81
 	{
82
-		if(!$this->document_srl) return;
82
+		if (!$this->document_srl) return;
83 83
 
84 84
 		$document_item = false;
85 85
 		$cache_put = false;
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 		// cache controll
90 90
 		$oCacheHandler = CacheHandler::getInstance('object');
91
-		if($oCacheHandler->isSupport())
91
+		if ($oCacheHandler->isSupport())
92 92
 		{
93
-			$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
93
+			$cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl;
94 94
 			$document_item = $oCacheHandler->get($cache_key);
95
-			if($document_item !== false)
95
+			if ($document_item !== false)
96 96
 			{
97 97
 				$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
98 98
 			}
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 		$args->document_srl = $this->document_srl;
103 103
 		$output = executeQuery('document.getDocument', $args, $columnList);
104 104
 
105
-		if($document_item === false)
105
+		if ($document_item === false)
106 106
 		{
107 107
 			$document_item = $output->data;
108 108
 
109 109
 				//insert in cache
110
-			if($document_item && $oCacheHandler->isSupport())
110
+			if ($document_item && $oCacheHandler->isSupport())
111 111
 			{
112 112
 				$oCacheHandler->put($cache_key, $document_item);
113 113
 			}
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		$this->setAttribute($document_item, $load_extra_vars);
125 125
 	}
126 126
 
127
-	function setAttribute($attribute, $load_extra_vars=true)
127
+	function setAttribute($attribute, $load_extra_vars = true)
128 128
 	{
129
-		if(!$attribute->document_srl)
129
+		if (!$attribute->document_srl)
130 130
 		{
131 131
 			$this->document_srl = null;
132 132
 			return;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$this->adds($attribute);
137 137
 
138 138
 		// Tags
139
-		if($this->get('tags'))
139
+		if ($this->get('tags'))
140 140
 		{
141 141
 			$tag_list = explode(',', $this->get('tags'));
142 142
 			$tag_list = array_map('trim', $tag_list);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		$oDocumentModel = getModel('document');
147
-		if($load_extra_vars)
147
+		if ($load_extra_vars)
148 148
 		{
149 149
 			$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
150 150
 			$oDocumentModel->setToAllDocumentExtraVars();
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
 
160 160
 	function isGranted()
161 161
 	{
162
-		if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
162
+		if ($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
163 163
 
164
-		if($this->grant_cache !== null)
164
+		if ($this->grant_cache !== null)
165 165
 		{
166 166
 			return $this->grant_cache;
167 167
 		}
168 168
 
169
-		if(!Context::get('is_logged')) return $this->grant_cache = false;
169
+		if (!Context::get('is_logged')) return $this->grant_cache = false;
170 170
 
171 171
 		$logged_info = Context::get('logged_info');
172
-		if($logged_info->is_admin == 'Y') return $this->grant_cache = true;
172
+		if ($logged_info->is_admin == 'Y') return $this->grant_cache = true;
173 173
 
174 174
 		$oModuleModel = getModel('module');
175 175
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
176
-		if($grant->manager) return $this->grant_cache = true;
176
+		if ($grant->manager) return $this->grant_cache = true;
177 177
 
178
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return $this->grant_cache = true;
178
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return $this->grant_cache = true;
179 179
 
180 180
 		return $this->grant_cache = false;
181 181
 	}
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 
189 189
 	function isAccessible()
190 190
 	{
191
-		return $_SESSION['accessible'][$this->document_srl]==true?true:false;
191
+		return $_SESSION['accessible'][$this->document_srl] == true ? true : false;
192 192
 	}
193 193
 
194 194
 	function allowComment()
195 195
 	{
196 196
 		// init write, document is not exists. so allow comment status is true
197
-		if(!$this->isExists()) return true;
197
+		if (!$this->isExists()) return true;
198 198
 
199 199
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
200 200
 	}
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
 	function allowTrackback()
203 203
 	{
204 204
 		static $allow_trackback_status = null;
205
-		if(is_null($allow_trackback_status))
205
+		if (is_null($allow_trackback_status))
206 206
 		{
207 207
 			
208 208
 			// Check the tarckback module exist
209
-			if(!getClass('trackback'))
209
+			if (!getClass('trackback'))
210 210
 			{
211 211
 				$allow_trackback_status = false;
212 212
 			}
@@ -216,20 +216,20 @@  discard block
 block discarded – undo
216 216
 				$oModuleModel = getModel('module');
217 217
 				$trackback_config = $oModuleModel->getModuleConfig('trackback');
218 218
 				
219
-				if(!$trackback_config)
219
+				if (!$trackback_config)
220 220
 				{
221 221
 					$trackback_config = new stdClass();
222 222
 				}
223 223
 				
224
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
224
+				if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
+				if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
226 226
 				else
227 227
 				{
228 228
 					$module_srl = $this->get('module_srl');
229 229
 					// Check settings of each module
230 230
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
231
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
231
+					if ($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
+					else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true;
233 233
 				}
234 234
 			}
235 235
 		}
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 
239 239
 	function isLocked()
240 240
 	{
241
-		if(!$this->isExists()) return false;
241
+		if (!$this->isExists()) return false;
242 242
 
243 243
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
244 244
 	}
245 245
 
246 246
 	function isEditable()
247 247
 	{
248
-		if($this->isGranted() || !$this->get('member_srl')) return true;
248
+		if ($this->isGranted() || !$this->get('member_srl')) return true;
249 249
 		return false;
250 250
 	}
251 251
 
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 
263 263
 	function useNotify()
264 264
 	{
265
-		return $this->get('notify_message')=='Y' ? true : false;
265
+		return $this->get('notify_message') == 'Y' ? true : false;
266 266
 	}
267 267
 
268 268
 	function doCart()
269 269
 	{
270
-		if(!$this->document_srl) return false;
271
-		if($this->isCarted()) $this->removeCart();
270
+		if (!$this->document_srl) return false;
271
+		if ($this->isCarted()) $this->removeCart();
272 272
 		else $this->addCart();
273 273
 	}
274 274
 
@@ -295,18 +295,18 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	function notify($type, $content)
297 297
 	{
298
-		if(!$this->document_srl) return;
298
+		if (!$this->document_srl) return;
299 299
 		// return if it is not useNotify
300
-		if(!$this->useNotify()) return;
300
+		if (!$this->useNotify()) return;
301 301
 		// Pass if an author is not a logged-in user
302
-		if(!$this->get('member_srl')) return;
302
+		if (!$this->get('member_srl')) return;
303 303
 		// Return if the currently logged-in user is an author
304 304
 		$logged_info = Context::get('logged_info');
305
-		if($logged_info->member_srl == $this->get('member_srl')) return;
305
+		if ($logged_info->member_srl == $this->get('member_srl')) return;
306 306
 		// List variables
307
-		if($type) $title = "[".$type."] ";
307
+		if ($type) $title = "[".$type."] ";
308 308
 		$title .= cut_str(strip_tags($content), 10, '...');
309
-		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
309
+		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
310 310
 		$receiver_srl = $this->get('member_srl');
311 311
 		$sender_member_srl = $logged_info->member_srl;
312 312
 		// Send a message
@@ -321,26 +321,26 @@  discard block
 block discarded – undo
321 321
 
322 322
 	function getIpAddress()
323 323
 	{
324
-		if($this->isGranted())
324
+		if ($this->isGranted())
325 325
 		{
326 326
 			return $this->get('ipaddress');
327 327
 		}
328 328
 
329
-		return '*' . strstr($this->get('ipaddress'), '.');
329
+		return '*'.strstr($this->get('ipaddress'), '.');
330 330
 	}
331 331
 
332 332
 	function isExistsHomepage()
333 333
 	{
334
-		if(trim($this->get('homepage'))) return true;
334
+		if (trim($this->get('homepage'))) return true;
335 335
 		return false;
336 336
 	}
337 337
 
338 338
 	function getHomepageUrl()
339 339
 	{
340 340
 		$url = trim($this->get('homepage'));
341
-		if(!$url) return;
341
+		if (!$url) return;
342 342
 
343
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
343
+		if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://'.$url;
344 344
 
345 345
 		return $url;
346 346
 	}
@@ -370,52 +370,52 @@  discard block
 block discarded – undo
370 370
 		return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
371 371
 	}
372 372
 
373
-	function getTitleText($cut_size = 0, $tail='...')
373
+	function getTitleText($cut_size = 0, $tail = '...')
374 374
 	{
375
-		if(!$this->document_srl) return;
375
+		if (!$this->document_srl) return;
376 376
 
377
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
377
+		if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
378 378
 		else $title = $this->get('title');
379 379
 
380 380
 		return $title;
381 381
 	}
382 382
 
383
-	function getTitle($cut_size = 0, $tail='...')
383
+	function getTitle($cut_size = 0, $tail = '...')
384 384
 	{
385
-		if(!$this->document_srl) return;
385
+		if (!$this->document_srl) return;
386 386
 
387 387
 		$title = $this->getTitleText($cut_size, $tail);
388 388
 
389 389
 		$attrs = array();
390 390
 		$this->add('title_color', trim($this->get('title_color')));
391
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
392
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
391
+		if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;";
392
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
393 393
 
394
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
394
+		if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
395 395
 		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
396 396
 	}
397 397
 
398 398
 	function getContentText($strlen = 0)
399 399
 	{
400
-		if(!$this->document_srl) return;
400
+		if (!$this->document_srl) return;
401 401
 
402
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
402
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
403 403
 
404 404
 		$result = $this->_checkAccessibleFromStatus();
405
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
405
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
406 406
 
407 407
 		$content = $this->get('content');
408 408
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
409 409
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
410 410
 
411
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
411
+		if ($strlen) return cut_str(strip_tags($content), $strlen, '...');
412 412
 
413 413
 		return htmlspecialchars($content);
414 414
 	}
415 415
 
416 416
 	function _addAllowScriptAccess($m)
417 417
 	{
418
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
418
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
419 419
 		{
420 420
 			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
421 421
 		}
@@ -425,26 +425,26 @@  discard block
 block discarded – undo
425 425
 
426 426
 	function _checkAllowScriptAccess($m)
427 427
 	{
428
-		if($m[1] == 'object')
428
+		if ($m[1] == 'object')
429 429
 		{
430 430
 			$this->allowscriptaccessList[] = 1;
431 431
 		}
432 432
 
433
-		if($m[1] == 'param')
433
+		if ($m[1] == 'param')
434 434
 		{
435
-			if(stripos($m[0], 'allowscriptaccess'))
435
+			if (stripos($m[0], 'allowscriptaccess'))
436 436
 			{
437 437
 				$m[0] = '<param name="allowscriptaccess" value="never"';
438
-				if(substr($m[0], -1) == '/')
438
+				if (substr($m[0], -1) == '/')
439 439
 				{
440 440
 					$m[0] .= '/';
441 441
 				}
442
-				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
442
+				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
443 443
 			}
444 444
 		}
445
-		else if($m[1] == 'embed')
445
+		else if ($m[1] == 'embed')
446 446
 		{
447
-			if(stripos($m[0], 'allowscriptaccess'))
447
+			if (stripos($m[0], 'allowscriptaccess'))
448 448
 			{
449 449
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
450 450
 			}
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
 
459 459
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
460 460
 	{
461
-		if(!$this->document_srl) return;
461
+		if (!$this->document_srl) return;
462 462
 
463
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
463
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
464 464
 
465 465
 		$result = $this->_checkAccessibleFromStatus();
466
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
466
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
467 467
 
468 468
 		$content = $this->get('content');
469
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
469
+		if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
470 470
 
471 471
 		// Define a link if using a rewrite module
472 472
 		$oContext = &Context::getInstance();
473
-		if($oContext->allow_rewrite)
473
+		if ($oContext->allow_rewrite)
474 474
 		{
475
-			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
475
+			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content);
476 476
 		}
477 477
 		// To display a pop-up menu
478
-		if($add_popup_menu)
478
+		if ($add_popup_menu)
479 479
 		{
480 480
 			$content = sprintf(
481 481
 				'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@@ -484,10 +484,10 @@  discard block
 block discarded – undo
484 484
 			);
485 485
 		}
486 486
 		// If additional content information is set
487
-		if($add_content_info)
487
+		if ($add_content_info)
488 488
 		{
489 489
 			$memberSrl = $this->get('member_srl');
490
-			if($memberSrl < 0)
490
+			if ($memberSrl < 0)
491 491
 			{
492 492
 				$memberSrl = 0;
493 493
 			}
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 		else
505 505
 		{
506
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
506
+			if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
507 507
 		}
508 508
 		// Change the image path to a valid absolute path if resource_realpath is true
509
-		if($resource_realpath)
509
+		if ($resource_realpath)
510 510
 		{
511
-			$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
511
+			$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
512 512
 		}
513 513
 
514 514
 		return $content;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		$content = trim(cut_str($content, $str_size, $tail));
558 558
 
559 559
 		// Replace back < , <, "
560
-		$content = str_replace(array('<', '>', '"'),array('&lt;', '&gt;', '&quot;'), $content);
560
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
561 561
 
562 562
 		return $content;
563 563
 	}
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 	function getRegdateTime()
571 571
 	{
572 572
 		$regdate = $this->get('regdate');
573
-		$year = substr($regdate,0,4);
574
-		$month = substr($regdate,4,2);
575
-		$day = substr($regdate,6,2);
576
-		$hour = substr($regdate,8,2);
577
-		$min = substr($regdate,10,2);
578
-		$sec = substr($regdate,12,2);
579
-		return mktime($hour,$min,$sec,$month,$day,$year);
573
+		$year = substr($regdate, 0, 4);
574
+		$month = substr($regdate, 4, 2);
575
+		$day = substr($regdate, 6, 2);
576
+		$hour = substr($regdate, 8, 2);
577
+		$min = substr($regdate, 10, 2);
578
+		$sec = substr($regdate, 12, 2);
579
+		return mktime($hour, $min, $sec, $month, $day, $year);
580 580
 	}
581 581
 
582 582
 	function getRegdateGM()
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 
587 587
 	function getRegdateDT()
588 588
 	{
589
-		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
589
+		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
590 590
 	}
591 591
 
592 592
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
 
597 597
 	function getUpdateTime()
598 598
 	{
599
-		$year = substr($this->get('last_update'),0,4);
600
-		$month = substr($this->get('last_update'),4,2);
601
-		$day = substr($this->get('last_update'),6,2);
602
-		$hour = substr($this->get('last_update'),8,2);
603
-		$min = substr($this->get('last_update'),10,2);
604
-		$sec = substr($this->get('last_update'),12,2);
605
-		return mktime($hour,$min,$sec,$month,$day,$year);
599
+		$year = substr($this->get('last_update'), 0, 4);
600
+		$month = substr($this->get('last_update'), 4, 2);
601
+		$day = substr($this->get('last_update'), 6, 2);
602
+		$hour = substr($this->get('last_update'), 8, 2);
603
+		$min = substr($this->get('last_update'), 10, 2);
604
+		$sec = substr($this->get('last_update'), 12, 2);
605
+		return mktime($hour, $min, $sec, $month, $day, $year);
606 606
 	}
607 607
 
608 608
 	function getUpdateGM()
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
 
613 613
 	function getUpdateDT()
614 614
 	{
615
-		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
615
+		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
616 616
 	}
617 617
 
618 618
 	function getPermanentUrl()
619 619
 	{
620
-		return getFullUrl('','document_srl',$this->get('document_srl'));
620
+		return getFullUrl('', 'document_srl', $this->get('document_srl'));
621 621
 	}
622 622
 
623 623
 	function getTrackbackUrl()
624 624
 	{
625
-		if(!$this->document_srl) return;
625
+		if (!$this->document_srl) return;
626 626
 
627 627
 		// Generate a key to prevent spams
628 628
 		$oTrackbackModel = getModel('trackback');
629
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
629
+		if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
630 630
 	}
631 631
 
632 632
 	/**
@@ -636,24 +636,24 @@  discard block
 block discarded – undo
636 636
 	function updateReadedCount()
637 637
 	{
638 638
 		$oDocumentController = getController('document');
639
-		if($oDocumentController->updateReadedCount($this))
639
+		if ($oDocumentController->updateReadedCount($this))
640 640
 		{
641 641
 			$readed_count = $this->get('readed_count');
642
-			$this->add('readed_count', $readed_count+1);
642
+			$this->add('readed_count', $readed_count + 1);
643 643
 		}
644 644
 	}
645 645
 
646 646
 	function isExtraVarsExists()
647 647
 	{
648
-		if(!$this->get('module_srl')) return false;
648
+		if (!$this->get('module_srl')) return false;
649 649
 		$oDocumentModel = getModel('document');
650 650
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
651
-		return count($extra_keys)?true:false;
651
+		return count($extra_keys) ? true : false;
652 652
 	}
653 653
 
654 654
 	function getExtraVars()
655 655
 	{
656
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
656
+		if (!$this->get('module_srl') || !$this->document_srl) return null;
657 657
 
658 658
 		$oDocumentModel = getModel('document');
659 659
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	function getExtraValue($idx)
663 663
 	{
664 664
 		$extra_vars = $this->getExtraVars();
665
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
665
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
666 666
 		{
667 667
 			return $extra_vars[$idx]->getValue();
668 668
 		}
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 	function getExtraValueHTML($idx)
676 676
 	{
677 677
 		$extra_vars = $this->getExtraVars();
678
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
678
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
679 679
 		{
680 680
 			return $extra_vars[$idx]->getValueHTML();
681 681
 		}
@@ -689,16 +689,16 @@  discard block
 block discarded – undo
689 689
 	{
690 690
 		$extra_vars = $this->getExtraVars();
691 691
 
692
-		if($extra_vars)
692
+		if ($extra_vars)
693 693
 		{
694 694
 			// Handle extra variable(eid)
695
-			foreach($extra_vars as $idx => $key)
695
+			foreach ($extra_vars as $idx => $key)
696 696
 			{
697 697
 				$extra_eid[$key->eid] = $key;
698 698
 			}
699 699
 		}
700 700
 		
701
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
701
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
702 702
 		{
703 703
 			return $extra_eid[$eid]->getValue();
704 704
 		}
@@ -712,12 +712,12 @@  discard block
 block discarded – undo
712 712
 	{
713 713
 		$extra_vars = $this->getExtraVars();
714 714
 		// Handle extra variable(eid)
715
-		foreach($extra_vars as $idx => $key)
715
+		foreach ($extra_vars as $idx => $key)
716 716
 		{
717 717
 			$extra_eid[$key->eid] = $key;
718 718
 		}
719 719
 		
720
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
720
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
721 721
 		{
722 722
 			return $extra_eid[$eid]->getValueHTML();
723 723
 		}
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
 
742 742
 	function getComments()
743 743
 	{
744
-		if(!$this->getCommentCount()) return;
745
-		if(!$this->isGranted() && $this->isSecret()) return;
744
+		if (!$this->getCommentCount()) return;
745
+		if (!$this->isGranted() && $this->isSecret()) return;
746 746
 		// cpage is a number of comment pages
747 747
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
748 748
 		$cpage = Context::get($cpageStr);
749 749
 
750
-		if(!$cpage)
750
+		if (!$cpage)
751 751
 		{
752 752
 			$cpage = Context::get('cpage');
753 753
 		}
@@ -755,19 +755,19 @@  discard block
 block discarded – undo
755 755
 		// Get a list of comments
756 756
 		$oCommentModel = getModel('comment');
757 757
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
758
-		if(!$output->toBool() || !count($output->data)) return;
758
+		if (!$output->toBool() || !count($output->data)) return;
759 759
 		// Create commentItem object from a comment list
760 760
 		// If admin priviledge is granted on parent posts, you can read its child posts.
761 761
 		$accessible = array();
762 762
 		$comment_list = array();
763
-		foreach($output->data as $key => $val)
763
+		foreach ($output->data as $key => $val)
764 764
 		{
765 765
 			$oCommentItem = new commentItem();
766 766
 			$oCommentItem->setAttribute($val);
767 767
 			// If permission is granted to the post, you can access it temporarily
768
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
768
+			if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
769 769
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
770
-			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
770
+			if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true)
771 771
 			{
772 772
 				$oCommentItem->setAccessible();
773 773
 			}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 		// Variable setting to be displayed on the skin
777 777
 		Context::set($cpageStr, $output->page_navigation->cur_page);
778 778
 		Context::set('cpage', $output->page_navigation->cur_page);
779
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
779
+		if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation;
780 780
 
781 781
 		return $comment_list;
782 782
 	}
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
 
789 789
 	function getTrackbacks()
790 790
 	{
791
-		if(!$this->document_srl) return;
791
+		if (!$this->document_srl) return;
792 792
 
793
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
793
+		if (!$this->allowTrackback() || !$this->get('trackback_count')) return;
794 794
 
795 795
 		$oTrackbackModel = getModel('trackback');
796 796
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -798,47 +798,47 @@  discard block
 block discarded – undo
798 798
 
799 799
 	function thumbnailExists($width = 80, $height = 0, $type = '')
800 800
 	{
801
-		if(!$this->document_srl) return false;
802
-		if(!$this->getThumbnail($width, $height, $type)) return false;
801
+		if (!$this->document_srl) return false;
802
+		if (!$this->getThumbnail($width, $height, $type)) return false;
803 803
 		return true;
804 804
 	}
805 805
 
806 806
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
807 807
 	{
808 808
 		// Return false if the document doesn't exist
809
-		if(!$this->document_srl) return;
809
+		if (!$this->document_srl) return;
810 810
 
811
-		if($this->isSecret() && !$this->isGranted())
811
+		if ($this->isSecret() && !$this->isGranted())
812 812
 		{
813 813
 			return;
814 814
 		}
815 815
 
816 816
 		// If not specify its height, create a square
817
-		if(!$height) $height = $width;
817
+		if (!$height) $height = $width;
818 818
 
819 819
 		// Return false if neither attachement nor image files in the document
820 820
 		$content = $this->get('content');
821
-		if(!$this->get('uploaded_count'))
821
+		if (!$this->get('uploaded_count'))
822 822
 		{
823
-			if(!$content)
823
+			if (!$content)
824 824
 			{
825 825
 				$args = new stdClass();
826 826
 				$args->document_srl = $this->document_srl;
827 827
 				$output = executeQuery('document.getDocument', $args, array('content'));
828
-				if($output->toBool() && $output->data)
828
+				if ($output->toBool() && $output->data)
829 829
 				{
830 830
 					$content = $output->data->content;
831 831
 					$this->add('content', $content);
832 832
 				}
833 833
 			}
834 834
 
835
-			if(!preg_match("!<img!is", $content)) return;
835
+			if (!preg_match("!<img!is", $content)) return;
836 836
 		}
837 837
 		// Get thumbnai_type information from document module's configuration
838
-		if(!in_array($thumbnail_type, array('crop','ratio')))
838
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
839 839
 		{
840 840
 			$config = $GLOBALS['__document_config__'];
841
-			if(!$config)
841
+			if (!$config)
842 842
 			{
843 843
 				$oDocumentModel = getModel('document');
844 844
 				$config = $oDocumentModel->getDocumentConfig();
@@ -848,15 +848,15 @@  discard block
 block discarded – undo
848 848
 		}
849 849
 
850 850
 		// Define thumbnail information
851
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
851
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
852 852
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
853 853
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
854 854
 		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
855 855
 
856 856
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
857
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
857
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
858 858
 		{
859
-			if(filesize($thumbnail_file) < 1)
859
+			if (filesize($thumbnail_file) < 1)
860 860
 			{
861 861
 				return FALSE;
862 862
 			}
@@ -874,64 +874,64 @@  discard block
 block discarded – undo
874 874
 		$is_tmp_file = false;
875 875
 
876 876
 		// Find an iamge file among attached files if exists
877
-		if($this->hasUploadedFiles())
877
+		if ($this->hasUploadedFiles())
878 878
 		{
879 879
 			$file_list = $this->getUploadedFiles();
880 880
 
881 881
 			$first_image = null;
882
-			foreach($file_list as $file)
882
+			foreach ($file_list as $file)
883 883
 			{
884
-				if($file->direct_download !== 'Y') continue;
884
+				if ($file->direct_download !== 'Y') continue;
885 885
 
886
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
886
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
887 887
 				{
888 888
 					$source_file = $file->uploaded_filename;
889 889
 					break;
890 890
 				}
891 891
 
892
-				if($first_image) continue;
892
+				if ($first_image) continue;
893 893
 
894
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
894
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
895 895
 				{
896
-					if(file_exists($file->uploaded_filename))
896
+					if (file_exists($file->uploaded_filename))
897 897
 					{
898 898
 						$first_image = $file->uploaded_filename;
899 899
 					}
900 900
 				}
901 901
 			}
902 902
 
903
-			if(!$source_file && $first_image)
903
+			if (!$source_file && $first_image)
904 904
 			{
905 905
 				$source_file = $first_image;
906 906
 			}
907 907
 		}
908 908
 		// If not exists, file an image file from the content
909 909
 		$is_tmp_file = false;
910
-		if(!$source_file)
910
+		if (!$source_file)
911 911
 		{
912 912
 			$random = new Password();
913 913
 
914 914
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
915 915
 
916
-			foreach($matches as $target_image)
916
+			foreach ($matches as $target_image)
917 917
 			{
918 918
 				$target_src = trim($target_image[1]);
919
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
919
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
920 920
 
921
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
921
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
922 922
 				{
923 923
 					$target_src = Context::getRequestUri().$target_src;
924 924
 				}
925 925
 
926 926
 				$target_src = htmlspecialchars_decode($target_src);
927 927
 
928
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
928
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
929 929
 				FileHandler::getRemoteFile($target_src, $tmp_file);
930
-				if(!file_exists($tmp_file)) continue;
930
+				if (!file_exists($tmp_file)) continue;
931 931
 
932 932
 				$imageinfo = getimagesize($tmp_file);
933 933
 				list($_w, $_h) = $imageinfo;
934
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
934
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
935 935
 					FileHandler::removeFile($tmp_file);
936 936
 					continue;
937 937
 				}
@@ -942,13 +942,13 @@  discard block
 block discarded – undo
942 942
 			}
943 943
 		}
944 944
 
945
-		if($source_file)
945
+		if ($source_file)
946 946
 		{
947 947
 			$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
948 948
 		}
949 949
 
950 950
 		// Remove source file if it was temporary
951
-		if($is_tmp_file)
951
+		if ($is_tmp_file)
952 952
 		{
953 953
 			FileHandler::removeFile($source_file);
954 954
 		}
@@ -957,14 +957,14 @@  discard block
 block discarded – undo
957 957
 		FileHandler::removeFile($thumbnail_lockfile);
958 958
 
959 959
 		// Return the thumbnail path if it was successfully generated
960
-		if($output)
960
+		if ($output)
961 961
 		{
962 962
 			return $thumbnail_url;
963 963
 		}
964 964
 		// Create an empty file if thumbnail generation failed
965 965
 		else
966 966
 		{
967
-			FileHandler::writeFile($thumbnail_file, '','w');
967
+			FileHandler::writeFile($thumbnail_file, '', 'w');
968 968
 		}
969 969
 
970 970
 		return;
@@ -978,21 +978,21 @@  discard block
 block discarded – undo
978 978
 	 */
979 979
 	function getExtraImages($time_interval = 43200)
980 980
 	{
981
-		if(!$this->document_srl) return;
981
+		if (!$this->document_srl) return;
982 982
 		// variables for icon list
983 983
 		$buffs = array();
984 984
 
985 985
 		$check_files = false;
986 986
 
987 987
 		// Check if secret post is
988
-		if($this->isSecret()) $buffs[] = "secret";
988
+		if ($this->isSecret()) $buffs[] = "secret";
989 989
 
990 990
 		// Set the latest time
991
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
991
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
992 992
 
993 993
 		// Check new post
994
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
995
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
994
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
995
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
996 996
 
997 997
 		/*
998 998
 		   $content = $this->get('content');
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
 		 */
1016 1016
 
1017 1017
 		// Check the attachment
1018
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1018
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
1019 1019
 
1020 1020
 		return $buffs;
1021 1021
 	}
1022 1022
 
1023 1023
 	function getStatus()
1024 1024
 	{
1025
-		if(!$this->get('status')) return $this->getDefaultStatus();
1025
+		if (!$this->get('status')) return $this->getDefaultStatus();
1026 1026
 		return $this->get('status');
1027 1027
 	}
1028 1028
 
@@ -1033,15 +1033,15 @@  discard block
 block discarded – undo
1033 1033
 	 */
1034 1034
 	function printExtraImages($time_check = 43200)
1035 1035
 	{
1036
-		if(!$this->document_srl) return;
1036
+		if (!$this->document_srl) return;
1037 1037
 		// Get the icon directory
1038
-		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
1038
+		$path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/');
1039 1039
 
1040 1040
 		$buffs = $this->getExtraImages($time_check);
1041
-		if(!count($buffs)) return;
1041
+		if (!count($buffs)) return;
1042 1042
 
1043 1043
 		$buff = array();
1044
-		foreach($buffs as $key => $val)
1044
+		foreach ($buffs as $key => $val)
1045 1045
 		{
1046 1046
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1047 1047
 		}
@@ -1050,20 +1050,20 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 	function hasUploadedFiles()
1052 1052
 	{
1053
-		if(!$this->document_srl) return;
1053
+		if (!$this->document_srl) return;
1054 1054
 
1055
-		if($this->isSecret() && !$this->isGranted()) return false;
1056
-		return $this->get('uploaded_count')? true : false;
1055
+		if ($this->isSecret() && !$this->isGranted()) return false;
1056
+		return $this->get('uploaded_count') ? true : false;
1057 1057
 	}
1058 1058
 
1059 1059
 	function getUploadedFiles($sortIndex = 'file_srl')
1060 1060
 	{
1061
-		if(!$this->document_srl) return;
1061
+		if (!$this->document_srl) return;
1062 1062
 
1063
-		if($this->isSecret() && !$this->isGranted()) return;
1064
-		if(!$this->get('uploaded_count')) return;
1063
+		if ($this->isSecret() && !$this->isGranted()) return;
1064
+		if (!$this->get('uploaded_count')) return;
1065 1065
 
1066
-		if(!$this->uploadedFiles[$sortIndex])
1066
+		if (!$this->uploadedFiles[$sortIndex])
1067 1067
 		{
1068 1068
 			$oFileModel = getModel('file');
1069 1069
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 	function getEditor()
1080 1080
 	{
1081 1081
 		$module_srl = $this->get('module_srl');
1082
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1082
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1083 1083
 
1084 1084
 		$oEditorModel = getModel('editor');
1085 1085
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 	{
1095 1095
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1096 1096
 		if (!$this->allowComment()) return false;
1097
-		if(!$this->isGranted() && $this->isSecret()) return false;
1097
+		if (!$this->isGranted() && $this->isSecret()) return false;
1098 1098
 
1099 1099
 		return true;
1100 1100
 	}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	function getCommentEditor()
1107 1107
 	{
1108
-		if(!$this->isEnableComment()) return;
1108
+		if (!$this->isEnableComment()) return;
1109 1109
 
1110 1110
 		$oEditorModel = getModel('editor');
1111 1111
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1117,10 +1117,10 @@  discard block
 block discarded – undo
1117 1117
 	 */
1118 1118
 	function getProfileImage()
1119 1119
 	{
1120
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1120
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1121 1121
 		$oMemberModel = getModel('member');
1122 1122
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1123
-		if(!$profile_info) return;
1123
+		if (!$profile_info) return;
1124 1124
 
1125 1125
 		return $profile_info->src;
1126 1126
 	}
@@ -1132,21 +1132,21 @@  discard block
 block discarded – undo
1132 1132
 	function getSignature()
1133 1133
 	{
1134 1134
 		// Pass if a document doesn't exist
1135
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1135
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1136 1136
 		// Get signature information
1137 1137
 		$oMemberModel = getModel('member');
1138 1138
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1139 1139
 		// Check if a maximum height of signiture is set in the member module
1140
-		if(!isset($GLOBALS['__member_signature_max_height']))
1140
+		if (!isset($GLOBALS['__member_signature_max_height']))
1141 1141
 		{
1142 1142
 			$oModuleModel = getModel('module');
1143 1143
 			$member_config = $oModuleModel->getModuleConfig('member');
1144 1144
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1145 1145
 		}
1146
-		if($signature)
1146
+		if ($signature)
1147 1147
 		{
1148 1148
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1149
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1149
+			if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1150 1150
 		}
1151 1151
 
1152 1152
 		return $signature;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 */
1160 1160
 	function replaceResourceRealPath($matches)
1161 1161
 	{
1162
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1162
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1163 1163
 	}
1164 1164
 
1165 1165
 	/**
@@ -1170,19 +1170,19 @@  discard block
 block discarded – undo
1170 1170
 	function _checkAccessibleFromStatus()
1171 1171
 	{
1172 1172
 		$logged_info = Context::get('logged_info');
1173
-		if($logged_info->is_admin == 'Y') return true;
1173
+		if ($logged_info->is_admin == 'Y') return true;
1174 1174
 
1175 1175
 		$status = $this->get('status');
1176
-		if(empty($status)) return false;
1176
+		if (empty($status)) return false;
1177 1177
 
1178 1178
 		$oDocumentModel = getModel('document');
1179 1179
 		$configStatusList = $oDocumentModel->getStatusList();
1180 1180
 
1181
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1181
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1182 1182
 			return true;
1183
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1183
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1184 1184
 		{
1185
-			if($this->get('member_srl') == $logged_info->member_srl)
1185
+			if ($this->get('member_srl') == $logged_info->member_srl)
1186 1186
 				return true;
1187 1187
 		}
1188 1188
 		return false;
Please login to merge, or discard this patch.
Braces   +263 added lines, -110 removed lines patch added patch discarded remove patch
@@ -79,7 +79,9 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	function _loadFromDB($load_extra_vars = true)
81 81
 	{
82
-		if(!$this->document_srl) return;
82
+		if(!$this->document_srl) {
83
+			return;
84
+		}
83 85
 
84 86
 		$document_item = false;
85 87
 		$cache_put = false;
@@ -111,8 +113,7 @@  discard block
 block discarded – undo
111 113
 			{
112 114
 				$oCacheHandler->put($cache_key, $document_item);
113 115
 			}
114
-		}
115
-		else
116
+		} else
116 117
 		{
117 118
 			$document_item->readed_count = $output->data->readed_count;
118 119
 			$document_item->voted_count = $output->data->voted_count;
@@ -159,23 +160,33 @@  discard block
 block discarded – undo
159 160
 
160 161
 	function isGranted()
161 162
 	{
162
-		if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
163
+		if($_SESSION['own_document'][$this->document_srl]) {
164
+			return $this->grant_cache = true;
165
+		}
163 166
 
164 167
 		if($this->grant_cache !== null)
165 168
 		{
166 169
 			return $this->grant_cache;
167 170
 		}
168 171
 
169
-		if(!Context::get('is_logged')) return $this->grant_cache = false;
172
+		if(!Context::get('is_logged')) {
173
+			return $this->grant_cache = false;
174
+		}
170 175
 
171 176
 		$logged_info = Context::get('logged_info');
172
-		if($logged_info->is_admin == 'Y') return $this->grant_cache = true;
177
+		if($logged_info->is_admin == 'Y') {
178
+			return $this->grant_cache = true;
179
+		}
173 180
 
174 181
 		$oModuleModel = getModel('module');
175 182
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
176
-		if($grant->manager) return $this->grant_cache = true;
183
+		if($grant->manager) {
184
+			return $this->grant_cache = true;
185
+		}
177 186
 
178
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return $this->grant_cache = true;
187
+		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) {
188
+			return $this->grant_cache = true;
189
+		}
179 190
 
180 191
 		return $this->grant_cache = false;
181 192
 	}
@@ -194,7 +205,9 @@  discard block
 block discarded – undo
194 205
 	function allowComment()
195 206
 	{
196 207
 		// init write, document is not exists. so allow comment status is true
197
-		if(!$this->isExists()) return true;
208
+		if(!$this->isExists()) {
209
+			return true;
210
+		}
198 211
 
199 212
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
200 213
 	}
@@ -209,8 +222,7 @@  discard block
 block discarded – undo
209 222
 			if(!getClass('trackback'))
210 223
 			{
211 224
 				$allow_trackback_status = false;
212
-			}
213
-			else
225
+			} else
214 226
 			{
215 227
 				// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
216 228
 				$oModuleModel = getModel('module');
@@ -221,15 +233,21 @@  discard block
 block discarded – undo
221 233
 					$trackback_config = new stdClass();
222 234
 				}
223 235
 				
224
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
226
-				else
236
+				if(!isset($trackback_config->enable_trackback)) {
237
+					$trackback_config->enable_trackback = 'Y';
238
+				}
239
+				if($trackback_config->enable_trackback != 'Y') {
240
+					$allow_trackback_status = false;
241
+				} else
227 242
 				{
228 243
 					$module_srl = $this->get('module_srl');
229 244
 					// Check settings of each module
230 245
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
231
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
246
+					if($module_config->enable_trackback == 'N') {
247
+						$allow_trackback_status = false;
248
+					} else if($this->get('allow_trackback')=='Y' || !$this->isExists()) {
249
+						$allow_trackback_status = true;
250
+					}
233 251
 				}
234 252
 			}
235 253
 		}
@@ -238,14 +256,18 @@  discard block
 block discarded – undo
238 256
 
239 257
 	function isLocked()
240 258
 	{
241
-		if(!$this->isExists()) return false;
259
+		if(!$this->isExists()) {
260
+			return false;
261
+		}
242 262
 
243 263
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
244 264
 	}
245 265
 
246 266
 	function isEditable()
247 267
 	{
248
-		if($this->isGranted() || !$this->get('member_srl')) return true;
268
+		if($this->isGranted() || !$this->get('member_srl')) {
269
+			return true;
270
+		}
249 271
 		return false;
250 272
 	}
251 273
 
@@ -267,9 +289,14 @@  discard block
 block discarded – undo
267 289
 
268 290
 	function doCart()
269 291
 	{
270
-		if(!$this->document_srl) return false;
271
-		if($this->isCarted()) $this->removeCart();
272
-		else $this->addCart();
292
+		if(!$this->document_srl) {
293
+			return false;
294
+		}
295
+		if($this->isCarted()) {
296
+			$this->removeCart();
297
+		} else {
298
+			$this->addCart();
299
+		}
273 300
 	}
274 301
 
275 302
 	function addCart()
@@ -295,16 +322,26 @@  discard block
 block discarded – undo
295 322
 	 */
296 323
 	function notify($type, $content)
297 324
 	{
298
-		if(!$this->document_srl) return;
325
+		if(!$this->document_srl) {
326
+			return;
327
+		}
299 328
 		// return if it is not useNotify
300
-		if(!$this->useNotify()) return;
329
+		if(!$this->useNotify()) {
330
+			return;
331
+		}
301 332
 		// Pass if an author is not a logged-in user
302
-		if(!$this->get('member_srl')) return;
333
+		if(!$this->get('member_srl')) {
334
+			return;
335
+		}
303 336
 		// Return if the currently logged-in user is an author
304 337
 		$logged_info = Context::get('logged_info');
305
-		if($logged_info->member_srl == $this->get('member_srl')) return;
338
+		if($logged_info->member_srl == $this->get('member_srl')) {
339
+			return;
340
+		}
306 341
 		// List variables
307
-		if($type) $title = "[".$type."] ";
342
+		if($type) {
343
+			$title = "[".$type."] ";
344
+		}
308 345
 		$title .= cut_str(strip_tags($content), 10, '...');
309 346
 		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
310 347
 		$receiver_srl = $this->get('member_srl');
@@ -331,16 +368,22 @@  discard block
 block discarded – undo
331 368
 
332 369
 	function isExistsHomepage()
333 370
 	{
334
-		if(trim($this->get('homepage'))) return true;
371
+		if(trim($this->get('homepage'))) {
372
+			return true;
373
+		}
335 374
 		return false;
336 375
 	}
337 376
 
338 377
 	function getHomepageUrl()
339 378
 	{
340 379
 		$url = trim($this->get('homepage'));
341
-		if(!$url) return;
380
+		if(!$url) {
381
+			return;
382
+		}
342 383
 
343
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
384
+		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) {
385
+			$url = 'http://' . $url;
386
+		}
344 387
 
345 388
 		return $url;
346 389
 	}
@@ -372,43 +415,65 @@  discard block
 block discarded – undo
372 415
 
373 416
 	function getTitleText($cut_size = 0, $tail='...')
374 417
 	{
375
-		if(!$this->document_srl) return;
418
+		if(!$this->document_srl) {
419
+			return;
420
+		}
376 421
 
377
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
378
-		else $title = $this->get('title');
422
+		if($cut_size) {
423
+			$title = cut_str($this->get('title'), $cut_size, $tail);
424
+		} else {
425
+			$title = $this->get('title');
426
+		}
379 427
 
380 428
 		return $title;
381 429
 	}
382 430
 
383 431
 	function getTitle($cut_size = 0, $tail='...')
384 432
 	{
385
-		if(!$this->document_srl) return;
433
+		if(!$this->document_srl) {
434
+			return;
435
+		}
386 436
 
387 437
 		$title = $this->getTitleText($cut_size, $tail);
388 438
 
389 439
 		$attrs = array();
390 440
 		$this->add('title_color', trim($this->get('title_color')));
391
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
392
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
441
+		if($this->get('title_bold')=='Y') {
442
+			$attrs[] = "font-weight:bold;";
443
+		}
444
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
445
+			$attrs[] = "color:#".$this->get('title_color');
446
+		}
393 447
 
394
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
395
-		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
448
+		if(count($attrs)) {
449
+			return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
450
+		} else {
451
+			return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
452
+		}
396 453
 	}
397 454
 
398 455
 	function getContentText($strlen = 0)
399 456
 	{
400
-		if(!$this->document_srl) return;
457
+		if(!$this->document_srl) {
458
+			return;
459
+		}
401 460
 
402
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
461
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
462
+			return Context::getLang('msg_is_secret');
463
+		}
403 464
 
404 465
 		$result = $this->_checkAccessibleFromStatus();
405
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
466
+		if($result) {
467
+			$_SESSION['accessible'][$this->document_srl] = true;
468
+		}
406 469
 
407 470
 		$content = $this->get('content');
408 471
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
409 472
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
410 473
 
411
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
474
+		if($strlen) {
475
+			return cut_str(strip_tags($content),$strlen,'...');
476
+		}
412 477
 
413 478
 		return htmlspecialchars($content);
414 479
 	}
@@ -441,14 +506,12 @@  discard block
 block discarded – undo
441 506
 				}
442 507
 				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
443 508
 			}
444
-		}
445
-		else if($m[1] == 'embed')
509
+		} else if($m[1] == 'embed')
446 510
 		{
447 511
 			if(stripos($m[0], 'allowscriptaccess'))
448 512
 			{
449 513
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
450
-			}
451
-			else
514
+			} else
452 515
 			{
453 516
 				$m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]);
454 517
 			}
@@ -458,15 +521,23 @@  discard block
 block discarded – undo
458 521
 
459 522
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
460 523
 	{
461
-		if(!$this->document_srl) return;
524
+		if(!$this->document_srl) {
525
+			return;
526
+		}
462 527
 
463
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
528
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
529
+			return Context::getLang('msg_is_secret');
530
+		}
464 531
 
465 532
 		$result = $this->_checkAccessibleFromStatus();
466
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
533
+		if($result) {
534
+			$_SESSION['accessible'][$this->document_srl] = true;
535
+		}
467 536
 
468 537
 		$content = $this->get('content');
469
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
538
+		if(!$stripEmbedTagException) {
539
+			stripEmbedTagForAdmin($content, $this->get('member_srl'));
540
+		}
470 541
 
471 542
 		// Define a link if using a rewrite module
472 543
 		$oContext = &Context::getInstance();
@@ -500,10 +571,11 @@  discard block
 block discarded – undo
500 571
 				$this->document_srl, $memberSrl
501 572
 			);
502 573
 			// Add xe_content class although accessing content is not required
503
-		}
504
-		else
574
+		} else
505 575
 		{
506
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
576
+			if($add_xe_content_class) {
577
+				$content = sprintf('<div class="xe_content">%s</div>', $content);
578
+			}
507 579
 		}
508 580
 		// Change the image path to a valid absolute path if resource_realpath is true
509 581
 		if($resource_realpath)
@@ -622,11 +694,15 @@  discard block
 block discarded – undo
622 694
 
623 695
 	function getTrackbackUrl()
624 696
 	{
625
-		if(!$this->document_srl) return;
697
+		if(!$this->document_srl) {
698
+			return;
699
+		}
626 700
 
627 701
 		// Generate a key to prevent spams
628 702
 		$oTrackbackModel = getModel('trackback');
629
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
703
+		if($oTrackbackModel) {
704
+			return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
705
+		}
630 706
 	}
631 707
 
632 708
 	/**
@@ -645,7 +721,9 @@  discard block
 block discarded – undo
645 721
 
646 722
 	function isExtraVarsExists()
647 723
 	{
648
-		if(!$this->get('module_srl')) return false;
724
+		if(!$this->get('module_srl')) {
725
+			return false;
726
+		}
649 727
 		$oDocumentModel = getModel('document');
650 728
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
651 729
 		return count($extra_keys)?true:false;
@@ -653,7 +731,9 @@  discard block
 block discarded – undo
653 731
 
654 732
 	function getExtraVars()
655 733
 	{
656
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
734
+		if(!$this->get('module_srl') || !$this->document_srl) {
735
+			return null;
736
+		}
657 737
 
658 738
 		$oDocumentModel = getModel('document');
659 739
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -665,8 +745,7 @@  discard block
 block discarded – undo
665 745
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
666 746
 		{
667 747
 			return $extra_vars[$idx]->getValue();
668
-		}
669
-		else
748
+		} else
670 749
 		{
671 750
 			return '';
672 751
 		}
@@ -678,8 +757,7 @@  discard block
 block discarded – undo
678 757
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
679 758
 		{
680 759
 			return $extra_vars[$idx]->getValueHTML();
681
-		}
682
-		else
760
+		} else
683 761
 		{
684 762
 			return '';
685 763
 		}
@@ -701,8 +779,7 @@  discard block
 block discarded – undo
701 779
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
702 780
 		{
703 781
 			return $extra_eid[$eid]->getValue();
704
-		}
705
-		else
782
+		} else
706 783
 		{
707 784
 			return '';
708 785
 		}
@@ -720,8 +797,7 @@  discard block
 block discarded – undo
720 797
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
721 798
 		{
722 799
 			return $extra_eid[$eid]->getValueHTML();
723
-		}
724
-		else
800
+		} else
725 801
 		{
726 802
 			return '';
727 803
 		}
@@ -741,8 +817,12 @@  discard block
 block discarded – undo
741 817
 
742 818
 	function getComments()
743 819
 	{
744
-		if(!$this->getCommentCount()) return;
745
-		if(!$this->isGranted() && $this->isSecret()) return;
820
+		if(!$this->getCommentCount()) {
821
+			return;
822
+		}
823
+		if(!$this->isGranted() && $this->isSecret()) {
824
+			return;
825
+		}
746 826
 		// cpage is a number of comment pages
747 827
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
748 828
 		$cpage = Context::get($cpageStr);
@@ -755,7 +835,9 @@  discard block
 block discarded – undo
755 835
 		// Get a list of comments
756 836
 		$oCommentModel = getModel('comment');
757 837
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
758
-		if(!$output->toBool() || !count($output->data)) return;
838
+		if(!$output->toBool() || !count($output->data)) {
839
+			return;
840
+		}
759 841
 		// Create commentItem object from a comment list
760 842
 		// If admin priviledge is granted on parent posts, you can read its child posts.
761 843
 		$accessible = array();
@@ -765,7 +847,9 @@  discard block
 block discarded – undo
765 847
 			$oCommentItem = new commentItem();
766 848
 			$oCommentItem->setAttribute($val);
767 849
 			// If permission is granted to the post, you can access it temporarily
768
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
850
+			if($oCommentItem->isGranted()) {
851
+				$accessible[$val->comment_srl] = true;
852
+			}
769 853
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
770 854
 			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
771 855
 			{
@@ -776,7 +860,9 @@  discard block
 block discarded – undo
776 860
 		// Variable setting to be displayed on the skin
777 861
 		Context::set($cpageStr, $output->page_navigation->cur_page);
778 862
 		Context::set('cpage', $output->page_navigation->cur_page);
779
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
863
+		if($output->total_page>1) {
864
+			$this->comment_page_navigation = $output->page_navigation;
865
+		}
780 866
 
781 867
 		return $comment_list;
782 868
 	}
@@ -788,9 +874,13 @@  discard block
 block discarded – undo
788 874
 
789 875
 	function getTrackbacks()
790 876
 	{
791
-		if(!$this->document_srl) return;
877
+		if(!$this->document_srl) {
878
+			return;
879
+		}
792 880
 
793
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
881
+		if(!$this->allowTrackback() || !$this->get('trackback_count')) {
882
+			return;
883
+		}
794 884
 
795 885
 		$oTrackbackModel = getModel('trackback');
796 886
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -798,15 +888,21 @@  discard block
 block discarded – undo
798 888
 
799 889
 	function thumbnailExists($width = 80, $height = 0, $type = '')
800 890
 	{
801
-		if(!$this->document_srl) return false;
802
-		if(!$this->getThumbnail($width, $height, $type)) return false;
891
+		if(!$this->document_srl) {
892
+			return false;
893
+		}
894
+		if(!$this->getThumbnail($width, $height, $type)) {
895
+			return false;
896
+		}
803 897
 		return true;
804 898
 	}
805 899
 
806 900
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
807 901
 	{
808 902
 		// Return false if the document doesn't exist
809
-		if(!$this->document_srl) return;
903
+		if(!$this->document_srl) {
904
+			return;
905
+		}
810 906
 
811 907
 		if($this->isSecret() && !$this->isGranted())
812 908
 		{
@@ -814,7 +910,9 @@  discard block
 block discarded – undo
814 910
 		}
815 911
 
816 912
 		// If not specify its height, create a square
817
-		if(!$height) $height = $width;
913
+		if(!$height) {
914
+			$height = $width;
915
+		}
818 916
 
819 917
 		// Return false if neither attachement nor image files in the document
820 918
 		$content = $this->get('content');
@@ -832,7 +930,9 @@  discard block
 block discarded – undo
832 930
 				}
833 931
 			}
834 932
 
835
-			if(!preg_match("!<img!is", $content)) return;
933
+			if(!preg_match("!<img!is", $content)) {
934
+				return;
935
+			}
836 936
 		}
837 937
 		// Get thumbnai_type information from document module's configuration
838 938
 		if(!in_array($thumbnail_type, array('crop','ratio')))
@@ -859,8 +959,7 @@  discard block
 block discarded – undo
859 959
 			if(filesize($thumbnail_file) < 1)
860 960
 			{
861 961
 				return FALSE;
862
-			}
863
-			else
962
+			} else
864 963
 			{
865 964
 				return $thumbnail_url;
866 965
 			}
@@ -881,7 +980,9 @@  discard block
 block discarded – undo
881 980
 			$first_image = null;
882 981
 			foreach($file_list as $file)
883 982
 			{
884
-				if($file->direct_download !== 'Y') continue;
983
+				if($file->direct_download !== 'Y') {
984
+					continue;
985
+				}
885 986
 
886 987
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
887 988
 				{
@@ -889,7 +990,9 @@  discard block
 block discarded – undo
889 990
 					break;
890 991
 				}
891 992
 
892
-				if($first_image) continue;
993
+				if($first_image) {
994
+					continue;
995
+				}
893 996
 
894 997
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
895 998
 				{
@@ -916,7 +1019,9 @@  discard block
 block discarded – undo
916 1019
 			foreach($matches as $target_image)
917 1020
 			{
918 1021
 				$target_src = trim($target_image[1]);
919
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
1022
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
1023
+					continue;
1024
+				}
920 1025
 
921 1026
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
922 1027
 				{
@@ -927,7 +1032,9 @@  discard block
 block discarded – undo
927 1032
 
928 1033
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
929 1034
 				FileHandler::getRemoteFile($target_src, $tmp_file);
930
-				if(!file_exists($tmp_file)) continue;
1035
+				if(!file_exists($tmp_file)) {
1036
+					continue;
1037
+				}
931 1038
 
932 1039
 				$imageinfo = getimagesize($tmp_file);
933 1040
 				list($_w, $_h) = $imageinfo;
@@ -978,21 +1085,28 @@  discard block
 block discarded – undo
978 1085
 	 */
979 1086
 	function getExtraImages($time_interval = 43200)
980 1087
 	{
981
-		if(!$this->document_srl) return;
1088
+		if(!$this->document_srl) {
1089
+			return;
1090
+		}
982 1091
 		// variables for icon list
983 1092
 		$buffs = array();
984 1093
 
985 1094
 		$check_files = false;
986 1095
 
987 1096
 		// Check if secret post is
988
-		if($this->isSecret()) $buffs[] = "secret";
1097
+		if($this->isSecret()) {
1098
+			$buffs[] = "secret";
1099
+		}
989 1100
 
990 1101
 		// Set the latest time
991 1102
 		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
992 1103
 
993 1104
 		// Check new post
994
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
995
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
1105
+		if($this->get('regdate')>$time_check) {
1106
+			$buffs[] = "new";
1107
+		} else if($this->get('last_update')>$time_check) {
1108
+			$buffs[] = "update";
1109
+		}
996 1110
 
997 1111
 		/*
998 1112
 		   $content = $this->get('content');
@@ -1015,14 +1129,18 @@  discard block
 block discarded – undo
1015 1129
 		 */
1016 1130
 
1017 1131
 		// Check the attachment
1018
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1132
+		if($this->hasUploadedFiles()) {
1133
+			$buffs[] = "file";
1134
+		}
1019 1135
 
1020 1136
 		return $buffs;
1021 1137
 	}
1022 1138
 
1023 1139
 	function getStatus()
1024 1140
 	{
1025
-		if(!$this->get('status')) return $this->getDefaultStatus();
1141
+		if(!$this->get('status')) {
1142
+			return $this->getDefaultStatus();
1143
+		}
1026 1144
 		return $this->get('status');
1027 1145
 	}
1028 1146
 
@@ -1033,12 +1151,16 @@  discard block
 block discarded – undo
1033 1151
 	 */
1034 1152
 	function printExtraImages($time_check = 43200)
1035 1153
 	{
1036
-		if(!$this->document_srl) return;
1154
+		if(!$this->document_srl) {
1155
+			return;
1156
+		}
1037 1157
 		// Get the icon directory
1038 1158
 		$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
1039 1159
 
1040 1160
 		$buffs = $this->getExtraImages($time_check);
1041
-		if(!count($buffs)) return;
1161
+		if(!count($buffs)) {
1162
+			return;
1163
+		}
1042 1164
 
1043 1165
 		$buff = array();
1044 1166
 		foreach($buffs as $key => $val)
@@ -1050,18 +1172,28 @@  discard block
 block discarded – undo
1050 1172
 
1051 1173
 	function hasUploadedFiles()
1052 1174
 	{
1053
-		if(!$this->document_srl) return;
1175
+		if(!$this->document_srl) {
1176
+			return;
1177
+		}
1054 1178
 
1055
-		if($this->isSecret() && !$this->isGranted()) return false;
1179
+		if($this->isSecret() && !$this->isGranted()) {
1180
+			return false;
1181
+		}
1056 1182
 		return $this->get('uploaded_count')? true : false;
1057 1183
 	}
1058 1184
 
1059 1185
 	function getUploadedFiles($sortIndex = 'file_srl')
1060 1186
 	{
1061
-		if(!$this->document_srl) return;
1187
+		if(!$this->document_srl) {
1188
+			return;
1189
+		}
1062 1190
 
1063
-		if($this->isSecret() && !$this->isGranted()) return;
1064
-		if(!$this->get('uploaded_count')) return;
1191
+		if($this->isSecret() && !$this->isGranted()) {
1192
+			return;
1193
+		}
1194
+		if(!$this->get('uploaded_count')) {
1195
+			return;
1196
+		}
1065 1197
 
1066 1198
 		if(!$this->uploadedFiles[$sortIndex])
1067 1199
 		{
@@ -1079,7 +1211,9 @@  discard block
 block discarded – undo
1079 1211
 	function getEditor()
1080 1212
 	{
1081 1213
 		$module_srl = $this->get('module_srl');
1082
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1214
+		if(!$module_srl) {
1215
+			$module_srl = Context::get('module_srl');
1216
+		}
1083 1217
 
1084 1218
 		$oEditorModel = getModel('editor');
1085 1219
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1093,8 +1227,12 @@  discard block
 block discarded – undo
1093 1227
 	function isEnableComment()
1094 1228
 	{
1095 1229
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1096
-		if (!$this->allowComment()) return false;
1097
-		if(!$this->isGranted() && $this->isSecret()) return false;
1230
+		if (!$this->allowComment()) {
1231
+			return false;
1232
+		}
1233
+		if(!$this->isGranted() && $this->isSecret()) {
1234
+			return false;
1235
+		}
1098 1236
 
1099 1237
 		return true;
1100 1238
 	}
@@ -1105,7 +1243,9 @@  discard block
 block discarded – undo
1105 1243
 	 */
1106 1244
 	function getCommentEditor()
1107 1245
 	{
1108
-		if(!$this->isEnableComment()) return;
1246
+		if(!$this->isEnableComment()) {
1247
+			return;
1248
+		}
1109 1249
 
1110 1250
 		$oEditorModel = getModel('editor');
1111 1251
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1117,10 +1257,14 @@  discard block
 block discarded – undo
1117 1257
 	 */
1118 1258
 	function getProfileImage()
1119 1259
 	{
1120
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1260
+		if(!$this->isExists() || !$this->get('member_srl')) {
1261
+			return;
1262
+		}
1121 1263
 		$oMemberModel = getModel('member');
1122 1264
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1123
-		if(!$profile_info) return;
1265
+		if(!$profile_info) {
1266
+			return;
1267
+		}
1124 1268
 
1125 1269
 		return $profile_info->src;
1126 1270
 	}
@@ -1132,7 +1276,9 @@  discard block
 block discarded – undo
1132 1276
 	function getSignature()
1133 1277
 	{
1134 1278
 		// Pass if a document doesn't exist
1135
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1279
+		if(!$this->isExists() || !$this->get('member_srl')) {
1280
+			return;
1281
+		}
1136 1282
 		// Get signature information
1137 1283
 		$oMemberModel = getModel('member');
1138 1284
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1146,7 +1292,9 @@  discard block
 block discarded – undo
1146 1292
 		if($signature)
1147 1293
 		{
1148 1294
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1149
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1295
+			if($max_signature_height) {
1296
+				$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);
1297
+			}
1150 1298
 		}
1151 1299
 
1152 1300
 		return $signature;
@@ -1170,20 +1318,25 @@  discard block
 block discarded – undo
1170 1318
 	function _checkAccessibleFromStatus()
1171 1319
 	{
1172 1320
 		$logged_info = Context::get('logged_info');
1173
-		if($logged_info->is_admin == 'Y') return true;
1321
+		if($logged_info->is_admin == 'Y') {
1322
+			return true;
1323
+		}
1174 1324
 
1175 1325
 		$status = $this->get('status');
1176
-		if(empty($status)) return false;
1326
+		if(empty($status)) {
1327
+			return false;
1328
+		}
1177 1329
 
1178 1330
 		$oDocumentModel = getModel('document');
1179 1331
 		$configStatusList = $oDocumentModel->getStatusList();
1180 1332
 
1181
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1182
-			return true;
1183
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1333
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1334
+					return true;
1335
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1184 1336
 		{
1185
-			if($this->get('member_srl') == $logged_info->member_srl)
1186
-				return true;
1337
+			if($this->get('member_srl') == $logged_info->member_srl) {
1338
+							return true;
1339
+			}
1187 1340
 		}
1188 1341
 		return false;
1189 1342
 	}
Please login to merge, or discard this patch.