@@ -79,7 +79,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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') && abs($this->get('member_srl')) == $logged_info->member_srl) |
|
178 | + if ($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl) |
|
179 | 179 | { |
180 | 180 | return $this->grant_cache = true; |
181 | 181 | } |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | |
192 | 192 | function isAccessible() |
193 | 193 | { |
194 | - return $_SESSION['accessible'][$this->document_srl]==true?true:false; |
|
194 | + return $_SESSION['accessible'][$this->document_srl] == true ?true:false; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | function allowComment() |
198 | 198 | { |
199 | 199 | // init write, document is not exists. so allow comment status is true |
200 | - if(!$this->isExists()) return true; |
|
200 | + if (!$this->isExists()) return true; |
|
201 | 201 | |
202 | 202 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
203 | 203 | } |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | function allowTrackback() |
206 | 206 | { |
207 | 207 | static $allow_trackback_status = null; |
208 | - if(is_null($allow_trackback_status)) |
|
208 | + if (is_null($allow_trackback_status)) |
|
209 | 209 | { |
210 | 210 | |
211 | 211 | // Check the tarckback module exist |
212 | - if(!getClass('trackback')) |
|
212 | + if (!getClass('trackback')) |
|
213 | 213 | { |
214 | 214 | $allow_trackback_status = false; |
215 | 215 | } |
@@ -219,20 +219,20 @@ discard block |
||
219 | 219 | $oModuleModel = getModel('module'); |
220 | 220 | $trackback_config = $oModuleModel->getModuleConfig('trackback'); |
221 | 221 | |
222 | - if(!$trackback_config) |
|
222 | + if (!$trackback_config) |
|
223 | 223 | { |
224 | 224 | $trackback_config = new stdClass(); |
225 | 225 | } |
226 | 226 | |
227 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
228 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
227 | + if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
228 | + if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
229 | 229 | else |
230 | 230 | { |
231 | 231 | $module_srl = $this->get('module_srl'); |
232 | 232 | // Check settings of each module |
233 | 233 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
234 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
235 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
234 | + if ($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
235 | + else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true; |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | |
242 | 242 | function isLocked() |
243 | 243 | { |
244 | - if(!$this->isExists()) return false; |
|
244 | + if (!$this->isExists()) return false; |
|
245 | 245 | |
246 | 246 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
247 | 247 | } |
248 | 248 | |
249 | 249 | function isEditable() |
250 | 250 | { |
251 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
251 | + if ($this->isGranted() || !$this->get('member_srl')) return true; |
|
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | |
266 | 266 | function useNotify() |
267 | 267 | { |
268 | - return $this->get('notify_message')=='Y' ? true : false; |
|
268 | + return $this->get('notify_message') == 'Y' ? true : false; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | function doCart() |
272 | 272 | { |
273 | - if(!$this->document_srl) return false; |
|
274 | - if($this->isCarted()) $this->removeCart(); |
|
273 | + if (!$this->document_srl) return false; |
|
274 | + if ($this->isCarted()) $this->removeCart(); |
|
275 | 275 | else $this->addCart(); |
276 | 276 | } |
277 | 277 | |
@@ -298,18 +298,18 @@ discard block |
||
298 | 298 | */ |
299 | 299 | function notify($type, $content) |
300 | 300 | { |
301 | - if(!$this->document_srl) return; |
|
301 | + if (!$this->document_srl) return; |
|
302 | 302 | // return if it is not useNotify |
303 | - if(!$this->useNotify()) return; |
|
303 | + if (!$this->useNotify()) return; |
|
304 | 304 | // Pass if an author is not a logged-in user |
305 | - if(!$this->get('member_srl')) return; |
|
305 | + if (!$this->get('member_srl')) return; |
|
306 | 306 | // Return if the currently logged-in user is an author |
307 | 307 | $logged_info = Context::get('logged_info'); |
308 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
308 | + if ($logged_info->member_srl == $this->get('member_srl')) return; |
|
309 | 309 | // List variables |
310 | - if($type) $title = "[".$type."] "; |
|
310 | + if ($type) $title = "[".$type."] "; |
|
311 | 311 | $title .= cut_str(strip_tags($content), 10, '...'); |
312 | - $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)); |
|
312 | + $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)); |
|
313 | 313 | $receiver_srl = $this->get('member_srl'); |
314 | 314 | $sender_member_srl = $logged_info->member_srl; |
315 | 315 | // Send a message |
@@ -324,26 +324,26 @@ discard block |
||
324 | 324 | |
325 | 325 | function getIpAddress() |
326 | 326 | { |
327 | - if($this->isGranted()) |
|
327 | + if ($this->isGranted()) |
|
328 | 328 | { |
329 | 329 | return $this->get('ipaddress'); |
330 | 330 | } |
331 | 331 | |
332 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
332 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | function isExistsHomepage() |
336 | 336 | { |
337 | - if(trim($this->get('homepage'))) return true; |
|
337 | + if (trim($this->get('homepage'))) return true; |
|
338 | 338 | return false; |
339 | 339 | } |
340 | 340 | |
341 | 341 | function getHomepageUrl() |
342 | 342 | { |
343 | 343 | $url = trim($this->get('homepage')); |
344 | - if(!$url) return; |
|
344 | + if (!$url) return; |
|
345 | 345 | |
346 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
346 | + if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://'.$url; |
|
347 | 347 | |
348 | 348 | return $url; |
349 | 349 | } |
@@ -373,52 +373,52 @@ discard block |
||
373 | 373 | return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
374 | 374 | } |
375 | 375 | |
376 | - function getTitleText($cut_size = 0, $tail='...') |
|
376 | + function getTitleText($cut_size = 0, $tail = '...') |
|
377 | 377 | { |
378 | - if(!$this->document_srl) return; |
|
378 | + if (!$this->document_srl) return; |
|
379 | 379 | |
380 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
380 | + if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
381 | 381 | else $title = $this->get('title'); |
382 | 382 | |
383 | 383 | return $title; |
384 | 384 | } |
385 | 385 | |
386 | - function getTitle($cut_size = 0, $tail='...') |
|
386 | + function getTitle($cut_size = 0, $tail = '...') |
|
387 | 387 | { |
388 | - if(!$this->document_srl) return; |
|
388 | + if (!$this->document_srl) return; |
|
389 | 389 | |
390 | 390 | $title = $this->getTitleText($cut_size, $tail); |
391 | 391 | |
392 | 392 | $attrs = array(); |
393 | 393 | $this->add('title_color', trim($this->get('title_color'))); |
394 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
395 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
394 | + if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;"; |
|
395 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
396 | 396 | |
397 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
397 | + if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
398 | 398 | else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
399 | 399 | } |
400 | 400 | |
401 | 401 | function getContentText($strlen = 0) |
402 | 402 | { |
403 | - if(!$this->document_srl) return; |
|
403 | + if (!$this->document_srl) return; |
|
404 | 404 | |
405 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
405 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
406 | 406 | |
407 | 407 | $result = $this->_checkAccessibleFromStatus(); |
408 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
408 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
409 | 409 | |
410 | 410 | $content = $this->get('content'); |
411 | 411 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
412 | 412 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
413 | 413 | |
414 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
414 | + if ($strlen) return cut_str(strip_tags($content), $strlen, '...'); |
|
415 | 415 | |
416 | 416 | return htmlspecialchars($content); |
417 | 417 | } |
418 | 418 | |
419 | 419 | function _addAllowScriptAccess($m) |
420 | 420 | { |
421 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
421 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
422 | 422 | { |
423 | 423 | $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
424 | 424 | } |
@@ -428,26 +428,26 @@ discard block |
||
428 | 428 | |
429 | 429 | function _checkAllowScriptAccess($m) |
430 | 430 | { |
431 | - if($m[1] == 'object') |
|
431 | + if ($m[1] == 'object') |
|
432 | 432 | { |
433 | 433 | $this->allowscriptaccessList[] = 1; |
434 | 434 | } |
435 | 435 | |
436 | - if($m[1] == 'param') |
|
436 | + if ($m[1] == 'param') |
|
437 | 437 | { |
438 | - if(stripos($m[0], 'allowscriptaccess')) |
|
438 | + if (stripos($m[0], 'allowscriptaccess')) |
|
439 | 439 | { |
440 | 440 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
441 | - if(substr($m[0], -1) == '/') |
|
441 | + if (substr($m[0], -1) == '/') |
|
442 | 442 | { |
443 | 443 | $m[0] .= '/'; |
444 | 444 | } |
445 | - $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
|
445 | + $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
|
446 | 446 | } |
447 | 447 | } |
448 | - else if($m[1] == 'embed') |
|
448 | + else if ($m[1] == 'embed') |
|
449 | 449 | { |
450 | - if(stripos($m[0], 'allowscriptaccess')) |
|
450 | + if (stripos($m[0], 'allowscriptaccess')) |
|
451 | 451 | { |
452 | 452 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
453 | 453 | } |
@@ -461,24 +461,24 @@ discard block |
||
461 | 461 | |
462 | 462 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
463 | 463 | { |
464 | - if(!$this->document_srl) return; |
|
464 | + if (!$this->document_srl) return; |
|
465 | 465 | |
466 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
466 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
467 | 467 | |
468 | 468 | $result = $this->_checkAccessibleFromStatus(); |
469 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
469 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
470 | 470 | |
471 | 471 | $content = $this->get('content'); |
472 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
472 | + if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
473 | 473 | |
474 | 474 | // Define a link if using a rewrite module |
475 | 475 | $oContext = &Context::getInstance(); |
476 | - if($oContext->allow_rewrite) |
|
476 | + if ($oContext->allow_rewrite) |
|
477 | 477 | { |
478 | - $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content); |
|
478 | + $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content); |
|
479 | 479 | } |
480 | 480 | // To display a pop-up menu |
481 | - if($add_popup_menu) |
|
481 | + if ($add_popup_menu) |
|
482 | 482 | { |
483 | 483 | $content = sprintf( |
484 | 484 | '%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>', |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | ); |
488 | 488 | } |
489 | 489 | // If additional content information is set |
490 | - if($add_content_info) |
|
490 | + if ($add_content_info) |
|
491 | 491 | { |
492 | 492 | $memberSrl = $this->get('member_srl'); |
493 | - if($memberSrl < 0) |
|
493 | + if ($memberSrl < 0) |
|
494 | 494 | { |
495 | 495 | $memberSrl = 0; |
496 | 496 | } |
@@ -506,12 +506,12 @@ discard block |
||
506 | 506 | } |
507 | 507 | else |
508 | 508 | { |
509 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
509 | + if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
510 | 510 | } |
511 | 511 | // Change the image path to a valid absolute path if resource_realpath is true |
512 | - if($resource_realpath) |
|
512 | + if ($resource_realpath) |
|
513 | 513 | { |
514 | - $content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content); |
|
514 | + $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | return $content; |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | $content = trim(cut_str($content, $str_size, $tail)); |
561 | 561 | |
562 | 562 | // Replace back < , <, " |
563 | - $content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content); |
|
563 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
564 | 564 | |
565 | 565 | return $content; |
566 | 566 | } |
@@ -573,13 +573,13 @@ discard block |
||
573 | 573 | function getRegdateTime() |
574 | 574 | { |
575 | 575 | $regdate = $this->get('regdate'); |
576 | - $year = substr($regdate,0,4); |
|
577 | - $month = substr($regdate,4,2); |
|
578 | - $day = substr($regdate,6,2); |
|
579 | - $hour = substr($regdate,8,2); |
|
580 | - $min = substr($regdate,10,2); |
|
581 | - $sec = substr($regdate,12,2); |
|
582 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
576 | + $year = substr($regdate, 0, 4); |
|
577 | + $month = substr($regdate, 4, 2); |
|
578 | + $day = substr($regdate, 6, 2); |
|
579 | + $hour = substr($regdate, 8, 2); |
|
580 | + $min = substr($regdate, 10, 2); |
|
581 | + $sec = substr($regdate, 12, 2); |
|
582 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | function getRegdateGM() |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | |
590 | 590 | function getRegdateDT() |
591 | 591 | { |
592 | - return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
592 | + return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -599,13 +599,13 @@ discard block |
||
599 | 599 | |
600 | 600 | function getUpdateTime() |
601 | 601 | { |
602 | - $year = substr($this->get('last_update'),0,4); |
|
603 | - $month = substr($this->get('last_update'),4,2); |
|
604 | - $day = substr($this->get('last_update'),6,2); |
|
605 | - $hour = substr($this->get('last_update'),8,2); |
|
606 | - $min = substr($this->get('last_update'),10,2); |
|
607 | - $sec = substr($this->get('last_update'),12,2); |
|
608 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
602 | + $year = substr($this->get('last_update'), 0, 4); |
|
603 | + $month = substr($this->get('last_update'), 4, 2); |
|
604 | + $day = substr($this->get('last_update'), 6, 2); |
|
605 | + $hour = substr($this->get('last_update'), 8, 2); |
|
606 | + $min = substr($this->get('last_update'), 10, 2); |
|
607 | + $sec = substr($this->get('last_update'), 12, 2); |
|
608 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | function getUpdateGM() |
@@ -615,21 +615,21 @@ discard block |
||
615 | 615 | |
616 | 616 | function getUpdateDT() |
617 | 617 | { |
618 | - return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
618 | + return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | function getPermanentUrl() |
622 | 622 | { |
623 | - return getFullUrl('','mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl')); |
|
623 | + return getFullUrl('', 'mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl')); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | function getTrackbackUrl() |
627 | 627 | { |
628 | - if(!$this->document_srl) return; |
|
628 | + if (!$this->document_srl) return; |
|
629 | 629 | |
630 | 630 | // Generate a key to prevent spams |
631 | 631 | $oTrackbackModel = getModel('trackback'); |
632 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
632 | + if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | /** |
@@ -639,24 +639,24 @@ discard block |
||
639 | 639 | function updateReadedCount() |
640 | 640 | { |
641 | 641 | $oDocumentController = getController('document'); |
642 | - if($oDocumentController->updateReadedCount($this)) |
|
642 | + if ($oDocumentController->updateReadedCount($this)) |
|
643 | 643 | { |
644 | 644 | $readed_count = $this->get('readed_count'); |
645 | - $this->add('readed_count', $readed_count+1); |
|
645 | + $this->add('readed_count', $readed_count + 1); |
|
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
649 | 649 | function isExtraVarsExists() |
650 | 650 | { |
651 | - if(!$this->get('module_srl')) return false; |
|
651 | + if (!$this->get('module_srl')) return false; |
|
652 | 652 | $oDocumentModel = getModel('document'); |
653 | 653 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
654 | - return count($extra_keys)?true:false; |
|
654 | + return count($extra_keys) ?true:false; |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | function getExtraVars() |
658 | 658 | { |
659 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
659 | + if (!$this->get('module_srl') || !$this->document_srl) return null; |
|
660 | 660 | |
661 | 661 | $oDocumentModel = getModel('document'); |
662 | 662 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | function getExtraValue($idx) |
666 | 666 | { |
667 | 667 | $extra_vars = $this->getExtraVars(); |
668 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
668 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
669 | 669 | { |
670 | 670 | return $extra_vars[$idx]->getValue(); |
671 | 671 | } |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | function getExtraValueHTML($idx) |
679 | 679 | { |
680 | 680 | $extra_vars = $this->getExtraVars(); |
681 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
681 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
682 | 682 | { |
683 | 683 | return $extra_vars[$idx]->getValueHTML(); |
684 | 684 | } |
@@ -692,16 +692,16 @@ discard block |
||
692 | 692 | { |
693 | 693 | $extra_vars = $this->getExtraVars(); |
694 | 694 | |
695 | - if($extra_vars) |
|
695 | + if ($extra_vars) |
|
696 | 696 | { |
697 | 697 | // Handle extra variable(eid) |
698 | - foreach($extra_vars as $idx => $key) |
|
698 | + foreach ($extra_vars as $idx => $key) |
|
699 | 699 | { |
700 | 700 | $extra_eid[$key->eid] = $key; |
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
704 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
704 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
705 | 705 | { |
706 | 706 | return $extra_eid[$eid]->getValue(); |
707 | 707 | } |
@@ -715,12 +715,12 @@ discard block |
||
715 | 715 | { |
716 | 716 | $extra_vars = $this->getExtraVars(); |
717 | 717 | // Handle extra variable(eid) |
718 | - foreach($extra_vars as $idx => $key) |
|
718 | + foreach ($extra_vars as $idx => $key) |
|
719 | 719 | { |
720 | 720 | $extra_eid[$key->eid] = $key; |
721 | 721 | } |
722 | 722 | |
723 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
723 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
724 | 724 | { |
725 | 725 | return $extra_eid[$eid]->getValueHTML(); |
726 | 726 | } |
@@ -744,13 +744,13 @@ discard block |
||
744 | 744 | |
745 | 745 | function getComments() |
746 | 746 | { |
747 | - if(!$this->getCommentCount()) return; |
|
748 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
747 | + if (!$this->getCommentCount()) return; |
|
748 | + if (!$this->isGranted() && $this->isSecret()) return; |
|
749 | 749 | // cpage is a number of comment pages |
750 | 750 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
751 | 751 | $cpage = Context::get($cpageStr); |
752 | 752 | |
753 | - if(!$cpage) |
|
753 | + if (!$cpage) |
|
754 | 754 | { |
755 | 755 | $cpage = Context::get('cpage'); |
756 | 756 | } |
@@ -758,19 +758,19 @@ discard block |
||
758 | 758 | // Get a list of comments |
759 | 759 | $oCommentModel = getModel('comment'); |
760 | 760 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
761 | - if(!$output->toBool() || !count($output->data)) return; |
|
761 | + if (!$output->toBool() || !count($output->data)) return; |
|
762 | 762 | // Create commentItem object from a comment list |
763 | 763 | // If admin priviledge is granted on parent posts, you can read its child posts. |
764 | 764 | $accessible = array(); |
765 | 765 | $comment_list = array(); |
766 | - foreach($output->data as $key => $val) |
|
766 | + foreach ($output->data as $key => $val) |
|
767 | 767 | { |
768 | 768 | $oCommentItem = new commentItem(); |
769 | 769 | $oCommentItem->setAttribute($val); |
770 | 770 | // If permission is granted to the post, you can access it temporarily |
771 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
771 | + if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
772 | 772 | // 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 |
773 | - if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
|
773 | + if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) |
|
774 | 774 | { |
775 | 775 | $oCommentItem->setAccessible(); |
776 | 776 | } |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | // Variable setting to be displayed on the skin |
780 | 780 | Context::set($cpageStr, $output->page_navigation->cur_page); |
781 | 781 | Context::set('cpage', $output->page_navigation->cur_page); |
782 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
782 | + if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation; |
|
783 | 783 | |
784 | 784 | // Call trigger (after) |
785 | 785 | $output = ModuleHandler::triggerCall('document.getComments', 'after', $comment_list); |
@@ -794,9 +794,9 @@ discard block |
||
794 | 794 | |
795 | 795 | function getTrackbacks() |
796 | 796 | { |
797 | - if(!$this->document_srl) return; |
|
797 | + if (!$this->document_srl) return; |
|
798 | 798 | |
799 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
799 | + if (!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
800 | 800 | |
801 | 801 | $oTrackbackModel = getModel('trackback'); |
802 | 802 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -804,47 +804,47 @@ discard block |
||
804 | 804 | |
805 | 805 | function thumbnailExists($width = 80, $height = 0, $type = '') |
806 | 806 | { |
807 | - if(!$this->document_srl) return false; |
|
808 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
807 | + if (!$this->document_srl) return false; |
|
808 | + if (!$this->getThumbnail($width, $height, $type)) return false; |
|
809 | 809 | return true; |
810 | 810 | } |
811 | 811 | |
812 | 812 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
813 | 813 | { |
814 | 814 | // Return false if the document doesn't exist |
815 | - if(!$this->document_srl) return; |
|
815 | + if (!$this->document_srl) return; |
|
816 | 816 | |
817 | - if($this->isSecret() && !$this->isGranted()) |
|
817 | + if ($this->isSecret() && !$this->isGranted()) |
|
818 | 818 | { |
819 | 819 | return; |
820 | 820 | } |
821 | 821 | |
822 | 822 | // If not specify its height, create a square |
823 | - if(!$height) $height = $width; |
|
823 | + if (!$height) $height = $width; |
|
824 | 824 | |
825 | 825 | // Return false if neither attachement nor image files in the document |
826 | 826 | $content = $this->get('content'); |
827 | - if(!$this->get('uploaded_count')) |
|
827 | + if (!$this->get('uploaded_count')) |
|
828 | 828 | { |
829 | - if(!$content) |
|
829 | + if (!$content) |
|
830 | 830 | { |
831 | 831 | $args = new stdClass(); |
832 | 832 | $args->document_srl = $this->document_srl; |
833 | 833 | $output = executeQuery('document.getDocument', $args, array('content')); |
834 | - if($output->toBool() && $output->data) |
|
834 | + if ($output->toBool() && $output->data) |
|
835 | 835 | { |
836 | 836 | $content = $output->data->content; |
837 | 837 | $this->add('content', $content); |
838 | 838 | } |
839 | 839 | } |
840 | 840 | |
841 | - if(!preg_match("!<img!is", $content)) return; |
|
841 | + if (!preg_match("!<img!is", $content)) return; |
|
842 | 842 | } |
843 | 843 | // Get thumbnai_type information from document module's configuration |
844 | - if(!in_array($thumbnail_type, array('crop','ratio'))) |
|
844 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
845 | 845 | { |
846 | 846 | $config = $GLOBALS['__document_config__']; |
847 | - if(!$config) |
|
847 | + if (!$config) |
|
848 | 848 | { |
849 | 849 | $oDocumentModel = getModel('document'); |
850 | 850 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -854,21 +854,21 @@ discard block |
||
854 | 854 | } |
855 | 855 | |
856 | 856 | // Define thumbnail information |
857 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3)); |
|
857 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3)); |
|
858 | 858 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
859 | 859 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
860 | 860 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
861 | 861 | |
862 | 862 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
863 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
863 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
864 | 864 | { |
865 | - if(filesize($thumbnail_file) < 1) |
|
865 | + if (filesize($thumbnail_file) < 1) |
|
866 | 866 | { |
867 | 867 | return FALSE; |
868 | 868 | } |
869 | 869 | else |
870 | 870 | { |
871 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
871 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
872 | 872 | } |
873 | 873 | } |
874 | 874 | |
@@ -880,64 +880,64 @@ discard block |
||
880 | 880 | $is_tmp_file = false; |
881 | 881 | |
882 | 882 | // Find an iamge file among attached files if exists |
883 | - if($this->hasUploadedFiles()) |
|
883 | + if ($this->hasUploadedFiles()) |
|
884 | 884 | { |
885 | 885 | $file_list = $this->getUploadedFiles(); |
886 | 886 | |
887 | 887 | $first_image = null; |
888 | - foreach($file_list as $file) |
|
888 | + foreach ($file_list as $file) |
|
889 | 889 | { |
890 | - if($file->direct_download !== 'Y') continue; |
|
890 | + if ($file->direct_download !== 'Y') continue; |
|
891 | 891 | |
892 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
892 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
893 | 893 | { |
894 | 894 | $source_file = $file->uploaded_filename; |
895 | 895 | break; |
896 | 896 | } |
897 | 897 | |
898 | - if($first_image) continue; |
|
898 | + if ($first_image) continue; |
|
899 | 899 | |
900 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
900 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
901 | 901 | { |
902 | - if(file_exists($file->uploaded_filename)) |
|
902 | + if (file_exists($file->uploaded_filename)) |
|
903 | 903 | { |
904 | 904 | $first_image = $file->uploaded_filename; |
905 | 905 | } |
906 | 906 | } |
907 | 907 | } |
908 | 908 | |
909 | - if(!$source_file && $first_image) |
|
909 | + if (!$source_file && $first_image) |
|
910 | 910 | { |
911 | 911 | $source_file = $first_image; |
912 | 912 | } |
913 | 913 | } |
914 | 914 | // If not exists, file an image file from the content |
915 | 915 | $is_tmp_file = false; |
916 | - if(!$source_file) |
|
916 | + if (!$source_file) |
|
917 | 917 | { |
918 | 918 | $random = new Password(); |
919 | 919 | |
920 | 920 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
921 | 921 | |
922 | - foreach($matches as $target_image) |
|
922 | + foreach ($matches as $target_image) |
|
923 | 923 | { |
924 | 924 | $target_src = trim($target_image[1]); |
925 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
925 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
926 | 926 | |
927 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
927 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
928 | 928 | { |
929 | 929 | $target_src = Context::getRequestUri().$target_src; |
930 | 930 | } |
931 | 931 | |
932 | 932 | $target_src = htmlspecialchars_decode($target_src); |
933 | 933 | |
934 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
934 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
935 | 935 | FileHandler::getRemoteFile($target_src, $tmp_file); |
936 | - if(!file_exists($tmp_file)) continue; |
|
936 | + if (!file_exists($tmp_file)) continue; |
|
937 | 937 | |
938 | 938 | $imageinfo = getimagesize($tmp_file); |
939 | 939 | list($_w, $_h) = $imageinfo; |
940 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
940 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
941 | 941 | FileHandler::removeFile($tmp_file); |
942 | 942 | continue; |
943 | 943 | } |
@@ -948,13 +948,13 @@ discard block |
||
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
951 | - if($source_file) |
|
951 | + if ($source_file) |
|
952 | 952 | { |
953 | 953 | $output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
954 | 954 | } |
955 | 955 | |
956 | 956 | // Remove source file if it was temporary |
957 | - if($is_tmp_file) |
|
957 | + if ($is_tmp_file) |
|
958 | 958 | { |
959 | 959 | FileHandler::removeFile($source_file); |
960 | 960 | } |
@@ -963,12 +963,12 @@ discard block |
||
963 | 963 | FileHandler::removeFile($thumbnail_lockfile); |
964 | 964 | |
965 | 965 | // Create an empty file if thumbnail generation failed |
966 | - if(!$output_file) |
|
966 | + if (!$output_file) |
|
967 | 967 | { |
968 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
968 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
969 | 969 | } |
970 | 970 | |
971 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
971 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | /** |
@@ -979,21 +979,21 @@ discard block |
||
979 | 979 | */ |
980 | 980 | function getExtraImages($time_interval = 43200) |
981 | 981 | { |
982 | - if(!$this->document_srl) return; |
|
982 | + if (!$this->document_srl) return; |
|
983 | 983 | // variables for icon list |
984 | 984 | $buffs = array(); |
985 | 985 | |
986 | 986 | $check_files = false; |
987 | 987 | |
988 | 988 | // Check if secret post is |
989 | - if($this->isSecret()) $buffs[] = "secret"; |
|
989 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
990 | 990 | |
991 | 991 | // Set the latest time |
992 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
992 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
993 | 993 | |
994 | 994 | // Check new post |
995 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
996 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
995 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
996 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
997 | 997 | |
998 | 998 | /* |
999 | 999 | $content = $this->get('content'); |
@@ -1016,14 +1016,14 @@ discard block |
||
1016 | 1016 | */ |
1017 | 1017 | |
1018 | 1018 | // Check the attachment |
1019 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
1019 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
1020 | 1020 | |
1021 | 1021 | return $buffs; |
1022 | 1022 | } |
1023 | 1023 | |
1024 | 1024 | function getStatus() |
1025 | 1025 | { |
1026 | - if(!$this->get('status')) { |
|
1026 | + if (!$this->get('status')) { |
|
1027 | 1027 | $oDocumentClass = getClass('document'); |
1028 | 1028 | return $oDocumentClass->getDefaultStatus(); |
1029 | 1029 | } |
@@ -1037,11 +1037,11 @@ discard block |
||
1037 | 1037 | */ |
1038 | 1038 | function printExtraImages($time_check = 43200) |
1039 | 1039 | { |
1040 | - if(!$this->document_srl) return; |
|
1040 | + if (!$this->document_srl) return; |
|
1041 | 1041 | |
1042 | 1042 | $oDocumentModel = getModel('document'); |
1043 | 1043 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
1044 | - if(Mobile::isFromMobilePhone()) |
|
1044 | + if (Mobile::isFromMobilePhone()) |
|
1045 | 1045 | { |
1046 | 1046 | $iconSkin = $documentConfig->micons; |
1047 | 1047 | } |
@@ -1049,13 +1049,13 @@ discard block |
||
1049 | 1049 | { |
1050 | 1050 | $iconSkin = $documentConfig->icons; |
1051 | 1051 | } |
1052 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
1052 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
1053 | 1053 | |
1054 | 1054 | $buffs = $this->getExtraImages($time_check); |
1055 | - if(!count($buffs)) return; |
|
1055 | + if (!count($buffs)) return; |
|
1056 | 1056 | |
1057 | 1057 | $buff = array(); |
1058 | - foreach($buffs as $key => $val) |
|
1058 | + foreach ($buffs as $key => $val) |
|
1059 | 1059 | { |
1060 | 1060 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
1061 | 1061 | } |
@@ -1064,20 +1064,20 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | function hasUploadedFiles() |
1066 | 1066 | { |
1067 | - if(!$this->document_srl) return; |
|
1067 | + if (!$this->document_srl) return; |
|
1068 | 1068 | |
1069 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
1070 | - return $this->get('uploaded_count')? true : false; |
|
1069 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
1070 | + return $this->get('uploaded_count') ? true : false; |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | function getUploadedFiles($sortIndex = 'file_srl') |
1074 | 1074 | { |
1075 | - if(!$this->document_srl) return; |
|
1075 | + if (!$this->document_srl) return; |
|
1076 | 1076 | |
1077 | - if($this->isSecret() && !$this->isGranted()) return; |
|
1078 | - if(!$this->get('uploaded_count')) return; |
|
1077 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
1078 | + if (!$this->get('uploaded_count')) return; |
|
1079 | 1079 | |
1080 | - if(!$this->uploadedFiles[$sortIndex]) |
|
1080 | + if (!$this->uploadedFiles[$sortIndex]) |
|
1081 | 1081 | { |
1082 | 1082 | $oFileModel = getModel('file'); |
1083 | 1083 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | function getEditor() |
1094 | 1094 | { |
1095 | 1095 | $module_srl = $this->get('module_srl'); |
1096 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
1096 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
1097 | 1097 | |
1098 | 1098 | $oEditorModel = getModel('editor'); |
1099 | 1099 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | { |
1109 | 1109 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
1110 | 1110 | if (!$this->allowComment()) return false; |
1111 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
1111 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
1112 | 1112 | |
1113 | 1113 | return true; |
1114 | 1114 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | */ |
1120 | 1120 | function getCommentEditor() |
1121 | 1121 | { |
1122 | - if(!$this->isEnableComment()) return; |
|
1122 | + if (!$this->isEnableComment()) return; |
|
1123 | 1123 | |
1124 | 1124 | $oEditorModel = getModel('editor'); |
1125 | 1125 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1131,10 +1131,10 @@ discard block |
||
1131 | 1131 | */ |
1132 | 1132 | function getProfileImage() |
1133 | 1133 | { |
1134 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
1134 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
1135 | 1135 | $oMemberModel = getModel('member'); |
1136 | 1136 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
1137 | - if(!$profile_info) return; |
|
1137 | + if (!$profile_info) return; |
|
1138 | 1138 | |
1139 | 1139 | return $profile_info->src; |
1140 | 1140 | } |
@@ -1146,21 +1146,21 @@ discard block |
||
1146 | 1146 | function getSignature() |
1147 | 1147 | { |
1148 | 1148 | // Pass if a document doesn't exist |
1149 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
1149 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
1150 | 1150 | // Get signature information |
1151 | 1151 | $oMemberModel = getModel('member'); |
1152 | 1152 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
1153 | 1153 | // Check if a maximum height of signiture is set in the member module |
1154 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
1154 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
1155 | 1155 | { |
1156 | 1156 | $oModuleModel = getModel('module'); |
1157 | 1157 | $member_config = $oModuleModel->getModuleConfig('member'); |
1158 | 1158 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
1159 | 1159 | } |
1160 | - if($signature) |
|
1160 | + if ($signature) |
|
1161 | 1161 | { |
1162 | 1162 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
1163 | - 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); |
|
1163 | + 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); |
|
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | return $signature; |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | */ |
1174 | 1174 | function replaceResourceRealPath($matches) |
1175 | 1175 | { |
1176 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
1176 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | /** |
@@ -1184,19 +1184,19 @@ discard block |
||
1184 | 1184 | function _checkAccessibleFromStatus() |
1185 | 1185 | { |
1186 | 1186 | $logged_info = Context::get('logged_info'); |
1187 | - if($logged_info->is_admin == 'Y') return true; |
|
1187 | + if ($logged_info->is_admin == 'Y') return true; |
|
1188 | 1188 | |
1189 | 1189 | $status = $this->get('status'); |
1190 | - if(empty($status)) return false; |
|
1190 | + if (empty($status)) return false; |
|
1191 | 1191 | |
1192 | 1192 | $oDocumentModel = getModel('document'); |
1193 | 1193 | $configStatusList = $oDocumentModel->getStatusList(); |
1194 | 1194 | |
1195 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
1195 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
1196 | 1196 | return true; |
1197 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
1197 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
1198 | 1198 | { |
1199 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
1199 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
1200 | 1200 | return true; |
1201 | 1201 | } |
1202 | 1202 | return false; |
@@ -79,7 +79,9 @@ discard block |
||
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 |
||
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,21 +160,29 @@ discard block |
||
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 | 187 | if($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl) |
179 | 188 | { |
@@ -197,7 +206,9 @@ discard block |
||
197 | 206 | function allowComment() |
198 | 207 | { |
199 | 208 | // init write, document is not exists. so allow comment status is true |
200 | - if(!$this->isExists()) return true; |
|
209 | + if(!$this->isExists()) { |
|
210 | + return true; |
|
211 | + } |
|
201 | 212 | |
202 | 213 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
203 | 214 | } |
@@ -212,8 +223,7 @@ discard block |
||
212 | 223 | if(!getClass('trackback')) |
213 | 224 | { |
214 | 225 | $allow_trackback_status = false; |
215 | - } |
|
216 | - else |
|
226 | + } else |
|
217 | 227 | { |
218 | 228 | // If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module. |
219 | 229 | $oModuleModel = getModel('module'); |
@@ -224,15 +234,21 @@ discard block |
||
224 | 234 | $trackback_config = new stdClass(); |
225 | 235 | } |
226 | 236 | |
227 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
228 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
229 | - else |
|
237 | + if(!isset($trackback_config->enable_trackback)) { |
|
238 | + $trackback_config->enable_trackback = 'Y'; |
|
239 | + } |
|
240 | + if($trackback_config->enable_trackback != 'Y') { |
|
241 | + $allow_trackback_status = false; |
|
242 | + } else |
|
230 | 243 | { |
231 | 244 | $module_srl = $this->get('module_srl'); |
232 | 245 | // Check settings of each module |
233 | 246 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
234 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
235 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
247 | + if($module_config->enable_trackback == 'N') { |
|
248 | + $allow_trackback_status = false; |
|
249 | + } else if($this->get('allow_trackback')=='Y' || !$this->isExists()) { |
|
250 | + $allow_trackback_status = true; |
|
251 | + } |
|
236 | 252 | } |
237 | 253 | } |
238 | 254 | } |
@@ -241,14 +257,18 @@ discard block |
||
241 | 257 | |
242 | 258 | function isLocked() |
243 | 259 | { |
244 | - if(!$this->isExists()) return false; |
|
260 | + if(!$this->isExists()) { |
|
261 | + return false; |
|
262 | + } |
|
245 | 263 | |
246 | 264 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
247 | 265 | } |
248 | 266 | |
249 | 267 | function isEditable() |
250 | 268 | { |
251 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
269 | + if($this->isGranted() || !$this->get('member_srl')) { |
|
270 | + return true; |
|
271 | + } |
|
252 | 272 | return false; |
253 | 273 | } |
254 | 274 | |
@@ -270,9 +290,14 @@ discard block |
||
270 | 290 | |
271 | 291 | function doCart() |
272 | 292 | { |
273 | - if(!$this->document_srl) return false; |
|
274 | - if($this->isCarted()) $this->removeCart(); |
|
275 | - else $this->addCart(); |
|
293 | + if(!$this->document_srl) { |
|
294 | + return false; |
|
295 | + } |
|
296 | + if($this->isCarted()) { |
|
297 | + $this->removeCart(); |
|
298 | + } else { |
|
299 | + $this->addCart(); |
|
300 | + } |
|
276 | 301 | } |
277 | 302 | |
278 | 303 | function addCart() |
@@ -298,16 +323,26 @@ discard block |
||
298 | 323 | */ |
299 | 324 | function notify($type, $content) |
300 | 325 | { |
301 | - if(!$this->document_srl) return; |
|
326 | + if(!$this->document_srl) { |
|
327 | + return; |
|
328 | + } |
|
302 | 329 | // return if it is not useNotify |
303 | - if(!$this->useNotify()) return; |
|
330 | + if(!$this->useNotify()) { |
|
331 | + return; |
|
332 | + } |
|
304 | 333 | // Pass if an author is not a logged-in user |
305 | - if(!$this->get('member_srl')) return; |
|
334 | + if(!$this->get('member_srl')) { |
|
335 | + return; |
|
336 | + } |
|
306 | 337 | // Return if the currently logged-in user is an author |
307 | 338 | $logged_info = Context::get('logged_info'); |
308 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
339 | + if($logged_info->member_srl == $this->get('member_srl')) { |
|
340 | + return; |
|
341 | + } |
|
309 | 342 | // List variables |
310 | - if($type) $title = "[".$type."] "; |
|
343 | + if($type) { |
|
344 | + $title = "[".$type."] "; |
|
345 | + } |
|
311 | 346 | $title .= cut_str(strip_tags($content), 10, '...'); |
312 | 347 | $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)); |
313 | 348 | $receiver_srl = $this->get('member_srl'); |
@@ -334,16 +369,22 @@ discard block |
||
334 | 369 | |
335 | 370 | function isExistsHomepage() |
336 | 371 | { |
337 | - if(trim($this->get('homepage'))) return true; |
|
372 | + if(trim($this->get('homepage'))) { |
|
373 | + return true; |
|
374 | + } |
|
338 | 375 | return false; |
339 | 376 | } |
340 | 377 | |
341 | 378 | function getHomepageUrl() |
342 | 379 | { |
343 | 380 | $url = trim($this->get('homepage')); |
344 | - if(!$url) return; |
|
381 | + if(!$url) { |
|
382 | + return; |
|
383 | + } |
|
345 | 384 | |
346 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
385 | + if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) { |
|
386 | + $url = 'http://' . $url; |
|
387 | + } |
|
347 | 388 | |
348 | 389 | return $url; |
349 | 390 | } |
@@ -375,43 +416,65 @@ discard block |
||
375 | 416 | |
376 | 417 | function getTitleText($cut_size = 0, $tail='...') |
377 | 418 | { |
378 | - if(!$this->document_srl) return; |
|
419 | + if(!$this->document_srl) { |
|
420 | + return; |
|
421 | + } |
|
379 | 422 | |
380 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
381 | - else $title = $this->get('title'); |
|
423 | + if($cut_size) { |
|
424 | + $title = cut_str($this->get('title'), $cut_size, $tail); |
|
425 | + } else { |
|
426 | + $title = $this->get('title'); |
|
427 | + } |
|
382 | 428 | |
383 | 429 | return $title; |
384 | 430 | } |
385 | 431 | |
386 | 432 | function getTitle($cut_size = 0, $tail='...') |
387 | 433 | { |
388 | - if(!$this->document_srl) return; |
|
434 | + if(!$this->document_srl) { |
|
435 | + return; |
|
436 | + } |
|
389 | 437 | |
390 | 438 | $title = $this->getTitleText($cut_size, $tail); |
391 | 439 | |
392 | 440 | $attrs = array(); |
393 | 441 | $this->add('title_color', trim($this->get('title_color'))); |
394 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
395 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
442 | + if($this->get('title_bold')=='Y') { |
|
443 | + $attrs[] = "font-weight:bold;"; |
|
444 | + } |
|
445 | + if($this->get('title_color') && $this->get('title_color') != 'N') { |
|
446 | + $attrs[] = "color:#".$this->get('title_color'); |
|
447 | + } |
|
396 | 448 | |
397 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
398 | - else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
449 | + if(count($attrs)) { |
|
450 | + return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
451 | + } else { |
|
452 | + return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
453 | + } |
|
399 | 454 | } |
400 | 455 | |
401 | 456 | function getContentText($strlen = 0) |
402 | 457 | { |
403 | - if(!$this->document_srl) return; |
|
458 | + if(!$this->document_srl) { |
|
459 | + return; |
|
460 | + } |
|
404 | 461 | |
405 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
462 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
463 | + return Context::getLang('msg_is_secret'); |
|
464 | + } |
|
406 | 465 | |
407 | 466 | $result = $this->_checkAccessibleFromStatus(); |
408 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
467 | + if($result) { |
|
468 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
469 | + } |
|
409 | 470 | |
410 | 471 | $content = $this->get('content'); |
411 | 472 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
412 | 473 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
413 | 474 | |
414 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
475 | + if($strlen) { |
|
476 | + return cut_str(strip_tags($content),$strlen,'...'); |
|
477 | + } |
|
415 | 478 | |
416 | 479 | return htmlspecialchars($content); |
417 | 480 | } |
@@ -444,14 +507,12 @@ discard block |
||
444 | 507 | } |
445 | 508 | $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
446 | 509 | } |
447 | - } |
|
448 | - else if($m[1] == 'embed') |
|
510 | + } else if($m[1] == 'embed') |
|
449 | 511 | { |
450 | 512 | if(stripos($m[0], 'allowscriptaccess')) |
451 | 513 | { |
452 | 514 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
453 | - } |
|
454 | - else |
|
515 | + } else |
|
455 | 516 | { |
456 | 517 | $m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]); |
457 | 518 | } |
@@ -461,15 +522,23 @@ discard block |
||
461 | 522 | |
462 | 523 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
463 | 524 | { |
464 | - if(!$this->document_srl) return; |
|
525 | + if(!$this->document_srl) { |
|
526 | + return; |
|
527 | + } |
|
465 | 528 | |
466 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
529 | + if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) { |
|
530 | + return Context::getLang('msg_is_secret'); |
|
531 | + } |
|
467 | 532 | |
468 | 533 | $result = $this->_checkAccessibleFromStatus(); |
469 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
534 | + if($result) { |
|
535 | + $_SESSION['accessible'][$this->document_srl] = true; |
|
536 | + } |
|
470 | 537 | |
471 | 538 | $content = $this->get('content'); |
472 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
539 | + if(!$stripEmbedTagException) { |
|
540 | + stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
541 | + } |
|
473 | 542 | |
474 | 543 | // Define a link if using a rewrite module |
475 | 544 | $oContext = &Context::getInstance(); |
@@ -503,10 +572,11 @@ discard block |
||
503 | 572 | $this->document_srl, $memberSrl |
504 | 573 | ); |
505 | 574 | // Add xe_content class although accessing content is not required |
506 | - } |
|
507 | - else |
|
575 | + } else |
|
508 | 576 | { |
509 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
577 | + if($add_xe_content_class) { |
|
578 | + $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
579 | + } |
|
510 | 580 | } |
511 | 581 | // Change the image path to a valid absolute path if resource_realpath is true |
512 | 582 | if($resource_realpath) |
@@ -625,11 +695,15 @@ discard block |
||
625 | 695 | |
626 | 696 | function getTrackbackUrl() |
627 | 697 | { |
628 | - if(!$this->document_srl) return; |
|
698 | + if(!$this->document_srl) { |
|
699 | + return; |
|
700 | + } |
|
629 | 701 | |
630 | 702 | // Generate a key to prevent spams |
631 | 703 | $oTrackbackModel = getModel('trackback'); |
632 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
704 | + if($oTrackbackModel) { |
|
705 | + return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
706 | + } |
|
633 | 707 | } |
634 | 708 | |
635 | 709 | /** |
@@ -648,7 +722,9 @@ discard block |
||
648 | 722 | |
649 | 723 | function isExtraVarsExists() |
650 | 724 | { |
651 | - if(!$this->get('module_srl')) return false; |
|
725 | + if(!$this->get('module_srl')) { |
|
726 | + return false; |
|
727 | + } |
|
652 | 728 | $oDocumentModel = getModel('document'); |
653 | 729 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
654 | 730 | return count($extra_keys)?true:false; |
@@ -656,7 +732,9 @@ discard block |
||
656 | 732 | |
657 | 733 | function getExtraVars() |
658 | 734 | { |
659 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
735 | + if(!$this->get('module_srl') || !$this->document_srl) { |
|
736 | + return null; |
|
737 | + } |
|
660 | 738 | |
661 | 739 | $oDocumentModel = getModel('document'); |
662 | 740 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -668,8 +746,7 @@ discard block |
||
668 | 746 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
669 | 747 | { |
670 | 748 | return $extra_vars[$idx]->getValue(); |
671 | - } |
|
672 | - else |
|
749 | + } else |
|
673 | 750 | { |
674 | 751 | return ''; |
675 | 752 | } |
@@ -681,8 +758,7 @@ discard block |
||
681 | 758 | if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
682 | 759 | { |
683 | 760 | return $extra_vars[$idx]->getValueHTML(); |
684 | - } |
|
685 | - else |
|
761 | + } else |
|
686 | 762 | { |
687 | 763 | return ''; |
688 | 764 | } |
@@ -704,8 +780,7 @@ discard block |
||
704 | 780 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
705 | 781 | { |
706 | 782 | return $extra_eid[$eid]->getValue(); |
707 | - } |
|
708 | - else |
|
783 | + } else |
|
709 | 784 | { |
710 | 785 | return ''; |
711 | 786 | } |
@@ -723,8 +798,7 @@ discard block |
||
723 | 798 | if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
724 | 799 | { |
725 | 800 | return $extra_eid[$eid]->getValueHTML(); |
726 | - } |
|
727 | - else |
|
801 | + } else |
|
728 | 802 | { |
729 | 803 | return ''; |
730 | 804 | } |
@@ -744,8 +818,12 @@ discard block |
||
744 | 818 | |
745 | 819 | function getComments() |
746 | 820 | { |
747 | - if(!$this->getCommentCount()) return; |
|
748 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
821 | + if(!$this->getCommentCount()) { |
|
822 | + return; |
|
823 | + } |
|
824 | + if(!$this->isGranted() && $this->isSecret()) { |
|
825 | + return; |
|
826 | + } |
|
749 | 827 | // cpage is a number of comment pages |
750 | 828 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
751 | 829 | $cpage = Context::get($cpageStr); |
@@ -758,7 +836,9 @@ discard block |
||
758 | 836 | // Get a list of comments |
759 | 837 | $oCommentModel = getModel('comment'); |
760 | 838 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
761 | - if(!$output->toBool() || !count($output->data)) return; |
|
839 | + if(!$output->toBool() || !count($output->data)) { |
|
840 | + return; |
|
841 | + } |
|
762 | 842 | // Create commentItem object from a comment list |
763 | 843 | // If admin priviledge is granted on parent posts, you can read its child posts. |
764 | 844 | $accessible = array(); |
@@ -768,7 +848,9 @@ discard block |
||
768 | 848 | $oCommentItem = new commentItem(); |
769 | 849 | $oCommentItem->setAttribute($val); |
770 | 850 | // If permission is granted to the post, you can access it temporarily |
771 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
851 | + if($oCommentItem->isGranted()) { |
|
852 | + $accessible[$val->comment_srl] = true; |
|
853 | + } |
|
772 | 854 | // 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 |
773 | 855 | if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
774 | 856 | { |
@@ -779,7 +861,9 @@ discard block |
||
779 | 861 | // Variable setting to be displayed on the skin |
780 | 862 | Context::set($cpageStr, $output->page_navigation->cur_page); |
781 | 863 | Context::set('cpage', $output->page_navigation->cur_page); |
782 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
864 | + if($output->total_page>1) { |
|
865 | + $this->comment_page_navigation = $output->page_navigation; |
|
866 | + } |
|
783 | 867 | |
784 | 868 | // Call trigger (after) |
785 | 869 | $output = ModuleHandler::triggerCall('document.getComments', 'after', $comment_list); |
@@ -794,9 +878,13 @@ discard block |
||
794 | 878 | |
795 | 879 | function getTrackbacks() |
796 | 880 | { |
797 | - if(!$this->document_srl) return; |
|
881 | + if(!$this->document_srl) { |
|
882 | + return; |
|
883 | + } |
|
798 | 884 | |
799 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
885 | + if(!$this->allowTrackback() || !$this->get('trackback_count')) { |
|
886 | + return; |
|
887 | + } |
|
800 | 888 | |
801 | 889 | $oTrackbackModel = getModel('trackback'); |
802 | 890 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -804,15 +892,21 @@ discard block |
||
804 | 892 | |
805 | 893 | function thumbnailExists($width = 80, $height = 0, $type = '') |
806 | 894 | { |
807 | - if(!$this->document_srl) return false; |
|
808 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
895 | + if(!$this->document_srl) { |
|
896 | + return false; |
|
897 | + } |
|
898 | + if(!$this->getThumbnail($width, $height, $type)) { |
|
899 | + return false; |
|
900 | + } |
|
809 | 901 | return true; |
810 | 902 | } |
811 | 903 | |
812 | 904 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
813 | 905 | { |
814 | 906 | // Return false if the document doesn't exist |
815 | - if(!$this->document_srl) return; |
|
907 | + if(!$this->document_srl) { |
|
908 | + return; |
|
909 | + } |
|
816 | 910 | |
817 | 911 | if($this->isSecret() && !$this->isGranted()) |
818 | 912 | { |
@@ -820,7 +914,9 @@ discard block |
||
820 | 914 | } |
821 | 915 | |
822 | 916 | // If not specify its height, create a square |
823 | - if(!$height) $height = $width; |
|
917 | + if(!$height) { |
|
918 | + $height = $width; |
|
919 | + } |
|
824 | 920 | |
825 | 921 | // Return false if neither attachement nor image files in the document |
826 | 922 | $content = $this->get('content'); |
@@ -838,7 +934,9 @@ discard block |
||
838 | 934 | } |
839 | 935 | } |
840 | 936 | |
841 | - if(!preg_match("!<img!is", $content)) return; |
|
937 | + if(!preg_match("!<img!is", $content)) { |
|
938 | + return; |
|
939 | + } |
|
842 | 940 | } |
843 | 941 | // Get thumbnai_type information from document module's configuration |
844 | 942 | if(!in_array($thumbnail_type, array('crop','ratio'))) |
@@ -865,8 +963,7 @@ discard block |
||
865 | 963 | if(filesize($thumbnail_file) < 1) |
866 | 964 | { |
867 | 965 | return FALSE; |
868 | - } |
|
869 | - else |
|
966 | + } else |
|
870 | 967 | { |
871 | 968 | return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
872 | 969 | } |
@@ -887,7 +984,9 @@ discard block |
||
887 | 984 | $first_image = null; |
888 | 985 | foreach($file_list as $file) |
889 | 986 | { |
890 | - if($file->direct_download !== 'Y') continue; |
|
987 | + if($file->direct_download !== 'Y') { |
|
988 | + continue; |
|
989 | + } |
|
891 | 990 | |
892 | 991 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
893 | 992 | { |
@@ -895,7 +994,9 @@ discard block |
||
895 | 994 | break; |
896 | 995 | } |
897 | 996 | |
898 | - if($first_image) continue; |
|
997 | + if($first_image) { |
|
998 | + continue; |
|
999 | + } |
|
899 | 1000 | |
900 | 1001 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
901 | 1002 | { |
@@ -922,7 +1023,9 @@ discard block |
||
922 | 1023 | foreach($matches as $target_image) |
923 | 1024 | { |
924 | 1025 | $target_src = trim($target_image[1]); |
925 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
1026 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
1027 | + continue; |
|
1028 | + } |
|
926 | 1029 | |
927 | 1030 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
928 | 1031 | { |
@@ -933,7 +1036,9 @@ discard block |
||
933 | 1036 | |
934 | 1037 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
935 | 1038 | FileHandler::getRemoteFile($target_src, $tmp_file); |
936 | - if(!file_exists($tmp_file)) continue; |
|
1039 | + if(!file_exists($tmp_file)) { |
|
1040 | + continue; |
|
1041 | + } |
|
937 | 1042 | |
938 | 1043 | $imageinfo = getimagesize($tmp_file); |
939 | 1044 | list($_w, $_h) = $imageinfo; |
@@ -979,21 +1084,28 @@ discard block |
||
979 | 1084 | */ |
980 | 1085 | function getExtraImages($time_interval = 43200) |
981 | 1086 | { |
982 | - if(!$this->document_srl) return; |
|
1087 | + if(!$this->document_srl) { |
|
1088 | + return; |
|
1089 | + } |
|
983 | 1090 | // variables for icon list |
984 | 1091 | $buffs = array(); |
985 | 1092 | |
986 | 1093 | $check_files = false; |
987 | 1094 | |
988 | 1095 | // Check if secret post is |
989 | - if($this->isSecret()) $buffs[] = "secret"; |
|
1096 | + if($this->isSecret()) { |
|
1097 | + $buffs[] = "secret"; |
|
1098 | + } |
|
990 | 1099 | |
991 | 1100 | // Set the latest time |
992 | 1101 | $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
993 | 1102 | |
994 | 1103 | // Check new post |
995 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
996 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
1104 | + if($this->get('regdate')>$time_check) { |
|
1105 | + $buffs[] = "new"; |
|
1106 | + } else if($this->get('last_update')>$time_check) { |
|
1107 | + $buffs[] = "update"; |
|
1108 | + } |
|
997 | 1109 | |
998 | 1110 | /* |
999 | 1111 | $content = $this->get('content'); |
@@ -1016,7 +1128,9 @@ discard block |
||
1016 | 1128 | */ |
1017 | 1129 | |
1018 | 1130 | // Check the attachment |
1019 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
1131 | + if($this->hasUploadedFiles()) { |
|
1132 | + $buffs[] = "file"; |
|
1133 | + } |
|
1020 | 1134 | |
1021 | 1135 | return $buffs; |
1022 | 1136 | } |
@@ -1037,22 +1151,25 @@ discard block |
||
1037 | 1151 | */ |
1038 | 1152 | function printExtraImages($time_check = 43200) |
1039 | 1153 | { |
1040 | - if(!$this->document_srl) return; |
|
1154 | + if(!$this->document_srl) { |
|
1155 | + return; |
|
1156 | + } |
|
1041 | 1157 | |
1042 | 1158 | $oDocumentModel = getModel('document'); |
1043 | 1159 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
1044 | 1160 | if(Mobile::isFromMobilePhone()) |
1045 | 1161 | { |
1046 | 1162 | $iconSkin = $documentConfig->micons; |
1047 | - } |
|
1048 | - else |
|
1163 | + } else |
|
1049 | 1164 | { |
1050 | 1165 | $iconSkin = $documentConfig->icons; |
1051 | 1166 | } |
1052 | 1167 | $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
1053 | 1168 | |
1054 | 1169 | $buffs = $this->getExtraImages($time_check); |
1055 | - if(!count($buffs)) return; |
|
1170 | + if(!count($buffs)) { |
|
1171 | + return; |
|
1172 | + } |
|
1056 | 1173 | |
1057 | 1174 | $buff = array(); |
1058 | 1175 | foreach($buffs as $key => $val) |
@@ -1064,18 +1181,28 @@ discard block |
||
1064 | 1181 | |
1065 | 1182 | function hasUploadedFiles() |
1066 | 1183 | { |
1067 | - if(!$this->document_srl) return; |
|
1184 | + if(!$this->document_srl) { |
|
1185 | + return; |
|
1186 | + } |
|
1068 | 1187 | |
1069 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
1188 | + if($this->isSecret() && !$this->isGranted()) { |
|
1189 | + return false; |
|
1190 | + } |
|
1070 | 1191 | return $this->get('uploaded_count')? true : false; |
1071 | 1192 | } |
1072 | 1193 | |
1073 | 1194 | function getUploadedFiles($sortIndex = 'file_srl') |
1074 | 1195 | { |
1075 | - if(!$this->document_srl) return; |
|
1196 | + if(!$this->document_srl) { |
|
1197 | + return; |
|
1198 | + } |
|
1076 | 1199 | |
1077 | - if($this->isSecret() && !$this->isGranted()) return; |
|
1078 | - if(!$this->get('uploaded_count')) return; |
|
1200 | + if($this->isSecret() && !$this->isGranted()) { |
|
1201 | + return; |
|
1202 | + } |
|
1203 | + if(!$this->get('uploaded_count')) { |
|
1204 | + return; |
|
1205 | + } |
|
1079 | 1206 | |
1080 | 1207 | if(!$this->uploadedFiles[$sortIndex]) |
1081 | 1208 | { |
@@ -1093,7 +1220,9 @@ discard block |
||
1093 | 1220 | function getEditor() |
1094 | 1221 | { |
1095 | 1222 | $module_srl = $this->get('module_srl'); |
1096 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
1223 | + if(!$module_srl) { |
|
1224 | + $module_srl = Context::get('module_srl'); |
|
1225 | + } |
|
1097 | 1226 | |
1098 | 1227 | $oEditorModel = getModel('editor'); |
1099 | 1228 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1107,8 +1236,12 @@ discard block |
||
1107 | 1236 | function isEnableComment() |
1108 | 1237 | { |
1109 | 1238 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
1110 | - if (!$this->allowComment()) return false; |
|
1111 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
1239 | + if (!$this->allowComment()) { |
|
1240 | + return false; |
|
1241 | + } |
|
1242 | + if(!$this->isGranted() && $this->isSecret()) { |
|
1243 | + return false; |
|
1244 | + } |
|
1112 | 1245 | |
1113 | 1246 | return true; |
1114 | 1247 | } |
@@ -1119,7 +1252,9 @@ discard block |
||
1119 | 1252 | */ |
1120 | 1253 | function getCommentEditor() |
1121 | 1254 | { |
1122 | - if(!$this->isEnableComment()) return; |
|
1255 | + if(!$this->isEnableComment()) { |
|
1256 | + return; |
|
1257 | + } |
|
1123 | 1258 | |
1124 | 1259 | $oEditorModel = getModel('editor'); |
1125 | 1260 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1131,10 +1266,14 @@ discard block |
||
1131 | 1266 | */ |
1132 | 1267 | function getProfileImage() |
1133 | 1268 | { |
1134 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
1269 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
1270 | + return; |
|
1271 | + } |
|
1135 | 1272 | $oMemberModel = getModel('member'); |
1136 | 1273 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
1137 | - if(!$profile_info) return; |
|
1274 | + if(!$profile_info) { |
|
1275 | + return; |
|
1276 | + } |
|
1138 | 1277 | |
1139 | 1278 | return $profile_info->src; |
1140 | 1279 | } |
@@ -1146,7 +1285,9 @@ discard block |
||
1146 | 1285 | function getSignature() |
1147 | 1286 | { |
1148 | 1287 | // Pass if a document doesn't exist |
1149 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
1288 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
1289 | + return; |
|
1290 | + } |
|
1150 | 1291 | // Get signature information |
1151 | 1292 | $oMemberModel = getModel('member'); |
1152 | 1293 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
@@ -1160,7 +1301,9 @@ discard block |
||
1160 | 1301 | if($signature) |
1161 | 1302 | { |
1162 | 1303 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
1163 | - 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); |
|
1304 | + if($max_signature_height) { |
|
1305 | + $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); |
|
1306 | + } |
|
1164 | 1307 | } |
1165 | 1308 | |
1166 | 1309 | return $signature; |
@@ -1184,20 +1327,25 @@ discard block |
||
1184 | 1327 | function _checkAccessibleFromStatus() |
1185 | 1328 | { |
1186 | 1329 | $logged_info = Context::get('logged_info'); |
1187 | - if($logged_info->is_admin == 'Y') return true; |
|
1330 | + if($logged_info->is_admin == 'Y') { |
|
1331 | + return true; |
|
1332 | + } |
|
1188 | 1333 | |
1189 | 1334 | $status = $this->get('status'); |
1190 | - if(empty($status)) return false; |
|
1335 | + if(empty($status)) { |
|
1336 | + return false; |
|
1337 | + } |
|
1191 | 1338 | |
1192 | 1339 | $oDocumentModel = getModel('document'); |
1193 | 1340 | $configStatusList = $oDocumentModel->getStatusList(); |
1194 | 1341 | |
1195 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
1196 | - return true; |
|
1197 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
1342 | + if($status == $configStatusList['public'] || $status == $configStatusList['publish']) { |
|
1343 | + return true; |
|
1344 | + } else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
1198 | 1345 | { |
1199 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
1200 | - return true; |
|
1346 | + if($this->get('member_srl') == $logged_info->member_srl) { |
|
1347 | + return true; |
|
1348 | + } |
|
1201 | 1349 | } |
1202 | 1350 | return false; |
1203 | 1351 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $oCommentController = getController('comment'); |
44 | 44 | |
45 | 45 | // feature that only member can do |
46 | - if($logged_info->member_srl) |
|
46 | + if ($logged_info->member_srl) |
|
47 | 47 | { |
48 | 48 | $oCommentModel = getModel('comment'); |
49 | 49 | $columnList = array('comment_srl', 'module_srl', 'member_srl', 'ipaddress'); |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | $oModuleModel = getModel('module'); |
55 | 55 | $comment_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
56 | 56 | |
57 | - if($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
57 | + if ($comment_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
58 | 58 | { |
59 | 59 | // Add a vote-up button for positive feedback |
60 | 60 | $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl); |
61 | 61 | $oCommentController->addCommentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
62 | 62 | } |
63 | 63 | |
64 | - if($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
64 | + if ($comment_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
65 | 65 | { |
66 | 66 | // Add a vote-down button for negative feedback |
67 | 67 | $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl); |
@@ -76,20 +76,20 @@ discard block |
||
76 | 76 | // call a trigger (after) |
77 | 77 | ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list); |
78 | 78 | |
79 | - if($this->grant->manager){ |
|
79 | + if ($this->grant->manager) { |
|
80 | 80 | $str_confirm = Context::getLang('confirm_move'); |
81 | 81 | $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['comment_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('comment', 'procCommentAdminMoveToTrash', params)", $str_confirm, $comment_srl); |
82 | - $oCommentController->addCommentPopupMenu($url,'cmd_trash','','javascript'); |
|
82 | + $oCommentController->addCommentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | 86 | // find a comment by IP matching if an administrator. |
87 | - if($logged_info->is_admin == 'Y') |
|
87 | + if ($logged_info->is_admin == 'Y') |
|
88 | 88 | { |
89 | 89 | $oCommentModel = getModel('comment'); |
90 | 90 | $oComment = $oCommentModel->getComment($comment_srl); |
91 | 91 | |
92 | - if($oComment->isExists()) |
|
92 | + if ($oComment->isExists()) |
|
93 | 93 | { |
94 | 94 | // Find a post of the corresponding ip address |
95 | 95 | $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oComment->getIpAddress()); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $menus = Context::get('comment_popup_menu_list'); |
105 | 105 | $menus_count = count($menus); |
106 | 106 | |
107 | - for($i = 0; $i < $menus_count; $i++) |
|
107 | + for ($i = 0; $i < $menus_count; $i++) |
|
108 | 108 | { |
109 | 109 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
110 | 110 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | function getComment($comment_srl = 0, $is_admin = FALSE, $columnList = array()) |
161 | 161 | { |
162 | 162 | $oComment = new commentItem($comment_srl, $columnList); |
163 | - if($is_admin) |
|
163 | + if ($is_admin) |
|
164 | 164 | { |
165 | 165 | $oComment->setGrant(); |
166 | 166 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | function getComments($comment_srl_list, $columnList = array()) |
178 | 178 | { |
179 | - if(is_array($comment_srl_list)) |
|
179 | + if (is_array($comment_srl_list)) |
|
180 | 180 | { |
181 | 181 | $comment_srls = implode(',', $comment_srl_list); |
182 | 182 | } |
@@ -185,25 +185,25 @@ discard block |
||
185 | 185 | $args = new stdClass(); |
186 | 186 | $args->comment_srls = $comment_srls; |
187 | 187 | $output = executeQuery('comment.getComments', $args, $columnList); |
188 | - if(!$output->toBool()) |
|
188 | + if (!$output->toBool()) |
|
189 | 189 | { |
190 | 190 | return; |
191 | 191 | } |
192 | 192 | |
193 | 193 | $comment_list = $output->data; |
194 | - if(!$comment_list) |
|
194 | + if (!$comment_list) |
|
195 | 195 | { |
196 | 196 | return; |
197 | 197 | } |
198 | - if(!is_array($comment_list)) |
|
198 | + if (!is_array($comment_list)) |
|
199 | 199 | { |
200 | 200 | $comment_list = array($comment_list); |
201 | 201 | } |
202 | 202 | |
203 | 203 | $comment_count = count($comment_list); |
204 | - foreach($comment_list as $key => $attribute) |
|
204 | + foreach ($comment_list as $key => $attribute) |
|
205 | 205 | { |
206 | - if(!$attribute->comment_srl) |
|
206 | + if (!$attribute->comment_srl) |
|
207 | 207 | { |
208 | 208 | continue; |
209 | 209 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $oComment = NULL; |
212 | 212 | $oComment = new commentItem(); |
213 | 213 | $oComment->setAttribute($attribute); |
214 | - if($is_admin) |
|
214 | + if ($is_admin) |
|
215 | 215 | { |
216 | 216 | $oComment->setGrant(); |
217 | 217 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $oDocument = $oDocumentModel->getDocument($document_srl, FALSE, TRUE, $columnList); |
239 | 239 | |
240 | 240 | // return if no doc exists. |
241 | - if(!$oDocument->isExists()) |
|
241 | + if (!$oDocument->isExists()) |
|
242 | 242 | { |
243 | 243 | return; |
244 | 244 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $oCommentController = getController('comment'); |
251 | 251 | |
252 | 252 | $using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl); |
253 | - if($using_validation) |
|
253 | + if ($using_validation) |
|
254 | 254 | { |
255 | 255 | $args->status = 1; |
256 | 256 | } |
@@ -269,18 +269,18 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function getCommentCountByDate($date = '', $moduleSrlList = array()) |
271 | 271 | { |
272 | - if($date) |
|
272 | + if ($date) |
|
273 | 273 | { |
274 | 274 | $args->regDate = date('Ymd', strtotime($date)); |
275 | 275 | } |
276 | 276 | |
277 | - if(count($moduleSrlList) > 0) |
|
277 | + if (count($moduleSrlList) > 0) |
|
278 | 278 | { |
279 | 279 | $args->module_srl = $moduleSrlList; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $output = executeQuery('comment.getCommentCount', $args); |
283 | - if(!$output->toBool()) |
|
283 | + if (!$output->toBool()) |
|
284 | 284 | { |
285 | 285 | return 0; |
286 | 286 | } |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | $args = new stdClass(); |
300 | 300 | $args->module_srl = $module_srl; |
301 | 301 | |
302 | - if(is_null($published)) |
|
302 | + if (is_null($published)) |
|
303 | 303 | { |
304 | 304 | // check if module is using comment validation system |
305 | 305 | $oCommentController = getController("comment"); |
306 | 306 | $is_using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl); |
307 | - if($is_using_validation) |
|
307 | + if ($is_using_validation) |
|
308 | 308 | { |
309 | 309 | $args->status = 1; |
310 | 310 | } |
311 | 311 | } |
312 | 312 | else |
313 | 313 | { |
314 | - if($published) |
|
314 | + if ($published) |
|
315 | 315 | { |
316 | 316 | $args->status = 1; |
317 | 317 | } |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | { |
364 | 364 | $args = new stdClass(); |
365 | 365 | |
366 | - if(!is_object($obj)) |
|
366 | + if (!is_object($obj)) |
|
367 | 367 | { |
368 | 368 | $obj = new stdClass(); |
369 | 369 | } |
370 | 370 | |
371 | - if($obj->mid) |
|
371 | + if ($obj->mid) |
|
372 | 372 | { |
373 | 373 | $oModuleModel = getModel('module'); |
374 | 374 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | // check if module_srl is an arrary. |
379 | - if(is_array($obj->module_srl)) |
|
379 | + if (is_array($obj->module_srl)) |
|
380 | 380 | { |
381 | 381 | $args->module_srl = implode(',', $obj->module_srl); |
382 | 382 | } |
@@ -388,14 +388,14 @@ discard block |
||
388 | 388 | $args->document_srl = $obj->document_srl; |
389 | 389 | $args->list_count = $obj->list_count; |
390 | 390 | |
391 | - if(strpos($args->module_srl, ",") === false) |
|
391 | + if (strpos($args->module_srl, ",") === false) |
|
392 | 392 | { |
393 | - if($args->module_srl) |
|
393 | + if ($args->module_srl) |
|
394 | 394 | { |
395 | 395 | // check if module is using comment validation system |
396 | 396 | $oCommentController = getController("comment"); |
397 | 397 | $is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl); |
398 | - if($is_using_validation) |
|
398 | + if ($is_using_validation) |
|
399 | 399 | { |
400 | 400 | $args->status = 1; |
401 | 401 | } |
@@ -404,24 +404,24 @@ discard block |
||
404 | 404 | |
405 | 405 | $output = executeQuery('comment.getNewestCommentList', $args, $columnList); |
406 | 406 | |
407 | - if(!$output->toBool()) |
|
407 | + if (!$output->toBool()) |
|
408 | 408 | { |
409 | 409 | return $output; |
410 | 410 | } |
411 | 411 | |
412 | 412 | $comment_list = $output->data; |
413 | - if($comment_list) |
|
413 | + if ($comment_list) |
|
414 | 414 | { |
415 | - if(!is_array($comment_list)) |
|
415 | + if (!is_array($comment_list)) |
|
416 | 416 | { |
417 | 417 | $comment_list = array($comment_list); |
418 | 418 | } |
419 | 419 | |
420 | 420 | $comment_count = count($comment_list); |
421 | 421 | |
422 | - foreach($comment_list as $key => $attribute) |
|
422 | + foreach ($comment_list as $key => $attribute) |
|
423 | 423 | { |
424 | - if(!$attribute->comment_srl) |
|
424 | + if (!$attribute->comment_srl) |
|
425 | 425 | { |
426 | 426 | continue; |
427 | 427 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | function getCommentList($document_srl, $page = 0, $is_admin = FALSE, $count = 0) |
450 | 450 | { |
451 | - if(!isset($document_srl)) |
|
451 | + if (!isset($document_srl)) |
|
452 | 452 | { |
453 | 453 | return; |
454 | 454 | } |
@@ -459,13 +459,13 @@ discard block |
||
459 | 459 | $oDocument = $oDocumentModel->getDocument($document_srl, FALSE, TRUE, $columnList); |
460 | 460 | |
461 | 461 | // return if no doc exists. |
462 | - if(!$oDocument->isExists()) |
|
462 | + if (!$oDocument->isExists()) |
|
463 | 463 | { |
464 | 464 | return; |
465 | 465 | } |
466 | 466 | |
467 | 467 | // return if no comment exists |
468 | - if($oDocument->getCommentCount() < 1) |
|
468 | + if ($oDocument->getCommentCount() < 1) |
|
469 | 469 | { |
470 | 470 | return; |
471 | 471 | } |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | // get a list of comments |
474 | 474 | $module_srl = $oDocument->get('module_srl'); |
475 | 475 | |
476 | - if(!$count) |
|
476 | + if (!$count) |
|
477 | 477 | { |
478 | 478 | $comment_config = $this->getCommentConfig($module_srl); |
479 | 479 | $comment_count = $comment_config->comment_count; |
480 | - if(!$comment_count) |
|
480 | + if (!$comment_count) |
|
481 | 481 | { |
482 | 482 | $comment_count = 50; |
483 | 483 | } |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | } |
489 | 489 | |
490 | 490 | // get a very last page if no page exists |
491 | - if(!$page) |
|
491 | + if (!$page) |
|
492 | 492 | { |
493 | - $page = (int) ( ($oDocument->getCommentCount() - 1) / $comment_count) + 1; |
|
493 | + $page = (int) (($oDocument->getCommentCount() - 1) / $comment_count) + 1; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | // get a list of comments |
@@ -503,14 +503,14 @@ discard block |
||
503 | 503 | //check if module is using validation system |
504 | 504 | $oCommentController = getController('comment'); |
505 | 505 | $using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl); |
506 | - if($using_validation) |
|
506 | + if ($using_validation) |
|
507 | 507 | { |
508 | 508 | $args->status = 1; |
509 | 509 | } |
510 | 510 | |
511 | 511 | // call trigger (before) |
512 | 512 | $trigger_output = ModuleHandler::triggerCall('comment.getCommentList', 'before', $args); |
513 | - if($trigger_output instanceof BaseObject && !$trigger_output->toBool()) |
|
513 | + if ($trigger_output instanceof BaseObject && !$trigger_output->toBool()) |
|
514 | 514 | { |
515 | 515 | return $output; |
516 | 516 | } |
@@ -518,17 +518,17 @@ discard block |
||
518 | 518 | $output = executeQueryArray('comment.getCommentPageList', $args); |
519 | 519 | |
520 | 520 | // return if an error occurs in the query results |
521 | - if(!$output->toBool()) |
|
521 | + if (!$output->toBool()) |
|
522 | 522 | { |
523 | 523 | return; |
524 | 524 | } |
525 | 525 | |
526 | 526 | // insert data into CommentPageList table if the number of results is different from stored comments |
527 | - if(!$output->data) |
|
527 | + if (!$output->data) |
|
528 | 528 | { |
529 | 529 | $this->fixCommentList($oDocument->get('module_srl'), $document_srl); |
530 | 530 | $output = executeQueryArray('comment.getCommentPageList', $args); |
531 | - if(!$output->toBool()) |
|
531 | + if (!$output->toBool()) |
|
532 | 532 | { |
533 | 533 | return; |
534 | 534 | } |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | // call trigger (after) |
538 | 538 | $trigger_output = ModuleHandler::triggerCall('comment.getCommentList', 'after', $output); |
539 | - if($trigger_output instanceof BaseObject && !$trigger_output->toBool()) |
|
539 | + if ($trigger_output instanceof BaseObject && !$trigger_output->toBool()) |
|
540 | 540 | { |
541 | 541 | return $trigger_output; |
542 | 542 | } |
@@ -554,9 +554,9 @@ discard block |
||
554 | 554 | function fixCommentList($module_srl, $document_srl) |
555 | 555 | { |
556 | 556 | // create a lock file to prevent repeated work when performing a batch job |
557 | - $lock_file = "./files/cache/tmp/lock." . $document_srl; |
|
557 | + $lock_file = "./files/cache/tmp/lock.".$document_srl; |
|
558 | 558 | |
559 | - if(file_exists($lock_file) && filemtime($lock_file) + 60 * 60 * 10 < $_SERVER['REQUEST_TIME']) |
|
559 | + if (file_exists($lock_file) && filemtime($lock_file) + 60 * 60 * 10 < $_SERVER['REQUEST_TIME']) |
|
560 | 560 | { |
561 | 561 | return; |
562 | 562 | } |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | $args->document_srl = $document_srl; |
569 | 569 | $args->list_order = 'list_order'; |
570 | 570 | $output = executeQuery('comment.getCommentList', $args); |
571 | - if(!$output->toBool()) |
|
571 | + if (!$output->toBool()) |
|
572 | 572 | { |
573 | 573 | return $output; |
574 | 574 | } |
575 | 575 | |
576 | 576 | $source_list = $output->data; |
577 | - if(!is_array($source_list)) |
|
577 | + if (!is_array($source_list)) |
|
578 | 578 | { |
579 | 579 | $source_list = array($source_list); |
580 | 580 | } |
@@ -590,11 +590,11 @@ discard block |
||
590 | 590 | $logged_info = Context::get('logged_info'); |
591 | 591 | |
592 | 592 | // generate a hierarchical structure of comments for loop |
593 | - for($i = $comment_count - 1; $i >= 0; $i--) |
|
593 | + for ($i = $comment_count - 1; $i >= 0; $i--) |
|
594 | 594 | { |
595 | 595 | $comment_srl = $source_list[$i]->comment_srl; |
596 | 596 | $parent_srl = $source_list[$i]->parent_srl; |
597 | - if(!$comment_srl) |
|
597 | + if (!$comment_srl) |
|
598 | 598 | { |
599 | 599 | continue; |
600 | 600 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | // generate a list |
603 | 603 | $list[$comment_srl] = $source_list[$i]; |
604 | 604 | |
605 | - if($parent_srl) |
|
605 | + if ($parent_srl) |
|
606 | 606 | { |
607 | 607 | $list[$parent_srl]->child[] = &$list[$comment_srl]; |
608 | 608 | } |
@@ -614,9 +614,9 @@ discard block |
||
614 | 614 | $this->_arrangeComment($comment_list, $root->child, 0, NULL); |
615 | 615 | |
616 | 616 | // insert values to the database |
617 | - if(count($comment_list)) |
|
617 | + if (count($comment_list)) |
|
618 | 618 | { |
619 | - foreach($comment_list as $comment_srl => $item) |
|
619 | + foreach ($comment_list as $comment_srl => $item) |
|
620 | 620 | { |
621 | 621 | $comment_args = new stdClass(); |
622 | 622 | $comment_args->comment_srl = $comment_srl; |
@@ -645,14 +645,14 @@ discard block |
||
645 | 645 | */ |
646 | 646 | function _arrangeComment(&$comment_list, $list, $depth, $parent = NULL) |
647 | 647 | { |
648 | - if(!count($list)) |
|
648 | + if (!count($list)) |
|
649 | 649 | { |
650 | 650 | return; |
651 | 651 | } |
652 | 652 | |
653 | - foreach($list as $key => $val) |
|
653 | + foreach ($list as $key => $val) |
|
654 | 654 | { |
655 | - if($parent) |
|
655 | + if ($parent) |
|
656 | 656 | { |
657 | 657 | $val->head = $parent->head; |
658 | 658 | } |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | $val->arrange = count($comment_list) + 1; |
665 | 665 | |
666 | - if($val->child) |
|
666 | + if ($val->child) |
|
667 | 667 | { |
668 | 668 | $val->depth = $depth; |
669 | 669 | $comment_list[$val->comment_srl] = $val; |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | // check if module is using comment validation system |
701 | 701 | $oCommentController = getController("comment"); |
702 | 702 | $is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl); |
703 | - if($is_using_validation) |
|
703 | + if ($is_using_validation) |
|
704 | 704 | { |
705 | 705 | $args->s_is_published = 1; |
706 | 706 | } |
@@ -708,12 +708,12 @@ discard block |
||
708 | 708 | // Search options |
709 | 709 | $search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target')); |
710 | 710 | $search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword')); |
711 | - if($search_target && $search_keyword) |
|
711 | + if ($search_target && $search_keyword) |
|
712 | 712 | { |
713 | - switch($search_target) |
|
713 | + switch ($search_target) |
|
714 | 714 | { |
715 | 715 | case 'content' : |
716 | - if($search_keyword) |
|
716 | + if ($search_keyword) |
|
717 | 717 | { |
718 | 718 | $search_keyword = str_replace(' ', '%', $search_keyword); |
719 | 719 | } |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | break; |
723 | 723 | |
724 | 724 | case 'user_id' : |
725 | - if($search_keyword) |
|
725 | + if ($search_keyword) |
|
726 | 726 | { |
727 | 727 | $search_keyword = str_replace(' ', '%', $search_keyword); |
728 | 728 | } |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | break; |
734 | 734 | |
735 | 735 | case 'user_name' : |
736 | - if($search_keyword) |
|
736 | + if ($search_keyword) |
|
737 | 737 | { |
738 | 738 | $search_keyword = str_replace(' ', '%', $search_keyword); |
739 | 739 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | break; |
743 | 743 | |
744 | 744 | case 'nick_name' : |
745 | - if($search_keyword) |
|
745 | + if ($search_keyword) |
|
746 | 746 | { |
747 | 747 | $search_keyword = str_replace(' ', '%', $search_keyword); |
748 | 748 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | break; |
752 | 752 | |
753 | 753 | case 'email_address' : |
754 | - if($search_keyword) |
|
754 | + if ($search_keyword) |
|
755 | 755 | { |
756 | 756 | $search_keyword = str_replace(' ', '%', $search_keyword); |
757 | 757 | } |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | break; |
761 | 761 | |
762 | 762 | case 'homepage' : |
763 | - if($search_keyword) |
|
763 | + if ($search_keyword) |
|
764 | 764 | { |
765 | 765 | $search_keyword = str_replace(' ', '%', $search_keyword); |
766 | 766 | } |
@@ -785,12 +785,12 @@ discard block |
||
785 | 785 | break; |
786 | 786 | |
787 | 787 | case 'is_published' : |
788 | - if($search_keyword == 'Y') |
|
788 | + if ($search_keyword == 'Y') |
|
789 | 789 | { |
790 | 790 | $args->s_is_published = 1; |
791 | 791 | } |
792 | 792 | |
793 | - if($search_keyword == 'N') |
|
793 | + if ($search_keyword == 'N') |
|
794 | 794 | { |
795 | 795 | $args->s_is_published = 0; |
796 | 796 | } |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | break; |
803 | 803 | |
804 | 804 | case 'member_srl' : |
805 | - $args->{"s_" . $search_target} = (int) $search_keyword; |
|
805 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
806 | 806 | break; |
807 | 807 | } |
808 | 808 | } |
@@ -811,12 +811,12 @@ discard block |
||
811 | 811 | $output = executeQueryArray($query_id, $args, $columnList); |
812 | 812 | |
813 | 813 | // return when no result or error occurance |
814 | - if(!$output->toBool() || !count($output->data)) |
|
814 | + if (!$output->toBool() || !count($output->data)) |
|
815 | 815 | { |
816 | 816 | return $output; |
817 | 817 | } |
818 | 818 | |
819 | - foreach($output->data as $key => $val) |
|
819 | + foreach ($output->data as $key => $val) |
|
820 | 820 | { |
821 | 821 | unset($_oComment); |
822 | 822 | $_oComment = new CommentItem(0); |
@@ -845,12 +845,12 @@ discard block |
||
845 | 845 | $search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target')); |
846 | 846 | $search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword')); |
847 | 847 | |
848 | - if($search_target && $search_keyword) |
|
848 | + if ($search_target && $search_keyword) |
|
849 | 849 | { |
850 | - switch($search_target) |
|
850 | + switch ($search_target) |
|
851 | 851 | { |
852 | 852 | case 'content' : |
853 | - if($search_keyword) |
|
853 | + if ($search_keyword) |
|
854 | 854 | { |
855 | 855 | $search_keyword = str_replace(' ', '%', $search_keyword); |
856 | 856 | } |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | break; |
860 | 860 | |
861 | 861 | case 'user_id' : |
862 | - if($search_keyword) |
|
862 | + if ($search_keyword) |
|
863 | 863 | { |
864 | 864 | $search_keyword = str_replace(' ', '%', $search_keyword); |
865 | 865 | } |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | break; |
870 | 870 | |
871 | 871 | case 'user_name' : |
872 | - if($search_keyword) |
|
872 | + if ($search_keyword) |
|
873 | 873 | { |
874 | 874 | $search_keyword = str_replace(' ', '%', $search_keyword); |
875 | 875 | } |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | break; |
879 | 879 | |
880 | 880 | case 'nick_name' : |
881 | - if($search_keyword) |
|
881 | + if ($search_keyword) |
|
882 | 882 | { |
883 | 883 | $search_keyword = str_replace(' ', '%', $search_keyword); |
884 | 884 | } |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | break; |
888 | 888 | |
889 | 889 | case 'email_address' : |
890 | - if($search_keyword) |
|
890 | + if ($search_keyword) |
|
891 | 891 | { |
892 | 892 | $search_keyword = str_replace(' ', '%', $search_keyword); |
893 | 893 | } |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | break; |
897 | 897 | |
898 | 898 | case 'homepage' : |
899 | - if($search_keyword) |
|
899 | + if ($search_keyword) |
|
900 | 900 | { |
901 | 901 | $search_keyword = str_replace(' ', '%', $search_keyword); |
902 | 902 | } |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | break; |
922 | 922 | |
923 | 923 | case 'member_srl' : |
924 | - $args->{"s_" . $search_target} = (int) $search_keyword; |
|
924 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
925 | 925 | break; |
926 | 926 | } |
927 | 927 | } |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | $output = executeQueryArray($query_id, $args); |
930 | 930 | |
931 | 931 | // return when no result or error occurance |
932 | - if(!$output->toBool() || !count($output->data)) |
|
932 | + if (!$output->toBool() || !count($output->data)) |
|
933 | 933 | { |
934 | 934 | return $output; |
935 | 935 | } |
@@ -946,12 +946,12 @@ discard block |
||
946 | 946 | { |
947 | 947 | $oModuleModel = getModel('module'); |
948 | 948 | $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); |
949 | - if(!is_object($comment_config)) |
|
949 | + if (!is_object($comment_config)) |
|
950 | 950 | { |
951 | 951 | $comment_config = new stdClass(); |
952 | 952 | } |
953 | 953 | |
954 | - if(!isset($comment_config->comment_count)) |
|
954 | + if (!isset($comment_config->comment_count)) |
|
955 | 955 | { |
956 | 956 | $comment_config->comment_count = 50; |
957 | 957 | } |
@@ -966,13 +966,13 @@ discard block |
||
966 | 966 | function getCommentVotedMemberList() |
967 | 967 | { |
968 | 968 | $comment_srl = Context::get('comment_srl'); |
969 | - if(!$comment_srl) |
|
969 | + if (!$comment_srl) |
|
970 | 970 | { |
971 | 971 | return new BaseObject(-1, 'msg_invalid_request'); |
972 | 972 | } |
973 | 973 | |
974 | 974 | $point = Context::get('point'); |
975 | - if($point != -1) |
|
975 | + if ($point != -1) |
|
976 | 976 | { |
977 | 977 | $point = 1; |
978 | 978 | } |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | $oCommentModel = getModel('comment'); |
981 | 981 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
982 | 982 | $module_srl = $oComment->get('module_srl'); |
983 | - if(!$module_srl) |
|
983 | + if (!$module_srl) |
|
984 | 984 | { |
985 | 985 | return new BaseObject(-1, 'msg_invalid_request'); |
986 | 986 | } |
@@ -990,9 +990,9 @@ discard block |
||
990 | 990 | |
991 | 991 | $args = new stdClass(); |
992 | 992 | |
993 | - if($point == -1) |
|
993 | + if ($point == -1) |
|
994 | 994 | { |
995 | - if($comment_config->use_vote_down != 'S') |
|
995 | + if ($comment_config->use_vote_down != 'S') |
|
996 | 996 | { |
997 | 997 | return new BaseObject(-1, 'msg_invalid_request'); |
998 | 998 | } |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | } |
1002 | 1002 | else |
1003 | 1003 | { |
1004 | - if($comment_config->use_vote_up != 'S') |
|
1004 | + if ($comment_config->use_vote_up != 'S') |
|
1005 | 1005 | { |
1006 | 1006 | return new BaseObject(-1, 'msg_invalid_request'); |
1007 | 1007 | } |
@@ -1011,15 +1011,15 @@ discard block |
||
1011 | 1011 | |
1012 | 1012 | $args->comment_srl = $comment_srl; |
1013 | 1013 | $output = executeQueryArray('comment.getVotedMemberList', $args); |
1014 | - if(!$output->toBool()) |
|
1014 | + if (!$output->toBool()) |
|
1015 | 1015 | { |
1016 | 1016 | return $output; |
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | $oMemberModel = getModel('member'); |
1020 | - if($output->data) |
|
1020 | + if ($output->data) |
|
1021 | 1021 | { |
1022 | - foreach($output->data as $k => $d) |
|
1022 | + foreach ($output->data as $k => $d) |
|
1023 | 1023 | { |
1024 | 1024 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
1025 | 1025 | $output->data[$k]->src = $profile_image->src; |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | { |
1038 | 1038 | global $lang; |
1039 | 1039 | |
1040 | - if(!isset($lang->secret_name_list)) |
|
1040 | + if (!isset($lang->secret_name_list)) |
|
1041 | 1041 | { |
1042 | 1042 | return array('Y' => 'Secret', 'N' => 'Public'); |
1043 | 1043 | } |
@@ -1078,8 +1078,8 @@ discard block |
||
1078 | 1078 | $output = executeQuery('comment.getCommentListByMemberSrl', $args, $columnList); |
1079 | 1079 | $comment_list = $output->data; |
1080 | 1080 | |
1081 | - if(!$comment_list) return array(); |
|
1082 | - if(!is_array($comment_list)) $comment_list = array($comment_list); |
|
1081 | + if (!$comment_list) return array(); |
|
1082 | + if (!is_array($comment_list)) $comment_list = array($comment_list); |
|
1083 | 1083 | |
1084 | 1084 | return $comment_list; |
1085 | 1085 |