@@ -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 | |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function procCommentVoteUp() |
| 29 | 29 | { |
| 30 | - if(!Context::get('is_logged')) |
|
| 30 | + if (!Context::get('is_logged')) |
|
| 31 | 31 | { |
| 32 | 32 | return new BaseObject(-1, 'msg_invalid_request'); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $comment_srl = Context::get('target_srl'); |
| 36 | - if(!$comment_srl) |
|
| 36 | + if (!$comment_srl) |
|
| 37 | 37 | { |
| 38 | 38 | return new BaseObject(-1, 'msg_invalid_request'); |
| 39 | 39 | } |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | $oCommentModel = getModel('comment'); |
| 42 | 42 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 43 | 43 | $module_srl = $oComment->get('module_srl'); |
| 44 | - if(!$module_srl) |
|
| 44 | + if (!$module_srl) |
|
| 45 | 45 | { |
| 46 | 46 | return new BaseObject(-1, 'msg_invalid_request'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | 50 | $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); |
| 51 | - if($comment_config->use_vote_up == 'N') |
|
| 51 | + if ($comment_config->use_vote_up == 'N') |
|
| 52 | 52 | { |
| 53 | 53 | return new BaseObject(-1, 'msg_invalid_request'); |
| 54 | 54 | } |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function procCommentVoteDown() |
| 67 | 67 | { |
| 68 | - if(!Context::get('is_logged')) |
|
| 68 | + if (!Context::get('is_logged')) |
|
| 69 | 69 | { |
| 70 | 70 | return new BaseObject(-1, 'msg_invalid_request'); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $comment_srl = Context::get('target_srl'); |
| 74 | - if(!$comment_srl) |
|
| 74 | + if (!$comment_srl) |
|
| 75 | 75 | { |
| 76 | 76 | return new BaseObject(-1, 'msg_invalid_request'); |
| 77 | 77 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | $oCommentModel = getModel('comment'); |
| 80 | 80 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 81 | 81 | $module_srl = $oComment->get('module_srl'); |
| 82 | - if(!$module_srl) |
|
| 82 | + if (!$module_srl) |
|
| 83 | 83 | { |
| 84 | 84 | return new BaseObject(-1, 'msg_invalid_request'); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); |
| 89 | - if($comment_config->use_vote_down == 'N') |
|
| 89 | + if ($comment_config->use_vote_down == 'N') |
|
| 90 | 90 | { |
| 91 | 91 | return new BaseObject(-1, 'msg_invalid_request'); |
| 92 | 92 | } |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | function procCommentDeclare() |
| 105 | 105 | { |
| 106 | - if(!Context::get('is_logged')) |
|
| 106 | + if (!Context::get('is_logged')) |
|
| 107 | 107 | { |
| 108 | 108 | return new BaseObject(-1, 'msg_invalid_request'); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $comment_srl = Context::get('target_srl'); |
| 112 | - if(!$comment_srl) |
|
| 112 | + if (!$comment_srl) |
|
| 113 | 113 | { |
| 114 | 114 | return new BaseObject(-1, 'msg_invalid_request'); |
| 115 | 115 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | function triggerDeleteDocumentComments(&$obj) |
| 125 | 125 | { |
| 126 | 126 | $document_srl = $obj->document_srl; |
| 127 | - if(!$document_srl) |
|
| 127 | + if (!$document_srl) |
|
| 128 | 128 | { |
| 129 | 129 | return new BaseObject(); |
| 130 | 130 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | function triggerDeleteModuleComments(&$obj) |
| 140 | 140 | { |
| 141 | 141 | $module_srl = $obj->module_srl; |
| 142 | - if(!$module_srl) |
|
| 142 | + if (!$module_srl) |
|
| 143 | 143 | { |
| 144 | 144 | return new BaseObject(); |
| 145 | 145 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | function isModuleUsingPublishValidation($module_srl = NULL) |
| 168 | 168 | { |
| 169 | - if($module_srl == NULL) |
|
| 169 | + if ($module_srl == NULL) |
|
| 170 | 170 | { |
| 171 | 171 | return FALSE; |
| 172 | 172 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 176 | 176 | $module_part_config = $oModuleModel->getModulePartConfig('comment', $module_info->module_srl); |
| 177 | 177 | $use_validation = FALSE; |
| 178 | - if(isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation == "Y") |
|
| 178 | + if (isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation == "Y") |
|
| 179 | 179 | { |
| 180 | 180 | $use_validation = TRUE; |
| 181 | 181 | } |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | function insertComment($obj, $manual_inserted = FALSE) |
| 192 | 192 | { |
| 193 | - if(!$manual_inserted && !checkCSRF()) |
|
| 193 | + if (!$manual_inserted && !checkCSRF()) |
|
| 194 | 194 | { |
| 195 | 195 | return new BaseObject(-1, 'msg_invalid_request'); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if(!is_object($obj)) |
|
| 198 | + if (!is_object($obj)) |
|
| 199 | 199 | { |
| 200 | 200 | $obj = new stdClass(); |
| 201 | 201 | } |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | // check if comment's module is using comment validation and set the publish status to 0 (false) |
| 204 | 204 | // for inserting query, otherwise default is 1 (true - means comment is published) |
| 205 | 205 | $using_validation = $this->isModuleUsingPublishValidation($obj->module_srl); |
| 206 | - if(!$manual_inserted) |
|
| 206 | + if (!$manual_inserted) |
|
| 207 | 207 | { |
| 208 | - if(Context::get('is_logged')) |
|
| 208 | + if (Context::get('is_logged')) |
|
| 209 | 209 | { |
| 210 | 210 | $logged_info = Context::get('logged_info'); |
| 211 | - if($logged_info->is_admin == 'Y') |
|
| 211 | + if ($logged_info->is_admin == 'Y') |
|
| 212 | 212 | { |
| 213 | 213 | $is_admin = TRUE; |
| 214 | 214 | } |
@@ -223,13 +223,13 @@ discard block |
||
| 223 | 223 | $is_admin = FALSE; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if(!$using_validation) |
|
| 226 | + if (!$using_validation) |
|
| 227 | 227 | { |
| 228 | 228 | $obj->status = 1; |
| 229 | 229 | } |
| 230 | 230 | else |
| 231 | 231 | { |
| 232 | - if($is_admin) |
|
| 232 | + if ($is_admin) |
|
| 233 | 233 | { |
| 234 | 234 | $obj->status = 1; |
| 235 | 235 | } |
@@ -242,14 +242,14 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | // call a trigger (before) |
| 244 | 244 | $output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj); |
| 245 | - if(!$output->toBool()) |
|
| 245 | + if (!$output->toBool()) |
|
| 246 | 246 | { |
| 247 | 247 | return $output; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // check if a posting of the corresponding document_srl exists |
| 251 | 251 | $document_srl = $obj->document_srl; |
| 252 | - if(!$document_srl) |
|
| 252 | + if (!$document_srl) |
|
| 253 | 253 | { |
| 254 | 254 | return new BaseObject(-1, 'msg_invalid_document'); |
| 255 | 255 | } |
@@ -258,36 +258,36 @@ discard block |
||
| 258 | 258 | $oDocumentModel = getModel('document'); |
| 259 | 259 | |
| 260 | 260 | // even for manual_inserted if password exists, hash it. |
| 261 | - if($obj->password) |
|
| 261 | + if ($obj->password) |
|
| 262 | 262 | { |
| 263 | 263 | $obj->password = getModel('member')->hashPassword($obj->password); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // get the original posting |
| 267 | - if(!$manual_inserted) |
|
| 267 | + if (!$manual_inserted) |
|
| 268 | 268 | { |
| 269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 270 | 270 | |
| 271 | - if($document_srl != $oDocument->document_srl) |
|
| 271 | + if ($document_srl != $oDocument->document_srl) |
|
| 272 | 272 | { |
| 273 | 273 | return new BaseObject(-1, 'msg_invalid_document'); |
| 274 | 274 | } |
| 275 | - if($oDocument->isLocked()) |
|
| 275 | + if ($oDocument->isLocked()) |
|
| 276 | 276 | { |
| 277 | 277 | return new BaseObject(-1, 'msg_invalid_request'); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if($obj->homepage) |
|
| 280 | + if ($obj->homepage) |
|
| 281 | 281 | { |
| 282 | 282 | $obj->homepage = removeHackTag($obj->homepage); |
| 283 | - if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) |
|
| 283 | + if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage)) |
|
| 284 | 284 | { |
| 285 | 285 | $obj->homepage = 'http://'.$obj->homepage; |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // input the member's information if logged-in |
| 290 | - if(Context::get('is_logged')) |
|
| 290 | + if (Context::get('is_logged')) |
|
| 291 | 291 | { |
| 292 | 292 | $logged_info = Context::get('logged_info'); |
| 293 | 293 | $obj->member_srl = $logged_info->member_srl; |
@@ -302,16 +302,16 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // error display if neither of log-in info and user name exist. |
| 305 | - if(!$logged_info->member_srl && !$obj->nick_name) |
|
| 305 | + if (!$logged_info->member_srl && !$obj->nick_name) |
|
| 306 | 306 | { |
| 307 | 307 | return new BaseObject(-1, 'msg_invalid_request'); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if(!$obj->comment_srl) |
|
| 310 | + if (!$obj->comment_srl) |
|
| 311 | 311 | { |
| 312 | 312 | $obj->comment_srl = getNextSequence(); |
| 313 | 313 | } |
| 314 | - elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 314 | + elseif (!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 315 | 315 | { |
| 316 | 316 | return new BaseObject(-1, 'msg_not_permitted'); |
| 317 | 317 | } |
@@ -322,32 +322,32 @@ discard block |
||
| 322 | 322 | // remove XE's own tags from the contents |
| 323 | 323 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 324 | 324 | |
| 325 | - if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 325 | + if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 326 | 326 | { |
| 327 | - if($obj->use_html != 'Y') |
|
| 327 | + if ($obj->use_html != 'Y') |
|
| 328 | 328 | { |
| 329 | 329 | $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 330 | 330 | } |
| 331 | 331 | $obj->content = nl2br($obj->content); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if(!$obj->regdate) |
|
| 334 | + if (!$obj->regdate) |
|
| 335 | 335 | { |
| 336 | 336 | $obj->regdate = date("YmdHis"); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | // remove iframe and script if not a top administrator on the session. |
| 340 | - if($logged_info->is_admin != 'Y') |
|
| 340 | + if ($logged_info->is_admin != 'Y') |
|
| 341 | 341 | { |
| 342 | 342 | $obj->content = removeHackTag($obj->content); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if(!$obj->notify_message) |
|
| 345 | + if (!$obj->notify_message) |
|
| 346 | 346 | { |
| 347 | 347 | $obj->notify_message = 'N'; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if(!$obj->is_secret) |
|
| 350 | + if (!$obj->is_secret) |
|
| 351 | 351 | { |
| 352 | 352 | $obj->is_secret = 'N'; |
| 353 | 353 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $list_args->regdate = $obj->regdate; |
| 365 | 365 | |
| 366 | 366 | // If parent comment doesn't exist, set data directly |
| 367 | - if(!$obj->parent_srl) |
|
| 367 | + if (!$obj->parent_srl) |
|
| 368 | 368 | { |
| 369 | 369 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
| 370 | 370 | $list_args->depth = 0; |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
| 379 | 379 | |
| 380 | 380 | // return if no parent comment exists |
| 381 | - if(!$parent_output->toBool() || !$parent_output->data) |
|
| 381 | + if (!$parent_output->toBool() || !$parent_output->data) |
|
| 382 | 382 | { |
| 383 | 383 | return; |
| 384 | 384 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $list_args->depth = $parent->depth + 1; |
| 390 | 390 | |
| 391 | 391 | // if the depth of comments is less than 2, execute insert. |
| 392 | - if($list_args->depth < 2) |
|
| 392 | + if ($list_args->depth < 2) |
|
| 393 | 393 | { |
| 394 | 394 | $list_args->arrange = $obj->comment_srl; |
| 395 | 395 | // if the depth of comments is greater than 2, execute update. |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $p_args->depth = $parent->depth; |
| 404 | 404 | $output = executeQuery('comment.getCommentParentNextSibling', $p_args); |
| 405 | 405 | |
| 406 | - if($output->data->arrange) |
|
| 406 | + if ($output->data->arrange) |
|
| 407 | 407 | { |
| 408 | 408 | $list_args->arrange = $output->data->arrange; |
| 409 | 409 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
@@ -416,14 +416,14 @@ discard block |
||
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | $output = executeQuery('comment.insertCommentList', $list_args); |
| 419 | - if(!$output->toBool()) |
|
| 419 | + if (!$output->toBool()) |
|
| 420 | 420 | { |
| 421 | 421 | return $output; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | // insert comment |
| 425 | 425 | $output = executeQuery('comment.insertComment', $obj); |
| 426 | - if(!$output->toBool()) |
|
| 426 | + if (!$output->toBool()) |
|
| 427 | 427 | { |
| 428 | 428 | $oDB->rollback(); |
| 429 | 429 | return $output; |
@@ -439,29 +439,29 @@ discard block |
||
| 439 | 439 | $oDocumentController = getController('document'); |
| 440 | 440 | |
| 441 | 441 | // Update the number of comments in the post |
| 442 | - if(!$using_validation) |
|
| 442 | + if (!$using_validation) |
|
| 443 | 443 | { |
| 444 | 444 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE); |
| 445 | 445 | } |
| 446 | 446 | else |
| 447 | 447 | { |
| 448 | - if($is_admin) |
|
| 448 | + if ($is_admin) |
|
| 449 | 449 | { |
| 450 | 450 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE); |
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // grant autority of the comment |
| 455 | - if(!$manual_inserted) |
|
| 455 | + if (!$manual_inserted) |
|
| 456 | 456 | { |
| 457 | 457 | $this->addGrant($obj->comment_srl); |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | // call a trigger(after) |
| 461 | - if($output->toBool()) |
|
| 461 | + if ($output->toBool()) |
|
| 462 | 462 | { |
| 463 | 463 | $trigger_output = ModuleHandler::triggerCall('comment.insertComment', 'after', $obj); |
| 464 | - if(!$trigger_output->toBool()) |
|
| 464 | + if (!$trigger_output->toBool()) |
|
| 465 | 465 | { |
| 466 | 466 | $oDB->rollback(); |
| 467 | 467 | return $trigger_output; |
@@ -471,16 +471,16 @@ discard block |
||
| 471 | 471 | // commit |
| 472 | 472 | $oDB->commit(); |
| 473 | 473 | |
| 474 | - if(!$manual_inserted) |
|
| 474 | + if (!$manual_inserted) |
|
| 475 | 475 | { |
| 476 | 476 | // send a message if notify_message option in enabled in the original article |
| 477 | 477 | $oDocument->notify(Context::getLang('comment'), $obj->content); |
| 478 | 478 | |
| 479 | 479 | // send a message if notify_message option in enabled in the original comment |
| 480 | - if($obj->parent_srl) |
|
| 480 | + if ($obj->parent_srl) |
|
| 481 | 481 | { |
| 482 | 482 | $oParent = $oCommentModel->getComment($obj->parent_srl); |
| 483 | - if($oParent->get('member_srl') != $oDocument->get('member_srl')) |
|
| 483 | + if ($oParent->get('member_srl') != $oDocument->get('member_srl')) |
|
| 484 | 484 | { |
| 485 | 485 | $oParent->notify(Context::getLang('comment'), $obj->content); |
| 486 | 486 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
| 509 | 509 | |
| 510 | 510 | $oMemberModel = getModel("member"); |
| 511 | - if(isset($obj->member_srl) && !is_null($obj->member_srl)) |
|
| 511 | + if (isset($obj->member_srl) && !is_null($obj->member_srl)) |
|
| 512 | 512 | { |
| 513 | 513 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->member_srl); |
| 514 | 514 | } |
@@ -528,47 +528,47 @@ discard block |
||
| 528 | 528 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($obj->document_srl); |
| 529 | 529 | |
| 530 | 530 | // If there is no problem to register comment then send an email to all admin were set in module admin panel |
| 531 | - if($module_info->admin_mail && $member_info->is_admin != 'Y') |
|
| 531 | + if ($module_info->admin_mail && $member_info->is_admin != 'Y') |
|
| 532 | 532 | { |
| 533 | 533 | $oMail = new Mail(); |
| 534 | 534 | $oMail->setSender($obj->email_address, $obj->email_address); |
| 535 | - $mail_title = "[XE - " . Context::get('mid') . "] A new comment was posted on document: \"" . $oDocument->getTitleText() . "\""; |
|
| 535 | + $mail_title = "[XE - ".Context::get('mid')."] A new comment was posted on document: \"".$oDocument->getTitleText()."\""; |
|
| 536 | 536 | $oMail->setTitle($mail_title); |
| 537 | - $url_comment = getFullUrl('','document_srl',$obj->document_srl).'#comment_'.$obj->comment_srl; |
|
| 538 | - if($using_validation) |
|
| 537 | + $url_comment = getFullUrl('', 'document_srl', $obj->document_srl).'#comment_'.$obj->comment_srl; |
|
| 538 | + if ($using_validation) |
|
| 539 | 539 | { |
| 540 | 540 | $url_approve = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminChangePublishedStatusChecked', 'cart[]', $obj->comment_srl, 'will_publish', '1', 'search_target', 'is_published', 'search_keyword', 'N'); |
| 541 | 541 | $url_trash = getFullUrl('', 'module', 'admin', 'act', 'procCommentAdminDeleteChecked', 'cart[]', $obj->comment_srl, 'search_target', 'is_trash', 'search_keyword', 'true'); |
| 542 | 542 | $mail_content = " |
| 543 | - A new comment on the document \"" . $oDocument->getTitleText() . "\" is waiting for your approval. |
|
| 543 | + A new comment on the document \"" . $oDocument->getTitleText()."\" is waiting for your approval. |
|
| 544 | 544 | <br /> |
| 545 | 545 | <br /> |
| 546 | - Author: " . $member_info->nick_name . " |
|
| 547 | - <br />Author e-mail: " . $member_info->email_address . " |
|
| 548 | - <br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a> |
|
| 546 | + Author: " . $member_info->nick_name." |
|
| 547 | + <br />Author e-mail: " . $member_info->email_address." |
|
| 548 | + <br />From : <a href=\"" . $url_comment."\">".$url_comment."</a> |
|
| 549 | 549 | <br />Comment: |
| 550 | - <br />\"" . $obj->content . "\" |
|
| 550 | + <br />\"" . $obj->content."\" |
|
| 551 | 551 | <br />Document: |
| 552 | - <br />\"" . $oDocument->getContentText(). "\" |
|
| 552 | + <br />\"" . $oDocument->getContentText()."\" |
|
| 553 | 553 | <br /> |
| 554 | 554 | <br /> |
| 555 | - Approve it: <a href=\"" . $url_approve . "\">" . $url_approve . "</a> |
|
| 556 | - <br />Trash it: <a href=\"" . $url_trash . "\">" . $url_trash . "</a> |
|
| 557 | - <br />Currently " . $nr_comments_not_approved . " comments on \"" . Context::get('mid') . "\" module are waiting for approval. Please visit the moderation panel: |
|
| 558 | - <br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "\">" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "</a> |
|
| 555 | + Approve it: <a href=\"" . $url_approve."\">".$url_approve."</a> |
|
| 556 | + <br />Trash it: <a href=\"" . $url_trash."\">".$url_trash."</a> |
|
| 557 | + <br />Currently " . $nr_comments_not_approved." comments on \"".Context::get('mid')."\" module are waiting for approval. Please visit the moderation panel: |
|
| 558 | + <br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl)."\">".getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl)."</a> |
|
| 559 | 559 | "; |
| 560 | 560 | $oMail->setContent($mail_content); |
| 561 | 561 | } |
| 562 | 562 | else |
| 563 | 563 | { |
| 564 | 564 | $mail_content = " |
| 565 | - Author: " . $member_info->nick_name . " |
|
| 566 | - <br />Author e-mail: " . $member_info->email_address . " |
|
| 567 | - <br />From : <a href=\"" . $url_comment . "\">" . $url_comment . "</a> |
|
| 565 | + Author: " . $member_info->nick_name." |
|
| 566 | + <br />Author e-mail: " . $member_info->email_address." |
|
| 567 | + <br />From : <a href=\"" . $url_comment."\">".$url_comment."</a> |
|
| 568 | 568 | <br />Comment: |
| 569 | - <br />\"" . $obj->content . "\" |
|
| 569 | + <br />\"" . $obj->content."\" |
|
| 570 | 570 | <br />Document: |
| 571 | - <br />\"" . $oDocument->getContentText(). "\" |
|
| 571 | + <br />\"" . $oDocument->getContentText()."\" |
|
| 572 | 572 | "; |
| 573 | 573 | $oMail->setContent($mail_content); |
| 574 | 574 | |
@@ -597,10 +597,10 @@ discard block |
||
| 597 | 597 | $target_mail = explode(',', $admins_emails); |
| 598 | 598 | |
| 599 | 599 | // send email to all admins - START |
| 600 | - for($i = 0; $i < count($target_mail); $i++) |
|
| 600 | + for ($i = 0; $i < count($target_mail); $i++) |
|
| 601 | 601 | { |
| 602 | 602 | $email_address = trim($target_mail[$i]); |
| 603 | - if(!$email_address) |
|
| 603 | + if (!$email_address) |
|
| 604 | 604 | { |
| 605 | 605 | continue; |
| 606 | 606 | } |
@@ -646,12 +646,12 @@ discard block |
||
| 646 | 646 | */ |
| 647 | 647 | function updateComment($obj, $is_admin = FALSE, $manual_updated = FALSE) |
| 648 | 648 | { |
| 649 | - if(!$manual_updated && !checkCSRF()) |
|
| 649 | + if (!$manual_updated && !checkCSRF()) |
|
| 650 | 650 | { |
| 651 | 651 | return new BaseObject(-1, 'msg_invalid_request'); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - if(!is_object($obj)) |
|
| 654 | + if (!is_object($obj)) |
|
| 655 | 655 | { |
| 656 | 656 | $obj = new stdClass(); |
| 657 | 657 | } |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | |
| 661 | 661 | // call a trigger (before) |
| 662 | 662 | $output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj); |
| 663 | - if(!$output->toBool()) |
|
| 663 | + if (!$output->toBool()) |
|
| 664 | 664 | { |
| 665 | 665 | return $output; |
| 666 | 666 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | // get the original data |
| 672 | 672 | $source_obj = $oCommentModel->getComment($obj->comment_srl); |
| 673 | - if(!$source_obj->getMemberSrl()) |
|
| 673 | + if (!$source_obj->getMemberSrl()) |
|
| 674 | 674 | { |
| 675 | 675 | $obj->member_srl = $source_obj->get('member_srl'); |
| 676 | 676 | $obj->user_name = $source_obj->get('user_name'); |
@@ -680,30 +680,30 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | // check if permission is granted |
| 683 | - if(!$is_admin && !$source_obj->isGranted()) |
|
| 683 | + if (!$is_admin && !$source_obj->isGranted()) |
|
| 684 | 684 | { |
| 685 | 685 | return new BaseObject(-1, 'msg_not_permitted'); |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if($obj->password) |
|
| 688 | + if ($obj->password) |
|
| 689 | 689 | { |
| 690 | 690 | $obj->password = getModel('member')->hashPassword($obj->password); |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - if($obj->homepage) |
|
| 693 | + if ($obj->homepage) |
|
| 694 | 694 | { |
| 695 | 695 | $obj->homepage = removeHackTag($obj->homepage); |
| 696 | - if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) |
|
| 696 | + if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage)) |
|
| 697 | 697 | { |
| 698 | 698 | $obj->homepage = 'http://'.$obj->homepage; |
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | // set modifier's information if logged-in and posting author and modifier are matched. |
| 703 | - if(Context::get('is_logged')) |
|
| 703 | + if (Context::get('is_logged')) |
|
| 704 | 704 | { |
| 705 | 705 | $logged_info = Context::get('logged_info'); |
| 706 | - if($source_obj->member_srl == $logged_info->member_srl) |
|
| 706 | + if ($source_obj->member_srl == $logged_info->member_srl) |
|
| 707 | 707 | { |
| 708 | 708 | $obj->member_srl = $logged_info->member_srl; |
| 709 | 709 | $obj->user_name = $logged_info->user_name; |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | // if nick_name of the logged-in author doesn't exist |
| 717 | - if($source_obj->get('member_srl') && !$obj->nick_name) |
|
| 717 | + if ($source_obj->get('member_srl') && !$obj->nick_name) |
|
| 718 | 718 | { |
| 719 | 719 | $obj->member_srl = $source_obj->get('member_srl'); |
| 720 | 720 | $obj->user_name = $source_obj->get('user_name'); |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | $obj->homepage = $source_obj->get('homepage'); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - if(!$obj->content) |
|
| 726 | + if (!$obj->content) |
|
| 727 | 727 | { |
| 728 | 728 | $obj->content = $source_obj->get('content'); |
| 729 | 729 | } |
@@ -731,9 +731,9 @@ discard block |
||
| 731 | 731 | // remove XE's wn tags from contents |
| 732 | 732 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 733 | 733 | |
| 734 | - if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 734 | + if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 735 | 735 | { |
| 736 | - if($obj->use_html != 'Y') |
|
| 736 | + if ($obj->use_html != 'Y') |
|
| 737 | 737 | { |
| 738 | 738 | $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 739 | 739 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | // remove iframe and script if not a top administrator on the session |
| 744 | - if($logged_info->is_admin != 'Y') |
|
| 744 | + if ($logged_info->is_admin != 'Y') |
|
| 745 | 745 | { |
| 746 | 746 | $obj->content = removeHackTag($obj->content); |
| 747 | 747 | } |
@@ -752,17 +752,17 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | // Update |
| 754 | 754 | $output = executeQuery('comment.updateComment', $obj); |
| 755 | - if(!$output->toBool()) |
|
| 755 | + if (!$output->toBool()) |
|
| 756 | 756 | { |
| 757 | 757 | $oDB->rollback(); |
| 758 | 758 | return $output; |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | // call a trigger (after) |
| 762 | - if($output->toBool()) |
|
| 762 | + if ($output->toBool()) |
|
| 763 | 763 | { |
| 764 | 764 | $trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj); |
| 765 | - if(!$trigger_output->toBool()) |
|
| 765 | + if (!$trigger_output->toBool()) |
|
| 766 | 766 | { |
| 767 | 767 | $oDB->rollback(); |
| 768 | 768 | return $trigger_output; |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | // check if comment already exists |
| 793 | 793 | $comment = $oCommentModel->getComment($comment_srl); |
| 794 | - if($comment->comment_srl != $comment_srl) |
|
| 794 | + if ($comment->comment_srl != $comment_srl) |
|
| 795 | 795 | { |
| 796 | 796 | return new BaseObject(-1, 'msg_invalid_request'); |
| 797 | 797 | } |
@@ -800,28 +800,28 @@ discard block |
||
| 800 | 800 | |
| 801 | 801 | // call a trigger (before) |
| 802 | 802 | $output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment); |
| 803 | - if(!$output->toBool()) |
|
| 803 | + if (!$output->toBool()) |
|
| 804 | 804 | { |
| 805 | 805 | return $output; |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | // check if permission is granted |
| 809 | - if(!$is_admin && !$comment->isGranted()) |
|
| 809 | + if (!$is_admin && !$comment->isGranted()) |
|
| 810 | 810 | { |
| 811 | 811 | return new BaseObject(-1, 'msg_not_permitted'); |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | // check if child comment exists on the comment |
| 815 | 815 | $childs = $oCommentModel->getChildComments($comment_srl); |
| 816 | - if(count($childs) > 0) |
|
| 816 | + if (count($childs) > 0) |
|
| 817 | 817 | { |
| 818 | 818 | $deleteAllComment = TRUE; |
| 819 | - if(!$is_admin) |
|
| 819 | + if (!$is_admin) |
|
| 820 | 820 | { |
| 821 | 821 | $logged_info = Context::get('logged_info'); |
| 822 | - foreach($childs as $val) |
|
| 822 | + foreach ($childs as $val) |
|
| 823 | 823 | { |
| 824 | - if($val->member_srl != $logged_info->member_srl) |
|
| 824 | + if ($val->member_srl != $logged_info->member_srl) |
|
| 825 | 825 | { |
| 826 | 826 | $deleteAllComment = FALSE; |
| 827 | 827 | break; |
@@ -829,16 +829,16 @@ discard block |
||
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - if(!$deleteAllComment) |
|
| 832 | + if (!$deleteAllComment) |
|
| 833 | 833 | { |
| 834 | 834 | return new BaseObject(-1, 'fail_to_delete_have_children'); |
| 835 | 835 | } |
| 836 | 836 | else |
| 837 | 837 | { |
| 838 | - foreach($childs as $val) |
|
| 838 | + foreach ($childs as $val) |
|
| 839 | 839 | { |
| 840 | 840 | $output = $this->deleteComment($val->comment_srl, $is_admin, $isMoveToTrash); |
| 841 | - if(!$output->toBool()) |
|
| 841 | + if (!$output->toBool()) |
|
| 842 | 842 | { |
| 843 | 843 | return $output; |
| 844 | 844 | } |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | $args = new stdClass(); |
| 855 | 855 | $args->comment_srl = $comment_srl; |
| 856 | 856 | $output = executeQuery('comment.deleteComment', $args); |
| 857 | - if(!$output->toBool()) |
|
| 857 | + if (!$output->toBool()) |
|
| 858 | 858 | { |
| 859 | 859 | $oDB->rollback(); |
| 860 | 860 | return $output; |
@@ -866,14 +866,14 @@ discard block |
||
| 866 | 866 | $comment_count = $oCommentModel->getCommentCount($document_srl); |
| 867 | 867 | |
| 868 | 868 | // only document is exists |
| 869 | - if(isset($comment_count)) |
|
| 869 | + if (isset($comment_count)) |
|
| 870 | 870 | { |
| 871 | 871 | // create the controller object of the document |
| 872 | 872 | $oDocumentController = getController('document'); |
| 873 | 873 | |
| 874 | 874 | // update comment count of the article posting |
| 875 | 875 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, NULL, FALSE); |
| 876 | - if(!$output->toBool()) |
|
| 876 | + if (!$output->toBool()) |
|
| 877 | 877 | { |
| 878 | 878 | $oDB->rollback(); |
| 879 | 879 | return $output; |
@@ -881,11 +881,11 @@ discard block |
||
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | // call a trigger (after) |
| 884 | - if($output->toBool()) |
|
| 884 | + if ($output->toBool()) |
|
| 885 | 885 | { |
| 886 | 886 | $comment->isMoveToTrash = $isMoveToTrash; |
| 887 | 887 | $trigger_output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment); |
| 888 | - if(!$trigger_output->toBool()) |
|
| 888 | + if (!$trigger_output->toBool()) |
|
| 889 | 889 | { |
| 890 | 890 | $oDB->rollback(); |
| 891 | 891 | return $trigger_output; |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | unset($comment->isMoveToTrash); |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | - if(!$isMoveToTrash) |
|
| 896 | + if (!$isMoveToTrash) |
|
| 897 | 897 | { |
| 898 | 898 | $this->_deleteDeclaredComments($args); |
| 899 | 899 | $this->_deleteVotedComments($args); |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | $oCommentModel = getModel('comment'); |
| 938 | 938 | |
| 939 | 939 | // check if permission is granted |
| 940 | - if(is_object($obj)) |
|
| 940 | + if (is_object($obj)) |
|
| 941 | 941 | { |
| 942 | 942 | $oDocument = new documentItem(); |
| 943 | 943 | $oDocument->setAttribute($obj); |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | - if(!$oDocument->isExists() || !$oDocument->isGranted()) |
|
| 950 | + if (!$oDocument->isExists() || !$oDocument->isGranted()) |
|
| 951 | 951 | { |
| 952 | 952 | return new BaseObject(-1, 'msg_not_permitted'); |
| 953 | 953 | } |
@@ -956,23 +956,23 @@ discard block |
||
| 956 | 956 | $args = new stdClass(); |
| 957 | 957 | $args->document_srl = $document_srl; |
| 958 | 958 | $comments = executeQueryArray('comment.getAllComments', $args); |
| 959 | - if($comments->data) |
|
| 959 | + if ($comments->data) |
|
| 960 | 960 | { |
| 961 | 961 | $commentSrlList = array(); |
| 962 | - foreach($comments->data as $comment) |
|
| 962 | + foreach ($comments->data as $comment) |
|
| 963 | 963 | { |
| 964 | 964 | $commentSrlList[] = $comment->comment_srl; |
| 965 | 965 | |
| 966 | 966 | // call a trigger (before) |
| 967 | 967 | $output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment); |
| 968 | - if(!$output->toBool()) |
|
| 968 | + if (!$output->toBool()) |
|
| 969 | 969 | { |
| 970 | 970 | continue; |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | // call a trigger (after) |
| 974 | 974 | $output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment); |
| 975 | - if(!$output->toBool()) |
|
| 975 | + if (!$output->toBool()) |
|
| 976 | 976 | { |
| 977 | 977 | continue; |
| 978 | 978 | } |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | // delete the comment |
| 983 | 983 | $args->document_srl = $document_srl; |
| 984 | 984 | $output = executeQuery('comment.deleteComments', $args); |
| 985 | - if(!$output->toBool()) |
|
| 985 | + if (!$output->toBool()) |
|
| 986 | 986 | { |
| 987 | 987 | return $output; |
| 988 | 988 | } |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | $output = executeQuery('comment.deleteCommentsList', $args); |
| 992 | 992 | |
| 993 | 993 | //delete declared, declared_log, voted_log |
| 994 | - if(is_array($commentSrlList) && count($commentSrlList) > 0) |
|
| 994 | + if (is_array($commentSrlList) && count($commentSrlList) > 0) |
|
| 995 | 995 | { |
| 996 | 996 | $args = new stdClass(); |
| 997 | 997 | $args->comment_srl = join(',', $commentSrlList); |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | */ |
| 1032 | 1032 | function updateVotedCount($comment_srl, $point = 1) |
| 1033 | 1033 | { |
| 1034 | - if($point > 0) |
|
| 1034 | + if ($point > 0) |
|
| 1035 | 1035 | { |
| 1036 | 1036 | $failed_voted = 'failed_voted'; |
| 1037 | 1037 | $success_message = 'success_voted'; |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | // invalid vote if vote info exists in the session info. |
| 1046 | - if($_SESSION['voted_comment'][$comment_srl]) |
|
| 1046 | + if ($_SESSION['voted_comment'][$comment_srl]) |
|
| 1047 | 1047 | { |
| 1048 | 1048 | return new BaseObject(-1, $failed_voted); |
| 1049 | 1049 | } |
@@ -1052,21 +1052,21 @@ discard block |
||
| 1052 | 1052 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 1053 | 1053 | |
| 1054 | 1054 | // invalid vote if both ip addresses between author's and the current user are same. |
| 1055 | - if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1055 | + if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1056 | 1056 | { |
| 1057 | 1057 | $_SESSION['voted_comment'][$comment_srl] = TRUE; |
| 1058 | 1058 | return new BaseObject(-1, $failed_voted); |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | // if the comment author is a member |
| 1062 | - if($oComment->get('member_srl')) |
|
| 1062 | + if ($oComment->get('member_srl')) |
|
| 1063 | 1063 | { |
| 1064 | 1064 | // create the member model object |
| 1065 | 1065 | $oMemberModel = getModel('member'); |
| 1066 | 1066 | $member_srl = $oMemberModel->getLoggedMemberSrl(); |
| 1067 | 1067 | |
| 1068 | 1068 | // session registered if the author information matches to the current logged-in user's. |
| 1069 | - if($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1069 | + if ($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1070 | 1070 | { |
| 1071 | 1071 | $_SESSION['voted_comment'][$comment_srl] = TRUE; |
| 1072 | 1072 | return new BaseObject(-1, $failed_voted); |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | $args = new stdClass(); |
| 1077 | 1077 | |
| 1078 | 1078 | // If logged-in, use the member_srl. otherwise use the ipaddress. |
| 1079 | - if($member_srl) |
|
| 1079 | + if ($member_srl) |
|
| 1080 | 1080 | { |
| 1081 | 1081 | $args->member_srl = $member_srl; |
| 1082 | 1082 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $output = executeQuery('comment.getCommentVotedLogInfo', $args); |
| 1090 | 1090 | |
| 1091 | 1091 | // session registered if log info contains recommendation vote log. |
| 1092 | - if($output->data->count) |
|
| 1092 | + if ($output->data->count) |
|
| 1093 | 1093 | { |
| 1094 | 1094 | $_SESSION['voted_comment'][$comment_srl] = TRUE; |
| 1095 | 1095 | return new BaseObject(-1, $failed_voted); |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | $trigger_obj->before_point = ($point < 0) ? $oComment->get('blamed_count') : $oComment->get('voted_count'); |
| 1107 | 1107 | $trigger_obj->after_point = $trigger_obj->before_point + $point; |
| 1108 | 1108 | $trigger_output = ModuleHandler::triggerCall('comment.updateVotedCount', 'before', $trigger_obj); |
| 1109 | - if(!$trigger_output->toBool()) |
|
| 1109 | + if (!$trigger_output->toBool()) |
|
| 1110 | 1110 | { |
| 1111 | 1111 | return $trigger_output; |
| 1112 | 1112 | } |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | $oDB->begin(); |
| 1117 | 1117 | |
| 1118 | 1118 | // update the number of votes |
| 1119 | - if($trigger_obj->update_target === 'blamed_count') |
|
| 1119 | + if ($trigger_obj->update_target === 'blamed_count') |
|
| 1120 | 1120 | { |
| 1121 | 1121 | $args->blamed_count = $trigger_obj->after_point; |
| 1122 | 1122 | $output = executeQuery('comment.updateBlamedCount', $args); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | |
| 1134 | 1134 | // Call a trigger (after) |
| 1135 | 1135 | $trigger_output = ModuleHandler::triggerCall('comment.updateVotedCount', 'after', $trigger_obj); |
| 1136 | - if(!$trigger_output->toBool()) |
|
| 1136 | + if (!$trigger_output->toBool()) |
|
| 1137 | 1137 | { |
| 1138 | 1138 | $oDB->rollback(); |
| 1139 | 1139 | return $trigger_output; |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | |
| 1147 | 1147 | // Return the result |
| 1148 | 1148 | $output = new BaseObject(0, $success_message); |
| 1149 | - if($trigger_obj->update_target === 'voted_count') |
|
| 1149 | + if ($trigger_obj->update_target === 'voted_count') |
|
| 1150 | 1150 | { |
| 1151 | 1151 | $output->add('voted_count', $trigger_obj->after_point); |
| 1152 | 1152 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | function declaredComment($comment_srl) |
| 1167 | 1167 | { |
| 1168 | 1168 | // Fail if session information already has a reported document |
| 1169 | - if($_SESSION['declared_comment'][$comment_srl]) |
|
| 1169 | + if ($_SESSION['declared_comment'][$comment_srl]) |
|
| 1170 | 1170 | { |
| 1171 | 1171 | return new BaseObject(-1, 'failed_declared'); |
| 1172 | 1172 | } |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | $args = new stdClass(); |
| 1176 | 1176 | $args->comment_srl = $comment_srl; |
| 1177 | 1177 | $output = executeQuery('comment.getDeclaredComment', $args); |
| 1178 | - if(!$output->toBool()) |
|
| 1178 | + if (!$output->toBool()) |
|
| 1179 | 1179 | { |
| 1180 | 1180 | return $output; |
| 1181 | 1181 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | |
| 1188 | 1188 | // Call a trigger (before) |
| 1189 | 1189 | $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'before', $trigger_obj); |
| 1190 | - if(!$trigger_output->toBool()) |
|
| 1190 | + if (!$trigger_output->toBool()) |
|
| 1191 | 1191 | { |
| 1192 | 1192 | return $trigger_output; |
| 1193 | 1193 | } |
@@ -1197,21 +1197,21 @@ discard block |
||
| 1197 | 1197 | $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); |
| 1198 | 1198 | |
| 1199 | 1199 | // failed if both ip addresses between author's and the current user are same. |
| 1200 | - if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1200 | + if ($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1201 | 1201 | { |
| 1202 | 1202 | $_SESSION['declared_comment'][$comment_srl] = TRUE; |
| 1203 | 1203 | return new BaseObject(-1, 'failed_declared'); |
| 1204 | 1204 | } |
| 1205 | 1205 | |
| 1206 | 1206 | // if the comment author is a member |
| 1207 | - if($oComment->get('member_srl')) |
|
| 1207 | + if ($oComment->get('member_srl')) |
|
| 1208 | 1208 | { |
| 1209 | 1209 | // create the member model object |
| 1210 | 1210 | $oMemberModel = getModel('member'); |
| 1211 | 1211 | $member_srl = $oMemberModel->getLoggedMemberSrl(); |
| 1212 | 1212 | |
| 1213 | 1213 | // session registered if the author information matches to the current logged-in user's. |
| 1214 | - if($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1214 | + if ($member_srl && $member_srl == abs($oComment->get('member_srl'))) |
|
| 1215 | 1215 | { |
| 1216 | 1216 | $_SESSION['declared_comment'][$comment_srl] = TRUE; |
| 1217 | 1217 | return new BaseObject(-1, 'failed_declared'); |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | 1221 | // If logged-in, use the member_srl. otherwise use the ipaddress. |
| 1222 | - if($member_srl) |
|
| 1222 | + if ($member_srl) |
|
| 1223 | 1223 | { |
| 1224 | 1224 | $args->member_srl = $member_srl; |
| 1225 | 1225 | } |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | $log_output = executeQuery('comment.getCommentDeclaredLogInfo', $args); |
| 1232 | 1232 | |
| 1233 | 1233 | // session registered if log info contains report log. |
| 1234 | - if($log_output->data->count) |
|
| 1234 | + if ($log_output->data->count) |
|
| 1235 | 1235 | { |
| 1236 | 1236 | $_SESSION['declared_comment'][$comment_srl] = TRUE; |
| 1237 | 1237 | return new BaseObject(-1, 'failed_declared'); |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | $oDB->begin(); |
| 1243 | 1243 | |
| 1244 | 1244 | // execute insert |
| 1245 | - if($output->data->declared_count > 0) |
|
| 1245 | + if ($output->data->declared_count > 0) |
|
| 1246 | 1246 | { |
| 1247 | 1247 | $output = executeQuery('comment.updateDeclaredComment', $args); |
| 1248 | 1248 | } |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | $output = executeQuery('comment.insertDeclaredComment', $args); |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | - if(!$output->toBool()) |
|
| 1254 | + if (!$output->toBool()) |
|
| 1255 | 1255 | { |
| 1256 | 1256 | $oDB->rollback(); |
| 1257 | 1257 | return $output; |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | // Call a trigger (after) |
| 1264 | 1264 | $trigger_obj->declared_count = $declared_count + 1; |
| 1265 | 1265 | $trigger_output = ModuleHandler::triggerCall('comment.declaredComment', 'after', $trigger_obj); |
| 1266 | - if(!$trigger_output->toBool()) |
|
| 1266 | + if (!$trigger_output->toBool()) |
|
| 1267 | 1267 | { |
| 1268 | 1268 | $oDB->rollback(); |
| 1269 | 1269 | return $trigger_output; |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | function addCommentPopupMenu($url, $str, $icon = '', $target = 'self') |
| 1289 | 1289 | { |
| 1290 | 1290 | $comment_popup_menu_list = Context::get('comment_popup_menu_list'); |
| 1291 | - if(!is_array($comment_popup_menu_list)) |
|
| 1291 | + if (!is_array($comment_popup_menu_list)) |
|
| 1292 | 1292 | { |
| 1293 | 1293 | $comment_popup_menu_list = array(); |
| 1294 | 1294 | } |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | function procCommentInsertModuleConfig() |
| 1311 | 1311 | { |
| 1312 | 1312 | $module_srl = Context::get('target_module_srl'); |
| 1313 | - if(preg_match('/^([0-9,]+)$/', $module_srl)) |
|
| 1313 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) |
|
| 1314 | 1314 | { |
| 1315 | 1315 | $module_srl = explode(',', $module_srl); |
| 1316 | 1316 | } |
@@ -1321,33 +1321,33 @@ discard block |
||
| 1321 | 1321 | |
| 1322 | 1322 | $comment_config = new stdClass(); |
| 1323 | 1323 | $comment_config->comment_count = (int) Context::get('comment_count'); |
| 1324 | - if(!$comment_config->comment_count) |
|
| 1324 | + if (!$comment_config->comment_count) |
|
| 1325 | 1325 | { |
| 1326 | 1326 | $comment_config->comment_count = 50; |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | $comment_config->use_vote_up = Context::get('use_vote_up'); |
| 1330 | - if(!$comment_config->use_vote_up) |
|
| 1330 | + if (!$comment_config->use_vote_up) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | $comment_config->use_vote_up = 'Y'; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | $comment_config->use_vote_down = Context::get('use_vote_down'); |
| 1336 | - if(!$comment_config->use_vote_down) |
|
| 1336 | + if (!$comment_config->use_vote_down) |
|
| 1337 | 1337 | { |
| 1338 | 1338 | $comment_config->use_vote_down = 'Y'; |
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 1341 | 1341 | $comment_config->use_comment_validation = Context::get('use_comment_validation'); |
| 1342 | - if(!$comment_config->use_comment_validation) |
|
| 1342 | + if (!$comment_config->use_comment_validation) |
|
| 1343 | 1343 | { |
| 1344 | 1344 | $comment_config->use_comment_validation = 'N'; |
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | - for($i = 0; $i < count($module_srl); $i++) |
|
| 1347 | + for ($i = 0; $i < count($module_srl); $i++) |
|
| 1348 | 1348 | { |
| 1349 | 1349 | $srl = trim($module_srl[$i]); |
| 1350 | - if(!$srl) |
|
| 1350 | + if (!$srl) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | continue; |
| 1353 | 1353 | } |
@@ -1381,25 +1381,25 @@ discard block |
||
| 1381 | 1381 | */ |
| 1382 | 1382 | function procCommentGetList() |
| 1383 | 1383 | { |
| 1384 | - if(!Context::get('is_logged')) |
|
| 1384 | + if (!Context::get('is_logged')) |
|
| 1385 | 1385 | { |
| 1386 | 1386 | return new BaseObject(-1, 'msg_not_permitted'); |
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | 1389 | $commentSrls = Context::get('comment_srls'); |
| 1390 | - if($commentSrls) |
|
| 1390 | + if ($commentSrls) |
|
| 1391 | 1391 | { |
| 1392 | 1392 | $commentSrlList = explode(',', $commentSrls); |
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | - if(count($commentSrlList) > 0) |
|
| 1395 | + if (count($commentSrlList) > 0) |
|
| 1396 | 1396 | { |
| 1397 | 1397 | $oCommentModel = getModel('comment'); |
| 1398 | 1398 | $commentList = $oCommentModel->getComments($commentSrlList); |
| 1399 | 1399 | |
| 1400 | - if(is_array($commentList)) |
|
| 1400 | + if (is_array($commentList)) |
|
| 1401 | 1401 | { |
| 1402 | - foreach($commentList as $value) |
|
| 1402 | + foreach ($commentList as $value) |
|
| 1403 | 1403 | { |
| 1404 | 1404 | $value->content = strip_tags($value->content); |
| 1405 | 1405 | } |
@@ -1424,9 +1424,9 @@ discard block |
||
| 1424 | 1424 | $commentConfig = $oModuleModel->getModulePartConfig('comment', $obj->originModuleSrl); |
| 1425 | 1425 | |
| 1426 | 1426 | $oModuleController = getController('module'); |
| 1427 | - if(is_array($obj->moduleSrlList)) |
|
| 1427 | + if (is_array($obj->moduleSrlList)) |
|
| 1428 | 1428 | { |
| 1429 | - foreach($obj->moduleSrlList as $moduleSrl) |
|
| 1429 | + foreach ($obj->moduleSrlList as $moduleSrl) |
|
| 1430 | 1430 | { |
| 1431 | 1431 | $oModuleController->insertModulePartConfig('comment', $moduleSrl, $commentConfig); |
| 1432 | 1432 | } |
@@ -211,14 +211,12 @@ discard block |
||
| 211 | 211 | if($logged_info->is_admin == 'Y') |
| 212 | 212 | { |
| 213 | 213 | $is_admin = TRUE; |
| 214 | - } |
|
| 215 | - else |
|
| 214 | + } else |
|
| 216 | 215 | { |
| 217 | 216 | $is_admin = FALSE; |
| 218 | 217 | } |
| 219 | 218 | } |
| 220 | - } |
|
| 221 | - else |
|
| 219 | + } else |
|
| 222 | 220 | { |
| 223 | 221 | $is_admin = FALSE; |
| 224 | 222 | } |
@@ -226,14 +224,12 @@ discard block |
||
| 226 | 224 | if(!$using_validation) |
| 227 | 225 | { |
| 228 | 226 | $obj->status = 1; |
| 229 | - } |
|
| 230 | - else |
|
| 227 | + } else |
|
| 231 | 228 | { |
| 232 | 229 | if($is_admin) |
| 233 | 230 | { |
| 234 | 231 | $obj->status = 1; |
| 235 | - } |
|
| 236 | - else |
|
| 232 | + } else |
|
| 237 | 233 | { |
| 238 | 234 | $obj->status = 0; |
| 239 | 235 | } |
@@ -310,8 +306,7 @@ discard block |
||
| 310 | 306 | if(!$obj->comment_srl) |
| 311 | 307 | { |
| 312 | 308 | $obj->comment_srl = getNextSequence(); |
| 313 | - } |
|
| 314 | - elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 309 | + } elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) |
|
| 315 | 310 | { |
| 316 | 311 | return new BaseObject(-1, 'msg_not_permitted'); |
| 317 | 312 | } |
@@ -369,8 +364,7 @@ discard block |
||
| 369 | 364 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
| 370 | 365 | $list_args->depth = 0; |
| 371 | 366 | // If parent comment exists, get information of the parent comment |
| 372 | - } |
|
| 373 | - else |
|
| 367 | + } else |
|
| 374 | 368 | { |
| 375 | 369 | // get information of the parent comment posting |
| 376 | 370 | $parent_args = new stdClass(); |
@@ -393,8 +387,7 @@ discard block |
||
| 393 | 387 | { |
| 394 | 388 | $list_args->arrange = $obj->comment_srl; |
| 395 | 389 | // if the depth of comments is greater than 2, execute update. |
| 396 | - } |
|
| 397 | - else |
|
| 390 | + } else |
|
| 398 | 391 | { |
| 399 | 392 | // get the top listed comment among those in lower depth and same head with parent's. |
| 400 | 393 | $p_args = new stdClass(); |
@@ -407,8 +400,7 @@ discard block |
||
| 407 | 400 | { |
| 408 | 401 | $list_args->arrange = $output->data->arrange; |
| 409 | 402 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
| 410 | - } |
|
| 411 | - else |
|
| 403 | + } else |
|
| 412 | 404 | { |
| 413 | 405 | $list_args->arrange = $obj->comment_srl; |
| 414 | 406 | } |
@@ -442,8 +434,7 @@ discard block |
||
| 442 | 434 | if(!$using_validation) |
| 443 | 435 | { |
| 444 | 436 | $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, TRUE); |
| 445 | - } |
|
| 446 | - else |
|
| 437 | + } else |
|
| 447 | 438 | { |
| 448 | 439 | if($is_admin) |
| 449 | 440 | { |
@@ -511,8 +502,7 @@ discard block |
||
| 511 | 502 | if(isset($obj->member_srl) && !is_null($obj->member_srl)) |
| 512 | 503 | { |
| 513 | 504 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($obj->member_srl); |
| 514 | - } |
|
| 515 | - else |
|
| 505 | + } else |
|
| 516 | 506 | { |
| 517 | 507 | $member_info = new stdClass(); |
| 518 | 508 | $member_info->is_admin = "N"; |
@@ -558,8 +548,7 @@ discard block |
||
| 558 | 548 | <br /><a href=\"" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "\">" . getFullUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'module', 'search_keyword', $obj->module_srl) . "</a> |
| 559 | 549 | "; |
| 560 | 550 | $oMail->setContent($mail_content); |
| 561 | - } |
|
| 562 | - else |
|
| 551 | + } else |
|
| 563 | 552 | { |
| 564 | 553 | $mail_content = " |
| 565 | 554 | Author: " . $member_info->nick_name . " |
@@ -832,8 +821,7 @@ discard block |
||
| 832 | 821 | if(!$deleteAllComment) |
| 833 | 822 | { |
| 834 | 823 | return new BaseObject(-1, 'fail_to_delete_have_children'); |
| 835 | - } |
|
| 836 | - else |
|
| 824 | + } else |
|
| 837 | 825 | { |
| 838 | 826 | foreach($childs as $val) |
| 839 | 827 | { |
@@ -897,8 +885,7 @@ discard block |
||
| 897 | 885 | { |
| 898 | 886 | $this->_deleteDeclaredComments($args); |
| 899 | 887 | $this->_deleteVotedComments($args); |
| 900 | - } |
|
| 901 | - else |
|
| 888 | + } else |
|
| 902 | 889 | { |
| 903 | 890 | $args = new stdClass(); |
| 904 | 891 | $args->upload_target_srl = $comment_srl; |
@@ -941,8 +928,7 @@ discard block |
||
| 941 | 928 | { |
| 942 | 929 | $oDocument = new documentItem(); |
| 943 | 930 | $oDocument->setAttribute($obj); |
| 944 | - } |
|
| 945 | - else |
|
| 931 | + } else |
|
| 946 | 932 | { |
| 947 | 933 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 948 | 934 | } |
@@ -1035,8 +1021,7 @@ discard block |
||
| 1035 | 1021 | { |
| 1036 | 1022 | $failed_voted = 'failed_voted'; |
| 1037 | 1023 | $success_message = 'success_voted'; |
| 1038 | - } |
|
| 1039 | - else |
|
| 1024 | + } else |
|
| 1040 | 1025 | { |
| 1041 | 1026 | $failed_voted = 'failed_blamed'; |
| 1042 | 1027 | $success_message = 'success_blamed'; |
@@ -1079,8 +1064,7 @@ discard block |
||
| 1079 | 1064 | if($member_srl) |
| 1080 | 1065 | { |
| 1081 | 1066 | $args->member_srl = $member_srl; |
| 1082 | - } |
|
| 1083 | - else |
|
| 1067 | + } else |
|
| 1084 | 1068 | { |
| 1085 | 1069 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1086 | 1070 | } |
@@ -1120,8 +1104,7 @@ discard block |
||
| 1120 | 1104 | { |
| 1121 | 1105 | $args->blamed_count = $trigger_obj->after_point; |
| 1122 | 1106 | $output = executeQuery('comment.updateBlamedCount', $args); |
| 1123 | - } |
|
| 1124 | - else |
|
| 1107 | + } else |
|
| 1125 | 1108 | { |
| 1126 | 1109 | $args->voted_count = $trigger_obj->after_point; |
| 1127 | 1110 | $output = executeQuery('comment.updateVotedCount', $args); |
@@ -1149,8 +1132,7 @@ discard block |
||
| 1149 | 1132 | if($trigger_obj->update_target === 'voted_count') |
| 1150 | 1133 | { |
| 1151 | 1134 | $output->add('voted_count', $trigger_obj->after_point); |
| 1152 | - } |
|
| 1153 | - else |
|
| 1135 | + } else |
|
| 1154 | 1136 | { |
| 1155 | 1137 | $output->add('blamed_count', $trigger_obj->after_point); |
| 1156 | 1138 | } |
@@ -1222,8 +1204,7 @@ discard block |
||
| 1222 | 1204 | if($member_srl) |
| 1223 | 1205 | { |
| 1224 | 1206 | $args->member_srl = $member_srl; |
| 1225 | - } |
|
| 1226 | - else |
|
| 1207 | + } else |
|
| 1227 | 1208 | { |
| 1228 | 1209 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1229 | 1210 | } |
@@ -1245,8 +1226,7 @@ discard block |
||
| 1245 | 1226 | if($output->data->declared_count > 0) |
| 1246 | 1227 | { |
| 1247 | 1228 | $output = executeQuery('comment.updateDeclaredComment', $args); |
| 1248 | - } |
|
| 1249 | - else |
|
| 1229 | + } else |
|
| 1250 | 1230 | { |
| 1251 | 1231 | $output = executeQuery('comment.insertDeclaredComment', $args); |
| 1252 | 1232 | } |
@@ -1313,8 +1293,7 @@ discard block |
||
| 1313 | 1293 | if(preg_match('/^([0-9,]+)$/', $module_srl)) |
| 1314 | 1294 | { |
| 1315 | 1295 | $module_srl = explode(',', $module_srl); |
| 1316 | - } |
|
| 1317 | - else |
|
| 1296 | + } else |
|
| 1318 | 1297 | { |
| 1319 | 1298 | $module_srl = array($module_srl); |
| 1320 | 1299 | } |
@@ -1404,8 +1383,7 @@ discard block |
||
| 1404 | 1383 | $value->content = strip_tags($value->content); |
| 1405 | 1384 | } |
| 1406 | 1385 | } |
| 1407 | - } |
|
| 1408 | - else |
|
| 1386 | + } else |
|
| 1409 | 1387 | { |
| 1410 | 1388 | global $lang; |
| 1411 | 1389 | $commentList = array(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $point = $config->signup_point; |
| 32 | 32 | // Increase the point |
| 33 | 33 | $cur_point += $point; |
| 34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
| 34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
| 35 | 35 | |
| 36 | 36 | return new BaseObject(); |
| 37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | function triggerAfterLogin(&$obj) |
| 43 | 43 | { |
| 44 | 44 | $member_srl = $obj->member_srl; |
| 45 | - if(!$member_srl) return new BaseObject(); |
|
| 45 | + if (!$member_srl) return new BaseObject(); |
|
| 46 | 46 | // If the last login is not today, give the points |
| 47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
| 47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new BaseObject(); |
|
| 48 | 48 | // Get the point module information |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $point = $config->login_point; |
| 56 | 56 | // Increase the point |
| 57 | 57 | $cur_point += $point; |
| 58 | - $this->setPoint($member_srl,$cur_point); |
|
| 58 | + $this->setPoint($member_srl, $cur_point); |
|
| 59 | 59 | |
| 60 | 60 | return new BaseObject(); |
| 61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
| 66 | 66 | function triggerInsertDocument(&$obj) |
| 67 | 67 | { |
| 68 | 68 | $oDocumentModel = getModel('document'); |
| 69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 70 | 70 | { |
| 71 | 71 | $module_srl = $obj->module_srl; |
| 72 | 72 | $member_srl = $obj->member_srl; |
| 73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 73 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 74 | 74 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
| 75 | + if ($module_srl == $member_srl) return new BaseObject(); |
|
| 76 | 76 | // Get the point module information |
| 77 | 77 | $oModuleModel = getModel('module'); |
| 78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
| 79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
| 79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
| 80 | 80 | // Get the points of the member |
| 81 | 81 | $oPointModel = getModel('point'); |
| 82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 83 | 83 | |
| 84 | 84 | $point = $module_config['insert_document']; |
| 85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 86 | 86 | $cur_point += $point; |
| 87 | 87 | // Add points for attaching a file |
| 88 | 88 | $point = $module_config['upload_file']; |
| 89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 91 | 91 | // Increase the point |
| 92 | - $this->setPoint($member_srl,$cur_point); |
|
| 92 | + $this->setPoint($member_srl, $cur_point); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return new BaseObject(); |
@@ -106,24 +106,24 @@ discard block |
||
| 106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 107 | 107 | |
| 108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
| 109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 110 | 110 | { |
| 111 | 111 | $oModuleModel = getModel('module'); |
| 112 | 112 | |
| 113 | 113 | // Get the point module information |
| 114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
| 115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
| 115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
| 116 | 116 | // Get the points of the member |
| 117 | 117 | $oPointModel = getModel('point'); |
| 118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
| 119 | 119 | |
| 120 | 120 | $point = $module_config['insert_document']; |
| 121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 122 | 122 | $cur_point += $point; |
| 123 | 123 | // Add points for attaching a file |
| 124 | 124 | $point = $module_config['upload_file']; |
| 125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 127 | 127 | // Increase the point |
| 128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
| 129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $oDocumentModel = getModel('document'); |
| 143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 144 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
| 145 | 145 | // Get the point module information |
| 146 | 146 | $oModuleModel = getModel('module'); |
| 147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
| 148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
| 148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
| 149 | 149 | // The process related to clearing the post comments |
| 150 | 150 | $comment_point = $module_config['insert_comment']; |
| 151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 152 | 152 | // If there are comment points, attempt to deduct |
| 153 | - if($comment_point>0) return new BaseObject(); |
|
| 153 | + if ($comment_point > 0) return new BaseObject(); |
|
| 154 | 154 | // Get all the comments related to this post |
| 155 | 155 | $cp_args = new stdClass(); |
| 156 | 156 | $cp_args->document_srl = $document_srl; |
| 157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
| 158 | 158 | // Return if there is no object |
| 159 | - if(!$output->data) return new BaseObject(); |
|
| 159 | + if (!$output->data) return new BaseObject(); |
|
| 160 | 160 | // Organize the member number |
| 161 | 161 | $member_srls = array(); |
| 162 | 162 | $cnt = count($output->data); |
| 163 | - for($i=0;$i<$cnt;$i++) |
|
| 163 | + for ($i = 0; $i < $cnt; $i++) |
|
| 164 | 164 | { |
| 165 | - if($output->data[$i]->member_srl<1) continue; |
|
| 165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
| 166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
| 167 | 167 | } |
| 168 | 168 | // Remove the member number who has written the original post |
| 169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | - if(!count($member_srls)) return new BaseObject(); |
|
| 169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | + if (!count($member_srls)) return new BaseObject(); |
|
| 171 | 171 | // Remove all the points for each member |
| 172 | 172 | $oPointModel = getModel('point'); |
| 173 | 173 | // Get the points |
| 174 | 174 | $point = $module_config['download_file']; |
| 175 | - foreach($member_srls as $member_srl => $cnt) |
|
| 175 | + foreach ($member_srls as $member_srl => $cnt) |
|
| 176 | 176 | { |
| 177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 178 | 178 | $cur_point -= $cnt * $comment_point; |
| 179 | - $this->setPoint($member_srl,$cur_point); |
|
| 179 | + $this->setPoint($member_srl, $cur_point); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | return new BaseObject(); |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | $oDocumentModel = getModel('document'); |
| 191 | 191 | |
| 192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 193 | 193 | { |
| 194 | 194 | $module_srl = $obj->module_srl; |
| 195 | 195 | $member_srl = $obj->member_srl; |
| 196 | 196 | // The process related to clearing the post object |
| 197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 197 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 198 | 198 | // Run only when logged in |
| 199 | 199 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 200 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
| 201 | 201 | // Get the points of the member |
| 202 | 202 | $oPointModel = getModel('point'); |
| 203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 208 | 208 | |
| 209 | 209 | $point = $module_config['insert_document']; |
| 210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
| 212 | - if($point < 0) return new BaseObject(); |
|
| 212 | + if ($point < 0) return new BaseObject(); |
|
| 213 | 213 | $cur_point -= $point; |
| 214 | 214 | // Increase the point |
| 215 | - $this->setPoint($member_srl,$cur_point); |
|
| 215 | + $this->setPoint($member_srl, $cur_point); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | return new BaseObject(); |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | $module_srl = $obj->module_srl; |
| 227 | 227 | $member_srl = $obj->member_srl; |
| 228 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 228 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 229 | 229 | // Do not increase the points if the member is the author of the post |
| 230 | 230 | $document_srl = $obj->document_srl; |
| 231 | 231 | $oDocumentModel = getModel('document'); |
| 232 | 232 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 233 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
| 233 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new BaseObject(); |
|
| 234 | 234 | // Get the point module information |
| 235 | 235 | $oModuleModel = getModel('module'); |
| 236 | 236 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 241 | 241 | |
| 242 | 242 | $point = $module_config['insert_comment']; |
| 243 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 243 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 244 | 244 | // Increase the point |
| 245 | 245 | $cur_point += $point; |
| 246 | - $this->setPoint($member_srl,$cur_point); |
|
| 246 | + $this->setPoint($member_srl, $cur_point); |
|
| 247 | 247 | |
| 248 | 248 | return new BaseObject(); |
| 249 | 249 | } |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | $module_srl = $obj->module_srl; |
| 261 | 261 | $member_srl = abs($obj->member_srl); |
| 262 | 262 | $document_srl = $obj->document_srl; |
| 263 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 263 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 264 | 264 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
| 265 | 265 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 266 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 267 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
| 266 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
| 267 | + if ($oDocument->get('member_srl') == $member_srl) return new BaseObject(); |
|
| 268 | 268 | // Get the point module information |
| 269 | 269 | $config = $oModuleModel->getModuleConfig('point'); |
| 270 | 270 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -272,12 +272,12 @@ discard block |
||
| 272 | 272 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 273 | 273 | |
| 274 | 274 | $point = $module_config['insert_comment']; |
| 275 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 275 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 276 | 276 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
| 277 | - if($point < 0) return new BaseObject(); |
|
| 277 | + if ($point < 0) return new BaseObject(); |
|
| 278 | 278 | // Increase the point |
| 279 | 279 | $cur_point -= $point; |
| 280 | - $this->setPoint($member_srl,$cur_point); |
|
| 280 | + $this->setPoint($member_srl, $cur_point); |
|
| 281 | 281 | |
| 282 | 282 | return new BaseObject(); |
| 283 | 283 | } |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | function triggerDeleteFile(&$obj) |
| 299 | 299 | { |
| 300 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
| 300 | + if ($obj->isvalid != 'Y') return new BaseObject(); |
|
| 301 | 301 | |
| 302 | 302 | $module_srl = $obj->module_srl; |
| 303 | 303 | $member_srl = $obj->member_srl; |
| 304 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 304 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 305 | 305 | // Get the point module information |
| 306 | 306 | $oModuleModel = getModel('module'); |
| 307 | 307 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 312 | 312 | |
| 313 | 313 | $point = $module_config['upload_file']; |
| 314 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 314 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 315 | 315 | // Increase the point |
| 316 | 316 | $cur_point -= $point; |
| 317 | - $this->setPoint($member_srl,$cur_point); |
|
| 317 | + $this->setPoint($member_srl, $cur_point); |
|
| 318 | 318 | |
| 319 | 319 | return new BaseObject(); |
| 320 | 320 | } |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | $logged_info = Context::get('logged_info'); |
| 328 | 328 | $member_srl = $logged_info->member_srl; |
| 329 | 329 | $module_srl = $obj->module_srl; |
| 330 | - if(!$module_srl) return new BaseObject(); |
|
| 330 | + if (!$module_srl) return new BaseObject(); |
|
| 331 | 331 | |
| 332 | 332 | // Pass if it is your file |
| 333 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 333 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 334 | 334 | $oModuleModel = getModel('module'); |
| 335 | 335 | $config = $oModuleModel->getModuleConfig('point'); |
| 336 | 336 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -344,11 +344,11 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // If the user is not logged in and download requires points, deny access. |
| 347 | - if(!Context::get('is_logged')) |
|
| 347 | + if (!Context::get('is_logged')) |
|
| 348 | 348 | { |
| 349 | - if($config->disable_download == 'Y' && $point) |
|
| 349 | + if ($config->disable_download == 'Y' && $point) |
|
| 350 | 350 | { |
| 351 | - return new BaseObject(-1,'msg_not_permitted_download'); |
|
| 351 | + return new BaseObject(-1, 'msg_not_permitted_download'); |
|
| 352 | 352 | } |
| 353 | 353 | else |
| 354 | 354 | { |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | // If the member does not have enough points, deny access. |
| 364 | 364 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
| 365 | 365 | { |
| 366 | - return new BaseObject(-1,'msg_cannot_download'); |
|
| 366 | + return new BaseObject(-1, 'msg_cannot_download'); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -377,13 +377,13 @@ discard block |
||
| 377 | 377 | { |
| 378 | 378 | // Run only when logged in |
| 379 | 379 | $logged_info = Context::get('logged_info'); |
| 380 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 380 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
| 381 | 381 | $module_srl = $obj->module_srl; |
| 382 | 382 | $member_srl = $logged_info->member_srl; |
| 383 | - if(!$module_srl) return new BaseObject(); |
|
| 383 | + if (!$module_srl) return new BaseObject(); |
|
| 384 | 384 | |
| 385 | 385 | // Pass if it is your file |
| 386 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 386 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 387 | 387 | |
| 388 | 388 | // Get the point module information |
| 389 | 389 | $oModuleModel = getModel('module'); |
@@ -424,22 +424,22 @@ discard block |
||
| 424 | 424 | // Get the original author number |
| 425 | 425 | $target_member_srl = abs($obj->get('member_srl')); |
| 426 | 426 | // Pass without increasing the hits if the viewer is the same as the author |
| 427 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
| 427 | + if ($target_member_srl == $member_srl) return new BaseObject(); |
|
| 428 | 428 | // Get the point information for each module |
| 429 | 429 | $config = $oModuleModel->getModuleConfig('point'); |
| 430 | 430 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 431 | 431 | // Get hits points |
| 432 | 432 | $point = $module_config['read_document']; |
| 433 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 433 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 434 | 434 | // Pass if there are no requested points |
| 435 | - if(!$point) return new BaseObject(); |
|
| 435 | + if (!$point) return new BaseObject(); |
|
| 436 | 436 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 437 | - if($member_srl) |
|
| 437 | + if ($member_srl) |
|
| 438 | 438 | { |
| 439 | 439 | $args->member_srl = $member_srl; |
| 440 | 440 | $args->document_srl = $obj->document_srl; |
| 441 | 441 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 442 | - if($output->data->count) return new BaseObject(); |
|
| 442 | + if ($output->data->count) return new BaseObject(); |
|
| 443 | 443 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 444 | 444 | } |
| 445 | 445 | else |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $config = $oModuleModel->getModuleConfig('point'); |
| 451 | 451 | // When the requested points are negative, compared it with the current point |
| 452 | 452 | $_SESSION['banned_document'][$obj->document_srl] = false; |
| 453 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
| 453 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
| 454 | 454 | { |
| 455 | 455 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
| 456 | 456 | $obj->add('content', $message); |
@@ -458,14 +458,14 @@ discard block |
||
| 458 | 458 | return new BaseObject(-1, $message); |
| 459 | 459 | } |
| 460 | 460 | // If not logged in, pass |
| 461 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 461 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
| 462 | 462 | // Pass, if there are no requested points |
| 463 | - if(!$point) return new BaseObject(); |
|
| 463 | + if (!$point) return new BaseObject(); |
|
| 464 | 464 | // If the read record is missing, leave it |
| 465 | 465 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 466 | 466 | // Increase the point |
| 467 | 467 | $cur_point += $point; |
| 468 | - $this->setPoint($member_srl,$cur_point); |
|
| 468 | + $this->setPoint($member_srl, $cur_point); |
|
| 469 | 469 | |
| 470 | 470 | return new BaseObject(); |
| 471 | 471 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | { |
| 478 | 478 | $module_srl = $obj->module_srl; |
| 479 | 479 | $member_srl = $obj->member_srl; |
| 480 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 480 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 481 | 481 | |
| 482 | 482 | $oModuleModel = getModel('module'); |
| 483 | 483 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -486,21 +486,21 @@ discard block |
||
| 486 | 486 | $oPointModel = getModel('point'); |
| 487 | 487 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 488 | 488 | |
| 489 | - if( $obj->point > 0 ) |
|
| 489 | + if ($obj->point > 0) |
|
| 490 | 490 | { |
| 491 | 491 | $point = $module_config['voted']; |
| 492 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 492 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 493 | 493 | } |
| 494 | 494 | else |
| 495 | 495 | { |
| 496 | 496 | $point = $module_config['blamed']; |
| 497 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 497 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if(!$point) return new BaseObject(); |
|
| 500 | + if (!$point) return new BaseObject(); |
|
| 501 | 501 | // Increase the point |
| 502 | 502 | $cur_point += $point; |
| 503 | - $this->setPoint($member_srl,$cur_point); |
|
| 503 | + $this->setPoint($member_srl, $cur_point); |
|
| 504 | 504 | |
| 505 | 505 | return new BaseObject(); |
| 506 | 506 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | { |
| 513 | 513 | $member_srl = abs($member_srl); |
| 514 | 514 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 515 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 515 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
| 516 | 516 | |
| 517 | 517 | // Get configuration information |
| 518 | 518 | $oMemberModel = getModel('member'); |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $args->member_srl = $member_srl; |
| 530 | 530 | $args->point = $current_point; |
| 531 | 531 | |
| 532 | - switch($mode) |
|
| 532 | + switch ($mode) |
|
| 533 | 533 | { |
| 534 | 534 | case 'add' : |
| 535 | 535 | $args->point += $point; |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | $args->point = $point; |
| 543 | 543 | break; |
| 544 | 544 | } |
| 545 | - if($args->point < 0) $args->point = 0; |
|
| 545 | + if ($args->point < 0) $args->point = 0; |
|
| 546 | 546 | $point = $args->point; |
| 547 | 547 | |
| 548 | 548 | // Call a trigger (before) |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | $trigger_obj->current_level = $current_level; |
| 554 | 554 | $trigger_obj->set_point = $point; |
| 555 | 555 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
| 556 | - if(!$trigger_output->toBool()) |
|
| 556 | + if (!$trigger_output->toBool()) |
|
| 557 | 557 | { |
| 558 | 558 | return $trigger_output; |
| 559 | 559 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | $oDB->begin(); |
| 564 | 564 | |
| 565 | 565 | // If there are points, update, if no, insert |
| 566 | - if($current_point > 0) |
|
| 566 | + if ($current_point > 0) |
|
| 567 | 567 | { |
| 568 | 568 | $output = executeQuery("point.updatePoint", $args); |
| 569 | 569 | } |
@@ -571,13 +571,13 @@ discard block |
||
| 571 | 571 | { |
| 572 | 572 | // 많은 동접시 넣는 과정에서 insert가 미리 이루어졌지만 이 공간으로 넘어올 경우 다시 한번 더 업데이트를 처리. |
| 573 | 573 | $output = executeQuery("point.insertPoint", $args); |
| 574 | - if(!$output->toBool()) |
|
| 574 | + if (!$output->toBool()) |
|
| 575 | 575 | { |
| 576 | 576 | $output = executeQuery("point.updatePoint", $args); |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - if(!$output->toBool()) |
|
| 580 | + if (!$output->toBool()) |
|
| 581 | 581 | { |
| 582 | 582 | $oDB->rollback(); |
| 583 | 583 | return $output; |
@@ -587,12 +587,12 @@ discard block |
||
| 587 | 587 | $level = $oPointModel->getLevel($point, $config->level_step); |
| 588 | 588 | |
| 589 | 589 | // If existing level and a new one are different attempt to set a point group |
| 590 | - if($level != $current_level) |
|
| 590 | + if ($level != $current_level) |
|
| 591 | 591 | { |
| 592 | 592 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
| 593 | 593 | $point_group = $config->point_group; |
| 594 | 594 | // If the point group exists |
| 595 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
| 595 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
| 596 | 596 | { |
| 597 | 597 | // Get the default group |
| 598 | 598 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -602,29 +602,29 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | asort($point_group); |
| 604 | 604 | // Reset group after initialization |
| 605 | - if($config->group_reset != 'N') |
|
| 605 | + if ($config->group_reset != 'N') |
|
| 606 | 606 | { |
| 607 | 607 | // If the new level is in the right group |
| 608 | - if(in_array($level, $point_group)) |
|
| 608 | + if (in_array($level, $point_group)) |
|
| 609 | 609 | { |
| 610 | 610 | // Delete all groups except the one which the current level belongs to |
| 611 | - foreach($point_group as $group_srl => $target_level) |
|
| 611 | + foreach ($point_group as $group_srl => $target_level) |
|
| 612 | 612 | { |
| 613 | 613 | $del_group_list[] = $group_srl; |
| 614 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 614 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | // Otherwise, in case the level is reduced, add the recent group |
| 618 | 618 | else |
| 619 | 619 | { |
| 620 | 620 | $i = $level; |
| 621 | - while($i > 0) |
|
| 621 | + while ($i > 0) |
|
| 622 | 622 | { |
| 623 | - if(in_array($i, $point_group)) |
|
| 623 | + if (in_array($i, $point_group)) |
|
| 624 | 624 | { |
| 625 | - foreach($point_group as $group_srl => $target_level) |
|
| 625 | + foreach ($point_group as $group_srl => $target_level) |
|
| 626 | 626 | { |
| 627 | - if($target_level == $i) |
|
| 627 | + if ($target_level == $i) |
|
| 628 | 628 | { |
| 629 | 629 | $new_group_list[] = $group_srl; |
| 630 | 630 | } |
@@ -635,9 +635,9 @@ discard block |
||
| 635 | 635 | } |
| 636 | 636 | } |
| 637 | 637 | // Delete the group of a level which is higher than the current level |
| 638 | - foreach($point_group as $group_srl => $target_level) |
|
| 638 | + foreach ($point_group as $group_srl => $target_level) |
|
| 639 | 639 | { |
| 640 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 640 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
| 641 | 641 | } |
| 642 | 642 | $del_group_list[] = $default_group->group_srl; |
| 643 | 643 | } |
@@ -645,16 +645,16 @@ discard block |
||
| 645 | 645 | else |
| 646 | 646 | { |
| 647 | 647 | // Check until the current level by rotating setting the configurations of the point groups |
| 648 | - foreach($point_group as $group_srl => $target_level) |
|
| 648 | + foreach ($point_group as $group_srl => $target_level) |
|
| 649 | 649 | { |
| 650 | 650 | $del_group_list[] = $group_srl; |
| 651 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 651 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 652 | 652 | } |
| 653 | 653 | } |
| 654 | 654 | // If there is no a new group, granted the default group |
| 655 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 655 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 656 | 656 | // Remove linkage group |
| 657 | - if($del_group_list && count($del_group_list)) |
|
| 657 | + if ($del_group_list && count($del_group_list)) |
|
| 658 | 658 | { |
| 659 | 659 | $del_group_args = new stdClass; |
| 660 | 660 | $del_group_args->member_srl = $member_srl; |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
| 663 | 663 | } |
| 664 | 664 | // Grant a new group |
| 665 | - foreach($new_group_list as $group_srl) |
|
| 665 | + foreach ($new_group_list as $group_srl) |
|
| 666 | 666 | { |
| 667 | 667 | $new_group_args = new stdClass; |
| 668 | 668 | $new_group_args->member_srl = $member_srl; |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | $trigger_obj->del_group_list = $del_group_list; |
| 678 | 678 | $trigger_obj->new_level = $level; |
| 679 | 679 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
| 680 | - if(!$trigger_output->toBool()) |
|
| 680 | + if (!$trigger_output->toBool()) |
|
| 681 | 681 | { |
| 682 | 682 | $oDB->rollback(); |
| 683 | 683 | return $trigger_output; |
@@ -693,17 +693,17 @@ discard block |
||
| 693 | 693 | FileHandler::writeFile($cache_filename, $point); |
| 694 | 694 | |
| 695 | 695 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 696 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 696 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 697 | 697 | { |
| 698 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 698 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 699 | 699 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 700 | 700 | $oCacheHandler->delete($cache_key); |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 704 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 704 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 705 | 705 | { |
| 706 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 706 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 707 | 707 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 708 | 708 | $oCacheHandler->delete($cache_key); |
| 709 | 709 | } |
@@ -717,9 +717,9 @@ discard block |
||
| 717 | 717 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
| 718 | 718 | |
| 719 | 719 | $oModuleController = getController('module'); |
| 720 | - if(is_array($obj->moduleSrlList)) |
|
| 720 | + if (is_array($obj->moduleSrlList)) |
|
| 721 | 721 | { |
| 722 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 722 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 723 | 723 | { |
| 724 | 724 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
| 725 | 725 | } |
@@ -42,9 +42,13 @@ discard block |
||
| 42 | 42 | function triggerAfterLogin(&$obj) |
| 43 | 43 | { |
| 44 | 44 | $member_srl = $obj->member_srl; |
| 45 | - if(!$member_srl) return new BaseObject(); |
|
| 45 | + if(!$member_srl) { |
|
| 46 | + return new BaseObject(); |
|
| 47 | + } |
|
| 46 | 48 | // If the last login is not today, give the points |
| 47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
| 49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
| 50 | + return new BaseObject(); |
|
| 51 | + } |
|
| 48 | 52 | // Get the point module information |
| 49 | 53 | $oModuleModel = getModel('module'); |
| 50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
| 70 | 74 | { |
| 71 | 75 | $module_srl = $obj->module_srl; |
| 72 | 76 | $member_srl = $obj->member_srl; |
| 73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 77 | + if(!$module_srl || !$member_srl) { |
|
| 78 | + return new BaseObject(); |
|
| 79 | + } |
|
| 74 | 80 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
| 81 | + if($module_srl == $member_srl) { |
|
| 82 | + return new BaseObject(); |
|
| 83 | + } |
|
| 76 | 84 | // Get the point module information |
| 77 | 85 | $oModuleModel = getModel('module'); |
| 78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
| 82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 83 | 91 | |
| 84 | 92 | $point = $module_config['insert_document']; |
| 85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 94 | + $point = $config->insert_document; |
|
| 95 | + } |
|
| 86 | 96 | $cur_point += $point; |
| 87 | 97 | // Add points for attaching a file |
| 88 | 98 | $point = $module_config['upload_file']; |
| 89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 100 | + $point = $config->upload_file; |
|
| 101 | + } |
|
| 102 | + if($obj->uploaded_count) { |
|
| 103 | + $cur_point += $point * $obj->uploaded_count; |
|
| 104 | + } |
|
| 91 | 105 | // Increase the point |
| 92 | 106 | $this->setPoint($member_srl,$cur_point); |
| 93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
| 118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
| 119 | 133 | |
| 120 | 134 | $point = $module_config['insert_document']; |
| 121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 136 | + $point = $config->insert_document; |
|
| 137 | + } |
|
| 122 | 138 | $cur_point += $point; |
| 123 | 139 | // Add points for attaching a file |
| 124 | 140 | $point = $module_config['upload_file']; |
| 125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 142 | + $point = $config->upload_file; |
|
| 143 | + } |
|
| 144 | + if($obj->uploaded_count) { |
|
| 145 | + $cur_point += $point * $obj->uploaded_count; |
|
| 146 | + } |
|
| 127 | 147 | // Increase the point |
| 128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
| 129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
| 141 | 161 | |
| 142 | 162 | $oDocumentModel = getModel('document'); |
| 143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 164 | + if(!$oDocument->isExists()) { |
|
| 165 | + return new BaseObject(); |
|
| 166 | + } |
|
| 145 | 167 | // Get the point module information |
| 146 | 168 | $oModuleModel = getModel('module'); |
| 147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
| 148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
| 149 | 171 | // The process related to clearing the post comments |
| 150 | 172 | $comment_point = $module_config['insert_comment']; |
| 151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
| 174 | + $comment_point = $config->insert_comment; |
|
| 175 | + } |
|
| 152 | 176 | // If there are comment points, attempt to deduct |
| 153 | - if($comment_point>0) return new BaseObject(); |
|
| 177 | + if($comment_point>0) { |
|
| 178 | + return new BaseObject(); |
|
| 179 | + } |
|
| 154 | 180 | // Get all the comments related to this post |
| 155 | 181 | $cp_args = new stdClass(); |
| 156 | 182 | $cp_args->document_srl = $document_srl; |
| 157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
| 158 | 184 | // Return if there is no object |
| 159 | - if(!$output->data) return new BaseObject(); |
|
| 185 | + if(!$output->data) { |
|
| 186 | + return new BaseObject(); |
|
| 187 | + } |
|
| 160 | 188 | // Organize the member number |
| 161 | 189 | $member_srls = array(); |
| 162 | 190 | $cnt = count($output->data); |
| 163 | 191 | for($i=0;$i<$cnt;$i++) |
| 164 | 192 | { |
| 165 | - if($output->data[$i]->member_srl<1) continue; |
|
| 193 | + if($output->data[$i]->member_srl<1) { |
|
| 194 | + continue; |
|
| 195 | + } |
|
| 166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
| 167 | 197 | } |
| 168 | 198 | // Remove the member number who has written the original post |
| 169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | - if(!count($member_srls)) return new BaseObject(); |
|
| 199 | + if($member_srl) { |
|
| 200 | + unset($member_srls[abs($member_srl)]); |
|
| 201 | + } |
|
| 202 | + if(!count($member_srls)) { |
|
| 203 | + return new BaseObject(); |
|
| 204 | + } |
|
| 171 | 205 | // Remove all the points for each member |
| 172 | 206 | $oPointModel = getModel('point'); |
| 173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
| 194 | 228 | $module_srl = $obj->module_srl; |
| 195 | 229 | $member_srl = $obj->member_srl; |
| 196 | 230 | // The process related to clearing the post object |
| 197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 231 | + if(!$module_srl || !$member_srl) { |
|
| 232 | + return new BaseObject(); |
|
| 233 | + } |
|
| 198 | 234 | // Run only when logged in |
| 199 | 235 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 236 | + if(!$logged_info->member_srl) { |
|
| 237 | + return new BaseObject(); |
|
| 238 | + } |
|
| 201 | 239 | // Get the points of the member |
| 202 | 240 | $oPointModel = getModel('point'); |
| 203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,9 +245,13 @@ discard block |
||
| 207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 208 | 246 | |
| 209 | 247 | $point = $module_config['insert_document']; |
| 210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 249 | + $point = $config->insert_document; |
|
| 250 | + } |
|
| 211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
| 212 | - if($point < 0) return new BaseObject(); |
|
| 252 | + if($point < 0) { |
|
| 253 | + return new BaseObject(); |
|
| 254 | + } |
|
| 213 | 255 | $cur_point -= $point; |
| 214 | 256 | // Increase the point |
| 215 | 257 | $this->setPoint($member_srl,$cur_point); |
@@ -225,12 +267,16 @@ discard block |
||
| 225 | 267 | { |
| 226 | 268 | $module_srl = $obj->module_srl; |
| 227 | 269 | $member_srl = $obj->member_srl; |
| 228 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 270 | + if(!$module_srl || !$member_srl) { |
|
| 271 | + return new BaseObject(); |
|
| 272 | + } |
|
| 229 | 273 | // Do not increase the points if the member is the author of the post |
| 230 | 274 | $document_srl = $obj->document_srl; |
| 231 | 275 | $oDocumentModel = getModel('document'); |
| 232 | 276 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 233 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
| 277 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
| 278 | + return new BaseObject(); |
|
| 279 | + } |
|
| 234 | 280 | // Get the point module information |
| 235 | 281 | $oModuleModel = getModel('module'); |
| 236 | 282 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -240,7 +286,9 @@ discard block |
||
| 240 | 286 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 241 | 287 | |
| 242 | 288 | $point = $module_config['insert_comment']; |
| 243 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 289 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 290 | + $point = $config->insert_comment; |
|
| 291 | + } |
|
| 244 | 292 | // Increase the point |
| 245 | 293 | $cur_point += $point; |
| 246 | 294 | $this->setPoint($member_srl,$cur_point); |
@@ -260,11 +308,17 @@ discard block |
||
| 260 | 308 | $module_srl = $obj->module_srl; |
| 261 | 309 | $member_srl = abs($obj->member_srl); |
| 262 | 310 | $document_srl = $obj->document_srl; |
| 263 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 311 | + if(!$module_srl || !$member_srl) { |
|
| 312 | + return new BaseObject(); |
|
| 313 | + } |
|
| 264 | 314 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
| 265 | 315 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 266 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 267 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
| 316 | + if(!$oDocument->isExists()) { |
|
| 317 | + return new BaseObject(); |
|
| 318 | + } |
|
| 319 | + if($oDocument->get('member_srl')==$member_srl) { |
|
| 320 | + return new BaseObject(); |
|
| 321 | + } |
|
| 268 | 322 | // Get the point module information |
| 269 | 323 | $config = $oModuleModel->getModuleConfig('point'); |
| 270 | 324 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -272,9 +326,13 @@ discard block |
||
| 272 | 326 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 273 | 327 | |
| 274 | 328 | $point = $module_config['insert_comment']; |
| 275 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 329 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 330 | + $point = $config->insert_comment; |
|
| 331 | + } |
|
| 276 | 332 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
| 277 | - if($point < 0) return new BaseObject(); |
|
| 333 | + if($point < 0) { |
|
| 334 | + return new BaseObject(); |
|
| 335 | + } |
|
| 278 | 336 | // Increase the point |
| 279 | 337 | $cur_point -= $point; |
| 280 | 338 | $this->setPoint($member_srl,$cur_point); |
@@ -297,11 +355,15 @@ discard block |
||
| 297 | 355 | */ |
| 298 | 356 | function triggerDeleteFile(&$obj) |
| 299 | 357 | { |
| 300 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
| 358 | + if($obj->isvalid != 'Y') { |
|
| 359 | + return new BaseObject(); |
|
| 360 | + } |
|
| 301 | 361 | |
| 302 | 362 | $module_srl = $obj->module_srl; |
| 303 | 363 | $member_srl = $obj->member_srl; |
| 304 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 364 | + if(!$module_srl || !$member_srl) { |
|
| 365 | + return new BaseObject(); |
|
| 366 | + } |
|
| 305 | 367 | // Get the point module information |
| 306 | 368 | $oModuleModel = getModel('module'); |
| 307 | 369 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -311,7 +373,9 @@ discard block |
||
| 311 | 373 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 312 | 374 | |
| 313 | 375 | $point = $module_config['upload_file']; |
| 314 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 376 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 377 | + $point = $config->upload_file; |
|
| 378 | + } |
|
| 315 | 379 | // Increase the point |
| 316 | 380 | $cur_point -= $point; |
| 317 | 381 | $this->setPoint($member_srl,$cur_point); |
@@ -327,18 +391,21 @@ discard block |
||
| 327 | 391 | $logged_info = Context::get('logged_info'); |
| 328 | 392 | $member_srl = $logged_info->member_srl; |
| 329 | 393 | $module_srl = $obj->module_srl; |
| 330 | - if(!$module_srl) return new BaseObject(); |
|
| 394 | + if(!$module_srl) { |
|
| 395 | + return new BaseObject(); |
|
| 396 | + } |
|
| 331 | 397 | |
| 332 | 398 | // Pass if it is your file |
| 333 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 399 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
| 400 | + return new BaseObject(); |
|
| 401 | + } |
|
| 334 | 402 | $oModuleModel = getModel('module'); |
| 335 | 403 | $config = $oModuleModel->getModuleConfig('point'); |
| 336 | 404 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 337 | 405 | if (isset($module_config['download_file'])) |
| 338 | 406 | { |
| 339 | 407 | $point = intval($module_config['download_file']); |
| 340 | - } |
|
| 341 | - else |
|
| 408 | + } else |
|
| 342 | 409 | { |
| 343 | 410 | $point = intval($config->download_file); |
| 344 | 411 | } |
@@ -349,8 +416,7 @@ discard block |
||
| 349 | 416 | if($config->disable_download == 'Y' && $point) |
| 350 | 417 | { |
| 351 | 418 | return new BaseObject(-1,'msg_not_permitted_download'); |
| 352 | - } |
|
| 353 | - else |
|
| 419 | + } else |
|
| 354 | 420 | { |
| 355 | 421 | return new BaseObject(); |
| 356 | 422 | } |
@@ -377,13 +443,19 @@ discard block |
||
| 377 | 443 | { |
| 378 | 444 | // Run only when logged in |
| 379 | 445 | $logged_info = Context::get('logged_info'); |
| 380 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 446 | + if(!$logged_info->member_srl) { |
|
| 447 | + return new BaseObject(); |
|
| 448 | + } |
|
| 381 | 449 | $module_srl = $obj->module_srl; |
| 382 | 450 | $member_srl = $logged_info->member_srl; |
| 383 | - if(!$module_srl) return new BaseObject(); |
|
| 451 | + if(!$module_srl) { |
|
| 452 | + return new BaseObject(); |
|
| 453 | + } |
|
| 384 | 454 | |
| 385 | 455 | // Pass if it is your file |
| 386 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 456 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
| 457 | + return new BaseObject(); |
|
| 458 | + } |
|
| 387 | 459 | |
| 388 | 460 | // Get the point module information |
| 389 | 461 | $oModuleModel = getModel('module'); |
@@ -392,8 +464,7 @@ discard block |
||
| 392 | 464 | if (isset($module_config['download_file'])) |
| 393 | 465 | { |
| 394 | 466 | $point = intval($module_config['download_file']); |
| 395 | - } |
|
| 396 | - else |
|
| 467 | + } else |
|
| 397 | 468 | { |
| 398 | 469 | $point = intval($config->download_file); |
| 399 | 470 | } |
@@ -424,25 +495,32 @@ discard block |
||
| 424 | 495 | // Get the original author number |
| 425 | 496 | $target_member_srl = abs($obj->get('member_srl')); |
| 426 | 497 | // Pass without increasing the hits if the viewer is the same as the author |
| 427 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
| 498 | + if($target_member_srl == $member_srl) { |
|
| 499 | + return new BaseObject(); |
|
| 500 | + } |
|
| 428 | 501 | // Get the point information for each module |
| 429 | 502 | $config = $oModuleModel->getModuleConfig('point'); |
| 430 | 503 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 431 | 504 | // Get hits points |
| 432 | 505 | $point = $module_config['read_document']; |
| 433 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 506 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 507 | + $point = $config->read_document; |
|
| 508 | + } |
|
| 434 | 509 | // Pass if there are no requested points |
| 435 | - if(!$point) return new BaseObject(); |
|
| 510 | + if(!$point) { |
|
| 511 | + return new BaseObject(); |
|
| 512 | + } |
|
| 436 | 513 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 437 | 514 | if($member_srl) |
| 438 | 515 | { |
| 439 | 516 | $args->member_srl = $member_srl; |
| 440 | 517 | $args->document_srl = $obj->document_srl; |
| 441 | 518 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 442 | - if($output->data->count) return new BaseObject(); |
|
| 519 | + if($output->data->count) { |
|
| 520 | + return new BaseObject(); |
|
| 521 | + } |
|
| 443 | 522 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 444 | - } |
|
| 445 | - else |
|
| 523 | + } else |
|
| 446 | 524 | { |
| 447 | 525 | $cur_point = 0; |
| 448 | 526 | } |
@@ -458,9 +536,13 @@ discard block |
||
| 458 | 536 | return new BaseObject(-1, $message); |
| 459 | 537 | } |
| 460 | 538 | // If not logged in, pass |
| 461 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 539 | + if(!$logged_info->member_srl) { |
|
| 540 | + return new BaseObject(); |
|
| 541 | + } |
|
| 462 | 542 | // Pass, if there are no requested points |
| 463 | - if(!$point) return new BaseObject(); |
|
| 543 | + if(!$point) { |
|
| 544 | + return new BaseObject(); |
|
| 545 | + } |
|
| 464 | 546 | // If the read record is missing, leave it |
| 465 | 547 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 466 | 548 | // Increase the point |
@@ -477,7 +559,9 @@ discard block |
||
| 477 | 559 | { |
| 478 | 560 | $module_srl = $obj->module_srl; |
| 479 | 561 | $member_srl = $obj->member_srl; |
| 480 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 562 | + if(!$module_srl || !$member_srl) { |
|
| 563 | + return new BaseObject(); |
|
| 564 | + } |
|
| 481 | 565 | |
| 482 | 566 | $oModuleModel = getModel('module'); |
| 483 | 567 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -489,15 +573,20 @@ discard block |
||
| 489 | 573 | if( $obj->point > 0 ) |
| 490 | 574 | { |
| 491 | 575 | $point = $module_config['voted']; |
| 492 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 493 | - } |
|
| 494 | - else |
|
| 576 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 577 | + $point = $config->voted; |
|
| 578 | + } |
|
| 579 | + } else |
|
| 495 | 580 | { |
| 496 | 581 | $point = $module_config['blamed']; |
| 497 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 582 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 583 | + $point = $config->blamed; |
|
| 584 | + } |
|
| 498 | 585 | } |
| 499 | 586 | |
| 500 | - if(!$point) return new BaseObject(); |
|
| 587 | + if(!$point) { |
|
| 588 | + return new BaseObject(); |
|
| 589 | + } |
|
| 501 | 590 | // Increase the point |
| 502 | 591 | $cur_point += $point; |
| 503 | 592 | $this->setPoint($member_srl,$cur_point); |
@@ -512,7 +601,9 @@ discard block |
||
| 512 | 601 | { |
| 513 | 602 | $member_srl = abs($member_srl); |
| 514 | 603 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 515 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 604 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
| 605 | + $mode = 'update'; |
|
| 606 | + } |
|
| 516 | 607 | |
| 517 | 608 | // Get configuration information |
| 518 | 609 | $oMemberModel = getModel('member'); |
@@ -542,7 +633,9 @@ discard block |
||
| 542 | 633 | $args->point = $point; |
| 543 | 634 | break; |
| 544 | 635 | } |
| 545 | - if($args->point < 0) $args->point = 0; |
|
| 636 | + if($args->point < 0) { |
|
| 637 | + $args->point = 0; |
|
| 638 | + } |
|
| 546 | 639 | $point = $args->point; |
| 547 | 640 | |
| 548 | 641 | // Call a trigger (before) |
@@ -566,8 +659,7 @@ discard block |
||
| 566 | 659 | if($current_point > 0) |
| 567 | 660 | { |
| 568 | 661 | $output = executeQuery("point.updatePoint", $args); |
| 569 | - } |
|
| 570 | - else |
|
| 662 | + } else |
|
| 571 | 663 | { |
| 572 | 664 | // 많은 동접시 넣는 과정에서 insert가 미리 이루어졌지만 이 공간으로 넘어올 경우 다시 한번 더 업데이트를 처리. |
| 573 | 665 | $output = executeQuery("point.insertPoint", $args); |
@@ -611,7 +703,9 @@ discard block |
||
| 611 | 703 | foreach($point_group as $group_srl => $target_level) |
| 612 | 704 | { |
| 613 | 705 | $del_group_list[] = $group_srl; |
| 614 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 706 | + if($target_level == $level) { |
|
| 707 | + $new_group_list[] = $group_srl; |
|
| 708 | + } |
|
| 615 | 709 | } |
| 616 | 710 | } |
| 617 | 711 | // Otherwise, in case the level is reduced, add the recent group |
@@ -637,7 +731,9 @@ discard block |
||
| 637 | 731 | // Delete the group of a level which is higher than the current level |
| 638 | 732 | foreach($point_group as $group_srl => $target_level) |
| 639 | 733 | { |
| 640 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 734 | + if($target_level > $level) { |
|
| 735 | + $del_group_list[] = $group_srl; |
|
| 736 | + } |
|
| 641 | 737 | } |
| 642 | 738 | $del_group_list[] = $default_group->group_srl; |
| 643 | 739 | } |
@@ -648,11 +744,15 @@ discard block |
||
| 648 | 744 | foreach($point_group as $group_srl => $target_level) |
| 649 | 745 | { |
| 650 | 746 | $del_group_list[] = $group_srl; |
| 651 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 747 | + if($target_level <= $level) { |
|
| 748 | + $new_group_list[] = $group_srl; |
|
| 749 | + } |
|
| 652 | 750 | } |
| 653 | 751 | } |
| 654 | 752 | // If there is no a new group, granted the default group |
| 655 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 753 | + if(!$new_group_list[0]) { |
|
| 754 | + $new_group_list[0] = $default_group->group_srl; |
|
| 755 | + } |
|
| 656 | 756 | // Remove linkage group |
| 657 | 757 | if($del_group_list && count($del_group_list)) |
| 658 | 758 | { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function procCommunicationUpdateAllowMessage() |
| 25 | 25 | { |
| 26 | - if(!Context::get('is_logged')) |
|
| 26 | + if (!Context::get('is_logged')) |
|
| 27 | 27 | { |
| 28 | 28 | return new BaseObject(-1, 'msg_not_logged'); |
| 29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $args = new stdClass(); |
| 32 | 32 | $args->allow_message = Context::get('allow_message'); |
| 33 | 33 | |
| 34 | - if(!in_array($args->allow_message, array('Y', 'N', 'F'))) |
|
| 34 | + if (!in_array($args->allow_message, array('Y', 'N', 'F'))) |
|
| 35 | 35 | { |
| 36 | 36 | $args->allow_message = 'Y'; |
| 37 | 37 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | function procCommunicationSendMessage() |
| 54 | 54 | { |
| 55 | 55 | // Check login information |
| 56 | - if(!Context::get('is_logged')) |
|
| 56 | + if (!Context::get('is_logged')) |
|
| 57 | 57 | { |
| 58 | 58 | return new BaseObject(-1, 'msg_not_logged'); |
| 59 | 59 | } |
@@ -62,25 +62,25 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | // Check variables |
| 64 | 64 | $receiver_srl = Context::get('receiver_srl'); |
| 65 | - if(!$receiver_srl) |
|
| 65 | + if (!$receiver_srl) |
|
| 66 | 66 | { |
| 67 | 67 | return new BaseObject(-1, 'msg_not_exists_member'); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $title = trim(Context::get('title')); |
| 71 | - if(!$title) |
|
| 71 | + if (!$title) |
|
| 72 | 72 | { |
| 73 | 73 | return new BaseObject(-1, 'msg_title_is_null'); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $content = trim(Context::get('content')); |
| 77 | - if(!$content) |
|
| 77 | + if (!$content) |
|
| 78 | 78 | { |
| 79 | 79 | return new BaseObject(-1, 'msg_content_is_null'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $send_mail = Context::get('send_mail'); |
| 83 | - if($send_mail != 'Y') |
|
| 83 | + if ($send_mail != 'Y') |
|
| 84 | 84 | { |
| 85 | 85 | $send_mail = 'N'; |
| 86 | 86 | } |
@@ -90,28 +90,28 @@ discard block |
||
| 90 | 90 | $oCommunicationModel = getModel('communication'); |
| 91 | 91 | $config = $oCommunicationModel->getConfig(); |
| 92 | 92 | |
| 93 | - if(!$oCommunicationModel->checkGrant($config->grant_write)) |
|
| 93 | + if (!$oCommunicationModel->checkGrant($config->grant_write)) |
|
| 94 | 94 | { |
| 95 | 95 | return new BaseObject(-1, 'msg_not_permitted'); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl); |
| 99 | - if($receiver_member_info->member_srl != $receiver_srl) |
|
| 99 | + if ($receiver_member_info->member_srl != $receiver_srl) |
|
| 100 | 100 | { |
| 101 | 101 | return new BaseObject(-1, 'msg_not_exists_member'); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // check whether to allow to receive the message(pass if a top-administrator) |
| 105 | - if($logged_info->is_admin != 'Y') |
|
| 105 | + if ($logged_info->is_admin != 'Y') |
|
| 106 | 106 | { |
| 107 | - if($receiver_member_info->allow_message == 'F') |
|
| 107 | + if ($receiver_member_info->allow_message == 'F') |
|
| 108 | 108 | { |
| 109 | - if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) |
|
| 109 | + if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) |
|
| 110 | 110 | { |
| 111 | 111 | return new BaseObject(-1, 'msg_allow_message_to_friend'); |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | - else if($receiver_member_info->allow_message == 'N') |
|
| 114 | + else if ($receiver_member_info->allow_message == 'N') |
|
| 115 | 115 | { |
| 116 | 116 | return new BaseObject(-1, 'msg_disallow_message'); |
| 117 | 117 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | // send a message |
| 121 | 121 | $output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content); |
| 122 | 122 | |
| 123 | - if(!$output->toBool()) |
|
| 123 | + if (!$output->toBool()) |
|
| 124 | 124 | { |
| 125 | 125 | return $output; |
| 126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $message_srl = $output->get('message_srl'); |
| 129 | 129 | |
| 130 | 130 | // send an e-mail |
| 131 | - if($send_mail == 'Y') |
|
| 131 | + if ($send_mail == 'Y') |
|
| 132 | 132 | { |
| 133 | 133 | $view_url = Context::getRequestUri(); |
| 134 | 134 | $content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url); |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $oMail->send(); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 143 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 144 | 144 | { |
| 145 | - if(Context::get('is_popup') === 'Y') |
|
| 145 | + if (Context::get('is_popup') === 'Y') |
|
| 146 | 146 | { |
| 147 | 147 | global $lang; |
| 148 | 148 | htmlHeader(); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $receiver_args->related_srl = 0; |
| 200 | 200 | $receiver_args->list_order = $related_srl * -1; |
| 201 | 201 | $receiver_args->sender_srl = $sender_srl; |
| 202 | - if(!$receiver_args->sender_srl) |
|
| 202 | + if (!$receiver_args->sender_srl) |
|
| 203 | 203 | { |
| 204 | 204 | $receiver_args->sender_srl = $receiver_srl; |
| 205 | 205 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $trigger_obj->content = $content; |
| 221 | 221 | $trigger_obj->sender_log = $sender_log; |
| 222 | 222 | $triggerOutput = ModuleHandler::triggerCall('communication.sendMessage', 'before', $trigger_obj); |
| 223 | - if(!$triggerOutput->toBool()) |
|
| 223 | + if (!$triggerOutput->toBool()) |
|
| 224 | 224 | { |
| 225 | 225 | return $triggerOutput; |
| 226 | 226 | } |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | $oDB->begin(); |
| 230 | 230 | |
| 231 | 231 | // messages to save in the sendor's message box |
| 232 | - if($sender_srl && $sender_log) |
|
| 232 | + if ($sender_srl && $sender_log) |
|
| 233 | 233 | { |
| 234 | 234 | $output = executeQuery('communication.sendMessage', $sender_args); |
| 235 | - if(!$output->toBool()) |
|
| 235 | + if (!$output->toBool()) |
|
| 236 | 236 | { |
| 237 | 237 | $oDB->rollback(); |
| 238 | 238 | return $output; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | // messages to save in the receiver's message box |
| 243 | 243 | $output = executeQuery('communication.sendMessage', $receiver_args); |
| 244 | - if(!$output->toBool()) |
|
| 244 | + if (!$output->toBool()) |
|
| 245 | 245 | { |
| 246 | 246 | $oDB->rollback(); |
| 247 | 247 | return $output; |
@@ -249,14 +249,14 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | // Call a trigger (after) |
| 251 | 251 | $trigger_output = ModuleHandler::triggerCall('communication.sendMessage', 'after', $trigger_obj); |
| 252 | - if(!$trigger_output->toBool()) |
|
| 252 | + if (!$trigger_output->toBool()) |
|
| 253 | 253 | { |
| 254 | 254 | $oDB->rollback(); |
| 255 | 255 | return $trigger_output; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // create a flag that message is sent (in file format) |
| 259 | - $flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($receiver_srl); |
|
| 259 | + $flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($receiver_srl); |
|
| 260 | 260 | FileHandler::makeDir($flag_path); |
| 261 | 261 | $flag_file = sprintf('%s%s', $flag_path, $receiver_srl); |
| 262 | 262 | $flag_count = FileHandler::readFile($flag_file); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | function procCommunicationStoreMessage() |
| 278 | 278 | { |
| 279 | 279 | // Check login information |
| 280 | - if(!Context::get('is_logged')) |
|
| 280 | + if (!Context::get('is_logged')) |
|
| 281 | 281 | { |
| 282 | 282 | return new BaseObject(-1, 'msg_not_logged'); |
| 283 | 283 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | // Check variable |
| 287 | 287 | $message_srl = Context::get('message_srl'); |
| 288 | - if(!$message_srl) |
|
| 288 | + if (!$message_srl) |
|
| 289 | 289 | { |
| 290 | 290 | return new BaseObject(-1, 'msg_invalid_request'); |
| 291 | 291 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | // get the message |
| 294 | 294 | $oCommunicationModel = getModel('communication'); |
| 295 | 295 | $message = $oCommunicationModel->getSelectedMessage($message_srl); |
| 296 | - if(!$message || $message->message_type != 'R') |
|
| 296 | + if (!$message || $message->message_type != 'R') |
|
| 297 | 297 | { |
| 298 | 298 | return new BaseObject(-1, 'msg_invalid_request'); |
| 299 | 299 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $args->message_srl = $message_srl; |
| 303 | 303 | $args->receiver_srl = $logged_info->member_srl; |
| 304 | 304 | $output = executeQuery('communication.setMessageStored', $args); |
| 305 | - if(!$output->toBool()) |
|
| 305 | + if (!$output->toBool()) |
|
| 306 | 306 | { |
| 307 | 307 | return $output; |
| 308 | 308 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | function procCommunicationDeleteMessage() |
| 318 | 318 | { |
| 319 | 319 | // Check login information |
| 320 | - if(!Context::get('is_logged')) |
|
| 320 | + if (!Context::get('is_logged')) |
|
| 321 | 321 | { |
| 322 | 322 | return new BaseObject(-1, 'msg_not_logged'); |
| 323 | 323 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | // Check the variable |
| 329 | 329 | $message_srl = Context::get('message_srl'); |
| 330 | - if(!$message_srl) |
|
| 330 | + if (!$message_srl) |
|
| 331 | 331 | { |
| 332 | 332 | return new BaseObject(-1, 'msg_invalid_request'); |
| 333 | 333 | } |
@@ -335,23 +335,23 @@ discard block |
||
| 335 | 335 | // Get the message |
| 336 | 336 | $oCommunicationModel = getModel('communication'); |
| 337 | 337 | $message = $oCommunicationModel->getSelectedMessage($message_srl); |
| 338 | - if(!$message) |
|
| 338 | + if (!$message) |
|
| 339 | 339 | { |
| 340 | 340 | return new BaseObject(-1, 'msg_invalid_request'); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | // Check the grant |
| 344 | - switch($message->message_type) |
|
| 344 | + switch ($message->message_type) |
|
| 345 | 345 | { |
| 346 | 346 | case 'S': |
| 347 | - if($message->sender_srl != $member_srl) |
|
| 347 | + if ($message->sender_srl != $member_srl) |
|
| 348 | 348 | { |
| 349 | 349 | return new BaseObject(-1, 'msg_invalid_request'); |
| 350 | 350 | } |
| 351 | 351 | break; |
| 352 | 352 | |
| 353 | 353 | case 'R': |
| 354 | - if($message->receiver_srl != $member_srl) |
|
| 354 | + if ($message->receiver_srl != $member_srl) |
|
| 355 | 355 | { |
| 356 | 356 | return new BaseObject(-1, 'msg_invalid_request'); |
| 357 | 357 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $args = new stdClass(); |
| 363 | 363 | $args->message_srl = $message_srl; |
| 364 | 364 | $output = executeQuery('communication.deleteMessage', $args); |
| 365 | - if(!$output->toBool()) |
|
| 365 | + if (!$output->toBool()) |
|
| 366 | 366 | { |
| 367 | 367 | return $output; |
| 368 | 368 | } |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | function procCommunicationDeleteMessages() |
| 378 | 378 | { |
| 379 | 379 | // Check login information |
| 380 | - if(!Context::get('is_logged')) |
|
| 380 | + if (!Context::get('is_logged')) |
|
| 381 | 381 | { |
| 382 | 382 | return new BaseObject(-1, 'msg_not_logged'); |
| 383 | 383 | } |
@@ -386,41 +386,41 @@ discard block |
||
| 386 | 386 | $member_srl = $logged_info->member_srl; |
| 387 | 387 | |
| 388 | 388 | // check variables |
| 389 | - if(!Context::get('message_srl_list')) |
|
| 389 | + if (!Context::get('message_srl_list')) |
|
| 390 | 390 | { |
| 391 | 391 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $message_srl_list = Context::get('message_srl_list'); |
| 395 | - if(!is_array($message_srl_list)) |
|
| 395 | + if (!is_array($message_srl_list)) |
|
| 396 | 396 | { |
| 397 | 397 | $message_srl_list = explode('|@|', trim($message_srl_list)); |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - if(!count($message_srl_list)) |
|
| 400 | + if (!count($message_srl_list)) |
|
| 401 | 401 | { |
| 402 | 402 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | $message_type = Context::get('message_type'); |
| 406 | - if(!$message_type || !in_array($message_type, array('R', 'S', 'T'))) |
|
| 406 | + if (!$message_type || !in_array($message_type, array('R', 'S', 'T'))) |
|
| 407 | 407 | { |
| 408 | 408 | return new BaseObject(-1, 'msg_invalid_request'); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | $message_count = count($message_srl_list); |
| 412 | 412 | $target = array(); |
| 413 | - for($i = 0; $i < $message_count; $i++) |
|
| 413 | + for ($i = 0; $i < $message_count; $i++) |
|
| 414 | 414 | { |
| 415 | 415 | $message_srl = (int) trim($message_srl_list[$i]); |
| 416 | - if(!$message_srl) |
|
| 416 | + if (!$message_srl) |
|
| 417 | 417 | { |
| 418 | 418 | continue; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | $target[] = $message_srl; |
| 422 | 422 | } |
| 423 | - if(!count($target)) |
|
| 423 | + if (!count($target)) |
|
| 424 | 424 | { |
| 425 | 425 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 426 | 426 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $args->message_srls = implode(',', $target); |
| 431 | 431 | $args->message_type = $message_type; |
| 432 | 432 | |
| 433 | - if($message_type == 'S') |
|
| 433 | + if ($message_type == 'S') |
|
| 434 | 434 | { |
| 435 | 435 | $args->sender_srl = $member_srl; |
| 436 | 436 | } |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $output = executeQuery('communication.deleteMessages', $args); |
| 443 | - if(!$output->toBool()) |
|
| 443 | + if (!$output->toBool()) |
|
| 444 | 444 | { |
| 445 | 445 | return $output; |
| 446 | 446 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | function procCommunicationAddFriend() |
| 459 | 459 | { |
| 460 | 460 | // Check login information |
| 461 | - if(!Context::get('is_logged')) |
|
| 461 | + if (!Context::get('is_logged')) |
|
| 462 | 462 | { |
| 463 | 463 | return new BaseObject(-1, 'msg_not_logged'); |
| 464 | 464 | } |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | $logged_info = Context::get('logged_info'); |
| 467 | 467 | |
| 468 | 468 | $target_srl = (int) trim(Context::get('target_srl')); |
| 469 | - if(!$target_srl) |
|
| 469 | + if (!$target_srl) |
|
| 470 | 470 | { |
| 471 | 471 | return new BaseObject(-1, 'msg_invalid_request'); |
| 472 | 472 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $args->member_srl = $logged_info->member_srl; |
| 480 | 480 | $args->target_srl = $target_srl; |
| 481 | 481 | $output = executeQuery('communication.addFriend', $args); |
| 482 | - if(!$output->toBool()) |
|
| 482 | + if (!$output->toBool()) |
|
| 483 | 483 | { |
| 484 | 484 | return $output; |
| 485 | 485 | } |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $this->add('member_srl', $target_srl); |
| 488 | 488 | $this->setMessage('success_registed'); |
| 489 | 489 | |
| 490 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 490 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 491 | 491 | { |
| 492 | 492 | global $lang; |
| 493 | 493 | htmlHeader(); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | function procCommunicationMoveFriend() |
| 507 | 507 | { |
| 508 | 508 | // Check login information |
| 509 | - if(!Context::get('is_logged')) |
|
| 509 | + if (!Context::get('is_logged')) |
|
| 510 | 510 | { |
| 511 | 511 | return new BaseObject(-1, 'msg_not_logged'); |
| 512 | 512 | } |
@@ -515,27 +515,27 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | // Check variables |
| 517 | 517 | $friend_srl_list = Context::get('friend_srl_list'); |
| 518 | - if(!$friend_srl_list) |
|
| 518 | + if (!$friend_srl_list) |
|
| 519 | 519 | { |
| 520 | 520 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - if(!is_array($friend_srl_list)) |
|
| 523 | + if (!is_array($friend_srl_list)) |
|
| 524 | 524 | { |
| 525 | 525 | $friend_srl_list = explode('|@|', $friend_srl_list); |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - if(!count($friend_srl_list)) |
|
| 528 | + if (!count($friend_srl_list)) |
|
| 529 | 529 | { |
| 530 | 530 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | $friend_count = count($friend_srl_list); |
| 534 | 534 | $target = array(); |
| 535 | - for($i = 0; $i < $friend_count; $i++) |
|
| 535 | + for ($i = 0; $i < $friend_count; $i++) |
|
| 536 | 536 | { |
| 537 | 537 | $friend_srl = (int) trim($friend_srl_list[$i]); |
| 538 | - if(!$friend_srl) |
|
| 538 | + if (!$friend_srl) |
|
| 539 | 539 | { |
| 540 | 540 | continue; |
| 541 | 541 | } |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | $target[] = $friend_srl; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - if(!count($target)) |
|
| 546 | + if (!count($target)) |
|
| 547 | 547 | { |
| 548 | 548 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 549 | 549 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | $args->friend_group_srl = Context::get('target_friend_group_srl'); |
| 556 | 556 | |
| 557 | 557 | $output = executeQuery('communication.moveFriend', $args); |
| 558 | - if(!$output->toBool()) |
|
| 558 | + if (!$output->toBool()) |
|
| 559 | 559 | { |
| 560 | 560 | return $output; |
| 561 | 561 | } |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | function procCommunicationDeleteFriend() |
| 574 | 574 | { |
| 575 | 575 | // Check login information |
| 576 | - if(!Context::get('is_logged')) |
|
| 576 | + if (!Context::get('is_logged')) |
|
| 577 | 577 | { |
| 578 | 578 | return new BaseObject(-1, 'msg_not_logged'); |
| 579 | 579 | } |
@@ -584,12 +584,12 @@ discard block |
||
| 584 | 584 | // Check variables |
| 585 | 585 | $friend_srl_list = Context::get('friend_srl_list'); |
| 586 | 586 | |
| 587 | - if(!is_array($friend_srl_list)) |
|
| 587 | + if (!is_array($friend_srl_list)) |
|
| 588 | 588 | { |
| 589 | 589 | $friend_srl_list = explode('|@|', $friend_srl_list); |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - if(!count($friend_srl_list)) |
|
| 592 | + if (!count($friend_srl_list)) |
|
| 593 | 593 | { |
| 594 | 594 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 595 | 595 | } |
@@ -597,10 +597,10 @@ discard block |
||
| 597 | 597 | $friend_count = count($friend_srl_list); |
| 598 | 598 | $target = array(); |
| 599 | 599 | |
| 600 | - for($i = 0; $i < $friend_count; $i++) |
|
| 600 | + for ($i = 0; $i < $friend_count; $i++) |
|
| 601 | 601 | { |
| 602 | 602 | $friend_srl = (int) trim($friend_srl_list[$i]); |
| 603 | - if(!$friend_srl) |
|
| 603 | + if (!$friend_srl) |
|
| 604 | 604 | { |
| 605 | 605 | continue; |
| 606 | 606 | } |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | $target[] = $friend_srl; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if(!count($target)) |
|
| 611 | + if (!count($target)) |
|
| 612 | 612 | { |
| 613 | 613 | return new BaseObject(-1, 'msg_cart_is_null'); |
| 614 | 614 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | $args->friend_srls = implode(',', $target); |
| 619 | 619 | $args->member_srl = $logged_info->member_srl; |
| 620 | 620 | $output = executeQuery('communication.deleteFriend', $args); |
| 621 | - if(!$output->toBool()) |
|
| 621 | + if (!$output->toBool()) |
|
| 622 | 622 | { |
| 623 | 623 | return $output; |
| 624 | 624 | } |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | function procCommunicationAddFriendGroup() |
| 637 | 637 | { |
| 638 | 638 | // Check login information |
| 639 | - if(!Context::get('is_logged')) |
|
| 639 | + if (!Context::get('is_logged')) |
|
| 640 | 640 | { |
| 641 | 641 | return new BaseObject(-1, 'msg_not_logged'); |
| 642 | 642 | } |
@@ -650,13 +650,13 @@ discard block |
||
| 650 | 650 | $args->title = Context::get('title'); |
| 651 | 651 | $args->title = htmlspecialchars($args->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 652 | 652 | |
| 653 | - if(!$args->title) |
|
| 653 | + if (!$args->title) |
|
| 654 | 654 | { |
| 655 | 655 | return new BaseObject(-1, 'msg_invalid_request'); |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // modify if friend_group_srl exists. |
| 659 | - if($args->friend_group_srl) |
|
| 659 | + if ($args->friend_group_srl) |
|
| 660 | 660 | { |
| 661 | 661 | $output = executeQuery('communication.renameFriendGroup', $args); |
| 662 | 662 | $msg_code = 'success_updated'; |
@@ -668,9 +668,9 @@ discard block |
||
| 668 | 668 | $msg_code = 'success_registed'; |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - if(!$output->toBool()) |
|
| 671 | + if (!$output->toBool()) |
|
| 672 | 672 | { |
| 673 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 673 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 674 | 674 | { |
| 675 | 675 | global $lang; |
| 676 | 676 | htmlHeader(); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | } |
| 688 | 688 | else |
| 689 | 689 | { |
| 690 | - if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 690 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 691 | 691 | { |
| 692 | 692 | global $lang; |
| 693 | 693 | htmlHeader(); |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | function procCommunicationRenameFriendGroup() |
| 713 | 713 | { |
| 714 | 714 | // Check login information |
| 715 | - if(!Context::get('is_logged')) |
|
| 715 | + if (!Context::get('is_logged')) |
|
| 716 | 716 | { |
| 717 | 717 | return new BaseObject(-1, 'msg_not_logged'); |
| 718 | 718 | } |
@@ -726,13 +726,13 @@ discard block |
||
| 726 | 726 | $args->title = Context::get('title'); |
| 727 | 727 | $args->title = htmlspecialchars($args->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 728 | 728 | |
| 729 | - if(!$args->title) |
|
| 729 | + if (!$args->title) |
|
| 730 | 730 | { |
| 731 | 731 | return new BaseObject(-1, 'msg_invalid_request'); |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | $output = executeQuery('communication.renameFriendGroup', $args); |
| 735 | - if(!$output->toBool()) |
|
| 735 | + if (!$output->toBool()) |
|
| 736 | 736 | { |
| 737 | 737 | return $output; |
| 738 | 738 | } |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | function procCommunicationDeleteFriendGroup() |
| 748 | 748 | { |
| 749 | 749 | // Check login information |
| 750 | - if(!Context::get('is_logged')) |
|
| 750 | + if (!Context::get('is_logged')) |
|
| 751 | 751 | { |
| 752 | 752 | return new BaseObject(-1, 'msg_not_logged'); |
| 753 | 753 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | $args->friend_group_srl = Context::get('friend_group_srl'); |
| 760 | 760 | $args->member_srl = $logged_info->member_srl; |
| 761 | 761 | $output = executeQuery('communication.deleteFriendGroup', $args); |
| 762 | - if(!$output->toBool()) |
|
| 762 | + if (!$output->toBool()) |
|
| 763 | 763 | { |
| 764 | 764 | return $output; |
| 765 | 765 | } |
@@ -110,8 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | return new BaseObject(-1, 'msg_allow_message_to_friend'); |
| 112 | 112 | } |
| 113 | - } |
|
| 114 | - else if($receiver_member_info->allow_message == 'N') |
|
| 113 | + } else if($receiver_member_info->allow_message == 'N') |
|
| 115 | 114 | { |
| 116 | 115 | return new BaseObject(-1, 'msg_disallow_message'); |
| 117 | 116 | } |
@@ -151,8 +150,7 @@ discard block |
||
| 151 | 150 | htmlFooter(); |
| 152 | 151 | Context::close(); |
| 153 | 152 | exit; |
| 154 | - } |
|
| 155 | - else |
|
| 153 | + } else |
|
| 156 | 154 | { |
| 157 | 155 | $this->setMessage('success_sended'); |
| 158 | 156 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('act', 'dispCommunicationMessages', 'message_type', 'S', 'message_srl', $message_srl); |
@@ -433,8 +431,7 @@ discard block |
||
| 433 | 431 | if($message_type == 'S') |
| 434 | 432 | { |
| 435 | 433 | $args->sender_srl = $member_srl; |
| 436 | - } |
|
| 437 | - else |
|
| 434 | + } else |
|
| 438 | 435 | { |
| 439 | 436 | $args->receiver_srl = $member_srl; |
| 440 | 437 | } |
@@ -661,8 +658,7 @@ discard block |
||
| 661 | 658 | $output = executeQuery('communication.renameFriendGroup', $args); |
| 662 | 659 | $msg_code = 'success_updated'; |
| 663 | 660 | // add if not exists |
| 664 | - } |
|
| 665 | - else |
|
| 661 | + } else |
|
| 666 | 662 | { |
| 667 | 663 | $output = executeQuery('communication.addFriendGroup', $args); |
| 668 | 664 | $msg_code = 'success_registed'; |
@@ -679,13 +675,11 @@ discard block |
||
| 679 | 675 | htmlFooter(); |
| 680 | 676 | Context::close(); |
| 681 | 677 | exit; |
| 682 | - } |
|
| 683 | - else |
|
| 678 | + } else |
|
| 684 | 679 | { |
| 685 | 680 | return $output; |
| 686 | 681 | } |
| 687 | - } |
|
| 688 | - else |
|
| 682 | + } else |
|
| 689 | 683 | { |
| 690 | 684 | if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
| 691 | 685 | { |
@@ -697,8 +691,7 @@ discard block |
||
| 697 | 691 | htmlFooter(); |
| 698 | 692 | Context::close(); |
| 699 | 693 | exit; |
| 700 | - } |
|
| 701 | - else |
|
| 694 | + } else |
|
| 702 | 695 | { |
| 703 | 696 | $this->setMessage($msg_code); |
| 704 | 697 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
| 164 | 164 | static $theInstance = null; |
| 165 | - if(!$theInstance) |
|
| 165 | + if (!$theInstance) |
|
| 166 | 166 | { |
| 167 | 167 | $theInstance = new Context(); |
| 168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // include ssl action cache file |
| 184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
| 185 | - if(is_readable($this->sslActionCacheFile)) |
|
| 185 | + if (is_readable($this->sslActionCacheFile)) |
|
| 186 | 186 | { |
| 187 | 187 | require($this->sslActionCacheFile); |
| 188 | - if(isset($sslActions)) |
|
| 188 | + if (isset($sslActions)) |
|
| 189 | 189 | { |
| 190 | 190 | $this->ssl_actions = $sslActions; |
| 191 | 191 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | function init() |
| 202 | 202 | { |
| 203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
| 204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 205 | 205 | { |
| 206 | 206 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
| 207 | 207 | |
| 208 | 208 | // If content is not XML JSON, unset |
| 209 | - if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 209 | + if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 210 | 210 | { |
| 211 | 211 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
| 212 | 212 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | $this->_setUploadedArgument(); |
| 229 | 229 | |
| 230 | 230 | $this->loadDBInfo(); |
| 231 | - if($this->db_info->use_sitelock == 'Y') |
|
| 231 | + if ($this->db_info->use_sitelock == 'Y') |
|
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 234 | 234 | |
| 235 | - if(!IpFilter::filter($whitelist)) |
|
| 235 | + if (!IpFilter::filter($whitelist)) |
|
| 236 | 236 | { |
| 237 | 237 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
| 238 | 238 | $message = $this->db_info->sitelock_message; |
@@ -242,52 +242,52 @@ discard block |
||
| 242 | 242 | define('_XE_SITELOCK_MESSAGE_', $message); |
| 243 | 243 | |
| 244 | 244 | header("HTTP/1.1 403 Forbidden"); |
| 245 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 245 | + if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html')) |
|
| 246 | 246 | { |
| 247 | - include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
|
| 247 | + include _XE_PATH_.'common/tpl/sitelock.user.html'; |
|
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | - include _XE_PATH_ . 'common/tpl/sitelock.html'; |
|
| 251 | + include _XE_PATH_.'common/tpl/sitelock.html'; |
|
| 252 | 252 | } |
| 253 | 253 | exit; |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // If XE is installed, get virtual site information |
| 258 | - if(self::isInstalled()) |
|
| 258 | + if (self::isInstalled()) |
|
| 259 | 259 | { |
| 260 | 260 | $oModuleModel = getModel('module'); |
| 261 | 261 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 262 | 262 | |
| 263 | - if(!isset($site_module_info)) |
|
| 263 | + if (!isset($site_module_info)) |
|
| 264 | 264 | { |
| 265 | 265 | $site_module_info = new stdClass(); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
| 269 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 269 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 270 | 270 | { |
| 271 | 271 | $site_module_info->domain = $this->db_info->default_url; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $this->set('site_module_info', $site_module_info); |
| 275 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 275 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 276 | 276 | { |
| 277 | 277 | $this->set('vid', $site_module_info->domain, TRUE); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if(!isset($this->db_info)) |
|
| 280 | + if (!isset($this->db_info)) |
|
| 281 | 281 | { |
| 282 | 282 | $this->db_info = new stdClass(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $this->db_info->lang_type = $site_module_info->default_language; |
| 286 | - if(!$this->db_info->lang_type) |
|
| 286 | + if (!$this->db_info->lang_type) |
|
| 287 | 287 | { |
| 288 | 288 | $this->db_info->lang_type = 'en'; |
| 289 | 289 | } |
| 290 | - if(!$this->db_info->use_db_session) |
|
| 290 | + if (!$this->db_info->use_db_session) |
|
| 291 | 291 | { |
| 292 | 292 | $this->db_info->use_db_session = 'N'; |
| 293 | 293 | } |
@@ -297,30 +297,30 @@ discard block |
||
| 297 | 297 | $lang_supported = $this->loadLangSelected(); |
| 298 | 298 | |
| 299 | 299 | // Retrieve language type set in user's cookie |
| 300 | - if($this->lang_type = $this->get('l')) |
|
| 300 | + if ($this->lang_type = $this->get('l')) |
|
| 301 | 301 | { |
| 302 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
| 302 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
| 303 | 303 | { |
| 304 | 304 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + elseif ($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // If it's not exists, follow default language type set in db_info |
| 313 | - if(!$this->lang_type) |
|
| 313 | + if (!$this->lang_type) |
|
| 314 | 314 | { |
| 315 | 315 | $this->lang_type = $this->db_info->lang_type; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // if still lang_type has not been set or has not-supported type , set as English. |
| 319 | - if(!$this->lang_type) |
|
| 319 | + if (!$this->lang_type) |
|
| 320 | 320 | { |
| 321 | 321 | $this->lang_type = 'en'; |
| 322 | 322 | } |
| 323 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 323 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 324 | 324 | { |
| 325 | 325 | $this->lang_type = 'en'; |
| 326 | 326 | } |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | $this->setLangType($this->lang_type); |
| 330 | 330 | |
| 331 | 331 | // load module module's language file according to language setting |
| 332 | - $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
|
| 332 | + $this->loadLang(_XE_PATH_.'modules/module/lang'); |
|
| 333 | 333 | |
| 334 | 334 | // set session handler |
| 335 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 335 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 336 | 336 | { |
| 337 | 337 | $oSessionModel = getModel('session'); |
| 338 | 338 | $oSessionController = getController('session'); |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 345 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
| 346 | 346 | session_start(); |
| 347 | 347 | |
| 348 | 348 | // set authentication information in Context and session |
| 349 | - if(self::isInstalled()) |
|
| 349 | + if (self::isInstalled()) |
|
| 350 | 350 | { |
| 351 | 351 | $oModuleModel = getModel('module'); |
| 352 | 352 | $oModuleModel->loadModuleExtends(); |
@@ -354,15 +354,15 @@ discard block |
||
| 354 | 354 | $oMemberModel = getModel('member'); |
| 355 | 355 | $oMemberController = getController('member'); |
| 356 | 356 | |
| 357 | - if($oMemberController && $oMemberModel) |
|
| 357 | + if ($oMemberController && $oMemberModel) |
|
| 358 | 358 | { |
| 359 | 359 | // if signed in, validate it. |
| 360 | - if($oMemberModel->isLogged()) |
|
| 360 | + if ($oMemberModel->isLogged()) |
|
| 361 | 361 | { |
| 362 | 362 | $oMemberController->setSessionInfo(); |
| 363 | 363 | } |
| 364 | 364 | // check auto sign-in |
| 365 | - elseif($_COOKIE['xeak']) |
|
| 365 | + elseif ($_COOKIE['xeak']) |
|
| 366 | 366 | { |
| 367 | 367 | $oMemberController->doAutologin(); |
| 368 | 368 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | // load common language file |
| 376 | 376 | $this->lang = &$GLOBALS['lang']; |
| 377 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
| 377 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
| 378 | 378 | |
| 379 | 379 | // check if using rewrite module |
| 380 | 380 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -382,28 +382,28 @@ discard block |
||
| 382 | 382 | // set locations for javascript use |
| 383 | 383 | $url = array(); |
| 384 | 384 | $current_url = self::getRequestUri(); |
| 385 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 385 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 386 | 386 | { |
| 387 | - if($this->get_vars) |
|
| 387 | + if ($this->get_vars) |
|
| 388 | 388 | { |
| 389 | 389 | $url = array(); |
| 390 | - foreach($this->get_vars as $key => $val) |
|
| 390 | + foreach ($this->get_vars as $key => $val) |
|
| 391 | 391 | { |
| 392 | - if(is_array($val) && count($val) > 0) |
|
| 392 | + if (is_array($val) && count($val) > 0) |
|
| 393 | 393 | { |
| 394 | - foreach($val as $k => $v) |
|
| 394 | + foreach ($val as $k => $v) |
|
| 395 | 395 | { |
| 396 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 396 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | - elseif($val) |
|
| 399 | + elseif ($val) |
|
| 400 | 400 | { |
| 401 | - $url[] = $key . '=' . urlencode($val); |
|
| 401 | + $url[] = $key.'='.urlencode($val); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | $current_url = self::getRequestUri(); |
| 406 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 406 | + if ($url) $current_url .= '?'.join('&', $url); |
|
| 407 | 407 | } |
| 408 | 408 | else |
| 409 | 409 | { |
@@ -418,12 +418,12 @@ discard block |
||
| 418 | 418 | $this->set('current_url', $current_url); |
| 419 | 419 | $this->set('request_uri', self::getRequestUri()); |
| 420 | 420 | |
| 421 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
| 421 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
| 422 | 422 | { |
| 423 | 423 | $this->set('current_url', self::decodeIdna($current_url)); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 426 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 427 | 427 | { |
| 428 | 428 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
| 429 | 429 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | { |
| 449 | 449 | $self = self::getInstance(); |
| 450 | 450 | |
| 451 | - if(!$self->isInstalled()) |
|
| 451 | + if (!$self->isInstalled()) |
|
| 452 | 452 | { |
| 453 | 453 | return; |
| 454 | 454 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | ob_end_clean(); |
| 459 | 459 | |
| 460 | 460 | // If master_db information does not exist, the config file needs to be updated |
| 461 | - if(!isset($db_info->master_db)) |
|
| 461 | + if (!isset($db_info->master_db)) |
|
| 462 | 462 | { |
| 463 | 463 | $db_info->master_db = array(); |
| 464 | 464 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 477 | 477 | unset($db_info->db_table_prefix); |
| 478 | 478 | |
| 479 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 479 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 480 | 480 | { |
| 481 | 481 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 482 | 482 | } |
@@ -488,42 +488,42 @@ discard block |
||
| 488 | 488 | $oInstallController->makeConfigFile(); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | - if(version_compare(PHP_VERSION, '7.0', '>=')) |
|
| 491 | + if (version_compare(PHP_VERSION, '7.0', '>=')) |
|
| 492 | 492 | { |
| 493 | 493 | $db_info->master_db["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $db_info->master_db["db_type"]); |
| 494 | - foreach($db_info->slave_db as &$slave_db_info) |
|
| 494 | + foreach ($db_info->slave_db as &$slave_db_info) |
|
| 495 | 495 | { |
| 496 | 496 | $slave_db_info["db_type"] = preg_replace('/^mysql(_.+)?$/', 'mysqli$1', $slave_db_info["db_type"]); |
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if(!$db_info->use_prepared_statements) |
|
| 500 | + if (!$db_info->use_prepared_statements) |
|
| 501 | 501 | { |
| 502 | 502 | $db_info->use_prepared_statements = 'Y'; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if(!$db_info->time_zone) |
|
| 505 | + if (!$db_info->time_zone) |
|
| 506 | 506 | $db_info->time_zone = date('O'); |
| 507 | 507 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 508 | 508 | |
| 509 | - if($db_info->qmail_compatibility != 'Y') |
|
| 509 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 510 | 510 | $db_info->qmail_compatibility = 'N'; |
| 511 | 511 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 512 | 512 | |
| 513 | - if(!$db_info->use_db_session) |
|
| 513 | + if (!$db_info->use_db_session) |
|
| 514 | 514 | $db_info->use_db_session = 'N'; |
| 515 | - if(!$db_info->use_ssl) |
|
| 515 | + if (!$db_info->use_ssl) |
|
| 516 | 516 | $db_info->use_ssl = 'none'; |
| 517 | 517 | $this->set('_use_ssl', $db_info->use_ssl); |
| 518 | 518 | |
| 519 | 519 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 520 | 520 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 521 | 521 | |
| 522 | - if(!$db_info->sitelock_whitelist) { |
|
| 522 | + if (!$db_info->sitelock_whitelist) { |
|
| 523 | 523 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 526 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 527 | 527 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 528 | 528 | } |
| 529 | 529 | |
@@ -594,10 +594,10 @@ discard block |
||
| 594 | 594 | function loadLangSupported() |
| 595 | 595 | { |
| 596 | 596 | static $lang_supported = null; |
| 597 | - if(!$lang_supported) |
|
| 597 | + if (!$lang_supported) |
|
| 598 | 598 | { |
| 599 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
| 600 | - foreach($langs as $val) |
|
| 599 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
| 600 | + foreach ($langs as $val) |
|
| 601 | 601 | { |
| 602 | 602 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 603 | 603 | $lang_text = trim($lang_text); |
@@ -615,17 +615,17 @@ discard block |
||
| 615 | 615 | function loadLangSelected() |
| 616 | 616 | { |
| 617 | 617 | static $lang_selected = null; |
| 618 | - if(!$lang_selected) |
|
| 618 | + if (!$lang_selected) |
|
| 619 | 619 | { |
| 620 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
| 621 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
| 622 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 620 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
| 621 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
| 622 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 623 | 623 | { |
| 624 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
| 624 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
| 625 | 625 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 628 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 629 | 629 | { |
| 630 | 630 | $buff = FileHandler::readFile($orig_lang_file); |
| 631 | 631 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | else |
| 635 | 635 | { |
| 636 | 636 | $langs = file($selected_lang_file); |
| 637 | - foreach($langs as $val) |
|
| 637 | + foreach ($langs as $val) |
|
| 638 | 638 | { |
| 639 | 639 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 640 | 640 | $lang_text = trim($lang_text); |
@@ -653,56 +653,56 @@ discard block |
||
| 653 | 653 | function checkSSO() |
| 654 | 654 | { |
| 655 | 655 | // pass if it's not GET request or XE is not yet installed |
| 656 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 656 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 657 | 657 | { |
| 658 | 658 | return TRUE; |
| 659 | 659 | } |
| 660 | 660 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 661 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 661 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 662 | 662 | { |
| 663 | 663 | return TRUE; |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | // pass if default URL is not set |
| 667 | 667 | $default_url = trim($this->db_info->default_url); |
| 668 | - if(!$default_url) |
|
| 668 | + if (!$default_url) |
|
| 669 | 669 | { |
| 670 | 670 | return TRUE; |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 673 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 674 | 674 | { |
| 675 | 675 | $default_url .= '/'; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // for sites recieving SSO valdiation |
| 679 | - if($default_url == self::getRequestUri()) |
|
| 679 | + if ($default_url == self::getRequestUri()) |
|
| 680 | 680 | { |
| 681 | - if(self::get('url')) |
|
| 681 | + if (self::get('url')) |
|
| 682 | 682 | { |
| 683 | 683 | $url = base64_decode(self::get('url')); |
| 684 | 684 | $url_info = parse_url($url); |
| 685 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
| 685 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
| 686 | 686 | { |
| 687 | 687 | echo self::get('lang')->msg_invalid_request; |
| 688 | 688 | return false; |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | $oModuleModel = getModel('module'); |
| 692 | - $domain = $url_info['host'] . $url_info['path']; |
|
| 693 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 692 | + $domain = $url_info['host'].$url_info['path']; |
|
| 693 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 694 | 694 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
| 695 | 695 | |
| 696 | - if($site_info->site_srl) |
|
| 696 | + if ($site_info->site_srl) |
|
| 697 | 697 | { |
| 698 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
| 699 | - $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 698 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
| 699 | + $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 700 | 700 | } |
| 701 | 701 | else |
| 702 | 702 | { |
| 703 | 703 | $redirect_url = $url; |
| 704 | 704 | } |
| 705 | - header('location:' . $redirect_url); |
|
| 705 | + header('location:'.$redirect_url); |
|
| 706 | 706 | |
| 707 | 707 | return FALSE; |
| 708 | 708 | } |
@@ -711,9 +711,9 @@ discard block |
||
| 711 | 711 | else |
| 712 | 712 | { |
| 713 | 713 | // result handling : set session_name() |
| 714 | - if($session_name = self::get('SSOID')) |
|
| 714 | + if ($session_name = self::get('SSOID')) |
|
| 715 | 715 | { |
| 716 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
| 716 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
| 717 | 717 | { |
| 718 | 718 | echo self::get('lang')->msg_invalid_request; |
| 719 | 719 | return false; |
@@ -722,17 +722,17 @@ discard block |
||
| 722 | 722 | setcookie(session_name(), $session_name); |
| 723 | 723 | |
| 724 | 724 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
| 725 | - header('location:' . $url); |
|
| 725 | + header('location:'.$url); |
|
| 726 | 726 | return FALSE; |
| 727 | 727 | // send SSO request |
| 728 | 728 | } |
| 729 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 729 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 730 | 730 | { |
| 731 | 731 | setcookie('sso', md5(self::getRequestUri())); |
| 732 | 732 | $origin_url = self::getRequestUrl(); |
| 733 | 733 | $origin_sig = Password::createSignature($origin_url); |
| 734 | 734 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
| 735 | - header('location:' . $url); |
|
| 735 | + header('location:'.$url); |
|
| 736 | 736 | return FALSE; |
| 737 | 737 | } |
| 738 | 738 | } |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | { |
| 760 | 760 | $self = self::getInstance(); |
| 761 | 761 | |
| 762 | - if(!$self->isFTPRegisted()) |
|
| 762 | + if (!$self->isFTPRegisted()) |
|
| 763 | 763 | { |
| 764 | 764 | return null; |
| 765 | 765 | } |
@@ -777,15 +777,15 @@ discard block |
||
| 777 | 777 | */ |
| 778 | 778 | function addBrowserTitle($site_title) |
| 779 | 779 | { |
| 780 | - if(!$site_title) |
|
| 780 | + if (!$site_title) |
|
| 781 | 781 | { |
| 782 | 782 | return; |
| 783 | 783 | } |
| 784 | 784 | $self = self::getInstance(); |
| 785 | 785 | |
| 786 | - if($self->site_title) |
|
| 786 | + if ($self->site_title) |
|
| 787 | 787 | { |
| 788 | - $self->site_title .= ' - ' . $site_title; |
|
| 788 | + $self->site_title .= ' - '.$site_title; |
|
| 789 | 789 | } |
| 790 | 790 | else |
| 791 | 791 | { |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | */ |
| 802 | 802 | function setBrowserTitle($site_title) |
| 803 | 803 | { |
| 804 | - if(!$site_title) |
|
| 804 | + if (!$site_title) |
|
| 805 | 805 | { |
| 806 | 806 | return; |
| 807 | 807 | } |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | $oModuleModel = getModel('module'); |
| 834 | 834 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 835 | 835 | |
| 836 | - if(isset($moduleConfig->siteTitle)) |
|
| 836 | + if (isset($moduleConfig->siteTitle)) |
|
| 837 | 837 | { |
| 838 | 838 | return $moduleConfig->siteTitle; |
| 839 | 839 | } |
@@ -860,30 +860,30 @@ discard block |
||
| 860 | 860 | global $lang; |
| 861 | 861 | |
| 862 | 862 | $self = self::getInstance(); |
| 863 | - if(!$self->lang_type) |
|
| 863 | + if (!$self->lang_type) |
|
| 864 | 864 | { |
| 865 | 865 | return; |
| 866 | 866 | } |
| 867 | - if(!is_object($lang)) |
|
| 867 | + if (!is_object($lang)) |
|
| 868 | 868 | { |
| 869 | 869 | $lang = new stdClass; |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 872 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 873 | 873 | { |
| 874 | 874 | $filename = $self->_loadPhpLang($path); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - if(!is_array($self->loaded_lang_files)) |
|
| 877 | + if (!is_array($self->loaded_lang_files)) |
|
| 878 | 878 | { |
| 879 | 879 | $self->loaded_lang_files = array(); |
| 880 | 880 | } |
| 881 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 881 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 882 | 882 | { |
| 883 | 883 | return; |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | - if($filename && is_readable($filename)) |
|
| 886 | + if ($filename && is_readable($filename)) |
|
| 887 | 887 | { |
| 888 | 888 | $self->loaded_lang_files[] = $filename; |
| 889 | 889 | include($filename); |
@@ -904,24 +904,24 @@ discard block |
||
| 904 | 904 | { |
| 905 | 905 | global $lang; |
| 906 | 906 | |
| 907 | - if(!$path) return; |
|
| 907 | + if (!$path) return; |
|
| 908 | 908 | |
| 909 | - $_path = 'eval://' . $path; |
|
| 909 | + $_path = 'eval://'.$path; |
|
| 910 | 910 | |
| 911 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 911 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 912 | 912 | { |
| 913 | 913 | return; |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 916 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 917 | 917 | { |
| 918 | 918 | $path .= '/'; |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
| 921 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
| 922 | 922 | $content = $oXmlLangParser->getCompileContent(); |
| 923 | 923 | |
| 924 | - if($content) |
|
| 924 | + if ($content) |
|
| 925 | 925 | { |
| 926 | 926 | $this->loaded_lang_files[] = $_path; |
| 927 | 927 | eval($content); |
@@ -936,9 +936,9 @@ discard block |
||
| 936 | 936 | */ |
| 937 | 937 | function _loadXmlLang($path) |
| 938 | 938 | { |
| 939 | - if(!$path) return; |
|
| 939 | + if (!$path) return; |
|
| 940 | 940 | |
| 941 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
| 941 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
| 942 | 942 | return $oXmlLangParser->compile(); |
| 943 | 943 | } |
| 944 | 944 | |
@@ -950,22 +950,22 @@ discard block |
||
| 950 | 950 | */ |
| 951 | 951 | function _loadPhpLang($path) |
| 952 | 952 | { |
| 953 | - if(!$path) return; |
|
| 953 | + if (!$path) return; |
|
| 954 | 954 | |
| 955 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 955 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 956 | 956 | { |
| 957 | 957 | $path .= '/'; |
| 958 | 958 | } |
| 959 | - $path_tpl = $path . '%s.lang.php'; |
|
| 959 | + $path_tpl = $path.'%s.lang.php'; |
|
| 960 | 960 | $file = sprintf($path_tpl, $this->lang_type); |
| 961 | 961 | |
| 962 | 962 | $langs = array('ko', 'en'); // this will be configurable. |
| 963 | - while(!is_readable($file) && $langs[0]) |
|
| 963 | + while (!is_readable($file) && $langs[0]) |
|
| 964 | 964 | { |
| 965 | 965 | $file = sprintf($path_tpl, array_shift($langs)); |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | - if(!is_readable($file)) |
|
| 968 | + if (!is_readable($file)) |
|
| 969 | 969 | { |
| 970 | 970 | return FALSE; |
| 971 | 971 | } |
@@ -1007,11 +1007,11 @@ discard block |
||
| 1007 | 1007 | */ |
| 1008 | 1008 | function getLang($code) |
| 1009 | 1009 | { |
| 1010 | - if(!$code) |
|
| 1010 | + if (!$code) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | return; |
| 1013 | 1013 | } |
| 1014 | - if($GLOBALS['lang']->{$code}) |
|
| 1014 | + if ($GLOBALS['lang']->{$code}) |
|
| 1015 | 1015 | { |
| 1016 | 1016 | return $GLOBALS['lang']->{$code}; |
| 1017 | 1017 | } |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | */ |
| 1028 | 1028 | function setLang($code, $val) |
| 1029 | 1029 | { |
| 1030 | - if(!isset($GLOBALS['lang'])) |
|
| 1030 | + if (!isset($GLOBALS['lang'])) |
|
| 1031 | 1031 | { |
| 1032 | 1032 | $GLOBALS['lang'] = new stdClass(); |
| 1033 | 1033 | } |
@@ -1052,17 +1052,17 @@ discard block |
||
| 1052 | 1052 | |
| 1053 | 1053 | $obj = clone $source_obj; |
| 1054 | 1054 | |
| 1055 | - foreach($charset_list as $charset) |
|
| 1055 | + foreach ($charset_list as $charset) |
|
| 1056 | 1056 | { |
| 1057 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1057 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1058 | 1058 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1059 | - if($flag) |
|
| 1059 | + if ($flag) |
|
| 1060 | 1060 | { |
| 1061 | - if($charset == 'UTF-8') |
|
| 1061 | + if ($charset == 'UTF-8') |
|
| 1062 | 1062 | { |
| 1063 | 1063 | return $obj; |
| 1064 | 1064 | } |
| 1065 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1065 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1066 | 1066 | return $obj; |
| 1067 | 1067 | } |
| 1068 | 1068 | } |
@@ -1081,11 +1081,11 @@ discard block |
||
| 1081 | 1081 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1082 | 1082 | { |
| 1083 | 1083 | static $flag = TRUE; |
| 1084 | - if($charset) |
|
| 1084 | + if ($charset) |
|
| 1085 | 1085 | { |
| 1086 | - if(is_array($val)) |
|
| 1087 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1088 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1086 | + if (is_array($val)) |
|
| 1087 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1088 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1089 | 1089 | else $flag = FALSE; |
| 1090 | 1090 | } |
| 1091 | 1091 | else |
@@ -1109,9 +1109,9 @@ discard block |
||
| 1109 | 1109 | { |
| 1110 | 1110 | if (is_array($val)) |
| 1111 | 1111 | { |
| 1112 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1112 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1113 | 1113 | } |
| 1114 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1114 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | /** |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | */ |
| 1123 | 1123 | function convertEncodingStr($str) |
| 1124 | 1124 | { |
| 1125 | - if(!$str) return null; |
|
| 1125 | + if (!$str) return null; |
|
| 1126 | 1126 | $obj = new stdClass(); |
| 1127 | 1127 | $obj->str = $str; |
| 1128 | 1128 | $obj = self::convertEncoding($obj); |
@@ -1131,9 +1131,9 @@ discard block |
||
| 1131 | 1131 | |
| 1132 | 1132 | function decodeIdna($domain) |
| 1133 | 1133 | { |
| 1134 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1134 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1135 | 1135 | { |
| 1136 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1136 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1137 | 1137 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1138 | 1138 | $domain = $IDN->decode($domain); |
| 1139 | 1139 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | { |
| 1165 | 1165 | $self = self::getInstance(); |
| 1166 | 1166 | |
| 1167 | - if($self->response_method) |
|
| 1167 | + if ($self->response_method) |
|
| 1168 | 1168 | { |
| 1169 | 1169 | return $self->response_method; |
| 1170 | 1170 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1205 | 1205 | |
| 1206 | 1206 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1207 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1207 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1208 | 1208 | { |
| 1209 | 1209 | $this->isSuccessInit = FALSE; |
| 1210 | 1210 | } |
@@ -1217,30 +1217,30 @@ discard block |
||
| 1217 | 1217 | */ |
| 1218 | 1218 | function _setRequestArgument() |
| 1219 | 1219 | { |
| 1220 | - if(!count($_REQUEST)) |
|
| 1220 | + if (!count($_REQUEST)) |
|
| 1221 | 1221 | { |
| 1222 | 1222 | return; |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | $requestMethod = $this->getRequestMethod(); |
| 1226 | - foreach($_REQUEST as $key => $val) |
|
| 1226 | + foreach ($_REQUEST as $key => $val) |
|
| 1227 | 1227 | { |
| 1228 | - if($val === '' || self::get($key)) |
|
| 1228 | + if ($val === '' || self::get($key)) |
|
| 1229 | 1229 | { |
| 1230 | 1230 | continue; |
| 1231 | 1231 | } |
| 1232 | 1232 | $key = htmlentities($key); |
| 1233 | 1233 | $val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET')); |
| 1234 | 1234 | |
| 1235 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1235 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1236 | 1236 | { |
| 1237 | 1237 | $set_to_vars = TRUE; |
| 1238 | 1238 | } |
| 1239 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1239 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1240 | 1240 | { |
| 1241 | 1241 | $set_to_vars = TRUE; |
| 1242 | 1242 | } |
| 1243 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1243 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1244 | 1244 | { |
| 1245 | 1245 | $set_to_vars = TRUE; |
| 1246 | 1246 | } |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | $set_to_vars = FALSE; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - if($set_to_vars) |
|
| 1252 | + if ($set_to_vars) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $this->_recursiveCheckVar($val); |
| 1255 | 1255 | } |
@@ -1260,20 +1260,20 @@ discard block |
||
| 1260 | 1260 | |
| 1261 | 1261 | function _recursiveCheckVar($val) |
| 1262 | 1262 | { |
| 1263 | - if(is_string($val)) |
|
| 1263 | + if (is_string($val)) |
|
| 1264 | 1264 | { |
| 1265 | - foreach($this->patterns as $pattern) |
|
| 1265 | + foreach ($this->patterns as $pattern) |
|
| 1266 | 1266 | { |
| 1267 | - if(preg_match($pattern, $val)) |
|
| 1267 | + if (preg_match($pattern, $val)) |
|
| 1268 | 1268 | { |
| 1269 | 1269 | $this->isSuccessInit = FALSE; |
| 1270 | 1270 | return; |
| 1271 | 1271 | } |
| 1272 | 1272 | } |
| 1273 | 1273 | } |
| 1274 | - else if(is_array($val)) |
|
| 1274 | + else if (is_array($val)) |
|
| 1275 | 1275 | { |
| 1276 | - foreach($val as $val2) |
|
| 1276 | + foreach ($val as $val2) |
|
| 1277 | 1277 | { |
| 1278 | 1278 | $this->_recursiveCheckVar($val2); |
| 1279 | 1279 | } |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | */ |
| 1288 | 1288 | function _setJSONRequestArgument() |
| 1289 | 1289 | { |
| 1290 | - if($this->getRequestMethod() != 'JSON') |
|
| 1290 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1291 | 1291 | { |
| 1292 | 1292 | return; |
| 1293 | 1293 | } |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | $params = array(); |
| 1296 | 1296 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1297 | 1297 | |
| 1298 | - foreach($params as $key => $val) |
|
| 1298 | + foreach ($params as $key => $val) |
|
| 1299 | 1299 | { |
| 1300 | 1300 | $key = htmlentities($key); |
| 1301 | 1301 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
@@ -1309,13 +1309,13 @@ discard block |
||
| 1309 | 1309 | */ |
| 1310 | 1310 | function _setXmlRpcArgument() |
| 1311 | 1311 | { |
| 1312 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1312 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1313 | 1313 | { |
| 1314 | 1314 | return; |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1318 | - if(Security::detectingXEE($xml)) |
|
| 1318 | + if (Security::detectingXEE($xml)) |
|
| 1319 | 1319 | { |
| 1320 | 1320 | header("HTTP/1.0 400 Bad Request"); |
| 1321 | 1321 | exit; |
@@ -1327,12 +1327,12 @@ discard block |
||
| 1327 | 1327 | $params = $xml_obj->methodcall->params; |
| 1328 | 1328 | unset($params->node_name, $params->attrs, $params->body); |
| 1329 | 1329 | |
| 1330 | - if(!count(get_object_vars($params))) |
|
| 1330 | + if (!count(get_object_vars($params))) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | return; |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | - foreach($params as $key => $val) |
|
| 1335 | + foreach ($params as $key => $val) |
|
| 1336 | 1336 | { |
| 1337 | 1337 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1338 | 1338 | } |
@@ -1347,10 +1347,10 @@ discard block |
||
| 1347 | 1347 | */ |
| 1348 | 1348 | function _filterXmlVars($key, $val) |
| 1349 | 1349 | { |
| 1350 | - if(is_array($val)) |
|
| 1350 | + if (is_array($val)) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | $stack = array(); |
| 1353 | - foreach($val as $k => $v) |
|
| 1353 | + foreach ($val as $k => $v) |
|
| 1354 | 1354 | { |
| 1355 | 1355 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1356 | 1356 | } |
@@ -1360,20 +1360,20 @@ discard block |
||
| 1360 | 1360 | |
| 1361 | 1361 | $body = $val->body; |
| 1362 | 1362 | unset($val->node_name, $val->attrs, $val->body); |
| 1363 | - if(!count(get_object_vars($val))) |
|
| 1363 | + if (!count(get_object_vars($val))) |
|
| 1364 | 1364 | { |
| 1365 | 1365 | return $this->_filterRequestVar($key, $body, 0); |
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | $stack = new stdClass(); |
| 1369 | - foreach($val as $k => $v) |
|
| 1369 | + foreach ($val as $k => $v) |
|
| 1370 | 1370 | { |
| 1371 | 1371 | $output = $this->_filterXmlVars($k, $v); |
| 1372 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1372 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1373 | 1373 | { |
| 1374 | 1374 | $output = array($output); |
| 1375 | 1375 | } |
| 1376 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1376 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1377 | 1377 | { |
| 1378 | 1378 | return $output; |
| 1379 | 1379 | } |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | $stack->{$k} = $output; |
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | - if(!count(get_object_vars($stack))) |
|
| 1384 | + if (!count(get_object_vars($stack))) |
|
| 1385 | 1385 | { |
| 1386 | 1386 | return NULL; |
| 1387 | 1387 | } |
@@ -1400,16 +1400,16 @@ discard block |
||
| 1400 | 1400 | */ |
| 1401 | 1401 | function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false) |
| 1402 | 1402 | { |
| 1403 | - if(!($isArray = is_array($val))) |
|
| 1403 | + if (!($isArray = is_array($val))) |
|
| 1404 | 1404 | { |
| 1405 | 1405 | $val = array($val); |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | $result = array(); |
| 1409 | - foreach($val as $k => $v) |
|
| 1409 | + foreach ($val as $k => $v) |
|
| 1410 | 1410 | { |
| 1411 | - if($remove_hack && !is_array($v)) { |
|
| 1412 | - if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
| 1411 | + if ($remove_hack && !is_array($v)) { |
|
| 1412 | + if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
| 1413 | 1413 | { |
| 1414 | 1414 | $result[$k] = escape($v); |
| 1415 | 1415 | continue; |
@@ -1417,18 +1417,18 @@ discard block |
||
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | 1419 | $k = htmlentities($k); |
| 1420 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1420 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1423 | 1423 | } |
| 1424 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1424 | + elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) { |
|
| 1425 | 1425 | $result[$k] = escape($v, false); |
| 1426 | 1426 | } |
| 1427 | - elseif($key === 'vid') |
|
| 1427 | + elseif ($key === 'vid') |
|
| 1428 | 1428 | { |
| 1429 | 1429 | $result[$k] = urlencode($v); |
| 1430 | 1430 | } |
| 1431 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1431 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1432 | 1432 | { |
| 1433 | 1433 | unset($result[$k]); |
| 1434 | 1434 | } |
@@ -1436,7 +1436,7 @@ discard block |
||
| 1436 | 1436 | { |
| 1437 | 1437 | $result[$k] = $v; |
| 1438 | 1438 | |
| 1439 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1439 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1440 | 1440 | { |
| 1441 | 1441 | if (is_array($result[$k])) |
| 1442 | 1442 | { |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | } |
| 1449 | 1449 | } |
| 1450 | 1450 | |
| 1451 | - if(is_array($result[$k])) |
|
| 1451 | + if (is_array($result[$k])) |
|
| 1452 | 1452 | { |
| 1453 | 1453 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1454 | 1454 | } |
@@ -1457,7 +1457,7 @@ discard block |
||
| 1457 | 1457 | $result[$k] = trim($result[$k]); |
| 1458 | 1458 | } |
| 1459 | 1459 | |
| 1460 | - if($remove_hack) |
|
| 1460 | + if ($remove_hack) |
|
| 1461 | 1461 | { |
| 1462 | 1462 | $result[$k] = escape($result[$k], false); |
| 1463 | 1463 | } |
@@ -1485,17 +1485,17 @@ discard block |
||
| 1485 | 1485 | */ |
| 1486 | 1486 | function _setUploadedArgument() |
| 1487 | 1487 | { |
| 1488 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1488 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1489 | 1489 | { |
| 1490 | 1490 | return; |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | - foreach($_FILES as $key => $val) |
|
| 1493 | + foreach ($_FILES as $key => $val) |
|
| 1494 | 1494 | { |
| 1495 | 1495 | $tmp_name = $val['tmp_name']; |
| 1496 | - if(!is_array($tmp_name)) |
|
| 1496 | + if (!is_array($tmp_name)) |
|
| 1497 | 1497 | { |
| 1498 | - if(!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1498 | + if (!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1499 | 1499 | { |
| 1500 | 1500 | continue; |
| 1501 | 1501 | } |
@@ -1508,7 +1508,7 @@ discard block |
||
| 1508 | 1508 | $files = array(); |
| 1509 | 1509 | foreach ($tmp_name as $i => $j) |
| 1510 | 1510 | { |
| 1511 | - if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1511 | + if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1512 | 1512 | { |
| 1513 | 1513 | $files = array(); |
| 1514 | 1514 | unset($_FILES[$key]); |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | $file['size'] = $val['size'][$i]; |
| 1523 | 1523 | $files[] = $file; |
| 1524 | 1524 | } |
| 1525 | - if(count($files)) |
|
| 1525 | + if (count($files)) |
|
| 1526 | 1526 | { |
| 1527 | 1527 | self::set($key, $files, true); |
| 1528 | 1528 | } |
@@ -1547,16 +1547,16 @@ discard block |
||
| 1547 | 1547 | function getRequestUrl() |
| 1548 | 1548 | { |
| 1549 | 1549 | static $url = null; |
| 1550 | - if(is_null($url)) |
|
| 1550 | + if (is_null($url)) |
|
| 1551 | 1551 | { |
| 1552 | 1552 | $url = self::getRequestUri(); |
| 1553 | - if(count($_GET) > 0) |
|
| 1553 | + if (count($_GET) > 0) |
|
| 1554 | 1554 | { |
| 1555 | - foreach($_GET as $key => $val) |
|
| 1555 | + foreach ($_GET as $key => $val) |
|
| 1556 | 1556 | { |
| 1557 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1557 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1558 | 1558 | } |
| 1559 | - $url .= '?' . join('&', $vars); |
|
| 1559 | + $url .= '?'.join('&', $vars); |
|
| 1560 | 1560 | } |
| 1561 | 1561 | } |
| 1562 | 1562 | return $url; |
@@ -1571,7 +1571,7 @@ discard block |
||
| 1571 | 1571 | $self = self::getInstance(); |
| 1572 | 1572 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1573 | 1573 | |
| 1574 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1574 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1575 | 1575 | { |
| 1576 | 1576 | unset($js_callback_func); |
| 1577 | 1577 | unset($_GET['xe_js_callback']); |
@@ -1599,22 +1599,22 @@ discard block |
||
| 1599 | 1599 | $self = self::getInstance(); |
| 1600 | 1600 | |
| 1601 | 1601 | // retrieve virtual site information |
| 1602 | - if(is_null($site_module_info)) |
|
| 1602 | + if (is_null($site_module_info)) |
|
| 1603 | 1603 | { |
| 1604 | 1604 | $site_module_info = self::get('site_module_info'); |
| 1605 | 1605 | } |
| 1606 | 1606 | |
| 1607 | 1607 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1608 | - if($domain && isSiteID($domain)) |
|
| 1608 | + if ($domain && isSiteID($domain)) |
|
| 1609 | 1609 | { |
| 1610 | 1610 | $vid = $domain; |
| 1611 | 1611 | $domain = ''; |
| 1612 | 1612 | } |
| 1613 | 1613 | |
| 1614 | 1614 | // If $domain, $vid are not set, use current site information |
| 1615 | - if(!$domain && !$vid) |
|
| 1615 | + if (!$domain && !$vid) |
|
| 1616 | 1616 | { |
| 1617 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1617 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1618 | 1618 | { |
| 1619 | 1619 | $vid = $site_module_info->domain; |
| 1620 | 1620 | } |
@@ -1625,21 +1625,21 @@ discard block |
||
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1628 | - if($domain) |
|
| 1628 | + if ($domain) |
|
| 1629 | 1629 | { |
| 1630 | 1630 | $domain_info = parse_url($domain); |
| 1631 | - if(is_null($current_info)) |
|
| 1631 | + if (is_null($current_info)) |
|
| 1632 | 1632 | { |
| 1633 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
| 1633 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
| 1634 | 1634 | } |
| 1635 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1635 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
| 1636 | 1636 | { |
| 1637 | 1637 | unset($domain); |
| 1638 | 1638 | } |
| 1639 | 1639 | else |
| 1640 | 1640 | { |
| 1641 | 1641 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1642 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1642 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1643 | 1643 | { |
| 1644 | 1644 | $domain .= '/'; |
| 1645 | 1645 | } |
@@ -1649,41 +1649,41 @@ discard block |
||
| 1649 | 1649 | $get_vars = array(); |
| 1650 | 1650 | |
| 1651 | 1651 | // If there is no GET variables or first argument is '' to reset variables |
| 1652 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1652 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1653 | 1653 | { |
| 1654 | 1654 | // rearrange args_list |
| 1655 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1655 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1656 | 1656 | { |
| 1657 | 1657 | array_shift($args_list); |
| 1658 | 1658 | } |
| 1659 | 1659 | } |
| 1660 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1660 | + elseif ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1661 | 1661 | { |
| 1662 | 1662 | // Otherwise, make GET variables into array |
| 1663 | 1663 | $get_vars = get_object_vars($self->get_vars); |
| 1664 | 1664 | } |
| 1665 | 1665 | else |
| 1666 | 1666 | { |
| 1667 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1668 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1669 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1670 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1671 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1672 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1673 | - if($get_vars['act'] == 'IS') |
|
| 1667 | + if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1668 | + if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1669 | + if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1670 | + if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1671 | + if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1672 | + if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1673 | + if ($get_vars['act'] == 'IS') |
|
| 1674 | 1674 | { |
| 1675 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1675 | + if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1676 | 1676 | } |
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | // arrange args_list |
| 1680 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1680 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1681 | 1681 | { |
| 1682 | 1682 | $key = $args_list[$i]; |
| 1683 | 1683 | $val = trim($args_list[$i + 1]); |
| 1684 | 1684 | |
| 1685 | 1685 | // If value is not set, remove the key |
| 1686 | - if(!isset($val) || !strlen($val)) |
|
| 1686 | + if (!isset($val) || !strlen($val)) |
|
| 1687 | 1687 | { |
| 1688 | 1688 | unset($get_vars[$key]); |
| 1689 | 1689 | continue; |
@@ -1694,7 +1694,7 @@ discard block |
||
| 1694 | 1694 | |
| 1695 | 1695 | // remove vid, rnd |
| 1696 | 1696 | unset($get_vars['rnd']); |
| 1697 | - if($vid) |
|
| 1697 | + if ($vid) |
|
| 1698 | 1698 | { |
| 1699 | 1699 | $get_vars['vid'] = $vid; |
| 1700 | 1700 | } |
@@ -1711,17 +1711,17 @@ discard block |
||
| 1711 | 1711 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1712 | 1712 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1713 | 1713 | ); |
| 1714 | - if($act_alias[$act]) |
|
| 1714 | + if ($act_alias[$act]) |
|
| 1715 | 1715 | { |
| 1716 | 1716 | $get_vars['act'] = $act_alias[$act]; |
| 1717 | 1717 | } |
| 1718 | 1718 | |
| 1719 | 1719 | // organize URL |
| 1720 | 1720 | $query = ''; |
| 1721 | - if(count($get_vars) > 0) |
|
| 1721 | + if (count($get_vars) > 0) |
|
| 1722 | 1722 | { |
| 1723 | 1723 | // if using rewrite mod |
| 1724 | - if($self->allow_rewrite) |
|
| 1724 | + if ($self->allow_rewrite) |
|
| 1725 | 1725 | { |
| 1726 | 1726 | $var_keys = array_keys($get_vars); |
| 1727 | 1727 | sort($var_keys); |
@@ -1741,8 +1741,8 @@ discard block |
||
| 1741 | 1741 | 'vid' => $vid, |
| 1742 | 1742 | 'mid' => $mid, |
| 1743 | 1743 | 'mid.vid' => "$vid/$mid", |
| 1744 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
| 1745 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
| 1744 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
| 1745 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
| 1746 | 1746 | 'document_srl' => $srl, |
| 1747 | 1747 | 'document_srl.mid' => "$mid/$srl", |
| 1748 | 1748 | 'document_srl.vid' => "$vid/$srl", |
@@ -1759,66 +1759,66 @@ discard block |
||
| 1759 | 1759 | $query = $target_map[$target]; |
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | - if(!$query) |
|
| 1762 | + if (!$query) |
|
| 1763 | 1763 | { |
| 1764 | 1764 | $queries = array(); |
| 1765 | - foreach($get_vars as $key => $val) |
|
| 1765 | + foreach ($get_vars as $key => $val) |
|
| 1766 | 1766 | { |
| 1767 | - if(is_array($val) && count($val) > 0) |
|
| 1767 | + if (is_array($val) && count($val) > 0) |
|
| 1768 | 1768 | { |
| 1769 | - foreach($val as $k => $v) |
|
| 1769 | + foreach ($val as $k => $v) |
|
| 1770 | 1770 | { |
| 1771 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 1771 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
| 1772 | 1772 | } |
| 1773 | 1773 | } |
| 1774 | - elseif(!is_array($val)) |
|
| 1774 | + elseif (!is_array($val)) |
|
| 1775 | 1775 | { |
| 1776 | - $queries[] = $key . '=' . urlencode($val); |
|
| 1776 | + $queries[] = $key.'='.urlencode($val); |
|
| 1777 | 1777 | } |
| 1778 | 1778 | } |
| 1779 | - if(count($queries) > 0) |
|
| 1779 | + if (count($queries) > 0) |
|
| 1780 | 1780 | { |
| 1781 | - $query = 'index.php?' . join('&', $queries); |
|
| 1781 | + $query = 'index.php?'.join('&', $queries); |
|
| 1782 | 1782 | } |
| 1783 | 1783 | } |
| 1784 | 1784 | } |
| 1785 | 1785 | |
| 1786 | 1786 | // If using SSL always |
| 1787 | 1787 | $_use_ssl = $self->get('_use_ssl'); |
| 1788 | - if($_use_ssl == 'always') |
|
| 1788 | + if ($_use_ssl == 'always') |
|
| 1789 | 1789 | { |
| 1790 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1790 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1791 | 1791 | // optional SSL use |
| 1792 | 1792 | } |
| 1793 | - elseif($_use_ssl == 'optional') |
|
| 1793 | + elseif ($_use_ssl == 'optional') |
|
| 1794 | 1794 | { |
| 1795 | 1795 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1796 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
| 1796 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
| 1797 | 1797 | // no SSL |
| 1798 | 1798 | } |
| 1799 | 1799 | else |
| 1800 | 1800 | { |
| 1801 | 1801 | // currently on SSL but target is not based on SSL |
| 1802 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1802 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1803 | 1803 | { |
| 1804 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1804 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1805 | 1805 | } |
| 1806 | - else if($domain) // if $domain is set |
|
| 1806 | + else if ($domain) // if $domain is set |
|
| 1807 | 1807 | { |
| 1808 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
| 1808 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
| 1809 | 1809 | } |
| 1810 | 1810 | else |
| 1811 | 1811 | { |
| 1812 | - $query = getScriptPath() . $query; |
|
| 1812 | + $query = getScriptPath().$query; |
|
| 1813 | 1813 | } |
| 1814 | 1814 | } |
| 1815 | 1815 | |
| 1816 | - if(!$encode) |
|
| 1816 | + if (!$encode) |
|
| 1817 | 1817 | { |
| 1818 | 1818 | return $query; |
| 1819 | 1819 | } |
| 1820 | 1820 | |
| 1821 | - if(!$autoEncode) |
|
| 1821 | + if (!$autoEncode) |
|
| 1822 | 1822 | { |
| 1823 | 1823 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1824 | 1824 | } |
@@ -1827,16 +1827,16 @@ discard block |
||
| 1827 | 1827 | $encode_queries = array(); |
| 1828 | 1828 | $parsedUrl = parse_url($query); |
| 1829 | 1829 | parse_str($parsedUrl['query'], $output); |
| 1830 | - foreach($output as $key => $value) |
|
| 1830 | + foreach ($output as $key => $value) |
|
| 1831 | 1831 | { |
| 1832 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1832 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1833 | 1833 | { |
| 1834 | 1834 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1835 | 1835 | } |
| 1836 | - $encode_queries[] = $key . '=' . $value; |
|
| 1836 | + $encode_queries[] = $key.'='.$value; |
|
| 1837 | 1837 | } |
| 1838 | 1838 | |
| 1839 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1839 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1840 | 1840 | } |
| 1841 | 1841 | |
| 1842 | 1842 | /** |
@@ -1851,17 +1851,17 @@ discard block |
||
| 1851 | 1851 | static $url = array(); |
| 1852 | 1852 | |
| 1853 | 1853 | // Check HTTP Request |
| 1854 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1854 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1855 | 1855 | { |
| 1856 | 1856 | return; |
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | - if(self::get('_use_ssl') == 'always') |
|
| 1859 | + if (self::get('_use_ssl') == 'always') |
|
| 1860 | 1860 | { |
| 1861 | 1861 | $ssl_mode = ENFORCE_SSL; |
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | - if($domain) |
|
| 1864 | + if ($domain) |
|
| 1865 | 1865 | { |
| 1866 | 1866 | $domain_key = md5($domain); |
| 1867 | 1867 | } |
@@ -1870,14 +1870,14 @@ discard block |
||
| 1870 | 1870 | $domain_key = 'default'; |
| 1871 | 1871 | } |
| 1872 | 1872 | |
| 1873 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1873 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1874 | 1874 | { |
| 1875 | 1875 | return $url[$ssl_mode][$domain_key]; |
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1879 | 1879 | |
| 1880 | - switch($ssl_mode) |
|
| 1880 | + switch ($ssl_mode) |
|
| 1881 | 1881 | { |
| 1882 | 1882 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1883 | 1883 | break; |
@@ -1887,34 +1887,34 @@ discard block |
||
| 1887 | 1887 | break; |
| 1888 | 1888 | } |
| 1889 | 1889 | |
| 1890 | - if($domain) |
|
| 1890 | + if ($domain) |
|
| 1891 | 1891 | { |
| 1892 | 1892 | $target_url = trim($domain); |
| 1893 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1893 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1894 | 1894 | { |
| 1895 | - $target_url.= '/'; |
|
| 1895 | + $target_url .= '/'; |
|
| 1896 | 1896 | } |
| 1897 | 1897 | } |
| 1898 | 1898 | else |
| 1899 | 1899 | { |
| 1900 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
| 1900 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
| 1901 | 1901 | } |
| 1902 | 1902 | |
| 1903 | - $url_info = parse_url('http://' . $target_url); |
|
| 1903 | + $url_info = parse_url('http://'.$target_url); |
|
| 1904 | 1904 | |
| 1905 | - if($current_use_ssl != $use_ssl) |
|
| 1905 | + if ($current_use_ssl != $use_ssl) |
|
| 1906 | 1906 | { |
| 1907 | 1907 | unset($url_info['port']); |
| 1908 | 1908 | } |
| 1909 | 1909 | |
| 1910 | - if($use_ssl) |
|
| 1910 | + if ($use_ssl) |
|
| 1911 | 1911 | { |
| 1912 | 1912 | $port = self::get('_https_port'); |
| 1913 | - if($port && $port != 443) |
|
| 1913 | + if ($port && $port != 443) |
|
| 1914 | 1914 | { |
| 1915 | 1915 | $url_info['port'] = $port; |
| 1916 | 1916 | } |
| 1917 | - elseif($url_info['port'] == 443) |
|
| 1917 | + elseif ($url_info['port'] == 443) |
|
| 1918 | 1918 | { |
| 1919 | 1919 | unset($url_info['port']); |
| 1920 | 1920 | } |
@@ -1922,17 +1922,17 @@ discard block |
||
| 1922 | 1922 | else |
| 1923 | 1923 | { |
| 1924 | 1924 | $port = self::get('_http_port'); |
| 1925 | - if($port && $port != 80) |
|
| 1925 | + if ($port && $port != 80) |
|
| 1926 | 1926 | { |
| 1927 | 1927 | $url_info['port'] = $port; |
| 1928 | 1928 | } |
| 1929 | - elseif($url_info['port'] == 80) |
|
| 1929 | + elseif ($url_info['port'] == 80) |
|
| 1930 | 1930 | { |
| 1931 | 1931 | unset($url_info['port']); |
| 1932 | 1932 | } |
| 1933 | 1933 | } |
| 1934 | 1934 | |
| 1935 | - $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); |
|
| 1935 | + $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']); |
|
| 1936 | 1936 | |
| 1937 | 1937 | return $url[$ssl_mode][$domain_key]; |
| 1938 | 1938 | } |
@@ -1949,16 +1949,16 @@ discard block |
||
| 1949 | 1949 | { |
| 1950 | 1950 | $self = self::getInstance(); |
| 1951 | 1951 | $self->context->{$key} = $val; |
| 1952 | - if($set_to_get_vars === FALSE) |
|
| 1952 | + if ($set_to_get_vars === FALSE) |
|
| 1953 | 1953 | { |
| 1954 | 1954 | return; |
| 1955 | 1955 | } |
| 1956 | - if($val === NULL || $val === '') |
|
| 1956 | + if ($val === NULL || $val === '') |
|
| 1957 | 1957 | { |
| 1958 | 1958 | unset($self->get_vars->{$key}); |
| 1959 | 1959 | return; |
| 1960 | 1960 | } |
| 1961 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1961 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1962 | 1962 | { |
| 1963 | 1963 | $self->get_vars->{$key} = $val; |
| 1964 | 1964 | } |
@@ -1974,7 +1974,7 @@ discard block |
||
| 1974 | 1974 | { |
| 1975 | 1975 | $self = self::getInstance(); |
| 1976 | 1976 | |
| 1977 | - if(!isset($self->context->{$key})) |
|
| 1977 | + if (!isset($self->context->{$key})) |
|
| 1978 | 1978 | { |
| 1979 | 1979 | return null; |
| 1980 | 1980 | } |
@@ -1989,7 +1989,7 @@ discard block |
||
| 1989 | 1989 | function gets() |
| 1990 | 1990 | { |
| 1991 | 1991 | $num_args = func_num_args(); |
| 1992 | - if($num_args < 1) |
|
| 1992 | + if ($num_args < 1) |
|
| 1993 | 1993 | { |
| 1994 | 1994 | return; |
| 1995 | 1995 | } |
@@ -1997,7 +1997,7 @@ discard block |
||
| 1997 | 1997 | |
| 1998 | 1998 | $args_list = func_get_args(); |
| 1999 | 1999 | $output = new stdClass(); |
| 2000 | - foreach($args_list as $v) |
|
| 2000 | + foreach ($args_list as $v) |
|
| 2001 | 2001 | { |
| 2002 | 2002 | $output->{$v} = $self->get($v); |
| 2003 | 2003 | } |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | function getRequestVars() |
| 2024 | 2024 | { |
| 2025 | 2025 | $self = self::getInstance(); |
| 2026 | - if($self->get_vars) |
|
| 2026 | + if ($self->get_vars) |
|
| 2027 | 2027 | { |
| 2028 | 2028 | return clone($self->get_vars); |
| 2029 | 2029 | } |
@@ -2040,13 +2040,13 @@ discard block |
||
| 2040 | 2040 | { |
| 2041 | 2041 | $self = self::getInstance(); |
| 2042 | 2042 | |
| 2043 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2043 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2044 | 2044 | { |
| 2045 | 2045 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2046 | 2046 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | - if(!isset($self->ssl_actions[$action])) |
|
| 2049 | + if (!isset($self->ssl_actions[$action])) |
|
| 2050 | 2050 | { |
| 2051 | 2051 | $self->ssl_actions[$action] = 1; |
| 2052 | 2052 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2064,16 +2064,16 @@ discard block |
||
| 2064 | 2064 | { |
| 2065 | 2065 | $self = self::getInstance(); |
| 2066 | 2066 | |
| 2067 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2067 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2068 | 2068 | { |
| 2069 | 2069 | unset($self->ssl_actions); |
| 2070 | 2070 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2071 | 2071 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2072 | 2072 | } |
| 2073 | 2073 | |
| 2074 | - foreach($action_array as $action) |
|
| 2074 | + foreach ($action_array as $action) |
|
| 2075 | 2075 | { |
| 2076 | - if(!isset($self->ssl_actions[$action])) |
|
| 2076 | + if (!isset($self->ssl_actions[$action])) |
|
| 2077 | 2077 | { |
| 2078 | 2078 | $self->ssl_actions[$action] = 1; |
| 2079 | 2079 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2092,7 +2092,7 @@ discard block |
||
| 2092 | 2092 | { |
| 2093 | 2093 | $self = self::getInstance(); |
| 2094 | 2094 | |
| 2095 | - if($self->isExistsSSLAction($action)) |
|
| 2095 | + if ($self->isExistsSSLAction($action)) |
|
| 2096 | 2096 | { |
| 2097 | 2097 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2098 | 2098 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2109,7 +2109,7 @@ discard block |
||
| 2109 | 2109 | function getSSLActions() |
| 2110 | 2110 | { |
| 2111 | 2111 | $self = self::getInstance(); |
| 2112 | - if($self->getSslStatus() == 'optional') |
|
| 2112 | + if ($self->getSslStatus() == 'optional') |
|
| 2113 | 2113 | { |
| 2114 | 2114 | return $self->ssl_actions; |
| 2115 | 2115 | } |
@@ -2136,12 +2136,12 @@ discard block |
||
| 2136 | 2136 | */ |
| 2137 | 2137 | function normalizeFilePath($file) |
| 2138 | 2138 | { |
| 2139 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2139 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2140 | 2140 | { |
| 2141 | - $file = './' . $file; |
|
| 2141 | + $file = './'.$file; |
|
| 2142 | 2142 | } |
| 2143 | 2143 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2144 | - while(strpos($file, '/../') !== FALSE) |
|
| 2144 | + while (strpos($file, '/../') !== FALSE) |
|
| 2145 | 2145 | { |
| 2146 | 2146 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2147 | 2147 | } |
@@ -2160,13 +2160,13 @@ discard block |
||
| 2160 | 2160 | { |
| 2161 | 2161 | $file = self::normalizeFilePath($file); |
| 2162 | 2162 | $script_path = getScriptPath(); |
| 2163 | - if(strpos($file, './') === 0) |
|
| 2163 | + if (strpos($file, './') === 0) |
|
| 2164 | 2164 | { |
| 2165 | - $file = $script_path . substr($file, 2); |
|
| 2165 | + $file = $script_path.substr($file, 2); |
|
| 2166 | 2166 | } |
| 2167 | - elseif(strpos($file, '../') === 0) |
|
| 2167 | + elseif (strpos($file, '../') === 0) |
|
| 2168 | 2168 | { |
| 2169 | - $file = self::normalizeFilePath($script_path . $file); |
|
| 2169 | + $file = self::normalizeFilePath($script_path.$file); |
|
| 2170 | 2170 | } |
| 2171 | 2171 | |
| 2172 | 2172 | return $file; |
@@ -2236,12 +2236,12 @@ discard block |
||
| 2236 | 2236 | */ |
| 2237 | 2237 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2238 | 2238 | { |
| 2239 | - if($isRuleset) |
|
| 2239 | + if ($isRuleset) |
|
| 2240 | 2240 | { |
| 2241 | - if(strpos($file, '#') !== FALSE) |
|
| 2241 | + if (strpos($file, '#') !== FALSE) |
|
| 2242 | 2242 | { |
| 2243 | 2243 | $file = str_replace('#', '', $file); |
| 2244 | - if(!is_readable($file)) |
|
| 2244 | + if (!is_readable($file)) |
|
| 2245 | 2245 | { |
| 2246 | 2246 | $file = $autoPath; |
| 2247 | 2247 | } |
@@ -2306,9 +2306,9 @@ discard block |
||
| 2306 | 2306 | ksort($files); |
| 2307 | 2307 | $files = array_values($files); |
| 2308 | 2308 | $filenames = array(); |
| 2309 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2309 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2310 | 2310 | { |
| 2311 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2311 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2312 | 2312 | { |
| 2313 | 2313 | unset($files[$i]); |
| 2314 | 2314 | } |
@@ -2393,14 +2393,14 @@ discard block |
||
| 2393 | 2393 | */ |
| 2394 | 2394 | function getJavascriptPluginInfo($pluginName) |
| 2395 | 2395 | { |
| 2396 | - if($plugin_name == 'ui.datepicker') |
|
| 2396 | + if ($plugin_name == 'ui.datepicker') |
|
| 2397 | 2397 | { |
| 2398 | 2398 | $plugin_name = 'ui'; |
| 2399 | 2399 | } |
| 2400 | 2400 | |
| 2401 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
| 2402 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2403 | - if(!is_readable($info_file)) |
|
| 2401 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
| 2402 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2403 | + if (!is_readable($info_file)) |
|
| 2404 | 2404 | { |
| 2405 | 2405 | return; |
| 2406 | 2406 | } |
@@ -2410,32 +2410,32 @@ discard block |
||
| 2410 | 2410 | $result->jsList = array(); |
| 2411 | 2411 | $result->cssList = array(); |
| 2412 | 2412 | |
| 2413 | - foreach($list as $filename) |
|
| 2413 | + foreach ($list as $filename) |
|
| 2414 | 2414 | { |
| 2415 | 2415 | $filename = trim($filename); |
| 2416 | - if(!$filename) |
|
| 2416 | + if (!$filename) |
|
| 2417 | 2417 | { |
| 2418 | 2418 | continue; |
| 2419 | 2419 | } |
| 2420 | 2420 | |
| 2421 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2421 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2422 | 2422 | { |
| 2423 | 2423 | $filename = substr($filename, 2); |
| 2424 | 2424 | } |
| 2425 | 2425 | |
| 2426 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2426 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2427 | 2427 | { |
| 2428 | - $result->jsList[] = $plugin_path . $filename; |
|
| 2428 | + $result->jsList[] = $plugin_path.$filename; |
|
| 2429 | 2429 | } |
| 2430 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2430 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2431 | 2431 | { |
| 2432 | - $result->cssList[] = $plugin_path . $filename; |
|
| 2432 | + $result->cssList[] = $plugin_path.$filename; |
|
| 2433 | 2433 | } |
| 2434 | 2434 | } |
| 2435 | 2435 | |
| 2436 | - if(is_dir($plugin_path . 'lang')) |
|
| 2436 | + if (is_dir($plugin_path.'lang')) |
|
| 2437 | 2437 | { |
| 2438 | - $result->langPath = $plugin_path . 'lang'; |
|
| 2438 | + $result->langPath = $plugin_path.'lang'; |
|
| 2439 | 2439 | } |
| 2440 | 2440 | |
| 2441 | 2441 | return $result; |
@@ -2451,50 +2451,50 @@ discard block |
||
| 2451 | 2451 | static $loaded_plugins = array(); |
| 2452 | 2452 | |
| 2453 | 2453 | $self = self::getInstance(); |
| 2454 | - if($plugin_name == 'ui.datepicker') |
|
| 2454 | + if ($plugin_name == 'ui.datepicker') |
|
| 2455 | 2455 | { |
| 2456 | 2456 | $plugin_name = 'ui'; |
| 2457 | 2457 | } |
| 2458 | 2458 | |
| 2459 | - if($loaded_plugins[$plugin_name]) |
|
| 2459 | + if ($loaded_plugins[$plugin_name]) |
|
| 2460 | 2460 | { |
| 2461 | 2461 | return; |
| 2462 | 2462 | } |
| 2463 | 2463 | $loaded_plugins[$plugin_name] = TRUE; |
| 2464 | 2464 | |
| 2465 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
| 2466 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2467 | - if(!is_readable($info_file)) |
|
| 2465 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
| 2466 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2467 | + if (!is_readable($info_file)) |
|
| 2468 | 2468 | { |
| 2469 | 2469 | return; |
| 2470 | 2470 | } |
| 2471 | 2471 | |
| 2472 | 2472 | $list = file($info_file); |
| 2473 | - foreach($list as $filename) |
|
| 2473 | + foreach ($list as $filename) |
|
| 2474 | 2474 | { |
| 2475 | 2475 | $filename = trim($filename); |
| 2476 | - if(!$filename) |
|
| 2476 | + if (!$filename) |
|
| 2477 | 2477 | { |
| 2478 | 2478 | continue; |
| 2479 | 2479 | } |
| 2480 | 2480 | |
| 2481 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2481 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2482 | 2482 | { |
| 2483 | 2483 | $filename = substr($filename, 2); |
| 2484 | 2484 | } |
| 2485 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2485 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2486 | 2486 | { |
| 2487 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
| 2487 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
| 2488 | 2488 | } |
| 2489 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2489 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2490 | 2490 | { |
| 2491 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
| 2491 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
| 2492 | 2492 | } |
| 2493 | 2493 | } |
| 2494 | 2494 | |
| 2495 | - if(is_dir($plugin_path . 'lang')) |
|
| 2495 | + if (is_dir($plugin_path.'lang')) |
|
| 2496 | 2496 | { |
| 2497 | - $self->loadLang($plugin_path . 'lang'); |
|
| 2497 | + $self->loadLang($plugin_path.'lang'); |
|
| 2498 | 2498 | } |
| 2499 | 2499 | } |
| 2500 | 2500 | |
@@ -2507,7 +2507,7 @@ discard block |
||
| 2507 | 2507 | function addHtmlHeader($header) |
| 2508 | 2508 | { |
| 2509 | 2509 | $self = self::getInstance(); |
| 2510 | - $self->html_header .= "\n" . $header; |
|
| 2510 | + $self->html_header .= "\n".$header; |
|
| 2511 | 2511 | } |
| 2512 | 2512 | |
| 2513 | 2513 | function clearHtmlHeader() |
@@ -2559,7 +2559,7 @@ discard block |
||
| 2559 | 2559 | function addBodyHeader($header) |
| 2560 | 2560 | { |
| 2561 | 2561 | $self = self::getInstance(); |
| 2562 | - $self->body_header .= "\n" . $header; |
|
| 2562 | + $self->body_header .= "\n".$header; |
|
| 2563 | 2563 | } |
| 2564 | 2564 | |
| 2565 | 2565 | /** |
@@ -2581,7 +2581,7 @@ discard block |
||
| 2581 | 2581 | function addHtmlFooter($footer) |
| 2582 | 2582 | { |
| 2583 | 2583 | $self = self::getInstance(); |
| 2584 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
| 2584 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
| 2585 | 2585 | } |
| 2586 | 2586 | |
| 2587 | 2587 | /** |
@@ -2602,7 +2602,7 @@ discard block |
||
| 2602 | 2602 | */ |
| 2603 | 2603 | function getConfigFile() |
| 2604 | 2604 | { |
| 2605 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
| 2605 | + return _XE_PATH_.'files/config/db.config.php'; |
|
| 2606 | 2606 | } |
| 2607 | 2607 | |
| 2608 | 2608 | /** |
@@ -2612,7 +2612,7 @@ discard block |
||
| 2612 | 2612 | */ |
| 2613 | 2613 | function getFTPConfigFile() |
| 2614 | 2614 | { |
| 2615 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
| 2615 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
| 2616 | 2616 | } |
| 2617 | 2617 | |
| 2618 | 2618 | /** |
@@ -2664,14 +2664,14 @@ discard block |
||
| 2664 | 2664 | $_path = explode('/', $path); |
| 2665 | 2665 | $_base = explode('/', $base_url); |
| 2666 | 2666 | |
| 2667 | - if(!$_base[count($_base) - 1]) |
|
| 2667 | + if (!$_base[count($_base) - 1]) |
|
| 2668 | 2668 | { |
| 2669 | 2669 | array_pop($_base); |
| 2670 | 2670 | } |
| 2671 | 2671 | |
| 2672 | - foreach($_xe as $idx => $dir) |
|
| 2672 | + foreach ($_xe as $idx => $dir) |
|
| 2673 | 2673 | { |
| 2674 | - if($_path[0] != $dir) |
|
| 2674 | + if ($_path[0] != $dir) |
|
| 2675 | 2675 | { |
| 2676 | 2676 | break; |
| 2677 | 2677 | } |
@@ -2679,9 +2679,9 @@ discard block |
||
| 2679 | 2679 | } |
| 2680 | 2680 | |
| 2681 | 2681 | $idx = count($_xe) - $idx - 1; |
| 2682 | - while($idx--) |
|
| 2682 | + while ($idx--) |
|
| 2683 | 2683 | { |
| 2684 | - if(count($_base) > 0) |
|
| 2684 | + if (count($_base) > 0) |
|
| 2685 | 2685 | { |
| 2686 | 2686 | array_shift($_base); |
| 2687 | 2687 | } |
@@ -2691,13 +2691,13 @@ discard block |
||
| 2691 | 2691 | } |
| 2692 | 2692 | } |
| 2693 | 2693 | |
| 2694 | - if(count($_base) > 0) |
|
| 2694 | + if (count($_base) > 0) |
|
| 2695 | 2695 | { |
| 2696 | 2696 | array_unshift($_path, join('/', $_base)); |
| 2697 | 2697 | } |
| 2698 | 2698 | |
| 2699 | - $path = '/' . join('/', $_path); |
|
| 2700 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2699 | + $path = '/'.join('/', $_path); |
|
| 2700 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2701 | 2701 | { |
| 2702 | 2702 | $path .= '/'; |
| 2703 | 2703 | } |
@@ -2712,13 +2712,13 @@ discard block |
||
| 2712 | 2712 | { |
| 2713 | 2713 | $self = self::getInstance(); |
| 2714 | 2714 | |
| 2715 | - if(!is_array($self->meta_tags)) |
|
| 2715 | + if (!is_array($self->meta_tags)) |
|
| 2716 | 2716 | { |
| 2717 | 2717 | $self->meta_tags = array(); |
| 2718 | 2718 | } |
| 2719 | 2719 | |
| 2720 | 2720 | $ret = array(); |
| 2721 | - foreach($self->meta_tags as $key => $val) |
|
| 2721 | + foreach ($self->meta_tags as $key => $val) |
|
| 2722 | 2722 | { |
| 2723 | 2723 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2724 | 2724 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2738,7 +2738,7 @@ discard block |
||
| 2738 | 2738 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
| 2739 | 2739 | { |
| 2740 | 2740 | $self = self::getInstance(); |
| 2741 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
| 2741 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
| 2742 | 2742 | } |
| 2743 | 2743 | |
| 2744 | 2744 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function getInstance() |
| 25 | 25 | { |
| 26 | - if(!$GLOBALS['__CacheFile__']) |
|
| 26 | + if (!$GLOBALS['__CacheFile__']) |
|
| 27 | 27 | { |
| 28 | 28 | $GLOBALS['__CacheFile__'] = new CacheFile(); |
| 29 | 29 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function __construct() |
| 39 | 39 | { |
| 40 | - $this->cache_dir = _XE_PATH_ . $this->cache_dir; |
|
| 40 | + $this->cache_dir = _XE_PATH_.$this->cache_dir; |
|
| 41 | 41 | FileHandler::makeDir($this->cache_dir); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | function getCacheFileName($key) |
| 51 | 51 | { |
| 52 | - return $this->cache_dir . str_replace(':', DIRECTORY_SEPARATOR, $key) . '.php'; |
|
| 52 | + return $this->cache_dir.str_replace(':', DIRECTORY_SEPARATOR, $key).'.php'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | $content = array(); |
| 80 | 80 | $content[] = '<?php'; |
| 81 | 81 | $content[] = 'if(!defined(\'__XE__\')) { exit(); }'; |
| 82 | - $content[] = 'return \'' . $data . '\';'; |
|
| 82 | + $content[] = 'return \''.$data.'\';'; |
|
| 83 | 83 | FileHandler::writeFile($cache_file, implode(PHP_EOL, $content)); |
| 84 | - if(function_exists('opcache_invalidate')) |
|
| 84 | + if (function_exists('opcache_invalidate')) |
|
| 85 | 85 | { |
| 86 | 86 | @opcache_invalidate($cache_file, true); |
| 87 | 87 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $cache_file = $this->getCacheFileName($key); |
| 100 | 100 | |
| 101 | - if(file_exists($cache_file)) |
|
| 101 | + if (file_exists($cache_file)) |
|
| 102 | 102 | { |
| 103 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
| 103 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
| 104 | 104 | { |
| 105 | 105 | FileHandler::removeFile($cache_file); |
| 106 | 106 | return false; |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | function get($key, $modified_time = 0) |
| 123 | 123 | { |
| 124 | - if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
| 124 | + if (!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
| 125 | 125 | { |
| 126 | 126 | return false; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
| 129 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
| 130 | 130 | { |
| 131 | 131 | FileHandler::removeFile($cache_file); |
| 132 | 132 | return false; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | function _delete($_key) |
| 147 | 147 | { |
| 148 | 148 | $cache_file = $this->getCacheFileName($_key); |
| 149 | - if(function_exists('opcache_invalidate')) |
|
| 149 | + if (function_exists('opcache_invalidate')) |
|
| 150 | 150 | { |
| 151 | 151 | @opcache_invalidate($cache_file, true); |
| 152 | 152 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function getDocumentExtraVarsFromDB($documentSrls) |
| 39 | 39 | { |
| 40 | - if(!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 40 | + if (!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 41 | 41 | { |
| 42 | 42 | return new BaseObject(-1, 'msg_invalid_request'); |
| 43 | 43 | } |
@@ -58,52 +58,52 @@ discard block |
||
| 58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
| 59 | 59 | |
| 60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
| 61 | - if(count($_document_list) <= 0) return; |
|
| 61 | + if (count($_document_list) <= 0) return; |
|
| 62 | 62 | |
| 63 | 63 | // Find all called the document object variable has been set extension |
| 64 | 64 | $document_srls = array(); |
| 65 | - foreach($_document_list as $key => $val) |
|
| 65 | + foreach ($_document_list as $key => $val) |
|
| 66 | 66 | { |
| 67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 67 | + if (!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 68 | 68 | $checked_documents[$val->document_srl] = true; |
| 69 | 69 | $document_srls[] = $val->document_srl; |
| 70 | 70 | } |
| 71 | 71 | // If the document number, return detected |
| 72 | - if(!count($document_srls)) return; |
|
| 72 | + if (!count($document_srls)) return; |
|
| 73 | 73 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
| 74 | 74 | //$obj->document_srl = implode(',',$document_srls); |
| 75 | 75 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
| 76 | - if($output->toBool() && $output->data) |
|
| 76 | + if ($output->toBool() && $output->data) |
|
| 77 | 77 | { |
| 78 | - foreach($output->data as $key => $val) |
|
| 78 | + foreach ($output->data as $key => $val) |
|
| 79 | 79 | { |
| 80 | - if(!isset($val->value)) continue; |
|
| 81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 80 | + if (!isset($val->value)) continue; |
|
| 81 | + if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 82 | 82 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $user_lang_code = Context::getLangType(); |
| 87 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
| 87 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
| 88 | 88 | { |
| 89 | 89 | $document_srl = $document_srls[$i]; |
| 90 | 90 | unset($vars); |
| 91 | 91 | |
| 92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 92 | + if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 93 | 93 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
| 94 | 94 | $extra_keys = $this->getExtraKeys($module_srl); |
| 95 | 95 | $vars = $extra_vars[$document_srl]; |
| 96 | 96 | $document_lang_code = $_document_list[$document_srl]->get('lang_code'); |
| 97 | 97 | // Expand the variable processing |
| 98 | - if(count($extra_keys)) |
|
| 98 | + if (count($extra_keys)) |
|
| 99 | 99 | { |
| 100 | - foreach($extra_keys as $idx => $key) |
|
| 100 | + foreach ($extra_keys as $idx => $key) |
|
| 101 | 101 | { |
| 102 | 102 | $extra_keys[$idx] = clone($key); |
| 103 | 103 | $val = $vars[$idx]; |
| 104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 106 | - else if(isset($val[0])) $v = $val[0]; |
|
| 104 | + if (isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 105 | + else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 106 | + else if (isset($val[0])) $v = $val[0]; |
|
| 107 | 107 | else $v = null; |
| 108 | 108 | $extra_keys[$idx]->value = $v; |
| 109 | 109 | } |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | $evars = new ExtraVar($module_srl); |
| 114 | 114 | $evars->setExtraVarKeys($extra_keys); |
| 115 | 115 | // Title Processing |
| 116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 116 | + if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]); |
|
| 117 | 117 | // Information processing |
| 118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 118 | + if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]); |
|
| 119 | 119 | |
| 120 | 120 | // static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남 |
| 121 | 121 | /* |
@@ -137,21 +137,21 @@ discard block |
||
| 137 | 137 | * @param array $columnList |
| 138 | 138 | * @return documentItem |
| 139 | 139 | */ |
| 140 | - function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 140 | + function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 141 | 141 | { |
| 142 | - if(!$document_srl) return new documentItem(); |
|
| 142 | + if (!$document_srl) return new documentItem(); |
|
| 143 | 143 | |
| 144 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 144 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 145 | 145 | { |
| 146 | 146 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
| 147 | - if(!$oDocument->isExists()) |
|
| 147 | + if (!$oDocument->isExists()) |
|
| 148 | 148 | { |
| 149 | 149 | return $oDocument; |
| 150 | 150 | } |
| 151 | 151 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 152 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 152 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 153 | 153 | } |
| 154 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 154 | + if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 155 | 155 | |
| 156 | 156 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 157 | 157 | } |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | * @param array $columnList |
| 165 | 165 | * @return array value type is documentItem |
| 166 | 166 | */ |
| 167 | - function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 167 | + function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 168 | 168 | { |
| 169 | - if(is_array($document_srls)) |
|
| 169 | + if (is_array($document_srls)) |
|
| 170 | 170 | { |
| 171 | 171 | $list_count = count($document_srls); |
| 172 | - $document_srls = implode(',',$document_srls); |
|
| 172 | + $document_srls = implode(',', $document_srls); |
|
| 173 | 173 | } |
| 174 | 174 | else |
| 175 | 175 | { |
@@ -182,33 +182,33 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $output = executeQuery('document.getDocuments', $args, $columnList); |
| 184 | 184 | $document_list = $output->data; |
| 185 | - if(!$document_list) return; |
|
| 186 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 185 | + if (!$document_list) return; |
|
| 186 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 187 | 187 | |
| 188 | 188 | $document_count = count($document_list); |
| 189 | - foreach($document_list as $key => $attribute) |
|
| 189 | + foreach ($document_list as $key => $attribute) |
|
| 190 | 190 | { |
| 191 | 191 | $document_srl = $attribute->document_srl; |
| 192 | - if(!$document_srl) continue; |
|
| 192 | + if (!$document_srl) continue; |
|
| 193 | 193 | |
| 194 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 194 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 195 | 195 | { |
| 196 | 196 | $oDocument = null; |
| 197 | 197 | $oDocument = new documentItem(); |
| 198 | 198 | $oDocument->setAttribute($attribute, false); |
| 199 | - if($is_admin) $oDocument->setGrant(); |
|
| 199 | + if ($is_admin) $oDocument->setGrant(); |
|
| 200 | 200 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 206 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 207 | 207 | |
| 208 | 208 | $output = null; |
| 209 | - if(count($result)) |
|
| 209 | + if (count($result)) |
|
| 210 | 210 | { |
| 211 | - foreach($result as $document_srl => $val) |
|
| 211 | + foreach ($result as $document_srl => $val) |
|
| 212 | 212 | { |
| 213 | 213 | $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 214 | 214 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param array $columnList |
| 226 | 226 | * @return BaseObject |
| 227 | 227 | */ |
| 228 | - function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) |
|
| 228 | + function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array()) |
|
| 229 | 229 | { |
| 230 | 230 | $sort_check = $this->_setSortIndex($obj, $load_extra_vars); |
| 231 | 231 | $obj->sort_index = $sort_check->sort_index; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | // Call trigger (before) |
| 236 | 236 | // This trigger can be used to set an alternative output using a different search method |
| 237 | 237 | $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); |
| 238 | - if($output instanceof BaseObject && !$output->toBool()) |
|
| 238 | + if ($output instanceof BaseObject && !$output->toBool()) |
|
| 239 | 239 | { |
| 240 | 240 | return $output; |
| 241 | 241 | } |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | $output = $obj->use_alternate_output; |
| 253 | 253 | unset($obj->use_alternate_output); |
| 254 | 254 | } |
| 255 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 255 | + elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars')) |
|
| 256 | 256 | { |
| 257 | 257 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
| 258 | - $args->sort_index = str_replace('documents.','',$args->sort_index); |
|
| 258 | + $args->sort_index = str_replace('documents.', '', $args->sort_index); |
|
| 259 | 259 | $output = executeQueryArray($query_id, $args); |
| 260 | 260 | } |
| 261 | 261 | elseif ($sort_check->isExtraVars) |
@@ -267,16 +267,16 @@ discard block |
||
| 267 | 267 | // document.getDocumentList query execution |
| 268 | 268 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
| 269 | 269 | $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1); |
| 270 | - if(isset($groupByQuery[$query_id])) |
|
| 270 | + if (isset($groupByQuery[$query_id])) |
|
| 271 | 271 | { |
| 272 | 272 | $group_args = clone($args); |
| 273 | 273 | $group_args->sort_index = 'documents.'.$args->sort_index; |
| 274 | 274 | $output = executeQueryArray($query_id, $group_args); |
| 275 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 275 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 276 | 276 | |
| 277 | - foreach($output->data as $key => $val) |
|
| 277 | + foreach ($output->data as $key => $val) |
|
| 278 | 278 | { |
| 279 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 279 | + if ($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $page_navigation = $output->page_navigation; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $virtual_number = $keys[0]; |
| 285 | 285 | |
| 286 | 286 | $target_args = new stdClass(); |
| 287 | - $target_args->document_srls = implode(',',$target_srls); |
|
| 287 | + $target_args->document_srls = implode(',', $target_srls); |
|
| 288 | 288 | $target_args->list_order = $args->sort_index; |
| 289 | 289 | $target_args->order_type = $args->order_type; |
| 290 | 290 | $target_args->list_count = $args->list_count; |
@@ -301,35 +301,35 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | // Return if no result or an error occurs |
| 304 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 304 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 305 | 305 | $idx = 0; |
| 306 | 306 | $data = $output->data; |
| 307 | 307 | unset($output->data); |
| 308 | 308 | |
| 309 | - if(!isset($virtual_number)) |
|
| 309 | + if (!isset($virtual_number)) |
|
| 310 | 310 | { |
| 311 | 311 | $keys = array_keys($data); |
| 312 | 312 | $virtual_number = $keys[0]; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - if($except_notice) |
|
| 315 | + if ($except_notice) |
|
| 316 | 316 | { |
| 317 | - foreach($data as $key => $attribute) |
|
| 317 | + foreach ($data as $key => $attribute) |
|
| 318 | 318 | { |
| 319 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
| 319 | + if ($attribute->is_notice == 'Y') $virtual_number--; |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - foreach($data as $key => $attribute) |
|
| 323 | + foreach ($data as $key => $attribute) |
|
| 324 | 324 | { |
| 325 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 325 | + if ($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 326 | 326 | $document_srl = $attribute->document_srl; |
| 327 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 327 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 328 | 328 | { |
| 329 | 329 | $oDocument = null; |
| 330 | 330 | $oDocument = new documentItem(); |
| 331 | 331 | $oDocument->setAttribute($attribute, false); |
| 332 | - if($is_admin) $oDocument->setGrant(); |
|
| 332 | + if ($is_admin) $oDocument->setGrant(); |
|
| 333 | 333 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 334 | 334 | } |
| 335 | 335 | |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | $virtual_number--; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 340 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 341 | 341 | |
| 342 | - if(count($output->data)) |
|
| 342 | + if (count($output->data)) |
|
| 343 | 343 | { |
| 344 | - foreach($output->data as $number => $document) |
|
| 344 | + foreach ($output->data as $number => $document) |
|
| 345 | 345 | { |
| 346 | 346 | $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl]; |
| 347 | 347 | } |
@@ -363,16 +363,16 @@ discard block |
||
| 363 | 363 | { |
| 364 | 364 | $args = new stdClass(); |
| 365 | 365 | $args->module_srl = $obj->module_srl; |
| 366 | - $args->category_srl= $obj->category_srl; |
|
| 366 | + $args->category_srl = $obj->category_srl; |
|
| 367 | 367 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
| 368 | - if(!$output->toBool()||!$output->data) return; |
|
| 368 | + if (!$output->toBool() || !$output->data) return; |
|
| 369 | 369 | |
| 370 | - foreach($output->data as $key => $val) |
|
| 370 | + foreach ($output->data as $key => $val) |
|
| 371 | 371 | { |
| 372 | 372 | $document_srl = $val->document_srl; |
| 373 | - if(!$document_srl) continue; |
|
| 373 | + if (!$document_srl) continue; |
|
| 374 | 374 | |
| 375 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 375 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 376 | 376 | { |
| 377 | 377 | $oDocument = null; |
| 378 | 378 | $oDocument = new documentItem(); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | $this->setToAllDocumentExtraVars(); |
| 385 | 385 | |
| 386 | - foreach($result->data as $document_srl => $val) |
|
| 386 | + foreach ($result->data as $document_srl => $val) |
|
| 387 | 387 | { |
| 388 | 388 | $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 389 | 389 | } |
@@ -399,20 +399,20 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | function getExtraKeys($module_srl) |
| 401 | 401 | { |
| 402 | - if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 402 | + if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 403 | 403 | { |
| 404 | 404 | $keys = false; |
| 405 | 405 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 406 | - if($oCacheHandler->isSupport()) |
|
| 406 | + if ($oCacheHandler->isSupport()) |
|
| 407 | 407 | { |
| 408 | - $object_key = 'module_document_extra_keys:' . $module_srl; |
|
| 408 | + $object_key = 'module_document_extra_keys:'.$module_srl; |
|
| 409 | 409 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 410 | 410 | $keys = $oCacheHandler->get($cache_key); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | $oExtraVar = ExtraVar::getInstance($module_srl); |
| 414 | 414 | |
| 415 | - if($keys === false) |
|
| 415 | + if ($keys === false) |
|
| 416 | 416 | { |
| 417 | 417 | $obj = new stdClass(); |
| 418 | 418 | $obj->module_srl = $module_srl; |
@@ -422,13 +422,13 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | // correcting index order |
| 424 | 424 | $isFixed = FALSE; |
| 425 | - if(is_array($output->data)) |
|
| 425 | + if (is_array($output->data)) |
|
| 426 | 426 | { |
| 427 | 427 | $prevIdx = 0; |
| 428 | - foreach($output->data as $no => $value) |
|
| 428 | + foreach ($output->data as $no => $value) |
|
| 429 | 429 | { |
| 430 | 430 | // case first |
| 431 | - if($prevIdx == 0 && $value->idx != 1) |
|
| 431 | + if ($prevIdx == 0 && $value->idx != 1) |
|
| 432 | 432 | { |
| 433 | 433 | $args = new stdClass(); |
| 434 | 434 | $args->module_srl = $module_srl; |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | // case others |
| 445 | - if($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 445 | + if ($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 446 | 446 | { |
| 447 | 447 | $args = new stdClass(); |
| 448 | 448 | $args->module_srl = $module_srl; |
@@ -459,16 +459,16 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - if($isFixed) |
|
| 462 | + if ($isFixed) |
|
| 463 | 463 | { |
| 464 | 464 | $output = executeQueryArray('document.getDocumentExtraKeys', $obj); |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | $oExtraVar->setExtraVarKeys($output->data); |
| 468 | 468 | $keys = $oExtraVar->getExtraVars(); |
| 469 | - if(!$keys) $keys = array(); |
|
| 469 | + if (!$keys) $keys = array(); |
|
| 470 | 470 | |
| 471 | - if($oCacheHandler->isSupport()) |
|
| 471 | + if ($oCacheHandler->isSupport()) |
|
| 472 | 472 | { |
| 473 | 473 | $oCacheHandler->put($cache_key, $keys); |
| 474 | 474 | } |
@@ -489,14 +489,14 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | function getExtraVars($module_srl, $document_srl) |
| 491 | 491 | { |
| 492 | - if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 492 | + if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 493 | 493 | { |
| 494 | 494 | // Extended to extract the values of variables set |
| 495 | 495 | $oDocument = $this->getDocument($document_srl, false); |
| 496 | 496 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 497 | 497 | $this->setToAllDocumentExtraVars(); |
| 498 | 498 | } |
| 499 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 499 | + if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 500 | 500 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -519,71 +519,71 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | $oDocumentController = getController('document'); |
| 521 | 521 | // Members must be a possible feature |
| 522 | - if($logged_info->member_srl) |
|
| 522 | + if ($logged_info->member_srl) |
|
| 523 | 523 | { |
| 524 | 524 | $oDocumentModel = getModel('document'); |
| 525 | 525 | $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); |
| 526 | 526 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 527 | 527 | $module_srl = $oDocument->get('module_srl'); |
| 528 | 528 | $member_srl = $oDocument->get('member_srl'); |
| 529 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 529 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 530 | 530 | |
| 531 | 531 | $oModuleModel = getModel('module'); |
| 532 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 533 | - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) |
|
| 532 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 533 | + if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
| 534 | 534 | { |
| 535 | 535 | // Add a Referral Button |
| 536 | 536 | $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); |
| 537 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); |
|
| 537 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) |
|
| 540 | + if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
| 541 | 541 | { |
| 542 | 542 | // Add button to negative |
| 543 | - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 544 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); |
|
| 543 | + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 544 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | // Adding Report |
| 548 | 548 | $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); |
| 549 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript'); |
|
| 549 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript'); |
|
| 550 | 550 | |
| 551 | 551 | // Add Bookmark button |
| 552 | 552 | $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); |
| 553 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript'); |
|
| 553 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript'); |
|
| 554 | 554 | } |
| 555 | 555 | // Add print button |
| 556 | - $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); |
|
| 557 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument'); |
|
| 556 | + $url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl); |
|
| 557 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument'); |
|
| 558 | 558 | // Call a trigger (after) |
| 559 | 559 | ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); |
| 560 | - if($this->grant->manager) |
|
| 560 | + if ($this->grant->manager) |
|
| 561 | 561 | { |
| 562 | 562 | $str_confirm = Context::getLang('confirm_move'); |
| 563 | 563 | $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl); |
| 564 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript'); |
|
| 564 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | // If you are managing to find posts by ip |
| 568 | - if($logged_info->is_admin == 'Y') |
|
| 568 | + if ($logged_info->is_admin == 'Y') |
|
| 569 | 569 | { |
| 570 | 570 | $oDocumentModel = getModel('document'); |
| 571 | - $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 571 | + $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 572 | 572 | |
| 573 | - if($oDocument->isExists()) |
|
| 573 | + if ($oDocument->isExists()) |
|
| 574 | 574 | { |
| 575 | 575 | // Find a post equivalent to ip address |
| 576 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress()); |
|
| 577 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); |
|
| 576 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress()); |
|
| 577 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); |
|
| 578 | 578 | |
| 579 | 579 | $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress()); |
| 580 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript'); |
|
| 580 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); |
|
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | 583 | // Changing the language of pop-up menu |
| 584 | 584 | $menus = Context::get('document_popup_menu_list'); |
| 585 | 585 | $menus_count = count($menus); |
| 586 | - for($i=0;$i<$menus_count;$i++) |
|
| 586 | + for ($i = 0; $i < $menus_count; $i++) |
|
| 587 | 587 | { |
| 588 | 588 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
| 589 | 589 | } |
@@ -599,13 +599,13 @@ discard block |
||
| 599 | 599 | */ |
| 600 | 600 | function getDocumentCount($module_srl, $search_obj = NULL) |
| 601 | 601 | { |
| 602 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
| 602 | + if (is_null($search_obj)) $search_obj = new stdClass(); |
|
| 603 | 603 | $search_obj->module_srl = $module_srl; |
| 604 | 604 | |
| 605 | 605 | $output = executeQuery('document.getDocumentCount', $search_obj); |
| 606 | 606 | // Return total number of |
| 607 | 607 | $total_count = $output->data->count; |
| 608 | - return (int)$total_count; |
|
| 608 | + return (int) $total_count; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | function getDocumentCountByGroupStatus($search_obj = NULL) |
| 617 | 617 | { |
| 618 | 618 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
| 619 | - if(!$output->toBool()) return array(); |
|
| 619 | + if (!$output->toBool()) return array(); |
|
| 620 | 620 | |
| 621 | 621 | return $output->data; |
| 622 | 622 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $output = executeQuery('document.getDocumentExtraVarsCount', $args); |
| 636 | 636 | // Return total number of |
| 637 | 637 | $total_count = $output->data->count; |
| 638 | - return (int)$total_count; |
|
| 638 | + return (int) $total_count; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
@@ -652,29 +652,29 @@ discard block |
||
| 652 | 652 | |
| 653 | 653 | $this->_setSearchOption($opt, $args, $query_id, $use_division); |
| 654 | 654 | |
| 655 | - if($sort_check->isExtraVars) |
|
| 655 | + if ($sort_check->isExtraVars) |
|
| 656 | 656 | { |
| 657 | 657 | return 1; |
| 658 | 658 | } |
| 659 | 659 | else |
| 660 | 660 | { |
| 661 | - if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 661 | + if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 662 | 662 | { |
| 663 | - if($args->order_type === 'desc') |
|
| 663 | + if ($args->order_type === 'desc') |
|
| 664 | 664 | { |
| 665 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 665 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 666 | 666 | } |
| 667 | 667 | else |
| 668 | 668 | { |
| 669 | 669 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | - elseif($sort_check->sort_index === 'regdate') |
|
| 672 | + elseif ($sort_check->sort_index === 'regdate') |
|
| 673 | 673 | { |
| 674 | 674 | |
| 675 | - if($args->order_type === 'asc') |
|
| 675 | + if ($args->order_type === 'asc') |
|
| 676 | 676 | { |
| 677 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 677 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 678 | 678 | } |
| 679 | 679 | else |
| 680 | 680 | { |
@@ -689,9 +689,9 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // Guhanhu total number of the article search page |
| 692 | - $output = executeQuery($query_id . 'Page', $args); |
|
| 692 | + $output = executeQuery($query_id.'Page', $args); |
|
| 693 | 693 | $count = $output->data->count; |
| 694 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
| 694 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
| 695 | 695 | return $page; |
| 696 | 696 | } |
| 697 | 697 | |
@@ -703,16 +703,16 @@ discard block |
||
| 703 | 703 | */ |
| 704 | 704 | function getCategory($category_srl, $columnList = array()) |
| 705 | 705 | { |
| 706 | - $args =new stdClass(); |
|
| 706 | + $args = new stdClass(); |
|
| 707 | 707 | $args->category_srl = $category_srl; |
| 708 | 708 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 709 | 709 | |
| 710 | 710 | $node = $output->data; |
| 711 | - if(!$node) return; |
|
| 711 | + if (!$node) return; |
|
| 712 | 712 | |
| 713 | - if($node->group_srls) |
|
| 713 | + if ($node->group_srls) |
|
| 714 | 714 | { |
| 715 | - $group_srls = explode(',',$node->group_srls); |
|
| 715 | + $group_srls = explode(',', $node->group_srls); |
|
| 716 | 716 | unset($node->group_srls); |
| 717 | 717 | $node->group_srls = $group_srls; |
| 718 | 718 | } |
@@ -733,8 +733,8 @@ discard block |
||
| 733 | 733 | { |
| 734 | 734 | $args = new stdClass(); |
| 735 | 735 | $args->category_srl = $category_srl; |
| 736 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
| 737 | - if($output->data->count > 0) return true; |
|
| 736 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
| 737 | + if ($output->data->count > 0) return true; |
|
| 738 | 738 | return false; |
| 739 | 739 | } |
| 740 | 740 | |
@@ -747,15 +747,15 @@ discard block |
||
| 747 | 747 | */ |
| 748 | 748 | function getCategoryList($module_srl, $columnList = array()) |
| 749 | 749 | { |
| 750 | - $module_srl = (int)$module_srl; |
|
| 750 | + $module_srl = (int) $module_srl; |
|
| 751 | 751 | |
| 752 | 752 | // Category of the target module file swollen |
| 753 | 753 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
| 754 | 754 | // If the target file to the cache file regeneration category |
| 755 | - if(!file_exists($filename)) |
|
| 755 | + if (!file_exists($filename)) |
|
| 756 | 756 | { |
| 757 | 757 | $oDocumentController = getController('document'); |
| 758 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 758 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | include($filename); |
@@ -775,10 +775,10 @@ discard block |
||
| 775 | 775 | */ |
| 776 | 776 | function _arrangeCategory(&$document_category, $list, $depth) |
| 777 | 777 | { |
| 778 | - if(!count($list)) return; |
|
| 778 | + if (!count($list)) return; |
|
| 779 | 779 | $idx = 0; |
| 780 | 780 | $list_order = array(); |
| 781 | - foreach($list as $key => $val) |
|
| 781 | + foreach ($list as $key => $val) |
|
| 782 | 782 | { |
| 783 | 783 | $obj = new stdClass; |
| 784 | 784 | $obj->mid = $val['mid']; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | $obj->parent_srl = $val['parent_srl']; |
| 788 | 788 | $obj->title = $obj->text = $val['text']; |
| 789 | 789 | $obj->description = $val['description']; |
| 790 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
| 790 | + $obj->expand = $val['expand'] == 'Y' ?true:false; |
|
| 791 | 791 | $obj->color = $val['color']; |
| 792 | 792 | $obj->document_count = $val['document_count']; |
| 793 | 793 | $obj->depth = $depth; |
@@ -795,26 +795,26 @@ discard block |
||
| 795 | 795 | $obj->childs = array(); |
| 796 | 796 | $obj->grant = $val['grant']; |
| 797 | 797 | |
| 798 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 798 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 799 | 799 | else $selected = false; |
| 800 | 800 | |
| 801 | 801 | $obj->selected = $selected; |
| 802 | 802 | |
| 803 | 803 | $list_order[$idx++] = $obj->category_srl; |
| 804 | 804 | // If you have a parent category of child nodes apply data |
| 805 | - if($obj->parent_srl) |
|
| 805 | + if ($obj->parent_srl) |
|
| 806 | 806 | { |
| 807 | 807 | $parent_srl = $obj->parent_srl; |
| 808 | 808 | $document_count = $obj->document_count; |
| 809 | 809 | $expand = $obj->expand; |
| 810 | - if($selected) $expand = true; |
|
| 810 | + if ($selected) $expand = true; |
|
| 811 | 811 | |
| 812 | - while($parent_srl) |
|
| 812 | + while ($parent_srl) |
|
| 813 | 813 | { |
| 814 | 814 | $document_category[$parent_srl]->document_count += $document_count; |
| 815 | 815 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 816 | 816 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 817 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 817 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 818 | 818 | |
| 819 | 819 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 820 | 820 | } |
@@ -822,10 +822,10 @@ discard block |
||
| 822 | 822 | |
| 823 | 823 | $document_category[$key] = $obj; |
| 824 | 824 | |
| 825 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 825 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
| 826 | 826 | } |
| 827 | 827 | $document_category[$list_order[0]]->first = true; |
| 828 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
| 828 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | /** |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | $args->module_srl = $module_srl; |
| 841 | 841 | $args->category_srl = $category_srl; |
| 842 | 842 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
| 843 | - return (int)$output->data->count; |
|
| 843 | + return (int) $output->data->count; |
|
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | /** |
@@ -850,8 +850,8 @@ discard block |
||
| 850 | 850 | */ |
| 851 | 851 | function getCategoryXmlFile($module_srl) |
| 852 | 852 | { |
| 853 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
| 854 | - if(!file_exists($xml_file)) |
|
| 853 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
| 854 | + if (!file_exists($xml_file)) |
|
| 855 | 855 | { |
| 856 | 856 | $oDocumentController = getController('document'); |
| 857 | 857 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -866,8 +866,8 @@ discard block |
||
| 866 | 866 | */ |
| 867 | 867 | function getCategoryPhpFile($module_srl) |
| 868 | 868 | { |
| 869 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
| 870 | - if(!file_exists($php_file)) |
|
| 869 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
| 870 | + if (!file_exists($php_file)) |
|
| 871 | 871 | { |
| 872 | 872 | $oDocumentController = getController('document'); |
| 873 | 873 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | */ |
| 883 | 883 | function getMonthlyArchivedList($obj) |
| 884 | 884 | { |
| 885 | - if($obj->mid) |
|
| 885 | + if ($obj->mid) |
|
| 886 | 886 | { |
| 887 | 887 | $oModuleModel = getModel('module'); |
| 888 | 888 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -890,13 +890,13 @@ discard block |
||
| 890 | 890 | } |
| 891 | 891 | // Module_srl passed the array may be a check whether the array |
| 892 | 892 | $args = new stdClass; |
| 893 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 893 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 894 | 894 | else $args->module_srl = $obj->module_srl; |
| 895 | 895 | |
| 896 | 896 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 897 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 897 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 898 | 898 | |
| 899 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 899 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 900 | 900 | |
| 901 | 901 | return $output; |
| 902 | 902 | } |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | */ |
| 909 | 909 | function getDailyArchivedList($obj) |
| 910 | 910 | { |
| 911 | - if($obj->mid) |
|
| 911 | + if ($obj->mid) |
|
| 912 | 912 | { |
| 913 | 913 | $oModuleModel = getModel('module'); |
| 914 | 914 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -916,14 +916,14 @@ discard block |
||
| 916 | 916 | } |
| 917 | 917 | // Module_srl passed the array may be a check whether the array |
| 918 | 918 | $args = new stdClass; |
| 919 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 919 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 920 | 920 | else $args->module_srl = $obj->module_srl; |
| 921 | 921 | $args->regdate = $obj->regdate; |
| 922 | 922 | |
| 923 | 923 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 924 | - if(!$output->toBool()) return $output; |
|
| 924 | + if (!$output->toBool()) return $output; |
|
| 925 | 925 | |
| 926 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 926 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 927 | 927 | |
| 928 | 928 | return $output; |
| 929 | 929 | } |
@@ -934,17 +934,17 @@ discard block |
||
| 934 | 934 | */ |
| 935 | 935 | function getDocumentCategories() |
| 936 | 936 | { |
| 937 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 937 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 938 | 938 | $module_srl = Context::get('module_srl'); |
| 939 | - $categories= $this->getCategoryList($module_srl); |
|
| 939 | + $categories = $this->getCategoryList($module_srl); |
|
| 940 | 940 | $lang = Context::get('lang'); |
| 941 | 941 | // No additional category |
| 942 | 942 | $output = "0,0,{$lang->none_category}\n"; |
| 943 | - if($categories) |
|
| 943 | + if ($categories) |
|
| 944 | 944 | { |
| 945 | - foreach($categories as $category_srl => $category) |
|
| 945 | + foreach ($categories as $category_srl => $category) |
|
| 946 | 946 | { |
| 947 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
| 947 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
| 948 | 948 | } |
| 949 | 949 | } |
| 950 | 950 | $this->add('categories', $output); |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | */ |
| 957 | 957 | function getDocumentConfig() |
| 958 | 958 | { |
| 959 | - if($this->documentConfig === NULL) |
|
| 959 | + if ($this->documentConfig === NULL) |
|
| 960 | 960 | { |
| 961 | 961 | $oModuleModel = getModel('module'); |
| 962 | 962 | $config = $oModuleModel->getModuleConfig('document'); |
@@ -1029,11 +1029,11 @@ discard block |
||
| 1029 | 1029 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1030 | 1030 | // Check permissions |
| 1031 | 1031 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1032 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1032 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1033 | 1033 | |
| 1034 | 1034 | $category_srl = Context::get('category_srl'); |
| 1035 | 1035 | $category_info = $this->getCategory($category_srl); |
| 1036 | - if(!$category_info) |
|
| 1036 | + if (!$category_info) |
|
| 1037 | 1037 | { |
| 1038 | 1038 | return new BaseObject(-1, 'msg_invalid_request'); |
| 1039 | 1039 | } |
@@ -1049,14 +1049,14 @@ discard block |
||
| 1049 | 1049 | */ |
| 1050 | 1050 | function getDocumentSrlByAlias($mid, $alias) |
| 1051 | 1051 | { |
| 1052 | - if(!$mid || !$alias) return null; |
|
| 1052 | + if (!$mid || !$alias) return null; |
|
| 1053 | 1053 | $site_module_info = Context::get('site_module_info'); |
| 1054 | 1054 | $args = new stdClass; |
| 1055 | 1055 | $args->mid = $mid; |
| 1056 | 1056 | $args->alias_title = $alias; |
| 1057 | 1057 | $args->site_srl = $site_module_info->site_srl; |
| 1058 | 1058 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1059 | - if(!$output->data) return null; |
|
| 1059 | + if (!$output->data) return null; |
|
| 1060 | 1060 | else return $output->data->document_srl; |
| 1061 | 1061 | } |
| 1062 | 1062 | |
@@ -1068,15 +1068,15 @@ discard block |
||
| 1068 | 1068 | */ |
| 1069 | 1069 | function getDocumentSrlByTitle($module_srl, $title) |
| 1070 | 1070 | { |
| 1071 | - if(!$module_srl || !$title) return null; |
|
| 1071 | + if (!$module_srl || !$title) return null; |
|
| 1072 | 1072 | $args = new stdClass; |
| 1073 | 1073 | $args->module_srl = $module_srl; |
| 1074 | 1074 | $args->title = $title; |
| 1075 | 1075 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1076 | - if(!$output->data) return null; |
|
| 1076 | + if (!$output->data) return null; |
|
| 1077 | 1077 | else |
| 1078 | 1078 | { |
| 1079 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1079 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1080 | 1080 | return $output->data->document_srl; |
| 1081 | 1081 | } |
| 1082 | 1082 | } |
@@ -1088,12 +1088,12 @@ discard block |
||
| 1088 | 1088 | */ |
| 1089 | 1089 | function getAlias($document_srl) |
| 1090 | 1090 | { |
| 1091 | - if(!$document_srl) return null; |
|
| 1091 | + if (!$document_srl) return null; |
|
| 1092 | 1092 | $args = new stdClass; |
| 1093 | 1093 | $args->document_srl = $document_srl; |
| 1094 | 1094 | $output = executeQueryArray('document.getAliases', $args); |
| 1095 | 1095 | |
| 1096 | - if(!$output->data) return null; |
|
| 1096 | + if (!$output->data) return null; |
|
| 1097 | 1097 | else return $output->data[0]->alias_title; |
| 1098 | 1098 | } |
| 1099 | 1099 | |
@@ -1136,32 +1136,32 @@ discard block |
||
| 1136 | 1136 | { |
| 1137 | 1137 | // Variable check |
| 1138 | 1138 | $args = new stdClass; |
| 1139 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
| 1139 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
| 1140 | 1140 | $args->sort_index = $obj->sort_index; |
| 1141 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
| 1142 | - $args->page = $obj->page?$obj->page:1; |
|
| 1143 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
| 1144 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
| 1141 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
| 1142 | + $args->page = $obj->page ? $obj->page : 1; |
|
| 1143 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
| 1144 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
| 1145 | 1145 | // Search options |
| 1146 | 1146 | $search_target = $obj->search_target; |
| 1147 | 1147 | $search_keyword = $obj->search_keyword; |
| 1148 | - if($search_target && $search_keyword) |
|
| 1148 | + if ($search_target && $search_keyword) |
|
| 1149 | 1149 | { |
| 1150 | - switch($search_target) |
|
| 1150 | + switch ($search_target) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | case 'title' : |
| 1153 | 1153 | case 'content' : |
| 1154 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1154 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1155 | 1155 | $args->{"s_".$search_target} = $search_keyword; |
| 1156 | 1156 | $use_division = true; |
| 1157 | 1157 | break; |
| 1158 | 1158 | case 'title_content' : |
| 1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1159 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1160 | 1160 | $args->s_title = $search_keyword; |
| 1161 | 1161 | $args->s_content = $search_keyword; |
| 1162 | 1162 | break; |
| 1163 | 1163 | case 'user_id' : |
| 1164 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1164 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1165 | 1165 | $args->s_user_id = $search_keyword; |
| 1166 | 1166 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1167 | 1167 | break; |
@@ -1169,13 +1169,13 @@ discard block |
||
| 1169 | 1169 | case 'nick_name' : |
| 1170 | 1170 | case 'email_address' : |
| 1171 | 1171 | case 'homepage' : |
| 1172 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1172 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1173 | 1173 | $args->{"s_".$search_target} = $search_keyword; |
| 1174 | 1174 | break; |
| 1175 | 1175 | case 'is_notice' : |
| 1176 | 1176 | case 'is_secret' : |
| 1177 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1178 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1177 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1178 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1179 | 1179 | break; |
| 1180 | 1180 | case 'member_srl' : |
| 1181 | 1181 | case 'readed_count' : |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | case 'comment_count' : |
| 1185 | 1185 | case 'trackback_count' : |
| 1186 | 1186 | case 'uploaded_count' : |
| 1187 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1187 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1188 | 1188 | break; |
| 1189 | 1189 | case 'regdate' : |
| 1190 | 1190 | case 'last_update' : |
@@ -1196,9 +1196,9 @@ discard block |
||
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | $output = executeQueryArray('document.getTrashList', $args); |
| 1199 | - if($output->data) |
|
| 1199 | + if ($output->data) |
|
| 1200 | 1200 | { |
| 1201 | - foreach($output->data as $key => $attribute) |
|
| 1201 | + foreach ($output->data as $key => $attribute) |
|
| 1202 | 1202 | { |
| 1203 | 1203 | $oDocument = null; |
| 1204 | 1204 | $oDocument = new documentItem(); |
@@ -1217,46 +1217,46 @@ discard block |
||
| 1217 | 1217 | { |
| 1218 | 1218 | $args = new stdClass; |
| 1219 | 1219 | $document_srl = Context::get('document_srl'); |
| 1220 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1220 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1221 | 1221 | |
| 1222 | 1222 | $point = Context::get('point'); |
| 1223 | - if($point != -1) $point = 1; |
|
| 1223 | + if ($point != -1) $point = 1; |
|
| 1224 | 1224 | |
| 1225 | 1225 | $oDocumentModel = getModel('document'); |
| 1226 | 1226 | $columnList = array('document_srl', 'module_srl'); |
| 1227 | 1227 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1228 | 1228 | $module_srl = $oDocument->get('module_srl'); |
| 1229 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1229 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1230 | 1230 | |
| 1231 | 1231 | $oModuleModel = getModel('module'); |
| 1232 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 1233 | - if($point == -1) |
|
| 1232 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 1233 | + if ($point == -1) |
|
| 1234 | 1234 | { |
| 1235 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1235 | + if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1236 | 1236 | $args->below_point = 0; |
| 1237 | 1237 | } |
| 1238 | 1238 | else |
| 1239 | 1239 | { |
| 1240 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1240 | + if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1241 | 1241 | $args->more_point = 0; |
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | $args->document_srl = $document_srl; |
| 1245 | 1245 | |
| 1246 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
| 1247 | - if(!$output->toBool()) return $output; |
|
| 1246 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
| 1247 | + if (!$output->toBool()) return $output; |
|
| 1248 | 1248 | |
| 1249 | 1249 | $oMemberModel = getModel('member'); |
| 1250 | - if($output->data) |
|
| 1250 | + if ($output->data) |
|
| 1251 | 1251 | { |
| 1252 | - foreach($output->data as $k => $d) |
|
| 1252 | + foreach ($output->data as $k => $d) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
| 1255 | 1255 | $output->data[$k]->src = $profile_image->src; |
| 1256 | 1256 | } |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | - $this->add('voted_member_list',$output->data); |
|
| 1259 | + $this->add('voted_member_list', $output->data); |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | /** |
@@ -1266,7 +1266,7 @@ discard block |
||
| 1266 | 1266 | function getStatusNameList() |
| 1267 | 1267 | { |
| 1268 | 1268 | global $lang; |
| 1269 | - if(!isset($lang->status_name_list)) |
|
| 1269 | + if (!isset($lang->status_name_list)) |
|
| 1270 | 1270 | return array_flip($this->getStatusList()); |
| 1271 | 1271 | else return $lang->status_name_list; |
| 1272 | 1272 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | { |
| 1282 | 1282 | $sortIndex = $obj->sort_index; |
| 1283 | 1283 | $isExtraVars = false; |
| 1284 | - if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) |
|
| 1284 | + if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl'))) |
|
| 1285 | 1285 | { |
| 1286 | 1286 | // get module_srl extra_vars list |
| 1287 | 1287 | if ($load_extra_vars) |
@@ -1296,11 +1296,11 @@ discard block |
||
| 1296 | 1296 | else |
| 1297 | 1297 | { |
| 1298 | 1298 | $check_array = array(); |
| 1299 | - foreach($extra_output->data as $val) |
|
| 1299 | + foreach ($extra_output->data as $val) |
|
| 1300 | 1300 | { |
| 1301 | 1301 | $check_array[] = $val->eid; |
| 1302 | 1302 | } |
| 1303 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1303 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1304 | 1304 | else $isExtraVars = true; |
| 1305 | 1305 | } |
| 1306 | 1306 | } |
@@ -1328,13 +1328,13 @@ discard block |
||
| 1328 | 1328 | { |
| 1329 | 1329 | // Variable check |
| 1330 | 1330 | $args = new stdClass(); |
| 1331 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
| 1331 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
| 1332 | 1332 | $args->order_type = $searchOpt->order_type; |
| 1333 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
| 1334 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
| 1335 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
| 1336 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
| 1337 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
| 1333 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
| 1334 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
| 1335 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
| 1336 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
| 1337 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
| 1338 | 1338 | $args->member_srl = $searchOpt->member_srl; |
| 1339 | 1339 | $args->member_srls = $searchOpt->member_srls; |
| 1340 | 1340 | |
@@ -1344,10 +1344,10 @@ discard block |
||
| 1344 | 1344 | |
| 1345 | 1345 | // Check the target and sequence alignment |
| 1346 | 1346 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1347 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1347 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1348 | 1348 | |
| 1349 | 1349 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1350 | - if($searchOpt->mid) |
|
| 1350 | + if ($searchOpt->mid) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | $oModuleModel = getModel('module'); |
| 1353 | 1353 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1355,30 +1355,30 @@ discard block |
||
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | // Module_srl passed the array may be a check whether the array |
| 1358 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1358 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1359 | 1359 | else $args->module_srl = $searchOpt->module_srl; |
| 1360 | 1360 | |
| 1361 | 1361 | // Except for the test module_srl |
| 1362 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1362 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1363 | 1363 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
| 1364 | 1364 | |
| 1365 | 1365 | // only admin document list, temp document showing |
| 1366 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1366 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1367 | 1367 | else |
| 1368 | 1368 | { |
| 1369 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1369 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1370 | 1370 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
| 1371 | 1371 | else |
| 1372 | 1372 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
| 1373 | 1373 | } |
| 1374 | 1374 | |
| 1375 | 1375 | // Category is selected, further sub-categories until all conditions |
| 1376 | - if($args->category_srl) |
|
| 1376 | + if ($args->category_srl) |
|
| 1377 | 1377 | { |
| 1378 | 1378 | $category_list = $this->getCategoryList($args->module_srl); |
| 1379 | 1379 | $category_info = $category_list[$args->category_srl]; |
| 1380 | 1380 | $category_info->childs[] = $args->category_srl; |
| 1381 | - $args->category_srl = implode(',',$category_info->childs); |
|
| 1381 | + $args->category_srl = implode(',', $category_info->childs); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1391,24 +1391,24 @@ discard block |
||
| 1391 | 1391 | $search_target = $searchOpt->search_target; |
| 1392 | 1392 | $search_keyword = $searchOpt->search_keyword; |
| 1393 | 1393 | |
| 1394 | - if($search_target && $search_keyword) |
|
| 1394 | + if ($search_target && $search_keyword) |
|
| 1395 | 1395 | { |
| 1396 | - switch($search_target) |
|
| 1396 | + switch ($search_target) |
|
| 1397 | 1397 | { |
| 1398 | 1398 | case 'title' : |
| 1399 | 1399 | case 'content' : |
| 1400 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1400 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1401 | 1401 | $args->{"s_".$search_target} = $search_keyword; |
| 1402 | 1402 | $use_division = true; |
| 1403 | 1403 | break; |
| 1404 | 1404 | case 'title_content' : |
| 1405 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1405 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1406 | 1406 | $args->s_title = $search_keyword; |
| 1407 | 1407 | $args->s_content = $search_keyword; |
| 1408 | 1408 | $use_division = true; |
| 1409 | 1409 | break; |
| 1410 | 1410 | case 'user_id' : |
| 1411 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1411 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1412 | 1412 | $args->s_user_id = $search_keyword; |
| 1413 | 1413 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1414 | 1414 | break; |
@@ -1416,18 +1416,18 @@ discard block |
||
| 1416 | 1416 | case 'nick_name' : |
| 1417 | 1417 | case 'email_address' : |
| 1418 | 1418 | case 'homepage' : |
| 1419 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1419 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1420 | 1420 | $args->{"s_".$search_target} = $search_keyword; |
| 1421 | 1421 | break; |
| 1422 | 1422 | case 'is_notice' : |
| 1423 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1424 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1423 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
| 1424 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1425 | 1425 | else $args->{"s_".$search_target} = ''; |
| 1426 | 1426 | break; |
| 1427 | 1427 | case 'is_secret' : |
| 1428 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1429 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1430 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1428 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1429 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1430 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1431 | 1431 | break; |
| 1432 | 1432 | case 'member_srl' : |
| 1433 | 1433 | case 'readed_count' : |
@@ -1435,17 +1435,17 @@ discard block |
||
| 1435 | 1435 | case 'comment_count' : |
| 1436 | 1436 | case 'trackback_count' : |
| 1437 | 1437 | case 'uploaded_count' : |
| 1438 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1438 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1439 | 1439 | break; |
| 1440 | 1440 | case 'member_srls' : |
| 1441 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1441 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1442 | 1442 | |
| 1443 | - if($logged_info->member_srl) |
|
| 1443 | + if ($logged_info->member_srl) |
|
| 1444 | 1444 | { |
| 1445 | 1445 | $srls = explode(',', $search_keyword); |
| 1446 | - foreach($srls as $srl) |
|
| 1446 | + foreach ($srls as $srl) |
|
| 1447 | 1447 | { |
| 1448 | - if(abs($srl) != $logged_info->member_srl) |
|
| 1448 | + if (abs($srl) != $logged_info->member_srl) |
|
| 1449 | 1449 | { |
| 1450 | 1450 | break; // foreach |
| 1451 | 1451 | } |
@@ -1456,7 +1456,7 @@ discard block |
||
| 1456 | 1456 | } |
| 1457 | 1457 | break; |
| 1458 | 1458 | case 'blamed_count' : |
| 1459 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
| 1459 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
| 1460 | 1460 | break; |
| 1461 | 1461 | case 'regdate' : |
| 1462 | 1462 | case 'last_update' : |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | $use_division = true; |
| 1470 | 1470 | break; |
| 1471 | 1471 | case 'tag' : |
| 1472 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
| 1472 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
| 1473 | 1473 | $query_id = 'document.getDocumentListWithinTag'; |
| 1474 | 1474 | break; |
| 1475 | 1475 | case 'extra_vars': |
@@ -1477,9 +1477,9 @@ discard block |
||
| 1477 | 1477 | $query_id = 'document.getDocumentListWithinExtraVars'; |
| 1478 | 1478 | break; |
| 1479 | 1479 | default : |
| 1480 | - if(strpos($search_target,'extra_vars')!==false) { |
|
| 1480 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
| 1481 | 1481 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
| 1482 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
| 1482 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
| 1483 | 1483 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1484 | 1484 | $query_id = 'document.getDocumentListWithExtraVars'; |
| 1485 | 1485 | } |
@@ -1496,18 +1496,18 @@ discard block |
||
| 1496 | 1496 | /** |
| 1497 | 1497 | * list_order asc sort of division that can be used only when |
| 1498 | 1498 | */ |
| 1499 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1499 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1500 | 1500 | |
| 1501 | 1501 | /** |
| 1502 | 1502 | * If it is true, use_division changed to use the document division |
| 1503 | 1503 | */ |
| 1504 | - if($use_division) |
|
| 1504 | + if ($use_division) |
|
| 1505 | 1505 | { |
| 1506 | 1506 | // Division begins |
| 1507 | - $division = (int)Context::get('division'); |
|
| 1507 | + $division = (int) Context::get('division'); |
|
| 1508 | 1508 | |
| 1509 | 1509 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
| 1510 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1510 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1511 | 1511 | { |
| 1512 | 1512 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1513 | 1513 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1519,7 +1519,7 @@ discard block |
||
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | 1521 | // If you do not value the best division top |
| 1522 | - if(!$division) |
|
| 1522 | + if (!$division) |
|
| 1523 | 1523 | { |
| 1524 | 1524 | $division_args = new stdClass(); |
| 1525 | 1525 | $division_args->module_srl = $args->module_srl; |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | $division_args->statusList = $args->statusList; |
| 1531 | 1531 | |
| 1532 | 1532 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
| 1533 | - if($output->data) |
|
| 1533 | + if ($output->data) |
|
| 1534 | 1534 | { |
| 1535 | 1535 | $item = array_pop($output->data); |
| 1536 | 1536 | $division = $item->list_order; |
@@ -1539,10 +1539,10 @@ discard block |
||
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | // The last division |
| 1542 | - $last_division = (int)Context::get('last_division'); |
|
| 1542 | + $last_division = (int) Context::get('last_division'); |
|
| 1543 | 1543 | |
| 1544 | 1544 | // Division after division from the 5000 value of the specified Wanted |
| 1545 | - if(!$last_division) |
|
| 1545 | + if (!$last_division) |
|
| 1546 | 1546 | { |
| 1547 | 1547 | $last_division_args = new stdClass(); |
| 1548 | 1548 | $last_division_args->module_srl = $args->module_srl; |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | $last_division_args->page = 5001; |
| 1555 | 1555 | |
| 1556 | 1556 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
| 1557 | - if($output->data) |
|
| 1557 | + if ($output->data) |
|
| 1558 | 1558 | { |
| 1559 | 1559 | $item = array_pop($output->data); |
| 1560 | 1560 | $last_division = $item->list_order; |
@@ -1562,14 +1562,14 @@ discard block |
||
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | 1564 | // Make sure that after last_division article |
| 1565 | - if($last_division) |
|
| 1565 | + if ($last_division) |
|
| 1566 | 1566 | { |
| 1567 | 1567 | $last_division_args = new stdClass(); |
| 1568 | 1568 | $last_division_args->module_srl = $args->module_srl; |
| 1569 | 1569 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1570 | 1570 | $last_division_args->list_order = $last_division; |
| 1571 | 1571 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1572 | - if($output->data->count<1) $last_division = null; |
|
| 1572 | + if ($output->data->count < 1) $last_division = null; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | |
| 1575 | 1575 | $args->division = $division; |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | * @param int $count |
| 1603 | 1603 | * @return object |
| 1604 | 1604 | */ |
| 1605 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
| 1605 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
| 1606 | 1606 | { |
| 1607 | 1607 | $args = new stdClass(); |
| 1608 | 1608 | $args->member_srl = $member_srl; |
@@ -1610,8 +1610,8 @@ discard block |
||
| 1610 | 1610 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1611 | 1611 | $document_list = $output->data; |
| 1612 | 1612 | |
| 1613 | - if(!$document_list) return array(); |
|
| 1614 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1613 | + if (!$document_list) return array(); |
|
| 1614 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 1615 | 1615 | |
| 1616 | 1616 | return $document_list; |
| 1617 | 1617 | } |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | function getDocumentExtraImagePath() |
| 1624 | 1624 | { |
| 1625 | 1625 | $documentConfig = getModel('document')->getDocumentConfig(); |
| 1626 | - if(Mobile::isFromMobilePhone()) |
|
| 1626 | + if (Mobile::isFromMobilePhone()) |
|
| 1627 | 1627 | { |
| 1628 | 1628 | $iconSkin = $documentConfig->micons; |
| 1629 | 1629 | } |
@@ -1631,7 +1631,7 @@ discard block |
||
| 1631 | 1631 | { |
| 1632 | 1632 | $iconSkin = $documentConfig->icons; |
| 1633 | 1633 | } |
| 1634 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1634 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1635 | 1635 | |
| 1636 | 1636 | return $path; |
| 1637 | 1637 | } |
@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function procDocumentVoteUp() |
| 26 | 26 | { |
| 27 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 27 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 28 | 28 | |
| 29 | 29 | $document_srl = Context::get('target_srl'); |
| 30 | - if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 30 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 31 | 31 | |
| 32 | 32 | $oDocumentModel = getModel('document'); |
| 33 | 33 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 34 | 34 | $module_srl = $oDocument->get('module_srl'); |
| 35 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 35 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 36 | 36 | |
| 37 | 37 | $oModuleModel = getModel('module'); |
| 38 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 39 | - if($document_config->use_vote_up=='N') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 38 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 39 | + if ($document_config->use_vote_up == 'N') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 40 | 40 | |
| 41 | 41 | $point = 1; |
| 42 | 42 | $output = $this->updateVotedCount($document_srl, $point); |
@@ -69,19 +69,19 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | function procDocumentVoteDown() |
| 71 | 71 | { |
| 72 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 72 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 73 | 73 | |
| 74 | 74 | $document_srl = Context::get('target_srl'); |
| 75 | - if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 75 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 76 | 76 | |
| 77 | 77 | $oDocumentModel = getModel('document'); |
| 78 | 78 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 79 | 79 | $module_srl = $oDocument->get('module_srl'); |
| 80 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 80 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 81 | 81 | |
| 82 | 82 | $oModuleModel = getModel('module'); |
| 83 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 84 | - if($document_config->use_vote_down=='N') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 83 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 84 | + if ($document_config->use_vote_down == 'N') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 85 | 85 | |
| 86 | 86 | $point = -1; |
| 87 | 87 | $output = $this->updateVotedCount($document_srl, $point); |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | function procDocumentDeclare() |
| 97 | 97 | { |
| 98 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 98 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 99 | 99 | |
| 100 | 100 | $document_srl = Context::get('target_srl'); |
| 101 | - if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 101 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 102 | 102 | |
| 103 | 103 | return $this->declaredDocument($document_srl); |
| 104 | 104 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $args->history_srl = $history_srl; |
| 141 | 141 | $args->module_srl = $module_srl; |
| 142 | 142 | $args->document_srl = $document_srl; |
| 143 | - if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return; |
|
| 143 | + if (!$args->history_srl && !$args->module_srl && !$args->document_srl) return; |
|
| 144 | 144 | executeQuery("document.deleteHistory", $args); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | function triggerDeleteModuleDocuments(&$obj) |
| 153 | 153 | { |
| 154 | 154 | $module_srl = $obj->module_srl; |
| 155 | - if(!$module_srl) return new BaseObject(); |
|
| 155 | + if (!$module_srl) return new BaseObject(); |
|
| 156 | 156 | // Delete the document |
| 157 | 157 | $oDocumentAdminController = getAdminController('document'); |
| 158 | 158 | $output = $oDocumentAdminController->deleteModuleDocument($module_srl); |
| 159 | - if(!$output->toBool()) return $output; |
|
| 159 | + if (!$output->toBool()) return $output; |
|
| 160 | 160 | // Delete the category |
| 161 | 161 | $oDocumentController = getController('document'); |
| 162 | 162 | $output = $oDocumentController->deleteModuleCategory($module_srl); |
| 163 | - if(!$output->toBool()) return $output; |
|
| 163 | + if (!$output->toBool()) return $output; |
|
| 164 | 164 | // Delete extra key and variable, because module deleted |
| 165 | 165 | $this->deleteDocumentExtraKeys($module_srl); |
| 166 | 166 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | function insertDocument($obj, $manual_inserted = false, $isRestore = false, $isLatest = true) |
| 195 | 195 | { |
| 196 | - if(!$manual_inserted && !checkCSRF()) |
|
| 196 | + if (!$manual_inserted && !checkCSRF()) |
|
| 197 | 197 | { |
| 198 | 198 | return new BaseObject(-1, 'msg_invalid_request'); |
| 199 | 199 | } |
@@ -202,32 +202,32 @@ discard block |
||
| 202 | 202 | $oDB = &DB::getInstance(); |
| 203 | 203 | $oDB->begin(); |
| 204 | 204 | // List variables |
| 205 | - if($obj->comment_status) $obj->commentStatus = $obj->comment_status; |
|
| 206 | - if(!$obj->commentStatus) $obj->commentStatus = 'DENY'; |
|
| 207 | - if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj); |
|
| 208 | - if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; |
|
| 209 | - if($obj->homepage) |
|
| 205 | + if ($obj->comment_status) $obj->commentStatus = $obj->comment_status; |
|
| 206 | + if (!$obj->commentStatus) $obj->commentStatus = 'DENY'; |
|
| 207 | + if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj); |
|
| 208 | + if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N'; |
|
| 209 | + if ($obj->homepage) |
|
| 210 | 210 | { |
| 211 | 211 | $obj->homepage = removeHackTag($obj->homepage); |
| 212 | - if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) |
|
| 212 | + if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage)) |
|
| 213 | 213 | { |
| 214 | 214 | $obj->homepage = 'http://'.$obj->homepage; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if($obj->notify_message != 'Y') $obj->notify_message = 'N'; |
|
| 219 | - if(!$obj->email_address) $obj->email_address = ''; |
|
| 220 | - if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 218 | + if ($obj->notify_message != 'Y') $obj->notify_message = 'N'; |
|
| 219 | + if (!$obj->email_address) $obj->email_address = ''; |
|
| 220 | + if (!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 221 | 221 | |
| 222 | 222 | // can modify regdate only manager |
| 223 | 223 | $grant = Context::get('grant'); |
| 224 | - if(!$grant->manager) |
|
| 224 | + if (!$grant->manager) |
|
| 225 | 225 | { |
| 226 | 226 | unset($obj->regdate); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid |
| 230 | - if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); |
|
| 230 | + if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); |
|
| 231 | 231 | // Remove the columns for automatic saving |
| 232 | 232 | unset($obj->_saved_doc_srl); |
| 233 | 233 | unset($obj->_saved_doc_title); |
@@ -235,34 +235,34 @@ discard block |
||
| 235 | 235 | unset($obj->_saved_doc_message); |
| 236 | 236 | // Call a trigger (before) |
| 237 | 237 | $output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj); |
| 238 | - if(!$output->toBool()) return $output; |
|
| 238 | + if (!$output->toBool()) return $output; |
|
| 239 | 239 | // Register it if no given document_srl exists |
| 240 | - if(!$obj->document_srl) $obj->document_srl = getNextSequence(); |
|
| 241 | - elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 240 | + if (!$obj->document_srl) $obj->document_srl = getNextSequence(); |
|
| 241 | + elseif (!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 242 | 242 | |
| 243 | 243 | $oDocumentModel = getModel('document'); |
| 244 | 244 | // Set to 0 if the category_srl doesn't exist |
| 245 | - if($obj->category_srl) |
|
| 245 | + if ($obj->category_srl) |
|
| 246 | 246 | { |
| 247 | 247 | $category_list = $oDocumentModel->getCategoryList($obj->module_srl); |
| 248 | - if(count($category_list) > 0 && !$category_list[$obj->category_srl]->grant) |
|
| 248 | + if (count($category_list) > 0 && !$category_list[$obj->category_srl]->grant) |
|
| 249 | 249 | { |
| 250 | 250 | return new BaseObject(-1, 'msg_not_permitted'); |
| 251 | 251 | } |
| 252 | - if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0; |
|
| 252 | + if (count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0; |
|
| 253 | 253 | } |
| 254 | 254 | // Set the read counts and update order. |
| 255 | - if(!$obj->readed_count) $obj->readed_count = 0; |
|
| 256 | - if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1; |
|
| 255 | + if (!$obj->readed_count) $obj->readed_count = 0; |
|
| 256 | + if ($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1; |
|
| 257 | 257 | else $obj->update_order = $obj->list_order; |
| 258 | 258 | // Check the status of password hash for manually inserting. Apply hashing for otherwise. |
| 259 | - if($obj->password && !$obj->password_is_hashed) |
|
| 259 | + if ($obj->password && !$obj->password_is_hashed) |
|
| 260 | 260 | { |
| 261 | 261 | $obj->password = getModel('member')->hashPassword($obj->password); |
| 262 | 262 | } |
| 263 | 263 | // Insert member's information only if the member is logged-in and not manually registered. |
| 264 | 264 | $logged_info = Context::get('logged_info'); |
| 265 | - if(Context::get('is_logged') && !$manual_inserted && !$isRestore) |
|
| 265 | + if (Context::get('is_logged') && !$manual_inserted && !$isRestore) |
|
| 266 | 266 | { |
| 267 | 267 | $obj->member_srl = $logged_info->member_srl; |
| 268 | 268 | |
@@ -276,61 +276,61 @@ discard block |
||
| 276 | 276 | // If the tile is empty, extract string from the contents. |
| 277 | 277 | $obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 278 | 278 | settype($obj->title, "string"); |
| 279 | - if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); |
|
| 279 | + if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...'); |
|
| 280 | 280 | // If no tile extracted from the contents, leave it untitled. |
| 281 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
| 281 | + if ($obj->title == '') $obj->title = 'Untitled'; |
|
| 282 | 282 | // Remove XE's own tags from the contents. |
| 283 | 283 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 284 | - if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 284 | + if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 285 | 285 | { |
| 286 | - if($obj->use_html != 'Y') |
|
| 286 | + if ($obj->use_html != 'Y') |
|
| 287 | 287 | { |
| 288 | 288 | $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 289 | 289 | } |
| 290 | 290 | $obj->content = nl2br($obj->content); |
| 291 | 291 | } |
| 292 | 292 | // Remove iframe and script if not a top adminisrator in the session. |
| 293 | - if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); |
|
| 293 | + if ($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); |
|
| 294 | 294 | // An error appears if both log-in info and user name don't exist. |
| 295 | - if(!$logged_info->member_srl && !$obj->nick_name) return new BaseObject(-1,'msg_invalid_request'); |
|
| 295 | + if (!$logged_info->member_srl && !$obj->nick_name) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 296 | 296 | |
| 297 | 297 | $obj->lang_code = Context::getLangType(); |
| 298 | 298 | // Insert data into the DB |
| 299 | - if(!$obj->status) $this->_checkDocumentStatusForOldVersion($obj); |
|
| 299 | + if (!$obj->status) $this->_checkDocumentStatusForOldVersion($obj); |
|
| 300 | 300 | $output = executeQuery('document.insertDocument', $obj); |
| 301 | - if(!$output->toBool()) |
|
| 301 | + if (!$output->toBool()) |
|
| 302 | 302 | { |
| 303 | 303 | $oDB->rollback(); |
| 304 | 304 | return $output; |
| 305 | 305 | } |
| 306 | 306 | // Insert extra variables if the document successfully inserted. |
| 307 | 307 | $extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); |
| 308 | - if(count($extra_keys)) |
|
| 308 | + if (count($extra_keys)) |
|
| 309 | 309 | { |
| 310 | - foreach($extra_keys as $idx => $extra_item) |
|
| 310 | + foreach ($extra_keys as $idx => $extra_item) |
|
| 311 | 311 | { |
| 312 | 312 | $value = NULL; |
| 313 | - if(isset($obj->{'extra_vars'.$idx})) |
|
| 313 | + if (isset($obj->{'extra_vars'.$idx})) |
|
| 314 | 314 | { |
| 315 | 315 | $tmp = $obj->{'extra_vars'.$idx}; |
| 316 | - if(is_array($tmp)) |
|
| 316 | + if (is_array($tmp)) |
|
| 317 | 317 | $value = implode('|@|', $tmp); |
| 318 | 318 | else |
| 319 | 319 | $value = trim($tmp); |
| 320 | 320 | } |
| 321 | - else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); |
|
| 322 | - if($value == NULL) continue; |
|
| 321 | + else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); |
|
| 322 | + if ($value == NULL) continue; |
|
| 323 | 323 | |
| 324 | 324 | $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); |
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | // Update the category if the category_srl exists. |
| 328 | - if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 328 | + if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 329 | 329 | // Call a trigger (after) |
| 330 | - if($output->toBool()) |
|
| 330 | + if ($output->toBool()) |
|
| 331 | 331 | { |
| 332 | 332 | $trigger_output = ModuleHandler::triggerCall('document.insertDocument', 'after', $obj); |
| 333 | - if(!$trigger_output->toBool()) |
|
| 333 | + if (!$trigger_output->toBool()) |
|
| 334 | 334 | { |
| 335 | 335 | $oDB->rollback(); |
| 336 | 336 | return $trigger_output; |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | $oDB->commit(); |
| 342 | 342 | |
| 343 | 343 | // return |
| 344 | - if(!$manual_inserted) |
|
| 344 | + if (!$manual_inserted) |
|
| 345 | 345 | { |
| 346 | 346 | $this->addGrant($obj->document_srl); |
| 347 | 347 | } |
| 348 | - $output->add('document_srl',$obj->document_srl); |
|
| 349 | - $output->add('category_srl',$obj->category_srl); |
|
| 348 | + $output->add('document_srl', $obj->document_srl); |
|
| 349 | + $output->add('category_srl', $obj->category_srl); |
|
| 350 | 350 | |
| 351 | 351 | return $output; |
| 352 | 352 | } |
@@ -362,41 +362,41 @@ discard block |
||
| 362 | 362 | { |
| 363 | 363 | $logged_info = Context::get('logged_info'); |
| 364 | 364 | |
| 365 | - if(!$manual_updated && !checkCSRF()) |
|
| 365 | + if (!$manual_updated && !checkCSRF()) |
|
| 366 | 366 | { |
| 367 | 367 | return new BaseObject(-1, 'msg_invalid_request'); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if(!$source_obj->document_srl || !$obj->document_srl) return new BaseObject(-1,'msg_invalied_request'); |
|
| 371 | - if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET'; |
|
| 372 | - if(!$obj->status) $obj->status = 'PUBLIC'; |
|
| 370 | + if (!$source_obj->document_srl || !$obj->document_srl) return new BaseObject(-1, 'msg_invalied_request'); |
|
| 371 | + if (!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET'; |
|
| 372 | + if (!$obj->status) $obj->status = 'PUBLIC'; |
|
| 373 | 373 | |
| 374 | 374 | // Call a trigger (before) |
| 375 | 375 | $output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj); |
| 376 | - if(!$output->toBool()) return $output; |
|
| 376 | + if (!$output->toBool()) return $output; |
|
| 377 | 377 | |
| 378 | 378 | // begin transaction |
| 379 | 379 | $oDB = &DB::getInstance(); |
| 380 | 380 | $oDB->begin(); |
| 381 | 381 | |
| 382 | 382 | $oModuleModel = getModel('module'); |
| 383 | - if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl'); |
|
| 383 | + if (!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl'); |
|
| 384 | 384 | $module_srl = $obj->module_srl; |
| 385 | 385 | $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
| 386 | - if(!$document_config) |
|
| 386 | + if (!$document_config) |
|
| 387 | 387 | { |
| 388 | 388 | $document_config = new stdClass(); |
| 389 | 389 | } |
| 390 | - if(!isset($document_config->use_history)) $document_config->use_history = 'N'; |
|
| 390 | + if (!isset($document_config->use_history)) $document_config->use_history = 'N'; |
|
| 391 | 391 | $bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace'; |
| 392 | 392 | |
| 393 | - if($bUseHistory) |
|
| 393 | + if ($bUseHistory) |
|
| 394 | 394 | { |
| 395 | 395 | $args = new stdClass; |
| 396 | 396 | $args->history_srl = getNextSequence(); |
| 397 | 397 | $args->document_srl = $obj->document_srl; |
| 398 | 398 | $args->module_srl = $module_srl; |
| 399 | - if($document_config->use_history == 'Y') $args->content = $source_obj->get('content'); |
|
| 399 | + if ($document_config->use_history == 'Y') $args->content = $source_obj->get('content'); |
|
| 400 | 400 | $args->nick_name = $logged_info->nick_name; |
| 401 | 401 | $args->member_srl = $logged_info->member_srl; |
| 402 | 402 | $args->regdate = $source_obj->get('last_update'); |
@@ -408,30 +408,30 @@ discard block |
||
| 408 | 408 | $obj->ipaddress = $source_obj->get('ipaddress'); |
| 409 | 409 | } |
| 410 | 410 | // List variables |
| 411 | - if($obj->comment_status) $obj->commentStatus = $obj->comment_status; |
|
| 412 | - if(!$obj->commentStatus) $obj->commentStatus = 'DENY'; |
|
| 413 | - if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj); |
|
| 414 | - if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; |
|
| 415 | - if($obj->homepage) |
|
| 411 | + if ($obj->comment_status) $obj->commentStatus = $obj->comment_status; |
|
| 412 | + if (!$obj->commentStatus) $obj->commentStatus = 'DENY'; |
|
| 413 | + if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj); |
|
| 414 | + if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N'; |
|
| 415 | + if ($obj->homepage) |
|
| 416 | 416 | { |
| 417 | 417 | $obj->homepage = removeHackTag($obj->homepage); |
| 418 | - if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) |
|
| 418 | + if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage)) |
|
| 419 | 419 | { |
| 420 | 420 | $obj->homepage = 'http://'.$obj->homepage; |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if($obj->notify_message != 'Y') $obj->notify_message = 'N'; |
|
| 424 | + if ($obj->notify_message != 'Y') $obj->notify_message = 'N'; |
|
| 425 | 425 | |
| 426 | 426 | // can modify regdate only manager |
| 427 | 427 | $grant = Context::get('grant'); |
| 428 | - if(!$grant->manager) |
|
| 428 | + if (!$grant->manager) |
|
| 429 | 429 | { |
| 430 | 430 | unset($obj->regdate); |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | // Serialize the $extra_vars |
| 434 | - if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); |
|
| 434 | + if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); |
|
| 435 | 435 | // Remove the columns for automatic saving |
| 436 | 436 | unset($obj->_saved_doc_srl); |
| 437 | 437 | unset($obj->_saved_doc_title); |
@@ -440,23 +440,23 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | $oDocumentModel = getModel('document'); |
| 442 | 442 | // Set the category_srl to 0 if the changed category is not exsiting. |
| 443 | - if($source_obj->get('category_srl')!=$obj->category_srl) |
|
| 443 | + if ($source_obj->get('category_srl') != $obj->category_srl) |
|
| 444 | 444 | { |
| 445 | 445 | $category_list = $oDocumentModel->getCategoryList($obj->module_srl); |
| 446 | - if(!$category_list[$obj->category_srl]) $obj->category_srl = 0; |
|
| 446 | + if (!$category_list[$obj->category_srl]) $obj->category_srl = 0; |
|
| 447 | 447 | } |
| 448 | 448 | // Change the update order |
| 449 | 449 | $obj->update_order = getNextSequence() * -1; |
| 450 | 450 | // Hash the password if it exists |
| 451 | - if($obj->password) |
|
| 451 | + if ($obj->password) |
|
| 452 | 452 | { |
| 453 | 453 | $obj->password = getModel('member')->hashPassword($obj->password); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | // If an author is identical to the modifier or history is used, use the logged-in user's information. |
| 457 | - if(Context::get('is_logged') && !$manual_updated) |
|
| 457 | + if (Context::get('is_logged') && !$manual_updated) |
|
| 458 | 458 | { |
| 459 | - if($source_obj->get('member_srl')==$logged_info->member_srl) |
|
| 459 | + if ($source_obj->get('member_srl') == $logged_info->member_srl) |
|
| 460 | 460 | { |
| 461 | 461 | $obj->member_srl = $logged_info->member_srl; |
| 462 | 462 | $obj->user_name = htmlspecialchars_decode($logged_info->user_name); |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | // For the document written by logged-in user however no nick_name exists |
| 470 | - if($source_obj->get('member_srl')&& !$obj->nick_name) |
|
| 470 | + if ($source_obj->get('member_srl') && !$obj->nick_name) |
|
| 471 | 471 | { |
| 472 | 472 | $obj->member_srl = $source_obj->get('member_srl'); |
| 473 | 473 | $obj->user_name = $source_obj->get('user_name'); |
@@ -478,24 +478,24 @@ discard block |
||
| 478 | 478 | // If the tile is empty, extract string from the contents. |
| 479 | 479 | $obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 480 | 480 | settype($obj->title, "string"); |
| 481 | - if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
|
| 481 | + if ($obj->title == '') $obj->title = cut_str(strip_tags($obj->content), 20, '...'); |
|
| 482 | 482 | // If no tile extracted from the contents, leave it untitled. |
| 483 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
| 483 | + if ($obj->title == '') $obj->title = 'Untitled'; |
|
| 484 | 484 | // Remove XE's own tags from the contents. |
| 485 | 485 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 486 | - if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 486 | + if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
|
| 487 | 487 | { |
| 488 | - if($obj->use_html != 'Y') |
|
| 488 | + if ($obj->use_html != 'Y') |
|
| 489 | 489 | { |
| 490 | 490 | $obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 491 | 491 | } |
| 492 | 492 | $obj->content = nl2br($obj->content); |
| 493 | 493 | } |
| 494 | 494 | // Change not extra vars but language code of the original document if document's lang_code is different from author's setting. |
| 495 | - if($source_obj->get('lang_code') != Context::getLangType()) |
|
| 495 | + if ($source_obj->get('lang_code') != Context::getLangType()) |
|
| 496 | 496 | { |
| 497 | 497 | // Change not extra vars but language code of the original document if document's lang_code doesn't exist. |
| 498 | - if(!$source_obj->get('lang_code')) |
|
| 498 | + if (!$source_obj->get('lang_code')) |
|
| 499 | 499 | { |
| 500 | 500 | $lang_code_args->document_srl = $source_obj->get('document_srl'); |
| 501 | 501 | $lang_code_args->lang_code = Context::getLangType(); |
@@ -515,59 +515,59 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | // Remove iframe and script if not a top adminisrator in the session. |
| 518 | - if($logged_info->is_admin != 'Y') |
|
| 518 | + if ($logged_info->is_admin != 'Y') |
|
| 519 | 519 | { |
| 520 | 520 | $obj->content = removeHackTag($obj->content); |
| 521 | 521 | } |
| 522 | 522 | // if temporary document, regdate is now setting |
| 523 | - if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis'); |
|
| 523 | + if ($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis'); |
|
| 524 | 524 | |
| 525 | 525 | // Insert data into the DB |
| 526 | 526 | $output = executeQuery('document.updateDocument', $obj); |
| 527 | - if(!$output->toBool()) |
|
| 527 | + if (!$output->toBool()) |
|
| 528 | 528 | { |
| 529 | 529 | $oDB->rollback(); |
| 530 | 530 | return $output; |
| 531 | 531 | } |
| 532 | 532 | // Remove all extra variables |
| 533 | - if(Context::get('act')!='procFileDelete') |
|
| 533 | + if (Context::get('act') != 'procFileDelete') |
|
| 534 | 534 | { |
| 535 | 535 | $this->deleteDocumentExtraVars($source_obj->get('module_srl'), $obj->document_srl, null, Context::getLangType()); |
| 536 | 536 | // Insert extra variables if the document successfully inserted. |
| 537 | 537 | $extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); |
| 538 | - if(count($extra_keys)) |
|
| 538 | + if (count($extra_keys)) |
|
| 539 | 539 | { |
| 540 | - foreach($extra_keys as $idx => $extra_item) |
|
| 540 | + foreach ($extra_keys as $idx => $extra_item) |
|
| 541 | 541 | { |
| 542 | 542 | $value = NULL; |
| 543 | - if(isset($obj->{'extra_vars'.$idx})) |
|
| 543 | + if (isset($obj->{'extra_vars'.$idx})) |
|
| 544 | 544 | { |
| 545 | 545 | $tmp = $obj->{'extra_vars'.$idx}; |
| 546 | - if(is_array($tmp)) |
|
| 546 | + if (is_array($tmp)) |
|
| 547 | 547 | $value = implode('|@|', $tmp); |
| 548 | 548 | else |
| 549 | 549 | $value = trim($tmp); |
| 550 | 550 | } |
| 551 | - else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); |
|
| 552 | - if($value == NULL) continue; |
|
| 551 | + else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); |
|
| 552 | + if ($value == NULL) continue; |
|
| 553 | 553 | $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); |
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | // Inert extra vars for multi-language support of title and contents. |
| 557 | - if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); |
|
| 558 | - if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); |
|
| 557 | + if ($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); |
|
| 558 | + if ($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); |
|
| 559 | 559 | } |
| 560 | 560 | // Update the category if the category_srl exists. |
| 561 | - if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl) |
|
| 561 | + if ($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl) |
|
| 562 | 562 | { |
| 563 | - if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl')); |
|
| 564 | - if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 563 | + if ($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl')); |
|
| 564 | + if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 565 | 565 | } |
| 566 | 566 | // Call a trigger (after) |
| 567 | - if($output->toBool()) |
|
| 567 | + if ($output->toBool()) |
|
| 568 | 568 | { |
| 569 | 569 | $trigger_output = ModuleHandler::triggerCall('document.updateDocument', 'after', $obj); |
| 570 | - if(!$trigger_output->toBool()) |
|
| 570 | + if (!$trigger_output->toBool()) |
|
| 571 | 571 | { |
| 572 | 572 | $oDB->rollback(); |
| 573 | 573 | return $trigger_output; |
@@ -577,15 +577,15 @@ discard block |
||
| 577 | 577 | // commit |
| 578 | 578 | $oDB->commit(); |
| 579 | 579 | // Remove the thumbnail file |
| 580 | - FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); |
|
| 580 | + FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3))); |
|
| 581 | 581 | |
| 582 | - $output->add('document_srl',$obj->document_srl); |
|
| 582 | + $output->add('document_srl', $obj->document_srl); |
|
| 583 | 583 | //remove from cache |
| 584 | 584 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 585 | - if($oCacheHandler->isSupport()) |
|
| 585 | + if ($oCacheHandler->isSupport()) |
|
| 586 | 586 | { |
| 587 | 587 | //remove document item from cache |
| 588 | - $cache_key = 'document_item:'. getNumberingPath($obj->document_srl) . $obj->document_srl; |
|
| 588 | + $cache_key = 'document_item:'.getNumberingPath($obj->document_srl).$obj->document_srl; |
|
| 589 | 589 | $oCacheHandler->delete($cache_key); |
| 590 | 590 | } |
| 591 | 591 | |
@@ -606,33 +606,33 @@ discard block |
||
| 606 | 606 | $trigger_obj = new stdClass(); |
| 607 | 607 | $trigger_obj->document_srl = $document_srl; |
| 608 | 608 | $output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj); |
| 609 | - if(!$output->toBool()) return $output; |
|
| 609 | + if (!$output->toBool()) return $output; |
|
| 610 | 610 | |
| 611 | 611 | // begin transaction |
| 612 | 612 | $oDB = &DB::getInstance(); |
| 613 | 613 | $oDB->begin(); |
| 614 | 614 | |
| 615 | - if(!$isEmptyTrash) |
|
| 615 | + if (!$isEmptyTrash) |
|
| 616 | 616 | { |
| 617 | 617 | // get model object of the document |
| 618 | 618 | $oDocumentModel = getModel('document'); |
| 619 | 619 | // Check if the documnet exists |
| 620 | 620 | $oDocument = $oDocumentModel->getDocument($document_srl, $is_admin); |
| 621 | 621 | } |
| 622 | - else if($isEmptyTrash && $oDocument == null) return new BaseObject(-1, 'document is not exists'); |
|
| 622 | + else if ($isEmptyTrash && $oDocument == null) return new BaseObject(-1, 'document is not exists'); |
|
| 623 | 623 | |
| 624 | - if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new BaseObject(-1, 'msg_invalid_document'); |
|
| 624 | + if (!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new BaseObject(-1, 'msg_invalid_document'); |
|
| 625 | 625 | // Check if a permossion is granted |
| 626 | - if(!$oDocument->isGranted()) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 626 | + if (!$oDocument->isGranted()) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 627 | 627 | |
| 628 | 628 | //if empty trash, document already deleted, therefore document not delete |
| 629 | 629 | $args = new stdClass(); |
| 630 | 630 | $args->document_srl = $document_srl; |
| 631 | - if(!$isEmptyTrash) |
|
| 631 | + if (!$isEmptyTrash) |
|
| 632 | 632 | { |
| 633 | 633 | // Delete the document |
| 634 | 634 | $output = executeQuery('document.deleteDocument', $args); |
| 635 | - if(!$output->toBool()) |
|
| 635 | + if (!$output->toBool()) |
|
| 636 | 636 | { |
| 637 | 637 | $oDB->rollback(); |
| 638 | 638 | return $output; |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | $this->deleteDocumentHistory(null, $document_srl, null); |
| 645 | 645 | // Update category information if the category_srl exists. |
| 646 | - if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); |
|
| 646 | + if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl')); |
|
| 647 | 647 | // Delete a declared list |
| 648 | 648 | executeQuery('document.deleteDeclared', $args); |
| 649 | 649 | // Delete extra variable |
@@ -651,11 +651,11 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | //this |
| 653 | 653 | // Call a trigger (after) |
| 654 | - if($output->toBool()) |
|
| 654 | + if ($output->toBool()) |
|
| 655 | 655 | { |
| 656 | 656 | $trigger_obj = $oDocument->getObjectVars(); |
| 657 | 657 | $trigger_output = ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj); |
| 658 | - if(!$trigger_output->toBool()) |
|
| 658 | + if (!$trigger_output->toBool()) |
|
| 659 | 659 | { |
| 660 | 660 | $oDB->rollback(); |
| 661 | 661 | return $trigger_output; |
@@ -667,16 +667,16 @@ discard block |
||
| 667 | 667 | $this->_deleteDocumentVotedLog($args); |
| 668 | 668 | |
| 669 | 669 | // Remove the thumbnail file |
| 670 | - FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($document_srl, 3))); |
|
| 670 | + FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($document_srl, 3))); |
|
| 671 | 671 | |
| 672 | 672 | // commit |
| 673 | 673 | $oDB->commit(); |
| 674 | 674 | |
| 675 | 675 | //remove from cache |
| 676 | 676 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 677 | - if($oCacheHandler->isSupport()) |
|
| 677 | + if ($oCacheHandler->isSupport()) |
|
| 678 | 678 | { |
| 679 | - $cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
| 679 | + $cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
| 680 | 680 | $oCacheHandler->delete($cache_key); |
| 681 | 681 | } |
| 682 | 682 | |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | { |
| 724 | 724 | $trash_args = new stdClass(); |
| 725 | 725 | // Get trash_srl if a given trash_srl doesn't exist |
| 726 | - if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence(); |
|
| 726 | + if (!$obj->trash_srl) $trash_args->trash_srl = getNextSequence(); |
|
| 727 | 727 | else $trash_args->trash_srl = $obj->trash_srl; |
| 728 | 728 | // Get its module_srl which the document belongs to |
| 729 | 729 | $oDocumentModel = getModel('document'); |
@@ -732,12 +732,12 @@ discard block |
||
| 732 | 732 | $trash_args->module_srl = $oDocument->get('module_srl'); |
| 733 | 733 | $obj->module_srl = $oDocument->get('module_srl'); |
| 734 | 734 | // Cannot throw data from the trash to the trash |
| 735 | - if($trash_args->module_srl == 0) return false; |
|
| 735 | + if ($trash_args->module_srl == 0) return false; |
|
| 736 | 736 | // Data setting |
| 737 | 737 | $trash_args->document_srl = $obj->document_srl; |
| 738 | 738 | $trash_args->description = $obj->description; |
| 739 | 739 | // Insert member's information only if the member is logged-in and not manually registered. |
| 740 | - if(Context::get('is_logged')&&!$manual_inserted) |
|
| 740 | + if (Context::get('is_logged') && !$manual_inserted) |
|
| 741 | 741 | { |
| 742 | 742 | $logged_info = Context::get('logged_info'); |
| 743 | 743 | $trash_args->member_srl = $logged_info->member_srl; |
@@ -773,14 +773,14 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | $oTrashAdminController = getAdminController('trash'); |
| 775 | 775 | $output = $oTrashAdminController->insertTrash($oTrashVO); |
| 776 | - if(!$output->toBool()) |
|
| 776 | + if (!$output->toBool()) |
|
| 777 | 777 | { |
| 778 | 778 | $oDB->rollback(); |
| 779 | 779 | return $output; |
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | $output = executeQuery('document.deleteDocument', $trash_args); |
| 783 | - if(!$output->toBool()) |
|
| 783 | + if (!$output->toBool()) |
|
| 784 | 784 | { |
| 785 | 785 | $oDB->rollback(); |
| 786 | 786 | return $output; |
@@ -793,12 +793,12 @@ discard block |
||
| 793 | 793 | }*/ |
| 794 | 794 | |
| 795 | 795 | // update category |
| 796 | - if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); |
|
| 796 | + if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl')); |
|
| 797 | 797 | |
| 798 | 798 | // remove thumbnails |
| 799 | - FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); |
|
| 799 | + FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3))); |
|
| 800 | 800 | // Set the attachment to be invalid state |
| 801 | - if($oDocument->hasUploadedFiles()) |
|
| 801 | + if ($oDocument->hasUploadedFiles()) |
|
| 802 | 802 | { |
| 803 | 803 | $args = new stdClass(); |
| 804 | 804 | $args->upload_target_srl = $oDocument->document_srl; |
@@ -806,10 +806,10 @@ discard block |
||
| 806 | 806 | executeQuery('file.updateFileValid', $args); |
| 807 | 807 | } |
| 808 | 808 | // Call a trigger (after) |
| 809 | - if($output->toBool()) |
|
| 809 | + if ($output->toBool()) |
|
| 810 | 810 | { |
| 811 | 811 | $trigger_output = ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj); |
| 812 | - if(!$trigger_output->toBool()) |
|
| 812 | + if (!$trigger_output->toBool()) |
|
| 813 | 813 | { |
| 814 | 814 | $oDB->rollback(); |
| 815 | 815 | return $trigger_output; |
@@ -821,9 +821,9 @@ discard block |
||
| 821 | 821 | |
| 822 | 822 | // Clear cache |
| 823 | 823 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 824 | - if($oCacheHandler->isSupport()) |
|
| 824 | + if ($oCacheHandler->isSupport()) |
|
| 825 | 825 | { |
| 826 | - $cache_key = 'document_item:'. getNumberingPath($oDocument->document_srl) . $oDocument->document_srl; |
|
| 826 | + $cache_key = 'document_item:'.getNumberingPath($oDocument->document_srl).$oDocument->document_srl; |
|
| 827 | 827 | $oCacheHandler->delete($cache_key); |
| 828 | 828 | } |
| 829 | 829 | |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | function updateReadedCount(&$oDocument) |
| 839 | 839 | { |
| 840 | 840 | // Pass if Crawler access |
| 841 | - if(isCrawler()) return false; |
|
| 841 | + if (isCrawler()) return false; |
|
| 842 | 842 | |
| 843 | 843 | $document_srl = $oDocument->document_srl; |
| 844 | 844 | $member_srl = $oDocument->get('member_srl'); |
@@ -846,19 +846,19 @@ discard block |
||
| 846 | 846 | |
| 847 | 847 | // Call a trigger when the read count is updated (before) |
| 848 | 848 | $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument); |
| 849 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 849 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 850 | 850 | |
| 851 | 851 | // Pass if read count is increaded on the session information |
| 852 | - if($_SESSION['readed_document'][$document_srl]) return false; |
|
| 852 | + if ($_SESSION['readed_document'][$document_srl]) return false; |
|
| 853 | 853 | |
| 854 | 854 | // Pass if the author's IP address is as same as visitor's. |
| 855 | - if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 855 | + if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 856 | 856 | { |
| 857 | 857 | $_SESSION['readed_document'][$document_srl] = true; |
| 858 | 858 | return false; |
| 859 | 859 | } |
| 860 | 860 | // Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user. |
| 861 | - if($member_srl && $logged_info->member_srl == $member_srl) |
|
| 861 | + if ($member_srl && $logged_info->member_srl == $member_srl) |
|
| 862 | 862 | { |
| 863 | 863 | $_SESSION['readed_document'][$document_srl] = true; |
| 864 | 864 | return false; |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | // Call a trigger when the read count is updated (after) |
| 876 | 876 | $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument); |
| 877 | - if(!$trigger_output->toBool()) |
|
| 877 | + if (!$trigger_output->toBool()) |
|
| 878 | 878 | { |
| 879 | 879 | $oDB->rollback(); |
| 880 | 880 | return $trigger_output; |
@@ -883,15 +883,15 @@ discard block |
||
| 883 | 883 | $oDB->commit(); |
| 884 | 884 | |
| 885 | 885 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 886 | - if($oCacheHandler->isSupport()) |
|
| 886 | + if ($oCacheHandler->isSupport()) |
|
| 887 | 887 | { |
| 888 | 888 | //remove document item from cache |
| 889 | - $cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
| 889 | + $cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
| 890 | 890 | $oCacheHandler->delete($cache_key); |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | // Register session |
| 894 | - if(!$_SESSION['banned_document'][$document_srl]) |
|
| 894 | + if (!$_SESSION['banned_document'][$document_srl]) |
|
| 895 | 895 | { |
| 896 | 896 | $_SESSION['readed_document'][$document_srl] = true; |
| 897 | 897 | } |
@@ -914,21 +914,21 @@ discard block |
||
| 914 | 914 | */ |
| 915 | 915 | function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid) |
| 916 | 916 | { |
| 917 | - if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
| 917 | + if (!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 918 | 918 | |
| 919 | 919 | $obj = new stdClass(); |
| 920 | 920 | $obj->module_srl = $module_srl; |
| 921 | 921 | $obj->var_idx = $var_idx; |
| 922 | 922 | $obj->var_name = $var_name; |
| 923 | 923 | $obj->var_type = $var_type; |
| 924 | - $obj->var_is_required = $var_is_required=='Y'?'Y':'N'; |
|
| 925 | - $obj->var_search = $var_search=='Y'?'Y':'N'; |
|
| 924 | + $obj->var_is_required = $var_is_required == 'Y' ? 'Y' : 'N'; |
|
| 925 | + $obj->var_search = $var_search == 'Y' ? 'Y' : 'N'; |
|
| 926 | 926 | $obj->var_default = $var_default; |
| 927 | 927 | $obj->var_desc = $var_desc; |
| 928 | 928 | $obj->eid = $eid; |
| 929 | 929 | |
| 930 | 930 | $output = executeQuery('document.getDocumentExtraKeys', $obj); |
| 931 | - if(!$output->data) |
|
| 931 | + if (!$output->data) |
|
| 932 | 932 | { |
| 933 | 933 | $output = executeQuery('document.insertDocumentExtraKey', $obj); |
| 934 | 934 | } |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 943 | - if($oCacheHandler->isSupport()) |
|
| 943 | + if ($oCacheHandler->isSupport()) |
|
| 944 | 944 | { |
| 945 | 945 | $object_key = 'module_document_extra_keys:'.$module_srl; |
| 946 | 946 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -958,42 +958,42 @@ discard block |
||
| 958 | 958 | */ |
| 959 | 959 | function deleteDocumentExtraKeys($module_srl, $var_idx = null) |
| 960 | 960 | { |
| 961 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 961 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 962 | 962 | $obj = new stdClass(); |
| 963 | 963 | $obj->module_srl = $module_srl; |
| 964 | - if(!is_null($var_idx)) $obj->var_idx = $var_idx; |
|
| 964 | + if (!is_null($var_idx)) $obj->var_idx = $var_idx; |
|
| 965 | 965 | |
| 966 | 966 | $oDB = DB::getInstance(); |
| 967 | 967 | $oDB->begin(); |
| 968 | 968 | |
| 969 | 969 | $output = $oDB->executeQuery('document.deleteDocumentExtraKeys', $obj); |
| 970 | - if(!$output->toBool()) |
|
| 970 | + if (!$output->toBool()) |
|
| 971 | 971 | { |
| 972 | 972 | $oDB->rollback(); |
| 973 | 973 | return $output; |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | - if($var_idx != NULL) |
|
| 976 | + if ($var_idx != NULL) |
|
| 977 | 977 | { |
| 978 | 978 | $output = $oDB->executeQuery('document.updateDocumentExtraKeyIdxOrder', $obj); |
| 979 | - if(!$output->toBool()) |
|
| 979 | + if (!$output->toBool()) |
|
| 980 | 980 | { |
| 981 | 981 | $oDB->rollback(); |
| 982 | 982 | return $output; |
| 983 | 983 | } |
| 984 | 984 | } |
| 985 | 985 | |
| 986 | - $output = executeQuery('document.deleteDocumentExtraVars', $obj); |
|
| 987 | - if(!$output->toBool()) |
|
| 986 | + $output = executeQuery('document.deleteDocumentExtraVars', $obj); |
|
| 987 | + if (!$output->toBool()) |
|
| 988 | 988 | { |
| 989 | 989 | $oDB->rollback(); |
| 990 | 990 | return $output; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - if($var_idx != NULL) |
|
| 993 | + if ($var_idx != NULL) |
|
| 994 | 994 | { |
| 995 | 995 | $output = $oDB->executeQuery('document.updateDocumentExtraVarIdxOrder', $obj); |
| 996 | - if(!$output->toBool()) |
|
| 996 | + if (!$output->toBool()) |
|
| 997 | 997 | { |
| 998 | 998 | $oDB->rollback(); |
| 999 | 999 | return $output; |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | $oDB->commit(); |
| 1004 | 1004 | |
| 1005 | 1005 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 1006 | - if($oCacheHandler->isSupport()) |
|
| 1006 | + if ($oCacheHandler->isSupport()) |
|
| 1007 | 1007 | { |
| 1008 | 1008 | $object_key = 'module_document_extra_keys:'.$module_srl; |
| 1009 | 1009 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1025,8 +1025,8 @@ discard block |
||
| 1025 | 1025 | */ |
| 1026 | 1026 | function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '') |
| 1027 | 1027 | { |
| 1028 | - if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1029 | - if(!$lang_code) $lang_code = Context::getLangType(); |
|
| 1028 | + if (!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1029 | + if (!$lang_code) $lang_code = Context::getLangType(); |
|
| 1030 | 1030 | |
| 1031 | 1031 | $obj = new stdClass; |
| 1032 | 1032 | $obj->module_srl = $module_srl; |
@@ -1052,10 +1052,10 @@ discard block |
||
| 1052 | 1052 | { |
| 1053 | 1053 | $obj = new stdClass(); |
| 1054 | 1054 | $obj->module_srl = $module_srl; |
| 1055 | - if(!is_null($document_srl)) $obj->document_srl = $document_srl; |
|
| 1056 | - if(!is_null($var_idx)) $obj->var_idx = $var_idx; |
|
| 1057 | - if(!is_null($lang_code)) $obj->lang_code = $lang_code; |
|
| 1058 | - if(!is_null($eid)) $obj->eid = $eid; |
|
| 1055 | + if (!is_null($document_srl)) $obj->document_srl = $document_srl; |
|
| 1056 | + if (!is_null($var_idx)) $obj->var_idx = $var_idx; |
|
| 1057 | + if (!is_null($lang_code)) $obj->lang_code = $lang_code; |
|
| 1058 | + if (!is_null($eid)) $obj->eid = $eid; |
|
| 1059 | 1059 | $output = executeQuery('document.deleteDocumentExtraVars', $obj); |
| 1060 | 1060 | return $output; |
| 1061 | 1061 | } |
@@ -1069,10 +1069,10 @@ discard block |
||
| 1069 | 1069 | */ |
| 1070 | 1070 | function updateVotedCount($document_srl, $point = 1) |
| 1071 | 1071 | { |
| 1072 | - if($point > 0) $failed_voted = 'failed_voted'; |
|
| 1072 | + if ($point > 0) $failed_voted = 'failed_voted'; |
|
| 1073 | 1073 | else $failed_voted = 'failed_blamed'; |
| 1074 | 1074 | // Return fail if session already has information about votes |
| 1075 | - if($_SESSION['voted_document'][$document_srl]) |
|
| 1075 | + if ($_SESSION['voted_document'][$document_srl]) |
|
| 1076 | 1076 | { |
| 1077 | 1077 | return new BaseObject(-1, $failed_voted); |
| 1078 | 1078 | } |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | $oDocumentModel = getModel('document'); |
| 1081 | 1081 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 1082 | 1082 | // Pass if the author's IP address is as same as visitor's. |
| 1083 | - if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1083 | + if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
|
| 1084 | 1084 | { |
| 1085 | 1085 | $_SESSION['voted_document'][$document_srl] = true; |
| 1086 | 1086 | return new BaseObject(-1, $failed_voted); |
@@ -1091,10 +1091,10 @@ discard block |
||
| 1091 | 1091 | $member_srl = $oMemberModel->getLoggedMemberSrl(); |
| 1092 | 1092 | |
| 1093 | 1093 | // Check if document's author is a member. |
| 1094 | - if($oDocument->get('member_srl')) |
|
| 1094 | + if ($oDocument->get('member_srl')) |
|
| 1095 | 1095 | { |
| 1096 | 1096 | // Pass after registering a session if author's information is same as the currently logged-in user's. |
| 1097 | - if($member_srl && $member_srl == abs($oDocument->get('member_srl'))) |
|
| 1097 | + if ($member_srl && $member_srl == abs($oDocument->get('member_srl'))) |
|
| 1098 | 1098 | { |
| 1099 | 1099 | $_SESSION['voted_document'][$document_srl] = true; |
| 1100 | 1100 | return new BaseObject(-1, $failed_voted); |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | |
| 1104 | 1104 | // Use member_srl for logged-in members and IP address for non-members. |
| 1105 | 1105 | $args = new stdClass; |
| 1106 | - if($member_srl) |
|
| 1106 | + if ($member_srl) |
|
| 1107 | 1107 | { |
| 1108 | 1108 | $args->member_srl = $member_srl; |
| 1109 | 1109 | } |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | $args->document_srl = $document_srl; |
| 1115 | 1115 | $output = executeQuery('document.getDocumentVotedLogInfo', $args); |
| 1116 | 1116 | // Pass after registering a session if log information has vote-up logs |
| 1117 | - if($output->data->count) |
|
| 1117 | + if ($output->data->count) |
|
| 1118 | 1118 | { |
| 1119 | 1119 | $_SESSION['voted_document'][$document_srl] = true; |
| 1120 | 1120 | return new BaseObject(-1, $failed_voted); |
@@ -1130,7 +1130,7 @@ discard block |
||
| 1130 | 1130 | $trigger_obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count'); |
| 1131 | 1131 | $trigger_obj->after_point = $trigger_obj->before_point + $point; |
| 1132 | 1132 | $trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'before', $trigger_obj); |
| 1133 | - if(!$trigger_output->toBool()) |
|
| 1133 | + if (!$trigger_output->toBool()) |
|
| 1134 | 1134 | { |
| 1135 | 1135 | return $trigger_output; |
| 1136 | 1136 | } |
@@ -1140,7 +1140,7 @@ discard block |
||
| 1140 | 1140 | $oDB->begin(); |
| 1141 | 1141 | |
| 1142 | 1142 | // Update the voted count |
| 1143 | - if($trigger_obj->update_target === 'blamed_count') |
|
| 1143 | + if ($trigger_obj->update_target === 'blamed_count') |
|
| 1144 | 1144 | { |
| 1145 | 1145 | $args->blamed_count = $trigger_obj->after_point; |
| 1146 | 1146 | $output = executeQuery('document.updateBlamedCount', $args); |
@@ -1150,16 +1150,16 @@ discard block |
||
| 1150 | 1150 | $args->voted_count = $trigger_obj->after_point; |
| 1151 | 1151 | $output = executeQuery('document.updateVotedCount', $args); |
| 1152 | 1152 | } |
| 1153 | - if(!$output->toBool()) return $output; |
|
| 1153 | + if (!$output->toBool()) return $output; |
|
| 1154 | 1154 | |
| 1155 | 1155 | // Leave logs |
| 1156 | 1156 | $args->point = $trigger_obj->point; |
| 1157 | 1157 | $output = executeQuery('document.insertDocumentVotedLog', $args); |
| 1158 | - if(!$output->toBool()) return $output; |
|
| 1158 | + if (!$output->toBool()) return $output; |
|
| 1159 | 1159 | |
| 1160 | 1160 | // Call a trigger (after) |
| 1161 | 1161 | $trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $trigger_obj); |
| 1162 | - if(!$trigger_output->toBool()) |
|
| 1162 | + if (!$trigger_output->toBool()) |
|
| 1163 | 1163 | { |
| 1164 | 1164 | $oDB->rollback(); |
| 1165 | 1165 | return $trigger_output; |
@@ -1168,10 +1168,10 @@ discard block |
||
| 1168 | 1168 | $oDB->commit(); |
| 1169 | 1169 | |
| 1170 | 1170 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 1171 | - if($oCacheHandler->isSupport()) |
|
| 1171 | + if ($oCacheHandler->isSupport()) |
|
| 1172 | 1172 | { |
| 1173 | 1173 | //remove document item from cache |
| 1174 | - $cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
| 1174 | + $cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
| 1175 | 1175 | $oCacheHandler->delete($cache_key); |
| 1176 | 1176 | } |
| 1177 | 1177 | |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | |
| 1181 | 1181 | // Return result |
| 1182 | 1182 | $output = new BaseObject(); |
| 1183 | - if($trigger_obj->update_target === 'voted_count') |
|
| 1183 | + if ($trigger_obj->update_target === 'voted_count') |
|
| 1184 | 1184 | { |
| 1185 | 1185 | $output->setMessage('success_voted'); |
| 1186 | 1186 | $output->add('voted_count', $trigger_obj->after_point); |
@@ -1202,13 +1202,13 @@ discard block |
||
| 1202 | 1202 | function declaredDocument($document_srl) |
| 1203 | 1203 | { |
| 1204 | 1204 | // Fail if session information already has a reported document |
| 1205 | - if($_SESSION['declared_document'][$document_srl]) return new BaseObject(-1, 'failed_declared'); |
|
| 1205 | + if ($_SESSION['declared_document'][$document_srl]) return new BaseObject(-1, 'failed_declared'); |
|
| 1206 | 1206 | |
| 1207 | 1207 | // Check if previously reported |
| 1208 | 1208 | $args = new stdClass(); |
| 1209 | 1209 | $args->document_srl = $document_srl; |
| 1210 | 1210 | $output = executeQuery('document.getDeclaredDocument', $args); |
| 1211 | - if(!$output->toBool()) return $output; |
|
| 1211 | + if (!$output->toBool()) return $output; |
|
| 1212 | 1212 | |
| 1213 | 1213 | $declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0; |
| 1214 | 1214 | |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | |
| 1219 | 1219 | // Call a trigger (before) |
| 1220 | 1220 | $trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'before', $trigger_obj); |
| 1221 | - if(!$trigger_output->toBool()) |
|
| 1221 | + if (!$trigger_output->toBool()) |
|
| 1222 | 1222 | { |
| 1223 | 1223 | return $trigger_output; |
| 1224 | 1224 | } |
@@ -1228,19 +1228,19 @@ discard block |
||
| 1228 | 1228 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 1229 | 1229 | |
| 1230 | 1230 | // Pass if the author's IP address is as same as visitor's. |
| 1231 | - if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { |
|
| 1231 | + if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { |
|
| 1232 | 1232 | $_SESSION['declared_document'][$document_srl] = true; |
| 1233 | 1233 | return new BaseObject(-1, 'failed_declared'); |
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | 1236 | // Check if document's author is a member. |
| 1237 | - if($oDocument->get('member_srl')) |
|
| 1237 | + if ($oDocument->get('member_srl')) |
|
| 1238 | 1238 | { |
| 1239 | 1239 | // Create a member model object |
| 1240 | 1240 | $oMemberModel = getModel('member'); |
| 1241 | 1241 | $member_srl = $oMemberModel->getLoggedMemberSrl(); |
| 1242 | 1242 | // Pass after registering a session if author's information is same as the currently logged-in user's. |
| 1243 | - if($member_srl && $member_srl == abs($oDocument->get('member_srl'))) |
|
| 1243 | + if ($member_srl && $member_srl == abs($oDocument->get('member_srl'))) |
|
| 1244 | 1244 | { |
| 1245 | 1245 | $_SESSION['declared_document'][$document_srl] = true; |
| 1246 | 1246 | return new BaseObject(-1, 'failed_declared'); |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | |
| 1250 | 1250 | // Use member_srl for logged-in members and IP address for non-members. |
| 1251 | 1251 | $args = new stdClass; |
| 1252 | - if($member_srl) |
|
| 1252 | + if ($member_srl) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $args->member_srl = $member_srl; |
| 1255 | 1255 | } |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | $output = executeQuery('document.getDocumentDeclaredLogInfo', $args); |
| 1263 | 1263 | |
| 1264 | 1264 | // Pass after registering a sesson if reported/declared documents are in the logs. |
| 1265 | - if($output->data->count) |
|
| 1265 | + if ($output->data->count) |
|
| 1266 | 1266 | { |
| 1267 | 1267 | $_SESSION['declared_document'][$document_srl] = true; |
| 1268 | 1268 | return new BaseObject(-1, 'failed_declared'); |
@@ -1273,23 +1273,23 @@ discard block |
||
| 1273 | 1273 | $oDB->begin(); |
| 1274 | 1274 | |
| 1275 | 1275 | // Add the declared document |
| 1276 | - if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args); |
|
| 1276 | + if ($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args); |
|
| 1277 | 1277 | else $output = executeQuery('document.insertDeclaredDocument', $args); |
| 1278 | - if(!$output->toBool()) return $output; |
|
| 1278 | + if (!$output->toBool()) return $output; |
|
| 1279 | 1279 | // Leave logs |
| 1280 | 1280 | $output = executeQuery('document.insertDocumentDeclaredLog', $args); |
| 1281 | - if(!$output->toBool()) |
|
| 1281 | + if (!$output->toBool()) |
|
| 1282 | 1282 | { |
| 1283 | 1283 | $oDB->rollback(); |
| 1284 | 1284 | return $output; |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | - $this->add('declared_count', $declared_count+1); |
|
| 1287 | + $this->add('declared_count', $declared_count + 1); |
|
| 1288 | 1288 | |
| 1289 | 1289 | // Call a trigger (after) |
| 1290 | 1290 | $trigger_obj->declared_count = $declared_count + 1; |
| 1291 | 1291 | $trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'after', $trigger_obj); |
| 1292 | - if(!$trigger_output->toBool()) |
|
| 1292 | + if (!$trigger_output->toBool()) |
|
| 1293 | 1293 | { |
| 1294 | 1294 | $oDB->rollback(); |
| 1295 | 1295 | return $trigger_output; |
@@ -1319,16 +1319,16 @@ discard block |
||
| 1319 | 1319 | $args->document_srl = $document_srl; |
| 1320 | 1320 | $args->comment_count = $comment_count; |
| 1321 | 1321 | |
| 1322 | - if($comment_inserted) |
|
| 1322 | + if ($comment_inserted) |
|
| 1323 | 1323 | { |
| 1324 | - $args->update_order = -1*getNextSequence(); |
|
| 1324 | + $args->update_order = -1 * getNextSequence(); |
|
| 1325 | 1325 | $args->last_updater = $last_updater; |
| 1326 | 1326 | |
| 1327 | 1327 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 1328 | - if($oCacheHandler->isSupport()) |
|
| 1328 | + if ($oCacheHandler->isSupport()) |
|
| 1329 | 1329 | { |
| 1330 | 1330 | //remove document item from cache |
| 1331 | - $cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
| 1331 | + $cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
| 1332 | 1332 | $oCacheHandler->delete($cache_key); |
| 1333 | 1333 | } |
| 1334 | 1334 | } |
@@ -1349,10 +1349,10 @@ discard block |
||
| 1349 | 1349 | $args->trackback_count = $trackback_count; |
| 1350 | 1350 | |
| 1351 | 1351 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 1352 | - if($oCacheHandler->isSupport()) |
|
| 1352 | + if ($oCacheHandler->isSupport()) |
|
| 1353 | 1353 | { |
| 1354 | 1354 | //remove document item from cache |
| 1355 | - $cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl; |
|
| 1355 | + $cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl; |
|
| 1356 | 1356 | $oCacheHandler->delete($cache_key); |
| 1357 | 1357 | } |
| 1358 | 1358 | |
@@ -1367,14 +1367,14 @@ discard block |
||
| 1367 | 1367 | function insertCategory($obj) |
| 1368 | 1368 | { |
| 1369 | 1369 | // Sort the order to display if a child category is added |
| 1370 | - if($obj->parent_srl) |
|
| 1370 | + if ($obj->parent_srl) |
|
| 1371 | 1371 | { |
| 1372 | 1372 | // Get its parent category |
| 1373 | 1373 | $oDocumentModel = getModel('document'); |
| 1374 | 1374 | $parent_category = $oDocumentModel->getCategory($obj->parent_srl); |
| 1375 | 1375 | $obj->list_order = $parent_category->list_order; |
| 1376 | - $this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1); |
|
| 1377 | - if(!$obj->category_srl) $obj->category_srl = getNextSequence(); |
|
| 1376 | + $this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order + 1); |
|
| 1377 | + if (!$obj->category_srl) $obj->category_srl = getNextSequence(); |
|
| 1378 | 1378 | } |
| 1379 | 1379 | else |
| 1380 | 1380 | { |
@@ -1382,7 +1382,7 @@ discard block |
||
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | $output = executeQuery('document.insertCategory', $obj); |
| 1385 | - if($output->toBool()) |
|
| 1385 | + if ($output->toBool()) |
|
| 1386 | 1386 | { |
| 1387 | 1387 | $output->add('category_srl', $obj->category_srl); |
| 1388 | 1388 | $this->makeCategoryFile($obj->module_srl); |
@@ -1416,13 +1416,13 @@ discard block |
||
| 1416 | 1416 | { |
| 1417 | 1417 | // Create a document model object |
| 1418 | 1418 | $oDocumentModel = getModel('document'); |
| 1419 | - if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl); |
|
| 1419 | + if (!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl, $category_srl); |
|
| 1420 | 1420 | |
| 1421 | 1421 | $args = new stdClass; |
| 1422 | 1422 | $args->category_srl = $category_srl; |
| 1423 | 1423 | $args->document_count = $document_count; |
| 1424 | 1424 | $output = executeQuery('document.updateCategoryCount', $args); |
| 1425 | - if($output->toBool()) $this->makeCategoryFile($module_srl); |
|
| 1425 | + if ($output->toBool()) $this->makeCategoryFile($module_srl); |
|
| 1426 | 1426 | |
| 1427 | 1427 | return $output; |
| 1428 | 1428 | } |
@@ -1435,7 +1435,7 @@ discard block |
||
| 1435 | 1435 | function updateCategory($obj) |
| 1436 | 1436 | { |
| 1437 | 1437 | $output = executeQuery('document.updateCategory', $obj); |
| 1438 | - if($output->toBool()) $this->makeCategoryFile($obj->module_srl); |
|
| 1438 | + if ($output->toBool()) $this->makeCategoryFile($obj->module_srl); |
|
| 1439 | 1439 | return $output; |
| 1440 | 1440 | } |
| 1441 | 1441 | |
@@ -1452,32 +1452,32 @@ discard block |
||
| 1452 | 1452 | $category_info = $oDocumentModel->getCategory($category_srl); |
| 1453 | 1453 | // Display an error that the category cannot be deleted if it has a child |
| 1454 | 1454 | $output = executeQuery('document.getChildCategoryCount', $args); |
| 1455 | - if(!$output->toBool()) return $output; |
|
| 1456 | - if($output->data->count>0) return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 1455 | + if (!$output->toBool()) return $output; |
|
| 1456 | + if ($output->data->count > 0) return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 1457 | 1457 | // Delete a category information |
| 1458 | 1458 | $output = executeQuery('document.deleteCategory', $args); |
| 1459 | - if(!$output->toBool()) return $output; |
|
| 1459 | + if (!$output->toBool()) return $output; |
|
| 1460 | 1460 | |
| 1461 | 1461 | $this->makeCategoryFile($category_info->module_srl); |
| 1462 | 1462 | // remvove cache |
| 1463 | 1463 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 1464 | - if($oCacheHandler->isSupport()) |
|
| 1464 | + if ($oCacheHandler->isSupport()) |
|
| 1465 | 1465 | { |
| 1466 | 1466 | $page = 0; |
| 1467 | - while(true) { |
|
| 1467 | + while (true) { |
|
| 1468 | 1468 | $args = new stdClass(); |
| 1469 | 1469 | $args->category_srl = $category_srl; |
| 1470 | 1470 | $args->list_count = 100; |
| 1471 | 1471 | $args->page = ++$page; |
| 1472 | 1472 | $output = executeQuery('document.getDocumentList', $args, array('document_srl')); |
| 1473 | 1473 | |
| 1474 | - if($output->data == array()) |
|
| 1474 | + if ($output->data == array()) |
|
| 1475 | 1475 | break; |
| 1476 | 1476 | |
| 1477 | - foreach($output->data as $val) |
|
| 1477 | + foreach ($output->data as $val) |
|
| 1478 | 1478 | { |
| 1479 | 1479 | //remove document item from cache |
| 1480 | - $cache_key = 'document_item:'. getNumberingPath($val->document_srl) . $val->document_srl; |
|
| 1480 | + $cache_key = 'document_item:'.getNumberingPath($val->document_srl).$val->document_srl; |
|
| 1481 | 1481 | $oCacheHandler->delete($cache_key); |
| 1482 | 1482 | } |
| 1483 | 1483 | } |
@@ -1524,18 +1524,18 @@ discard block |
||
| 1524 | 1524 | // Seek a full list of categories |
| 1525 | 1525 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 1526 | 1526 | $category_srl_list = array_keys($category_list); |
| 1527 | - if(count($category_srl_list)<2) return new BaseObject(); |
|
| 1527 | + if (count($category_srl_list) < 2) return new BaseObject(); |
|
| 1528 | 1528 | |
| 1529 | 1529 | $prev_category = NULL; |
| 1530 | - foreach($category_list as $key => $val) |
|
| 1530 | + foreach ($category_list as $key => $val) |
|
| 1531 | 1531 | { |
| 1532 | - if($key==$category_srl) break; |
|
| 1532 | + if ($key == $category_srl) break; |
|
| 1533 | 1533 | $prev_category = $val; |
| 1534 | 1534 | } |
| 1535 | 1535 | // Return if the previous category doesn't exist |
| 1536 | - if(!$prev_category) return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1536 | + if (!$prev_category) return new BaseObject(-1, Context::getLang('msg_category_not_moved')); |
|
| 1537 | 1537 | // Return if the selected category is the top level |
| 1538 | - if($category_srl_list[0]==$category_srl) return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1538 | + if ($category_srl_list[0] == $category_srl) return new BaseObject(-1, Context::getLang('msg_category_not_moved')); |
|
| 1539 | 1539 | // Information of the selected category |
| 1540 | 1540 | $cur_args = new stdClass; |
| 1541 | 1541 | $cur_args->category_srl = $category_srl; |
@@ -1571,15 +1571,15 @@ discard block |
||
| 1571 | 1571 | // Seek a full list of categories |
| 1572 | 1572 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 1573 | 1573 | $category_srl_list = array_keys($category_list); |
| 1574 | - if(count($category_srl_list)<2) return new BaseObject(); |
|
| 1574 | + if (count($category_srl_list) < 2) return new BaseObject(); |
|
| 1575 | 1575 | |
| 1576 | - for($i=0;$i<count($category_srl_list);$i++) |
|
| 1576 | + for ($i = 0; $i < count($category_srl_list); $i++) |
|
| 1577 | 1577 | { |
| 1578 | - if($category_srl_list[$i]==$category_srl) break; |
|
| 1578 | + if ($category_srl_list[$i] == $category_srl) break; |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | - $next_category_srl = $category_srl_list[$i+1]; |
|
| 1582 | - if(!$category_list[$next_category_srl]) return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1581 | + $next_category_srl = $category_srl_list[$i + 1]; |
|
| 1582 | + if (!$category_list[$next_category_srl]) return new BaseObject(-1, Context::getLang('msg_category_not_moved')); |
|
| 1583 | 1583 | $next_category = $category_list[$next_category_srl]; |
| 1584 | 1584 | // Information of the selected category |
| 1585 | 1585 | $cur_args = new stdClass; |
@@ -1606,7 +1606,7 @@ discard block |
||
| 1606 | 1606 | { |
| 1607 | 1607 | $oDocumentModel = getModel('document'); |
| 1608 | 1608 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
| 1609 | - if(!count($extra_keys)) return; |
|
| 1609 | + if (!count($extra_keys)) return; |
|
| 1610 | 1610 | |
| 1611 | 1611 | $js_code = array(); |
| 1612 | 1612 | $js_code[] = '<script>//<![CDATA['; |
@@ -1616,16 +1616,16 @@ discard block |
||
| 1616 | 1616 | |
| 1617 | 1617 | $logged_info = Context::get('logged_info'); |
| 1618 | 1618 | |
| 1619 | - foreach($extra_keys as $idx => $val) |
|
| 1619 | + foreach ($extra_keys as $idx => $val) |
|
| 1620 | 1620 | { |
| 1621 | 1621 | $idx = $val->idx; |
| 1622 | - if($val->type == 'kr_zip') |
|
| 1622 | + if ($val->type == 'kr_zip') |
|
| 1623 | 1623 | { |
| 1624 | 1624 | $idx .= '[]'; |
| 1625 | 1625 | } |
| 1626 | 1626 | $name = str_ireplace(array('<script', '</script'), array('<scr" + "ipt', '</scr" + "ipt'), $val->name); |
| 1627 | 1627 | $js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["extra_vars%s","%s"]);', $idx, $name); |
| 1628 | - if($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx); |
|
| 1628 | + if ($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx); |
|
| 1629 | 1629 | } |
| 1630 | 1630 | |
| 1631 | 1631 | $js_code[] = '})(jQuery);'; |
@@ -1643,12 +1643,12 @@ discard block |
||
| 1643 | 1643 | function procDocumentInsertCategory($args = null) |
| 1644 | 1644 | { |
| 1645 | 1645 | // List variables |
| 1646 | - if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid'); |
|
| 1646 | + if (!$args) $args = Context::gets('module_srl', 'category_srl', 'parent_srl', 'category_title', 'category_description', 'expand', 'group_srls', 'category_color', 'mid'); |
|
| 1647 | 1647 | $args->title = $args->category_title; |
| 1648 | 1648 | $args->description = $args->category_description; |
| 1649 | 1649 | $args->color = $args->category_color; |
| 1650 | 1650 | |
| 1651 | - if(!$args->module_srl && $args->mid) |
|
| 1651 | + if (!$args->module_srl && $args->mid) |
|
| 1652 | 1652 | { |
| 1653 | 1653 | $mid = $args->mid; |
| 1654 | 1654 | unset($args->mid); |
@@ -1659,28 +1659,28 @@ discard block |
||
| 1659 | 1659 | $columnList = array('module_srl', 'module'); |
| 1660 | 1660 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); |
| 1661 | 1661 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1662 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1662 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1663 | 1663 | |
| 1664 | - if($args->expand !="Y") $args->expand = "N"; |
|
| 1665 | - if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls); |
|
| 1664 | + if ($args->expand != "Y") $args->expand = "N"; |
|
| 1665 | + if (!is_array($args->group_srls)) $args->group_srls = str_replace('|@|', ',', $args->group_srls); |
|
| 1666 | 1666 | else $args->group_srls = implode(',', $args->group_srls); |
| 1667 | - $args->parent_srl = (int)$args->parent_srl; |
|
| 1667 | + $args->parent_srl = (int) $args->parent_srl; |
|
| 1668 | 1668 | |
| 1669 | 1669 | $oDocumentModel = getModel('document'); |
| 1670 | 1670 | |
| 1671 | 1671 | $oDB = &DB::getInstance(); |
| 1672 | 1672 | $oDB->begin(); |
| 1673 | 1673 | // Check if already exists |
| 1674 | - if($args->category_srl) |
|
| 1674 | + if ($args->category_srl) |
|
| 1675 | 1675 | { |
| 1676 | 1676 | $category_info = $oDocumentModel->getCategory($args->category_srl); |
| 1677 | - if($category_info->category_srl != $args->category_srl) $args->category_srl = null; |
|
| 1677 | + if ($category_info->category_srl != $args->category_srl) $args->category_srl = null; |
|
| 1678 | 1678 | } |
| 1679 | 1679 | // Update if exists |
| 1680 | - if($args->category_srl) |
|
| 1680 | + if ($args->category_srl) |
|
| 1681 | 1681 | { |
| 1682 | 1682 | $output = $this->updateCategory($args); |
| 1683 | - if(!$output->toBool()) |
|
| 1683 | + if (!$output->toBool()) |
|
| 1684 | 1684 | { |
| 1685 | 1685 | $oDB->rollback(); |
| 1686 | 1686 | return $output; |
@@ -1690,7 +1690,7 @@ discard block |
||
| 1690 | 1690 | else |
| 1691 | 1691 | { |
| 1692 | 1692 | $output = $this->insertCategory($args); |
| 1693 | - if(!$output->toBool()) |
|
| 1693 | + if (!$output->toBool()) |
|
| 1694 | 1694 | { |
| 1695 | 1695 | $oDB->rollback(); |
| 1696 | 1696 | return $output; |
@@ -1729,11 +1729,11 @@ discard block |
||
| 1729 | 1729 | $columnList = array('module_srl', 'module'); |
| 1730 | 1730 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList); |
| 1731 | 1731 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1732 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1732 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1733 | 1733 | |
| 1734 | 1734 | // First child of the parent_category_srl |
| 1735 | 1735 | $source_args = new stdClass; |
| 1736 | - if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0)) |
|
| 1736 | + if ($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0)) |
|
| 1737 | 1737 | { |
| 1738 | 1738 | $parent_category = $oDocumentModel->getCategory($parent_category_srl); |
| 1739 | 1739 | |
@@ -1742,30 +1742,30 @@ discard block |
||
| 1742 | 1742 | $args->parent_srl = $parent_category_srl; |
| 1743 | 1743 | $output = executeQuery('document.getChildCategoryMinListOrder', $args); |
| 1744 | 1744 | |
| 1745 | - if(!$output->toBool()) return $output; |
|
| 1746 | - $args->list_order = (int)$output->data->list_order; |
|
| 1747 | - if(!$args->list_order) $args->list_order = 0; |
|
| 1745 | + if (!$output->toBool()) return $output; |
|
| 1746 | + $args->list_order = (int) $output->data->list_order; |
|
| 1747 | + if (!$args->list_order) $args->list_order = 0; |
|
| 1748 | 1748 | $args->list_order--; |
| 1749 | 1749 | |
| 1750 | 1750 | $source_args->category_srl = $source_category_srl; |
| 1751 | 1751 | $source_args->parent_srl = $parent_category_srl; |
| 1752 | 1752 | $source_args->list_order = $args->list_order; |
| 1753 | 1753 | $output = $this->updateCategory($source_args); |
| 1754 | - if(!$output->toBool()) return $output; |
|
| 1754 | + if (!$output->toBool()) return $output; |
|
| 1755 | 1755 | // Sibling of the $target_category_srl |
| 1756 | 1756 | } |
| 1757 | - else if($target_category_srl > 0) |
|
| 1757 | + else if ($target_category_srl > 0) |
|
| 1758 | 1758 | { |
| 1759 | 1759 | $target_category = $oDocumentModel->getCategory($target_category_srl); |
| 1760 | 1760 | // Move all siblings of the $target_category down |
| 1761 | - $output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1); |
|
| 1762 | - if(!$output->toBool()) return $output; |
|
| 1761 | + $output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order + 1); |
|
| 1762 | + if (!$output->toBool()) return $output; |
|
| 1763 | 1763 | |
| 1764 | 1764 | $source_args->category_srl = $source_category_srl; |
| 1765 | 1765 | $source_args->parent_srl = $target_category->parent_srl; |
| 1766 | - $source_args->list_order = $target_category->list_order+1; |
|
| 1766 | + $source_args->list_order = $target_category->list_order + 1; |
|
| 1767 | 1767 | $output = $this->updateCategory($source_args); |
| 1768 | - if(!$output->toBool()) return $output; |
|
| 1768 | + if (!$output->toBool()) return $output; |
|
| 1769 | 1769 | } |
| 1770 | 1770 | // Re-generate the xml file |
| 1771 | 1771 | $xml_file = $this->makeCategoryFile($source_category->module_srl); |
@@ -1781,7 +1781,7 @@ discard block |
||
| 1781 | 1781 | function procDocumentDeleteCategory() |
| 1782 | 1782 | { |
| 1783 | 1783 | // List variables |
| 1784 | - $args = Context::gets('module_srl','category_srl'); |
|
| 1784 | + $args = Context::gets('module_srl', 'category_srl'); |
|
| 1785 | 1785 | |
| 1786 | 1786 | $oDB = &DB::getInstance(); |
| 1787 | 1787 | $oDB->begin(); |
@@ -1790,17 +1790,17 @@ discard block |
||
| 1790 | 1790 | $columnList = array('module_srl', 'module'); |
| 1791 | 1791 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); |
| 1792 | 1792 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1793 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1793 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1794 | 1794 | |
| 1795 | 1795 | $oDocumentModel = getModel('document'); |
| 1796 | 1796 | // Get original information |
| 1797 | 1797 | $category_info = $oDocumentModel->getCategory($args->category_srl); |
| 1798 | - if($category_info->parent_srl) $parent_srl = $category_info->parent_srl; |
|
| 1798 | + if ($category_info->parent_srl) $parent_srl = $category_info->parent_srl; |
|
| 1799 | 1799 | // Display an error that the category cannot be deleted if it has a child node |
| 1800 | - if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 1800 | + if ($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 1801 | 1801 | // Remove from the DB |
| 1802 | 1802 | $output = $this->deleteCategory($args->category_srl); |
| 1803 | - if(!$output->toBool()) |
|
| 1803 | + if (!$output->toBool()) |
|
| 1804 | 1804 | { |
| 1805 | 1805 | $oDB->rollback(); |
| 1806 | 1806 | return $output; |
@@ -1831,11 +1831,11 @@ discard block |
||
| 1831 | 1831 | $columnList = array('module_srl', 'module'); |
| 1832 | 1832 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 1833 | 1833 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1834 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1834 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1835 | 1835 | |
| 1836 | 1836 | $xml_file = $this->makeCategoryFile($module_srl); |
| 1837 | 1837 | // Set return value |
| 1838 | - $this->add('xml_file',$xml_file); |
|
| 1838 | + $this->add('xml_file', $xml_file); |
|
| 1839 | 1839 | } |
| 1840 | 1840 | |
| 1841 | 1841 | /** |
@@ -1846,9 +1846,9 @@ discard block |
||
| 1846 | 1846 | function makeCategoryFile($module_srl) |
| 1847 | 1847 | { |
| 1848 | 1848 | // Return if there is no information you need for creating a cache file |
| 1849 | - if(!$module_srl) return false; |
|
| 1849 | + if (!$module_srl) return false; |
|
| 1850 | 1850 | |
| 1851 | - $module_srl = (int)$module_srl; |
|
| 1851 | + $module_srl = (int) $module_srl; |
|
| 1852 | 1852 | |
| 1853 | 1853 | // Get module information (to obtain mid) |
| 1854 | 1854 | $oModuleModel = getModel('module'); |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 1857 | 1857 | $mid = $module_info->mid; |
| 1858 | 1858 | |
| 1859 | - if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category'); |
|
| 1859 | + if (!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category'); |
|
| 1860 | 1860 | // Cache file's name |
| 1861 | 1861 | $xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl); |
| 1862 | 1862 | $php_file = sprintf("./files/cache/document_category/%s.php", $module_srl); |
@@ -1868,17 +1868,17 @@ discard block |
||
| 1868 | 1868 | |
| 1869 | 1869 | $category_list = $output->data; |
| 1870 | 1870 | |
| 1871 | - if(!is_array($category_list)) $category_list = array($category_list); |
|
| 1871 | + if (!is_array($category_list)) $category_list = array($category_list); |
|
| 1872 | 1872 | |
| 1873 | 1873 | $category_count = count($category_list); |
| 1874 | - for($i=0;$i<$category_count;$i++) |
|
| 1874 | + for ($i = 0; $i < $category_count; $i++) |
|
| 1875 | 1875 | { |
| 1876 | 1876 | $category_srl = $category_list[$i]->category_srl; |
| 1877 | - if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = ''; |
|
| 1877 | + if (!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = ''; |
|
| 1878 | 1878 | $list[$category_srl] = $category_list[$i]; |
| 1879 | 1879 | } |
| 1880 | 1880 | // Create the xml file without node data if no data is obtained |
| 1881 | - if(!$list) |
|
| 1881 | + if (!$list) |
|
| 1882 | 1882 | { |
| 1883 | 1883 | $xml_buff = "<root />"; |
| 1884 | 1884 | FileHandler::writeFile($xml_file, $xml_buff); |
@@ -1886,12 +1886,12 @@ discard block |
||
| 1886 | 1886 | return $xml_file; |
| 1887 | 1887 | } |
| 1888 | 1888 | // Change to an array if only a single data is obtained |
| 1889 | - if(!is_array($list)) $list = array($list); |
|
| 1889 | + if (!is_array($list)) $list = array($list); |
|
| 1890 | 1890 | // Create a tree for loop |
| 1891 | - foreach($list as $category_srl => $node) |
|
| 1891 | + foreach ($list as $category_srl => $node) |
|
| 1892 | 1892 | { |
| 1893 | 1893 | $node->mid = $mid; |
| 1894 | - $parent_srl = (int)$node->parent_srl; |
|
| 1894 | + $parent_srl = (int) $node->parent_srl; |
|
| 1895 | 1895 | $tree[$parent_srl][$category_srl] = $node; |
| 1896 | 1896 | } |
| 1897 | 1897 | // A common header to set permissions and groups of the cache file |
@@ -1965,13 +1965,13 @@ discard block |
||
| 1965 | 1965 | */ |
| 1966 | 1966 | function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff) |
| 1967 | 1967 | { |
| 1968 | - if(!$source_node) return; |
|
| 1968 | + if (!$source_node) return; |
|
| 1969 | 1969 | |
| 1970 | - foreach($source_node as $category_srl => $node) |
|
| 1970 | + foreach ($source_node as $category_srl => $node) |
|
| 1971 | 1971 | { |
| 1972 | 1972 | $child_buff = ""; |
| 1973 | 1973 | // Get data of the child nodes |
| 1974 | - if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); |
|
| 1974 | + if ($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); |
|
| 1975 | 1975 | // List variables |
| 1976 | 1976 | $expand = ($node->expand) ? $node->expand : 'N'; |
| 1977 | 1977 | $group_srls = ($node->group_srls) ? $node->group_srls : ''; |
@@ -1981,27 +1981,27 @@ discard block |
||
| 1981 | 1981 | $color = ($node->color) ? $node->color : ''; |
| 1982 | 1982 | $description = ($node->description) ? $node->description : ''; |
| 1983 | 1983 | // If node->group_srls value exists |
| 1984 | - if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls); |
|
| 1984 | + if ($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $group_srls); |
|
| 1985 | 1985 | else $group_check_code = "true"; |
| 1986 | 1986 | |
| 1987 | 1987 | $title = $node->title; |
| 1988 | 1988 | $oModuleAdminModel = getAdminModel('module'); |
| 1989 | 1989 | |
| 1990 | 1990 | $langs = $oModuleAdminModel->getLangCode($site_srl, $title); |
| 1991 | - if(count($langs)) |
|
| 1991 | + if (count($langs)) |
|
| 1992 | 1992 | { |
| 1993 | - foreach($langs as $key => $val) |
|
| 1993 | + foreach ($langs as $key => $val) |
|
| 1994 | 1994 | { |
| 1995 | - $xml_header_buff .= sprintf('$_titles[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true)); |
|
| 1995 | + $xml_header_buff .= sprintf('$_titles[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true)); |
|
| 1996 | 1996 | } |
| 1997 | 1997 | } |
| 1998 | 1998 | |
| 1999 | 1999 | $langx = $oModuleAdminModel->getLangCode($site_srl, $description); |
| 2000 | - if(count($langx)) |
|
| 2000 | + if (count($langx)) |
|
| 2001 | 2001 | { |
| 2002 | - foreach($langx as $key => $val) |
|
| 2002 | + foreach ($langx as $key => $val) |
|
| 2003 | 2003 | { |
| 2004 | - $xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true)); |
|
| 2004 | + $xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true)); |
|
| 2005 | 2005 | } |
| 2006 | 2006 | } |
| 2007 | 2007 | |
@@ -2014,7 +2014,7 @@ discard block |
||
| 2014 | 2014 | $category_srl, |
| 2015 | 2015 | $group_check_code, |
| 2016 | 2016 | $category_srl, |
| 2017 | - var_export(getUrl('','mid',$node->mid,'category',$category_srl), true), |
|
| 2017 | + var_export(getUrl('', 'mid', $node->mid, 'category', $category_srl), true), |
|
| 2018 | 2018 | var_export($expand, true), |
| 2019 | 2019 | var_export($color, true), |
| 2020 | 2020 | $group_check_code, |
@@ -2022,8 +2022,8 @@ discard block |
||
| 2022 | 2022 | $node->document_count |
| 2023 | 2023 | ); |
| 2024 | 2024 | |
| 2025 | - if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 2026 | - else $buff .= sprintf('<node %s />', $attribute); |
|
| 2025 | + if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 2026 | + else $buff .= sprintf('<node %s />', $attribute); |
|
| 2027 | 2027 | } |
| 2028 | 2028 | return $buff; |
| 2029 | 2029 | } |
@@ -2042,13 +2042,13 @@ discard block |
||
| 2042 | 2042 | function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff) |
| 2043 | 2043 | { |
| 2044 | 2044 | $output = array("buff"=>"", "category_srl_list"=>array()); |
| 2045 | - if(!$source_node) return $output; |
|
| 2045 | + if (!$source_node) return $output; |
|
| 2046 | 2046 | |
| 2047 | 2047 | // Set to an arraty for looping and then generate php script codes to be included |
| 2048 | - foreach($source_node as $category_srl => $node) |
|
| 2048 | + foreach ($source_node as $category_srl => $node) |
|
| 2049 | 2049 | { |
| 2050 | 2050 | // Get data from child nodes first if exist. |
| 2051 | - if($category_srl && $tree[$category_srl]){ |
|
| 2051 | + if ($category_srl && $tree[$category_srl]) { |
|
| 2052 | 2052 | $child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff); |
| 2053 | 2053 | } else { |
| 2054 | 2054 | $child_output = array("buff"=>"", "category_srl_list"=>array()); |
@@ -2059,14 +2059,14 @@ discard block |
||
| 2059 | 2059 | $output['category_srl_list'] = array_merge($output['category_srl_list'], $child_output['category_srl_list']); |
| 2060 | 2060 | |
| 2061 | 2061 | // If node->group_srls value exists |
| 2062 | - if($node->group_srls) { |
|
| 2063 | - $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls); |
|
| 2062 | + if ($node->group_srls) { |
|
| 2063 | + $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $node->group_srls); |
|
| 2064 | 2064 | } else { |
| 2065 | 2065 | $group_check_code = "true"; |
| 2066 | 2066 | } |
| 2067 | 2067 | |
| 2068 | 2068 | // List variables |
| 2069 | - $selected = '"' . implode('","', $child_output['category_srl_list']) . '"'; |
|
| 2069 | + $selected = '"'.implode('","', $child_output['category_srl_list']).'"'; |
|
| 2070 | 2070 | $child_buff = $child_output['buff']; |
| 2071 | 2071 | $expand = $node->expand; |
| 2072 | 2072 | |
@@ -2075,32 +2075,32 @@ discard block |
||
| 2075 | 2075 | $oModuleAdminModel = getAdminModel('module'); |
| 2076 | 2076 | $langs = $oModuleAdminModel->getLangCode($site_srl, $title); |
| 2077 | 2077 | |
| 2078 | - if(count($langs)) |
|
| 2078 | + if (count($langs)) |
|
| 2079 | 2079 | { |
| 2080 | - foreach($langs as $key => $val) |
|
| 2080 | + foreach ($langs as $key => $val) |
|
| 2081 | 2081 | { |
| 2082 | 2082 | $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2083 | 2083 | $php_header_buff .= sprintf( |
| 2084 | 2084 | '$_titles[%d]["%s"] = %s; ', |
| 2085 | 2085 | $category_srl, |
| 2086 | 2086 | $key, |
| 2087 | - var_export(str_replace('"','\\"', $val), true) |
|
| 2087 | + var_export(str_replace('"', '\\"', $val), true) |
|
| 2088 | 2088 | ); |
| 2089 | 2089 | } |
| 2090 | 2090 | } |
| 2091 | 2091 | |
| 2092 | 2092 | $langx = $oModuleAdminModel->getLangCode($site_srl, $description); |
| 2093 | 2093 | |
| 2094 | - if(count($langx)) |
|
| 2094 | + if (count($langx)) |
|
| 2095 | 2095 | { |
| 2096 | - foreach($langx as $key => $val) |
|
| 2096 | + foreach ($langx as $key => $val) |
|
| 2097 | 2097 | { |
| 2098 | 2098 | $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2099 | 2099 | $php_header_buff .= sprintf( |
| 2100 | 2100 | '$_descriptions[%d]["%s"] = %s; ', |
| 2101 | 2101 | $category_srl, |
| 2102 | 2102 | $key, |
| 2103 | - var_export(str_replace('"','\\"', $val), true) |
|
| 2103 | + var_export(str_replace('"', '\\"', $val), true) |
|
| 2104 | 2104 | ); |
| 2105 | 2105 | } |
| 2106 | 2106 | } |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | ); |
| 2125 | 2125 | |
| 2126 | 2126 | // Generate buff data |
| 2127 | - $output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute); |
|
| 2127 | + $output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute); |
|
| 2128 | 2128 | } |
| 2129 | 2129 | |
| 2130 | 2130 | return $output; |
@@ -2141,7 +2141,7 @@ discard block |
||
| 2141 | 2141 | function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self') |
| 2142 | 2142 | { |
| 2143 | 2143 | $document_popup_menu_list = Context::get('document_popup_menu_list'); |
| 2144 | - if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array(); |
|
| 2144 | + if (!is_array($document_popup_menu_list)) $document_popup_menu_list = array(); |
|
| 2145 | 2145 | |
| 2146 | 2146 | $obj = new stdClass(); |
| 2147 | 2147 | $obj->url = $url; |
@@ -2159,68 +2159,68 @@ discard block |
||
| 2159 | 2159 | */ |
| 2160 | 2160 | function procDocumentAddCart() |
| 2161 | 2161 | { |
| 2162 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2162 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2163 | 2163 | |
| 2164 | 2164 | // Get document_srl |
| 2165 | - $srls = explode(',',Context::get('srls')); |
|
| 2166 | - for($i = 0; $i < count($srls); $i++) |
|
| 2165 | + $srls = explode(',', Context::get('srls')); |
|
| 2166 | + for ($i = 0; $i < count($srls); $i++) |
|
| 2167 | 2167 | { |
| 2168 | 2168 | $srl = trim($srls[$i]); |
| 2169 | 2169 | |
| 2170 | - if(!$srl) continue; |
|
| 2170 | + if (!$srl) continue; |
|
| 2171 | 2171 | |
| 2172 | 2172 | $document_srls[] = $srl; |
| 2173 | 2173 | } |
| 2174 | - if(!count($document_srls)) return; |
|
| 2174 | + if (!count($document_srls)) return; |
|
| 2175 | 2175 | |
| 2176 | 2176 | // Get module_srl of the documents |
| 2177 | 2177 | $args = new stdClass; |
| 2178 | 2178 | $args->list_count = count($document_srls); |
| 2179 | - $args->document_srls = implode(',',$document_srls); |
|
| 2179 | + $args->document_srls = implode(',', $document_srls); |
|
| 2180 | 2180 | $args->order_type = 'asc'; |
| 2181 | 2181 | $output = executeQueryArray('document.getDocuments', $args); |
| 2182 | - if(!$output->data) return new BaseObject(); |
|
| 2182 | + if (!$output->data) return new BaseObject(); |
|
| 2183 | 2183 | |
| 2184 | 2184 | unset($document_srls); |
| 2185 | - foreach($output->data as $key => $val) |
|
| 2185 | + foreach ($output->data as $key => $val) |
|
| 2186 | 2186 | { |
| 2187 | 2187 | $document_srls[$val->module_srl][] = $val->document_srl; |
| 2188 | 2188 | } |
| 2189 | - if(!$document_srls || !count($document_srls)) return new BaseObject(); |
|
| 2189 | + if (!$document_srls || !count($document_srls)) return new BaseObject(); |
|
| 2190 | 2190 | |
| 2191 | 2191 | // Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents) |
| 2192 | 2192 | $oModuleModel = getModel('module'); |
| 2193 | 2193 | $module_srls = array_keys($document_srls); |
| 2194 | - for($i=0;$i<count($module_srls);$i++) |
|
| 2194 | + for ($i = 0; $i < count($module_srls); $i++) |
|
| 2195 | 2195 | { |
| 2196 | 2196 | $module_srl = $module_srls[$i]; |
| 2197 | 2197 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 2198 | 2198 | $logged_info = Context::get('logged_info'); |
| 2199 | - if($logged_info->is_admin != 'Y') |
|
| 2199 | + if ($logged_info->is_admin != 'Y') |
|
| 2200 | 2200 | { |
| 2201 | - if(!$module_info) |
|
| 2201 | + if (!$module_info) |
|
| 2202 | 2202 | { |
| 2203 | 2203 | unset($document_srls[$module_srl]); |
| 2204 | 2204 | continue; |
| 2205 | 2205 | } |
| 2206 | 2206 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2207 | - if(!$grant->manager) |
|
| 2207 | + if (!$grant->manager) |
|
| 2208 | 2208 | { |
| 2209 | 2209 | unset($document_srls[$module_srl]); |
| 2210 | 2210 | continue; |
| 2211 | 2211 | } |
| 2212 | 2212 | } |
| 2213 | 2213 | } |
| 2214 | - if(!count($document_srls)) return new BaseObject(); |
|
| 2214 | + if (!count($document_srls)) return new BaseObject(); |
|
| 2215 | 2215 | |
| 2216 | - foreach($document_srls as $module_srl => $documents) |
|
| 2216 | + foreach ($document_srls as $module_srl => $documents) |
|
| 2217 | 2217 | { |
| 2218 | 2218 | $cnt = count($documents); |
| 2219 | - for($i=0;$i<$cnt;$i++) |
|
| 2219 | + for ($i = 0; $i < $cnt; $i++) |
|
| 2220 | 2220 | { |
| 2221 | - $document_srl = (int)trim($documents[$i]); |
|
| 2222 | - if(!$document_srls) continue; |
|
| 2223 | - if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]); |
|
| 2221 | + $document_srl = (int) trim($documents[$i]); |
|
| 2222 | + if (!$document_srls) continue; |
|
| 2223 | + if ($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]); |
|
| 2224 | 2224 | else $_SESSION['document_management'][$document_srl] = true; |
| 2225 | 2225 | } |
| 2226 | 2226 | } |
@@ -2233,9 +2233,9 @@ discard block |
||
| 2233 | 2233 | function procDocumentManageCheckedDocument() |
| 2234 | 2234 | { |
| 2235 | 2235 | @set_time_limit(0); |
| 2236 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2236 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2237 | 2237 | |
| 2238 | - if(!checkCSRF()) |
|
| 2238 | + if (!checkCSRF()) |
|
| 2239 | 2239 | { |
| 2240 | 2240 | return new BaseObject(-1, 'msg_invalid_request'); |
| 2241 | 2241 | } |
@@ -2243,45 +2243,45 @@ discard block |
||
| 2243 | 2243 | $type = Context::get('type'); |
| 2244 | 2244 | $target_module = Context::get('target_module_srl'); |
| 2245 | 2245 | $module_srl = Context::get('module_srl'); |
| 2246 | - if($target_module && !$module_srl) $module_srl = $target_module; |
|
| 2246 | + if ($target_module && !$module_srl) $module_srl = $target_module; |
|
| 2247 | 2247 | $category_srl = Context::get('target_category_srl'); |
| 2248 | 2248 | $message_content = strip_tags(Context::get('message_content')); |
| 2249 | - if($message_content) $message_content = nl2br($message_content); |
|
| 2249 | + if ($message_content) $message_content = nl2br($message_content); |
|
| 2250 | 2250 | |
| 2251 | 2251 | $cart = Context::get('cart'); |
| 2252 | 2252 | $document_srl_list = (!is_array($cart)) ? explode('|@|', $cart) : $cart; |
| 2253 | 2253 | |
| 2254 | - array_map(function ($value) { return (int)$value; }, $document_srl_list); |
|
| 2254 | + array_map(function($value) { return (int) $value; }, $document_srl_list); |
|
| 2255 | 2255 | |
| 2256 | 2256 | $document_srl_count = count($document_srl_list); |
| 2257 | 2257 | |
| 2258 | 2258 | $oDocumentModel = getModel('document'); |
| 2259 | 2259 | $document_items = array(); |
| 2260 | - foreach($document_srl_list as $document_srl) |
|
| 2260 | + foreach ($document_srl_list as $document_srl) |
|
| 2261 | 2261 | { |
| 2262 | 2262 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 2263 | 2263 | $document_items[] = $oDocument; |
| 2264 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 2264 | + if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | 2267 | // Send a message |
| 2268 | - if($message_content) |
|
| 2268 | + if ($message_content) |
|
| 2269 | 2269 | { |
| 2270 | 2270 | |
| 2271 | 2271 | $oCommunicationController = getController('communication'); |
| 2272 | 2272 | |
| 2273 | 2273 | $logged_info = Context::get('logged_info'); |
| 2274 | 2274 | |
| 2275 | - $title = cut_str($message_content,10,'...'); |
|
| 2275 | + $title = cut_str($message_content, 10, '...'); |
|
| 2276 | 2276 | $sender_member_srl = $logged_info->member_srl; |
| 2277 | 2277 | |
| 2278 | - foreach($document_items as $oDocument) |
|
| 2278 | + foreach ($document_items as $oDocument) |
|
| 2279 | 2279 | { |
| 2280 | - if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue; |
|
| 2280 | + if (!$oDocument->get('member_srl') || $oDocument->get('member_srl') == $sender_member_srl) continue; |
|
| 2281 | 2281 | |
| 2282 | - if($type=='move') $purl = sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl()); |
|
| 2282 | + if ($type == 'move') $purl = sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl()); |
|
| 2283 | 2283 | else $purl = ""; |
| 2284 | - $content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false)); |
|
| 2284 | + $content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s", $message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false)); |
|
| 2285 | 2285 | |
| 2286 | 2286 | $oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false); |
| 2287 | 2287 | } |
@@ -2291,54 +2291,54 @@ discard block |
||
| 2291 | 2291 | $oSpamController->setAvoidLog(); |
| 2292 | 2292 | |
| 2293 | 2293 | $oDocumentAdminController = getAdminController('document'); |
| 2294 | - if($type == 'move') |
|
| 2294 | + if ($type == 'move') |
|
| 2295 | 2295 | { |
| 2296 | - if(!$module_srl) return new BaseObject(-1, 'fail_to_move'); |
|
| 2296 | + if (!$module_srl) return new BaseObject(-1, 'fail_to_move'); |
|
| 2297 | 2297 | |
| 2298 | 2298 | $output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl); |
| 2299 | - if(!$output->toBool()) return new BaseObject(-1, 'fail_to_move'); |
|
| 2299 | + if (!$output->toBool()) return new BaseObject(-1, 'fail_to_move'); |
|
| 2300 | 2300 | |
| 2301 | 2301 | $msg_code = 'success_moved'; |
| 2302 | 2302 | |
| 2303 | 2303 | } |
| 2304 | - else if($type == 'copy') |
|
| 2304 | + else if ($type == 'copy') |
|
| 2305 | 2305 | { |
| 2306 | - if(!$module_srl) return new BaseObject(-1, 'fail_to_move'); |
|
| 2306 | + if (!$module_srl) return new BaseObject(-1, 'fail_to_move'); |
|
| 2307 | 2307 | |
| 2308 | 2308 | $output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl); |
| 2309 | - if(!$output->toBool()) return new BaseObject(-1, 'fail_to_move'); |
|
| 2309 | + if (!$output->toBool()) return new BaseObject(-1, 'fail_to_move'); |
|
| 2310 | 2310 | |
| 2311 | 2311 | $msg_code = 'success_copied'; |
| 2312 | 2312 | } |
| 2313 | - else if($type =='delete') |
|
| 2313 | + else if ($type == 'delete') |
|
| 2314 | 2314 | { |
| 2315 | 2315 | $oDB = &DB::getInstance(); |
| 2316 | 2316 | $oDB->begin(); |
| 2317 | - for($i=0;$i<$document_srl_count;$i++) |
|
| 2317 | + for ($i = 0; $i < $document_srl_count; $i++) |
|
| 2318 | 2318 | { |
| 2319 | 2319 | $document_srl = $document_srl_list[$i]; |
| 2320 | 2320 | $output = $this->deleteDocument($document_srl, true); |
| 2321 | - if(!$output->toBool()) return new BaseObject(-1, 'fail_to_delete'); |
|
| 2321 | + if (!$output->toBool()) return new BaseObject(-1, 'fail_to_delete'); |
|
| 2322 | 2322 | } |
| 2323 | 2323 | $oDB->commit(); |
| 2324 | 2324 | $msg_code = 'success_deleted'; |
| 2325 | 2325 | } |
| 2326 | - else if($type == 'trash') |
|
| 2326 | + else if ($type == 'trash') |
|
| 2327 | 2327 | { |
| 2328 | 2328 | $args = new stdClass(); |
| 2329 | 2329 | $args->description = $message_content; |
| 2330 | 2330 | |
| 2331 | 2331 | $oDB = &DB::getInstance(); |
| 2332 | 2332 | $oDB->begin(); |
| 2333 | - for($i=0;$i<$document_srl_count;$i++) { |
|
| 2333 | + for ($i = 0; $i < $document_srl_count; $i++) { |
|
| 2334 | 2334 | $args->document_srl = $document_srl_list[$i]; |
| 2335 | 2335 | $output = $this->moveDocumentToTrash($args); |
| 2336 | - if(!$output || !$output->toBool()) return new BaseObject(-1, 'fail_to_trash'); |
|
| 2336 | + if (!$output || !$output->toBool()) return new BaseObject(-1, 'fail_to_trash'); |
|
| 2337 | 2337 | } |
| 2338 | 2338 | $oDB->commit(); |
| 2339 | 2339 | $msg_code = 'success_trashed'; |
| 2340 | 2340 | } |
| 2341 | - else if($type == 'cancelDeclare') |
|
| 2341 | + else if ($type == 'cancelDeclare') |
|
| 2342 | 2342 | { |
| 2343 | 2343 | $args->document_srl = $document_srl_list; |
| 2344 | 2344 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
@@ -2360,27 +2360,27 @@ discard block |
||
| 2360 | 2360 | function procDocumentInsertModuleConfig() |
| 2361 | 2361 | { |
| 2362 | 2362 | $module_srl = Context::get('target_module_srl'); |
| 2363 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
| 2363 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl); |
|
| 2364 | 2364 | else $module_srl = array($module_srl); |
| 2365 | 2365 | |
| 2366 | 2366 | $document_config = new stdClass(); |
| 2367 | 2367 | $document_config->use_history = Context::get('use_history'); |
| 2368 | - if(!$document_config->use_history) $document_config->use_history = 'N'; |
|
| 2368 | + if (!$document_config->use_history) $document_config->use_history = 'N'; |
|
| 2369 | 2369 | |
| 2370 | 2370 | $document_config->use_vote_up = Context::get('use_vote_up'); |
| 2371 | - if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y'; |
|
| 2371 | + if (!$document_config->use_vote_up) $document_config->use_vote_up = 'Y'; |
|
| 2372 | 2372 | |
| 2373 | 2373 | $document_config->use_vote_down = Context::get('use_vote_down'); |
| 2374 | - if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y'; |
|
| 2374 | + if (!$document_config->use_vote_down) $document_config->use_vote_down = 'Y'; |
|
| 2375 | 2375 | |
| 2376 | 2376 | $document_config->use_status = Context::get('use_status'); |
| 2377 | 2377 | |
| 2378 | 2378 | $oModuleController = getController('module'); |
| 2379 | - for($i=0;$i<count($module_srl);$i++) |
|
| 2379 | + for ($i = 0; $i < count($module_srl); $i++) |
|
| 2380 | 2380 | { |
| 2381 | 2381 | $srl = trim($module_srl[$i]); |
| 2382 | - if(!$srl) continue; |
|
| 2383 | - $output = $oModuleController->insertModulePartConfig('document',$srl,$document_config); |
|
| 2382 | + if (!$srl) continue; |
|
| 2383 | + $output = $oModuleController->insertModulePartConfig('document', $srl, $document_config); |
|
| 2384 | 2384 | } |
| 2385 | 2385 | $this->setError(-1); |
| 2386 | 2386 | $this->setMessage('success_updated', 'info'); |
@@ -2396,7 +2396,7 @@ discard block |
||
| 2396 | 2396 | function procDocumentTempSave() |
| 2397 | 2397 | { |
| 2398 | 2398 | // Check login information |
| 2399 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 2399 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 2400 | 2400 | $module_info = Context::get('module_info'); |
| 2401 | 2401 | $logged_info = Context::get('logged_info'); |
| 2402 | 2402 | |
@@ -2408,7 +2408,7 @@ discard block |
||
| 2408 | 2408 | unset($obj->is_notice); |
| 2409 | 2409 | |
| 2410 | 2410 | // Extract from beginning part of contents in the guestbook |
| 2411 | - if(!$obj->title) |
|
| 2411 | + if (!$obj->title) |
|
| 2412 | 2412 | { |
| 2413 | 2413 | $obj->title = cut_str(strip_tags($obj->content), 20, '...'); |
| 2414 | 2414 | } |
@@ -2419,13 +2419,13 @@ discard block |
||
| 2419 | 2419 | $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager); |
| 2420 | 2420 | |
| 2421 | 2421 | // Update if already exists |
| 2422 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
| 2422 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
| 2423 | 2423 | { |
| 2424 | - if($oDocument->get('module_srl') != $obj->module_srl) |
|
| 2424 | + if ($oDocument->get('module_srl') != $obj->module_srl) |
|
| 2425 | 2425 | { |
| 2426 | 2426 | return new BaseObject(-1, 'msg_invalid_request'); |
| 2427 | 2427 | } |
| 2428 | - if(!$oDocument->isGranted()) |
|
| 2428 | + if (!$oDocument->isGranted()) |
|
| 2429 | 2429 | { |
| 2430 | 2430 | return new BaseObject(-1, 'msg_invalid_request'); |
| 2431 | 2431 | } |
@@ -2443,7 +2443,7 @@ discard block |
||
| 2443 | 2443 | $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager); |
| 2444 | 2444 | } |
| 2445 | 2445 | // Set the attachment to be invalid state |
| 2446 | - if($oDocument->hasUploadedFiles()) |
|
| 2446 | + if ($oDocument->hasUploadedFiles()) |
|
| 2447 | 2447 | { |
| 2448 | 2448 | $args = new stdClass; |
| 2449 | 2449 | $args->upload_target_srl = $oDocument->document_srl; |
@@ -2461,11 +2461,11 @@ discard block |
||
| 2461 | 2461 | */ |
| 2462 | 2462 | function procDocumentGetList() |
| 2463 | 2463 | { |
| 2464 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2464 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2465 | 2465 | $documentSrls = Context::get('document_srls'); |
| 2466 | - if($documentSrls) $documentSrlList = explode(',', $documentSrls); |
|
| 2466 | + if ($documentSrls) $documentSrlList = explode(',', $documentSrls); |
|
| 2467 | 2467 | |
| 2468 | - if(count($documentSrlList) > 0) |
|
| 2468 | + if (count($documentSrlList) > 0) |
|
| 2469 | 2469 | { |
| 2470 | 2470 | $oDocumentModel = getModel('document'); |
| 2471 | 2471 | $columnList = array('document_srl', 'title', 'nick_name', 'status'); |
@@ -2489,10 +2489,10 @@ discard block |
||
| 2489 | 2489 | */ |
| 2490 | 2490 | function _checkCommentStatusForOldVersion(&$obj) |
| 2491 | 2491 | { |
| 2492 | - if(!isset($obj->allow_comment)) $obj->allow_comment = 'N'; |
|
| 2493 | - if(!isset($obj->lock_comment)) $obj->lock_comment = 'N'; |
|
| 2492 | + if (!isset($obj->allow_comment)) $obj->allow_comment = 'N'; |
|
| 2493 | + if (!isset($obj->lock_comment)) $obj->lock_comment = 'N'; |
|
| 2494 | 2494 | |
| 2495 | - if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW'; |
|
| 2495 | + if ($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW'; |
|
| 2496 | 2496 | else $obj->commentStatus = 'DENY'; |
| 2497 | 2497 | } |
| 2498 | 2498 | |
@@ -2503,8 +2503,8 @@ discard block |
||
| 2503 | 2503 | */ |
| 2504 | 2504 | function _checkDocumentStatusForOldVersion(&$obj) |
| 2505 | 2505 | { |
| 2506 | - if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret'); |
|
| 2507 | - if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public'); |
|
| 2506 | + if (!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret'); |
|
| 2507 | + if (!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public'); |
|
| 2508 | 2508 | } |
| 2509 | 2509 | |
| 2510 | 2510 | public function updateUploaedCount($documentSrlList) |
@@ -2512,10 +2512,10 @@ discard block |
||
| 2512 | 2512 | $oDocumentModel = getModel('document'); |
| 2513 | 2513 | $oFileModel = getModel('file'); |
| 2514 | 2514 | |
| 2515 | - if(is_array($documentSrlList)) |
|
| 2515 | + if (is_array($documentSrlList)) |
|
| 2516 | 2516 | { |
| 2517 | 2517 | $documentSrlList = array_unique($documentSrlList); |
| 2518 | - foreach($documentSrlList AS $key => $documentSrl) |
|
| 2518 | + foreach ($documentSrlList AS $key => $documentSrl) |
|
| 2519 | 2519 | { |
| 2520 | 2520 | $fileCount = $oFileModel->getFilesCount($documentSrl); |
| 2521 | 2521 | $args = new stdClass(); |
@@ -2536,14 +2536,14 @@ discard block |
||
| 2536 | 2536 | $oDocumentModel = getModel('document'); |
| 2537 | 2537 | $documentExtraKeys = $oDocumentModel->getExtraKeys($obj->originModuleSrl); |
| 2538 | 2538 | |
| 2539 | - if(is_array($documentExtraKeys) && is_array($obj->moduleSrlList)) |
|
| 2539 | + if (is_array($documentExtraKeys) && is_array($obj->moduleSrlList)) |
|
| 2540 | 2540 | { |
| 2541 | - $oDocumentController=getController('document'); |
|
| 2542 | - foreach($obj->moduleSrlList AS $key=>$value) |
|
| 2541 | + $oDocumentController = getController('document'); |
|
| 2542 | + foreach ($obj->moduleSrlList AS $key=>$value) |
|
| 2543 | 2543 | { |
| 2544 | - foreach($documentExtraKeys AS $extraItem) |
|
| 2544 | + foreach ($documentExtraKeys AS $extraItem) |
|
| 2545 | 2545 | { |
| 2546 | - $oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required , $extraItem->search , $extraItem->default , $extraItem->desc, $extraItem->eid) ; |
|
| 2546 | + $oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required, $extraItem->search, $extraItem->default, $extraItem->desc, $extraItem->eid); |
|
| 2547 | 2547 | } |
| 2548 | 2548 | } |
| 2549 | 2549 | } |
@@ -2555,9 +2555,9 @@ discard block |
||
| 2555 | 2555 | $documentConfig = $oModuleModel->getModulePartConfig('document', $obj->originModuleSrl); |
| 2556 | 2556 | |
| 2557 | 2557 | $oModuleController = getController('module'); |
| 2558 | - if(is_array($obj->moduleSrlList)) |
|
| 2558 | + if (is_array($obj->moduleSrlList)) |
|
| 2559 | 2559 | { |
| 2560 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 2560 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 2561 | 2561 | { |
| 2562 | 2562 | $oModuleController->insertModulePartConfig('document', $moduleSrl, $documentConfig); |
| 2563 | 2563 | } |
@@ -24,19 +24,27 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function procDocumentVoteUp() |
| 26 | 26 | { |
| 27 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 27 | + if(!Context::get('is_logged')) { |
|
| 28 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | 31 | $document_srl = Context::get('target_srl'); |
| 30 | - if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 32 | + if(!$document_srl) { |
|
| 33 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 34 | + } |
|
| 31 | 35 | |
| 32 | 36 | $oDocumentModel = getModel('document'); |
| 33 | 37 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 34 | 38 | $module_srl = $oDocument->get('module_srl'); |
| 35 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 39 | + if(!$module_srl) { |
|
| 40 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 41 | + } |
|
| 36 | 42 | |
| 37 | 43 | $oModuleModel = getModel('module'); |
| 38 | 44 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
| 39 | - if($document_config->use_vote_up=='N') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 45 | + if($document_config->use_vote_up=='N') { |
|
| 46 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 47 | + } |
|
| 40 | 48 | |
| 41 | 49 | $point = 1; |
| 42 | 50 | $output = $this->updateVotedCount($document_srl, $point); |
@@ -69,19 +77,27 @@ discard block |
||
| 69 | 77 | */ |
| 70 | 78 | function procDocumentVoteDown() |
| 71 | 79 | { |
| 72 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 80 | + if(!Context::get('is_logged')) { |
|
| 81 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 82 | + } |
|
| 73 | 83 | |
| 74 | 84 | $document_srl = Context::get('target_srl'); |
| 75 | - if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 85 | + if(!$document_srl) { |
|
| 86 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 87 | + } |
|
| 76 | 88 | |
| 77 | 89 | $oDocumentModel = getModel('document'); |
| 78 | 90 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false); |
| 79 | 91 | $module_srl = $oDocument->get('module_srl'); |
| 80 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 92 | + if(!$module_srl) { |
|
| 93 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 94 | + } |
|
| 81 | 95 | |
| 82 | 96 | $oModuleModel = getModel('module'); |
| 83 | 97 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
| 84 | - if($document_config->use_vote_down=='N') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 98 | + if($document_config->use_vote_down=='N') { |
|
| 99 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 100 | + } |
|
| 85 | 101 | |
| 86 | 102 | $point = -1; |
| 87 | 103 | $output = $this->updateVotedCount($document_srl, $point); |
@@ -95,10 +111,14 @@ discard block |
||
| 95 | 111 | */ |
| 96 | 112 | function procDocumentDeclare() |
| 97 | 113 | { |
| 98 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 114 | + if(!Context::get('is_logged')) { |
|
| 115 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 116 | + } |
|
| 99 | 117 | |
| 100 | 118 | $document_srl = Context::get('target_srl'); |
| 101 | - if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 119 | + if(!$document_srl) { |
|
| 120 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 121 | + } |
|
| 102 | 122 | |
| 103 | 123 | return $this->declaredDocument($document_srl); |
| 104 | 124 | } |
@@ -140,7 +160,9 @@ discard block |
||
| 140 | 160 | $args->history_srl = $history_srl; |
| 141 | 161 | $args->module_srl = $module_srl; |
| 142 | 162 | $args->document_srl = $document_srl; |
| 143 | - if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return; |
|
| 163 | + if(!$args->history_srl && !$args->module_srl && !$args->document_srl) { |
|
| 164 | + return; |
|
| 165 | + } |
|
| 144 | 166 | executeQuery("document.deleteHistory", $args); |
| 145 | 167 | } |
| 146 | 168 | |
@@ -152,15 +174,21 @@ discard block |
||
| 152 | 174 | function triggerDeleteModuleDocuments(&$obj) |
| 153 | 175 | { |
| 154 | 176 | $module_srl = $obj->module_srl; |
| 155 | - if(!$module_srl) return new BaseObject(); |
|
| 177 | + if(!$module_srl) { |
|
| 178 | + return new BaseObject(); |
|
| 179 | + } |
|
| 156 | 180 | // Delete the document |
| 157 | 181 | $oDocumentAdminController = getAdminController('document'); |
| 158 | 182 | $output = $oDocumentAdminController->deleteModuleDocument($module_srl); |
| 159 | - if(!$output->toBool()) return $output; |
|
| 183 | + if(!$output->toBool()) { |
|
| 184 | + return $output; |
|
| 185 | + } |
|
| 160 | 186 | // Delete the category |
| 161 | 187 | $oDocumentController = getController('document'); |
| 162 | 188 | $output = $oDocumentController->deleteModuleCategory($module_srl); |
| 163 | - if(!$output->toBool()) return $output; |
|
| 189 | + if(!$output->toBool()) { |
|
| 190 | + return $output; |
|
| 191 | + } |
|
| 164 | 192 | // Delete extra key and variable, because module deleted |
| 165 | 193 | $this->deleteDocumentExtraKeys($module_srl); |
| 166 | 194 | |
@@ -202,10 +230,18 @@ discard block |
||
| 202 | 230 | $oDB = &DB::getInstance(); |
| 203 | 231 | $oDB->begin(); |
| 204 | 232 | // List variables |
| 205 | - if($obj->comment_status) $obj->commentStatus = $obj->comment_status; |
|
| 206 | - if(!$obj->commentStatus) $obj->commentStatus = 'DENY'; |
|
| 207 | - if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj); |
|
| 208 | - if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; |
|
| 233 | + if($obj->comment_status) { |
|
| 234 | + $obj->commentStatus = $obj->comment_status; |
|
| 235 | + } |
|
| 236 | + if(!$obj->commentStatus) { |
|
| 237 | + $obj->commentStatus = 'DENY'; |
|
| 238 | + } |
|
| 239 | + if($obj->commentStatus == 'DENY') { |
|
| 240 | + $this->_checkCommentStatusForOldVersion($obj); |
|
| 241 | + } |
|
| 242 | + if($obj->allow_trackback!='Y') { |
|
| 243 | + $obj->allow_trackback = 'N'; |
|
| 244 | + } |
|
| 209 | 245 | if($obj->homepage) |
| 210 | 246 | { |
| 211 | 247 | $obj->homepage = removeHackTag($obj->homepage); |
@@ -215,9 +251,15 @@ discard block |
||
| 215 | 251 | } |
| 216 | 252 | } |
| 217 | 253 | |
| 218 | - if($obj->notify_message != 'Y') $obj->notify_message = 'N'; |
|
| 219 | - if(!$obj->email_address) $obj->email_address = ''; |
|
| 220 | - if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 254 | + if($obj->notify_message != 'Y') { |
|
| 255 | + $obj->notify_message = 'N'; |
|
| 256 | + } |
|
| 257 | + if(!$obj->email_address) { |
|
| 258 | + $obj->email_address = ''; |
|
| 259 | + } |
|
| 260 | + if(!$isRestore) { |
|
| 261 | + $obj->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 262 | + } |
|
| 221 | 263 | |
| 222 | 264 | // can modify regdate only manager |
| 223 | 265 | $grant = Context::get('grant'); |
@@ -227,7 +269,9 @@ discard block |
||
| 227 | 269 | } |
| 228 | 270 | |
| 229 | 271 | // Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid |
| 230 | - if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); |
|
| 272 | + if(!is_string($obj->extra_vars)) { |
|
| 273 | + $obj->extra_vars = serialize($obj->extra_vars); |
|
| 274 | + } |
|
| 231 | 275 | // Remove the columns for automatic saving |
| 232 | 276 | unset($obj->_saved_doc_srl); |
| 233 | 277 | unset($obj->_saved_doc_title); |
@@ -235,10 +279,15 @@ discard block |
||
| 235 | 279 | unset($obj->_saved_doc_message); |
| 236 | 280 | // Call a trigger (before) |
| 237 | 281 | $output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj); |
| 238 | - if(!$output->toBool()) return $output; |
|
| 282 | + if(!$output->toBool()) { |
|
| 283 | + return $output; |
|
| 284 | + } |
|
| 239 | 285 | // Register it if no given document_srl exists |
| 240 | - if(!$obj->document_srl) $obj->document_srl = getNextSequence(); |
|
| 241 | - elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 286 | + if(!$obj->document_srl) { |
|
| 287 | + $obj->document_srl = getNextSequence(); |
|
| 288 | + } elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) { |
|
| 289 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 290 | + } |
|
| 242 | 291 | |
| 243 | 292 | $oDocumentModel = getModel('document'); |
| 244 | 293 | // Set to 0 if the category_srl doesn't exist |
@@ -249,12 +298,19 @@ discard block |
||
| 249 | 298 | { |
| 250 | 299 | return new BaseObject(-1, 'msg_not_permitted'); |
| 251 | 300 | } |
| 252 | - if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0; |
|
| 301 | + if(count($category_list) > 0 && !$category_list[$obj->category_srl]) { |
|
| 302 | + $obj->category_srl = 0; |
|
| 303 | + } |
|
| 253 | 304 | } |
| 254 | 305 | // Set the read counts and update order. |
| 255 | - if(!$obj->readed_count) $obj->readed_count = 0; |
|
| 256 | - if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1; |
|
| 257 | - else $obj->update_order = $obj->list_order; |
|
| 306 | + if(!$obj->readed_count) { |
|
| 307 | + $obj->readed_count = 0; |
|
| 308 | + } |
|
| 309 | + if($isLatest) { |
|
| 310 | + $obj->update_order = $obj->list_order = $obj->document_srl * -1; |
|
| 311 | + } else { |
|
| 312 | + $obj->update_order = $obj->list_order; |
|
| 313 | + } |
|
| 258 | 314 | // Check the status of password hash for manually inserting. Apply hashing for otherwise. |
| 259 | 315 | if($obj->password && !$obj->password_is_hashed) |
| 260 | 316 | { |
@@ -276,9 +332,13 @@ discard block |
||
| 276 | 332 | // If the tile is empty, extract string from the contents. |
| 277 | 333 | $obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 278 | 334 | settype($obj->title, "string"); |
| 279 | - if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); |
|
| 335 | + if($obj->title == '') { |
|
| 336 | + $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); |
|
| 337 | + } |
|
| 280 | 338 | // If no tile extracted from the contents, leave it untitled. |
| 281 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
| 339 | + if($obj->title == '') { |
|
| 340 | + $obj->title = 'Untitled'; |
|
| 341 | + } |
|
| 282 | 342 | // Remove XE's own tags from the contents. |
| 283 | 343 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 284 | 344 | if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
@@ -290,13 +350,19 @@ discard block |
||
| 290 | 350 | $obj->content = nl2br($obj->content); |
| 291 | 351 | } |
| 292 | 352 | // Remove iframe and script if not a top adminisrator in the session. |
| 293 | - if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); |
|
| 353 | + if($logged_info->is_admin != 'Y') { |
|
| 354 | + $obj->content = removeHackTag($obj->content); |
|
| 355 | + } |
|
| 294 | 356 | // An error appears if both log-in info and user name don't exist. |
| 295 | - if(!$logged_info->member_srl && !$obj->nick_name) return new BaseObject(-1,'msg_invalid_request'); |
|
| 357 | + if(!$logged_info->member_srl && !$obj->nick_name) { |
|
| 358 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 359 | + } |
|
| 296 | 360 | |
| 297 | 361 | $obj->lang_code = Context::getLangType(); |
| 298 | 362 | // Insert data into the DB |
| 299 | - if(!$obj->status) $this->_checkDocumentStatusForOldVersion($obj); |
|
| 363 | + if(!$obj->status) { |
|
| 364 | + $this->_checkDocumentStatusForOldVersion($obj); |
|
| 365 | + } |
|
| 300 | 366 | $output = executeQuery('document.insertDocument', $obj); |
| 301 | 367 | if(!$output->toBool()) |
| 302 | 368 | { |
@@ -313,19 +379,25 @@ discard block |
||
| 313 | 379 | if(isset($obj->{'extra_vars'.$idx})) |
| 314 | 380 | { |
| 315 | 381 | $tmp = $obj->{'extra_vars'.$idx}; |
| 316 | - if(is_array($tmp)) |
|
| 317 | - $value = implode('|@|', $tmp); |
|
| 318 | - else |
|
| 319 | - $value = trim($tmp); |
|
| 382 | + if(is_array($tmp)) { |
|
| 383 | + $value = implode('|@|', $tmp); |
|
| 384 | + } else { |
|
| 385 | + $value = trim($tmp); |
|
| 386 | + } |
|
| 387 | + } else if(isset($obj->{$extra_item->name})) { |
|
| 388 | + $value = trim($obj->{$extra_item->name}); |
|
| 389 | + } |
|
| 390 | + if($value == NULL) { |
|
| 391 | + continue; |
|
| 320 | 392 | } |
| 321 | - else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); |
|
| 322 | - if($value == NULL) continue; |
|
| 323 | 393 | |
| 324 | 394 | $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); |
| 325 | 395 | } |
| 326 | 396 | } |
| 327 | 397 | // Update the category if the category_srl exists. |
| 328 | - if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 398 | + if($obj->category_srl) { |
|
| 399 | + $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 400 | + } |
|
| 329 | 401 | // Call a trigger (after) |
| 330 | 402 | if($output->toBool()) |
| 331 | 403 | { |
@@ -367,27 +439,39 @@ discard block |
||
| 367 | 439 | return new BaseObject(-1, 'msg_invalid_request'); |
| 368 | 440 | } |
| 369 | 441 | |
| 370 | - if(!$source_obj->document_srl || !$obj->document_srl) return new BaseObject(-1,'msg_invalied_request'); |
|
| 371 | - if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET'; |
|
| 372 | - if(!$obj->status) $obj->status = 'PUBLIC'; |
|
| 442 | + if(!$source_obj->document_srl || !$obj->document_srl) { |
|
| 443 | + return new BaseObject(-1,'msg_invalied_request'); |
|
| 444 | + } |
|
| 445 | + if(!$obj->status && $obj->is_secret == 'Y') { |
|
| 446 | + $obj->status = 'SECRET'; |
|
| 447 | + } |
|
| 448 | + if(!$obj->status) { |
|
| 449 | + $obj->status = 'PUBLIC'; |
|
| 450 | + } |
|
| 373 | 451 | |
| 374 | 452 | // Call a trigger (before) |
| 375 | 453 | $output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj); |
| 376 | - if(!$output->toBool()) return $output; |
|
| 454 | + if(!$output->toBool()) { |
|
| 455 | + return $output; |
|
| 456 | + } |
|
| 377 | 457 | |
| 378 | 458 | // begin transaction |
| 379 | 459 | $oDB = &DB::getInstance(); |
| 380 | 460 | $oDB->begin(); |
| 381 | 461 | |
| 382 | 462 | $oModuleModel = getModel('module'); |
| 383 | - if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl'); |
|
| 463 | + if(!$obj->module_srl) { |
|
| 464 | + $obj->module_srl = $source_obj->get('module_srl'); |
|
| 465 | + } |
|
| 384 | 466 | $module_srl = $obj->module_srl; |
| 385 | 467 | $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
| 386 | 468 | if(!$document_config) |
| 387 | 469 | { |
| 388 | 470 | $document_config = new stdClass(); |
| 389 | 471 | } |
| 390 | - if(!isset($document_config->use_history)) $document_config->use_history = 'N'; |
|
| 472 | + if(!isset($document_config->use_history)) { |
|
| 473 | + $document_config->use_history = 'N'; |
|
| 474 | + } |
|
| 391 | 475 | $bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace'; |
| 392 | 476 | |
| 393 | 477 | if($bUseHistory) |
@@ -396,22 +480,31 @@ discard block |
||
| 396 | 480 | $args->history_srl = getNextSequence(); |
| 397 | 481 | $args->document_srl = $obj->document_srl; |
| 398 | 482 | $args->module_srl = $module_srl; |
| 399 | - if($document_config->use_history == 'Y') $args->content = $source_obj->get('content'); |
|
| 483 | + if($document_config->use_history == 'Y') { |
|
| 484 | + $args->content = $source_obj->get('content'); |
|
| 485 | + } |
|
| 400 | 486 | $args->nick_name = $logged_info->nick_name; |
| 401 | 487 | $args->member_srl = $logged_info->member_srl; |
| 402 | 488 | $args->regdate = $source_obj->get('last_update'); |
| 403 | 489 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 404 | 490 | $output = executeQuery("document.insertHistory", $args); |
| 405 | - } |
|
| 406 | - else |
|
| 491 | + } else |
|
| 407 | 492 | { |
| 408 | 493 | $obj->ipaddress = $source_obj->get('ipaddress'); |
| 409 | 494 | } |
| 410 | 495 | // List variables |
| 411 | - if($obj->comment_status) $obj->commentStatus = $obj->comment_status; |
|
| 412 | - if(!$obj->commentStatus) $obj->commentStatus = 'DENY'; |
|
| 413 | - if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj); |
|
| 414 | - if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; |
|
| 496 | + if($obj->comment_status) { |
|
| 497 | + $obj->commentStatus = $obj->comment_status; |
|
| 498 | + } |
|
| 499 | + if(!$obj->commentStatus) { |
|
| 500 | + $obj->commentStatus = 'DENY'; |
|
| 501 | + } |
|
| 502 | + if($obj->commentStatus == 'DENY') { |
|
| 503 | + $this->_checkCommentStatusForOldVersion($obj); |
|
| 504 | + } |
|
| 505 | + if($obj->allow_trackback!='Y') { |
|
| 506 | + $obj->allow_trackback = 'N'; |
|
| 507 | + } |
|
| 415 | 508 | if($obj->homepage) |
| 416 | 509 | { |
| 417 | 510 | $obj->homepage = removeHackTag($obj->homepage); |
@@ -421,7 +514,9 @@ discard block |
||
| 421 | 514 | } |
| 422 | 515 | } |
| 423 | 516 | |
| 424 | - if($obj->notify_message != 'Y') $obj->notify_message = 'N'; |
|
| 517 | + if($obj->notify_message != 'Y') { |
|
| 518 | + $obj->notify_message = 'N'; |
|
| 519 | + } |
|
| 425 | 520 | |
| 426 | 521 | // can modify regdate only manager |
| 427 | 522 | $grant = Context::get('grant'); |
@@ -431,7 +526,9 @@ discard block |
||
| 431 | 526 | } |
| 432 | 527 | |
| 433 | 528 | // Serialize the $extra_vars |
| 434 | - if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); |
|
| 529 | + if(!is_string($obj->extra_vars)) { |
|
| 530 | + $obj->extra_vars = serialize($obj->extra_vars); |
|
| 531 | + } |
|
| 435 | 532 | // Remove the columns for automatic saving |
| 436 | 533 | unset($obj->_saved_doc_srl); |
| 437 | 534 | unset($obj->_saved_doc_title); |
@@ -443,7 +540,9 @@ discard block |
||
| 443 | 540 | if($source_obj->get('category_srl')!=$obj->category_srl) |
| 444 | 541 | { |
| 445 | 542 | $category_list = $oDocumentModel->getCategoryList($obj->module_srl); |
| 446 | - if(!$category_list[$obj->category_srl]) $obj->category_srl = 0; |
|
| 543 | + if(!$category_list[$obj->category_srl]) { |
|
| 544 | + $obj->category_srl = 0; |
|
| 545 | + } |
|
| 447 | 546 | } |
| 448 | 547 | // Change the update order |
| 449 | 548 | $obj->update_order = getNextSequence() * -1; |
@@ -478,9 +577,13 @@ discard block |
||
| 478 | 577 | // If the tile is empty, extract string from the contents. |
| 479 | 578 | $obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 480 | 579 | settype($obj->title, "string"); |
| 481 | - if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
|
| 580 | + if($obj->title == '') { |
|
| 581 | + $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
|
| 582 | + } |
|
| 482 | 583 | // If no tile extracted from the contents, leave it untitled. |
| 483 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
| 584 | + if($obj->title == '') { |
|
| 585 | + $obj->title = 'Untitled'; |
|
| 586 | + } |
|
| 484 | 587 | // Remove XE's own tags from the contents. |
| 485 | 588 | $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); |
| 486 | 589 | if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y') |
@@ -500,8 +603,7 @@ discard block |
||
| 500 | 603 | $lang_code_args->document_srl = $source_obj->get('document_srl'); |
| 501 | 604 | $lang_code_args->lang_code = Context::getLangType(); |
| 502 | 605 | $output = executeQuery('document.updateDocumentsLangCode', $lang_code_args); |
| 503 | - } |
|
| 504 | - else |
|
| 606 | + } else |
|
| 505 | 607 | { |
| 506 | 608 | $extra_content = new stdClass; |
| 507 | 609 | $extra_content->title = $obj->title; |
@@ -520,7 +622,9 @@ discard block |
||
| 520 | 622 | $obj->content = removeHackTag($obj->content); |
| 521 | 623 | } |
| 522 | 624 | // if temporary document, regdate is now setting |
| 523 | - if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis'); |
|
| 625 | + if($source_obj->get('status') == $this->getConfigStatus('temp')) { |
|
| 626 | + $obj->regdate = date('YmdHis'); |
|
| 627 | + } |
|
| 524 | 628 | |
| 525 | 629 | // Insert data into the DB |
| 526 | 630 | $output = executeQuery('document.updateDocument', $obj); |
@@ -543,25 +647,37 @@ discard block |
||
| 543 | 647 | if(isset($obj->{'extra_vars'.$idx})) |
| 544 | 648 | { |
| 545 | 649 | $tmp = $obj->{'extra_vars'.$idx}; |
| 546 | - if(is_array($tmp)) |
|
| 547 | - $value = implode('|@|', $tmp); |
|
| 548 | - else |
|
| 549 | - $value = trim($tmp); |
|
| 650 | + if(is_array($tmp)) { |
|
| 651 | + $value = implode('|@|', $tmp); |
|
| 652 | + } else { |
|
| 653 | + $value = trim($tmp); |
|
| 654 | + } |
|
| 655 | + } else if(isset($obj->{$extra_item->name})) { |
|
| 656 | + $value = trim($obj->{$extra_item->name}); |
|
| 657 | + } |
|
| 658 | + if($value == NULL) { |
|
| 659 | + continue; |
|
| 550 | 660 | } |
| 551 | - else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); |
|
| 552 | - if($value == NULL) continue; |
|
| 553 | 661 | $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); |
| 554 | 662 | } |
| 555 | 663 | } |
| 556 | 664 | // Inert extra vars for multi-language support of title and contents. |
| 557 | - if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); |
|
| 558 | - if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); |
|
| 665 | + if($extra_content->title) { |
|
| 666 | + $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); |
|
| 667 | + } |
|
| 668 | + if($extra_content->content) { |
|
| 669 | + $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); |
|
| 670 | + } |
|
| 559 | 671 | } |
| 560 | 672 | // Update the category if the category_srl exists. |
| 561 | 673 | if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl) |
| 562 | 674 | { |
| 563 | - if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl')); |
|
| 564 | - if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 675 | + if($source_obj->get('category_srl') != $obj->category_srl) { |
|
| 676 | + $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl')); |
|
| 677 | + } |
|
| 678 | + if($obj->category_srl) { |
|
| 679 | + $this->updateCategoryCount($obj->module_srl, $obj->category_srl); |
|
| 680 | + } |
|
| 565 | 681 | } |
| 566 | 682 | // Call a trigger (after) |
| 567 | 683 | if($output->toBool()) |
@@ -606,7 +722,9 @@ discard block |
||
| 606 | 722 | $trigger_obj = new stdClass(); |
| 607 | 723 | $trigger_obj->document_srl = $document_srl; |
| 608 | 724 | $output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj); |
| 609 | - if(!$output->toBool()) return $output; |
|
| 725 | + if(!$output->toBool()) { |
|
| 726 | + return $output; |
|
| 727 | + } |
|
| 610 | 728 | |
| 611 | 729 | // begin transaction |
| 612 | 730 | $oDB = &DB::getInstance(); |
@@ -618,12 +736,17 @@ discard block |
||
| 618 | 736 | $oDocumentModel = getModel('document'); |
| 619 | 737 | // Check if the documnet exists |
| 620 | 738 | $oDocument = $oDocumentModel->getDocument($document_srl, $is_admin); |
| 739 | + } else if($isEmptyTrash && $oDocument == null) { |
|
| 740 | + return new BaseObject(-1, 'document is not exists'); |
|
| 621 | 741 | } |
| 622 | - else if($isEmptyTrash && $oDocument == null) return new BaseObject(-1, 'document is not exists'); |
|
| 623 | 742 | |
| 624 | - if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new BaseObject(-1, 'msg_invalid_document'); |
|
| 743 | + if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) { |
|
| 744 | + return new BaseObject(-1, 'msg_invalid_document'); |
|
| 745 | + } |
|
| 625 | 746 | // Check if a permossion is granted |
| 626 | - if(!$oDocument->isGranted()) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 747 | + if(!$oDocument->isGranted()) { |
|
| 748 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 749 | + } |
|
| 627 | 750 | |
| 628 | 751 | //if empty trash, document already deleted, therefore document not delete |
| 629 | 752 | $args = new stdClass(); |
@@ -643,7 +766,9 @@ discard block |
||
| 643 | 766 | |
| 644 | 767 | $this->deleteDocumentHistory(null, $document_srl, null); |
| 645 | 768 | // Update category information if the category_srl exists. |
| 646 | - if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); |
|
| 769 | + if($oDocument->get('category_srl')) { |
|
| 770 | + $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); |
|
| 771 | + } |
|
| 647 | 772 | // Delete a declared list |
| 648 | 773 | executeQuery('document.deleteDeclared', $args); |
| 649 | 774 | // Delete extra variable |
@@ -723,8 +848,11 @@ discard block |
||
| 723 | 848 | { |
| 724 | 849 | $trash_args = new stdClass(); |
| 725 | 850 | // Get trash_srl if a given trash_srl doesn't exist |
| 726 | - if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence(); |
|
| 727 | - else $trash_args->trash_srl = $obj->trash_srl; |
|
| 851 | + if(!$obj->trash_srl) { |
|
| 852 | + $trash_args->trash_srl = getNextSequence(); |
|
| 853 | + } else { |
|
| 854 | + $trash_args->trash_srl = $obj->trash_srl; |
|
| 855 | + } |
|
| 728 | 856 | // Get its module_srl which the document belongs to |
| 729 | 857 | $oDocumentModel = getModel('document'); |
| 730 | 858 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
@@ -732,7 +860,9 @@ discard block |
||
| 732 | 860 | $trash_args->module_srl = $oDocument->get('module_srl'); |
| 733 | 861 | $obj->module_srl = $oDocument->get('module_srl'); |
| 734 | 862 | // Cannot throw data from the trash to the trash |
| 735 | - if($trash_args->module_srl == 0) return false; |
|
| 863 | + if($trash_args->module_srl == 0) { |
|
| 864 | + return false; |
|
| 865 | + } |
|
| 736 | 866 | // Data setting |
| 737 | 867 | $trash_args->document_srl = $obj->document_srl; |
| 738 | 868 | $trash_args->description = $obj->description; |
@@ -793,7 +923,9 @@ discard block |
||
| 793 | 923 | }*/ |
| 794 | 924 | |
| 795 | 925 | // update category |
| 796 | - if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); |
|
| 926 | + if($oDocument->get('category_srl')) { |
|
| 927 | + $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); |
|
| 928 | + } |
|
| 797 | 929 | |
| 798 | 930 | // remove thumbnails |
| 799 | 931 | FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); |
@@ -838,7 +970,9 @@ discard block |
||
| 838 | 970 | function updateReadedCount(&$oDocument) |
| 839 | 971 | { |
| 840 | 972 | // Pass if Crawler access |
| 841 | - if(isCrawler()) return false; |
|
| 973 | + if(isCrawler()) { |
|
| 974 | + return false; |
|
| 975 | + } |
|
| 842 | 976 | |
| 843 | 977 | $document_srl = $oDocument->document_srl; |
| 844 | 978 | $member_srl = $oDocument->get('member_srl'); |
@@ -846,10 +980,14 @@ discard block |
||
| 846 | 980 | |
| 847 | 981 | // Call a trigger when the read count is updated (before) |
| 848 | 982 | $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument); |
| 849 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 983 | + if(!$trigger_output->toBool()) { |
|
| 984 | + return $trigger_output; |
|
| 985 | + } |
|
| 850 | 986 | |
| 851 | 987 | // Pass if read count is increaded on the session information |
| 852 | - if($_SESSION['readed_document'][$document_srl]) return false; |
|
| 988 | + if($_SESSION['readed_document'][$document_srl]) { |
|
| 989 | + return false; |
|
| 990 | + } |
|
| 853 | 991 | |
| 854 | 992 | // Pass if the author's IP address is as same as visitor's. |
| 855 | 993 | if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) |
@@ -914,7 +1052,9 @@ discard block |
||
| 914 | 1052 | */ |
| 915 | 1053 | function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid) |
| 916 | 1054 | { |
| 917 | - if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1055 | + if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) { |
|
| 1056 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1057 | + } |
|
| 918 | 1058 | |
| 919 | 1059 | $obj = new stdClass(); |
| 920 | 1060 | $obj->module_srl = $module_srl; |
@@ -931,8 +1071,7 @@ discard block |
||
| 931 | 1071 | if(!$output->data) |
| 932 | 1072 | { |
| 933 | 1073 | $output = executeQuery('document.insertDocumentExtraKey', $obj); |
| 934 | - } |
|
| 935 | - else |
|
| 1074 | + } else |
|
| 936 | 1075 | { |
| 937 | 1076 | $output = executeQuery('document.updateDocumentExtraKey', $obj); |
| 938 | 1077 | // Update the extra var(eid) |
@@ -958,10 +1097,14 @@ discard block |
||
| 958 | 1097 | */ |
| 959 | 1098 | function deleteDocumentExtraKeys($module_srl, $var_idx = null) |
| 960 | 1099 | { |
| 961 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1100 | + if(!$module_srl) { |
|
| 1101 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1102 | + } |
|
| 962 | 1103 | $obj = new stdClass(); |
| 963 | 1104 | $obj->module_srl = $module_srl; |
| 964 | - if(!is_null($var_idx)) $obj->var_idx = $var_idx; |
|
| 1105 | + if(!is_null($var_idx)) { |
|
| 1106 | + $obj->var_idx = $var_idx; |
|
| 1107 | + } |
|
| 965 | 1108 | |
| 966 | 1109 | $oDB = DB::getInstance(); |
| 967 | 1110 | $oDB->begin(); |
@@ -1025,8 +1168,12 @@ discard block |
||
| 1025 | 1168 | */ |
| 1026 | 1169 | function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '') |
| 1027 | 1170 | { |
| 1028 | - if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1029 | - if(!$lang_code) $lang_code = Context::getLangType(); |
|
| 1171 | + if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) { |
|
| 1172 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1173 | + } |
|
| 1174 | + if(!$lang_code) { |
|
| 1175 | + $lang_code = Context::getLangType(); |
|
| 1176 | + } |
|
| 1030 | 1177 | |
| 1031 | 1178 | $obj = new stdClass; |
| 1032 | 1179 | $obj->module_srl = $module_srl; |
@@ -1052,10 +1199,18 @@ discard block |
||
| 1052 | 1199 | { |
| 1053 | 1200 | $obj = new stdClass(); |
| 1054 | 1201 | $obj->module_srl = $module_srl; |
| 1055 | - if(!is_null($document_srl)) $obj->document_srl = $document_srl; |
|
| 1056 | - if(!is_null($var_idx)) $obj->var_idx = $var_idx; |
|
| 1057 | - if(!is_null($lang_code)) $obj->lang_code = $lang_code; |
|
| 1058 | - if(!is_null($eid)) $obj->eid = $eid; |
|
| 1202 | + if(!is_null($document_srl)) { |
|
| 1203 | + $obj->document_srl = $document_srl; |
|
| 1204 | + } |
|
| 1205 | + if(!is_null($var_idx)) { |
|
| 1206 | + $obj->var_idx = $var_idx; |
|
| 1207 | + } |
|
| 1208 | + if(!is_null($lang_code)) { |
|
| 1209 | + $obj->lang_code = $lang_code; |
|
| 1210 | + } |
|
| 1211 | + if(!is_null($eid)) { |
|
| 1212 | + $obj->eid = $eid; |
|
| 1213 | + } |
|
| 1059 | 1214 | $output = executeQuery('document.deleteDocumentExtraVars', $obj); |
| 1060 | 1215 | return $output; |
| 1061 | 1216 | } |
@@ -1069,8 +1224,11 @@ discard block |
||
| 1069 | 1224 | */ |
| 1070 | 1225 | function updateVotedCount($document_srl, $point = 1) |
| 1071 | 1226 | { |
| 1072 | - if($point > 0) $failed_voted = 'failed_voted'; |
|
| 1073 | - else $failed_voted = 'failed_blamed'; |
|
| 1227 | + if($point > 0) { |
|
| 1228 | + $failed_voted = 'failed_voted'; |
|
| 1229 | + } else { |
|
| 1230 | + $failed_voted = 'failed_blamed'; |
|
| 1231 | + } |
|
| 1074 | 1232 | // Return fail if session already has information about votes |
| 1075 | 1233 | if($_SESSION['voted_document'][$document_srl]) |
| 1076 | 1234 | { |
@@ -1106,8 +1264,7 @@ discard block |
||
| 1106 | 1264 | if($member_srl) |
| 1107 | 1265 | { |
| 1108 | 1266 | $args->member_srl = $member_srl; |
| 1109 | - } |
|
| 1110 | - else |
|
| 1267 | + } else |
|
| 1111 | 1268 | { |
| 1112 | 1269 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1113 | 1270 | } |
@@ -1144,18 +1301,21 @@ discard block |
||
| 1144 | 1301 | { |
| 1145 | 1302 | $args->blamed_count = $trigger_obj->after_point; |
| 1146 | 1303 | $output = executeQuery('document.updateBlamedCount', $args); |
| 1147 | - } |
|
| 1148 | - else |
|
| 1304 | + } else |
|
| 1149 | 1305 | { |
| 1150 | 1306 | $args->voted_count = $trigger_obj->after_point; |
| 1151 | 1307 | $output = executeQuery('document.updateVotedCount', $args); |
| 1152 | 1308 | } |
| 1153 | - if(!$output->toBool()) return $output; |
|
| 1309 | + if(!$output->toBool()) { |
|
| 1310 | + return $output; |
|
| 1311 | + } |
|
| 1154 | 1312 | |
| 1155 | 1313 | // Leave logs |
| 1156 | 1314 | $args->point = $trigger_obj->point; |
| 1157 | 1315 | $output = executeQuery('document.insertDocumentVotedLog', $args); |
| 1158 | - if(!$output->toBool()) return $output; |
|
| 1316 | + if(!$output->toBool()) { |
|
| 1317 | + return $output; |
|
| 1318 | + } |
|
| 1159 | 1319 | |
| 1160 | 1320 | // Call a trigger (after) |
| 1161 | 1321 | $trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $trigger_obj); |
@@ -1184,8 +1344,7 @@ discard block |
||
| 1184 | 1344 | { |
| 1185 | 1345 | $output->setMessage('success_voted'); |
| 1186 | 1346 | $output->add('voted_count', $trigger_obj->after_point); |
| 1187 | - } |
|
| 1188 | - else |
|
| 1347 | + } else |
|
| 1189 | 1348 | { |
| 1190 | 1349 | $output->setMessage('success_blamed'); |
| 1191 | 1350 | $output->add('blamed_count', $trigger_obj->after_point); |
@@ -1202,13 +1361,17 @@ discard block |
||
| 1202 | 1361 | function declaredDocument($document_srl) |
| 1203 | 1362 | { |
| 1204 | 1363 | // Fail if session information already has a reported document |
| 1205 | - if($_SESSION['declared_document'][$document_srl]) return new BaseObject(-1, 'failed_declared'); |
|
| 1364 | + if($_SESSION['declared_document'][$document_srl]) { |
|
| 1365 | + return new BaseObject(-1, 'failed_declared'); |
|
| 1366 | + } |
|
| 1206 | 1367 | |
| 1207 | 1368 | // Check if previously reported |
| 1208 | 1369 | $args = new stdClass(); |
| 1209 | 1370 | $args->document_srl = $document_srl; |
| 1210 | 1371 | $output = executeQuery('document.getDeclaredDocument', $args); |
| 1211 | - if(!$output->toBool()) return $output; |
|
| 1372 | + if(!$output->toBool()) { |
|
| 1373 | + return $output; |
|
| 1374 | + } |
|
| 1212 | 1375 | |
| 1213 | 1376 | $declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0; |
| 1214 | 1377 | |
@@ -1252,8 +1415,7 @@ discard block |
||
| 1252 | 1415 | if($member_srl) |
| 1253 | 1416 | { |
| 1254 | 1417 | $args->member_srl = $member_srl; |
| 1255 | - } |
|
| 1256 | - else |
|
| 1418 | + } else |
|
| 1257 | 1419 | { |
| 1258 | 1420 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1259 | 1421 | } |
@@ -1273,9 +1435,14 @@ discard block |
||
| 1273 | 1435 | $oDB->begin(); |
| 1274 | 1436 | |
| 1275 | 1437 | // Add the declared document |
| 1276 | - if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args); |
|
| 1277 | - else $output = executeQuery('document.insertDeclaredDocument', $args); |
|
| 1278 | - if(!$output->toBool()) return $output; |
|
| 1438 | + if($declared_count > 0) { |
|
| 1439 | + $output = executeQuery('document.updateDeclaredDocument', $args); |
|
| 1440 | + } else { |
|
| 1441 | + $output = executeQuery('document.insertDeclaredDocument', $args); |
|
| 1442 | + } |
|
| 1443 | + if(!$output->toBool()) { |
|
| 1444 | + return $output; |
|
| 1445 | + } |
|
| 1279 | 1446 | // Leave logs |
| 1280 | 1447 | $output = executeQuery('document.insertDocumentDeclaredLog', $args); |
| 1281 | 1448 | if(!$output->toBool()) |
@@ -1374,9 +1541,10 @@ discard block |
||
| 1374 | 1541 | $parent_category = $oDocumentModel->getCategory($obj->parent_srl); |
| 1375 | 1542 | $obj->list_order = $parent_category->list_order; |
| 1376 | 1543 | $this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1); |
| 1377 | - if(!$obj->category_srl) $obj->category_srl = getNextSequence(); |
|
| 1378 | - } |
|
| 1379 | - else |
|
| 1544 | + if(!$obj->category_srl) { |
|
| 1545 | + $obj->category_srl = getNextSequence(); |
|
| 1546 | + } |
|
| 1547 | + } else |
|
| 1380 | 1548 | { |
| 1381 | 1549 | $obj->list_order = $obj->category_srl = getNextSequence(); |
| 1382 | 1550 | } |
@@ -1416,13 +1584,17 @@ discard block |
||
| 1416 | 1584 | { |
| 1417 | 1585 | // Create a document model object |
| 1418 | 1586 | $oDocumentModel = getModel('document'); |
| 1419 | - if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl); |
|
| 1587 | + if(!$document_count) { |
|
| 1588 | + $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl); |
|
| 1589 | + } |
|
| 1420 | 1590 | |
| 1421 | 1591 | $args = new stdClass; |
| 1422 | 1592 | $args->category_srl = $category_srl; |
| 1423 | 1593 | $args->document_count = $document_count; |
| 1424 | 1594 | $output = executeQuery('document.updateCategoryCount', $args); |
| 1425 | - if($output->toBool()) $this->makeCategoryFile($module_srl); |
|
| 1595 | + if($output->toBool()) { |
|
| 1596 | + $this->makeCategoryFile($module_srl); |
|
| 1597 | + } |
|
| 1426 | 1598 | |
| 1427 | 1599 | return $output; |
| 1428 | 1600 | } |
@@ -1435,7 +1607,9 @@ discard block |
||
| 1435 | 1607 | function updateCategory($obj) |
| 1436 | 1608 | { |
| 1437 | 1609 | $output = executeQuery('document.updateCategory', $obj); |
| 1438 | - if($output->toBool()) $this->makeCategoryFile($obj->module_srl); |
|
| 1610 | + if($output->toBool()) { |
|
| 1611 | + $this->makeCategoryFile($obj->module_srl); |
|
| 1612 | + } |
|
| 1439 | 1613 | return $output; |
| 1440 | 1614 | } |
| 1441 | 1615 | |
@@ -1452,11 +1626,17 @@ discard block |
||
| 1452 | 1626 | $category_info = $oDocumentModel->getCategory($category_srl); |
| 1453 | 1627 | // Display an error that the category cannot be deleted if it has a child |
| 1454 | 1628 | $output = executeQuery('document.getChildCategoryCount', $args); |
| 1455 | - if(!$output->toBool()) return $output; |
|
| 1456 | - if($output->data->count>0) return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 1629 | + if(!$output->toBool()) { |
|
| 1630 | + return $output; |
|
| 1631 | + } |
|
| 1632 | + if($output->data->count>0) { |
|
| 1633 | + return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 1634 | + } |
|
| 1457 | 1635 | // Delete a category information |
| 1458 | 1636 | $output = executeQuery('document.deleteCategory', $args); |
| 1459 | - if(!$output->toBool()) return $output; |
|
| 1637 | + if(!$output->toBool()) { |
|
| 1638 | + return $output; |
|
| 1639 | + } |
|
| 1460 | 1640 | |
| 1461 | 1641 | $this->makeCategoryFile($category_info->module_srl); |
| 1462 | 1642 | // remvove cache |
@@ -1471,8 +1651,9 @@ discard block |
||
| 1471 | 1651 | $args->page = ++$page; |
| 1472 | 1652 | $output = executeQuery('document.getDocumentList', $args, array('document_srl')); |
| 1473 | 1653 | |
| 1474 | - if($output->data == array()) |
|
| 1475 | - break; |
|
| 1654 | + if($output->data == array()) { |
|
| 1655 | + break; |
|
| 1656 | + } |
|
| 1476 | 1657 | |
| 1477 | 1658 | foreach($output->data as $val) |
| 1478 | 1659 | { |
@@ -1524,18 +1705,26 @@ discard block |
||
| 1524 | 1705 | // Seek a full list of categories |
| 1525 | 1706 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 1526 | 1707 | $category_srl_list = array_keys($category_list); |
| 1527 | - if(count($category_srl_list)<2) return new BaseObject(); |
|
| 1708 | + if(count($category_srl_list)<2) { |
|
| 1709 | + return new BaseObject(); |
|
| 1710 | + } |
|
| 1528 | 1711 | |
| 1529 | 1712 | $prev_category = NULL; |
| 1530 | 1713 | foreach($category_list as $key => $val) |
| 1531 | 1714 | { |
| 1532 | - if($key==$category_srl) break; |
|
| 1715 | + if($key==$category_srl) { |
|
| 1716 | + break; |
|
| 1717 | + } |
|
| 1533 | 1718 | $prev_category = $val; |
| 1534 | 1719 | } |
| 1535 | 1720 | // Return if the previous category doesn't exist |
| 1536 | - if(!$prev_category) return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1721 | + if(!$prev_category) { |
|
| 1722 | + return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1723 | + } |
|
| 1537 | 1724 | // Return if the selected category is the top level |
| 1538 | - if($category_srl_list[0]==$category_srl) return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1725 | + if($category_srl_list[0]==$category_srl) { |
|
| 1726 | + return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1727 | + } |
|
| 1539 | 1728 | // Information of the selected category |
| 1540 | 1729 | $cur_args = new stdClass; |
| 1541 | 1730 | $cur_args->category_srl = $category_srl; |
@@ -1571,15 +1760,21 @@ discard block |
||
| 1571 | 1760 | // Seek a full list of categories |
| 1572 | 1761 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 1573 | 1762 | $category_srl_list = array_keys($category_list); |
| 1574 | - if(count($category_srl_list)<2) return new BaseObject(); |
|
| 1763 | + if(count($category_srl_list)<2) { |
|
| 1764 | + return new BaseObject(); |
|
| 1765 | + } |
|
| 1575 | 1766 | |
| 1576 | 1767 | for($i=0;$i<count($category_srl_list);$i++) |
| 1577 | 1768 | { |
| 1578 | - if($category_srl_list[$i]==$category_srl) break; |
|
| 1769 | + if($category_srl_list[$i]==$category_srl) { |
|
| 1770 | + break; |
|
| 1771 | + } |
|
| 1579 | 1772 | } |
| 1580 | 1773 | |
| 1581 | 1774 | $next_category_srl = $category_srl_list[$i+1]; |
| 1582 | - if(!$category_list[$next_category_srl]) return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1775 | + if(!$category_list[$next_category_srl]) { |
|
| 1776 | + return new BaseObject(-1,Context::getLang('msg_category_not_moved')); |
|
| 1777 | + } |
|
| 1583 | 1778 | $next_category = $category_list[$next_category_srl]; |
| 1584 | 1779 | // Information of the selected category |
| 1585 | 1780 | $cur_args = new stdClass; |
@@ -1606,7 +1801,9 @@ discard block |
||
| 1606 | 1801 | { |
| 1607 | 1802 | $oDocumentModel = getModel('document'); |
| 1608 | 1803 | $extra_keys = $oDocumentModel->getExtraKeys($module_srl); |
| 1609 | - if(!count($extra_keys)) return; |
|
| 1804 | + if(!count($extra_keys)) { |
|
| 1805 | + return; |
|
| 1806 | + } |
|
| 1610 | 1807 | |
| 1611 | 1808 | $js_code = array(); |
| 1612 | 1809 | $js_code[] = '<script>//<![CDATA['; |
@@ -1625,7 +1822,9 @@ discard block |
||
| 1625 | 1822 | } |
| 1626 | 1823 | $name = str_ireplace(array('<script', '</script'), array('<scr" + "ipt', '</scr" + "ipt'), $val->name); |
| 1627 | 1824 | $js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["extra_vars%s","%s"]);', $idx, $name); |
| 1628 | - if($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx); |
|
| 1825 | + if($val->is_required == 'Y') { |
|
| 1826 | + $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx); |
|
| 1827 | + } |
|
| 1629 | 1828 | } |
| 1630 | 1829 | |
| 1631 | 1830 | $js_code[] = '})(jQuery);'; |
@@ -1643,7 +1842,9 @@ discard block |
||
| 1643 | 1842 | function procDocumentInsertCategory($args = null) |
| 1644 | 1843 | { |
| 1645 | 1844 | // List variables |
| 1646 | - if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid'); |
|
| 1845 | + if(!$args) { |
|
| 1846 | + $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid'); |
|
| 1847 | + } |
|
| 1647 | 1848 | $args->title = $args->category_title; |
| 1648 | 1849 | $args->description = $args->category_description; |
| 1649 | 1850 | $args->color = $args->category_color; |
@@ -1659,11 +1860,18 @@ discard block |
||
| 1659 | 1860 | $columnList = array('module_srl', 'module'); |
| 1660 | 1861 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); |
| 1661 | 1862 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1662 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1863 | + if(!$grant->manager) { |
|
| 1864 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 1865 | + } |
|
| 1663 | 1866 | |
| 1664 | - if($args->expand !="Y") $args->expand = "N"; |
|
| 1665 | - if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls); |
|
| 1666 | - else $args->group_srls = implode(',', $args->group_srls); |
|
| 1867 | + if($args->expand !="Y") { |
|
| 1868 | + $args->expand = "N"; |
|
| 1869 | + } |
|
| 1870 | + if(!is_array($args->group_srls)) { |
|
| 1871 | + $args->group_srls = str_replace('|@|',',',$args->group_srls); |
|
| 1872 | + } else { |
|
| 1873 | + $args->group_srls = implode(',', $args->group_srls); |
|
| 1874 | + } |
|
| 1667 | 1875 | $args->parent_srl = (int)$args->parent_srl; |
| 1668 | 1876 | |
| 1669 | 1877 | $oDocumentModel = getModel('document'); |
@@ -1674,7 +1882,9 @@ discard block |
||
| 1674 | 1882 | if($args->category_srl) |
| 1675 | 1883 | { |
| 1676 | 1884 | $category_info = $oDocumentModel->getCategory($args->category_srl); |
| 1677 | - if($category_info->category_srl != $args->category_srl) $args->category_srl = null; |
|
| 1885 | + if($category_info->category_srl != $args->category_srl) { |
|
| 1886 | + $args->category_srl = null; |
|
| 1887 | + } |
|
| 1678 | 1888 | } |
| 1679 | 1889 | // Update if exists |
| 1680 | 1890 | if($args->category_srl) |
@@ -1686,8 +1896,7 @@ discard block |
||
| 1686 | 1896 | return $output; |
| 1687 | 1897 | } |
| 1688 | 1898 | // Insert if not exist |
| 1689 | - } |
|
| 1690 | - else |
|
| 1899 | + } else |
|
| 1691 | 1900 | { |
| 1692 | 1901 | $output = $this->insertCategory($args); |
| 1693 | 1902 | if(!$output->toBool()) |
@@ -1729,7 +1938,9 @@ discard block |
||
| 1729 | 1938 | $columnList = array('module_srl', 'module'); |
| 1730 | 1939 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList); |
| 1731 | 1940 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1732 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1941 | + if(!$grant->manager) { |
|
| 1942 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 1943 | + } |
|
| 1733 | 1944 | |
| 1734 | 1945 | // First child of the parent_category_srl |
| 1735 | 1946 | $source_args = new stdClass; |
@@ -1742,30 +1953,39 @@ discard block |
||
| 1742 | 1953 | $args->parent_srl = $parent_category_srl; |
| 1743 | 1954 | $output = executeQuery('document.getChildCategoryMinListOrder', $args); |
| 1744 | 1955 | |
| 1745 | - if(!$output->toBool()) return $output; |
|
| 1956 | + if(!$output->toBool()) { |
|
| 1957 | + return $output; |
|
| 1958 | + } |
|
| 1746 | 1959 | $args->list_order = (int)$output->data->list_order; |
| 1747 | - if(!$args->list_order) $args->list_order = 0; |
|
| 1960 | + if(!$args->list_order) { |
|
| 1961 | + $args->list_order = 0; |
|
| 1962 | + } |
|
| 1748 | 1963 | $args->list_order--; |
| 1749 | 1964 | |
| 1750 | 1965 | $source_args->category_srl = $source_category_srl; |
| 1751 | 1966 | $source_args->parent_srl = $parent_category_srl; |
| 1752 | 1967 | $source_args->list_order = $args->list_order; |
| 1753 | 1968 | $output = $this->updateCategory($source_args); |
| 1754 | - if(!$output->toBool()) return $output; |
|
| 1969 | + if(!$output->toBool()) { |
|
| 1970 | + return $output; |
|
| 1971 | + } |
|
| 1755 | 1972 | // Sibling of the $target_category_srl |
| 1756 | - } |
|
| 1757 | - else if($target_category_srl > 0) |
|
| 1973 | + } else if($target_category_srl > 0) |
|
| 1758 | 1974 | { |
| 1759 | 1975 | $target_category = $oDocumentModel->getCategory($target_category_srl); |
| 1760 | 1976 | // Move all siblings of the $target_category down |
| 1761 | 1977 | $output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1); |
| 1762 | - if(!$output->toBool()) return $output; |
|
| 1978 | + if(!$output->toBool()) { |
|
| 1979 | + return $output; |
|
| 1980 | + } |
|
| 1763 | 1981 | |
| 1764 | 1982 | $source_args->category_srl = $source_category_srl; |
| 1765 | 1983 | $source_args->parent_srl = $target_category->parent_srl; |
| 1766 | 1984 | $source_args->list_order = $target_category->list_order+1; |
| 1767 | 1985 | $output = $this->updateCategory($source_args); |
| 1768 | - if(!$output->toBool()) return $output; |
|
| 1986 | + if(!$output->toBool()) { |
|
| 1987 | + return $output; |
|
| 1988 | + } |
|
| 1769 | 1989 | } |
| 1770 | 1990 | // Re-generate the xml file |
| 1771 | 1991 | $xml_file = $this->makeCategoryFile($source_category->module_srl); |
@@ -1790,14 +2010,20 @@ discard block |
||
| 1790 | 2010 | $columnList = array('module_srl', 'module'); |
| 1791 | 2011 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); |
| 1792 | 2012 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1793 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2013 | + if(!$grant->manager) { |
|
| 2014 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 2015 | + } |
|
| 1794 | 2016 | |
| 1795 | 2017 | $oDocumentModel = getModel('document'); |
| 1796 | 2018 | // Get original information |
| 1797 | 2019 | $category_info = $oDocumentModel->getCategory($args->category_srl); |
| 1798 | - if($category_info->parent_srl) $parent_srl = $category_info->parent_srl; |
|
| 2020 | + if($category_info->parent_srl) { |
|
| 2021 | + $parent_srl = $category_info->parent_srl; |
|
| 2022 | + } |
|
| 1799 | 2023 | // Display an error that the category cannot be deleted if it has a child node |
| 1800 | - if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 2024 | + if($oDocumentModel->getCategoryChlidCount($args->category_srl)) { |
|
| 2025 | + return new BaseObject(-1, 'msg_cannot_delete_for_child'); |
|
| 2026 | + } |
|
| 1801 | 2027 | // Remove from the DB |
| 1802 | 2028 | $output = $this->deleteCategory($args->category_srl); |
| 1803 | 2029 | if(!$output->toBool()) |
@@ -1831,7 +2057,9 @@ discard block |
||
| 1831 | 2057 | $columnList = array('module_srl', 'module'); |
| 1832 | 2058 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 1833 | 2059 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1834 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2060 | + if(!$grant->manager) { |
|
| 2061 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 2062 | + } |
|
| 1835 | 2063 | |
| 1836 | 2064 | $xml_file = $this->makeCategoryFile($module_srl); |
| 1837 | 2065 | // Set return value |
@@ -1846,7 +2074,9 @@ discard block |
||
| 1846 | 2074 | function makeCategoryFile($module_srl) |
| 1847 | 2075 | { |
| 1848 | 2076 | // Return if there is no information you need for creating a cache file |
| 1849 | - if(!$module_srl) return false; |
|
| 2077 | + if(!$module_srl) { |
|
| 2078 | + return false; |
|
| 2079 | + } |
|
| 1850 | 2080 | |
| 1851 | 2081 | $module_srl = (int)$module_srl; |
| 1852 | 2082 | |
@@ -1856,7 +2086,9 @@ discard block |
||
| 1856 | 2086 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 1857 | 2087 | $mid = $module_info->mid; |
| 1858 | 2088 | |
| 1859 | - if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category'); |
|
| 2089 | + if(!is_dir('./files/cache/document_category')) { |
|
| 2090 | + FileHandler::makeDir('./files/cache/document_category'); |
|
| 2091 | + } |
|
| 1860 | 2092 | // Cache file's name |
| 1861 | 2093 | $xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl); |
| 1862 | 2094 | $php_file = sprintf("./files/cache/document_category/%s.php", $module_srl); |
@@ -1868,13 +2100,17 @@ discard block |
||
| 1868 | 2100 | |
| 1869 | 2101 | $category_list = $output->data; |
| 1870 | 2102 | |
| 1871 | - if(!is_array($category_list)) $category_list = array($category_list); |
|
| 2103 | + if(!is_array($category_list)) { |
|
| 2104 | + $category_list = array($category_list); |
|
| 2105 | + } |
|
| 1872 | 2106 | |
| 1873 | 2107 | $category_count = count($category_list); |
| 1874 | 2108 | for($i=0;$i<$category_count;$i++) |
| 1875 | 2109 | { |
| 1876 | 2110 | $category_srl = $category_list[$i]->category_srl; |
| 1877 | - if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = ''; |
|
| 2111 | + if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) { |
|
| 2112 | + $category_list[$i]->group_srls = ''; |
|
| 2113 | + } |
|
| 1878 | 2114 | $list[$category_srl] = $category_list[$i]; |
| 1879 | 2115 | } |
| 1880 | 2116 | // Create the xml file without node data if no data is obtained |
@@ -1886,7 +2122,9 @@ discard block |
||
| 1886 | 2122 | return $xml_file; |
| 1887 | 2123 | } |
| 1888 | 2124 | // Change to an array if only a single data is obtained |
| 1889 | - if(!is_array($list)) $list = array($list); |
|
| 2125 | + if(!is_array($list)) { |
|
| 2126 | + $list = array($list); |
|
| 2127 | + } |
|
| 1890 | 2128 | // Create a tree for loop |
| 1891 | 2129 | foreach($list as $category_srl => $node) |
| 1892 | 2130 | { |
@@ -1965,13 +2203,17 @@ discard block |
||
| 1965 | 2203 | */ |
| 1966 | 2204 | function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff) |
| 1967 | 2205 | { |
| 1968 | - if(!$source_node) return; |
|
| 2206 | + if(!$source_node) { |
|
| 2207 | + return; |
|
| 2208 | + } |
|
| 1969 | 2209 | |
| 1970 | 2210 | foreach($source_node as $category_srl => $node) |
| 1971 | 2211 | { |
| 1972 | 2212 | $child_buff = ""; |
| 1973 | 2213 | // Get data of the child nodes |
| 1974 | - if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); |
|
| 2214 | + if($category_srl && $tree[$category_srl]) { |
|
| 2215 | + $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); |
|
| 2216 | + } |
|
| 1975 | 2217 | // List variables |
| 1976 | 2218 | $expand = ($node->expand) ? $node->expand : 'N'; |
| 1977 | 2219 | $group_srls = ($node->group_srls) ? $node->group_srls : ''; |
@@ -1981,8 +2223,11 @@ discard block |
||
| 1981 | 2223 | $color = ($node->color) ? $node->color : ''; |
| 1982 | 2224 | $description = ($node->description) ? $node->description : ''; |
| 1983 | 2225 | // If node->group_srls value exists |
| 1984 | - if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls); |
|
| 1985 | - else $group_check_code = "true"; |
|
| 2226 | + if($group_srls) { |
|
| 2227 | + $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls); |
|
| 2228 | + } else { |
|
| 2229 | + $group_check_code = "true"; |
|
| 2230 | + } |
|
| 1986 | 2231 | |
| 1987 | 2232 | $title = $node->title; |
| 1988 | 2233 | $oModuleAdminModel = getAdminModel('module'); |
@@ -2022,8 +2267,11 @@ discard block |
||
| 2022 | 2267 | $node->document_count |
| 2023 | 2268 | ); |
| 2024 | 2269 | |
| 2025 | - if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 2026 | - else $buff .= sprintf('<node %s />', $attribute); |
|
| 2270 | + if($child_buff) { |
|
| 2271 | + $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff); |
|
| 2272 | + } else { |
|
| 2273 | + $buff .= sprintf('<node %s />', $attribute); |
|
| 2274 | + } |
|
| 2027 | 2275 | } |
| 2028 | 2276 | return $buff; |
| 2029 | 2277 | } |
@@ -2042,7 +2290,9 @@ discard block |
||
| 2042 | 2290 | function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff) |
| 2043 | 2291 | { |
| 2044 | 2292 | $output = array("buff"=>"", "category_srl_list"=>array()); |
| 2045 | - if(!$source_node) return $output; |
|
| 2293 | + if(!$source_node) { |
|
| 2294 | + return $output; |
|
| 2295 | + } |
|
| 2046 | 2296 | |
| 2047 | 2297 | // Set to an arraty for looping and then generate php script codes to be included |
| 2048 | 2298 | foreach($source_node as $category_srl => $node) |
@@ -2141,7 +2391,9 @@ discard block |
||
| 2141 | 2391 | function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self') |
| 2142 | 2392 | { |
| 2143 | 2393 | $document_popup_menu_list = Context::get('document_popup_menu_list'); |
| 2144 | - if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array(); |
|
| 2394 | + if(!is_array($document_popup_menu_list)) { |
|
| 2395 | + $document_popup_menu_list = array(); |
|
| 2396 | + } |
|
| 2145 | 2397 | |
| 2146 | 2398 | $obj = new stdClass(); |
| 2147 | 2399 | $obj->url = $url; |
@@ -2159,7 +2411,9 @@ discard block |
||
| 2159 | 2411 | */ |
| 2160 | 2412 | function procDocumentAddCart() |
| 2161 | 2413 | { |
| 2162 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2414 | + if(!Context::get('is_logged')) { |
|
| 2415 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 2416 | + } |
|
| 2163 | 2417 | |
| 2164 | 2418 | // Get document_srl |
| 2165 | 2419 | $srls = explode(',',Context::get('srls')); |
@@ -2167,11 +2421,15 @@ discard block |
||
| 2167 | 2421 | { |
| 2168 | 2422 | $srl = trim($srls[$i]); |
| 2169 | 2423 | |
| 2170 | - if(!$srl) continue; |
|
| 2424 | + if(!$srl) { |
|
| 2425 | + continue; |
|
| 2426 | + } |
|
| 2171 | 2427 | |
| 2172 | 2428 | $document_srls[] = $srl; |
| 2173 | 2429 | } |
| 2174 | - if(!count($document_srls)) return; |
|
| 2430 | + if(!count($document_srls)) { |
|
| 2431 | + return; |
|
| 2432 | + } |
|
| 2175 | 2433 | |
| 2176 | 2434 | // Get module_srl of the documents |
| 2177 | 2435 | $args = new stdClass; |
@@ -2179,14 +2437,18 @@ discard block |
||
| 2179 | 2437 | $args->document_srls = implode(',',$document_srls); |
| 2180 | 2438 | $args->order_type = 'asc'; |
| 2181 | 2439 | $output = executeQueryArray('document.getDocuments', $args); |
| 2182 | - if(!$output->data) return new BaseObject(); |
|
| 2440 | + if(!$output->data) { |
|
| 2441 | + return new BaseObject(); |
|
| 2442 | + } |
|
| 2183 | 2443 | |
| 2184 | 2444 | unset($document_srls); |
| 2185 | 2445 | foreach($output->data as $key => $val) |
| 2186 | 2446 | { |
| 2187 | 2447 | $document_srls[$val->module_srl][] = $val->document_srl; |
| 2188 | 2448 | } |
| 2189 | - if(!$document_srls || !count($document_srls)) return new BaseObject(); |
|
| 2449 | + if(!$document_srls || !count($document_srls)) { |
|
| 2450 | + return new BaseObject(); |
|
| 2451 | + } |
|
| 2190 | 2452 | |
| 2191 | 2453 | // Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents) |
| 2192 | 2454 | $oModuleModel = getModel('module'); |
@@ -2211,7 +2473,9 @@ discard block |
||
| 2211 | 2473 | } |
| 2212 | 2474 | } |
| 2213 | 2475 | } |
| 2214 | - if(!count($document_srls)) return new BaseObject(); |
|
| 2476 | + if(!count($document_srls)) { |
|
| 2477 | + return new BaseObject(); |
|
| 2478 | + } |
|
| 2215 | 2479 | |
| 2216 | 2480 | foreach($document_srls as $module_srl => $documents) |
| 2217 | 2481 | { |
@@ -2219,9 +2483,14 @@ discard block |
||
| 2219 | 2483 | for($i=0;$i<$cnt;$i++) |
| 2220 | 2484 | { |
| 2221 | 2485 | $document_srl = (int)trim($documents[$i]); |
| 2222 | - if(!$document_srls) continue; |
|
| 2223 | - if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]); |
|
| 2224 | - else $_SESSION['document_management'][$document_srl] = true; |
|
| 2486 | + if(!$document_srls) { |
|
| 2487 | + continue; |
|
| 2488 | + } |
|
| 2489 | + if($_SESSION['document_management'][$document_srl]) { |
|
| 2490 | + unset($_SESSION['document_management'][$document_srl]); |
|
| 2491 | + } else { |
|
| 2492 | + $_SESSION['document_management'][$document_srl] = true; |
|
| 2493 | + } |
|
| 2225 | 2494 | } |
| 2226 | 2495 | } |
| 2227 | 2496 | } |
@@ -2233,7 +2502,9 @@ discard block |
||
| 2233 | 2502 | function procDocumentManageCheckedDocument() |
| 2234 | 2503 | { |
| 2235 | 2504 | @set_time_limit(0); |
| 2236 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2505 | + if(!Context::get('is_logged')) { |
|
| 2506 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 2507 | + } |
|
| 2237 | 2508 | |
| 2238 | 2509 | if(!checkCSRF()) |
| 2239 | 2510 | { |
@@ -2243,10 +2514,14 @@ discard block |
||
| 2243 | 2514 | $type = Context::get('type'); |
| 2244 | 2515 | $target_module = Context::get('target_module_srl'); |
| 2245 | 2516 | $module_srl = Context::get('module_srl'); |
| 2246 | - if($target_module && !$module_srl) $module_srl = $target_module; |
|
| 2517 | + if($target_module && !$module_srl) { |
|
| 2518 | + $module_srl = $target_module; |
|
| 2519 | + } |
|
| 2247 | 2520 | $category_srl = Context::get('target_category_srl'); |
| 2248 | 2521 | $message_content = strip_tags(Context::get('message_content')); |
| 2249 | - if($message_content) $message_content = nl2br($message_content); |
|
| 2522 | + if($message_content) { |
|
| 2523 | + $message_content = nl2br($message_content); |
|
| 2524 | + } |
|
| 2250 | 2525 | |
| 2251 | 2526 | $cart = Context::get('cart'); |
| 2252 | 2527 | $document_srl_list = (!is_array($cart)) ? explode('|@|', $cart) : $cart; |
@@ -2261,7 +2536,9 @@ discard block |
||
| 2261 | 2536 | { |
| 2262 | 2537 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 2263 | 2538 | $document_items[] = $oDocument; |
| 2264 | - if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 2539 | + if(!$oDocument->isGranted()) { |
|
| 2540 | + return $this->stop('msg_not_permitted'); |
|
| 2541 | + } |
|
| 2265 | 2542 | } |
| 2266 | 2543 | |
| 2267 | 2544 | // Send a message |
@@ -2277,10 +2554,15 @@ discard block |
||
| 2277 | 2554 | |
| 2278 | 2555 | foreach($document_items as $oDocument) |
| 2279 | 2556 | { |
| 2280 | - if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue; |
|
| 2557 | + if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) { |
|
| 2558 | + continue; |
|
| 2559 | + } |
|
| 2281 | 2560 | |
| 2282 | - if($type=='move') $purl = sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl()); |
|
| 2283 | - else $purl = ""; |
|
| 2561 | + if($type=='move') { |
|
| 2562 | + $purl = sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl()); |
|
| 2563 | + } else { |
|
| 2564 | + $purl = ""; |
|
| 2565 | + } |
|
| 2284 | 2566 | $content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false)); |
| 2285 | 2567 | |
| 2286 | 2568 | $oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false); |
@@ -2293,24 +2575,30 @@ discard block |
||
| 2293 | 2575 | $oDocumentAdminController = getAdminController('document'); |
| 2294 | 2576 | if($type == 'move') |
| 2295 | 2577 | { |
| 2296 | - if(!$module_srl) return new BaseObject(-1, 'fail_to_move'); |
|
| 2578 | + if(!$module_srl) { |
|
| 2579 | + return new BaseObject(-1, 'fail_to_move'); |
|
| 2580 | + } |
|
| 2297 | 2581 | |
| 2298 | 2582 | $output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl); |
| 2299 | - if(!$output->toBool()) return new BaseObject(-1, 'fail_to_move'); |
|
| 2583 | + if(!$output->toBool()) { |
|
| 2584 | + return new BaseObject(-1, 'fail_to_move'); |
|
| 2585 | + } |
|
| 2300 | 2586 | |
| 2301 | 2587 | $msg_code = 'success_moved'; |
| 2302 | 2588 | |
| 2303 | - } |
|
| 2304 | - else if($type == 'copy') |
|
| 2589 | + } else if($type == 'copy') |
|
| 2305 | 2590 | { |
| 2306 | - if(!$module_srl) return new BaseObject(-1, 'fail_to_move'); |
|
| 2591 | + if(!$module_srl) { |
|
| 2592 | + return new BaseObject(-1, 'fail_to_move'); |
|
| 2593 | + } |
|
| 2307 | 2594 | |
| 2308 | 2595 | $output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl); |
| 2309 | - if(!$output->toBool()) return new BaseObject(-1, 'fail_to_move'); |
|
| 2596 | + if(!$output->toBool()) { |
|
| 2597 | + return new BaseObject(-1, 'fail_to_move'); |
|
| 2598 | + } |
|
| 2310 | 2599 | |
| 2311 | 2600 | $msg_code = 'success_copied'; |
| 2312 | - } |
|
| 2313 | - else if($type =='delete') |
|
| 2601 | + } else if($type =='delete') |
|
| 2314 | 2602 | { |
| 2315 | 2603 | $oDB = &DB::getInstance(); |
| 2316 | 2604 | $oDB->begin(); |
@@ -2318,12 +2606,13 @@ discard block |
||
| 2318 | 2606 | { |
| 2319 | 2607 | $document_srl = $document_srl_list[$i]; |
| 2320 | 2608 | $output = $this->deleteDocument($document_srl, true); |
| 2321 | - if(!$output->toBool()) return new BaseObject(-1, 'fail_to_delete'); |
|
| 2609 | + if(!$output->toBool()) { |
|
| 2610 | + return new BaseObject(-1, 'fail_to_delete'); |
|
| 2611 | + } |
|
| 2322 | 2612 | } |
| 2323 | 2613 | $oDB->commit(); |
| 2324 | 2614 | $msg_code = 'success_deleted'; |
| 2325 | - } |
|
| 2326 | - else if($type == 'trash') |
|
| 2615 | + } else if($type == 'trash') |
|
| 2327 | 2616 | { |
| 2328 | 2617 | $args = new stdClass(); |
| 2329 | 2618 | $args->description = $message_content; |
@@ -2333,12 +2622,13 @@ discard block |
||
| 2333 | 2622 | for($i=0;$i<$document_srl_count;$i++) { |
| 2334 | 2623 | $args->document_srl = $document_srl_list[$i]; |
| 2335 | 2624 | $output = $this->moveDocumentToTrash($args); |
| 2336 | - if(!$output || !$output->toBool()) return new BaseObject(-1, 'fail_to_trash'); |
|
| 2625 | + if(!$output || !$output->toBool()) { |
|
| 2626 | + return new BaseObject(-1, 'fail_to_trash'); |
|
| 2627 | + } |
|
| 2337 | 2628 | } |
| 2338 | 2629 | $oDB->commit(); |
| 2339 | 2630 | $msg_code = 'success_trashed'; |
| 2340 | - } |
|
| 2341 | - else if($type == 'cancelDeclare') |
|
| 2631 | + } else if($type == 'cancelDeclare') |
|
| 2342 | 2632 | { |
| 2343 | 2633 | $args->document_srl = $document_srl_list; |
| 2344 | 2634 | $output = executeQuery('document.deleteDeclaredDocuments', $args); |
@@ -2360,18 +2650,27 @@ discard block |
||
| 2360 | 2650 | function procDocumentInsertModuleConfig() |
| 2361 | 2651 | { |
| 2362 | 2652 | $module_srl = Context::get('target_module_srl'); |
| 2363 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
| 2364 | - else $module_srl = array($module_srl); |
|
| 2653 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
| 2654 | + $module_srl = explode(',',$module_srl); |
|
| 2655 | + } else { |
|
| 2656 | + $module_srl = array($module_srl); |
|
| 2657 | + } |
|
| 2365 | 2658 | |
| 2366 | 2659 | $document_config = new stdClass(); |
| 2367 | 2660 | $document_config->use_history = Context::get('use_history'); |
| 2368 | - if(!$document_config->use_history) $document_config->use_history = 'N'; |
|
| 2661 | + if(!$document_config->use_history) { |
|
| 2662 | + $document_config->use_history = 'N'; |
|
| 2663 | + } |
|
| 2369 | 2664 | |
| 2370 | 2665 | $document_config->use_vote_up = Context::get('use_vote_up'); |
| 2371 | - if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y'; |
|
| 2666 | + if(!$document_config->use_vote_up) { |
|
| 2667 | + $document_config->use_vote_up = 'Y'; |
|
| 2668 | + } |
|
| 2372 | 2669 | |
| 2373 | 2670 | $document_config->use_vote_down = Context::get('use_vote_down'); |
| 2374 | - if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y'; |
|
| 2671 | + if(!$document_config->use_vote_down) { |
|
| 2672 | + $document_config->use_vote_down = 'Y'; |
|
| 2673 | + } |
|
| 2375 | 2674 | |
| 2376 | 2675 | $document_config->use_status = Context::get('use_status'); |
| 2377 | 2676 | |
@@ -2379,7 +2678,9 @@ discard block |
||
| 2379 | 2678 | for($i=0;$i<count($module_srl);$i++) |
| 2380 | 2679 | { |
| 2381 | 2680 | $srl = trim($module_srl[$i]); |
| 2382 | - if(!$srl) continue; |
|
| 2681 | + if(!$srl) { |
|
| 2682 | + continue; |
|
| 2683 | + } |
|
| 2383 | 2684 | $output = $oModuleController->insertModulePartConfig('document',$srl,$document_config); |
| 2384 | 2685 | } |
| 2385 | 2686 | $this->setError(-1); |
@@ -2396,7 +2697,9 @@ discard block |
||
| 2396 | 2697 | function procDocumentTempSave() |
| 2397 | 2698 | { |
| 2398 | 2699 | // Check login information |
| 2399 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged'); |
|
| 2700 | + if(!Context::get('is_logged')) { |
|
| 2701 | + return new BaseObject(-1, 'msg_not_logged'); |
|
| 2702 | + } |
|
| 2400 | 2703 | $module_info = Context::get('module_info'); |
| 2401 | 2704 | $logged_info = Context::get('logged_info'); |
| 2402 | 2705 | |
@@ -2434,8 +2737,7 @@ discard block |
||
| 2434 | 2737 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
| 2435 | 2738 | $msg_code = 'success_updated'; |
| 2436 | 2739 | // Otherwise, get a new |
| 2437 | - } |
|
| 2438 | - else |
|
| 2740 | + } else |
|
| 2439 | 2741 | { |
| 2440 | 2742 | $output = $oDocumentController->insertDocument($obj); |
| 2441 | 2743 | $msg_code = 'success_registed'; |
@@ -2461,17 +2763,20 @@ discard block |
||
| 2461 | 2763 | */ |
| 2462 | 2764 | function procDocumentGetList() |
| 2463 | 2765 | { |
| 2464 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 2766 | + if(!Context::get('is_logged')) { |
|
| 2767 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 2768 | + } |
|
| 2465 | 2769 | $documentSrls = Context::get('document_srls'); |
| 2466 | - if($documentSrls) $documentSrlList = explode(',', $documentSrls); |
|
| 2770 | + if($documentSrls) { |
|
| 2771 | + $documentSrlList = explode(',', $documentSrls); |
|
| 2772 | + } |
|
| 2467 | 2773 | |
| 2468 | 2774 | if(count($documentSrlList) > 0) |
| 2469 | 2775 | { |
| 2470 | 2776 | $oDocumentModel = getModel('document'); |
| 2471 | 2777 | $columnList = array('document_srl', 'title', 'nick_name', 'status'); |
| 2472 | 2778 | $documentList = $oDocumentModel->getDocuments($documentSrlList, $this->grant->is_admin, false, $columnList); |
| 2473 | - } |
|
| 2474 | - else |
|
| 2779 | + } else |
|
| 2475 | 2780 | { |
| 2476 | 2781 | global $lang; |
| 2477 | 2782 | $documentList = array(); |
@@ -2489,11 +2794,18 @@ discard block |
||
| 2489 | 2794 | */ |
| 2490 | 2795 | function _checkCommentStatusForOldVersion(&$obj) |
| 2491 | 2796 | { |
| 2492 | - if(!isset($obj->allow_comment)) $obj->allow_comment = 'N'; |
|
| 2493 | - if(!isset($obj->lock_comment)) $obj->lock_comment = 'N'; |
|
| 2797 | + if(!isset($obj->allow_comment)) { |
|
| 2798 | + $obj->allow_comment = 'N'; |
|
| 2799 | + } |
|
| 2800 | + if(!isset($obj->lock_comment)) { |
|
| 2801 | + $obj->lock_comment = 'N'; |
|
| 2802 | + } |
|
| 2494 | 2803 | |
| 2495 | - if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW'; |
|
| 2496 | - else $obj->commentStatus = 'DENY'; |
|
| 2804 | + if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') { |
|
| 2805 | + $obj->commentStatus = 'ALLOW'; |
|
| 2806 | + } else { |
|
| 2807 | + $obj->commentStatus = 'DENY'; |
|
| 2808 | + } |
|
| 2497 | 2809 | } |
| 2498 | 2810 | |
| 2499 | 2811 | /** |
@@ -2503,8 +2815,12 @@ discard block |
||
| 2503 | 2815 | */ |
| 2504 | 2816 | function _checkDocumentStatusForOldVersion(&$obj) |
| 2505 | 2817 | { |
| 2506 | - if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret'); |
|
| 2507 | - if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public'); |
|
| 2818 | + if(!$obj->status && $obj->is_secret == 'Y') { |
|
| 2819 | + $obj->status = $this->getConfigStatus('secret'); |
|
| 2820 | + } |
|
| 2821 | + if(!$obj->status && $obj->is_secret != 'Y') { |
|
| 2822 | + $obj->status = $this->getConfigStatus('public'); |
|
| 2823 | + } |
|
| 2508 | 2824 | } |
| 2509 | 2825 | |
| 2510 | 2826 | public function updateUploaedCount($documentSrlList) |