@@ -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') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return $this->grant_cache = true; |
|
| 178 | + if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return $this->grant_cache = true; |
|
| 179 | 179 | |
| 180 | 180 | return $this->grant_cache = false; |
| 181 | 181 | } |
@@ -188,13 +188,13 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | function isAccessible() |
| 190 | 190 | { |
| 191 | - return $_SESSION['accessible'][$this->document_srl]==true?true:false; |
|
| 191 | + return $_SESSION['accessible'][$this->document_srl] == true ? true : false; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | function allowComment() |
| 195 | 195 | { |
| 196 | 196 | // init write, document is not exists. so allow comment status is true |
| 197 | - if(!$this->isExists()) return true; |
|
| 197 | + if (!$this->isExists()) return true; |
|
| 198 | 198 | |
| 199 | 199 | return $this->get('comment_status') == 'ALLOW' ? true : false; |
| 200 | 200 | } |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | function allowTrackback() |
| 203 | 203 | { |
| 204 | 204 | static $allow_trackback_status = null; |
| 205 | - if(is_null($allow_trackback_status)) |
|
| 205 | + if (is_null($allow_trackback_status)) |
|
| 206 | 206 | { |
| 207 | 207 | |
| 208 | 208 | // Check the tarckback module exist |
| 209 | - if(!getClass('trackback')) |
|
| 209 | + if (!getClass('trackback')) |
|
| 210 | 210 | { |
| 211 | 211 | $allow_trackback_status = false; |
| 212 | 212 | } |
@@ -216,20 +216,20 @@ discard block |
||
| 216 | 216 | $oModuleModel = getModel('module'); |
| 217 | 217 | $trackback_config = $oModuleModel->getModuleConfig('trackback'); |
| 218 | 218 | |
| 219 | - if(!$trackback_config) |
|
| 219 | + if (!$trackback_config) |
|
| 220 | 220 | { |
| 221 | 221 | $trackback_config = new stdClass(); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 225 | - if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 224 | + if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; |
|
| 225 | + if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; |
|
| 226 | 226 | else |
| 227 | 227 | { |
| 228 | 228 | $module_srl = $this->get('module_srl'); |
| 229 | 229 | // Check settings of each module |
| 230 | 230 | $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); |
| 231 | - if($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 232 | - else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 231 | + if ($module_config->enable_trackback == 'N') $allow_trackback_status = false; |
|
| 232 | + else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true; |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | function isLocked() |
| 240 | 240 | { |
| 241 | - if(!$this->isExists()) return false; |
|
| 241 | + if (!$this->isExists()) return false; |
|
| 242 | 242 | |
| 243 | 243 | return $this->get('comment_status') == 'ALLOW' ? false : true; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | function isEditable() |
| 247 | 247 | { |
| 248 | - if($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 248 | + if ($this->isGranted() || !$this->get('member_srl')) return true; |
|
| 249 | 249 | return false; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | function useNotify() |
| 264 | 264 | { |
| 265 | - return $this->get('notify_message')=='Y' ? true : false; |
|
| 265 | + return $this->get('notify_message') == 'Y' ? true : false; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | function doCart() |
| 269 | 269 | { |
| 270 | - if(!$this->document_srl) return false; |
|
| 271 | - if($this->isCarted()) $this->removeCart(); |
|
| 270 | + if (!$this->document_srl) return false; |
|
| 271 | + if ($this->isCarted()) $this->removeCart(); |
|
| 272 | 272 | else $this->addCart(); |
| 273 | 273 | } |
| 274 | 274 | |
@@ -295,18 +295,18 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | function notify($type, $content) |
| 297 | 297 | { |
| 298 | - if(!$this->document_srl) return; |
|
| 298 | + if (!$this->document_srl) return; |
|
| 299 | 299 | // return if it is not useNotify |
| 300 | - if(!$this->useNotify()) return; |
|
| 300 | + if (!$this->useNotify()) return; |
|
| 301 | 301 | // Pass if an author is not a logged-in user |
| 302 | - if(!$this->get('member_srl')) return; |
|
| 302 | + if (!$this->get('member_srl')) return; |
|
| 303 | 303 | // Return if the currently logged-in user is an author |
| 304 | 304 | $logged_info = Context::get('logged_info'); |
| 305 | - if($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 305 | + if ($logged_info->member_srl == $this->get('member_srl')) return; |
|
| 306 | 306 | // List variables |
| 307 | - if($type) $title = "[".$type."] "; |
|
| 307 | + if ($type) $title = "[".$type."] "; |
|
| 308 | 308 | $title .= cut_str(strip_tags($content), 10, '...'); |
| 309 | - $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); |
|
| 309 | + $content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl)); |
|
| 310 | 310 | $receiver_srl = $this->get('member_srl'); |
| 311 | 311 | $sender_member_srl = $logged_info->member_srl; |
| 312 | 312 | // Send a message |
@@ -321,26 +321,26 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | function getIpAddress() |
| 323 | 323 | { |
| 324 | - if($this->isGranted()) |
|
| 324 | + if ($this->isGranted()) |
|
| 325 | 325 | { |
| 326 | 326 | return $this->get('ipaddress'); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - return '*' . strstr($this->get('ipaddress'), '.'); |
|
| 329 | + return '*'.strstr($this->get('ipaddress'), '.'); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | function isExistsHomepage() |
| 333 | 333 | { |
| 334 | - if(trim($this->get('homepage'))) return true; |
|
| 334 | + if (trim($this->get('homepage'))) return true; |
|
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | function getHomepageUrl() |
| 339 | 339 | { |
| 340 | 340 | $url = trim($this->get('homepage')); |
| 341 | - if(!$url) return; |
|
| 341 | + if (!$url) return; |
|
| 342 | 342 | |
| 343 | - if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url; |
|
| 343 | + if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://'.$url; |
|
| 344 | 344 | |
| 345 | 345 | return $url; |
| 346 | 346 | } |
@@ -370,52 +370,52 @@ discard block |
||
| 370 | 370 | return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - function getTitleText($cut_size = 0, $tail='...') |
|
| 373 | + function getTitleText($cut_size = 0, $tail = '...') |
|
| 374 | 374 | { |
| 375 | - if(!$this->document_srl) return; |
|
| 375 | + if (!$this->document_srl) return; |
|
| 376 | 376 | |
| 377 | - if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 377 | + if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail); |
|
| 378 | 378 | else $title = $this->get('title'); |
| 379 | 379 | |
| 380 | 380 | return $title; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - function getTitle($cut_size = 0, $tail='...') |
|
| 383 | + function getTitle($cut_size = 0, $tail = '...') |
|
| 384 | 384 | { |
| 385 | - if(!$this->document_srl) return; |
|
| 385 | + if (!$this->document_srl) return; |
|
| 386 | 386 | |
| 387 | 387 | $title = $this->getTitleText($cut_size, $tail); |
| 388 | 388 | |
| 389 | 389 | $attrs = array(); |
| 390 | 390 | $this->add('title_color', trim($this->get('title_color'))); |
| 391 | - if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;"; |
|
| 392 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 391 | + if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;"; |
|
| 392 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color'); |
|
| 393 | 393 | |
| 394 | - if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 394 | + if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
| 395 | 395 | else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | function getContentText($strlen = 0) |
| 399 | 399 | { |
| 400 | - if(!$this->document_srl) return; |
|
| 400 | + if (!$this->document_srl) return; |
|
| 401 | 401 | |
| 402 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 402 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 403 | 403 | |
| 404 | 404 | $result = $this->_checkAccessibleFromStatus(); |
| 405 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 405 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 406 | 406 | |
| 407 | 407 | $content = $this->get('content'); |
| 408 | 408 | $content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content); |
| 409 | 409 | $content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content); |
| 410 | 410 | |
| 411 | - if($strlen) return cut_str(strip_tags($content),$strlen,'...'); |
|
| 411 | + if ($strlen) return cut_str(strip_tags($content), $strlen, '...'); |
|
| 412 | 412 | |
| 413 | 413 | return htmlspecialchars($content); |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | function _addAllowScriptAccess($m) |
| 417 | 417 | { |
| 418 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 418 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
| 419 | 419 | { |
| 420 | 420 | $m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>'; |
| 421 | 421 | } |
@@ -425,26 +425,26 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | function _checkAllowScriptAccess($m) |
| 427 | 427 | { |
| 428 | - if($m[1] == 'object') |
|
| 428 | + if ($m[1] == 'object') |
|
| 429 | 429 | { |
| 430 | 430 | $this->allowscriptaccessList[] = 1; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if($m[1] == 'param') |
|
| 433 | + if ($m[1] == 'param') |
|
| 434 | 434 | { |
| 435 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 435 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 436 | 436 | { |
| 437 | 437 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
| 438 | - if(substr($m[0], -1) == '/') |
|
| 438 | + if (substr($m[0], -1) == '/') |
|
| 439 | 439 | { |
| 440 | 440 | $m[0] .= '/'; |
| 441 | 441 | } |
| 442 | - $this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--; |
|
| 442 | + $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | - else if($m[1] == 'embed') |
|
| 445 | + else if ($m[1] == 'embed') |
|
| 446 | 446 | { |
| 447 | - if(stripos($m[0], 'allowscriptaccess')) |
|
| 447 | + if (stripos($m[0], 'allowscriptaccess')) |
|
| 448 | 448 | { |
| 449 | 449 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
| 450 | 450 | } |
@@ -458,24 +458,24 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false) |
| 460 | 460 | { |
| 461 | - if(!$this->document_srl) return; |
|
| 461 | + if (!$this->document_srl) return; |
|
| 462 | 462 | |
| 463 | - if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 463 | + if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); |
|
| 464 | 464 | |
| 465 | 465 | $result = $this->_checkAccessibleFromStatus(); |
| 466 | - if($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 466 | + if ($result) $_SESSION['accessible'][$this->document_srl] = true; |
|
| 467 | 467 | |
| 468 | 468 | $content = $this->get('content'); |
| 469 | - if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 469 | + if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); |
|
| 470 | 470 | |
| 471 | 471 | // Define a link if using a rewrite module |
| 472 | 472 | $oContext = &Context::getInstance(); |
| 473 | - if($oContext->allow_rewrite) |
|
| 473 | + if ($oContext->allow_rewrite) |
|
| 474 | 474 | { |
| 475 | - $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content); |
|
| 475 | + $content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content); |
|
| 476 | 476 | } |
| 477 | 477 | // To display a pop-up menu |
| 478 | - if($add_popup_menu) |
|
| 478 | + if ($add_popup_menu) |
|
| 479 | 479 | { |
| 480 | 480 | $content = sprintf( |
| 481 | 481 | '%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>', |
@@ -484,10 +484,10 @@ discard block |
||
| 484 | 484 | ); |
| 485 | 485 | } |
| 486 | 486 | // If additional content information is set |
| 487 | - if($add_content_info) |
|
| 487 | + if ($add_content_info) |
|
| 488 | 488 | { |
| 489 | 489 | $memberSrl = $this->get('member_srl'); |
| 490 | - if($memberSrl < 0) |
|
| 490 | + if ($memberSrl < 0) |
|
| 491 | 491 | { |
| 492 | 492 | $memberSrl = 0; |
| 493 | 493 | } |
@@ -503,12 +503,12 @@ discard block |
||
| 503 | 503 | } |
| 504 | 504 | else |
| 505 | 505 | { |
| 506 | - if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 506 | + if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content); |
|
| 507 | 507 | } |
| 508 | 508 | // Change the image path to a valid absolute path if resource_realpath is true |
| 509 | - if($resource_realpath) |
|
| 509 | + if ($resource_realpath) |
|
| 510 | 510 | { |
| 511 | - $content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content); |
|
| 511 | + $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | return $content; |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | $content = trim(cut_str($content, $str_size, $tail)); |
| 558 | 558 | |
| 559 | 559 | // Replace back < , <, " |
| 560 | - $content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content); |
|
| 560 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
| 561 | 561 | |
| 562 | 562 | return $content; |
| 563 | 563 | } |
@@ -570,13 +570,13 @@ discard block |
||
| 570 | 570 | function getRegdateTime() |
| 571 | 571 | { |
| 572 | 572 | $regdate = $this->get('regdate'); |
| 573 | - $year = substr($regdate,0,4); |
|
| 574 | - $month = substr($regdate,4,2); |
|
| 575 | - $day = substr($regdate,6,2); |
|
| 576 | - $hour = substr($regdate,8,2); |
|
| 577 | - $min = substr($regdate,10,2); |
|
| 578 | - $sec = substr($regdate,12,2); |
|
| 579 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 573 | + $year = substr($regdate, 0, 4); |
|
| 574 | + $month = substr($regdate, 4, 2); |
|
| 575 | + $day = substr($regdate, 6, 2); |
|
| 576 | + $hour = substr($regdate, 8, 2); |
|
| 577 | + $min = substr($regdate, 10, 2); |
|
| 578 | + $sec = substr($regdate, 12, 2); |
|
| 579 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | function getRegdateGM() |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | function getRegdateDT() |
| 588 | 588 | { |
| 589 | - return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 589 | + return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | function getUpdate($format = 'Y.m.d H:i:s') |
@@ -596,13 +596,13 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | function getUpdateTime() |
| 598 | 598 | { |
| 599 | - $year = substr($this->get('last_update'),0,4); |
|
| 600 | - $month = substr($this->get('last_update'),4,2); |
|
| 601 | - $day = substr($this->get('last_update'),6,2); |
|
| 602 | - $hour = substr($this->get('last_update'),8,2); |
|
| 603 | - $min = substr($this->get('last_update'),10,2); |
|
| 604 | - $sec = substr($this->get('last_update'),12,2); |
|
| 605 | - return mktime($hour,$min,$sec,$month,$day,$year); |
|
| 599 | + $year = substr($this->get('last_update'), 0, 4); |
|
| 600 | + $month = substr($this->get('last_update'), 4, 2); |
|
| 601 | + $day = substr($this->get('last_update'), 6, 2); |
|
| 602 | + $hour = substr($this->get('last_update'), 8, 2); |
|
| 603 | + $min = substr($this->get('last_update'), 10, 2); |
|
| 604 | + $sec = substr($this->get('last_update'), 12, 2); |
|
| 605 | + return mktime($hour, $min, $sec, $month, $day, $year); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | function getUpdateGM() |
@@ -612,21 +612,21 @@ discard block |
||
| 612 | 612 | |
| 613 | 613 | function getUpdateDT() |
| 614 | 614 | { |
| 615 | - return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2); |
|
| 615 | + return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | function getPermanentUrl() |
| 619 | 619 | { |
| 620 | - return getFullUrl('','document_srl',$this->get('document_srl')); |
|
| 620 | + return getFullUrl('', 'document_srl', $this->get('document_srl')); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | function getTrackbackUrl() |
| 624 | 624 | { |
| 625 | - if(!$this->document_srl) return; |
|
| 625 | + if (!$this->document_srl) return; |
|
| 626 | 626 | |
| 627 | 627 | // Generate a key to prevent spams |
| 628 | 628 | $oTrackbackModel = getModel('trackback'); |
| 629 | - if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 629 | + if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid()); |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | /** |
@@ -636,24 +636,24 @@ discard block |
||
| 636 | 636 | function updateReadedCount() |
| 637 | 637 | { |
| 638 | 638 | $oDocumentController = getController('document'); |
| 639 | - if($oDocumentController->updateReadedCount($this)) |
|
| 639 | + if ($oDocumentController->updateReadedCount($this)) |
|
| 640 | 640 | { |
| 641 | 641 | $readed_count = $this->get('readed_count'); |
| 642 | - $this->add('readed_count', $readed_count+1); |
|
| 642 | + $this->add('readed_count', $readed_count + 1); |
|
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | function isExtraVarsExists() |
| 647 | 647 | { |
| 648 | - if(!$this->get('module_srl')) return false; |
|
| 648 | + if (!$this->get('module_srl')) return false; |
|
| 649 | 649 | $oDocumentModel = getModel('document'); |
| 650 | 650 | $extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl')); |
| 651 | - return count($extra_keys)?true:false; |
|
| 651 | + return count($extra_keys) ? true : false; |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | function getExtraVars() |
| 655 | 655 | { |
| 656 | - if(!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 656 | + if (!$this->get('module_srl') || !$this->document_srl) return null; |
|
| 657 | 657 | |
| 658 | 658 | $oDocumentModel = getModel('document'); |
| 659 | 659 | return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl); |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | function getExtraValue($idx) |
| 663 | 663 | { |
| 664 | 664 | $extra_vars = $this->getExtraVars(); |
| 665 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 665 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 666 | 666 | { |
| 667 | 667 | return $extra_vars[$idx]->getValue(); |
| 668 | 668 | } |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | function getExtraValueHTML($idx) |
| 676 | 676 | { |
| 677 | 677 | $extra_vars = $this->getExtraVars(); |
| 678 | - if(is_array($extra_vars) && array_key_exists($idx,$extra_vars)) |
|
| 678 | + if (is_array($extra_vars) && array_key_exists($idx, $extra_vars)) |
|
| 679 | 679 | { |
| 680 | 680 | return $extra_vars[$idx]->getValueHTML(); |
| 681 | 681 | } |
@@ -689,16 +689,16 @@ discard block |
||
| 689 | 689 | { |
| 690 | 690 | $extra_vars = $this->getExtraVars(); |
| 691 | 691 | |
| 692 | - if($extra_vars) |
|
| 692 | + if ($extra_vars) |
|
| 693 | 693 | { |
| 694 | 694 | // Handle extra variable(eid) |
| 695 | - foreach($extra_vars as $idx => $key) |
|
| 695 | + foreach ($extra_vars as $idx => $key) |
|
| 696 | 696 | { |
| 697 | 697 | $extra_eid[$key->eid] = $key; |
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 701 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 702 | 702 | { |
| 703 | 703 | return $extra_eid[$eid]->getValue(); |
| 704 | 704 | } |
@@ -712,12 +712,12 @@ discard block |
||
| 712 | 712 | { |
| 713 | 713 | $extra_vars = $this->getExtraVars(); |
| 714 | 714 | // Handle extra variable(eid) |
| 715 | - foreach($extra_vars as $idx => $key) |
|
| 715 | + foreach ($extra_vars as $idx => $key) |
|
| 716 | 716 | { |
| 717 | 717 | $extra_eid[$key->eid] = $key; |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | - if(is_array($extra_eid) && array_key_exists($eid,$extra_eid)) |
|
| 720 | + if (is_array($extra_eid) && array_key_exists($eid, $extra_eid)) |
|
| 721 | 721 | { |
| 722 | 722 | return $extra_eid[$eid]->getValueHTML(); |
| 723 | 723 | } |
@@ -741,13 +741,13 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | function getComments() |
| 743 | 743 | { |
| 744 | - if(!$this->getCommentCount()) return; |
|
| 745 | - if(!$this->isGranted() && $this->isSecret()) return; |
|
| 744 | + if (!$this->getCommentCount()) return; |
|
| 745 | + if (!$this->isGranted() && $this->isSecret()) return; |
|
| 746 | 746 | // cpage is a number of comment pages |
| 747 | 747 | $cpageStr = sprintf('%d_cpage', $this->document_srl); |
| 748 | 748 | $cpage = Context::get($cpageStr); |
| 749 | 749 | |
| 750 | - if(!$cpage) |
|
| 750 | + if (!$cpage) |
|
| 751 | 751 | { |
| 752 | 752 | $cpage = Context::get('cpage'); |
| 753 | 753 | } |
@@ -755,19 +755,19 @@ discard block |
||
| 755 | 755 | // Get a list of comments |
| 756 | 756 | $oCommentModel = getModel('comment'); |
| 757 | 757 | $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); |
| 758 | - if(!$output->toBool() || !count($output->data)) return; |
|
| 758 | + if (!$output->toBool() || !count($output->data)) return; |
|
| 759 | 759 | // Create commentItem object from a comment list |
| 760 | 760 | // If admin priviledge is granted on parent posts, you can read its child posts. |
| 761 | 761 | $accessible = array(); |
| 762 | 762 | $comment_list = array(); |
| 763 | - foreach($output->data as $key => $val) |
|
| 763 | + foreach ($output->data as $key => $val) |
|
| 764 | 764 | { |
| 765 | 765 | $oCommentItem = new commentItem(); |
| 766 | 766 | $oCommentItem->setAttribute($val); |
| 767 | 767 | // If permission is granted to the post, you can access it temporarily |
| 768 | - if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 768 | + if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; |
|
| 769 | 769 | // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post |
| 770 | - if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) |
|
| 770 | + if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) |
|
| 771 | 771 | { |
| 772 | 772 | $oCommentItem->setAccessible(); |
| 773 | 773 | } |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | // Variable setting to be displayed on the skin |
| 777 | 777 | Context::set($cpageStr, $output->page_navigation->cur_page); |
| 778 | 778 | Context::set('cpage', $output->page_navigation->cur_page); |
| 779 | - if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; |
|
| 779 | + if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation; |
|
| 780 | 780 | |
| 781 | 781 | return $comment_list; |
| 782 | 782 | } |
@@ -788,9 +788,9 @@ discard block |
||
| 788 | 788 | |
| 789 | 789 | function getTrackbacks() |
| 790 | 790 | { |
| 791 | - if(!$this->document_srl) return; |
|
| 791 | + if (!$this->document_srl) return; |
|
| 792 | 792 | |
| 793 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 793 | + if (!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 794 | 794 | |
| 795 | 795 | $oTrackbackModel = getModel('trackback'); |
| 796 | 796 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -798,47 +798,47 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 800 | 800 | { |
| 801 | - if(!$this->document_srl) return false; |
|
| 802 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 801 | + if (!$this->document_srl) return false; |
|
| 802 | + if (!$this->getThumbnail($width, $height, $type)) return false; |
|
| 803 | 803 | return true; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 807 | 807 | { |
| 808 | 808 | // Return false if the document doesn't exist |
| 809 | - if(!$this->document_srl) return; |
|
| 809 | + if (!$this->document_srl) return; |
|
| 810 | 810 | |
| 811 | - if($this->isSecret() && !$this->isGranted()) |
|
| 811 | + if ($this->isSecret() && !$this->isGranted()) |
|
| 812 | 812 | { |
| 813 | 813 | return; |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | // If not specify its height, create a square |
| 817 | - if(!$height) $height = $width; |
|
| 817 | + if (!$height) $height = $width; |
|
| 818 | 818 | |
| 819 | 819 | // Return false if neither attachement nor image files in the document |
| 820 | 820 | $content = $this->get('content'); |
| 821 | - if(!$this->get('uploaded_count')) |
|
| 821 | + if (!$this->get('uploaded_count')) |
|
| 822 | 822 | { |
| 823 | - if(!$content) |
|
| 823 | + if (!$content) |
|
| 824 | 824 | { |
| 825 | 825 | $args = new stdClass(); |
| 826 | 826 | $args->document_srl = $this->document_srl; |
| 827 | 827 | $output = executeQuery('document.getDocument', $args, array('content')); |
| 828 | - if($output->toBool() && $output->data) |
|
| 828 | + if ($output->toBool() && $output->data) |
|
| 829 | 829 | { |
| 830 | 830 | $content = $output->data->content; |
| 831 | 831 | $this->add('content', $content); |
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | - if(!preg_match("!<img!is", $content)) return; |
|
| 835 | + if (!preg_match("!<img!is", $content)) return; |
|
| 836 | 836 | } |
| 837 | 837 | // Get thumbnai_type information from document module's configuration |
| 838 | - if(!in_array($thumbnail_type, array('crop','ratio'))) |
|
| 838 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
| 839 | 839 | { |
| 840 | 840 | $config = $GLOBALS['__document_config__']; |
| 841 | - if(!$config) |
|
| 841 | + if (!$config) |
|
| 842 | 842 | { |
| 843 | 843 | $oDocumentModel = getModel('document'); |
| 844 | 844 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -848,15 +848,15 @@ discard block |
||
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | // Define thumbnail information |
| 851 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3)); |
|
| 851 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3)); |
|
| 852 | 852 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
| 853 | 853 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
| 854 | 854 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
| 855 | 855 | |
| 856 | 856 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
| 857 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
| 857 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
| 858 | 858 | { |
| 859 | - if(filesize($thumbnail_file) < 1) |
|
| 859 | + if (filesize($thumbnail_file) < 1) |
|
| 860 | 860 | { |
| 861 | 861 | return FALSE; |
| 862 | 862 | } |
@@ -874,64 +874,64 @@ discard block |
||
| 874 | 874 | $is_tmp_file = false; |
| 875 | 875 | |
| 876 | 876 | // Find an iamge file among attached files if exists |
| 877 | - if($this->hasUploadedFiles()) |
|
| 877 | + if ($this->hasUploadedFiles()) |
|
| 878 | 878 | { |
| 879 | 879 | $file_list = $this->getUploadedFiles(); |
| 880 | 880 | |
| 881 | 881 | $first_image = null; |
| 882 | - foreach($file_list as $file) |
|
| 882 | + foreach ($file_list as $file) |
|
| 883 | 883 | { |
| 884 | - if($file->direct_download !== 'Y') continue; |
|
| 884 | + if ($file->direct_download !== 'Y') continue; |
|
| 885 | 885 | |
| 886 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 886 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 887 | 887 | { |
| 888 | 888 | $source_file = $file->uploaded_filename; |
| 889 | 889 | break; |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - if($first_image) continue; |
|
| 892 | + if ($first_image) continue; |
|
| 893 | 893 | |
| 894 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 894 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 895 | 895 | { |
| 896 | - if(file_exists($file->uploaded_filename)) |
|
| 896 | + if (file_exists($file->uploaded_filename)) |
|
| 897 | 897 | { |
| 898 | 898 | $first_image = $file->uploaded_filename; |
| 899 | 899 | } |
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | - if(!$source_file && $first_image) |
|
| 903 | + if (!$source_file && $first_image) |
|
| 904 | 904 | { |
| 905 | 905 | $source_file = $first_image; |
| 906 | 906 | } |
| 907 | 907 | } |
| 908 | 908 | // If not exists, file an image file from the content |
| 909 | 909 | $is_tmp_file = false; |
| 910 | - if(!$source_file) |
|
| 910 | + if (!$source_file) |
|
| 911 | 911 | { |
| 912 | 912 | $random = new Password(); |
| 913 | 913 | |
| 914 | 914 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
| 915 | 915 | |
| 916 | - foreach($matches as $target_image) |
|
| 916 | + foreach ($matches as $target_image) |
|
| 917 | 917 | { |
| 918 | 918 | $target_src = trim($target_image[1]); |
| 919 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 919 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 920 | 920 | |
| 921 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
| 921 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
| 922 | 922 | { |
| 923 | 923 | $target_src = Context::getRequestUri().$target_src; |
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | $target_src = htmlspecialchars_decode($target_src); |
| 927 | 927 | |
| 928 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
| 928 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
| 929 | 929 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 930 | - if(!file_exists($tmp_file)) continue; |
|
| 930 | + if (!file_exists($tmp_file)) continue; |
|
| 931 | 931 | |
| 932 | 932 | $imageinfo = getimagesize($tmp_file); |
| 933 | 933 | list($_w, $_h) = $imageinfo; |
| 934 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 934 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 935 | 935 | FileHandler::removeFile($tmp_file); |
| 936 | 936 | continue; |
| 937 | 937 | } |
@@ -942,13 +942,13 @@ discard block |
||
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | - if($source_file) |
|
| 945 | + if ($source_file) |
|
| 946 | 946 | { |
| 947 | 947 | $output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | // Remove source file if it was temporary |
| 951 | - if($is_tmp_file) |
|
| 951 | + if ($is_tmp_file) |
|
| 952 | 952 | { |
| 953 | 953 | FileHandler::removeFile($source_file); |
| 954 | 954 | } |
@@ -957,14 +957,14 @@ discard block |
||
| 957 | 957 | FileHandler::removeFile($thumbnail_lockfile); |
| 958 | 958 | |
| 959 | 959 | // Return the thumbnail path if it was successfully generated |
| 960 | - if($output_file) |
|
| 960 | + if ($output_file) |
|
| 961 | 961 | { |
| 962 | 962 | return $thumbnail_url; |
| 963 | 963 | } |
| 964 | 964 | // Create an empty file if thumbnail generation failed |
| 965 | 965 | else |
| 966 | 966 | { |
| 967 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 967 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | return; |
@@ -978,21 +978,21 @@ discard block |
||
| 978 | 978 | */ |
| 979 | 979 | function getExtraImages($time_interval = 43200) |
| 980 | 980 | { |
| 981 | - if(!$this->document_srl) return; |
|
| 981 | + if (!$this->document_srl) return; |
|
| 982 | 982 | // variables for icon list |
| 983 | 983 | $buffs = array(); |
| 984 | 984 | |
| 985 | 985 | $check_files = false; |
| 986 | 986 | |
| 987 | 987 | // Check if secret post is |
| 988 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 988 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
| 989 | 989 | |
| 990 | 990 | // Set the latest time |
| 991 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
| 991 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
| 992 | 992 | |
| 993 | 993 | // Check new post |
| 994 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 995 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 994 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
| 995 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
| 996 | 996 | |
| 997 | 997 | /* |
| 998 | 998 | $content = $this->get('content'); |
@@ -1015,14 +1015,14 @@ discard block |
||
| 1015 | 1015 | */ |
| 1016 | 1016 | |
| 1017 | 1017 | // Check the attachment |
| 1018 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1018 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1019 | 1019 | |
| 1020 | 1020 | return $buffs; |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | function getStatus() |
| 1024 | 1024 | { |
| 1025 | - if(!$this->get('status')) return $this->getDefaultStatus(); |
|
| 1025 | + if (!$this->get('status')) return $this->getDefaultStatus(); |
|
| 1026 | 1026 | return $this->get('status'); |
| 1027 | 1027 | } |
| 1028 | 1028 | |
@@ -1033,15 +1033,15 @@ discard block |
||
| 1033 | 1033 | */ |
| 1034 | 1034 | function printExtraImages($time_check = 43200) |
| 1035 | 1035 | { |
| 1036 | - if(!$this->document_srl) return; |
|
| 1036 | + if (!$this->document_srl) return; |
|
| 1037 | 1037 | // Get the icon directory |
| 1038 | - $path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); |
|
| 1038 | + $path = sprintf('%s%s', getUrl(), 'modules/document/tpl/icons/'); |
|
| 1039 | 1039 | |
| 1040 | 1040 | $buffs = $this->getExtraImages($time_check); |
| 1041 | - if(!count($buffs)) return; |
|
| 1041 | + if (!count($buffs)) return; |
|
| 1042 | 1042 | |
| 1043 | 1043 | $buff = array(); |
| 1044 | - foreach($buffs as $key => $val) |
|
| 1044 | + foreach ($buffs as $key => $val) |
|
| 1045 | 1045 | { |
| 1046 | 1046 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
| 1047 | 1047 | } |
@@ -1050,20 +1050,20 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | function hasUploadedFiles() |
| 1052 | 1052 | { |
| 1053 | - if(!$this->document_srl) return; |
|
| 1053 | + if (!$this->document_srl) return; |
|
| 1054 | 1054 | |
| 1055 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1056 | - return $this->get('uploaded_count')? true : false; |
|
| 1055 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
| 1056 | + return $this->get('uploaded_count') ? true : false; |
|
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1060 | 1060 | { |
| 1061 | - if(!$this->document_srl) return; |
|
| 1061 | + if (!$this->document_srl) return; |
|
| 1062 | 1062 | |
| 1063 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1064 | - if(!$this->get('uploaded_count')) return; |
|
| 1063 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
| 1064 | + if (!$this->get('uploaded_count')) return; |
|
| 1065 | 1065 | |
| 1066 | - if(!$this->uploadedFiles[$sortIndex]) |
|
| 1066 | + if (!$this->uploadedFiles[$sortIndex]) |
|
| 1067 | 1067 | { |
| 1068 | 1068 | $oFileModel = getModel('file'); |
| 1069 | 1069 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | function getEditor() |
| 1080 | 1080 | { |
| 1081 | 1081 | $module_srl = $this->get('module_srl'); |
| 1082 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1082 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1083 | 1083 | |
| 1084 | 1084 | $oEditorModel = getModel('editor'); |
| 1085 | 1085 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | { |
| 1095 | 1095 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1096 | 1096 | if (!$this->allowComment()) return false; |
| 1097 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1097 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
| 1098 | 1098 | |
| 1099 | 1099 | return true; |
| 1100 | 1100 | } |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | */ |
| 1106 | 1106 | function getCommentEditor() |
| 1107 | 1107 | { |
| 1108 | - if(!$this->isEnableComment()) return; |
|
| 1108 | + if (!$this->isEnableComment()) return; |
|
| 1109 | 1109 | |
| 1110 | 1110 | $oEditorModel = getModel('editor'); |
| 1111 | 1111 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1117,10 +1117,10 @@ discard block |
||
| 1117 | 1117 | */ |
| 1118 | 1118 | function getProfileImage() |
| 1119 | 1119 | { |
| 1120 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1120 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1121 | 1121 | $oMemberModel = getModel('member'); |
| 1122 | 1122 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1123 | - if(!$profile_info) return; |
|
| 1123 | + if (!$profile_info) return; |
|
| 1124 | 1124 | |
| 1125 | 1125 | return $profile_info->src; |
| 1126 | 1126 | } |
@@ -1132,21 +1132,21 @@ discard block |
||
| 1132 | 1132 | function getSignature() |
| 1133 | 1133 | { |
| 1134 | 1134 | // Pass if a document doesn't exist |
| 1135 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1135 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1136 | 1136 | // Get signature information |
| 1137 | 1137 | $oMemberModel = getModel('member'); |
| 1138 | 1138 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
| 1139 | 1139 | // Check if a maximum height of signiture is set in the member module |
| 1140 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1140 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1141 | 1141 | { |
| 1142 | 1142 | $oModuleModel = getModel('module'); |
| 1143 | 1143 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1144 | 1144 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
| 1145 | 1145 | } |
| 1146 | - if($signature) |
|
| 1146 | + if ($signature) |
|
| 1147 | 1147 | { |
| 1148 | 1148 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1149 | - if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1149 | + if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | return $signature; |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | */ |
| 1160 | 1160 | function replaceResourceRealPath($matches) |
| 1161 | 1161 | { |
| 1162 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1162 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | /** |
@@ -1170,19 +1170,19 @@ discard block |
||
| 1170 | 1170 | function _checkAccessibleFromStatus() |
| 1171 | 1171 | { |
| 1172 | 1172 | $logged_info = Context::get('logged_info'); |
| 1173 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1173 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 1174 | 1174 | |
| 1175 | 1175 | $status = $this->get('status'); |
| 1176 | - if(empty($status)) return false; |
|
| 1176 | + if (empty($status)) return false; |
|
| 1177 | 1177 | |
| 1178 | 1178 | $oDocumentModel = getModel('document'); |
| 1179 | 1179 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1180 | 1180 | |
| 1181 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1181 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1182 | 1182 | return true; |
| 1183 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1183 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1184 | 1184 | { |
| 1185 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1185 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
| 1186 | 1186 | return true; |
| 1187 | 1187 | } |
| 1188 | 1188 | return false; |