@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Initilization |
| 44 | - * @return void |
|
| 44 | + * @return ModuleObject|null |
|
| 45 | 45 | */ |
| 46 | 46 | function init() |
| 47 | 47 | { |
@@ -566,7 +566,7 @@ |
||
| 566 | 566 | /** |
| 567 | 567 | * Retrun server environment to XML string |
| 568 | 568 | * @return object |
| 569 | - */ |
|
| 569 | + */ |
|
| 570 | 570 | function dispAdminViewServerEnv() |
| 571 | 571 | { |
| 572 | 572 | $info = array(); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $db_info = Context::getDBInfo(); |
| 30 | 30 | |
| 31 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
| 31 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
| 32 | 32 | { |
| 33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url); |
| 34 | 34 | } |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | // forbit access if the user is not an administrator |
| 49 | 49 | $oMemberModel = getModel('member'); |
| 50 | 50 | $logged_info = $oMemberModel->getLoggedInfo(); |
| 51 | - if($logged_info->is_admin != 'Y') |
|
| 51 | + if ($logged_info->is_admin != 'Y') |
|
| 52 | 52 | { |
| 53 | 53 | return $this->stop("msg_is_not_administrator"); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // change into administration layout |
| 57 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
| 57 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
| 58 | 58 | $this->setLayoutPath($this->getTemplatePath()); |
| 59 | 59 | $this->setLayoutFile('layout.html'); |
| 60 | 60 | |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y'); |
| 75 | 75 | Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N'); |
| 76 | 76 | Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none"); |
| 77 | - if($db_info->http_port) |
|
| 77 | + if ($db_info->http_port) |
|
| 78 | 78 | { |
| 79 | 79 | Context::set('http_port', $db_info->http_port); |
| 80 | 80 | } |
| 81 | - if($db_info->https_port) |
|
| 81 | + if ($db_info->https_port) |
|
| 82 | 82 | { |
| 83 | 83 | Context::set('https_port', $db_info->https_port); |
| 84 | 84 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | function checkEasyinstall() |
| 95 | 95 | { |
| 96 | 96 | $lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile); |
| 97 | - if($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
| 97 | + if ($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
| 98 | 98 | { |
| 99 | 99 | return; |
| 100 | 100 | } |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | $lUpdateDoc = $xml_lUpdate->parse($buff); |
| 109 | 109 | $updateDate = $lUpdateDoc->response->updatedate->body; |
| 110 | 110 | |
| 111 | - if(!$updateDate) |
|
| 111 | + if (!$updateDate) |
|
| 112 | 112 | { |
| 113 | 113 | $this->_markingCheckEasyinstall(); |
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $item = $oAutoinstallModel->getLatestPackage(); |
| 118 | - if(!$item || $item->updatedate < $updateDate) |
|
| 118 | + if (!$item || $item->updatedate < $updateDate) |
|
| 119 | 119 | { |
| 120 | 120 | $oController = getAdminController('autoinstall'); |
| 121 | 121 | $oController->_updateinfo(); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | // Check is_shortcut column |
| 146 | 146 | $oDB = DB::getInstance(); |
| 147 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 147 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 148 | 148 | { |
| 149 | 149 | return; |
| 150 | 150 | } |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | $currentAct = Context::get('act'); |
| 163 | 163 | $subMenuTitle = ''; |
| 164 | 164 | |
| 165 | - foreach((array) $moduleActionInfo->menu as $key => $value) |
|
| 165 | + foreach ((array) $moduleActionInfo->menu as $key => $value) |
|
| 166 | 166 | { |
| 167 | - if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
| 167 | + if (isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
| 168 | 168 | { |
| 169 | 169 | $subMenuTitle = $value->title; |
| 170 | 170 | break; |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | // get current menu's srl(=parentSrl) |
| 174 | 174 | $parentSrl = 0; |
| 175 | 175 | $oMenuAdminConroller = getAdminController('menu'); |
| 176 | - foreach((array) $menu->list as $parentKey => $parentMenu) |
|
| 176 | + foreach ((array) $menu->list as $parentKey => $parentMenu) |
|
| 177 | 177 | { |
| 178 | - if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
| 178 | + if (!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
| 179 | 179 | { |
| 180 | 180 | continue; |
| 181 | 181 | } |
| 182 | - if($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
| 182 | + if ($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
| 183 | 183 | { |
| 184 | 184 | $firstChild = current($parentMenu['list']); |
| 185 | 185 | $menu->list[$parentKey]['href'] = $firstChild['href']; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - foreach($parentMenu['list'] as $childKey => $childMenu) |
|
| 188 | + foreach ($parentMenu['list'] as $childKey => $childMenu) |
|
| 189 | 189 | { |
| 190 | - if($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
| 190 | + if ($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
| 191 | 191 | { |
| 192 | 192 | $parentSrl = $childMenu['parent_srl']; |
| 193 | 193 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'XE Admin'; |
| 201 | 201 | $gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : 'modules/admin/tpl/img/xe.h1.png'; |
| 202 | 202 | |
| 203 | - $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle; |
|
| 203 | + $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard').' - '.$gnbTitleInfo->adminTitle; |
|
| 204 | 204 | |
| 205 | 205 | // Get list of favorite |
| 206 | 206 | $oAdminAdminModel = getAdminModel('admin'); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // move from index method, because use in admin footer |
| 212 | 212 | $newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); |
| 213 | 213 | $cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); |
| 214 | - if(!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
| 214 | + if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
| 215 | 215 | { |
| 216 | 216 | // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page |
| 217 | 217 | // Ensure to access the administration page even though news cannot be displayed |
@@ -219,20 +219,20 @@ discard block |
||
| 219 | 219 | FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if(file_exists($cache_file)) |
|
| 222 | + if (file_exists($cache_file)) |
|
| 223 | 223 | { |
| 224 | 224 | $oXml = new XmlParser(); |
| 225 | 225 | $buff = $oXml->parse(FileHandler::readFile($cache_file)); |
| 226 | 226 | |
| 227 | 227 | $item = $buff->zbxe_news->item; |
| 228 | - if($item) |
|
| 228 | + if ($item) |
|
| 229 | 229 | { |
| 230 | - if(!is_array($item)) |
|
| 230 | + if (!is_array($item)) |
|
| 231 | 231 | { |
| 232 | 232 | $item = array($item); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - foreach($item as $key => $val) |
|
| 235 | + foreach ($item as $key => $val) |
|
| 236 | 236 | { |
| 237 | 237 | $obj = new stdClass(); |
| 238 | 238 | $obj->title = $val->body; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $news[] = $obj; |
| 242 | 242 | } |
| 243 | 243 | Context::set('news', $news); |
| 244 | - if(isset($news) && is_array($news)) |
|
| 244 | + if (isset($news) && is_array($news)) |
|
| 245 | 245 | { |
| 246 | 246 | Context::set('latestVersion', array_shift($news)); |
| 247 | 247 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | function dispAdminIndex() |
| 265 | 265 | { |
| 266 | 266 | $db_info = Context::getDBInfo(); |
| 267 | - Context::set('db_info',$db_info); |
|
| 267 | + Context::set('db_info', $db_info); |
|
| 268 | 268 | |
| 269 | 269 | // Get statistics |
| 270 | 270 | $args = new stdClass(); |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | $args = new stdClass(); |
| 302 | 302 | $args->list_count = 5; |
| 303 | 303 | $output = $oCommentModel->getNewestCommentList($args, $columnList); |
| 304 | - if(is_array($output)) |
|
| 304 | + if (is_array($output)) |
|
| 305 | 305 | { |
| 306 | - foreach($output AS $key => $value) |
|
| 306 | + foreach ($output AS $key => $value) |
|
| 307 | 307 | { |
| 308 | 308 | $value->content = strip_tags($value->content); |
| 309 | 309 | } |
@@ -314,17 +314,17 @@ discard block |
||
| 314 | 314 | // Get list of modules |
| 315 | 315 | $oModuleModel = getModel('module'); |
| 316 | 316 | $module_list = $oModuleModel->getModuleList(); |
| 317 | - if(is_array($module_list)) |
|
| 317 | + if (is_array($module_list)) |
|
| 318 | 318 | { |
| 319 | 319 | $needUpdate = FALSE; |
| 320 | 320 | $addTables = FALSE; |
| 321 | - foreach($module_list AS $key => $value) |
|
| 321 | + foreach ($module_list AS $key => $value) |
|
| 322 | 322 | { |
| 323 | - if($value->need_install) |
|
| 323 | + if ($value->need_install) |
|
| 324 | 324 | { |
| 325 | 325 | $addTables = TRUE; |
| 326 | 326 | } |
| 327 | - if($value->need_update) |
|
| 327 | + if ($value->need_update) |
|
| 328 | 328 | { |
| 329 | 329 | $needUpdate = TRUE; |
| 330 | 330 | } |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | $oAutoinstallAdminModel = getAdminModel('autoinstall'); |
| 336 | 336 | $needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList(); |
| 337 | 337 | |
| 338 | - if(is_array($needUpdateList)) |
|
| 338 | + if (is_array($needUpdateList)) |
|
| 339 | 339 | { |
| 340 | - foreach($needUpdateList AS $key => $value) |
|
| 340 | + foreach ($needUpdateList AS $key => $value) |
|
| 341 | 341 | { |
| 342 | 342 | $helpUrl = './admin/help/index.html#'; |
| 343 | - switch($value->type) |
|
| 343 | + switch ($value->type) |
|
| 344 | 344 | { |
| 345 | 345 | case 'addon': |
| 346 | 346 | $helpUrl .= 'UMAN_terminology_addon'; |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | $site_module_info = Context::get('site_module_info'); |
| 369 | 369 | $oAddonAdminModel = getAdminModel('addon'); |
| 370 | - $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl ); |
|
| 371 | - if(!$counterAddonActivated) |
|
| 370 | + $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl); |
|
| 371 | + if (!$counterAddonActivated) |
|
| 372 | 372 | { |
| 373 | 373 | $columnList = array('member_srl', 'nick_name', 'user_name', 'user_id', 'email_address'); |
| 374 | 374 | $args = new stdClass; |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | // gathering enviroment check |
| 393 | 393 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
| 394 | - $path = FileHandler::getRealPath('./files/env/' . $mainVersion); |
|
| 394 | + $path = FileHandler::getRealPath('./files/env/'.$mainVersion); |
|
| 395 | 395 | $isEnviromentGatheringAgreement = FALSE; |
| 396 | - if(file_exists($path)) |
|
| 396 | + if (file_exists($path)) |
|
| 397 | 397 | { |
| 398 | 398 | $isEnviromentGatheringAgreement = TRUE; |
| 399 | 399 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $isLicenseAgreement = FALSE; |
| 404 | 404 | $path = FileHandler::getRealPath('./files/env/license_agreement'); |
| 405 | 405 | $isLicenseAgreement = FALSE; |
| 406 | - if(file_exists($path)) |
|
| 406 | + if (file_exists($path)) |
|
| 407 | 407 | { |
| 408 | 408 | $isLicenseAgreement = TRUE; |
| 409 | 409 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | |
| 426 | 426 | Context::set('selected_lang', $db_info->lang_type); |
| 427 | 427 | |
| 428 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
| 428 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
| 429 | 429 | { |
| 430 | 430 | $db_info->default_url = Context::decodeIdna($db_info->default_url); |
| 431 | 431 | } |
@@ -434,9 +434,9 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | // site lock |
| 436 | 436 | Context::set('IP', $_SERVER['REMOTE_ADDR']); |
| 437 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
| 438 | - if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
| 439 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
| 437 | + if (!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
| 438 | + if (!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
| 439 | + if (!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
| 440 | 440 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
| 441 | 441 | Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
| 442 | 442 | Context::set('use_sitelock', $db_info->use_sitelock); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | Context::set('sitelock_whitelist', $whitelist); |
| 448 | 448 | |
| 449 | 449 | |
| 450 | - if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
| 450 | + if ($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
| 451 | 451 | else $admin_ip_list = ''; |
| 452 | 452 | Context::set('admin_ip_list', $admin_ip_list); |
| 453 | 453 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | Context::set('htmlFooter', htmlspecialchars($config->htmlFooter)); |
| 471 | 471 | |
| 472 | 472 | // embed filter |
| 473 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
| 473 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
| 474 | 474 | $oEmbedFilter = EmbedFilter::getInstance(); |
| 475 | 475 | context::set('embed_white_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList)); |
| 476 | 476 | context::set('embed_white_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList)); |
@@ -529,36 +529,36 @@ discard block |
||
| 529 | 529 | */ |
| 530 | 530 | function showSendEnv() |
| 531 | 531 | { |
| 532 | - if(Context::getResponseMethod() != 'HTML') |
|
| 532 | + if (Context::getResponseMethod() != 'HTML') |
|
| 533 | 533 | { |
| 534 | 534 | return; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | $server = 'http://collect.xpressengine.com/env/img.php?'; |
| 538 | 538 | $path = './files/env/'; |
| 539 | - $install_env = $path . 'install'; |
|
| 539 | + $install_env = $path.'install'; |
|
| 540 | 540 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
| 541 | 541 | |
| 542 | - if(file_exists(FileHandler::getRealPath($install_env))) |
|
| 542 | + if (file_exists(FileHandler::getRealPath($install_env))) |
|
| 543 | 543 | { |
| 544 | 544 | $oAdminAdminModel = getAdminModel('admin'); |
| 545 | 545 | $params = $oAdminAdminModel->getEnv('INSTALL'); |
| 546 | - $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
|
| 546 | + $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); |
|
| 547 | 547 | Context::addHtmlFooter($img); |
| 548 | 548 | |
| 549 | - FileHandler::writeFile($path . $mainVersion, '1'); |
|
| 549 | + FileHandler::writeFile($path.$mainVersion, '1'); |
|
| 550 | 550 | } |
| 551 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
| 551 | + else if (isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion))) |
|
| 552 | 552 | { |
| 553 | - if($_SESSION['enviroment_gather'] == 'Y') |
|
| 553 | + if ($_SESSION['enviroment_gather'] == 'Y') |
|
| 554 | 554 | { |
| 555 | 555 | $oAdminAdminModel = getAdminModel('admin'); |
| 556 | 556 | $params = $oAdminAdminModel->getEnv(); |
| 557 | - $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
|
| 557 | + $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); |
|
| 558 | 558 | Context::addHtmlFooter($img); |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - FileHandler::writeFile($path . $mainVersion, '1'); |
|
| 561 | + FileHandler::writeFile($path.$mainVersion, '1'); |
|
| 562 | 562 | unset($_SESSION['enviroment_gather']); |
| 563 | 563 | } |
| 564 | 564 | } |
@@ -576,64 +576,64 @@ discard block |
||
| 576 | 576 | $tmp = explode("&", $envInfo); |
| 577 | 577 | $arrInfo = array(); |
| 578 | 578 | $xe_check_env = array(); |
| 579 | - foreach($tmp as $value) { |
|
| 579 | + foreach ($tmp as $value) { |
|
| 580 | 580 | $arr = explode("=", $value); |
| 581 | - if($arr[0]=="type") { |
|
| 581 | + if ($arr[0] == "type") { |
|
| 582 | 582 | continue; |
| 583 | - }elseif($arr[0]=="phpext" ) { |
|
| 583 | + }elseif ($arr[0] == "phpext") { |
|
| 584 | 584 | $str = urldecode($arr[1]); |
| 585 | - $xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
|
| 586 | - } elseif($arr[0]=="module" ) { |
|
| 585 | + $xe_check_env[$arr[0]] = str_replace("|", ", ", $str); |
|
| 586 | + } elseif ($arr[0] == "module") { |
|
| 587 | 587 | $str = urldecode($arr[1]); |
| 588 | 588 | $arrModuleName = explode("|", $str); |
| 589 | 589 | $oModuleModel = getModel("module"); |
| 590 | 590 | $mInfo = array(); |
| 591 | - foreach($arrModuleName as $moduleName) { |
|
| 591 | + foreach ($arrModuleName as $moduleName) { |
|
| 592 | 592 | $moduleInfo = $oModuleModel->getModuleInfoXml($moduleName); |
| 593 | 593 | $mInfo[] = "{$moduleName}({$moduleInfo->version})"; |
| 594 | 594 | } |
| 595 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
| 596 | - } elseif($arr[0]=="addon") { |
|
| 595 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
| 596 | + } elseif ($arr[0] == "addon") { |
|
| 597 | 597 | $str = urldecode($arr[1]); |
| 598 | 598 | $arrAddonName = explode("|", $str); |
| 599 | 599 | $oAddonModel = getAdminModel("addon"); |
| 600 | 600 | $mInfo = array(); |
| 601 | - foreach($arrAddonName as $addonName) { |
|
| 601 | + foreach ($arrAddonName as $addonName) { |
|
| 602 | 602 | $addonInfo = $oAddonModel->getAddonInfoXml($addonName); |
| 603 | 603 | $mInfo[] = "{$addonName}({$addonInfo->version})"; |
| 604 | 604 | } |
| 605 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
| 606 | - } elseif($arr[0]=="widget") { |
|
| 605 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
| 606 | + } elseif ($arr[0] == "widget") { |
|
| 607 | 607 | $str = urldecode($arr[1]); |
| 608 | 608 | $arrWidgetName = explode("|", $str); |
| 609 | 609 | $oWidgetModel = getModel("widget"); |
| 610 | 610 | $mInfo = array(); |
| 611 | - foreach($arrWidgetName as $widgetName) { |
|
| 611 | + foreach ($arrWidgetName as $widgetName) { |
|
| 612 | 612 | $widgetInfo = $oWidgetModel->getWidgetInfo($widgetName); |
| 613 | 613 | $mInfo[] = "{$widgetName}({$widgetInfo->version})"; |
| 614 | 614 | } |
| 615 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
| 616 | - } elseif($arr[0]=="widgetstyle") { |
|
| 615 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
| 616 | + } elseif ($arr[0] == "widgetstyle") { |
|
| 617 | 617 | $str = urldecode($arr[1]); |
| 618 | 618 | $arrWidgetstyleName = explode("|", $str); |
| 619 | 619 | $oWidgetModel = getModel("widget"); |
| 620 | 620 | $mInfo = array(); |
| 621 | - foreach($arrWidgetstyleName as $widgetstyleName) { |
|
| 621 | + foreach ($arrWidgetstyleName as $widgetstyleName) { |
|
| 622 | 622 | $widgetstyleInfo = $oWidgetModel->getWidgetStyleInfo($widgetstyleName); |
| 623 | 623 | $mInfo[] = "{$widgetstyleName}({$widgetstyleInfo->version})"; |
| 624 | 624 | } |
| 625 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
| 625 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
| 626 | 626 | |
| 627 | - } elseif($arr[0]=="layout") { |
|
| 627 | + } elseif ($arr[0] == "layout") { |
|
| 628 | 628 | $str = urldecode($arr[1]); |
| 629 | 629 | $arrLayoutName = explode("|", $str); |
| 630 | 630 | $oLayoutModel = getModel("layout"); |
| 631 | 631 | $mInfo = array(); |
| 632 | - foreach($arrLayoutName as $layoutName) { |
|
| 632 | + foreach ($arrLayoutName as $layoutName) { |
|
| 633 | 633 | $layoutInfo = $oLayoutModel->getLayoutInfo($layoutName); |
| 634 | 634 | $mInfo[] = "{$layoutName}({$layoutInfo->version})"; |
| 635 | 635 | } |
| 636 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
| 636 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
| 637 | 637 | } else { |
| 638 | 638 | $xe_check_env[$arr[0]] = urldecode($arr[1]); |
| 639 | 639 | } |
@@ -647,15 +647,15 @@ discard block |
||
| 647 | 647 | $php_core['memory_limit'] = "{$ini_info['memory_limit']['local_value']}"; |
| 648 | 648 | $info['PHP_Core'] = $php_core; |
| 649 | 649 | |
| 650 | - $str_info = "[XE Server Environment " . date("Y-m-d") . "]\n\n"; |
|
| 650 | + $str_info = "[XE Server Environment ".date("Y-m-d")."]\n\n"; |
|
| 651 | 651 | $str_info .= "realpath : ".realpath('./')."\n"; |
| 652 | - foreach( $info as $key=>$value ) |
|
| 652 | + foreach ($info as $key=>$value) |
|
| 653 | 653 | { |
| 654 | - if( is_array( $value ) == false ) { |
|
| 654 | + if (is_array($value) == false) { |
|
| 655 | 655 | $str_info .= "{$key} : {$value}\n"; |
| 656 | 656 | } else { |
| 657 | 657 | //$str_info .= "\n{$key} \n"; |
| 658 | - foreach( $value as $key2=>$value2 ) |
|
| 658 | + foreach ($value as $key2=>$value2) |
|
| 659 | 659 | $str_info .= "{$key2} : {$value2}\n"; |
| 660 | 660 | } |
| 661 | 661 | } |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | Context::set('use_rewrite', $useRewrite); |
| 673 | 673 | |
| 674 | 674 | // nginx 체크, rewrite 사용법 안내 |
| 675 | - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
| 675 | + if ($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
| 676 | 676 | |
| 677 | 677 | Context::set('useable', $oInstallController->checkInstallEnv()); |
| 678 | 678 | $this->setTemplateFile('check_env.html'); |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | if(strpos($db_info->default_url, 'xn--') !== FALSE) |
| 32 | 32 | { |
| 33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url); |
| 34 | - } |
|
| 35 | - else |
|
| 34 | + } else |
|
| 36 | 35 | { |
| 37 | 36 | $xe_default_url = $db_info->default_url; |
| 38 | 37 | } |
@@ -434,9 +433,15 @@ discard block |
||
| 434 | 433 | |
| 435 | 434 | // site lock |
| 436 | 435 | Context::set('IP', $_SERVER['REMOTE_ADDR']); |
| 437 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
| 438 | - if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
| 439 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
| 436 | + if(!$db_info->sitelock_title) { |
|
| 437 | + $db_info->sitelock_title = 'Maintenance in progress...'; |
|
| 438 | + } |
|
| 439 | + if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) { |
|
| 440 | + $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
| 441 | + } |
|
| 442 | + if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) { |
|
| 443 | + $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
| 444 | + } |
|
| 440 | 445 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
| 441 | 446 | Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
| 442 | 447 | Context::set('use_sitelock', $db_info->use_sitelock); |
@@ -447,8 +452,11 @@ discard block |
||
| 447 | 452 | Context::set('sitelock_whitelist', $whitelist); |
| 448 | 453 | |
| 449 | 454 | |
| 450 | - if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
| 451 | - else $admin_ip_list = ''; |
|
| 455 | + if($db_info->admin_ip_list) { |
|
| 456 | + $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
| 457 | + } else { |
|
| 458 | + $admin_ip_list = ''; |
|
| 459 | + } |
|
| 452 | 460 | Context::set('admin_ip_list', $admin_ip_list); |
| 453 | 461 | |
| 454 | 462 | Context::set('lang_selected', Context::loadLangSelected()); |
@@ -547,8 +555,7 @@ discard block |
||
| 547 | 555 | Context::addHtmlFooter($img); |
| 548 | 556 | |
| 549 | 557 | FileHandler::writeFile($path . $mainVersion, '1'); |
| 550 | - } |
|
| 551 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
| 558 | + } else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
| 552 | 559 | { |
| 553 | 560 | if($_SESSION['enviroment_gather'] == 'Y') |
| 554 | 561 | { |
@@ -580,7 +587,7 @@ discard block |
||
| 580 | 587 | $arr = explode("=", $value); |
| 581 | 588 | if($arr[0]=="type") { |
| 582 | 589 | continue; |
| 583 | - }elseif($arr[0]=="phpext" ) { |
|
| 590 | + } elseif($arr[0]=="phpext" ) { |
|
| 584 | 591 | $str = urldecode($arr[1]); |
| 585 | 592 | $xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
| 586 | 593 | } elseif($arr[0]=="module" ) { |
@@ -655,8 +662,9 @@ discard block |
||
| 655 | 662 | $str_info .= "{$key} : {$value}\n"; |
| 656 | 663 | } else { |
| 657 | 664 | //$str_info .= "\n{$key} \n"; |
| 658 | - foreach( $value as $key2=>$value2 ) |
|
| 659 | - $str_info .= "{$key2} : {$value2}\n"; |
|
| 665 | + foreach( $value as $key2=>$value2 ) { |
|
| 666 | + $str_info .= "{$key2} : {$value2}\n"; |
|
| 667 | + } |
|
| 660 | 668 | } |
| 661 | 669 | } |
| 662 | 670 | |
@@ -672,7 +680,9 @@ discard block |
||
| 672 | 680 | Context::set('use_rewrite', $useRewrite); |
| 673 | 681 | |
| 674 | 682 | // nginx 체크, rewrite 사용법 안내 |
| 675 | - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
| 683 | + if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) { |
|
| 684 | + Context::set('use_nginx', 'Y'); |
|
| 685 | + } |
|
| 676 | 686 | |
| 677 | 687 | Context::set('useable', $oInstallController->checkInstallEnv()); |
| 678 | 688 | $this->setTemplateFile('check_env.html'); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Initialization |
| 17 | - * @return void |
|
| 17 | + * @return ModuleObject|null |
|
| 18 | 18 | */ |
| 19 | 19 | function init() |
| 20 | 20 | { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | // forbit access if the user is not an administrator |
| 22 | 22 | $oMemberModel = getModel('member'); |
| 23 | 23 | $logged_info = $oMemberModel->getLoggedInfo(); |
| 24 | - if($logged_info->is_admin != 'Y') |
|
| 24 | + if ($logged_info->is_admin != 'Y') |
|
| 25 | 25 | { |
| 26 | 26 | return $this->stop("msg_is_not_administrator"); |
| 27 | 27 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function insertLog($module, $act) |
| 35 | 35 | { |
| 36 | - if(!$module || !$act) |
|
| 36 | + if (!$module || !$act) |
|
| 37 | 37 | { |
| 38 | 38 | return; |
| 39 | 39 | } |
@@ -15,6 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Pre process parameters |
| 18 | + * @param string $order_target |
|
| 19 | + * @param string $order_type |
|
| 20 | + * @param string $page |
|
| 18 | 21 | */ |
| 19 | 22 | function preProcParam(&$order_target, &$order_type, &$page) |
| 20 | 23 | { |
@@ -115,6 +118,10 @@ discard block |
||
| 115 | 118 | |
| 116 | 119 | /** |
| 117 | 120 | * Get Package List |
| 121 | + * @param string $type |
|
| 122 | + * @param string $search_keyword |
|
| 123 | + * @param integer $category_srl |
|
| 124 | + * @param string $parent_program |
|
| 118 | 125 | */ |
| 119 | 126 | function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL) |
| 120 | 127 | { |
@@ -71,8 +71,7 @@ discard block |
||
| 71 | 71 | if($type == 'P') |
| 72 | 72 | { |
| 73 | 73 | $category_srl = $this->layout_category_srl; |
| 74 | - } |
|
| 75 | - else |
|
| 74 | + } else |
|
| 76 | 75 | { |
| 77 | 76 | $category_srl = $this->mobile_layout_category_srl; |
| 78 | 77 | } |
@@ -103,8 +102,7 @@ discard block |
||
| 103 | 102 | if($type == 'P') |
| 104 | 103 | { |
| 105 | 104 | $category_srl = $this->module_skin_category_srl; |
| 106 | - } |
|
| 107 | - else |
|
| 105 | + } else |
|
| 108 | 106 | { |
| 109 | 107 | $category_srl = $this->module_mobile_skin_category_srl; |
| 110 | 108 | } |
@@ -121,13 +119,11 @@ discard block |
||
| 121 | 119 | if($type == 'menu') |
| 122 | 120 | { |
| 123 | 121 | $params["act"] = "getResourceapiMenuPackageList"; |
| 124 | - } |
|
| 125 | - elseif($type == 'skin') |
|
| 122 | + } elseif($type == 'skin') |
|
| 126 | 123 | { |
| 127 | 124 | $params["act"] = "getResourceapiSkinPackageList"; |
| 128 | 125 | $params['parent_program'] = $parent_program; |
| 129 | - } |
|
| 130 | - else |
|
| 126 | + } else |
|
| 131 | 127 | { |
| 132 | 128 | $params["act"] = "getResourceapiPackagelist"; |
| 133 | 129 | } |
@@ -172,15 +168,13 @@ discard block |
||
| 172 | 168 | if($output->toBool()==TRUE) |
| 173 | 169 | { |
| 174 | 170 | $is_authed = 1; |
| 175 | - } |
|
| 176 | - else |
|
| 171 | + } else |
|
| 177 | 172 | { |
| 178 | 173 | $ftp_info = Context::getFTPInfo(); |
| 179 | 174 | if(!$ftp_info->ftp_root_path) |
| 180 | 175 | { |
| 181 | 176 | $is_authed = -1; |
| 182 | - } |
|
| 183 | - else |
|
| 177 | + } else |
|
| 184 | 178 | { |
| 185 | 179 | $is_authed = (int) isset($_SESSION['ftp_password']); |
| 186 | 180 | } |
@@ -216,8 +210,7 @@ discard block |
||
| 216 | 210 | if($packageInfo->type == 'core') |
| 217 | 211 | { |
| 218 | 212 | $title = 'XpressEngine'; |
| 219 | - } |
|
| 220 | - else |
|
| 213 | + } else |
|
| 221 | 214 | { |
| 222 | 215 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
| 223 | 216 | $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
@@ -238,8 +231,7 @@ discard block |
||
| 238 | 231 | $type = "layout"; |
| 239 | 232 | } |
| 240 | 233 | $title = $xmlDoc->{$type}->title->body; |
| 241 | - } |
|
| 242 | - else |
|
| 234 | + } else |
|
| 243 | 235 | { |
| 244 | 236 | $pathInfo = explode('/', $package->path); |
| 245 | 237 | $title = $pathInfo[count($pathInfo) - 1]; |
@@ -303,8 +295,7 @@ discard block |
||
| 303 | 295 | { |
| 304 | 296 | $package->depends[$key]->installed = FALSE; |
| 305 | 297 | $package->package_srl .= "," . $dep->package_srl; |
| 306 | - } |
|
| 307 | - else |
|
| 298 | + } else |
|
| 308 | 299 | { |
| 309 | 300 | $package->depends[$key]->installed = TRUE; |
| 310 | 301 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
@@ -318,8 +309,7 @@ discard block |
||
| 318 | 309 | $package->contain_core = TRUE; |
| 319 | 310 | $package->contain_core_version = $dep->version; |
| 320 | 311 | } |
| 321 | - } |
|
| 322 | - else |
|
| 312 | + } else |
|
| 323 | 313 | { |
| 324 | 314 | $package->need_update = FALSE; |
| 325 | 315 | } |
@@ -19,19 +19,19 @@ discard block |
||
| 19 | 19 | function preProcParam(&$order_target, &$order_type, &$page) |
| 20 | 20 | { |
| 21 | 21 | $order_target_array = array('newest' => 1, 'download' => 1, 'popular' => 1); |
| 22 | - if(!isset($order_target_array[$order_target])) |
|
| 22 | + if (!isset($order_target_array[$order_target])) |
|
| 23 | 23 | { |
| 24 | 24 | $order_target = 'newest'; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $order_type_array = array('asc' => 1, 'desc' => 1); |
| 28 | - if(!isset($order_type_array[$order_type])) |
|
| 28 | + if (!isset($order_type_array[$order_type])) |
|
| 29 | 29 | { |
| 30 | 30 | $order_type = 'desc'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $page = (int) $page; |
| 34 | - if($page < 1) |
|
| 34 | + if ($page < 1) |
|
| 35 | 35 | { |
| 36 | 36 | $page = 1; |
| 37 | 37 | } |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $type_array = array('M' => 1, 'P' => 1); |
| 65 | 65 | $type = Context::get('type'); |
| 66 | - if(!isset($type_array[$type])) |
|
| 66 | + if (!isset($type_array[$type])) |
|
| 67 | 67 | { |
| 68 | 68 | $type = 'P'; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if($type == 'P') |
|
| 71 | + if ($type == 'P') |
|
| 72 | 72 | { |
| 73 | 73 | $category_srl = $this->layout_category_srl; |
| 74 | 74 | } |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $type_array = array('M' => 1, 'P' => 1); |
| 97 | 97 | $type = Context::get('type'); |
| 98 | - if(!isset($type_array[$type])) |
|
| 98 | + if (!isset($type_array[$type])) |
|
| 99 | 99 | { |
| 100 | 100 | $type = 'P'; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if($type == 'P') |
|
| 103 | + if ($type == 'P') |
|
| 104 | 104 | { |
| 105 | 105 | $category_srl = $this->module_skin_category_srl; |
| 106 | 106 | } |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | function getPackageList($type, $order_target = 'newest', $order_type = 'desc', $page = '1', $search_keyword = NULL, $category_srl = NULL, $parent_program = NULL) |
| 120 | 120 | { |
| 121 | - if($type == 'menu') |
|
| 121 | + if ($type == 'menu') |
|
| 122 | 122 | { |
| 123 | 123 | $params["act"] = "getResourceapiMenuPackageList"; |
| 124 | 124 | } |
| 125 | - elseif($type == 'skin') |
|
| 125 | + elseif ($type == 'skin') |
|
| 126 | 126 | { |
| 127 | 127 | $params["act"] = "getResourceapiSkinPackageList"; |
| 128 | 128 | $params['parent_program'] = $parent_program; |
@@ -137,18 +137,18 @@ discard block |
||
| 137 | 137 | $params["order_type"] = $order_type; |
| 138 | 138 | $params["page"] = $page; |
| 139 | 139 | |
| 140 | - if($category_srl) |
|
| 140 | + if ($category_srl) |
|
| 141 | 141 | { |
| 142 | 142 | $params["category_srl"] = $category_srl; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if($search_keyword) |
|
| 145 | + if ($search_keyword) |
|
| 146 | 146 | { |
| 147 | 147 | $params["search_keyword"] = $search_keyword; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $xmlDoc = XmlGenerater::getXmlDoc($params); |
| 151 | - if($xmlDoc && $xmlDoc->response->packagelist->item) |
|
| 151 | + if ($xmlDoc && $xmlDoc->response->packagelist->item) |
|
| 152 | 152 | { |
| 153 | 153 | $item_list = $oAdminView->rearranges($xmlDoc->response->packagelist->item); |
| 154 | 154 | $this->add('item_list', $item_list); |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $is_authed = 0; |
| 171 | 171 | $output = $oAdminModel->checkUseDirectModuleInstall($package); |
| 172 | - if($output->toBool()==TRUE) |
|
| 172 | + if ($output->toBool() == TRUE) |
|
| 173 | 173 | { |
| 174 | 174 | $is_authed = 1; |
| 175 | 175 | } |
| 176 | 176 | else |
| 177 | 177 | { |
| 178 | 178 | $ftp_info = Context::getFTPInfo(); |
| 179 | - if(!$ftp_info->ftp_root_path) |
|
| 179 | + if (!$ftp_info->ftp_root_path) |
|
| 180 | 180 | { |
| 181 | 181 | $is_authed = -1; |
| 182 | 182 | } |
@@ -196,14 +196,14 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | $oModel = getModel('autoinstall'); |
| 198 | 198 | $output = executeQueryArray('autoinstall.getNeedUpdate'); |
| 199 | - if(!is_array($output->data)) |
|
| 199 | + if (!is_array($output->data)) |
|
| 200 | 200 | { |
| 201 | 201 | return NULL; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $result = array(); |
| 205 | 205 | $xml = new XmlParser(); |
| 206 | - foreach($output->data as $package) |
|
| 206 | + foreach ($output->data as $package) |
|
| 207 | 207 | { |
| 208 | 208 | $packageSrl = $package->package_srl; |
| 209 | 209 | |
@@ -213,27 +213,27 @@ discard block |
||
| 213 | 213 | $packageInfo->type = $oModel->getTypeFromPath($package->path); |
| 214 | 214 | $packageInfo->url = $oModel->getUpdateUrlByPackageSrl($package->package_srl); |
| 215 | 215 | |
| 216 | - if($packageInfo->type == 'core') |
|
| 216 | + if ($packageInfo->type == 'core') |
|
| 217 | 217 | { |
| 218 | 218 | $title = 'XpressEngine'; |
| 219 | 219 | } |
| 220 | 220 | else |
| 221 | 221 | { |
| 222 | 222 | $configFile = $oModel->getConfigFilePath($packageInfo->type); |
| 223 | - $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path) . $configFile); |
|
| 223 | + $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($package->path).$configFile); |
|
| 224 | 224 | |
| 225 | - if($xmlDoc) |
|
| 225 | + if ($xmlDoc) |
|
| 226 | 226 | { |
| 227 | 227 | $type = $packageInfo->type; |
| 228 | - if($type == "drcomponent") |
|
| 228 | + if ($type == "drcomponent") |
|
| 229 | 229 | { |
| 230 | 230 | $type = "component"; |
| 231 | 231 | } |
| 232 | - if($type == "style" || $type == "m.skin") |
|
| 232 | + if ($type == "style" || $type == "m.skin") |
|
| 233 | 233 | { |
| 234 | 234 | $type = "skin"; |
| 235 | 235 | } |
| 236 | - if($type == "m.layout") |
|
| 236 | + if ($type == "m.layout") |
|
| 237 | 237 | { |
| 238 | 238 | $type = "layout"; |
| 239 | 239 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $oModel = getModel('autoinstall'); |
| 268 | 268 | |
| 269 | 269 | $targetpackages = array(); |
| 270 | - if($xmlDoc) |
|
| 270 | + if ($xmlDoc) |
|
| 271 | 271 | { |
| 272 | 272 | $xmlPackage = $xmlDoc->response->package; |
| 273 | 273 | $package = new stdClass(); |
@@ -276,15 +276,15 @@ discard block |
||
| 276 | 276 | $package->package_description = $xmlPackage->package_description->body; |
| 277 | 277 | $package->version = $xmlPackage->version->body; |
| 278 | 278 | $package->path = $xmlPackage->path->body; |
| 279 | - if($xmlPackage->depends) |
|
| 279 | + if ($xmlPackage->depends) |
|
| 280 | 280 | { |
| 281 | - if(!is_array($xmlPackage->depends->item)) |
|
| 281 | + if (!is_array($xmlPackage->depends->item)) |
|
| 282 | 282 | { |
| 283 | 283 | $xmlPackage->depends->item = array($xmlPackage->depends->item); |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $package->depends = array(); |
| 287 | - foreach($xmlPackage->depends->item as $item) |
|
| 287 | + foreach ($xmlPackage->depends->item as $item) |
|
| 288 | 288 | { |
| 289 | 289 | $dep_item = new stdClass(); |
| 290 | 290 | $dep_item->package_srl = $item->package_srl->body; |
@@ -297,23 +297,23 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | $packages = $oModel->getInstalledPackages(array_keys($targetpackages)); |
| 299 | 299 | $package->deplist = ""; |
| 300 | - foreach($package->depends as $key => $dep) |
|
| 300 | + foreach ($package->depends as $key => $dep) |
|
| 301 | 301 | { |
| 302 | - if(!$packages[$dep->package_srl]) |
|
| 302 | + if (!$packages[$dep->package_srl]) |
|
| 303 | 303 | { |
| 304 | 304 | $package->depends[$key]->installed = FALSE; |
| 305 | - $package->package_srl .= "," . $dep->package_srl; |
|
| 305 | + $package->package_srl .= ",".$dep->package_srl; |
|
| 306 | 306 | } |
| 307 | 307 | else |
| 308 | 308 | { |
| 309 | 309 | $package->depends[$key]->installed = TRUE; |
| 310 | 310 | $package->depends[$key]->cur_version = $packages[$dep->package_srl]->current_version; |
| 311 | - if(version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
| 311 | + if (version_compare($dep->version, $packages[$dep->package_srl]->current_version, ">")) |
|
| 312 | 312 | { |
| 313 | 313 | $package->depends[$key]->need_update = TRUE; |
| 314 | - $package->package_srl .= "," . $dep->package_srl; |
|
| 314 | + $package->package_srl .= ",".$dep->package_srl; |
|
| 315 | 315 | |
| 316 | - if($dep->path === '.') |
|
| 316 | + if ($dep->path === '.') |
|
| 317 | 317 | { |
| 318 | 318 | $package->contain_core = TRUE; |
| 319 | 319 | $package->contain_core_version = $dep->version; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $installedPackage = $oModel->getInstalledPackage($packageSrl); |
| 331 | - if($installedPackage) |
|
| 331 | + if ($installedPackage) |
|
| 332 | 332 | { |
| 333 | 333 | $package->installed = TRUE; |
| 334 | 334 | $package->cur_version = $installedPackage->current_version; |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | public function getAutoInstallAdminInstallInfo() |
| 346 | 346 | { |
| 347 | 347 | $packageSrl = Context::get('package_srl'); |
| 348 | - if(!$packageSrl) |
|
| 348 | + if (!$packageSrl) |
|
| 349 | 349 | { |
| 350 | 350 | return new BaseObject(-1, 'msg_invalid_request'); |
| 351 | 351 | } |
@@ -359,23 +359,23 @@ discard block |
||
| 359 | 359 | $directModuleInstall = TRUE; |
| 360 | 360 | $arrUnwritableDir = array(); |
| 361 | 361 | $output = $this->isWritableDir($package->path); |
| 362 | - if($output->toBool()==FALSE) |
|
| 362 | + if ($output->toBool() == FALSE) |
|
| 363 | 363 | { |
| 364 | 364 | $directModuleInstall = FALSE; |
| 365 | 365 | $arrUnwritableDir[] = $output->get('path'); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - foreach($package->depends as $dep) |
|
| 368 | + foreach ($package->depends as $dep) |
|
| 369 | 369 | { |
| 370 | 370 | $output = $this->isWritableDir($dep->path); |
| 371 | - if($output->toBool()==FALSE) |
|
| 371 | + if ($output->toBool() == FALSE) |
|
| 372 | 372 | { |
| 373 | 373 | $directModuleInstall = FALSE; |
| 374 | 374 | $arrUnwritableDir[] = $output->get('path'); |
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if($directModuleInstall==FALSE) |
|
| 378 | + if ($directModuleInstall == FALSE) |
|
| 379 | 379 | { |
| 380 | 380 | $output = new BaseObject(-1, 'msg_direct_inall_invalid'); |
| 381 | 381 | $output->add('path', $arrUnwritableDir); |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | $path_list = explode('/', dirname($path)); |
| 391 | 391 | $real_path = './'; |
| 392 | 392 | |
| 393 | - while($path_list) |
|
| 393 | + while ($path_list) |
|
| 394 | 394 | { |
| 395 | - $check_path = realpath($real_path . implode('/', $path_list)); |
|
| 396 | - if(FileHandler::isDir($check_path)) |
|
| 395 | + $check_path = realpath($real_path.implode('/', $path_list)); |
|
| 396 | + if (FileHandler::isDir($check_path)) |
|
| 397 | 397 | { |
| 398 | 398 | break; |
| 399 | 399 | } |
| 400 | 400 | array_pop($path_list); |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - if(FileHandler::isWritableDir($check_path)==FALSE) |
|
| 403 | + if (FileHandler::isWritableDir($check_path) == FALSE) |
|
| 404 | 404 | { |
| 405 | 405 | $output = new BaseObject(-1, 'msg_unwritable_directory'); |
| 406 | 406 | $output->add('path', FileHandler::getRealPath($check_path)); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Get the board module admin simple setting page |
| 24 | - * @return void |
|
| 24 | + * @return null|string |
|
| 25 | 25 | */ |
| 26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
| 27 | 27 | { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function getBoardAdminSimpleSetup($moduleSrl, $setupUrl) |
| 27 | 27 | { |
| 28 | - if(!$moduleSrl) |
|
| 28 | + if (!$moduleSrl) |
|
| 29 | 29 | { |
| 30 | 30 | return; |
| 31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $oModuleModel = getModel('module'); |
| 36 | 36 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
| 37 | 37 | $moduleInfo->use_status = explode('|@|', $moduleInfo->use_status); |
| 38 | - if($moduleInfo) |
|
| 38 | + if ($moduleInfo) |
|
| 39 | 39 | { |
| 40 | 40 | Context::set('module_info', $moduleInfo); |
| 41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | Context::set('document_status_list', $documentStatusList); |
| 47 | 47 | |
| 48 | 48 | // set order target list |
| 49 | - foreach($this->order_target AS $key) |
|
| 49 | + foreach ($this->order_target AS $key) |
|
| 50 | 50 | { |
| 51 | 51 | $order_target[$key] = Context::getLang($key); |
| 52 | 52 | } |
@@ -747,6 +747,9 @@ |
||
| 747 | 747 | $this->setTemplateFile('write_form'); |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | + /** |
|
| 751 | + * @param ModuleObject $oDocumentModel |
|
| 752 | + */ |
|
| 750 | 753 | function _getStatusNameList(&$oDocumentModel) |
| 751 | 754 | { |
| 752 | 755 | $resultList = array(); |
@@ -53,18 +53,15 @@ discard block |
||
| 53 | 53 | if($this->module_info->hide_category) |
| 54 | 54 | { |
| 55 | 55 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
| 56 | - } |
|
| 57 | - else if($this->module_info->use_category) |
|
| 56 | + } else if($this->module_info->use_category) |
|
| 58 | 57 | { |
| 59 | 58 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
| 60 | - } |
|
| 61 | - else |
|
| 59 | + } else |
|
| 62 | 60 | { |
| 63 | 61 | $this->module_info->hide_category = 'N'; |
| 64 | 62 | $this->module_info->use_category = 'Y'; |
| 65 | 63 | } |
| 66 | - } |
|
| 67 | - else |
|
| 64 | + } else |
|
| 68 | 65 | { |
| 69 | 66 | $this->module_info->hide_category = 'Y'; |
| 70 | 67 | $this->module_info->use_category = 'N'; |
@@ -84,8 +81,7 @@ discard block |
||
| 84 | 81 | $this->grant->write_comment = FALSE; |
| 85 | 82 | $this->grant->view = FALSE; |
| 86 | 83 | } |
| 87 | - } |
|
| 88 | - else |
|
| 84 | + } else |
|
| 89 | 85 | { |
| 90 | 86 | $this->consultation = FALSE; |
| 91 | 87 | } |
@@ -160,13 +156,17 @@ discard block |
||
| 160 | 156 | * add extra vaiables to the search options |
| 161 | 157 | **/ |
| 162 | 158 | // use search options on the template (the search options key has been declared, based on the language selected) |
| 163 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
| 159 | + foreach($this->search_option as $opt) { |
|
| 160 | + $search_option[$opt] = Context::getLang($opt); |
|
| 161 | + } |
|
| 164 | 162 | $extra_keys = Context::get('extra_keys'); |
| 165 | 163 | if($extra_keys) |
| 166 | 164 | { |
| 167 | 165 | foreach($extra_keys as $key => $val) |
| 168 | 166 | { |
| 169 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 167 | + if($val->search == 'Y') { |
|
| 168 | + $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 169 | + } |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | // remove a search option that is not public in member config |
@@ -175,8 +175,9 @@ discard block |
||
| 175 | 175 | { |
| 176 | 176 | if(in_array($signupFormElement->title, $search_option)) |
| 177 | 177 | { |
| 178 | - if($signupFormElement->isPublic == 'N') |
|
| 179 | - unset($search_option[$signupFormElement->name]); |
|
| 178 | + if($signupFormElement->isPublic == 'N') { |
|
| 179 | + unset($search_option[$signupFormElement->name]); |
|
| 180 | + } |
|
| 180 | 181 | } |
| 181 | 182 | } |
| 182 | 183 | Context::set('search_option', $search_option); |
@@ -194,7 +195,9 @@ discard block |
||
| 194 | 195 | // list config, columnList setting |
| 195 | 196 | $oBoardModel = getModel('board'); |
| 196 | 197 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
| 197 | - if(!$this->listConfig) $this->listConfig = array(); |
|
| 198 | + if(!$this->listConfig) { |
|
| 199 | + $this->listConfig = array(); |
|
| 200 | + } |
|
| 198 | 201 | $this->_makeListColumnList(); |
| 199 | 202 | |
| 200 | 203 | // display the notice list |
@@ -265,7 +268,9 @@ discard block |
||
| 265 | 268 | } |
| 266 | 269 | |
| 267 | 270 | // check the manage grant |
| 268 | - if($this->grant->manager) $oDocument->setGrant(); |
|
| 271 | + if($this->grant->manager) { |
|
| 272 | + $oDocument->setGrant(); |
|
| 273 | + } |
|
| 269 | 274 | |
| 270 | 275 | // if the consultation function is enabled, and the document is not a notice |
| 271 | 276 | if($this->consultation && !$oDocument->isNotice()) |
@@ -286,8 +291,7 @@ discard block |
||
| 286 | 291 | } |
| 287 | 292 | } |
| 288 | 293 | |
| 289 | - } |
|
| 290 | - else |
|
| 294 | + } else |
|
| 291 | 295 | { |
| 292 | 296 | // if the document is not existed, then alert a warning message |
| 293 | 297 | Context::set('document_srl','',true); |
@@ -297,8 +301,7 @@ discard block |
||
| 297 | 301 | /** |
| 298 | 302 | * if the document is not existed, get an empty document |
| 299 | 303 | **/ |
| 300 | - } |
|
| 301 | - else |
|
| 304 | + } else |
|
| 302 | 305 | { |
| 303 | 306 | $oDocument = $oDocumentModel->getDocument(0); |
| 304 | 307 | } |
@@ -313,8 +316,7 @@ discard block |
||
| 313 | 316 | $oDocument = $oDocumentModel->getDocument(0); |
| 314 | 317 | Context::set('document_srl','',true); |
| 315 | 318 | $this->alertMessage('msg_not_permitted'); |
| 316 | - } |
|
| 317 | - else |
|
| 319 | + } else |
|
| 318 | 320 | { |
| 319 | 321 | // add the document title to the browser |
| 320 | 322 | Context::addBrowserTitle($oDocument->getTitleText()); |
@@ -368,13 +370,16 @@ discard block |
||
| 368 | 370 | $downloadGrantCount = 0; |
| 369 | 371 | if(is_array($file_module_config->download_grant)) |
| 370 | 372 | { |
| 371 | - foreach($file_module_config->download_grant AS $value) |
|
| 372 | - if($value) $downloadGrantCount++; |
|
| 373 | + foreach($file_module_config->download_grant AS $value) { |
|
| 374 | + if($value) $downloadGrantCount++; |
|
| 375 | + } |
|
| 373 | 376 | } |
| 374 | 377 | |
| 375 | 378 | if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
| 376 | 379 | { |
| 377 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 380 | + if(!Context::get('is_logged')) { |
|
| 381 | + return $this->stop('msg_not_permitted_download'); |
|
| 382 | + } |
|
| 378 | 383 | $logged_info = Context::get('logged_info'); |
| 379 | 384 | if($logged_info->is_admin != 'Y') |
| 380 | 385 | { |
@@ -397,7 +402,9 @@ discard block |
||
| 397 | 402 | break; |
| 398 | 403 | } |
| 399 | 404 | } |
| 400 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 405 | + if(!$is_permitted) { |
|
| 406 | + return $this->stop('msg_not_permitted_download'); |
|
| 407 | + } |
|
| 401 | 408 | } |
| 402 | 409 | } |
| 403 | 410 | } |
@@ -560,7 +567,9 @@ discard block |
||
| 560 | 567 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
| 561 | 568 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
| 562 | 569 | |
| 563 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 570 | + if(in_array('summary', $configColumList)) { |
|
| 571 | + array_push($this->columnList, 'content'); |
|
| 572 | + } |
|
| 564 | 573 | |
| 565 | 574 | // default column list add |
| 566 | 575 | $defaultColumn = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'member_srl', 'last_update', 'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'title_bold', 'title_color'); |
@@ -654,8 +663,7 @@ discard block |
||
| 654 | 663 | { |
| 655 | 664 | $logged_info = Context::get('logged_info'); |
| 656 | 665 | $group_srls = array_keys($logged_info->group_list); |
| 657 | - } |
|
| 658 | - else |
|
| 666 | + } else |
|
| 659 | 667 | { |
| 660 | 668 | $group_srls = array(); |
| 661 | 669 | } |
@@ -672,10 +680,14 @@ discard block |
||
| 672 | 680 | { |
| 673 | 681 | $category_group_srls = explode(',',$category->group_srls); |
| 674 | 682 | $is_granted = FALSE; |
| 675 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 683 | + if(count(array_intersect($group_srls, $category_group_srls))) { |
|
| 684 | + $is_granted = TRUE; |
|
| 685 | + } |
|
| 676 | 686 | |
| 677 | 687 | } |
| 678 | - if($is_granted) $category_list[$category_srl] = $category; |
|
| 688 | + if($is_granted) { |
|
| 689 | + $category_list[$category_srl] = $category; |
|
| 690 | + } |
|
| 679 | 691 | } |
| 680 | 692 | } |
| 681 | 693 | Context::set('category_list', $category_list); |
@@ -686,7 +698,9 @@ discard block |
||
| 686 | 698 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
| 687 | 699 | $oDocument->setDocument($document_srl); |
| 688 | 700 | |
| 689 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 701 | + if($oDocument->get('module_srl') == $oDocument->get('member_srl')) { |
|
| 702 | + $savedDoc = TRUE; |
|
| 703 | + } |
|
| 690 | 704 | $oDocument->add('module_srl', $this->module_srl); |
| 691 | 705 | |
| 692 | 706 | if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
@@ -712,17 +726,20 @@ discard block |
||
| 712 | 726 | if( !$logged_info ) |
| 713 | 727 | { |
| 714 | 728 | return $this->dispBoardMessage('msg_not_permitted'); |
| 715 | - } |
|
| 716 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
| 729 | + } else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
| 717 | 730 | { |
| 718 | 731 | return $this->dispBoardMessage('msg_not_enough_point'); |
| 719 | 732 | } |
| 720 | 733 | } |
| 721 | 734 | } |
| 722 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 735 | + if(!$oDocument->get('status')) { |
|
| 736 | + $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 737 | + } |
|
| 723 | 738 | |
| 724 | 739 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 725 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 740 | + if(count($statusList) > 0) { |
|
| 741 | + Context::set('status_list', $statusList); |
|
| 742 | + } |
|
| 726 | 743 | |
| 727 | 744 | // get Document status config value |
| 728 | 745 | Context::set('document_srl',$document_srl); |
@@ -733,13 +750,18 @@ discard block |
||
| 733 | 750 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
| 734 | 751 | |
| 735 | 752 | // if the document exists, then setup extra variabels on context |
| 736 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 753 | + if($oDocument->isExists() && !$savedDoc) { |
|
| 754 | + Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 755 | + } |
|
| 737 | 756 | |
| 738 | 757 | /** |
| 739 | 758 | * add JS filters |
| 740 | 759 | **/ |
| 741 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 742 | - else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
| 760 | + if(Context::get('logged_info')->is_admin=='Y') { |
|
| 761 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 762 | + } else { |
|
| 763 | + Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
|
| 764 | + } |
|
| 743 | 765 | |
| 744 | 766 | $oSecurity = new Security(); |
| 745 | 767 | $oSecurity->encodeHTML('category_list.text', 'category_list.title'); |
@@ -1054,7 +1076,9 @@ discard block |
||
| 1054 | 1076 | function dispBoardMessage($msg_code) |
| 1055 | 1077 | { |
| 1056 | 1078 | $msg = Context::getLang($msg_code); |
| 1057 | - if(!$msg) $msg = $msg_code; |
|
| 1079 | + if(!$msg) { |
|
| 1080 | + $msg = $msg_code; |
|
| 1081 | + } |
|
| 1058 | 1082 | Context::set('message', $msg); |
| 1059 | 1083 | $this->setTemplateFile('message'); |
| 1060 | 1084 | } |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * setup the module general information |
| 25 | 25 | **/ |
| 26 | - if($this->module_info->list_count) |
|
| 26 | + if ($this->module_info->list_count) |
|
| 27 | 27 | { |
| 28 | 28 | $this->list_count = $this->module_info->list_count; |
| 29 | 29 | } |
| 30 | - if($this->module_info->search_list_count) |
|
| 30 | + if ($this->module_info->search_list_count) |
|
| 31 | 31 | { |
| 32 | 32 | $this->search_list_count = $this->module_info->search_list_count; |
| 33 | 33 | } |
| 34 | - if($this->module_info->page_count) |
|
| 34 | + if ($this->module_info->page_count) |
|
| 35 | 35 | { |
| 36 | 36 | $this->page_count = $this->module_info->page_count; |
| 37 | 37 | } |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | $oDocumentModel = getModel('document'); |
| 42 | 42 | |
| 43 | 43 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 44 | - if(isset($statusList['SECRET'])) |
|
| 44 | + if (isset($statusList['SECRET'])) |
|
| 45 | 45 | { |
| 46 | 46 | $this->module_info->secret = 'Y'; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // use_category <=1.5.x, hide_category >=1.7.x |
| 50 | 50 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
| 51 | - if($count_category) |
|
| 51 | + if ($count_category) |
|
| 52 | 52 | { |
| 53 | - if($this->module_info->hide_category) |
|
| 53 | + if ($this->module_info->hide_category) |
|
| 54 | 54 | { |
| 55 | 55 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
| 56 | 56 | } |
| 57 | - else if($this->module_info->use_category) |
|
| 57 | + else if ($this->module_info->use_category) |
|
| 58 | 58 | { |
| 59 | 59 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
| 60 | 60 | } |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * check the consultation function, if the user is admin then swich off consultation function |
| 75 | 75 | * if the user is not logged, then disppear write document/write comment./ view document |
| 76 | 76 | **/ |
| 77 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 77 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 78 | 78 | { |
| 79 | 79 | $this->consultation = TRUE; |
| 80 | - if(!Context::get('is_logged')) |
|
| 80 | + if (!Context::get('is_logged')) |
|
| 81 | 81 | { |
| 82 | 82 | $this->grant->list = FALSE; |
| 83 | 83 | $this->grant->write_document = FALSE; |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | * setup the template path based on the skin |
| 95 | 95 | * the default skin is default |
| 96 | 96 | **/ |
| 97 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
| 98 | - if(!is_dir($template_path)||!$this->module_info->skin) |
|
| 97 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
| 98 | + if (!is_dir($template_path) || !$this->module_info->skin) |
|
| 99 | 99 | { |
| 100 | 100 | $this->module_info->skin = 'default'; |
| 101 | - $template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
|
| 101 | + $template_path = sprintf("%sskins/%s/", $this->module_path, $this->module_info->skin); |
|
| 102 | 102 | } |
| 103 | 103 | $this->setTemplatePath($template_path); |
| 104 | 104 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | **/ |
| 115 | 115 | if (is_array($extra_keys)) |
| 116 | 116 | { |
| 117 | - foreach($extra_keys as $val) |
|
| 117 | + foreach ($extra_keys as $val) |
|
| 118 | 118 | { |
| 119 | 119 | $this->order_target[] = $val->eid; |
| 120 | 120 | } |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | // remove [document_srl]_cpage from get_vars |
| 129 | 129 | $args = Context::getRequestVars(); |
| 130 | - foreach($args as $name => $value) |
|
| 130 | + foreach ($args as $name => $value) |
|
| 131 | 131 | { |
| 132 | - if(preg_match('/[0-9]+_cpage/', $name)) |
|
| 132 | + if (preg_match('/[0-9]+_cpage/', $name)) |
|
| 133 | 133 | { |
| 134 | 134 | Context::set($name, '', TRUE); |
| 135 | 135 | Context::set($name, $value); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | /** |
| 146 | 146 | * check the access grant (all the grant has been set by the module object) |
| 147 | 147 | **/ |
| 148 | - if(!$this->grant->access || !$this->grant->list) |
|
| 148 | + if (!$this->grant->access || !$this->grant->list) |
|
| 149 | 149 | { |
| 150 | 150 | return $this->dispBoardMessage('msg_not_permitted'); |
| 151 | 151 | } |
@@ -160,22 +160,22 @@ discard block |
||
| 160 | 160 | * add extra vaiables to the search options |
| 161 | 161 | **/ |
| 162 | 162 | // use search options on the template (the search options key has been declared, based on the language selected) |
| 163 | - foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
| 163 | + foreach ($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
| 164 | 164 | $extra_keys = Context::get('extra_keys'); |
| 165 | - if($extra_keys) |
|
| 165 | + if ($extra_keys) |
|
| 166 | 166 | { |
| 167 | - foreach($extra_keys as $key => $val) |
|
| 167 | + foreach ($extra_keys as $key => $val) |
|
| 168 | 168 | { |
| 169 | - if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 169 | + if ($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | // remove a search option that is not public in member config |
| 173 | 173 | $memberConfig = getModel('module')->getModuleConfig('member'); |
| 174 | - foreach($memberConfig->signupForm as $signupFormElement) |
|
| 174 | + foreach ($memberConfig->signupForm as $signupFormElement) |
|
| 175 | 175 | { |
| 176 | - if(in_array($signupFormElement->title, $search_option)) |
|
| 176 | + if (in_array($signupFormElement->title, $search_option)) |
|
| 177 | 177 | { |
| 178 | - if($signupFormElement->isPublic == 'N') |
|
| 178 | + if ($signupFormElement->isPublic == 'N') |
|
| 179 | 179 | unset($search_option[$signupFormElement->name]); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $oDocumentModel = getModel('document'); |
| 185 | 185 | $statusNameList = $this->_getStatusNameList($oDocumentModel); |
| 186 | - if(count($statusNameList) > 0) |
|
| 186 | + if (count($statusNameList) > 0) |
|
| 187 | 187 | { |
| 188 | 188 | Context::set('status_list', $statusNameList); |
| 189 | 189 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // list config, columnList setting |
| 195 | 195 | $oBoardModel = getModel('board'); |
| 196 | 196 | $this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
| 197 | - if(!$this->listConfig) $this->listConfig = array(); |
|
| 197 | + if (!$this->listConfig) $this->listConfig = array(); |
|
| 198 | 198 | $this->_makeListColumnList(); |
| 199 | 199 | |
| 200 | 200 | // display the notice list |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * @brief display the category list |
| 220 | 220 | **/ |
| 221 | - function dispBoardCategoryList(){ |
|
| 221 | + function dispBoardCategoryList() { |
|
| 222 | 222 | // check if the use_category option is enabled |
| 223 | - if($this->module_info->use_category=='Y') |
|
| 223 | + if ($this->module_info->use_category == 'Y') |
|
| 224 | 224 | { |
| 225 | 225 | // check the grant |
| 226 | - if(!$this->grant->list) |
|
| 226 | + if (!$this->grant->list) |
|
| 227 | 227 | { |
| 228 | 228 | Context::set('category_list', array()); |
| 229 | 229 | return; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | /** |
| 241 | 241 | * @brief display the board conent view |
| 242 | 242 | **/ |
| 243 | - function dispBoardContentView(){ |
|
| 243 | + function dispBoardContentView() { |
|
| 244 | 244 | // get the variable value |
| 245 | 245 | $document_srl = Context::get('document_srl'); |
| 246 | 246 | $page = Context::get('page'); |
@@ -251,36 +251,36 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * if the document exists, then get the document information |
| 253 | 253 | **/ |
| 254 | - if($document_srl) |
|
| 254 | + if ($document_srl) |
|
| 255 | 255 | { |
| 256 | 256 | $oDocument = $oDocumentModel->getDocument($document_srl, false, true); |
| 257 | 257 | |
| 258 | 258 | // if the document is existed |
| 259 | - if($oDocument->isExists()) |
|
| 259 | + if ($oDocument->isExists()) |
|
| 260 | 260 | { |
| 261 | 261 | // if the module srl is not consistent |
| 262 | - if($oDocument->get('module_srl')!=$this->module_info->module_srl ) |
|
| 262 | + if ($oDocument->get('module_srl') != $this->module_info->module_srl) |
|
| 263 | 263 | { |
| 264 | 264 | return $this->stop('msg_invalid_request'); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // check the manage grant |
| 268 | - if($this->grant->manager) $oDocument->setGrant(); |
|
| 268 | + if ($this->grant->manager) $oDocument->setGrant(); |
|
| 269 | 269 | |
| 270 | 270 | // if the consultation function is enabled, and the document is not a notice |
| 271 | - if($this->consultation && !$oDocument->isNotice()) |
|
| 271 | + if ($this->consultation && !$oDocument->isNotice()) |
|
| 272 | 272 | { |
| 273 | 273 | $logged_info = Context::get('logged_info'); |
| 274 | - if(abs($oDocument->get('member_srl')) != $logged_info->member_srl) |
|
| 274 | + if (abs($oDocument->get('member_srl')) != $logged_info->member_srl) |
|
| 275 | 275 | { |
| 276 | 276 | $oDocument = $oDocumentModel->getDocument(0); |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // if the document is TEMP saved, check Grant |
| 281 | - if($oDocument->getStatus() == 'TEMP') |
|
| 281 | + if ($oDocument->getStatus() == 'TEMP') |
|
| 282 | 282 | { |
| 283 | - if(!$oDocument->isGranted()) |
|
| 283 | + if (!$oDocument->isGranted()) |
|
| 284 | 284 | { |
| 285 | 285 | $oDocument = $oDocumentModel->getDocument(0); |
| 286 | 286 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | else |
| 291 | 291 | { |
| 292 | 292 | // if the document is not existed, then alert a warning message |
| 293 | - Context::set('document_srl','',true); |
|
| 293 | + Context::set('document_srl', '', true); |
|
| 294 | 294 | $this->alertMessage('msg_not_founded'); |
| 295 | 295 | } |
| 296 | 296 | |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | /** |
| 307 | 307 | *check the document view grant |
| 308 | 308 | **/ |
| 309 | - if($oDocument->isExists()) |
|
| 309 | + if ($oDocument->isExists()) |
|
| 310 | 310 | { |
| 311 | - if(!$this->grant->view && !$oDocument->isGranted()) |
|
| 311 | + if (!$this->grant->view && !$oDocument->isGranted()) |
|
| 312 | 312 | { |
| 313 | 313 | $oDocument = $oDocumentModel->getDocument(0); |
| 314 | - Context::set('document_srl','',true); |
|
| 314 | + Context::set('document_srl', '', true); |
|
| 315 | 315 | $this->alertMessage('msg_not_permitted'); |
| 316 | 316 | } |
| 317 | 317 | else |
@@ -320,15 +320,15 @@ discard block |
||
| 320 | 320 | Context::addBrowserTitle($oDocument->getTitleText()); |
| 321 | 321 | |
| 322 | 322 | // update the document view count (if the document is not secret) |
| 323 | - if(!$oDocument->isSecret() || $oDocument->isGranted()) |
|
| 323 | + if (!$oDocument->isSecret() || $oDocument->isGranted()) |
|
| 324 | 324 | { |
| 325 | 325 | $oDocument->updateReadedCount(); |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | // disappear the document if it is secret |
| 329 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 329 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 330 | 330 | { |
| 331 | - $oDocument->add('content',Context::getLang('thisissecret')); |
|
| 331 | + $oDocument->add('content', Context::getLang('thisissecret')); |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | } |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | /** |
| 349 | 349 | * @brief display the document file list (can be used by API) |
| 350 | 350 | **/ |
| 351 | - function dispBoardContentFileList(){ |
|
| 351 | + function dispBoardContentFileList() { |
|
| 352 | 352 | /** |
| 353 | 353 | * check the access grant (all the grant has been set by the module object) |
| 354 | 354 | **/ |
| 355 | - if(!$this->grant->access) |
|
| 355 | + if (!$this->grant->access) |
|
| 356 | 356 | { |
| 357 | 357 | return $this->dispBoardMessage('msg_not_permitted'); |
| 358 | 358 | } |
@@ -363,41 +363,41 @@ discard block |
||
| 363 | 363 | // Check if a permission for file download is granted |
| 364 | 364 | // Get configurations (using module model object) |
| 365 | 365 | $oModuleModel = getModel('module'); |
| 366 | - $file_module_config = $oModuleModel->getModulePartConfig('file',$this->module_srl); |
|
| 366 | + $file_module_config = $oModuleModel->getModulePartConfig('file', $this->module_srl); |
|
| 367 | 367 | |
| 368 | 368 | $downloadGrantCount = 0; |
| 369 | - if(is_array($file_module_config->download_grant)) |
|
| 369 | + if (is_array($file_module_config->download_grant)) |
|
| 370 | 370 | { |
| 371 | - foreach($file_module_config->download_grant AS $value) |
|
| 372 | - if($value) $downloadGrantCount++; |
|
| 371 | + foreach ($file_module_config->download_grant AS $value) |
|
| 372 | + if ($value) $downloadGrantCount++; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
| 375 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
| 376 | 376 | { |
| 377 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 377 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 378 | 378 | $logged_info = Context::get('logged_info'); |
| 379 | - if($logged_info->is_admin != 'Y') |
|
| 379 | + if ($logged_info->is_admin != 'Y') |
|
| 380 | 380 | { |
| 381 | - $oModuleModel =& getModel('module'); |
|
| 381 | + $oModuleModel = & getModel('module'); |
|
| 382 | 382 | $columnList = array('module_srl', 'site_srl'); |
| 383 | 383 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl, $columnList); |
| 384 | 384 | |
| 385 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 385 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 386 | 386 | { |
| 387 | - $oMemberModel =& getModel('member'); |
|
| 387 | + $oMemberModel = & getModel('member'); |
|
| 388 | 388 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
| 389 | 389 | |
| 390 | 390 | $is_permitted = false; |
| 391 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
| 391 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
| 392 | 392 | { |
| 393 | 393 | $group_srl = $file_module_config->download_grant[$i]; |
| 394 | - if($member_groups[$group_srl]) |
|
| 394 | + if ($member_groups[$group_srl]) |
|
| 395 | 395 | { |
| 396 | 396 | $is_permitted = true; |
| 397 | 397 | break; |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 400 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $document_srl = Context::get('document_srl'); |
| 407 | 407 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 408 | 408 | Context::set('oDocument', $oDocument); |
| 409 | - Context::set('file_list',$oDocument->getUploadedFiles()); |
|
| 409 | + Context::set('file_list', $oDocument->getUploadedFiles()); |
|
| 410 | 410 | |
| 411 | 411 | $oSecurity = new Security(); |
| 412 | 412 | $oSecurity->encodeHTML('file_list..source_filename'); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | /** |
| 416 | 416 | * @brief display the document comment list (can be used by API) |
| 417 | 417 | **/ |
| 418 | - function dispBoardContentCommentList(){ |
|
| 418 | + function dispBoardContentCommentList() { |
|
| 419 | 419 | // check document view grant |
| 420 | 420 | $this->dispBoardContentView(); |
| 421 | 421 | |
@@ -425,26 +425,26 @@ discard block |
||
| 425 | 425 | $comment_list = $oDocument->getComments(); |
| 426 | 426 | |
| 427 | 427 | // setup the comment list |
| 428 | - if(is_array($comment_list)) |
|
| 428 | + if (is_array($comment_list)) |
|
| 429 | 429 | { |
| 430 | - foreach($comment_list as $key => $val) |
|
| 430 | + foreach ($comment_list as $key => $val) |
|
| 431 | 431 | { |
| 432 | - if(!$val->isAccessible()) |
|
| 432 | + if (!$val->isAccessible()) |
|
| 433 | 433 | { |
| 434 | - $val->add('content',Context::getLang('thisissecret')); |
|
| 434 | + $val->add('content', Context::getLang('thisissecret')); |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | - Context::set('comment_list',$comment_list); |
|
| 438 | + Context::set('comment_list', $comment_list); |
|
| 439 | 439 | |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
| 443 | 443 | * @brief display notice list (can be used by API) |
| 444 | 444 | **/ |
| 445 | - function dispBoardNoticeList(){ |
|
| 445 | + function dispBoardNoticeList() { |
|
| 446 | 446 | // check the grant |
| 447 | - if(!$this->grant->list) |
|
| 447 | + if (!$this->grant->list) |
|
| 448 | 448 | { |
| 449 | 449 | Context::set('notice_list', array()); |
| 450 | 450 | return; |
@@ -460,15 +460,15 @@ discard block |
||
| 460 | 460 | /** |
| 461 | 461 | * @brief display board content list |
| 462 | 462 | **/ |
| 463 | - function dispBoardContentList(){ |
|
| 463 | + function dispBoardContentList() { |
|
| 464 | 464 | // check the grant |
| 465 | - if(!$this->grant->list) |
|
| 465 | + if (!$this->grant->list) |
|
| 466 | 466 | { |
| 467 | 467 | Context::set('document_list', array()); |
| 468 | 468 | Context::set('total_count', 0); |
| 469 | 469 | Context::set('total_page', 1); |
| 470 | 470 | Context::set('page', 1); |
| 471 | - Context::set('page_navigation', new PageHandler(0,0,1,10)); |
|
| 471 | + Context::set('page_navigation', new PageHandler(0, 0, 1, 10)); |
|
| 472 | 472 | return; |
| 473 | 473 | } |
| 474 | 474 | |
@@ -486,17 +486,17 @@ discard block |
||
| 486 | 486 | $args->search_keyword = Context::get('search_keyword'); |
| 487 | 487 | |
| 488 | 488 | $search_option = Context::get('search_option'); |
| 489 | - if($search_option==FALSE) |
|
| 489 | + if ($search_option == FALSE) |
|
| 490 | 490 | { |
| 491 | 491 | $search_option = $this->search_option; |
| 492 | 492 | } |
| 493 | - if(isset($search_option[$args->search_target])==FALSE) |
|
| 493 | + if (isset($search_option[$args->search_target]) == FALSE) |
|
| 494 | 494 | { |
| 495 | 495 | $args->search_target = ''; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | // if the category is enabled, then get the category |
| 499 | - if($this->module_info->use_category=='Y') |
|
| 499 | + if ($this->module_info->use_category == 'Y') |
|
| 500 | 500 | { |
| 501 | 501 | $args->category_srl = Context::get('category'); |
| 502 | 502 | } |
@@ -504,21 +504,21 @@ discard block |
||
| 504 | 504 | // setup the sort index and order index |
| 505 | 505 | $args->sort_index = Context::get('sort_index'); |
| 506 | 506 | $args->order_type = Context::get('order_type'); |
| 507 | - if(!in_array($args->sort_index, $this->order_target)) |
|
| 507 | + if (!in_array($args->sort_index, $this->order_target)) |
|
| 508 | 508 | { |
| 509 | - $args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
|
| 509 | + $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order'; |
|
| 510 | 510 | } |
| 511 | - if(!in_array($args->order_type, array('asc','desc'))) |
|
| 511 | + if (!in_array($args->order_type, array('asc', 'desc'))) |
|
| 512 | 512 | { |
| 513 | - $args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
|
| 513 | + $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc'; |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | // set the current page of documents |
| 517 | 517 | $document_srl = Context::get('document_srl'); |
| 518 | - if(!$args->page && $document_srl) |
|
| 518 | + if (!$args->page && $document_srl) |
|
| 519 | 519 | { |
| 520 | 520 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 521 | - if($oDocument->isExists() && !$oDocument->isNotice()) |
|
| 521 | + if ($oDocument->isExists() && !$oDocument->isNotice()) |
|
| 522 | 522 | { |
| 523 | 523 | $page = $oDocumentModel->getDocumentPage($oDocument, $args); |
| 524 | 524 | Context::set('page', $page); |
@@ -527,21 +527,21 @@ discard block |
||
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | // setup the list count to be serach list count, if the category or search keyword has been set |
| 530 | - if($args->category_srl || $args->search_keyword) |
|
| 530 | + if ($args->category_srl || $args->search_keyword) |
|
| 531 | 531 | { |
| 532 | 532 | $args->list_count = $this->search_list_count; |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | // if the consultation function is enabled, the get the logged user information |
| 536 | - if($this->consultation) |
|
| 536 | + if ($this->consultation) |
|
| 537 | 537 | { |
| 538 | 538 | $logged_info = Context::get('logged_info'); |
| 539 | 539 | $args->member_srl = $logged_info->member_srl; |
| 540 | 540 | |
| 541 | - if($this->module_info->use_anonymous === 'Y') |
|
| 541 | + if ($this->module_info->use_anonymous === 'Y') |
|
| 542 | 542 | { |
| 543 | 543 | unset($args->member_srl); |
| 544 | - $args->member_srls = $logged_info->member_srl . ',' . $logged_info->member_srl * -1; |
|
| 544 | + $args->member_srls = $logged_info->member_srl.','.$logged_info->member_srl * -1; |
|
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
@@ -567,18 +567,18 @@ discard block |
||
| 567 | 567 | 'allow_trackback', 'notify_message', 'status', 'comment_status'); |
| 568 | 568 | $this->columnList = array_intersect($configColumList, $tableColumnList); |
| 569 | 569 | |
| 570 | - if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 570 | + if (in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
|
| 571 | 571 | |
| 572 | 572 | // default column list add |
| 573 | 573 | $defaultColumn = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'member_srl', 'last_update', 'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'title_bold', 'title_color'); |
| 574 | 574 | |
| 575 | 575 | //TODO guestbook, blog style supports legacy codes. |
| 576 | - if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
| 576 | + if ($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
|
| 577 | 577 | { |
| 578 | 578 | $defaultColumn = $tableColumnList; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - if (in_array('last_post', $configColumList)){ |
|
| 581 | + if (in_array('last_post', $configColumList)) { |
|
| 582 | 582 | array_push($this->columnList, 'last_updater'); |
| 583 | 583 | } |
| 584 | 584 | |
@@ -590,9 +590,9 @@ discard block |
||
| 590 | 590 | $this->columnList = array_unique(array_merge($this->columnList, $defaultColumn)); |
| 591 | 591 | |
| 592 | 592 | // add table name |
| 593 | - foreach($this->columnList as $no => $value) |
|
| 593 | + foreach ($this->columnList as $no => $value) |
|
| 594 | 594 | { |
| 595 | - $this->columnList[$no] = 'documents.' . $value; |
|
| 595 | + $this->columnList[$no] = 'documents.'.$value; |
|
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | function dispBoardTagList() |
| 603 | 603 | { |
| 604 | 604 | // check if there is not grant fot view list, then alert an warning message |
| 605 | - if(!$this->grant->list) |
|
| 605 | + if (!$this->grant->list) |
|
| 606 | 606 | { |
| 607 | 607 | return $this->dispBoardMessage('msg_not_permitted'); |
| 608 | 608 | } |
@@ -616,14 +616,14 @@ discard block |
||
| 616 | 616 | $output = $oTagModel->getTagList($obj); |
| 617 | 617 | |
| 618 | 618 | // automatically order |
| 619 | - if(count($output->data)) |
|
| 619 | + if (count($output->data)) |
|
| 620 | 620 | { |
| 621 | 621 | $numbers = array_keys($output->data); |
| 622 | 622 | shuffle($numbers); |
| 623 | 623 | |
| 624 | - if(count($output->data)) |
|
| 624 | + if (count($output->data)) |
|
| 625 | 625 | { |
| 626 | - foreach($numbers as $k => $v) |
|
| 626 | + foreach ($numbers as $k => $v) |
|
| 627 | 627 | { |
| 628 | 628 | $tag_list[] = $output->data[$v]; |
| 629 | 629 | } |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | function dispBoardWrite() |
| 645 | 645 | { |
| 646 | 646 | // check grant |
| 647 | - if(!$this->grant->write_document) |
|
| 647 | + if (!$this->grant->write_document) |
|
| 648 | 648 | { |
| 649 | 649 | return $this->dispBoardMessage('msg_not_permitted'); |
| 650 | 650 | } |
@@ -654,10 +654,10 @@ discard block |
||
| 654 | 654 | /** |
| 655 | 655 | * check if the category option is enabled not not |
| 656 | 656 | **/ |
| 657 | - if($this->module_info->use_category=='Y') |
|
| 657 | + if ($this->module_info->use_category == 'Y') |
|
| 658 | 658 | { |
| 659 | 659 | // get the user group information |
| 660 | - if(Context::get('is_logged')) |
|
| 660 | + if (Context::get('is_logged')) |
|
| 661 | 661 | { |
| 662 | 662 | $logged_info = Context::get('logged_info'); |
| 663 | 663 | $group_srls = array_keys($logged_info->group_list); |
@@ -670,19 +670,19 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | // check the grant after obtained the category list |
| 672 | 672 | $normal_category_list = $oDocumentModel->getCategoryList($this->module_srl); |
| 673 | - if(count($normal_category_list)) |
|
| 673 | + if (count($normal_category_list)) |
|
| 674 | 674 | { |
| 675 | - foreach($normal_category_list as $category_srl => $category) |
|
| 675 | + foreach ($normal_category_list as $category_srl => $category) |
|
| 676 | 676 | { |
| 677 | 677 | $is_granted = TRUE; |
| 678 | - if($category->group_srls) |
|
| 678 | + if ($category->group_srls) |
|
| 679 | 679 | { |
| 680 | - $category_group_srls = explode(',',$category->group_srls); |
|
| 680 | + $category_group_srls = explode(',', $category->group_srls); |
|
| 681 | 681 | $is_granted = FALSE; |
| 682 | - if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 682 | + if (count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
|
| 683 | 683 | |
| 684 | 684 | } |
| 685 | - if($is_granted) $category_list[$category_srl] = $category; |
|
| 685 | + if ($is_granted) $category_list[$category_srl] = $category; |
|
| 686 | 686 | } |
| 687 | 687 | } |
| 688 | 688 | Context::set('category_list', $category_list); |
@@ -693,46 +693,46 @@ discard block |
||
| 693 | 693 | $oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
| 694 | 694 | $oDocument->setDocument($document_srl); |
| 695 | 695 | |
| 696 | - if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 696 | + if ($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
|
| 697 | 697 | $oDocument->add('module_srl', $this->module_srl); |
| 698 | 698 | |
| 699 | - if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 699 | + if ($oDocument->isExists() && $this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 700 | 700 | { |
| 701 | 701 | return new BaseObject(-1, 'msg_protect_content'); |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | // if the document is not granted, then back to the password input form |
| 705 | 705 | $oModuleModel = getModel('module'); |
| 706 | - if($oDocument->isExists()&&!$oDocument->isGranted()) |
|
| 706 | + if ($oDocument->isExists() && !$oDocument->isGranted()) |
|
| 707 | 707 | { |
| 708 | 708 | return $this->setTemplateFile('input_password_form'); |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | - if(!$oDocument->isExists()) |
|
| 711 | + if (!$oDocument->isExists()) |
|
| 712 | 712 | { |
| 713 | - $point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl); |
|
| 713 | + $point_config = $oModuleModel->getModulePartConfig('point', $this->module_srl); |
|
| 714 | 714 | $logged_info = Context::get('logged_info'); |
| 715 | 715 | $oPointModel = getModel('point'); |
| 716 | 716 | $pointForInsert = $point_config["insert_document"]; |
| 717 | - if($pointForInsert < 0) |
|
| 717 | + if ($pointForInsert < 0) |
|
| 718 | 718 | { |
| 719 | - if( !$logged_info ) |
|
| 719 | + if (!$logged_info) |
|
| 720 | 720 | { |
| 721 | 721 | return $this->dispBoardMessage('msg_not_permitted'); |
| 722 | 722 | } |
| 723 | - else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
|
| 723 | + else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert) < 0) |
|
| 724 | 724 | { |
| 725 | 725 | return $this->dispBoardMessage('msg_not_enough_point'); |
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | 728 | } |
| 729 | - if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 729 | + if (!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
|
| 730 | 730 | |
| 731 | 731 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 732 | - if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 732 | + if (count($statusList) > 0) Context::set('status_list', $statusList); |
|
| 733 | 733 | |
| 734 | 734 | // get Document status config value |
| 735 | - Context::set('document_srl',$document_srl); |
|
| 735 | + Context::set('document_srl', $document_srl); |
|
| 736 | 736 | Context::set('oDocument', $oDocument); |
| 737 | 737 | |
| 738 | 738 | // apply xml_js_filter on header |
@@ -740,12 +740,12 @@ discard block |
||
| 740 | 740 | $oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
| 741 | 741 | |
| 742 | 742 | // if the document exists, then setup extra variabels on context |
| 743 | - if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 743 | + if ($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
| 744 | 744 | |
| 745 | 745 | /** |
| 746 | 746 | * add JS filters |
| 747 | 747 | **/ |
| 748 | - if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 748 | + if (Context::get('logged_info')->is_admin == 'Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
|
| 749 | 749 | else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
| 750 | 750 | |
| 751 | 751 | $oSecurity = new Security(); |
@@ -757,14 +757,14 @@ discard block |
||
| 757 | 757 | function _getStatusNameList(&$oDocumentModel) |
| 758 | 758 | { |
| 759 | 759 | $resultList = array(); |
| 760 | - if(!empty($this->module_info->use_status)) |
|
| 760 | + if (!empty($this->module_info->use_status)) |
|
| 761 | 761 | { |
| 762 | 762 | $statusNameList = $oDocumentModel->getStatusNameList(); |
| 763 | 763 | $statusList = explode('|@|', $this->module_info->use_status); |
| 764 | 764 | |
| 765 | - if(is_array($statusList)) |
|
| 765 | + if (is_array($statusList)) |
|
| 766 | 766 | { |
| 767 | - foreach($statusList as $key => $value) |
|
| 767 | + foreach ($statusList as $key => $value) |
|
| 768 | 768 | { |
| 769 | 769 | $resultList[$value] = $statusNameList[$value]; |
| 770 | 770 | } |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | function dispBoardDelete() |
| 780 | 780 | { |
| 781 | 781 | // check grant |
| 782 | - if(!$this->grant->write_document) |
|
| 782 | + if (!$this->grant->write_document) |
|
| 783 | 783 | { |
| 784 | 784 | return $this->dispBoardMessage('msg_not_permitted'); |
| 785 | 785 | } |
@@ -788,30 +788,30 @@ discard block |
||
| 788 | 788 | $document_srl = Context::get('document_srl'); |
| 789 | 789 | |
| 790 | 790 | // if document exists, get the document information |
| 791 | - if($document_srl) |
|
| 791 | + if ($document_srl) |
|
| 792 | 792 | { |
| 793 | 793 | $oDocumentModel = getModel('document'); |
| 794 | 794 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | // if the document is not existed, then back to the board content page |
| 798 | - if(!$oDocument || !$oDocument->isExists()) |
|
| 798 | + if (!$oDocument || !$oDocument->isExists()) |
|
| 799 | 799 | { |
| 800 | 800 | return $this->dispBoardContent(); |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | // if the document is not granted, then back to the password input form |
| 804 | - if(!$oDocument->isGranted()) |
|
| 804 | + if (!$oDocument->isGranted()) |
|
| 805 | 805 | { |
| 806 | 806 | return $this->setTemplateFile('input_password_form'); |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 809 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 810 | 810 | { |
| 811 | 811 | return $this->dispBoardMessage('msg_protect_content'); |
| 812 | 812 | } |
| 813 | 813 | |
| 814 | - Context::set('oDocument',$oDocument); |
|
| 814 | + Context::set('oDocument', $oDocument); |
|
| 815 | 815 | |
| 816 | 816 | /** |
| 817 | 817 | * add JS filters |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | $document_srl = Context::get('document_srl'); |
| 830 | 830 | |
| 831 | 831 | // check grant |
| 832 | - if(!$this->grant->write_comment) |
|
| 832 | + if (!$this->grant->write_comment) |
|
| 833 | 833 | { |
| 834 | 834 | return $this->dispBoardMessage('msg_not_permitted'); |
| 835 | 835 | } |
@@ -837,13 +837,13 @@ discard block |
||
| 837 | 837 | // get the document information |
| 838 | 838 | $oDocumentModel = getModel('document'); |
| 839 | 839 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 840 | - if(!$oDocument->isExists()) |
|
| 840 | + if (!$oDocument->isExists()) |
|
| 841 | 841 | { |
| 842 | 842 | return $this->dispBoardMessage('msg_invalid_request'); |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | // Check allow comment |
| 846 | - if(!$oDocument->allowComment()) |
|
| 846 | + if (!$oDocument->allowComment()) |
|
| 847 | 847 | { |
| 848 | 848 | return $this->dispBoardMessage('msg_not_allow_comment'); |
| 849 | 849 | } |
@@ -855,9 +855,9 @@ discard block |
||
| 855 | 855 | $oComment->add('module_srl', $this->module_srl); |
| 856 | 856 | |
| 857 | 857 | // setup document variables on context |
| 858 | - Context::set('oDocument',$oDocument); |
|
| 859 | - Context::set('oSourceComment',$oSourceComment); |
|
| 860 | - Context::set('oComment',$oComment); |
|
| 858 | + Context::set('oDocument', $oDocument); |
|
| 859 | + Context::set('oSourceComment', $oSourceComment); |
|
| 860 | + Context::set('oComment', $oComment); |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * add JS filter |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | function dispBoardReplyComment() |
| 874 | 874 | { |
| 875 | 875 | // check grant |
| 876 | - if(!$this->grant->write_comment) |
|
| 876 | + if (!$this->grant->write_comment) |
|
| 877 | 877 | { |
| 878 | 878 | return $this->dispBoardMessage('msg_not_permitted'); |
| 879 | 879 | } |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $parent_srl = Context::get('comment_srl'); |
| 883 | 883 | |
| 884 | 884 | // if the parent comment is not existed |
| 885 | - if(!$parent_srl) |
|
| 885 | + if (!$parent_srl) |
|
| 886 | 886 | { |
| 887 | 887 | return new BaseObject(-1, 'msg_invalid_request'); |
| 888 | 888 | } |
@@ -892,11 +892,11 @@ discard block |
||
| 892 | 892 | $oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager); |
| 893 | 893 | |
| 894 | 894 | // if the comment is not existed, opoup an error message |
| 895 | - if(!$oSourceComment->isExists()) |
|
| 895 | + if (!$oSourceComment->isExists()) |
|
| 896 | 896 | { |
| 897 | 897 | return $this->dispBoardMessage('msg_invalid_request'); |
| 898 | 898 | } |
| 899 | - if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
| 899 | + if (Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
|
| 900 | 900 | { |
| 901 | 901 | return $this->dispBoardMessage('msg_invalid_request'); |
| 902 | 902 | } |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | // Check allow comment |
| 905 | 905 | $oDocumentModel = getModel('document'); |
| 906 | 906 | $oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl')); |
| 907 | - if(!$oDocument->allowComment()) |
|
| 907 | + if (!$oDocument->allowComment()) |
|
| 908 | 908 | { |
| 909 | 909 | return $this->dispBoardMessage('msg_not_allow_comment'); |
| 910 | 910 | } |
@@ -915,9 +915,9 @@ discard block |
||
| 915 | 915 | $oComment->add('document_srl', $oSourceComment->get('document_srl')); |
| 916 | 916 | |
| 917 | 917 | // setup comment variables |
| 918 | - Context::set('oSourceComment',$oSourceComment); |
|
| 919 | - Context::set('oComment',$oComment); |
|
| 920 | - Context::set('module_srl',$this->module_info->module_srl); |
|
| 918 | + Context::set('oSourceComment', $oSourceComment); |
|
| 919 | + Context::set('oComment', $oComment); |
|
| 920 | + Context::set('module_srl', $this->module_info->module_srl); |
|
| 921 | 921 | |
| 922 | 922 | /** |
| 923 | 923 | * add JS filters |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | function dispBoardModifyComment() |
| 934 | 934 | { |
| 935 | 935 | // check grant |
| 936 | - if(!$this->grant->write_comment) |
|
| 936 | + if (!$this->grant->write_comment) |
|
| 937 | 937 | { |
| 938 | 938 | return $this->dispBoardMessage('msg_not_permitted'); |
| 939 | 939 | } |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | $comment_srl = Context::get('comment_srl'); |
| 944 | 944 | |
| 945 | 945 | // if the comment is not existed |
| 946 | - if(!$comment_srl) |
|
| 946 | + if (!$comment_srl) |
|
| 947 | 947 | { |
| 948 | 948 | return new BaseObject(-1, 'msg_invalid_request'); |
| 949 | 949 | } |
@@ -953,13 +953,13 @@ discard block |
||
| 953 | 953 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
| 954 | 954 | |
| 955 | 955 | // if the comment is not exited, alert an error message |
| 956 | - if(!$oComment->isExists()) |
|
| 956 | + if (!$oComment->isExists()) |
|
| 957 | 957 | { |
| 958 | 958 | return $this->dispBoardMessage('msg_invalid_request'); |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | // if the comment is not granted, then back to the password input form |
| 962 | - if(!$oComment->isGranted()) |
|
| 962 | + if (!$oComment->isGranted()) |
|
| 963 | 963 | { |
| 964 | 964 | return $this->setTemplateFile('input_password_form'); |
| 965 | 965 | } |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | function dispBoardDeleteComment() |
| 983 | 983 | { |
| 984 | 984 | // check grant |
| 985 | - if(!$this->grant->write_comment) |
|
| 985 | + if (!$this->grant->write_comment) |
|
| 986 | 986 | { |
| 987 | 987 | return $this->dispBoardMessage('msg_not_permitted'); |
| 988 | 988 | } |
@@ -991,25 +991,25 @@ discard block |
||
| 991 | 991 | $comment_srl = Context::get('comment_srl'); |
| 992 | 992 | |
| 993 | 993 | // if the comment exists, then get the comment information |
| 994 | - if($comment_srl) |
|
| 994 | + if ($comment_srl) |
|
| 995 | 995 | { |
| 996 | 996 | $oCommentModel = getModel('comment'); |
| 997 | 997 | $oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | // if the comment is not existed, then back to the board content page |
| 1001 | - if(!$oComment->isExists() ) |
|
| 1001 | + if (!$oComment->isExists()) |
|
| 1002 | 1002 | { |
| 1003 | 1003 | return $this->dispBoardContent(); |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | // if the comment is not granted, then back to the password input form |
| 1007 | - if(!$oComment->isGranted()) |
|
| 1007 | + if (!$oComment->isGranted()) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | return $this->setTemplateFile('input_password_form'); |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | - Context::set('oComment',$oComment); |
|
| 1012 | + Context::set('oComment', $oComment); |
|
| 1013 | 1013 | |
| 1014 | 1014 | /** |
| 1015 | 1015 | * add JS filters |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | { |
| 1027 | 1027 | $oTrackbackModel = getModel('trackback'); |
| 1028 | 1028 | |
| 1029 | - if(!$oTrackbackModel) |
|
| 1029 | + if (!$oTrackbackModel) |
|
| 1030 | 1030 | { |
| 1031 | 1031 | return; |
| 1032 | 1032 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | $trackback = $output->data; |
| 1041 | 1041 | |
| 1042 | 1042 | // if no trackback, then display the board content |
| 1043 | - if(!$trackback) |
|
| 1043 | + if (!$trackback) |
|
| 1044 | 1044 | { |
| 1045 | 1045 | return $this->dispBoardContent(); |
| 1046 | 1046 | } |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | function dispBoardMessage($msg_code) |
| 1062 | 1062 | { |
| 1063 | 1063 | $msg = Context::getLang($msg_code); |
| 1064 | - if(!$msg) $msg = $msg_code; |
|
| 1064 | + if (!$msg) $msg = $msg_code; |
|
| 1065 | 1065 | Context::set('message', $msg); |
| 1066 | 1066 | $this->setTemplateFile('message'); |
| 1067 | 1067 | } |
@@ -1072,8 +1072,8 @@ discard block |
||
| 1072 | 1072 | **/ |
| 1073 | 1073 | function alertMessage($message) |
| 1074 | 1074 | { |
| 1075 | - $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
| 1076 | - Context::addHtmlFooter( $script ); |
|
| 1075 | + $script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
|
| 1076 | + Context::addHtmlFooter($script); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | } |
@@ -279,6 +279,9 @@ discard block |
||
| 279 | 279 | $this->setRedirectUrl($returnUrl); |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | + /** |
|
| 283 | + * @param string $message_content |
|
| 284 | + */ |
|
| 282 | 285 | private function _sendMessageForComment($message_content, $comment_srl_list) |
| 283 | 286 | { |
| 284 | 287 | $oCommunicationController = getController('communication'); |
@@ -308,6 +311,9 @@ discard block |
||
| 308 | 311 | |
| 309 | 312 | /** |
| 310 | 313 | * comment move to trash |
| 314 | + * @param ModuleObject $oCommentController |
|
| 315 | + * @param DB $oDB |
|
| 316 | + * @param string $message_content |
|
| 311 | 317 | * @return void|object |
| 312 | 318 | */ |
| 313 | 319 | function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL) |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | //mail to author of thread - START |
| 135 | 135 | /** |
| 136 | - * @todo Removed code send email to document author. |
|
| 137 | - */ |
|
| 136 | + * @todo Removed code send email to document author. |
|
| 137 | + */ |
|
| 138 | 138 | /* |
| 139 | 139 | if($document_author_email != $comment->email_address && $logged_info->email_address != $document_author_email) |
| 140 | 140 | { |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
| 344 | - * @fn procCommentAdminMoveToTrash |
|
| 345 | - * @brief move a comment to trash |
|
| 346 | - * @see commentModel::getCommentMenu |
|
| 347 | - */ |
|
| 344 | + * @fn procCommentAdminMoveToTrash |
|
| 345 | + * @brief move a comment to trash |
|
| 346 | + * @see commentModel::getCommentMenu |
|
| 347 | + */ |
|
| 348 | 348 | function procCommentAdminMoveToTrash() |
| 349 | 349 | { |
| 350 | 350 | $oDB = DB::getInstance(); |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | if(!is_array($cart)) |
| 33 | 33 | { |
| 34 | 34 | $comment_srl_list = explode('|@|', $cart); |
| 35 | - } |
|
| 36 | - else |
|
| 35 | + } else |
|
| 37 | 36 | { |
| 38 | 37 | $comment_srl_list = $cart; |
| 39 | 38 | } |
@@ -61,8 +60,7 @@ discard block |
||
| 61 | 60 | if(!is_array($cart)) |
| 62 | 61 | { |
| 63 | 62 | $comment_srl_list = explode('|@|', $cart); |
| 64 | - } |
|
| 65 | - else |
|
| 63 | + } else |
|
| 66 | 64 | { |
| 67 | 65 | $comment_srl_list = $cart; |
| 68 | 66 | } |
@@ -74,8 +72,7 @@ discard block |
||
| 74 | 72 | if(!$output->toBool()) |
| 75 | 73 | { |
| 76 | 74 | return $output; |
| 77 | - } |
|
| 78 | - else |
|
| 75 | + } else |
|
| 79 | 76 | { |
| 80 | 77 | //update comment count for document |
| 81 | 78 | $updated_documents_arr = array(); |
@@ -202,8 +199,7 @@ discard block |
||
| 202 | 199 | if(!is_array($cart)) |
| 203 | 200 | { |
| 204 | 201 | $comment_srl_list = explode('|@|', $cart); |
| 205 | - } |
|
| 206 | - else |
|
| 202 | + } else |
|
| 207 | 203 | { |
| 208 | 204 | $comment_srl_list = $cart; |
| 209 | 205 | } |
@@ -262,8 +258,7 @@ discard block |
||
| 262 | 258 | if($isTrash == 'true') |
| 263 | 259 | { |
| 264 | 260 | $msgCode = 'success_trashed'; |
| 265 | - } |
|
| 266 | - else |
|
| 261 | + } else |
|
| 267 | 262 | { |
| 268 | 263 | $msgCode = 'success_deleted'; |
| 269 | 264 | } |
@@ -355,7 +350,9 @@ discard block |
||
| 355 | 350 | $oCommentController = getController('comment'); |
| 356 | 351 | $oComment = $oCommentModel->getComment($comment_srl, false); |
| 357 | 352 | |
| 358 | - if(!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 353 | + if(!$oComment->isGranted()) { |
|
| 354 | + return $this->stop('msg_not_permitted'); |
|
| 355 | + } |
|
| 359 | 356 | |
| 360 | 357 | $message_content = ""; |
| 361 | 358 | $this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content); |
@@ -410,8 +407,7 @@ discard block |
||
| 410 | 407 | if($_SESSION['comment_management'][$key]) |
| 411 | 408 | { |
| 412 | 409 | unset($_SESSION['comment_management'][$key]); |
| 413 | - } |
|
| 414 | - else |
|
| 410 | + } else |
|
| 415 | 411 | { |
| 416 | 412 | $_SESSION['comment_management'][$key] = TRUE; |
| 417 | 413 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | // Error display if none is selected |
| 31 | 31 | $cart = Context::get('cart'); |
| 32 | - if(!is_array($cart)) |
|
| 32 | + if (!is_array($cart)) |
|
| 33 | 33 | { |
| 34 | 34 | $comment_srl_list = explode('|@|', $cart); |
| 35 | 35 | } |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // Error display if none is selected |
| 56 | 56 | $cart = Context::get('cart'); |
| 57 | - if(!$cart) |
|
| 57 | + if (!$cart) |
|
| 58 | 58 | { |
| 59 | 59 | return $this->stop('msg_cart_is_null'); |
| 60 | 60 | } |
| 61 | - if(!is_array($cart)) |
|
| 61 | + if (!is_array($cart)) |
|
| 62 | 62 | { |
| 63 | 63 | $comment_srl_list = explode('|@|', $cart); |
| 64 | 64 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $args->status = $will_publish; |
| 72 | 72 | $args->comment_srls_list = $comment_srl_list; |
| 73 | 73 | $output = executeQuery('comment.updatePublishedStatus', $args); |
| 74 | - if(!$output->toBool()) |
|
| 74 | + if (!$output->toBool()) |
|
| 75 | 75 | { |
| 76 | 76 | return $output; |
| 77 | 77 | } |
@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | //$oMemberModule = getModel("member"); |
| 91 | 91 | //$logged_info = $oMemberModule->getMemberInfoByMemberSrl($logged_member_srl); |
| 92 | 92 | $new_status = ($will_publish) ? "published" : "unpublished"; |
| 93 | - foreach($comment_srl_list as $comment_srl) |
|
| 93 | + foreach ($comment_srl_list as $comment_srl) |
|
| 94 | 94 | { |
| 95 | 95 | // check if comment already exists |
| 96 | 96 | $comment = $oCommentModel->getComment($comment_srl); |
| 97 | - if($comment->comment_srl != $comment_srl) |
|
| 97 | + if ($comment->comment_srl != $comment_srl) |
|
| 98 | 98 | { |
| 99 | 99 | return new BaseObject(-1, 'msg_invalid_request'); |
| 100 | 100 | } |
| 101 | 101 | $document_srl = $comment->document_srl; |
| 102 | - if(!in_array($document_srl, $updated_documents_arr)) |
|
| 102 | + if (!in_array($document_srl, $updated_documents_arr)) |
|
| 103 | 103 | { |
| 104 | 104 | $updated_documents_arr[] = $document_srl; |
| 105 | 105 | // update the number of comments |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | // send email to comment's author, all admins and thread(document) subscribers - START |
| 118 | 118 | // ------------------------------------------------------- |
| 119 | 119 | $oMail = new Mail(); |
| 120 | - $mail_title = "[XE - " . $module_info->mid . "] comment(s) status changed to " . $new_status . " on document: \"" . $oDocument->getTitleText() . "\""; |
|
| 120 | + $mail_title = "[XE - ".$module_info->mid."] comment(s) status changed to ".$new_status." on document: \"".$oDocument->getTitleText()."\""; |
|
| 121 | 121 | $oMail->setTitle($mail_title); |
| 122 | 122 | $mail_content = " |
| 123 | - The comment #" . $comment_srl . " on document \"" . $oDocument->getTitleText() . "\" has been " . $new_status . " by admin of <strong><i>" . strtoupper($module_info->mid) . "</i></strong> module. |
|
| 123 | + The comment #" . $comment_srl." on document \"".$oDocument->getTitleText()."\" has been ".$new_status." by admin of <strong><i>".strtoupper($module_info->mid)."</i></strong> module. |
|
| 124 | 124 | <br /> |
| 125 | 125 | <br />Comment content: |
| 126 | - " . $comment->content . " |
|
| 126 | + " . $comment->content." |
|
| 127 | 127 | <br /> |
| 128 | 128 | "; |
| 129 | 129 | $oMail->setContent($mail_content); |
@@ -145,17 +145,17 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | //mail to author of thread - STOP |
| 147 | 147 | //mail to all emails set for administrators - START |
| 148 | - if($module_info->admin_mail) |
|
| 148 | + if ($module_info->admin_mail) |
|
| 149 | 149 | { |
| 150 | 150 | $target_mail = explode(',', $module_info->admin_mail); |
| 151 | - for($i = 0; $i < count($target_mail); $i++) |
|
| 151 | + for ($i = 0; $i < count($target_mail); $i++) |
|
| 152 | 152 | { |
| 153 | 153 | $email_address = trim($target_mail[$i]); |
| 154 | - if(!$email_address) |
|
| 154 | + if (!$email_address) |
|
| 155 | 155 | { |
| 156 | 156 | continue; |
| 157 | 157 | } |
| 158 | - if($author_email != $email_address) |
|
| 158 | + if ($author_email != $email_address) |
|
| 159 | 159 | { |
| 160 | 160 | $oMail->setReceiptor($email_address, $email_address); |
| 161 | 161 | $oMail->send(); |
@@ -173,12 +173,12 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // for message send - start |
| 175 | 175 | $message_content = Context::get('message_content'); |
| 176 | - if($message_content) |
|
| 176 | + if ($message_content) |
|
| 177 | 177 | { |
| 178 | 178 | $message_content = nl2br($message_content); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if($message_content) |
|
| 181 | + if ($message_content) |
|
| 182 | 182 | { |
| 183 | 183 | $this->_sendMessageForComment($message_content, $comment_srl_list); |
| 184 | 184 | } |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | // Error display if none is selected |
| 197 | 197 | $cart = Context::get('cart'); |
| 198 | - if(!$cart) |
|
| 198 | + if (!$cart) |
|
| 199 | 199 | { |
| 200 | 200 | return $this->stop('msg_cart_is_null'); |
| 201 | 201 | } |
| 202 | - if(!is_array($cart)) |
|
| 202 | + if (!is_array($cart)) |
|
| 203 | 203 | { |
| 204 | 204 | $comment_srl_list = explode('|@|', $cart); |
| 205 | 205 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $comment_srl_list = $cart; |
| 209 | 209 | } |
| 210 | 210 | $comment_count = count($comment_srl_list); |
| 211 | - if(!$comment_count) |
|
| 211 | + if (!$comment_count) |
|
| 212 | 212 | { |
| 213 | 213 | return $this->stop('msg_cart_is_null'); |
| 214 | 214 | } |
@@ -220,34 +220,34 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // for message send - start |
| 222 | 222 | $message_content = Context::get('message_content'); |
| 223 | - if($message_content) |
|
| 223 | + if ($message_content) |
|
| 224 | 224 | { |
| 225 | 225 | $message_content = nl2br($message_content); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if($message_content) |
|
| 228 | + if ($message_content) |
|
| 229 | 229 | { |
| 230 | 230 | $this->_sendMessageForComment($message_content, $comment_srl_list); |
| 231 | 231 | } |
| 232 | 232 | // for message send - end |
| 233 | 233 | // comment into trash |
| 234 | - if($isTrash == 'true') |
|
| 234 | + if ($isTrash == 'true') |
|
| 235 | 235 | { |
| 236 | 236 | $this->_moveCommentToTrash($comment_srl_list, $oCommentController, $oDB, $message_content); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $deleted_count = 0; |
| 240 | 240 | // Delete the comment posting |
| 241 | - for($i = 0; $i < $comment_count; $i++) |
|
| 241 | + for ($i = 0; $i < $comment_count; $i++) |
|
| 242 | 242 | { |
| 243 | 243 | $comment_srl = trim($comment_srl_list[$i]); |
| 244 | - if(!$comment_srl) |
|
| 244 | + if (!$comment_srl) |
|
| 245 | 245 | { |
| 246 | 246 | continue; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $output = $oCommentController->deleteComment($comment_srl, TRUE, $isTrash); |
| 250 | - if(!$output->toBool()) |
|
| 250 | + if (!$output->toBool()) |
|
| 251 | 251 | { |
| 252 | 252 | $oDB->rollback(); |
| 253 | 253 | return $output; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | $oDB->commit(); |
| 260 | 260 | |
| 261 | 261 | $msgCode = ''; |
| 262 | - if($isTrash == 'true') |
|
| 262 | + if ($isTrash == 'true') |
|
| 263 | 263 | { |
| 264 | 264 | $msgCode = 'success_trashed'; |
| 265 | 265 | } |
@@ -290,12 +290,12 @@ discard block |
||
| 290 | 290 | $sender_member_srl = $logged_info->member_srl; |
| 291 | 291 | |
| 292 | 292 | $comment_count = count($comment_srl_list); |
| 293 | - for($i = 0; $i < $comment_count; $i++) |
|
| 293 | + for ($i = 0; $i < $comment_count; $i++) |
|
| 294 | 294 | { |
| 295 | 295 | $comment_srl = $comment_srl_list[$i]; |
| 296 | 296 | $oComment = $oCommentModel->getComment($comment_srl, TRUE); |
| 297 | 297 | |
| 298 | - if(!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl) |
|
| 298 | + if (!$oComment->get('member_srl') || $oComment->get('member_srl') == $sender_member_srl) |
|
| 299 | 299 | { |
| 300 | 300 | continue; |
| 301 | 301 | } |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB, $message_content = NULL) |
| 314 | 314 | { |
| 315 | - require_once(_XE_PATH_ . 'modules/trash/model/TrashVO.php'); |
|
| 315 | + require_once(_XE_PATH_.'modules/trash/model/TrashVO.php'); |
|
| 316 | 316 | |
| 317 | - if(is_array($commentSrlList)) |
|
| 317 | + if (is_array($commentSrlList)) |
|
| 318 | 318 | { |
| 319 | 319 | $logged_info = Context::get('logged_info'); |
| 320 | 320 | $oCommentModel = getModel('comment'); |
| 321 | 321 | $commentItemList = $oCommentModel->getComments($commentSrlList); |
| 322 | 322 | $oTrashAdminController = getAdminController('trash'); |
| 323 | 323 | |
| 324 | - foreach($commentItemList AS $key => $oComment) |
|
| 324 | + foreach ($commentItemList AS $key => $oComment) |
|
| 325 | 325 | { |
| 326 | 326 | $oTrashVO = new TrashVO(); |
| 327 | 327 | $oTrashVO->setTrashSrl(getNextSequence()); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $oTrashVO->setDescription($message_content); |
| 332 | 332 | |
| 333 | 333 | $output = $oTrashAdminController->insertTrash($oTrashVO); |
| 334 | - if(!$output->toBool()) |
|
| 334 | + if (!$output->toBool()) |
|
| 335 | 335 | { |
| 336 | 336 | $oDB->rollback(); |
| 337 | 337 | return $output; |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $oCommentController = getController('comment'); |
| 356 | 356 | $oComment = $oCommentModel->getComment($comment_srl, false); |
| 357 | 357 | |
| 358 | - if(!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 358 | + if (!$oComment->isGranted()) return $this->stop('msg_not_permitted'); |
|
| 359 | 359 | |
| 360 | 360 | $message_content = ""; |
| 361 | 361 | $this->_moveCommentToTrash(array($comment_srl), $oCommentController, $oDB, $message_content); |
@@ -377,12 +377,12 @@ discard block |
||
| 377 | 377 | { |
| 378 | 378 | $comment_srl = trim(Context::get('comment_srl')); |
| 379 | 379 | |
| 380 | - if($comment_srl) |
|
| 380 | + if ($comment_srl) |
|
| 381 | 381 | { |
| 382 | 382 | $args = new stdClass(); |
| 383 | 383 | $args->comment_srl = $comment_srl; |
| 384 | 384 | $output = executeQuery('comment.deleteDeclaredComments', $args); |
| 385 | - if(!$output->toBool()) |
|
| 385 | + if (!$output->toBool()) |
|
| 386 | 386 | { |
| 387 | 387 | return $output; |
| 388 | 388 | } |
@@ -403,11 +403,11 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | $output = $oCommentModel->getComments($commentSrlList); |
| 405 | 405 | |
| 406 | - if(is_array($output)) |
|
| 406 | + if (is_array($output)) |
|
| 407 | 407 | { |
| 408 | - foreach($output AS $key => $value) |
|
| 408 | + foreach ($output AS $key => $value) |
|
| 409 | 409 | { |
| 410 | - if($_SESSION['comment_management'][$key]) |
|
| 410 | + if ($_SESSION['comment_management'][$key]) |
|
| 411 | 411 | { |
| 412 | 412 | unset($_SESSION['comment_management'][$key]); |
| 413 | 413 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $args = new stdClass(); |
| 429 | 429 | $args->module_srl = $module_srl; |
| 430 | 430 | $output = executeQuery('comment.deleteModuleComments', $args); |
| 431 | - if(!$output->toBool()) |
|
| 431 | + if (!$output->toBool()) |
|
| 432 | 432 | { |
| 433 | 433 | return $output; |
| 434 | 434 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | //remove from cache |
| 439 | 439 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 440 | - if($oCacheHandler->isSupport()) |
|
| 440 | + if ($oCacheHandler->isSupport()) |
|
| 441 | 441 | { |
| 442 | 442 | // Invalidate newest comments. Per document cache is invalidated inside document admin controller. |
| 443 | 443 | $oCacheHandler->invalidateGroupKey('newestCommentsList'); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | function restoreTrash($originObject) |
| 454 | 454 | { |
| 455 | - if(is_array($originObject)) |
|
| 455 | + if (is_array($originObject)) |
|
| 456 | 456 | { |
| 457 | 457 | $originObject = (object) $originObject; |
| 458 | 458 | } |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | function emptyTrash($originObject) |
| 486 | 486 | { |
| 487 | 487 | $originObject = unserialize($originObject); |
| 488 | - if(is_array($originObject)) |
|
| 488 | + if (is_array($originObject)) |
|
| 489 | 489 | { |
| 490 | 490 | $originObject = (object) $originObject; |
| 491 | 491 | } |
@@ -101,7 +101,6 @@ |
||
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * @brief check member's grant |
| 104 | - * @param object $member_info |
|
| 105 | 104 | * @param array $arrGrant |
| 106 | 105 | * @return boolean |
| 107 | 106 | */ |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * @brief get grant array for insert to database. table module_config's config field |
|
| 65 | - * @param string $default |
|
| 66 | - * @param array $group |
|
| 67 | - * @return array |
|
| 68 | - */ |
|
| 64 | + * @brief get grant array for insert to database. table module_config's config field |
|
| 65 | + * @param string $default |
|
| 66 | + * @param array $group |
|
| 67 | + * @return array |
|
| 68 | + */ |
|
| 69 | 69 | function getGrantArray($default, $group) |
| 70 | 70 | { |
| 71 | 71 | $grant = array(); |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * @brief check member's grant |
|
| 104 | - * @param object $member_info |
|
| 105 | - * @param array $arrGrant |
|
| 106 | - * @return boolean |
|
| 107 | - */ |
|
| 103 | + * @brief check member's grant |
|
| 104 | + * @param object $member_info |
|
| 105 | + * @param array $arrGrant |
|
| 106 | + * @return boolean |
|
| 107 | + */ |
|
| 108 | 108 | function checkGrant($arrGrant) |
| 109 | 109 | { |
| 110 | 110 | if(!$arrGrant) |
@@ -27,32 +27,32 @@ discard block |
||
| 27 | 27 | $oModuleModel = getModel('module'); |
| 28 | 28 | $communication_config = $oModuleModel->getModuleConfig('communication'); |
| 29 | 29 | |
| 30 | - if(!is_object($communication_config)) |
|
| 30 | + if (!is_object($communication_config)) |
|
| 31 | 31 | { |
| 32 | 32 | $communication_config = new stdClass(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if(!$communication_config->skin) |
|
| 35 | + if (!$communication_config->skin) |
|
| 36 | 36 | { |
| 37 | 37 | $communication_config->skin = 'default'; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if(!$communication_config->colorset) |
|
| 40 | + if (!$communication_config->colorset) |
|
| 41 | 41 | { |
| 42 | 42 | $communication_config->colorset = 'white'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if(!$communication_config->editor_skin) |
|
| 45 | + if (!$communication_config->editor_skin) |
|
| 46 | 46 | { |
| 47 | 47 | $communication_config->editor_skin = 'ckeditor'; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if(!$communication_config->mskin) |
|
| 50 | + if (!$communication_config->mskin) |
|
| 51 | 51 | { |
| 52 | 52 | $communication_config->mskin = 'default'; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if(!$communication_config->grant_write) |
|
| 55 | + if (!$communication_config->grant_write) |
|
| 56 | 56 | { |
| 57 | 57 | $communication_config->grant_write = array('default_grant'=>'member'); |
| 58 | 58 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | function getGrantArray($default, $group) |
| 70 | 70 | { |
| 71 | 71 | $grant = array(); |
| 72 | - if($default!="") |
|
| 72 | + if ($default != "") |
|
| 73 | 73 | { |
| 74 | - switch($default) |
|
| 74 | + switch ($default) |
|
| 75 | 75 | { |
| 76 | 76 | case "-2": |
| 77 | 77 | $grant = array("default_grant"=>"site"); |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | break; |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | - else if(is_array($group)) |
|
| 87 | + else if (is_array($group)) |
|
| 88 | 88 | { |
| 89 | 89 | $oMemberModel = getModel('member'); |
| 90 | 90 | $group_list = $oMemberModel->getGroups($this->site_srl); |
| 91 | 91 | |
| 92 | 92 | $group_grant = array(); |
| 93 | - foreach($group as $group_srl) |
|
| 93 | + foreach ($group as $group_srl) |
|
| 94 | 94 | { |
| 95 | 95 | $group_grant[$group_srl] = $group_list[$group_srl]->title; |
| 96 | 96 | } |
@@ -107,37 +107,37 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | function checkGrant($arrGrant) |
| 109 | 109 | { |
| 110 | - if(!$arrGrant) |
|
| 110 | + if (!$arrGrant) |
|
| 111 | 111 | return false; |
| 112 | 112 | |
| 113 | 113 | $logged_info = Context::get('logged_info'); |
| 114 | - if(!$logged_info) |
|
| 114 | + if (!$logged_info) |
|
| 115 | 115 | return false; |
| 116 | 116 | |
| 117 | - if($logged_info->is_admin == "Y") |
|
| 117 | + if ($logged_info->is_admin == "Y") |
|
| 118 | 118 | return true; |
| 119 | 119 | |
| 120 | - if($arrGrant['default_grant']) |
|
| 120 | + if ($arrGrant['default_grant']) |
|
| 121 | 121 | { |
| 122 | - if($arrGrant['default_grant'] == "member" && $logged_info) |
|
| 122 | + if ($arrGrant['default_grant'] == "member" && $logged_info) |
|
| 123 | 123 | return true; |
| 124 | 124 | |
| 125 | - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
| 125 | + if ($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
| 126 | 126 | return true; |
| 127 | 127 | |
| 128 | - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
| 128 | + if ($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
| 129 | 129 | return true; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if($arrGrant['group_grant']) |
|
| 132 | + if ($arrGrant['group_grant']) |
|
| 133 | 133 | { |
| 134 | 134 | $group_grant = $arrGrant['group_grant']; |
| 135 | - if(!is_array($group_grant)) |
|
| 135 | + if (!is_array($group_grant)) |
|
| 136 | 136 | return false; |
| 137 | 137 | |
| 138 | - foreach($logged_info->group_list as $group_srl=>$title) |
|
| 138 | + foreach ($logged_info->group_list as $group_srl=>$title) |
|
| 139 | 139 | { |
| 140 | - if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) |
|
| 140 | + if (isset($group_grant[$group_srl]) && $group_grant[$group_srl] == $title) |
|
| 141 | 141 | return true; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $output = executeQuery('communication.getMessage', $args, $columnList); |
| 163 | 163 | |
| 164 | 164 | $message = $output->data; |
| 165 | - if(!$message) |
|
| 165 | + if (!$message) |
|
| 166 | 166 | { |
| 167 | 167 | return; |
| 168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | // get recipient's information if it is a sent message |
| 171 | 171 | $oMemberModel = getModel('member'); |
| 172 | 172 | |
| 173 | - if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') |
|
| 173 | + if ($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') |
|
| 174 | 174 | { |
| 175 | 175 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl); |
| 176 | 176 | } |
@@ -180,22 +180,22 @@ discard block |
||
| 180 | 180 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if($member_info) |
|
| 183 | + if ($member_info) |
|
| 184 | 184 | { |
| 185 | - foreach($member_info as $key => $val) |
|
| 185 | + foreach ($member_info as $key => $val) |
|
| 186 | 186 | { |
| 187 | - if($key === 'title') continue; |
|
| 188 | - if($key === 'content') continue; |
|
| 189 | - if($key === 'sender_srl') continue; |
|
| 190 | - if($key === 'password') continue; |
|
| 191 | - if($key === 'regdate') continue; |
|
| 187 | + if ($key === 'title') continue; |
|
| 188 | + if ($key === 'content') continue; |
|
| 189 | + if ($key === 'sender_srl') continue; |
|
| 190 | + if ($key === 'password') continue; |
|
| 191 | + if ($key === 'regdate') continue; |
|
| 192 | 192 | |
| 193 | 193 | $message->{$key} = $val; |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // change the status if is a received and not yet read message |
| 198 | - if($message->message_type == 'R' && $message->readed != 'Y') |
|
| 198 | + if ($message->message_type == 'R' && $message->readed != 'Y') |
|
| 199 | 199 | { |
| 200 | 200 | $oCommunicationController = getController('communication'); |
| 201 | 201 | $oCommunicationController->setMessageReaded($message_srl); |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $args->readed = 'N'; |
| 219 | 219 | |
| 220 | 220 | $output = executeQuery('communication.getNewMessage', $args, $columnList); |
| 221 | - if(!count($output->data)) |
|
| 221 | + if (!count($output->data)) |
|
| 222 | 222 | { |
| 223 | 223 | return; |
| 224 | 224 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $logged_info = Context::get('logged_info'); |
| 243 | 243 | $args = new stdClass(); |
| 244 | 244 | |
| 245 | - switch($message_type) |
|
| 245 | + switch ($message_type) |
|
| 246 | 246 | { |
| 247 | 247 | case 'R' : |
| 248 | 248 | $args->member_srl = $logged_info->member_srl; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $output = executeQueryArray('communication.getFriendGroups', $args); |
| 348 | 348 | |
| 349 | 349 | $group_list = $output->data; |
| 350 | - if(!$group_list) |
|
| 350 | + if (!$group_list) |
|
| 351 | 351 | { |
| 352 | 352 | return; |
| 353 | 353 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | $output = executeQuery('communication.isAddedFriend', $args); |
| 372 | 372 | |
| 373 | - if($output->data->count) |
|
| 373 | + if ($output->data->count) |
|
| 374 | 374 | { |
| 375 | 375 | return TRUE; |
| 376 | 376 | } |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | $grant = array("default_grant"=>"member"); |
| 84 | 84 | break; |
| 85 | 85 | } |
| 86 | - } |
|
| 87 | - else if(is_array($group)) |
|
| 86 | + } else if(is_array($group)) |
|
| 88 | 87 | { |
| 89 | 88 | $oMemberModel = getModel('member'); |
| 90 | 89 | $group_list = $oMemberModel->getGroups($this->site_srl); |
@@ -107,38 +106,46 @@ discard block |
||
| 107 | 106 | */ |
| 108 | 107 | function checkGrant($arrGrant) |
| 109 | 108 | { |
| 110 | - if(!$arrGrant) |
|
| 111 | - return false; |
|
| 109 | + if(!$arrGrant) { |
|
| 110 | + return false; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | 113 | $logged_info = Context::get('logged_info'); |
| 114 | - if(!$logged_info) |
|
| 115 | - return false; |
|
| 114 | + if(!$logged_info) { |
|
| 115 | + return false; |
|
| 116 | + } |
|
| 116 | 117 | |
| 117 | - if($logged_info->is_admin == "Y") |
|
| 118 | - return true; |
|
| 118 | + if($logged_info->is_admin == "Y") { |
|
| 119 | + return true; |
|
| 120 | + } |
|
| 119 | 121 | |
| 120 | 122 | if($arrGrant['default_grant']) |
| 121 | 123 | { |
| 122 | - if($arrGrant['default_grant'] == "member" && $logged_info) |
|
| 123 | - return true; |
|
| 124 | + if($arrGrant['default_grant'] == "member" && $logged_info) { |
|
| 125 | + return true; |
|
| 126 | + } |
|
| 124 | 127 | |
| 125 | - if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) |
|
| 126 | - return true; |
|
| 128 | + if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl) { |
|
| 129 | + return true; |
|
| 130 | + } |
|
| 127 | 131 | |
| 128 | - if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") |
|
| 129 | - return true; |
|
| 132 | + if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y") { |
|
| 133 | + return true; |
|
| 134 | + } |
|
| 130 | 135 | } |
| 131 | 136 | |
| 132 | 137 | if($arrGrant['group_grant']) |
| 133 | 138 | { |
| 134 | 139 | $group_grant = $arrGrant['group_grant']; |
| 135 | - if(!is_array($group_grant)) |
|
| 136 | - return false; |
|
| 140 | + if(!is_array($group_grant)) { |
|
| 141 | + return false; |
|
| 142 | + } |
|
| 137 | 143 | |
| 138 | 144 | foreach($logged_info->group_list as $group_srl=>$title) |
| 139 | 145 | { |
| 140 | - if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) |
|
| 141 | - return true; |
|
| 146 | + if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title) { |
|
| 147 | + return true; |
|
| 148 | + } |
|
| 142 | 149 | } |
| 143 | 150 | |
| 144 | 151 | } |
@@ -184,11 +191,21 @@ discard block |
||
| 184 | 191 | { |
| 185 | 192 | foreach($member_info as $key => $val) |
| 186 | 193 | { |
| 187 | - if($key === 'title') continue; |
|
| 188 | - if($key === 'content') continue; |
|
| 189 | - if($key === 'sender_srl') continue; |
|
| 190 | - if($key === 'password') continue; |
|
| 191 | - if($key === 'regdate') continue; |
|
| 194 | + if($key === 'title') { |
|
| 195 | + continue; |
|
| 196 | + } |
|
| 197 | + if($key === 'content') { |
|
| 198 | + continue; |
|
| 199 | + } |
|
| 200 | + if($key === 'sender_srl') { |
|
| 201 | + continue; |
|
| 202 | + } |
|
| 203 | + if($key === 'password') { |
|
| 204 | + continue; |
|
| 205 | + } |
|
| 206 | + if($key === 'regdate') { |
|
| 207 | + continue; |
|
| 208 | + } |
|
| 192 | 209 | |
| 193 | 210 | $message->{$key} = $val; |
| 194 | 211 | } |
@@ -351,6 +351,7 @@ |
||
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | 353 | * Return status by key |
| 354 | + * @param string $key |
|
| 354 | 355 | * @return string |
| 355 | 356 | */ |
| 356 | 357 | function getConfigStatus($key) |
@@ -70,68 +70,126 @@ discard block |
||
| 70 | 70 | if($oModuleModel->needUpdate($version_update_id)) |
| 71 | 71 | { |
| 72 | 72 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 73 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
| 73 | + if(!$oDB->isColumnExists("documents","notify_message")) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 74 | 76 | |
| 75 | 77 | // 2007. 8. 23: create a clustered index in the document table |
| 76 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
| 77 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
| 78 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
| 79 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
| 78 | + if(!$oDB->isIndexExists("documents","idx_module_list_order")) { |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 81 | + if(!$oDB->isIndexExists("documents","idx_module_update_order")) { |
|
| 82 | + return true; |
|
| 83 | + } |
|
| 84 | + if(!$oDB->isIndexExists("documents","idx_module_readed_count")) { |
|
| 85 | + return true; |
|
| 86 | + } |
|
| 87 | + if(!$oDB->isIndexExists("documents","idx_module_voted_count")) { |
|
| 88 | + return true; |
|
| 89 | + } |
|
| 80 | 90 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 81 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 91 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
| 92 | + return true; |
|
| 93 | + } |
|
| 82 | 94 | // 2007. 10. 25 add parent_srl, expand to the document category |
| 83 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
| 84 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
| 95 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 98 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
| 99 | + return true; |
|
| 100 | + } |
|
| 101 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
| 102 | + return true; |
|
| 103 | + } |
|
| 86 | 104 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 87 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
| 105 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
| 106 | + return true; |
|
| 107 | + } |
|
| 88 | 108 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 89 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
| 109 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
| 110 | + return true; |
|
| 111 | + } |
|
| 90 | 112 | |
| 91 | 113 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 92 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
| 114 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
| 115 | + return true; |
|
| 116 | + } |
|
| 93 | 117 | // 2008. 04. 23 Add a column(blamed_count) |
| 94 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 95 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
| 96 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 118 | + if(!$oDB->isColumnExists("documents", "blamed_count")) { |
|
| 119 | + return true; |
|
| 120 | + } |
|
| 121 | + if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) { |
|
| 122 | + return true; |
|
| 123 | + } |
|
| 124 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
| 125 | + return true; |
|
| 126 | + } |
|
| 97 | 127 | // 2008-12-15 Add a column(color) |
| 98 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 128 | + if(!$oDB->isColumnExists("document_categories", "color")) { |
|
| 129 | + return true; |
|
| 130 | + } |
|
| 99 | 131 | |
| 100 | 132 | /** |
| 101 | 133 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 102 | 134 | */ |
| 103 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
| 135 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
| 136 | + return true; |
|
| 137 | + } |
|
| 104 | 138 | |
| 105 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 139 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
| 140 | + return true; |
|
| 141 | + } |
|
| 106 | 142 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 107 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
| 143 | + if(!$oDB->isColumnExists("documents","lang_code")) { |
|
| 144 | + return true; |
|
| 145 | + } |
|
| 108 | 146 | // 2009. 03. 11 check the index in the document_extra_vars table |
| 109 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 147 | + if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) { |
|
| 148 | + return true; |
|
| 149 | + } |
|
| 110 | 150 | |
| 111 | 151 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
| 112 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
| 113 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
| 152 | + if(!$oDB->isColumnExists("document_extra_keys","eid")) { |
|
| 153 | + return true; |
|
| 154 | + } |
|
| 155 | + if(!$oDB->isColumnExists("document_extra_vars","eid")) { |
|
| 156 | + return true; |
|
| 157 | + } |
|
| 114 | 158 | |
| 115 | 159 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 116 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 160 | + if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) { |
|
| 161 | + return true; |
|
| 162 | + } |
|
| 117 | 163 | |
| 118 | 164 | //2011. 04. 07 adding description column to document categories |
| 119 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
| 165 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
| 166 | + return true; |
|
| 167 | + } |
|
| 120 | 168 | |
| 121 | 169 | //2011. 05. 23 adding status column to document |
| 122 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 170 | + if(!$oDB->isColumnExists('documents', 'status')) { |
|
| 171 | + return true; |
|
| 172 | + } |
|
| 123 | 173 | |
| 124 | 174 | //2011. 06. 07 check comment status update |
| 125 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 175 | + if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) { |
|
| 176 | + return true; |
|
| 177 | + } |
|
| 126 | 178 | |
| 127 | 179 | // 2011. 10. 25 status index check |
| 128 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 180 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
| 181 | + return true; |
|
| 182 | + } |
|
| 129 | 183 | |
| 130 | 184 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 131 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 185 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) { |
|
| 186 | + return true; |
|
| 187 | + } |
|
| 132 | 188 | |
| 133 | 189 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 134 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 190 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) { |
|
| 191 | + return true; |
|
| 192 | + } |
|
| 135 | 193 | |
| 136 | 194 | $oModuleController->insertUpdatedLog($version_update_id); |
| 137 | 195 | } |
@@ -178,20 +236,33 @@ discard block |
||
| 178 | 236 | $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
| 179 | 237 | } |
| 180 | 238 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 181 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 182 | - $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
| 239 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) { |
|
| 240 | + $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
|
| 241 | + } |
|
| 183 | 242 | // 2007. 10. 25 add columns(parent_srl, expand) |
| 184 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 185 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 186 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 243 | + if(!$oDB->isColumnExists("document_categories","parent_srl")) { |
|
| 244 | + $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 245 | + } |
|
| 246 | + if(!$oDB->isColumnExists("document_categories","expand")) { |
|
| 247 | + $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 248 | + } |
|
| 249 | + if(!$oDB->isColumnExists("document_categories","group_srls")) { |
|
| 250 | + $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 251 | + } |
|
| 187 | 252 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 188 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 253 | + if(!$oDB->isIndexExists("documents","idx_module_notice")) { |
|
| 254 | + $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 255 | + } |
|
| 189 | 256 | |
| 190 | 257 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 191 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
| 258 | + if(!$oDB->isColumnExists("documents","extra_vars")) { |
|
| 259 | + $oDB->addColumn('documents','extra_vars','text'); |
|
| 260 | + } |
|
| 192 | 261 | |
| 193 | 262 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 194 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 263 | + if(!$oDB->isIndexExists("documents","idx_module_document_srl")) { |
|
| 264 | + $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 265 | + } |
|
| 195 | 266 | // 2008. 04. 23 Add a column(blamed count) |
| 196 | 267 | if(!$oDB->isColumnExists("documents", "blamed_count")) |
| 197 | 268 | { |
@@ -204,18 +275,24 @@ discard block |
||
| 204 | 275 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
| 205 | 276 | } |
| 206 | 277 | |
| 207 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 208 | - $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
| 278 | + if(!$oDB->isColumnExists("document_voted_log", "point")) { |
|
| 279 | + $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
|
| 280 | + } |
|
| 209 | 281 | |
| 210 | 282 | |
| 211 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
| 283 | + if(!$oDB->isColumnExists("document_categories","color")) { |
|
| 284 | + $oDB->addColumn('document_categories',"color","char",7); |
|
| 285 | + } |
|
| 212 | 286 | |
| 213 | 287 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 214 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 288 | + if(!$oDB->isColumnExists("document_extra_vars","lang_code")) { |
|
| 289 | + $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 290 | + } |
|
| 215 | 291 | |
| 216 | 292 | // 2009. 01. 29 Added a trigger for additional setup |
| 217 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 218 | - $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
| 293 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) { |
|
| 294 | + $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
|
| 295 | + } |
|
| 219 | 296 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 220 | 297 | if(!$oDB->isColumnExists("documents","lang_code")) |
| 221 | 298 | { |
@@ -276,7 +353,9 @@ discard block |
||
| 276 | 353 | } |
| 277 | 354 | |
| 278 | 355 | //2011. 04. 07 adding description column to document categories |
| 279 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 356 | + if(!$oDB->isColumnExists("document_categories","description")) { |
|
| 357 | + $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 358 | + } |
|
| 280 | 359 | |
| 281 | 360 | //2011. 05. 23 adding status column to document |
| 282 | 361 | if(!$oDB->isColumnExists('documents', 'status')) |
@@ -287,8 +366,9 @@ discard block |
||
| 287 | 366 | } |
| 288 | 367 | |
| 289 | 368 | // 2011. 09. 08 drop column document is_secret |
| 290 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 291 | - $oDB->dropColumn('documents', 'is_secret'); |
|
| 369 | + if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) { |
|
| 370 | + $oDB->dropColumn('documents', 'is_secret'); |
|
| 371 | + } |
|
| 292 | 372 | |
| 293 | 373 | //2011. 06. 07 merge column, allow_comment and lock_comment |
| 294 | 374 | if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
@@ -313,14 +393,17 @@ discard block |
||
| 313 | 393 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
| 314 | 394 | } |
| 315 | 395 | |
| 316 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 317 | - $oDB->dropColumn('documents', 'allow_comment'); |
|
| 396 | + if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
| 397 | + $oDB->dropColumn('documents', 'allow_comment'); |
|
| 398 | + } |
|
| 318 | 399 | |
| 319 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 320 | - $oDB->dropColumn('documents', 'lock_comment'); |
|
| 400 | + if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) { |
|
| 401 | + $oDB->dropColumn('documents', 'lock_comment'); |
|
| 402 | + } |
|
| 321 | 403 | |
| 322 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 323 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 404 | + if(!$oDB->isIndexExists("documents", "idx_module_status")) { |
|
| 405 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 406 | + } |
|
| 324 | 407 | |
| 325 | 408 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 326 | 409 | if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
@@ -376,8 +459,11 @@ discard block |
||
| 376 | 459 | */ |
| 377 | 460 | function getConfigStatus($key) |
| 378 | 461 | { |
| 379 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 380 | - else $this->getDefaultStatus(); |
|
| 462 | + if(array_key_exists(strtolower($key), $this->statusList)) { |
|
| 463 | + return $this->statusList[$key]; |
|
| 464 | + } else { |
|
| 465 | + $this->getDefaultStatus(); |
|
| 466 | + } |
|
| 381 | 467 | } |
| 382 | 468 | } |
| 383 | 469 | /* End of file document.class.php */ |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * Search option to use in admin page |
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | - var $search_option = array('title','content','title_content','user_name',); // /< Search options |
|
| 20 | + var $search_option = array('title', 'content', 'title_content', 'user_name',); // /< Search options |
|
| 21 | 21 | /** |
| 22 | 22 | * Status list |
| 23 | 23 | * @var array |
@@ -34,22 +34,22 @@ discard block |
||
| 34 | 34 | $oModuleController = getController('module'); |
| 35 | 35 | |
| 36 | 36 | $oDB = &DB::getInstance(); |
| 37 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
| 38 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
| 39 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
| 40 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
| 41 | - $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 42 | - $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 43 | - $oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count")); |
|
| 44 | - $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true); |
|
| 45 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
| 37 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
| 38 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
| 39 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
| 40 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
| 41 | + $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
| 42 | + $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
| 43 | + $oDB->addIndex("documents", "idx_module_blamed_count", array("module_srl", "blamed_count")); |
|
| 44 | + $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl", "alias_title"), true); |
|
| 45 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
| 46 | 46 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 47 | 47 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
| 48 | 48 | |
| 49 | 49 | // 2009. 01. 29 Added a trigger for additional setup |
| 50 | 50 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
| 51 | 51 | |
| 52 | - if(!is_dir('./files/cache/tmp')) |
|
| 52 | + if (!is_dir('./files/cache/tmp')) |
|
| 53 | 53 | { |
| 54 | 54 | FileHandler::makeDir('./files/cache/tmp'); |
| 55 | 55 | } |
@@ -67,71 +67,71 @@ discard block |
||
| 67 | 67 | $oModuleModel = getModel('module'); |
| 68 | 68 | $oModuleController = getController('module'); |
| 69 | 69 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 70 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 70 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 71 | 71 | { |
| 72 | 72 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 73 | - if(!$oDB->isColumnExists("documents","notify_message")) return true; |
|
| 73 | + if (!$oDB->isColumnExists("documents", "notify_message")) return true; |
|
| 74 | 74 | |
| 75 | 75 | // 2007. 8. 23: create a clustered index in the document table |
| 76 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; |
|
| 77 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; |
|
| 78 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; |
|
| 79 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; |
|
| 76 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) return true; |
|
| 77 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) return true; |
|
| 78 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) return true; |
|
| 79 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) return true; |
|
| 80 | 80 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 81 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 81 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; |
|
| 82 | 82 | // 2007. 10. 25 add parent_srl, expand to the document category |
| 83 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; |
|
| 84 | - if(!$oDB->isColumnExists("document_categories","expand")) return true; |
|
| 85 | - if(!$oDB->isColumnExists("document_categories","group_srls")) return true; |
|
| 83 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) return true; |
|
| 84 | + if (!$oDB->isColumnExists("document_categories", "expand")) return true; |
|
| 85 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) return true; |
|
| 86 | 86 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 87 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; |
|
| 87 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) return true; |
|
| 88 | 88 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 89 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; |
|
| 89 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) return true; |
|
| 90 | 90 | |
| 91 | 91 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 92 | - if(!$oDB->isColumnExists("documents","extra_vars")) return true; |
|
| 92 | + if (!$oDB->isColumnExists("documents", "extra_vars")) return true; |
|
| 93 | 93 | // 2008. 04. 23 Add a column(blamed_count) |
| 94 | - if(!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 95 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; |
|
| 96 | - if(!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 94 | + if (!$oDB->isColumnExists("documents", "blamed_count")) return true; |
|
| 95 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) return true; |
|
| 96 | + if (!$oDB->isColumnExists("document_voted_log", "point")) return true; |
|
| 97 | 97 | // 2008-12-15 Add a column(color) |
| 98 | - if(!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 98 | + if (!$oDB->isColumnExists("document_categories", "color")) return true; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 102 | 102 | */ |
| 103 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; |
|
| 103 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) return true; |
|
| 104 | 104 | |
| 105 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 105 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; |
|
| 106 | 106 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 107 | - if(!$oDB->isColumnExists("documents","lang_code")) return true; |
|
| 107 | + if (!$oDB->isColumnExists("documents", "lang_code")) return true; |
|
| 108 | 108 | // 2009. 03. 11 check the index in the document_extra_vars table |
| 109 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 109 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; |
|
| 110 | 110 | |
| 111 | 111 | // 2009. 03. 19: Add a column(eid) if not exist in the table |
| 112 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; |
|
| 113 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; |
|
| 112 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) return true; |
|
| 113 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) return true; |
|
| 114 | 114 | |
| 115 | 115 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 116 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 116 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true; |
|
| 117 | 117 | |
| 118 | 118 | //2011. 04. 07 adding description column to document categories |
| 119 | - if(!$oDB->isColumnExists("document_categories","description")) return true; |
|
| 119 | + if (!$oDB->isColumnExists("document_categories", "description")) return true; |
|
| 120 | 120 | |
| 121 | 121 | //2011. 05. 23 adding status column to document |
| 122 | - if(!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 122 | + if (!$oDB->isColumnExists('documents', 'status')) return true; |
|
| 123 | 123 | |
| 124 | 124 | //2011. 06. 07 check comment status update |
| 125 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 125 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true; |
|
| 126 | 126 | |
| 127 | 127 | // 2011. 10. 25 status index check |
| 128 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 128 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) return true; |
|
| 129 | 129 | |
| 130 | 130 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 131 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 131 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true; |
|
| 132 | 132 | |
| 133 | 133 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 134 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 134 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 135 | 135 | |
| 136 | 136 | $oModuleController->insertUpdatedLog($version_update_id); |
| 137 | 137 | } |
@@ -149,101 +149,101 @@ discard block |
||
| 149 | 149 | $oModuleModel = getModel('module'); |
| 150 | 150 | $oModuleController = getController('module'); |
| 151 | 151 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 152 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 152 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 153 | 153 | { |
| 154 | 154 | // 2007. 7. 25: Add a column(notify_message) for notification |
| 155 | - if(!$oDB->isColumnExists("documents","notify_message")) |
|
| 155 | + if (!$oDB->isColumnExists("documents", "notify_message")) |
|
| 156 | 156 | { |
| 157 | - $oDB->addColumn('documents',"notify_message","char",1); |
|
| 157 | + $oDB->addColumn('documents', "notify_message", "char", 1); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // 2007. 8. 23: create a clustered index in the document table |
| 161 | - if(!$oDB->isIndexExists("documents","idx_module_list_order")) |
|
| 161 | + if (!$oDB->isIndexExists("documents", "idx_module_list_order")) |
|
| 162 | 162 | { |
| 163 | - $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); |
|
| 163 | + $oDB->addIndex("documents", "idx_module_list_order", array("module_srl", "list_order")); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if(!$oDB->isIndexExists("documents","idx_module_update_order")) |
|
| 166 | + if (!$oDB->isIndexExists("documents", "idx_module_update_order")) |
|
| 167 | 167 | { |
| 168 | - $oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order")); |
|
| 168 | + $oDB->addIndex("documents", "idx_module_update_order", array("module_srl", "update_order")); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if(!$oDB->isIndexExists("documents","idx_module_readed_count")) |
|
| 171 | + if (!$oDB->isIndexExists("documents", "idx_module_readed_count")) |
|
| 172 | 172 | { |
| 173 | - $oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count")); |
|
| 173 | + $oDB->addIndex("documents", "idx_module_readed_count", array("module_srl", "readed_count")); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if(!$oDB->isIndexExists("documents","idx_module_voted_count")) |
|
| 176 | + if (!$oDB->isIndexExists("documents", "idx_module_voted_count")) |
|
| 177 | 177 | { |
| 178 | - $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); |
|
| 178 | + $oDB->addIndex("documents", "idx_module_voted_count", array("module_srl", "voted_count")); |
|
| 179 | 179 | } |
| 180 | 180 | // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted |
| 181 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 181 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) |
|
| 182 | 182 | $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); |
| 183 | 183 | // 2007. 10. 25 add columns(parent_srl, expand) |
| 184 | - if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); |
|
| 185 | - if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); |
|
| 186 | - if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); |
|
| 184 | + if (!$oDB->isColumnExists("document_categories", "parent_srl")) $oDB->addColumn('document_categories', "parent_srl", "number", 12, 0); |
|
| 185 | + if (!$oDB->isColumnExists("document_categories", "expand")) $oDB->addColumn('document_categories', "expand", "char", 1, "N"); |
|
| 186 | + if (!$oDB->isColumnExists("document_categories", "group_srls")) $oDB->addColumn('document_categories', "group_srls", "text"); |
|
| 187 | 187 | // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) |
| 188 | - if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); |
|
| 188 | + if (!$oDB->isIndexExists("documents", "idx_module_notice")) $oDB->addIndex("documents", "idx_module_notice", array("module_srl", "is_notice")); |
|
| 189 | 189 | |
| 190 | 190 | // 2007. 12. 03: Add if the colume(extra_vars) doesn't exist |
| 191 | - if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); |
|
| 191 | + if (!$oDB->isColumnExists("documents", "extra_vars")) $oDB->addColumn('documents', 'extra_vars', 'text'); |
|
| 192 | 192 | |
| 193 | 193 | // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) |
| 194 | - if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); |
|
| 194 | + if (!$oDB->isIndexExists("documents", "idx_module_document_srl")) $oDB->addIndex("documents", "idx_module_document_srl", array("module_srl", "document_srl")); |
|
| 195 | 195 | // 2008. 04. 23 Add a column(blamed count) |
| 196 | - if(!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 196 | + if (!$oDB->isColumnExists("documents", "blamed_count")) |
|
| 197 | 197 | { |
| 198 | 198 | $oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true); |
| 199 | 199 | $oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count')); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) |
|
| 202 | + if (!$oDB->isIndexExists("documents", "idx_module_blamed_count")) |
|
| 203 | 203 | { |
| 204 | 204 | $oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count')); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if(!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 207 | + if (!$oDB->isColumnExists("document_voted_log", "point")) |
|
| 208 | 208 | $oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true); |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); |
|
| 211 | + if (!$oDB->isColumnExists("document_categories", "color")) $oDB->addColumn('document_categories', "color", "char", 7); |
|
| 212 | 212 | |
| 213 | 213 | // 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table |
| 214 | - if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); |
|
| 214 | + if (!$oDB->isColumnExists("document_extra_vars", "lang_code")) $oDB->addColumn('document_extra_vars', "lang_code", "varchar", 10); |
|
| 215 | 215 | |
| 216 | 216 | // 2009. 01. 29 Added a trigger for additional setup |
| 217 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 217 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) |
|
| 218 | 218 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); |
| 219 | 219 | // 2009. 03. 09 Add a column(lang_code) to the documnets table |
| 220 | - if(!$oDB->isColumnExists("documents","lang_code")) |
|
| 220 | + if (!$oDB->isColumnExists("documents", "lang_code")) |
|
| 221 | 221 | { |
| 222 | 222 | $db_info = Context::getDBInfo(); |
| 223 | - $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); |
|
| 223 | + $oDB->addColumn('documents', "lang_code", "varchar", 10, $db_info->lang_code); |
|
| 224 | 224 | $obj->lang_code = $db_info->lang_type; |
| 225 | 225 | executeQuery('document.updateDocumentsLangCode', $obj); |
| 226 | 226 | } |
| 227 | 227 | // 2009. 03. 11 Check the index in the document_extra_vars table |
| 228 | - if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 228 | + if (!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) |
|
| 229 | 229 | { |
| 230 | - $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); |
|
| 230 | + $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl", "document_srl", "var_idx", "lang_code"), true); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 233 | + if ($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) |
|
| 234 | 234 | { |
| 235 | 235 | $oDB->dropIndex("document_extra_vars", "unique_module_vars", true); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // 2009. 03. 19: Add a column(eid) |
| 239 | 239 | // 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column |
| 240 | - if(!$oDB->isColumnExists("document_extra_keys","eid")) |
|
| 240 | + if (!$oDB->isColumnExists("document_extra_keys", "eid")) |
|
| 241 | 241 | { |
| 242 | - $oDB->addColumn("document_extra_keys","eid","varchar",40); |
|
| 242 | + $oDB->addColumn("document_extra_keys", "eid", "varchar", 40); |
|
| 243 | 243 | |
| 244 | 244 | $output = executeQuery('document.getGroupsExtraKeys', $obj); |
| 245 | - if($output->toBool() && $output->data && count($output->data)) { |
|
| 246 | - foreach($output->data as $extra_keys) { |
|
| 245 | + if ($output->toBool() && $output->data && count($output->data)) { |
|
| 246 | + foreach ($output->data as $extra_keys) { |
|
| 247 | 247 | $args->module_srl = $extra_keys->module_srl; |
| 248 | 248 | $args->var_idx = $extra_keys->idx; |
| 249 | 249 | $args->new_eid = "extra_vars".$extra_keys->idx; |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if(!$oDB->isColumnExists("document_extra_vars","eid")) |
|
| 255 | + if (!$oDB->isColumnExists("document_extra_vars", "eid")) |
|
| 256 | 256 | { |
| 257 | - $oDB->addColumn("document_extra_vars","eid","varchar",40); |
|
| 257 | + $oDB->addColumn("document_extra_vars", "eid", "varchar", 40); |
|
| 258 | 258 | $obj->var_idx = '-1,-2'; |
| 259 | 259 | $output = executeQuery('document.getGroupsExtraVars', $obj); |
| 260 | - if($output->toBool() && $output->data && count($output->data)) |
|
| 260 | + if ($output->toBool() && $output->data && count($output->data)) |
|
| 261 | 261 | { |
| 262 | - foreach($output->data as $extra_vars) |
|
| 262 | + foreach ($output->data as $extra_vars) |
|
| 263 | 263 | { |
| 264 | 264 | $args->module_srl = $extra_vars->module_srl; |
| 265 | 265 | $args->var_idx = $extra_vars->idx; |
@@ -270,16 +270,16 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table |
| 273 | - if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 273 | + if (!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) |
|
| 274 | 274 | { |
| 275 | - $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false); |
|
| 275 | + $oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl", "module_srl", "var_idx"), false); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | //2011. 04. 07 adding description column to document categories |
| 279 | - if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0); |
|
| 279 | + if (!$oDB->isColumnExists("document_categories", "description")) $oDB->addColumn('document_categories', "description", "varchar", 200, 0); |
|
| 280 | 280 | |
| 281 | 281 | //2011. 05. 23 adding status column to document |
| 282 | - if(!$oDB->isColumnExists('documents', 'status')) |
|
| 282 | + if (!$oDB->isColumnExists('documents', 'status')) |
|
| 283 | 283 | { |
| 284 | 284 | $oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC'); |
| 285 | 285 | $args->is_secret = 'Y'; |
@@ -287,11 +287,11 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // 2011. 09. 08 drop column document is_secret |
| 290 | - if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 290 | + if ($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret')) |
|
| 291 | 291 | $oDB->dropColumn('documents', 'is_secret'); |
| 292 | 292 | |
| 293 | 293 | //2011. 06. 07 merge column, allow_comment and lock_comment |
| 294 | - if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 294 | + if ($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) |
|
| 295 | 295 | { |
| 296 | 296 | $oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW'); |
| 297 | 297 | |
@@ -313,23 +313,23 @@ discard block |
||
| 313 | 313 | $output = executeQuery('document.updateDocumentCommentStatus', $args); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 316 | + if ($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 317 | 317 | $oDB->dropColumn('documents', 'allow_comment'); |
| 318 | 318 | |
| 319 | - if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 319 | + if ($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status')) |
|
| 320 | 320 | $oDB->dropColumn('documents', 'lock_comment'); |
| 321 | 321 | |
| 322 | - if(!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 323 | - $oDB->addIndex("documents", "idx_module_status", array("module_srl","status")); |
|
| 322 | + if (!$oDB->isIndexExists("documents", "idx_module_status")) |
|
| 323 | + $oDB->addIndex("documents", "idx_module_status", array("module_srl", "status")); |
|
| 324 | 324 | |
| 325 | 325 | // 2012. 02. 27 Add a trigger to copy extra keys when the module is copied |
| 326 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 326 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) |
|
| 327 | 327 | { |
| 328 | 328 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'); |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 332 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 332 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after')) |
|
| 333 | 333 | { |
| 334 | 334 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModule', 'after'); |
| 335 | 335 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $oModuleController->insertUpdatedLog($version_update_id); |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - return new BaseObject(0,'success_updated'); |
|
| 340 | + return new BaseObject(0, 'success_updated'); |
|
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /** |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | function recompileCache() |
| 348 | 348 | { |
| 349 | - if(!is_dir('./files/cache/tmp')) |
|
| 349 | + if (!is_dir('./files/cache/tmp')) |
|
| 350 | 350 | { |
| 351 | 351 | FileHandler::makeDir('./files/cache/tmp'); |
| 352 | 352 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | */ |
| 377 | 377 | function getConfigStatus($key) |
| 378 | 378 | { |
| 379 | - if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 379 | + if (array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key]; |
|
| 380 | 380 | else $this->getDefaultStatus(); |
| 381 | 381 | } |
| 382 | 382 | } |
@@ -1106,8 +1106,7 @@ |
||
| 1106 | 1106 | |
| 1107 | 1107 | /** |
| 1108 | 1108 | * Check accessible by document status |
| 1109 | - * @param array $matches |
|
| 1110 | - * @return mixed |
|
| 1109 | + * @return boolean |
|
| 1111 | 1110 | */ |
| 1112 | 1111 | function _checkAccessibleFromStatus() |
| 1113 | 1112 | { |
@@ -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 | return $comment_list; |
| 785 | 785 | } |
@@ -791,9 +791,9 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | function getTrackbacks() |
| 793 | 793 | { |
| 794 | - if(!$this->document_srl) return; |
|
| 794 | + if (!$this->document_srl) return; |
|
| 795 | 795 | |
| 796 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 796 | + if (!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 797 | 797 | |
| 798 | 798 | $oTrackbackModel = getModel('trackback'); |
| 799 | 799 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -801,47 +801,47 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 803 | 803 | { |
| 804 | - if(!$this->document_srl) return false; |
|
| 805 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 804 | + if (!$this->document_srl) return false; |
|
| 805 | + if (!$this->getThumbnail($width, $height, $type)) return false; |
|
| 806 | 806 | return true; |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 810 | 810 | { |
| 811 | 811 | // Return false if the document doesn't exist |
| 812 | - if(!$this->document_srl) return; |
|
| 812 | + if (!$this->document_srl) return; |
|
| 813 | 813 | |
| 814 | - if($this->isSecret() && !$this->isGranted()) |
|
| 814 | + if ($this->isSecret() && !$this->isGranted()) |
|
| 815 | 815 | { |
| 816 | 816 | return; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | // If not specify its height, create a square |
| 820 | - if(!$height) $height = $width; |
|
| 820 | + if (!$height) $height = $width; |
|
| 821 | 821 | |
| 822 | 822 | // Return false if neither attachement nor image files in the document |
| 823 | 823 | $content = $this->get('content'); |
| 824 | - if(!$this->get('uploaded_count')) |
|
| 824 | + if (!$this->get('uploaded_count')) |
|
| 825 | 825 | { |
| 826 | - if(!$content) |
|
| 826 | + if (!$content) |
|
| 827 | 827 | { |
| 828 | 828 | $args = new stdClass(); |
| 829 | 829 | $args->document_srl = $this->document_srl; |
| 830 | 830 | $output = executeQuery('document.getDocument', $args, array('content')); |
| 831 | - if($output->toBool() && $output->data) |
|
| 831 | + if ($output->toBool() && $output->data) |
|
| 832 | 832 | { |
| 833 | 833 | $content = $output->data->content; |
| 834 | 834 | $this->add('content', $content); |
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - if(!preg_match("!<img!is", $content)) return; |
|
| 838 | + if (!preg_match("!<img!is", $content)) return; |
|
| 839 | 839 | } |
| 840 | 840 | // Get thumbnai_type information from document module's configuration |
| 841 | - if(!in_array($thumbnail_type, array('crop','ratio'))) |
|
| 841 | + if (!in_array($thumbnail_type, array('crop', 'ratio'))) |
|
| 842 | 842 | { |
| 843 | 843 | $config = $GLOBALS['__document_config__']; |
| 844 | - if(!$config) |
|
| 844 | + if (!$config) |
|
| 845 | 845 | { |
| 846 | 846 | $oDocumentModel = getModel('document'); |
| 847 | 847 | $config = $oDocumentModel->getDocumentConfig(); |
@@ -851,21 +851,21 @@ discard block |
||
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | // Define thumbnail information |
| 854 | - $thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3)); |
|
| 854 | + $thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3)); |
|
| 855 | 855 | $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); |
| 856 | 856 | $thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type); |
| 857 | 857 | $thumbnail_url = Context::getRequestUri().$thumbnail_file; |
| 858 | 858 | |
| 859 | 859 | // Return false if thumbnail file exists and its size is 0. Otherwise, return its path |
| 860 | - if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
| 860 | + if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile)) |
|
| 861 | 861 | { |
| 862 | - if(filesize($thumbnail_file) < 1) |
|
| 862 | + if (filesize($thumbnail_file) < 1) |
|
| 863 | 863 | { |
| 864 | 864 | return FALSE; |
| 865 | 865 | } |
| 866 | 866 | else |
| 867 | 867 | { |
| 868 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
| 868 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | |
@@ -877,64 +877,64 @@ discard block |
||
| 877 | 877 | $is_tmp_file = false; |
| 878 | 878 | |
| 879 | 879 | // Find an iamge file among attached files if exists |
| 880 | - if($this->hasUploadedFiles()) |
|
| 880 | + if ($this->hasUploadedFiles()) |
|
| 881 | 881 | { |
| 882 | 882 | $file_list = $this->getUploadedFiles(); |
| 883 | 883 | |
| 884 | 884 | $first_image = null; |
| 885 | - foreach($file_list as $file) |
|
| 885 | + foreach ($file_list as $file) |
|
| 886 | 886 | { |
| 887 | - if($file->direct_download !== 'Y') continue; |
|
| 887 | + if ($file->direct_download !== 'Y') continue; |
|
| 888 | 888 | |
| 889 | - if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 889 | + if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
|
| 890 | 890 | { |
| 891 | 891 | $source_file = $file->uploaded_filename; |
| 892 | 892 | break; |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | - if($first_image) continue; |
|
| 895 | + if ($first_image) continue; |
|
| 896 | 896 | |
| 897 | - if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 897 | + if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
|
| 898 | 898 | { |
| 899 | - if(file_exists($file->uploaded_filename)) |
|
| 899 | + if (file_exists($file->uploaded_filename)) |
|
| 900 | 900 | { |
| 901 | 901 | $first_image = $file->uploaded_filename; |
| 902 | 902 | } |
| 903 | 903 | } |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | - if(!$source_file && $first_image) |
|
| 906 | + if (!$source_file && $first_image) |
|
| 907 | 907 | { |
| 908 | 908 | $source_file = $first_image; |
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | // If not exists, file an image file from the content |
| 912 | 912 | $is_tmp_file = false; |
| 913 | - if(!$source_file) |
|
| 913 | + if (!$source_file) |
|
| 914 | 914 | { |
| 915 | 915 | $random = new Password(); |
| 916 | 916 | |
| 917 | 917 | preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER); |
| 918 | 918 | |
| 919 | - foreach($matches as $target_image) |
|
| 919 | + foreach ($matches as $target_image) |
|
| 920 | 920 | { |
| 921 | 921 | $target_src = trim($target_image[1]); |
| 922 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 922 | + if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 923 | 923 | |
| 924 | - if(!preg_match('/^(http|https):\/\//i',$target_src)) |
|
| 924 | + if (!preg_match('/^(http|https):\/\//i', $target_src)) |
|
| 925 | 925 | { |
| 926 | 926 | $target_src = Context::getRequestUri().$target_src; |
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | $target_src = htmlspecialchars_decode($target_src); |
| 930 | 930 | |
| 931 | - $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
|
| 931 | + $tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex'); |
|
| 932 | 932 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 933 | - if(!file_exists($tmp_file)) continue; |
|
| 933 | + if (!file_exists($tmp_file)) continue; |
|
| 934 | 934 | |
| 935 | 935 | $imageinfo = getimagesize($tmp_file); |
| 936 | 936 | list($_w, $_h) = $imageinfo; |
| 937 | - if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 937 | + if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) { |
|
| 938 | 938 | FileHandler::removeFile($tmp_file); |
| 939 | 939 | continue; |
| 940 | 940 | } |
@@ -945,13 +945,13 @@ discard block |
||
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - if($source_file) |
|
| 948 | + if ($source_file) |
|
| 949 | 949 | { |
| 950 | 950 | $output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | // Remove source file if it was temporary |
| 954 | - if($is_tmp_file) |
|
| 954 | + if ($is_tmp_file) |
|
| 955 | 955 | { |
| 956 | 956 | FileHandler::removeFile($source_file); |
| 957 | 957 | } |
@@ -960,12 +960,12 @@ discard block |
||
| 960 | 960 | FileHandler::removeFile($thumbnail_lockfile); |
| 961 | 961 | |
| 962 | 962 | // Create an empty file if thumbnail generation failed |
| 963 | - if(!$output_file) |
|
| 963 | + if (!$output_file) |
|
| 964 | 964 | { |
| 965 | - FileHandler::writeFile($thumbnail_file, '','w'); |
|
| 965 | + FileHandler::writeFile($thumbnail_file, '', 'w'); |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | - return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
|
| 968 | + return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file)); |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | 971 | /** |
@@ -976,21 +976,21 @@ discard block |
||
| 976 | 976 | */ |
| 977 | 977 | function getExtraImages($time_interval = 43200) |
| 978 | 978 | { |
| 979 | - if(!$this->document_srl) return; |
|
| 979 | + if (!$this->document_srl) return; |
|
| 980 | 980 | // variables for icon list |
| 981 | 981 | $buffs = array(); |
| 982 | 982 | |
| 983 | 983 | $check_files = false; |
| 984 | 984 | |
| 985 | 985 | // Check if secret post is |
| 986 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 986 | + if ($this->isSecret()) $buffs[] = "secret"; |
|
| 987 | 987 | |
| 988 | 988 | // Set the latest time |
| 989 | - $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
|
| 989 | + $time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval); |
|
| 990 | 990 | |
| 991 | 991 | // Check new post |
| 992 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 993 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 992 | + if ($this->get('regdate') > $time_check) $buffs[] = "new"; |
|
| 993 | + else if ($this->get('last_update') > $time_check) $buffs[] = "update"; |
|
| 994 | 994 | |
| 995 | 995 | /* |
| 996 | 996 | $content = $this->get('content'); |
@@ -1013,14 +1013,14 @@ discard block |
||
| 1013 | 1013 | */ |
| 1014 | 1014 | |
| 1015 | 1015 | // Check the attachment |
| 1016 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1016 | + if ($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1017 | 1017 | |
| 1018 | 1018 | return $buffs; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | function getStatus() |
| 1022 | 1022 | { |
| 1023 | - if(!$this->get('status')) { |
|
| 1023 | + if (!$this->get('status')) { |
|
| 1024 | 1024 | $oDocumentClass = getClass('document'); |
| 1025 | 1025 | return $oDocumentClass->getDefaultStatus(); |
| 1026 | 1026 | } |
@@ -1034,11 +1034,11 @@ discard block |
||
| 1034 | 1034 | */ |
| 1035 | 1035 | function printExtraImages($time_check = 43200) |
| 1036 | 1036 | { |
| 1037 | - if(!$this->document_srl) return; |
|
| 1037 | + if (!$this->document_srl) return; |
|
| 1038 | 1038 | |
| 1039 | 1039 | $oDocumentModel = getModel('document'); |
| 1040 | 1040 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
| 1041 | - if(Mobile::isFromMobilePhone()) |
|
| 1041 | + if (Mobile::isFromMobilePhone()) |
|
| 1042 | 1042 | { |
| 1043 | 1043 | $iconSkin = $documentConfig->micons; |
| 1044 | 1044 | } |
@@ -1046,13 +1046,13 @@ discard block |
||
| 1046 | 1046 | { |
| 1047 | 1047 | $iconSkin = $documentConfig->icons; |
| 1048 | 1048 | } |
| 1049 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1049 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1050 | 1050 | |
| 1051 | 1051 | $buffs = $this->getExtraImages($time_check); |
| 1052 | - if(!count($buffs)) return; |
|
| 1052 | + if (!count($buffs)) return; |
|
| 1053 | 1053 | |
| 1054 | 1054 | $buff = array(); |
| 1055 | - foreach($buffs as $key => $val) |
|
| 1055 | + foreach ($buffs as $key => $val) |
|
| 1056 | 1056 | { |
| 1057 | 1057 | $buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val); |
| 1058 | 1058 | } |
@@ -1061,20 +1061,20 @@ discard block |
||
| 1061 | 1061 | |
| 1062 | 1062 | function hasUploadedFiles() |
| 1063 | 1063 | { |
| 1064 | - if(!$this->document_srl) return; |
|
| 1064 | + if (!$this->document_srl) return; |
|
| 1065 | 1065 | |
| 1066 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1067 | - return $this->get('uploaded_count')? true : false; |
|
| 1066 | + if ($this->isSecret() && !$this->isGranted()) return false; |
|
| 1067 | + return $this->get('uploaded_count') ? true : false; |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1071 | 1071 | { |
| 1072 | - if(!$this->document_srl) return; |
|
| 1072 | + if (!$this->document_srl) return; |
|
| 1073 | 1073 | |
| 1074 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1075 | - if(!$this->get('uploaded_count')) return; |
|
| 1074 | + if ($this->isSecret() && !$this->isGranted()) return; |
|
| 1075 | + if (!$this->get('uploaded_count')) return; |
|
| 1076 | 1076 | |
| 1077 | - if(!$this->uploadedFiles[$sortIndex]) |
|
| 1077 | + if (!$this->uploadedFiles[$sortIndex]) |
|
| 1078 | 1078 | { |
| 1079 | 1079 | $oFileModel = getModel('file'); |
| 1080 | 1080 | $this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true); |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | function getEditor() |
| 1091 | 1091 | { |
| 1092 | 1092 | $module_srl = $this->get('module_srl'); |
| 1093 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1093 | + if (!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1094 | 1094 | |
| 1095 | 1095 | $oEditorModel = getModel('editor'); |
| 1096 | 1096 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | { |
| 1106 | 1106 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1107 | 1107 | if (!$this->allowComment()) return false; |
| 1108 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1108 | + if (!$this->isGranted() && $this->isSecret()) return false; |
|
| 1109 | 1109 | |
| 1110 | 1110 | return true; |
| 1111 | 1111 | } |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | */ |
| 1117 | 1117 | function getCommentEditor() |
| 1118 | 1118 | { |
| 1119 | - if(!$this->isEnableComment()) return; |
|
| 1119 | + if (!$this->isEnableComment()) return; |
|
| 1120 | 1120 | |
| 1121 | 1121 | $oEditorModel = getModel('editor'); |
| 1122 | 1122 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1128,10 +1128,10 @@ discard block |
||
| 1128 | 1128 | */ |
| 1129 | 1129 | function getProfileImage() |
| 1130 | 1130 | { |
| 1131 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1131 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1132 | 1132 | $oMemberModel = getModel('member'); |
| 1133 | 1133 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1134 | - if(!$profile_info) return; |
|
| 1134 | + if (!$profile_info) return; |
|
| 1135 | 1135 | |
| 1136 | 1136 | return $profile_info->src; |
| 1137 | 1137 | } |
@@ -1143,21 +1143,21 @@ discard block |
||
| 1143 | 1143 | function getSignature() |
| 1144 | 1144 | { |
| 1145 | 1145 | // Pass if a document doesn't exist |
| 1146 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1146 | + if (!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1147 | 1147 | // Get signature information |
| 1148 | 1148 | $oMemberModel = getModel('member'); |
| 1149 | 1149 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
| 1150 | 1150 | // Check if a maximum height of signiture is set in the member module |
| 1151 | - if(!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1151 | + if (!isset($GLOBALS['__member_signature_max_height'])) |
|
| 1152 | 1152 | { |
| 1153 | 1153 | $oModuleModel = getModel('module'); |
| 1154 | 1154 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1155 | 1155 | $GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height; |
| 1156 | 1156 | } |
| 1157 | - if($signature) |
|
| 1157 | + if ($signature) |
|
| 1158 | 1158 | { |
| 1159 | 1159 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1160 | - 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); |
|
| 1160 | + 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); |
|
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | 1163 | return $signature; |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | */ |
| 1171 | 1171 | function replaceResourceRealPath($matches) |
| 1172 | 1172 | { |
| 1173 | - return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1173 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | /** |
@@ -1181,19 +1181,19 @@ discard block |
||
| 1181 | 1181 | function _checkAccessibleFromStatus() |
| 1182 | 1182 | { |
| 1183 | 1183 | $logged_info = Context::get('logged_info'); |
| 1184 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1184 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 1185 | 1185 | |
| 1186 | 1186 | $status = $this->get('status'); |
| 1187 | - if(empty($status)) return false; |
|
| 1187 | + if (empty($status)) return false; |
|
| 1188 | 1188 | |
| 1189 | 1189 | $oDocumentModel = getModel('document'); |
| 1190 | 1190 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1191 | 1191 | |
| 1192 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1192 | + if ($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1193 | 1193 | return true; |
| 1194 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1194 | + else if ($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1195 | 1195 | { |
| 1196 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1196 | + if ($this->get('member_srl') == $logged_info->member_srl) |
|
| 1197 | 1197 | return true; |
| 1198 | 1198 | } |
| 1199 | 1199 | 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 | return $comment_list; |
| 785 | 869 | } |
@@ -791,9 +875,13 @@ discard block |
||
| 791 | 875 | |
| 792 | 876 | function getTrackbacks() |
| 793 | 877 | { |
| 794 | - if(!$this->document_srl) return; |
|
| 878 | + if(!$this->document_srl) { |
|
| 879 | + return; |
|
| 880 | + } |
|
| 795 | 881 | |
| 796 | - if(!$this->allowTrackback() || !$this->get('trackback_count')) return; |
|
| 882 | + if(!$this->allowTrackback() || !$this->get('trackback_count')) { |
|
| 883 | + return; |
|
| 884 | + } |
|
| 797 | 885 | |
| 798 | 886 | $oTrackbackModel = getModel('trackback'); |
| 799 | 887 | return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin); |
@@ -801,15 +889,21 @@ discard block |
||
| 801 | 889 | |
| 802 | 890 | function thumbnailExists($width = 80, $height = 0, $type = '') |
| 803 | 891 | { |
| 804 | - if(!$this->document_srl) return false; |
|
| 805 | - if(!$this->getThumbnail($width, $height, $type)) return false; |
|
| 892 | + if(!$this->document_srl) { |
|
| 893 | + return false; |
|
| 894 | + } |
|
| 895 | + if(!$this->getThumbnail($width, $height, $type)) { |
|
| 896 | + return false; |
|
| 897 | + } |
|
| 806 | 898 | return true; |
| 807 | 899 | } |
| 808 | 900 | |
| 809 | 901 | function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') |
| 810 | 902 | { |
| 811 | 903 | // Return false if the document doesn't exist |
| 812 | - if(!$this->document_srl) return; |
|
| 904 | + if(!$this->document_srl) { |
|
| 905 | + return; |
|
| 906 | + } |
|
| 813 | 907 | |
| 814 | 908 | if($this->isSecret() && !$this->isGranted()) |
| 815 | 909 | { |
@@ -817,7 +911,9 @@ discard block |
||
| 817 | 911 | } |
| 818 | 912 | |
| 819 | 913 | // If not specify its height, create a square |
| 820 | - if(!$height) $height = $width; |
|
| 914 | + if(!$height) { |
|
| 915 | + $height = $width; |
|
| 916 | + } |
|
| 821 | 917 | |
| 822 | 918 | // Return false if neither attachement nor image files in the document |
| 823 | 919 | $content = $this->get('content'); |
@@ -835,7 +931,9 @@ discard block |
||
| 835 | 931 | } |
| 836 | 932 | } |
| 837 | 933 | |
| 838 | - if(!preg_match("!<img!is", $content)) return; |
|
| 934 | + if(!preg_match("!<img!is", $content)) { |
|
| 935 | + return; |
|
| 936 | + } |
|
| 839 | 937 | } |
| 840 | 938 | // Get thumbnai_type information from document module's configuration |
| 841 | 939 | if(!in_array($thumbnail_type, array('crop','ratio'))) |
@@ -862,8 +960,7 @@ discard block |
||
| 862 | 960 | if(filesize($thumbnail_file) < 1) |
| 863 | 961 | { |
| 864 | 962 | return FALSE; |
| 865 | - } |
|
| 866 | - else |
|
| 963 | + } else |
|
| 867 | 964 | { |
| 868 | 965 | return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file)); |
| 869 | 966 | } |
@@ -884,7 +981,9 @@ discard block |
||
| 884 | 981 | $first_image = null; |
| 885 | 982 | foreach($file_list as $file) |
| 886 | 983 | { |
| 887 | - if($file->direct_download !== 'Y') continue; |
|
| 984 | + if($file->direct_download !== 'Y') { |
|
| 985 | + continue; |
|
| 986 | + } |
|
| 888 | 987 | |
| 889 | 988 | if($file->cover_image === 'Y' && file_exists($file->uploaded_filename)) |
| 890 | 989 | { |
@@ -892,7 +991,9 @@ discard block |
||
| 892 | 991 | break; |
| 893 | 992 | } |
| 894 | 993 | |
| 895 | - if($first_image) continue; |
|
| 994 | + if($first_image) { |
|
| 995 | + continue; |
|
| 996 | + } |
|
| 896 | 997 | |
| 897 | 998 | if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename)) |
| 898 | 999 | { |
@@ -919,7 +1020,9 @@ discard block |
||
| 919 | 1020 | foreach($matches as $target_image) |
| 920 | 1021 | { |
| 921 | 1022 | $target_src = trim($target_image[1]); |
| 922 | - if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue; |
|
| 1023 | + if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) { |
|
| 1024 | + continue; |
|
| 1025 | + } |
|
| 923 | 1026 | |
| 924 | 1027 | if(!preg_match('/^(http|https):\/\//i',$target_src)) |
| 925 | 1028 | { |
@@ -930,7 +1033,9 @@ discard block |
||
| 930 | 1033 | |
| 931 | 1034 | $tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex'); |
| 932 | 1035 | FileHandler::getRemoteFile($target_src, $tmp_file); |
| 933 | - if(!file_exists($tmp_file)) continue; |
|
| 1036 | + if(!file_exists($tmp_file)) { |
|
| 1037 | + continue; |
|
| 1038 | + } |
|
| 934 | 1039 | |
| 935 | 1040 | $imageinfo = getimagesize($tmp_file); |
| 936 | 1041 | list($_w, $_h) = $imageinfo; |
@@ -976,21 +1081,28 @@ discard block |
||
| 976 | 1081 | */ |
| 977 | 1082 | function getExtraImages($time_interval = 43200) |
| 978 | 1083 | { |
| 979 | - if(!$this->document_srl) return; |
|
| 1084 | + if(!$this->document_srl) { |
|
| 1085 | + return; |
|
| 1086 | + } |
|
| 980 | 1087 | // variables for icon list |
| 981 | 1088 | $buffs = array(); |
| 982 | 1089 | |
| 983 | 1090 | $check_files = false; |
| 984 | 1091 | |
| 985 | 1092 | // Check if secret post is |
| 986 | - if($this->isSecret()) $buffs[] = "secret"; |
|
| 1093 | + if($this->isSecret()) { |
|
| 1094 | + $buffs[] = "secret"; |
|
| 1095 | + } |
|
| 987 | 1096 | |
| 988 | 1097 | // Set the latest time |
| 989 | 1098 | $time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval); |
| 990 | 1099 | |
| 991 | 1100 | // Check new post |
| 992 | - if($this->get('regdate')>$time_check) $buffs[] = "new"; |
|
| 993 | - else if($this->get('last_update')>$time_check) $buffs[] = "update"; |
|
| 1101 | + if($this->get('regdate')>$time_check) { |
|
| 1102 | + $buffs[] = "new"; |
|
| 1103 | + } else if($this->get('last_update')>$time_check) { |
|
| 1104 | + $buffs[] = "update"; |
|
| 1105 | + } |
|
| 994 | 1106 | |
| 995 | 1107 | /* |
| 996 | 1108 | $content = $this->get('content'); |
@@ -1013,7 +1125,9 @@ discard block |
||
| 1013 | 1125 | */ |
| 1014 | 1126 | |
| 1015 | 1127 | // Check the attachment |
| 1016 | - if($this->hasUploadedFiles()) $buffs[] = "file"; |
|
| 1128 | + if($this->hasUploadedFiles()) { |
|
| 1129 | + $buffs[] = "file"; |
|
| 1130 | + } |
|
| 1017 | 1131 | |
| 1018 | 1132 | return $buffs; |
| 1019 | 1133 | } |
@@ -1034,22 +1148,25 @@ discard block |
||
| 1034 | 1148 | */ |
| 1035 | 1149 | function printExtraImages($time_check = 43200) |
| 1036 | 1150 | { |
| 1037 | - if(!$this->document_srl) return; |
|
| 1151 | + if(!$this->document_srl) { |
|
| 1152 | + return; |
|
| 1153 | + } |
|
| 1038 | 1154 | |
| 1039 | 1155 | $oDocumentModel = getModel('document'); |
| 1040 | 1156 | $documentConfig = $oDocumentModel->getDocumentConfig(); |
| 1041 | 1157 | if(Mobile::isFromMobilePhone()) |
| 1042 | 1158 | { |
| 1043 | 1159 | $iconSkin = $documentConfig->micons; |
| 1044 | - } |
|
| 1045 | - else |
|
| 1160 | + } else |
|
| 1046 | 1161 | { |
| 1047 | 1162 | $iconSkin = $documentConfig->icons; |
| 1048 | 1163 | } |
| 1049 | 1164 | $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
| 1050 | 1165 | |
| 1051 | 1166 | $buffs = $this->getExtraImages($time_check); |
| 1052 | - if(!count($buffs)) return; |
|
| 1167 | + if(!count($buffs)) { |
|
| 1168 | + return; |
|
| 1169 | + } |
|
| 1053 | 1170 | |
| 1054 | 1171 | $buff = array(); |
| 1055 | 1172 | foreach($buffs as $key => $val) |
@@ -1061,18 +1178,28 @@ discard block |
||
| 1061 | 1178 | |
| 1062 | 1179 | function hasUploadedFiles() |
| 1063 | 1180 | { |
| 1064 | - if(!$this->document_srl) return; |
|
| 1181 | + if(!$this->document_srl) { |
|
| 1182 | + return; |
|
| 1183 | + } |
|
| 1065 | 1184 | |
| 1066 | - if($this->isSecret() && !$this->isGranted()) return false; |
|
| 1185 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1186 | + return false; |
|
| 1187 | + } |
|
| 1067 | 1188 | return $this->get('uploaded_count')? true : false; |
| 1068 | 1189 | } |
| 1069 | 1190 | |
| 1070 | 1191 | function getUploadedFiles($sortIndex = 'file_srl') |
| 1071 | 1192 | { |
| 1072 | - if(!$this->document_srl) return; |
|
| 1193 | + if(!$this->document_srl) { |
|
| 1194 | + return; |
|
| 1195 | + } |
|
| 1073 | 1196 | |
| 1074 | - if($this->isSecret() && !$this->isGranted()) return; |
|
| 1075 | - if(!$this->get('uploaded_count')) return; |
|
| 1197 | + if($this->isSecret() && !$this->isGranted()) { |
|
| 1198 | + return; |
|
| 1199 | + } |
|
| 1200 | + if(!$this->get('uploaded_count')) { |
|
| 1201 | + return; |
|
| 1202 | + } |
|
| 1076 | 1203 | |
| 1077 | 1204 | if(!$this->uploadedFiles[$sortIndex]) |
| 1078 | 1205 | { |
@@ -1090,7 +1217,9 @@ discard block |
||
| 1090 | 1217 | function getEditor() |
| 1091 | 1218 | { |
| 1092 | 1219 | $module_srl = $this->get('module_srl'); |
| 1093 | - if(!$module_srl) $module_srl = Context::get('module_srl'); |
|
| 1220 | + if(!$module_srl) { |
|
| 1221 | + $module_srl = Context::get('module_srl'); |
|
| 1222 | + } |
|
| 1094 | 1223 | |
| 1095 | 1224 | $oEditorModel = getModel('editor'); |
| 1096 | 1225 | return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content'); |
@@ -1104,8 +1233,12 @@ discard block |
||
| 1104 | 1233 | function isEnableComment() |
| 1105 | 1234 | { |
| 1106 | 1235 | // Return false if not authorized, if a secret document, if the document is set not to allow any comment |
| 1107 | - if (!$this->allowComment()) return false; |
|
| 1108 | - if(!$this->isGranted() && $this->isSecret()) return false; |
|
| 1236 | + if (!$this->allowComment()) { |
|
| 1237 | + return false; |
|
| 1238 | + } |
|
| 1239 | + if(!$this->isGranted() && $this->isSecret()) { |
|
| 1240 | + return false; |
|
| 1241 | + } |
|
| 1109 | 1242 | |
| 1110 | 1243 | return true; |
| 1111 | 1244 | } |
@@ -1116,7 +1249,9 @@ discard block |
||
| 1116 | 1249 | */ |
| 1117 | 1250 | function getCommentEditor() |
| 1118 | 1251 | { |
| 1119 | - if(!$this->isEnableComment()) return; |
|
| 1252 | + if(!$this->isEnableComment()) { |
|
| 1253 | + return; |
|
| 1254 | + } |
|
| 1120 | 1255 | |
| 1121 | 1256 | $oEditorModel = getModel('editor'); |
| 1122 | 1257 | return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content'); |
@@ -1128,10 +1263,14 @@ discard block |
||
| 1128 | 1263 | */ |
| 1129 | 1264 | function getProfileImage() |
| 1130 | 1265 | { |
| 1131 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1266 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1267 | + return; |
|
| 1268 | + } |
|
| 1132 | 1269 | $oMemberModel = getModel('member'); |
| 1133 | 1270 | $profile_info = $oMemberModel->getProfileImage($this->get('member_srl')); |
| 1134 | - if(!$profile_info) return; |
|
| 1271 | + if(!$profile_info) { |
|
| 1272 | + return; |
|
| 1273 | + } |
|
| 1135 | 1274 | |
| 1136 | 1275 | return $profile_info->src; |
| 1137 | 1276 | } |
@@ -1143,7 +1282,9 @@ discard block |
||
| 1143 | 1282 | function getSignature() |
| 1144 | 1283 | { |
| 1145 | 1284 | // Pass if a document doesn't exist |
| 1146 | - if(!$this->isExists() || !$this->get('member_srl')) return; |
|
| 1285 | + if(!$this->isExists() || !$this->get('member_srl')) { |
|
| 1286 | + return; |
|
| 1287 | + } |
|
| 1147 | 1288 | // Get signature information |
| 1148 | 1289 | $oMemberModel = getModel('member'); |
| 1149 | 1290 | $signature = $oMemberModel->getSignature($this->get('member_srl')); |
@@ -1157,7 +1298,9 @@ discard block |
||
| 1157 | 1298 | if($signature) |
| 1158 | 1299 | { |
| 1159 | 1300 | $max_signature_height = $GLOBALS['__member_signature_max_height']; |
| 1160 | - 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); |
|
| 1301 | + if($max_signature_height) { |
|
| 1302 | + $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); |
|
| 1303 | + } |
|
| 1161 | 1304 | } |
| 1162 | 1305 | |
| 1163 | 1306 | return $signature; |
@@ -1181,20 +1324,25 @@ discard block |
||
| 1181 | 1324 | function _checkAccessibleFromStatus() |
| 1182 | 1325 | { |
| 1183 | 1326 | $logged_info = Context::get('logged_info'); |
| 1184 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1327 | + if($logged_info->is_admin == 'Y') { |
|
| 1328 | + return true; |
|
| 1329 | + } |
|
| 1185 | 1330 | |
| 1186 | 1331 | $status = $this->get('status'); |
| 1187 | - if(empty($status)) return false; |
|
| 1332 | + if(empty($status)) { |
|
| 1333 | + return false; |
|
| 1334 | + } |
|
| 1188 | 1335 | |
| 1189 | 1336 | $oDocumentModel = getModel('document'); |
| 1190 | 1337 | $configStatusList = $oDocumentModel->getStatusList(); |
| 1191 | 1338 | |
| 1192 | - if($status == $configStatusList['public'] || $status == $configStatusList['publish']) |
|
| 1193 | - return true; |
|
| 1194 | - else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1339 | + if($status == $configStatusList['public'] || $status == $configStatusList['publish']) { |
|
| 1340 | + return true; |
|
| 1341 | + } else if($status == $configStatusList['private'] || $status == $configStatusList['secret']) |
|
| 1195 | 1342 | { |
| 1196 | - if($this->get('member_srl') == $logged_info->member_srl) |
|
| 1197 | - return true; |
|
| 1343 | + if($this->get('member_srl') == $logged_info->member_srl) { |
|
| 1344 | + return true; |
|
| 1345 | + } |
|
| 1198 | 1346 | } |
| 1199 | 1347 | return false; |
| 1200 | 1348 | } |