@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function getDocumentExtraVarsFromDB($documentSrls) |
| 39 | 39 | { |
| 40 | - if(!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 40 | + if (!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 41 | 41 | { |
| 42 | 42 | return new BaseObject(-1, 'msg_invalid_request'); |
| 43 | 43 | } |
@@ -58,52 +58,52 @@ discard block |
||
| 58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
| 59 | 59 | |
| 60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
| 61 | - if(count($_document_list) <= 0) return; |
|
| 61 | + if (count($_document_list) <= 0) return; |
|
| 62 | 62 | |
| 63 | 63 | // Find all called the document object variable has been set extension |
| 64 | 64 | $document_srls = array(); |
| 65 | - foreach($_document_list as $key => $val) |
|
| 65 | + foreach ($_document_list as $key => $val) |
|
| 66 | 66 | { |
| 67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 67 | + if (!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 68 | 68 | $checked_documents[$val->document_srl] = true; |
| 69 | 69 | $document_srls[] = $val->document_srl; |
| 70 | 70 | } |
| 71 | 71 | // If the document number, return detected |
| 72 | - if(!count($document_srls)) return; |
|
| 72 | + if (!count($document_srls)) return; |
|
| 73 | 73 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
| 74 | 74 | //$obj->document_srl = implode(',',$document_srls); |
| 75 | 75 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
| 76 | - if($output->toBool() && $output->data) |
|
| 76 | + if ($output->toBool() && $output->data) |
|
| 77 | 77 | { |
| 78 | - foreach($output->data as $key => $val) |
|
| 78 | + foreach ($output->data as $key => $val) |
|
| 79 | 79 | { |
| 80 | - if(!isset($val->value)) continue; |
|
| 81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 80 | + if (!isset($val->value)) continue; |
|
| 81 | + if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 82 | 82 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $user_lang_code = Context::getLangType(); |
| 87 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
| 87 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
| 88 | 88 | { |
| 89 | 89 | $document_srl = $document_srls[$i]; |
| 90 | 90 | unset($vars); |
| 91 | 91 | |
| 92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 92 | + if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 93 | 93 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
| 94 | 94 | $extra_keys = $this->getExtraKeys($module_srl); |
| 95 | 95 | $vars = $extra_vars[$document_srl]; |
| 96 | 96 | $document_lang_code = $_document_list[$document_srl]->get('lang_code'); |
| 97 | 97 | // Expand the variable processing |
| 98 | - if(count($extra_keys)) |
|
| 98 | + if (count($extra_keys)) |
|
| 99 | 99 | { |
| 100 | - foreach($extra_keys as $idx => $key) |
|
| 100 | + foreach ($extra_keys as $idx => $key) |
|
| 101 | 101 | { |
| 102 | 102 | $extra_keys[$idx] = clone($key); |
| 103 | 103 | $val = $vars[$idx]; |
| 104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 106 | - else if(isset($val[0])) $v = $val[0]; |
|
| 104 | + if (isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 105 | + else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 106 | + else if (isset($val[0])) $v = $val[0]; |
|
| 107 | 107 | else $v = null; |
| 108 | 108 | $extra_keys[$idx]->value = $v; |
| 109 | 109 | } |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | $evars = new ExtraVar($module_srl); |
| 114 | 114 | $evars->setExtraVarKeys($extra_keys); |
| 115 | 115 | // Title Processing |
| 116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 116 | + if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]); |
|
| 117 | 117 | // Information processing |
| 118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 118 | + if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]); |
|
| 119 | 119 | |
| 120 | 120 | // static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남 |
| 121 | 121 | /* |
@@ -137,21 +137,21 @@ discard block |
||
| 137 | 137 | * @param array $columnList |
| 138 | 138 | * @return documentItem |
| 139 | 139 | */ |
| 140 | - function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 140 | + function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 141 | 141 | { |
| 142 | - if(!$document_srl) return new documentItem(); |
|
| 142 | + if (!$document_srl) return new documentItem(); |
|
| 143 | 143 | |
| 144 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 144 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 145 | 145 | { |
| 146 | 146 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
| 147 | - if(!$oDocument->isExists()) |
|
| 147 | + if (!$oDocument->isExists()) |
|
| 148 | 148 | { |
| 149 | 149 | return $oDocument; |
| 150 | 150 | } |
| 151 | 151 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 152 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 152 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 153 | 153 | } |
| 154 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 154 | + if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 155 | 155 | |
| 156 | 156 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 157 | 157 | } |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | * @param array $columnList |
| 165 | 165 | * @return array value type is documentItem |
| 166 | 166 | */ |
| 167 | - function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 167 | + function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 168 | 168 | { |
| 169 | - if(is_array($document_srls)) |
|
| 169 | + if (is_array($document_srls)) |
|
| 170 | 170 | { |
| 171 | 171 | $list_count = count($document_srls); |
| 172 | - $document_srls = implode(',',$document_srls); |
|
| 172 | + $document_srls = implode(',', $document_srls); |
|
| 173 | 173 | } |
| 174 | 174 | else |
| 175 | 175 | { |
@@ -182,33 +182,33 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $output = executeQuery('document.getDocuments', $args, $columnList); |
| 184 | 184 | $document_list = $output->data; |
| 185 | - if(!$document_list) return; |
|
| 186 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 185 | + if (!$document_list) return; |
|
| 186 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 187 | 187 | |
| 188 | 188 | $document_count = count($document_list); |
| 189 | - foreach($document_list as $key => $attribute) |
|
| 189 | + foreach ($document_list as $key => $attribute) |
|
| 190 | 190 | { |
| 191 | 191 | $document_srl = $attribute->document_srl; |
| 192 | - if(!$document_srl) continue; |
|
| 192 | + if (!$document_srl) continue; |
|
| 193 | 193 | |
| 194 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 194 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 195 | 195 | { |
| 196 | 196 | $oDocument = null; |
| 197 | 197 | $oDocument = new documentItem(); |
| 198 | 198 | $oDocument->setAttribute($attribute, false); |
| 199 | - if($is_admin) $oDocument->setGrant(); |
|
| 199 | + if ($is_admin) $oDocument->setGrant(); |
|
| 200 | 200 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 206 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 207 | 207 | |
| 208 | 208 | $output = null; |
| 209 | - if(count($result)) |
|
| 209 | + if (count($result)) |
|
| 210 | 210 | { |
| 211 | - foreach($result as $document_srl => $val) |
|
| 211 | + foreach ($result as $document_srl => $val) |
|
| 212 | 212 | { |
| 213 | 213 | $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 214 | 214 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param array $columnList |
| 226 | 226 | * @return BaseObject |
| 227 | 227 | */ |
| 228 | - function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) |
|
| 228 | + function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array()) |
|
| 229 | 229 | { |
| 230 | 230 | $sort_check = $this->_setSortIndex($obj, $load_extra_vars); |
| 231 | 231 | $obj->sort_index = $sort_check->sort_index; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | // Call trigger (before) |
| 236 | 236 | // This trigger can be used to set an alternative output using a different search method |
| 237 | 237 | $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); |
| 238 | - if($output instanceof BaseObject && !$output->toBool()) |
|
| 238 | + if ($output instanceof BaseObject && !$output->toBool()) |
|
| 239 | 239 | { |
| 240 | 240 | return $output; |
| 241 | 241 | } |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | $output = $obj->use_alternate_output; |
| 253 | 253 | unset($obj->use_alternate_output); |
| 254 | 254 | } |
| 255 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 255 | + elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars')) |
|
| 256 | 256 | { |
| 257 | 257 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
| 258 | - $args->sort_index = str_replace('documents.','',$args->sort_index); |
|
| 258 | + $args->sort_index = str_replace('documents.', '', $args->sort_index); |
|
| 259 | 259 | $output = executeQueryArray($query_id, $args); |
| 260 | 260 | } |
| 261 | 261 | elseif ($sort_check->isExtraVars) |
@@ -267,16 +267,16 @@ discard block |
||
| 267 | 267 | // document.getDocumentList query execution |
| 268 | 268 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
| 269 | 269 | $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1); |
| 270 | - if(isset($groupByQuery[$query_id])) |
|
| 270 | + if (isset($groupByQuery[$query_id])) |
|
| 271 | 271 | { |
| 272 | 272 | $group_args = clone($args); |
| 273 | 273 | $group_args->sort_index = 'documents.'.$args->sort_index; |
| 274 | 274 | $output = executeQueryArray($query_id, $group_args); |
| 275 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 275 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 276 | 276 | |
| 277 | - foreach($output->data as $key => $val) |
|
| 277 | + foreach ($output->data as $key => $val) |
|
| 278 | 278 | { |
| 279 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 279 | + if ($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | $page_navigation = $output->page_navigation; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $virtual_number = $keys[0]; |
| 285 | 285 | |
| 286 | 286 | $target_args = new stdClass(); |
| 287 | - $target_args->document_srls = implode(',',$target_srls); |
|
| 287 | + $target_args->document_srls = implode(',', $target_srls); |
|
| 288 | 288 | $target_args->list_order = $args->sort_index; |
| 289 | 289 | $target_args->order_type = $args->order_type; |
| 290 | 290 | $target_args->list_count = $args->list_count; |
@@ -301,35 +301,35 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | // Return if no result or an error occurs |
| 304 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 304 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 305 | 305 | $idx = 0; |
| 306 | 306 | $data = $output->data; |
| 307 | 307 | unset($output->data); |
| 308 | 308 | |
| 309 | - if(!isset($virtual_number)) |
|
| 309 | + if (!isset($virtual_number)) |
|
| 310 | 310 | { |
| 311 | 311 | $keys = array_keys($data); |
| 312 | 312 | $virtual_number = $keys[0]; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - if($except_notice) |
|
| 315 | + if ($except_notice) |
|
| 316 | 316 | { |
| 317 | - foreach($data as $key => $attribute) |
|
| 317 | + foreach ($data as $key => $attribute) |
|
| 318 | 318 | { |
| 319 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
| 319 | + if ($attribute->is_notice == 'Y') $virtual_number--; |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - foreach($data as $key => $attribute) |
|
| 323 | + foreach ($data as $key => $attribute) |
|
| 324 | 324 | { |
| 325 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 325 | + if ($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 326 | 326 | $document_srl = $attribute->document_srl; |
| 327 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 327 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 328 | 328 | { |
| 329 | 329 | $oDocument = null; |
| 330 | 330 | $oDocument = new documentItem(); |
| 331 | 331 | $oDocument->setAttribute($attribute, false); |
| 332 | - if(Context::get('logged_info')->is_admin == 'Y') $oDocument->setGrant(); |
|
| 332 | + if (Context::get('logged_info')->is_admin == 'Y') $oDocument->setGrant(); |
|
| 333 | 333 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 334 | 334 | } |
| 335 | 335 | |
@@ -337,11 +337,11 @@ discard block |
||
| 337 | 337 | $virtual_number--; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 340 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 341 | 341 | |
| 342 | - if(count($output->data)) |
|
| 342 | + if (count($output->data)) |
|
| 343 | 343 | { |
| 344 | - foreach($output->data as $number => $document) |
|
| 344 | + foreach ($output->data as $number => $document) |
|
| 345 | 345 | { |
| 346 | 346 | $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl]; |
| 347 | 347 | } |
@@ -363,16 +363,16 @@ discard block |
||
| 363 | 363 | { |
| 364 | 364 | $args = new stdClass(); |
| 365 | 365 | $args->module_srl = $obj->module_srl; |
| 366 | - $args->category_srl= $obj->category_srl; |
|
| 366 | + $args->category_srl = $obj->category_srl; |
|
| 367 | 367 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
| 368 | - if(!$output->toBool()||!$output->data) return; |
|
| 368 | + if (!$output->toBool() || !$output->data) return; |
|
| 369 | 369 | |
| 370 | - foreach($output->data as $key => $val) |
|
| 370 | + foreach ($output->data as $key => $val) |
|
| 371 | 371 | { |
| 372 | 372 | $document_srl = $val->document_srl; |
| 373 | - if(!$document_srl) continue; |
|
| 373 | + if (!$document_srl) continue; |
|
| 374 | 374 | |
| 375 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 375 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 376 | 376 | { |
| 377 | 377 | $oDocument = null; |
| 378 | 378 | $oDocument = new documentItem(); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | $this->setToAllDocumentExtraVars(); |
| 385 | 385 | |
| 386 | - foreach($result->data as $document_srl => $val) |
|
| 386 | + foreach ($result->data as $document_srl => $val) |
|
| 387 | 387 | { |
| 388 | 388 | $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 389 | 389 | } |
@@ -399,20 +399,20 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | function getExtraKeys($module_srl) |
| 401 | 401 | { |
| 402 | - if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 402 | + if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 403 | 403 | { |
| 404 | 404 | $keys = false; |
| 405 | 405 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 406 | - if($oCacheHandler->isSupport()) |
|
| 406 | + if ($oCacheHandler->isSupport()) |
|
| 407 | 407 | { |
| 408 | - $object_key = 'module_document_extra_keys:' . $module_srl; |
|
| 408 | + $object_key = 'module_document_extra_keys:'.$module_srl; |
|
| 409 | 409 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 410 | 410 | $keys = $oCacheHandler->get($cache_key); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | $oExtraVar = ExtraVar::getInstance($module_srl); |
| 414 | 414 | |
| 415 | - if($keys === false) |
|
| 415 | + if ($keys === false) |
|
| 416 | 416 | { |
| 417 | 417 | $obj = new stdClass(); |
| 418 | 418 | $obj->module_srl = $module_srl; |
@@ -422,13 +422,13 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | // correcting index order |
| 424 | 424 | $isFixed = FALSE; |
| 425 | - if(is_array($output->data)) |
|
| 425 | + if (is_array($output->data)) |
|
| 426 | 426 | { |
| 427 | 427 | $prevIdx = 0; |
| 428 | - foreach($output->data as $no => $value) |
|
| 428 | + foreach ($output->data as $no => $value) |
|
| 429 | 429 | { |
| 430 | 430 | // case first |
| 431 | - if($prevIdx == 0 && $value->idx != 1) |
|
| 431 | + if ($prevIdx == 0 && $value->idx != 1) |
|
| 432 | 432 | { |
| 433 | 433 | $args = new stdClass(); |
| 434 | 434 | $args->module_srl = $module_srl; |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | // case others |
| 445 | - if($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 445 | + if ($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 446 | 446 | { |
| 447 | 447 | $args = new stdClass(); |
| 448 | 448 | $args->module_srl = $module_srl; |
@@ -459,16 +459,16 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - if($isFixed) |
|
| 462 | + if ($isFixed) |
|
| 463 | 463 | { |
| 464 | 464 | $output = executeQueryArray('document.getDocumentExtraKeys', $obj); |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | $oExtraVar->setExtraVarKeys($output->data); |
| 468 | 468 | $keys = $oExtraVar->getExtraVars(); |
| 469 | - if(!$keys) $keys = array(); |
|
| 469 | + if (!$keys) $keys = array(); |
|
| 470 | 470 | |
| 471 | - if($oCacheHandler->isSupport()) |
|
| 471 | + if ($oCacheHandler->isSupport()) |
|
| 472 | 472 | { |
| 473 | 473 | $oCacheHandler->put($cache_key, $keys); |
| 474 | 474 | } |
@@ -489,14 +489,14 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | function getExtraVars($module_srl, $document_srl) |
| 491 | 491 | { |
| 492 | - if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 492 | + if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 493 | 493 | { |
| 494 | 494 | // Extended to extract the values of variables set |
| 495 | 495 | $oDocument = $this->getDocument($document_srl, false); |
| 496 | 496 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 497 | 497 | $this->setToAllDocumentExtraVars(); |
| 498 | 498 | } |
| 499 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 499 | + if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 500 | 500 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -519,71 +519,71 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | $oDocumentController = getController('document'); |
| 521 | 521 | // Members must be a possible feature |
| 522 | - if($logged_info->member_srl) |
|
| 522 | + if ($logged_info->member_srl) |
|
| 523 | 523 | { |
| 524 | 524 | $oDocumentModel = getModel('document'); |
| 525 | 525 | $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); |
| 526 | 526 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 527 | 527 | $module_srl = $oDocument->get('module_srl'); |
| 528 | 528 | $member_srl = $oDocument->get('member_srl'); |
| 529 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 529 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 530 | 530 | |
| 531 | 531 | $oModuleModel = getModel('module'); |
| 532 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 533 | - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) |
|
| 532 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 533 | + if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
| 534 | 534 | { |
| 535 | 535 | // Add a Referral Button |
| 536 | 536 | $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); |
| 537 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); |
|
| 537 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) |
|
| 540 | + if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
| 541 | 541 | { |
| 542 | 542 | // Add button to negative |
| 543 | - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 544 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); |
|
| 543 | + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 544 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); |
|
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | // Adding Report |
| 548 | 548 | $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); |
| 549 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript'); |
|
| 549 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript'); |
|
| 550 | 550 | |
| 551 | 551 | // Add Bookmark button |
| 552 | 552 | $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); |
| 553 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript'); |
|
| 553 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript'); |
|
| 554 | 554 | } |
| 555 | 555 | // Add print button |
| 556 | - $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); |
|
| 557 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument'); |
|
| 556 | + $url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl); |
|
| 557 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument'); |
|
| 558 | 558 | // Call a trigger (after) |
| 559 | 559 | ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); |
| 560 | - if($this->grant->manager) |
|
| 560 | + if ($this->grant->manager) |
|
| 561 | 561 | { |
| 562 | 562 | $str_confirm = Context::getLang('confirm_move'); |
| 563 | 563 | $url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl); |
| 564 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript'); |
|
| 564 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | // If you are managing to find posts by ip |
| 568 | - if($logged_info->is_admin == 'Y') |
|
| 568 | + if ($logged_info->is_admin == 'Y') |
|
| 569 | 569 | { |
| 570 | 570 | $oDocumentModel = getModel('document'); |
| 571 | - $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 571 | + $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 572 | 572 | |
| 573 | - if($oDocument->isExists()) |
|
| 573 | + if ($oDocument->isExists()) |
|
| 574 | 574 | { |
| 575 | 575 | // Find a post equivalent to ip address |
| 576 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress()); |
|
| 577 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); |
|
| 576 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress()); |
|
| 577 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); |
|
| 578 | 578 | |
| 579 | 579 | $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress()); |
| 580 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript'); |
|
| 580 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); |
|
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | 583 | // Changing the language of pop-up menu |
| 584 | 584 | $menus = Context::get('document_popup_menu_list'); |
| 585 | 585 | $menus_count = count($menus); |
| 586 | - for($i=0;$i<$menus_count;$i++) |
|
| 586 | + for ($i = 0; $i < $menus_count; $i++) |
|
| 587 | 587 | { |
| 588 | 588 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
| 589 | 589 | } |
@@ -599,13 +599,13 @@ discard block |
||
| 599 | 599 | */ |
| 600 | 600 | function getDocumentCount($module_srl, $search_obj = NULL) |
| 601 | 601 | { |
| 602 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
| 602 | + if (is_null($search_obj)) $search_obj = new stdClass(); |
|
| 603 | 603 | $search_obj->module_srl = $module_srl; |
| 604 | 604 | |
| 605 | 605 | $output = executeQuery('document.getDocumentCount', $search_obj); |
| 606 | 606 | // Return total number of |
| 607 | 607 | $total_count = $output->data->count; |
| 608 | - return (int)$total_count; |
|
| 608 | + return (int) $total_count; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | function getDocumentCountByGroupStatus($search_obj = NULL) |
| 617 | 617 | { |
| 618 | 618 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
| 619 | - if(!$output->toBool()) return array(); |
|
| 619 | + if (!$output->toBool()) return array(); |
|
| 620 | 620 | |
| 621 | 621 | return $output->data; |
| 622 | 622 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $output = executeQuery('document.getDocumentExtraVarsCount', $args); |
| 636 | 636 | // Return total number of |
| 637 | 637 | $total_count = $output->data->count; |
| 638 | - return (int)$total_count; |
|
| 638 | + return (int) $total_count; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
@@ -652,29 +652,29 @@ discard block |
||
| 652 | 652 | |
| 653 | 653 | $this->_setSearchOption($opt, $args, $query_id, $use_division); |
| 654 | 654 | |
| 655 | - if($sort_check->isExtraVars) |
|
| 655 | + if ($sort_check->isExtraVars) |
|
| 656 | 656 | { |
| 657 | 657 | return 1; |
| 658 | 658 | } |
| 659 | 659 | else |
| 660 | 660 | { |
| 661 | - if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 661 | + if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 662 | 662 | { |
| 663 | - if($args->order_type === 'desc') |
|
| 663 | + if ($args->order_type === 'desc') |
|
| 664 | 664 | { |
| 665 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 665 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 666 | 666 | } |
| 667 | 667 | else |
| 668 | 668 | { |
| 669 | 669 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | - elseif($sort_check->sort_index === 'regdate') |
|
| 672 | + elseif ($sort_check->sort_index === 'regdate') |
|
| 673 | 673 | { |
| 674 | 674 | |
| 675 | - if($args->order_type === 'asc') |
|
| 675 | + if ($args->order_type === 'asc') |
|
| 676 | 676 | { |
| 677 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 677 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 678 | 678 | } |
| 679 | 679 | else |
| 680 | 680 | { |
@@ -689,9 +689,9 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // Guhanhu total number of the article search page |
| 692 | - $output = executeQuery($query_id . 'Page', $args); |
|
| 692 | + $output = executeQuery($query_id.'Page', $args); |
|
| 693 | 693 | $count = $output->data->count; |
| 694 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
| 694 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
| 695 | 695 | return $page; |
| 696 | 696 | } |
| 697 | 697 | |
@@ -703,16 +703,16 @@ discard block |
||
| 703 | 703 | */ |
| 704 | 704 | function getCategory($category_srl, $columnList = array()) |
| 705 | 705 | { |
| 706 | - $args =new stdClass(); |
|
| 706 | + $args = new stdClass(); |
|
| 707 | 707 | $args->category_srl = $category_srl; |
| 708 | 708 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 709 | 709 | |
| 710 | 710 | $node = $output->data; |
| 711 | - if(!$node) return; |
|
| 711 | + if (!$node) return; |
|
| 712 | 712 | |
| 713 | - if($node->group_srls) |
|
| 713 | + if ($node->group_srls) |
|
| 714 | 714 | { |
| 715 | - $group_srls = explode(',',$node->group_srls); |
|
| 715 | + $group_srls = explode(',', $node->group_srls); |
|
| 716 | 716 | unset($node->group_srls); |
| 717 | 717 | $node->group_srls = $group_srls; |
| 718 | 718 | } |
@@ -733,8 +733,8 @@ discard block |
||
| 733 | 733 | { |
| 734 | 734 | $args = new stdClass(); |
| 735 | 735 | $args->category_srl = $category_srl; |
| 736 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
| 737 | - if($output->data->count > 0) return true; |
|
| 736 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
| 737 | + if ($output->data->count > 0) return true; |
|
| 738 | 738 | return false; |
| 739 | 739 | } |
| 740 | 740 | |
@@ -747,15 +747,15 @@ discard block |
||
| 747 | 747 | */ |
| 748 | 748 | function getCategoryList($module_srl, $columnList = array()) |
| 749 | 749 | { |
| 750 | - $module_srl = (int)$module_srl; |
|
| 750 | + $module_srl = (int) $module_srl; |
|
| 751 | 751 | |
| 752 | 752 | // Category of the target module file swollen |
| 753 | 753 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
| 754 | 754 | // If the target file to the cache file regeneration category |
| 755 | - if(!file_exists($filename)) |
|
| 755 | + if (!file_exists($filename)) |
|
| 756 | 756 | { |
| 757 | 757 | $oDocumentController = getController('document'); |
| 758 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 758 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | include($filename); |
@@ -775,10 +775,10 @@ discard block |
||
| 775 | 775 | */ |
| 776 | 776 | function _arrangeCategory(&$document_category, $list, $depth) |
| 777 | 777 | { |
| 778 | - if(!count($list)) return; |
|
| 778 | + if (!count($list)) return; |
|
| 779 | 779 | $idx = 0; |
| 780 | 780 | $list_order = array(); |
| 781 | - foreach($list as $key => $val) |
|
| 781 | + foreach ($list as $key => $val) |
|
| 782 | 782 | { |
| 783 | 783 | $obj = new stdClass; |
| 784 | 784 | $obj->mid = $val['mid']; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | $obj->parent_srl = $val['parent_srl']; |
| 788 | 788 | $obj->title = $obj->text = $val['text']; |
| 789 | 789 | $obj->description = $val['description']; |
| 790 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
| 790 | + $obj->expand = $val['expand'] == 'Y' ?true:false; |
|
| 791 | 791 | $obj->color = $val['color']; |
| 792 | 792 | $obj->document_count = $val['document_count']; |
| 793 | 793 | $obj->depth = $depth; |
@@ -795,26 +795,26 @@ discard block |
||
| 795 | 795 | $obj->childs = array(); |
| 796 | 796 | $obj->grant = $val['grant']; |
| 797 | 797 | |
| 798 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 798 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 799 | 799 | else $selected = false; |
| 800 | 800 | |
| 801 | 801 | $obj->selected = $selected; |
| 802 | 802 | |
| 803 | 803 | $list_order[$idx++] = $obj->category_srl; |
| 804 | 804 | // If you have a parent category of child nodes apply data |
| 805 | - if($obj->parent_srl) |
|
| 805 | + if ($obj->parent_srl) |
|
| 806 | 806 | { |
| 807 | 807 | $parent_srl = $obj->parent_srl; |
| 808 | 808 | $document_count = $obj->document_count; |
| 809 | 809 | $expand = $obj->expand; |
| 810 | - if($selected) $expand = true; |
|
| 810 | + if ($selected) $expand = true; |
|
| 811 | 811 | |
| 812 | - while($parent_srl) |
|
| 812 | + while ($parent_srl) |
|
| 813 | 813 | { |
| 814 | 814 | $document_category[$parent_srl]->document_count += $document_count; |
| 815 | 815 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 816 | 816 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 817 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 817 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 818 | 818 | |
| 819 | 819 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 820 | 820 | } |
@@ -822,10 +822,10 @@ discard block |
||
| 822 | 822 | |
| 823 | 823 | $document_category[$key] = $obj; |
| 824 | 824 | |
| 825 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 825 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
| 826 | 826 | } |
| 827 | 827 | $document_category[$list_order[0]]->first = true; |
| 828 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
| 828 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | /** |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | $args->module_srl = $module_srl; |
| 841 | 841 | $args->category_srl = $category_srl; |
| 842 | 842 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
| 843 | - return (int)$output->data->count; |
|
| 843 | + return (int) $output->data->count; |
|
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | /** |
@@ -850,8 +850,8 @@ discard block |
||
| 850 | 850 | */ |
| 851 | 851 | function getCategoryXmlFile($module_srl) |
| 852 | 852 | { |
| 853 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
| 854 | - if(!file_exists($xml_file)) |
|
| 853 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
| 854 | + if (!file_exists($xml_file)) |
|
| 855 | 855 | { |
| 856 | 856 | $oDocumentController = getController('document'); |
| 857 | 857 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -866,8 +866,8 @@ discard block |
||
| 866 | 866 | */ |
| 867 | 867 | function getCategoryPhpFile($module_srl) |
| 868 | 868 | { |
| 869 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
| 870 | - if(!file_exists($php_file)) |
|
| 869 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
| 870 | + if (!file_exists($php_file)) |
|
| 871 | 871 | { |
| 872 | 872 | $oDocumentController = getController('document'); |
| 873 | 873 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | */ |
| 883 | 883 | function getMonthlyArchivedList($obj) |
| 884 | 884 | { |
| 885 | - if($obj->mid) |
|
| 885 | + if ($obj->mid) |
|
| 886 | 886 | { |
| 887 | 887 | $oModuleModel = getModel('module'); |
| 888 | 888 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -890,13 +890,13 @@ discard block |
||
| 890 | 890 | } |
| 891 | 891 | // Module_srl passed the array may be a check whether the array |
| 892 | 892 | $args = new stdClass; |
| 893 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 893 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 894 | 894 | else $args->module_srl = $obj->module_srl; |
| 895 | 895 | |
| 896 | 896 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 897 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 897 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 898 | 898 | |
| 899 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 899 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 900 | 900 | |
| 901 | 901 | return $output; |
| 902 | 902 | } |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | */ |
| 909 | 909 | function getDailyArchivedList($obj) |
| 910 | 910 | { |
| 911 | - if($obj->mid) |
|
| 911 | + if ($obj->mid) |
|
| 912 | 912 | { |
| 913 | 913 | $oModuleModel = getModel('module'); |
| 914 | 914 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -916,14 +916,14 @@ discard block |
||
| 916 | 916 | } |
| 917 | 917 | // Module_srl passed the array may be a check whether the array |
| 918 | 918 | $args = new stdClass; |
| 919 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 919 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 920 | 920 | else $args->module_srl = $obj->module_srl; |
| 921 | 921 | $args->regdate = $obj->regdate; |
| 922 | 922 | |
| 923 | 923 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 924 | - if(!$output->toBool()) return $output; |
|
| 924 | + if (!$output->toBool()) return $output; |
|
| 925 | 925 | |
| 926 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 926 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 927 | 927 | |
| 928 | 928 | return $output; |
| 929 | 929 | } |
@@ -934,17 +934,17 @@ discard block |
||
| 934 | 934 | */ |
| 935 | 935 | function getDocumentCategories() |
| 936 | 936 | { |
| 937 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 937 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 938 | 938 | $module_srl = Context::get('module_srl'); |
| 939 | - $categories= $this->getCategoryList($module_srl); |
|
| 939 | + $categories = $this->getCategoryList($module_srl); |
|
| 940 | 940 | $lang = Context::get('lang'); |
| 941 | 941 | // No additional category |
| 942 | 942 | $output = "0,0,{$lang->none_category}\n"; |
| 943 | - if($categories) |
|
| 943 | + if ($categories) |
|
| 944 | 944 | { |
| 945 | - foreach($categories as $category_srl => $category) |
|
| 945 | + foreach ($categories as $category_srl => $category) |
|
| 946 | 946 | { |
| 947 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
| 947 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
| 948 | 948 | } |
| 949 | 949 | } |
| 950 | 950 | $this->add('categories', $output); |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | */ |
| 957 | 957 | function getDocumentConfig() |
| 958 | 958 | { |
| 959 | - if($this->documentConfig === NULL) |
|
| 959 | + if ($this->documentConfig === NULL) |
|
| 960 | 960 | { |
| 961 | 961 | $oModuleModel = getModel('module'); |
| 962 | 962 | $config = $oModuleModel->getModuleConfig('document'); |
@@ -1029,11 +1029,11 @@ discard block |
||
| 1029 | 1029 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1030 | 1030 | // Check permissions |
| 1031 | 1031 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1032 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1032 | + if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1033 | 1033 | |
| 1034 | 1034 | $category_srl = Context::get('category_srl'); |
| 1035 | 1035 | $category_info = $this->getCategory($category_srl); |
| 1036 | - if(!$category_info) |
|
| 1036 | + if (!$category_info) |
|
| 1037 | 1037 | { |
| 1038 | 1038 | return new BaseObject(-1, 'msg_invalid_request'); |
| 1039 | 1039 | } |
@@ -1049,14 +1049,14 @@ discard block |
||
| 1049 | 1049 | */ |
| 1050 | 1050 | function getDocumentSrlByAlias($mid, $alias) |
| 1051 | 1051 | { |
| 1052 | - if(!$mid || !$alias) return null; |
|
| 1052 | + if (!$mid || !$alias) return null; |
|
| 1053 | 1053 | $site_module_info = Context::get('site_module_info'); |
| 1054 | 1054 | $args = new stdClass; |
| 1055 | 1055 | $args->mid = $mid; |
| 1056 | 1056 | $args->alias_title = $alias; |
| 1057 | 1057 | $args->site_srl = $site_module_info->site_srl; |
| 1058 | 1058 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1059 | - if(!$output->data) return null; |
|
| 1059 | + if (!$output->data) return null; |
|
| 1060 | 1060 | else return $output->data->document_srl; |
| 1061 | 1061 | } |
| 1062 | 1062 | |
@@ -1068,15 +1068,15 @@ discard block |
||
| 1068 | 1068 | */ |
| 1069 | 1069 | function getDocumentSrlByTitle($module_srl, $title) |
| 1070 | 1070 | { |
| 1071 | - if(!$module_srl || !$title) return null; |
|
| 1071 | + if (!$module_srl || !$title) return null; |
|
| 1072 | 1072 | $args = new stdClass; |
| 1073 | 1073 | $args->module_srl = $module_srl; |
| 1074 | 1074 | $args->title = $title; |
| 1075 | 1075 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1076 | - if(!$output->data) return null; |
|
| 1076 | + if (!$output->data) return null; |
|
| 1077 | 1077 | else |
| 1078 | 1078 | { |
| 1079 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1079 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1080 | 1080 | return $output->data->document_srl; |
| 1081 | 1081 | } |
| 1082 | 1082 | } |
@@ -1088,12 +1088,12 @@ discard block |
||
| 1088 | 1088 | */ |
| 1089 | 1089 | function getAlias($document_srl) |
| 1090 | 1090 | { |
| 1091 | - if(!$document_srl) return null; |
|
| 1091 | + if (!$document_srl) return null; |
|
| 1092 | 1092 | $args = new stdClass; |
| 1093 | 1093 | $args->document_srl = $document_srl; |
| 1094 | 1094 | $output = executeQueryArray('document.getAliases', $args); |
| 1095 | 1095 | |
| 1096 | - if(!$output->data) return null; |
|
| 1096 | + if (!$output->data) return null; |
|
| 1097 | 1097 | else return $output->data[0]->alias_title; |
| 1098 | 1098 | } |
| 1099 | 1099 | |
@@ -1136,32 +1136,32 @@ discard block |
||
| 1136 | 1136 | { |
| 1137 | 1137 | // Variable check |
| 1138 | 1138 | $args = new stdClass; |
| 1139 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
| 1139 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
| 1140 | 1140 | $args->sort_index = $obj->sort_index; |
| 1141 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
| 1142 | - $args->page = $obj->page?$obj->page:1; |
|
| 1143 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
| 1144 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
| 1141 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
| 1142 | + $args->page = $obj->page ? $obj->page : 1; |
|
| 1143 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
| 1144 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
| 1145 | 1145 | // Search options |
| 1146 | 1146 | $search_target = $obj->search_target; |
| 1147 | 1147 | $search_keyword = $obj->search_keyword; |
| 1148 | - if($search_target && $search_keyword) |
|
| 1148 | + if ($search_target && $search_keyword) |
|
| 1149 | 1149 | { |
| 1150 | - switch($search_target) |
|
| 1150 | + switch ($search_target) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | case 'title' : |
| 1153 | 1153 | case 'content' : |
| 1154 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1154 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1155 | 1155 | $args->{"s_".$search_target} = $search_keyword; |
| 1156 | 1156 | $use_division = true; |
| 1157 | 1157 | break; |
| 1158 | 1158 | case 'title_content' : |
| 1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1159 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1160 | 1160 | $args->s_title = $search_keyword; |
| 1161 | 1161 | $args->s_content = $search_keyword; |
| 1162 | 1162 | break; |
| 1163 | 1163 | case 'user_id' : |
| 1164 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1164 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1165 | 1165 | $args->s_user_id = $search_keyword; |
| 1166 | 1166 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1167 | 1167 | break; |
@@ -1169,13 +1169,13 @@ discard block |
||
| 1169 | 1169 | case 'nick_name' : |
| 1170 | 1170 | case 'email_address' : |
| 1171 | 1171 | case 'homepage' : |
| 1172 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1172 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1173 | 1173 | $args->{"s_".$search_target} = $search_keyword; |
| 1174 | 1174 | break; |
| 1175 | 1175 | case 'is_notice' : |
| 1176 | 1176 | case 'is_secret' : |
| 1177 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1178 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1177 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1178 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1179 | 1179 | break; |
| 1180 | 1180 | case 'member_srl' : |
| 1181 | 1181 | case 'readed_count' : |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | case 'comment_count' : |
| 1185 | 1185 | case 'trackback_count' : |
| 1186 | 1186 | case 'uploaded_count' : |
| 1187 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1187 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1188 | 1188 | break; |
| 1189 | 1189 | case 'regdate' : |
| 1190 | 1190 | case 'last_update' : |
@@ -1196,9 +1196,9 @@ discard block |
||
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | $output = executeQueryArray('document.getTrashList', $args); |
| 1199 | - if($output->data) |
|
| 1199 | + if ($output->data) |
|
| 1200 | 1200 | { |
| 1201 | - foreach($output->data as $key => $attribute) |
|
| 1201 | + foreach ($output->data as $key => $attribute) |
|
| 1202 | 1202 | { |
| 1203 | 1203 | $oDocument = null; |
| 1204 | 1204 | $oDocument = new documentItem(); |
@@ -1217,46 +1217,46 @@ discard block |
||
| 1217 | 1217 | { |
| 1218 | 1218 | $args = new stdClass; |
| 1219 | 1219 | $document_srl = Context::get('document_srl'); |
| 1220 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1220 | + if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1221 | 1221 | |
| 1222 | 1222 | $point = Context::get('point'); |
| 1223 | - if($point != -1) $point = 1; |
|
| 1223 | + if ($point != -1) $point = 1; |
|
| 1224 | 1224 | |
| 1225 | 1225 | $oDocumentModel = getModel('document'); |
| 1226 | 1226 | $columnList = array('document_srl', 'module_srl'); |
| 1227 | 1227 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1228 | 1228 | $module_srl = $oDocument->get('module_srl'); |
| 1229 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1229 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1230 | 1230 | |
| 1231 | 1231 | $oModuleModel = getModel('module'); |
| 1232 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 1233 | - if($point == -1) |
|
| 1232 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 1233 | + if ($point == -1) |
|
| 1234 | 1234 | { |
| 1235 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1235 | + if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1236 | 1236 | $args->below_point = 0; |
| 1237 | 1237 | } |
| 1238 | 1238 | else |
| 1239 | 1239 | { |
| 1240 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1240 | + if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1241 | 1241 | $args->more_point = 0; |
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | 1244 | $args->document_srl = $document_srl; |
| 1245 | 1245 | |
| 1246 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
| 1247 | - if(!$output->toBool()) return $output; |
|
| 1246 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
| 1247 | + if (!$output->toBool()) return $output; |
|
| 1248 | 1248 | |
| 1249 | 1249 | $oMemberModel = getModel('member'); |
| 1250 | - if($output->data) |
|
| 1250 | + if ($output->data) |
|
| 1251 | 1251 | { |
| 1252 | - foreach($output->data as $k => $d) |
|
| 1252 | + foreach ($output->data as $k => $d) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
| 1255 | 1255 | $output->data[$k]->src = $profile_image->src; |
| 1256 | 1256 | } |
| 1257 | 1257 | } |
| 1258 | 1258 | |
| 1259 | - $this->add('voted_member_list',$output->data); |
|
| 1259 | + $this->add('voted_member_list', $output->data); |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | /** |
@@ -1266,7 +1266,7 @@ discard block |
||
| 1266 | 1266 | function getStatusNameList() |
| 1267 | 1267 | { |
| 1268 | 1268 | global $lang; |
| 1269 | - if(!isset($lang->status_name_list)) |
|
| 1269 | + if (!isset($lang->status_name_list)) |
|
| 1270 | 1270 | return array_flip($this->getStatusList()); |
| 1271 | 1271 | else return $lang->status_name_list; |
| 1272 | 1272 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | { |
| 1282 | 1282 | $sortIndex = $obj->sort_index; |
| 1283 | 1283 | $isExtraVars = false; |
| 1284 | - if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) |
|
| 1284 | + if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl'))) |
|
| 1285 | 1285 | { |
| 1286 | 1286 | // get module_srl extra_vars list |
| 1287 | 1287 | if ($load_extra_vars) |
@@ -1296,11 +1296,11 @@ discard block |
||
| 1296 | 1296 | else |
| 1297 | 1297 | { |
| 1298 | 1298 | $check_array = array(); |
| 1299 | - foreach($extra_output->data as $val) |
|
| 1299 | + foreach ($extra_output->data as $val) |
|
| 1300 | 1300 | { |
| 1301 | 1301 | $check_array[] = $val->eid; |
| 1302 | 1302 | } |
| 1303 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1303 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1304 | 1304 | else $isExtraVars = true; |
| 1305 | 1305 | } |
| 1306 | 1306 | } |
@@ -1328,13 +1328,13 @@ discard block |
||
| 1328 | 1328 | { |
| 1329 | 1329 | // Variable check |
| 1330 | 1330 | $args = new stdClass(); |
| 1331 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
| 1331 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
| 1332 | 1332 | $args->order_type = $searchOpt->order_type; |
| 1333 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
| 1334 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
| 1335 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
| 1336 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
| 1337 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
| 1333 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
| 1334 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
| 1335 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
| 1336 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
| 1337 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
| 1338 | 1338 | $args->member_srl = $searchOpt->member_srl; |
| 1339 | 1339 | $args->member_srls = $searchOpt->member_srls; |
| 1340 | 1340 | |
@@ -1344,10 +1344,10 @@ discard block |
||
| 1344 | 1344 | |
| 1345 | 1345 | // Check the target and sequence alignment |
| 1346 | 1346 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1347 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1347 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1348 | 1348 | |
| 1349 | 1349 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1350 | - if($searchOpt->mid) |
|
| 1350 | + if ($searchOpt->mid) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | $oModuleModel = getModel('module'); |
| 1353 | 1353 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1355,30 +1355,30 @@ discard block |
||
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | // Module_srl passed the array may be a check whether the array |
| 1358 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1358 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1359 | 1359 | else $args->module_srl = $searchOpt->module_srl; |
| 1360 | 1360 | |
| 1361 | 1361 | // Except for the test module_srl |
| 1362 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1362 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1363 | 1363 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
| 1364 | 1364 | |
| 1365 | 1365 | // only admin document list, temp document showing |
| 1366 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1366 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1367 | 1367 | else |
| 1368 | 1368 | { |
| 1369 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1369 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1370 | 1370 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
| 1371 | 1371 | else |
| 1372 | 1372 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
| 1373 | 1373 | } |
| 1374 | 1374 | |
| 1375 | 1375 | // Category is selected, further sub-categories until all conditions |
| 1376 | - if($args->category_srl) |
|
| 1376 | + if ($args->category_srl) |
|
| 1377 | 1377 | { |
| 1378 | 1378 | $category_list = $this->getCategoryList($args->module_srl); |
| 1379 | 1379 | $category_info = $category_list[$args->category_srl]; |
| 1380 | 1380 | $category_info->childs[] = $args->category_srl; |
| 1381 | - $args->category_srl = implode(',',$category_info->childs); |
|
| 1381 | + $args->category_srl = implode(',', $category_info->childs); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1391,24 +1391,24 @@ discard block |
||
| 1391 | 1391 | $search_target = $searchOpt->search_target; |
| 1392 | 1392 | $search_keyword = $searchOpt->search_keyword; |
| 1393 | 1393 | |
| 1394 | - if($search_target && $search_keyword) |
|
| 1394 | + if ($search_target && $search_keyword) |
|
| 1395 | 1395 | { |
| 1396 | - switch($search_target) |
|
| 1396 | + switch ($search_target) |
|
| 1397 | 1397 | { |
| 1398 | 1398 | case 'title' : |
| 1399 | 1399 | case 'content' : |
| 1400 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1400 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1401 | 1401 | $args->{"s_".$search_target} = $search_keyword; |
| 1402 | 1402 | $use_division = true; |
| 1403 | 1403 | break; |
| 1404 | 1404 | case 'title_content' : |
| 1405 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1405 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1406 | 1406 | $args->s_title = $search_keyword; |
| 1407 | 1407 | $args->s_content = $search_keyword; |
| 1408 | 1408 | $use_division = true; |
| 1409 | 1409 | break; |
| 1410 | 1410 | case 'user_id' : |
| 1411 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1411 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1412 | 1412 | $args->s_user_id = $search_keyword; |
| 1413 | 1413 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1414 | 1414 | break; |
@@ -1416,18 +1416,18 @@ discard block |
||
| 1416 | 1416 | case 'nick_name' : |
| 1417 | 1417 | case 'email_address' : |
| 1418 | 1418 | case 'homepage' : |
| 1419 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1419 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1420 | 1420 | $args->{"s_".$search_target} = $search_keyword; |
| 1421 | 1421 | break; |
| 1422 | 1422 | case 'is_notice' : |
| 1423 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1424 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1423 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
| 1424 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1425 | 1425 | else $args->{"s_".$search_target} = ''; |
| 1426 | 1426 | break; |
| 1427 | 1427 | case 'is_secret' : |
| 1428 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1429 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1430 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1428 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1429 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1430 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1431 | 1431 | break; |
| 1432 | 1432 | case 'member_srl' : |
| 1433 | 1433 | case 'readed_count' : |
@@ -1435,17 +1435,17 @@ discard block |
||
| 1435 | 1435 | case 'comment_count' : |
| 1436 | 1436 | case 'trackback_count' : |
| 1437 | 1437 | case 'uploaded_count' : |
| 1438 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1438 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1439 | 1439 | break; |
| 1440 | 1440 | case 'member_srls' : |
| 1441 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1441 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1442 | 1442 | |
| 1443 | - if($logged_info->member_srl) |
|
| 1443 | + if ($logged_info->member_srl) |
|
| 1444 | 1444 | { |
| 1445 | 1445 | $srls = explode(',', $search_keyword); |
| 1446 | - foreach($srls as $srl) |
|
| 1446 | + foreach ($srls as $srl) |
|
| 1447 | 1447 | { |
| 1448 | - if(abs($srl) != $logged_info->member_srl) |
|
| 1448 | + if (abs($srl) != $logged_info->member_srl) |
|
| 1449 | 1449 | { |
| 1450 | 1450 | break; // foreach |
| 1451 | 1451 | } |
@@ -1456,7 +1456,7 @@ discard block |
||
| 1456 | 1456 | } |
| 1457 | 1457 | break; |
| 1458 | 1458 | case 'blamed_count' : |
| 1459 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
| 1459 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
| 1460 | 1460 | break; |
| 1461 | 1461 | case 'regdate' : |
| 1462 | 1462 | case 'last_update' : |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | $use_division = true; |
| 1470 | 1470 | break; |
| 1471 | 1471 | case 'tag' : |
| 1472 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
| 1472 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
| 1473 | 1473 | $query_id = 'document.getDocumentListWithinTag'; |
| 1474 | 1474 | break; |
| 1475 | 1475 | case 'extra_vars': |
@@ -1477,9 +1477,9 @@ discard block |
||
| 1477 | 1477 | $query_id = 'document.getDocumentListWithinExtraVars'; |
| 1478 | 1478 | break; |
| 1479 | 1479 | default : |
| 1480 | - if(strpos($search_target,'extra_vars')!==false) { |
|
| 1480 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
| 1481 | 1481 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
| 1482 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
| 1482 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
| 1483 | 1483 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1484 | 1484 | $query_id = 'document.getDocumentListWithExtraVars'; |
| 1485 | 1485 | } |
@@ -1496,18 +1496,18 @@ discard block |
||
| 1496 | 1496 | /** |
| 1497 | 1497 | * list_order asc sort of division that can be used only when |
| 1498 | 1498 | */ |
| 1499 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1499 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1500 | 1500 | |
| 1501 | 1501 | /** |
| 1502 | 1502 | * If it is true, use_division changed to use the document division |
| 1503 | 1503 | */ |
| 1504 | - if($use_division) |
|
| 1504 | + if ($use_division) |
|
| 1505 | 1505 | { |
| 1506 | 1506 | // Division begins |
| 1507 | - $division = (int)Context::get('division'); |
|
| 1507 | + $division = (int) Context::get('division'); |
|
| 1508 | 1508 | |
| 1509 | 1509 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
| 1510 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1510 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1511 | 1511 | { |
| 1512 | 1512 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1513 | 1513 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1519,7 +1519,7 @@ discard block |
||
| 1519 | 1519 | } |
| 1520 | 1520 | |
| 1521 | 1521 | // If you do not value the best division top |
| 1522 | - if(!$division) |
|
| 1522 | + if (!$division) |
|
| 1523 | 1523 | { |
| 1524 | 1524 | $division_args = new stdClass(); |
| 1525 | 1525 | $division_args->module_srl = $args->module_srl; |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | $division_args->statusList = $args->statusList; |
| 1531 | 1531 | |
| 1532 | 1532 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
| 1533 | - if($output->data) |
|
| 1533 | + if ($output->data) |
|
| 1534 | 1534 | { |
| 1535 | 1535 | $item = array_pop($output->data); |
| 1536 | 1536 | $division = $item->list_order; |
@@ -1539,10 +1539,10 @@ discard block |
||
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | // The last division |
| 1542 | - $last_division = (int)Context::get('last_division'); |
|
| 1542 | + $last_division = (int) Context::get('last_division'); |
|
| 1543 | 1543 | |
| 1544 | 1544 | // Division after division from the 5000 value of the specified Wanted |
| 1545 | - if(!$last_division) |
|
| 1545 | + if (!$last_division) |
|
| 1546 | 1546 | { |
| 1547 | 1547 | $last_division_args = new stdClass(); |
| 1548 | 1548 | $last_division_args->module_srl = $args->module_srl; |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | $last_division_args->page = 5001; |
| 1555 | 1555 | |
| 1556 | 1556 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
| 1557 | - if($output->data) |
|
| 1557 | + if ($output->data) |
|
| 1558 | 1558 | { |
| 1559 | 1559 | $item = array_pop($output->data); |
| 1560 | 1560 | $last_division = $item->list_order; |
@@ -1562,14 +1562,14 @@ discard block |
||
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | 1564 | // Make sure that after last_division article |
| 1565 | - if($last_division) |
|
| 1565 | + if ($last_division) |
|
| 1566 | 1566 | { |
| 1567 | 1567 | $last_division_args = new stdClass(); |
| 1568 | 1568 | $last_division_args->module_srl = $args->module_srl; |
| 1569 | 1569 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1570 | 1570 | $last_division_args->list_order = $last_division; |
| 1571 | 1571 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1572 | - if($output->data->count<1) $last_division = null; |
|
| 1572 | + if ($output->data->count < 1) $last_division = null; |
|
| 1573 | 1573 | } |
| 1574 | 1574 | |
| 1575 | 1575 | $args->division = $division; |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | * @param int $count |
| 1603 | 1603 | * @return object |
| 1604 | 1604 | */ |
| 1605 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
| 1605 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
| 1606 | 1606 | { |
| 1607 | 1607 | $args = new stdClass(); |
| 1608 | 1608 | $args->member_srl = $member_srl; |
@@ -1610,8 +1610,8 @@ discard block |
||
| 1610 | 1610 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1611 | 1611 | $document_list = $output->data; |
| 1612 | 1612 | |
| 1613 | - if(!$document_list) return array(); |
|
| 1614 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1613 | + if (!$document_list) return array(); |
|
| 1614 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 1615 | 1615 | |
| 1616 | 1616 | return $document_list; |
| 1617 | 1617 | } |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | function getDocumentExtraImagePath() |
| 1624 | 1624 | { |
| 1625 | 1625 | $documentConfig = getModel('document')->getDocumentConfig(); |
| 1626 | - if(Mobile::isFromMobilePhone()) |
|
| 1626 | + if (Mobile::isFromMobilePhone()) |
|
| 1627 | 1627 | { |
| 1628 | 1628 | $iconSkin = $documentConfig->micons; |
| 1629 | 1629 | } |
@@ -1631,7 +1631,7 @@ discard block |
||
| 1631 | 1631 | { |
| 1632 | 1632 | $iconSkin = $documentConfig->icons; |
| 1633 | 1633 | } |
| 1634 | - $path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1634 | + $path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/"); |
|
| 1635 | 1635 | |
| 1636 | 1636 | return $path; |
| 1637 | 1637 | } |
@@ -58,18 +58,24 @@ discard block |
||
| 58 | 58 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
| 59 | 59 | |
| 60 | 60 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
| 61 | - if(count($_document_list) <= 0) return; |
|
| 61 | + if(count($_document_list) <= 0) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | // Find all called the document object variable has been set extension |
| 64 | 66 | $document_srls = array(); |
| 65 | 67 | foreach($_document_list as $key => $val) |
| 66 | 68 | { |
| 67 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 69 | + if(!$val->document_srl || $checked_documents[$val->document_srl]) { |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 68 | 72 | $checked_documents[$val->document_srl] = true; |
| 69 | 73 | $document_srls[] = $val->document_srl; |
| 70 | 74 | } |
| 71 | 75 | // If the document number, return detected |
| 72 | - if(!count($document_srls)) return; |
|
| 76 | + if(!count($document_srls)) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 73 | 79 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
| 74 | 80 | //$obj->document_srl = implode(',',$document_srls); |
| 75 | 81 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
@@ -77,8 +83,12 @@ discard block |
||
| 77 | 83 | { |
| 78 | 84 | foreach($output->data as $key => $val) |
| 79 | 85 | { |
| 80 | - if(!isset($val->value)) continue; |
|
| 81 | - if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 86 | + if(!isset($val->value)) { |
|
| 87 | + continue; |
|
| 88 | + } |
|
| 89 | + if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) { |
|
| 90 | + $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 91 | + } |
|
| 82 | 92 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
| 83 | 93 | } |
| 84 | 94 | } |
@@ -89,7 +99,9 @@ discard block |
||
| 89 | 99 | $document_srl = $document_srls[$i]; |
| 90 | 100 | unset($vars); |
| 91 | 101 | |
| 92 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 102 | + if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) { |
|
| 103 | + continue; |
|
| 104 | + } |
|
| 93 | 105 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
| 94 | 106 | $extra_keys = $this->getExtraKeys($module_srl); |
| 95 | 107 | $vars = $extra_vars[$document_srl]; |
@@ -101,10 +113,15 @@ discard block |
||
| 101 | 113 | { |
| 102 | 114 | $extra_keys[$idx] = clone($key); |
| 103 | 115 | $val = $vars[$idx]; |
| 104 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 105 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 106 | - else if(isset($val[0])) $v = $val[0]; |
|
| 107 | - else $v = null; |
|
| 116 | + if(isset($val[$user_lang_code])) { |
|
| 117 | + $v = $val[$user_lang_code]; |
|
| 118 | + } else if(isset($val[$document_lang_code])) { |
|
| 119 | + $v = $val[$document_lang_code]; |
|
| 120 | + } else if(isset($val[0])) { |
|
| 121 | + $v = $val[0]; |
|
| 122 | + } else { |
|
| 123 | + $v = null; |
|
| 124 | + } |
|
| 108 | 125 | $extra_keys[$idx]->value = $v; |
| 109 | 126 | } |
| 110 | 127 | } |
@@ -113,9 +130,13 @@ discard block |
||
| 113 | 130 | $evars = new ExtraVar($module_srl); |
| 114 | 131 | $evars->setExtraVarKeys($extra_keys); |
| 115 | 132 | // Title Processing |
| 116 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 133 | + if($vars[-1][$user_lang_code]) { |
|
| 134 | + $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 135 | + } |
|
| 117 | 136 | // Information processing |
| 118 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 137 | + if($vars[-2][$user_lang_code]) { |
|
| 138 | + $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 139 | + } |
|
| 119 | 140 | |
| 120 | 141 | // static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남 |
| 121 | 142 | /* |
@@ -139,7 +160,9 @@ discard block |
||
| 139 | 160 | */ |
| 140 | 161 | function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
| 141 | 162 | { |
| 142 | - if(!$document_srl) return new documentItem(); |
|
| 163 | + if(!$document_srl) { |
|
| 164 | + return new documentItem(); |
|
| 165 | + } |
|
| 143 | 166 | |
| 144 | 167 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 145 | 168 | { |
@@ -149,9 +172,13 @@ discard block |
||
| 149 | 172 | return $oDocument; |
| 150 | 173 | } |
| 151 | 174 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 152 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 175 | + if($load_extra_vars) { |
|
| 176 | + $this->setToAllDocumentExtraVars(); |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + if($is_admin) { |
|
| 180 | + $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 153 | 181 | } |
| 154 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 155 | 182 | |
| 156 | 183 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 157 | 184 | } |
@@ -170,8 +197,7 @@ discard block |
||
| 170 | 197 | { |
| 171 | 198 | $list_count = count($document_srls); |
| 172 | 199 | $document_srls = implode(',',$document_srls); |
| 173 | - } |
|
| 174 | - else |
|
| 200 | + } else |
|
| 175 | 201 | { |
| 176 | 202 | $list_count = 1; |
| 177 | 203 | } |
@@ -182,28 +208,38 @@ discard block |
||
| 182 | 208 | |
| 183 | 209 | $output = executeQuery('document.getDocuments', $args, $columnList); |
| 184 | 210 | $document_list = $output->data; |
| 185 | - if(!$document_list) return; |
|
| 186 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 211 | + if(!$document_list) { |
|
| 212 | + return; |
|
| 213 | + } |
|
| 214 | + if(!is_array($document_list)) { |
|
| 215 | + $document_list = array($document_list); |
|
| 216 | + } |
|
| 187 | 217 | |
| 188 | 218 | $document_count = count($document_list); |
| 189 | 219 | foreach($document_list as $key => $attribute) |
| 190 | 220 | { |
| 191 | 221 | $document_srl = $attribute->document_srl; |
| 192 | - if(!$document_srl) continue; |
|
| 222 | + if(!$document_srl) { |
|
| 223 | + continue; |
|
| 224 | + } |
|
| 193 | 225 | |
| 194 | 226 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 195 | 227 | { |
| 196 | 228 | $oDocument = null; |
| 197 | 229 | $oDocument = new documentItem(); |
| 198 | 230 | $oDocument->setAttribute($attribute, false); |
| 199 | - if($is_admin) $oDocument->setGrant(); |
|
| 231 | + if($is_admin) { |
|
| 232 | + $oDocument->setGrant(); |
|
| 233 | + } |
|
| 200 | 234 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 201 | 235 | } |
| 202 | 236 | |
| 203 | 237 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 204 | 238 | } |
| 205 | 239 | |
| 206 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 240 | + if($load_extra_vars) { |
|
| 241 | + $this->setToAllDocumentExtraVars(); |
|
| 242 | + } |
|
| 207 | 243 | |
| 208 | 244 | $output = null; |
| 209 | 245 | if(count($result)) |
@@ -251,18 +287,15 @@ discard block |
||
| 251 | 287 | { |
| 252 | 288 | $output = $obj->use_alternate_output; |
| 253 | 289 | unset($obj->use_alternate_output); |
| 254 | - } |
|
| 255 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 290 | + } elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 256 | 291 | { |
| 257 | 292 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
| 258 | 293 | $args->sort_index = str_replace('documents.','',$args->sort_index); |
| 259 | 294 | $output = executeQueryArray($query_id, $args); |
| 260 | - } |
|
| 261 | - elseif ($sort_check->isExtraVars) |
|
| 295 | + } elseif ($sort_check->isExtraVars) |
|
| 262 | 296 | { |
| 263 | 297 | $output = executeQueryArray($query_id, $args); |
| 264 | - } |
|
| 265 | - else |
|
| 298 | + } else |
|
| 266 | 299 | { |
| 267 | 300 | // document.getDocumentList query execution |
| 268 | 301 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
@@ -272,11 +305,15 @@ discard block |
||
| 272 | 305 | $group_args = clone($args); |
| 273 | 306 | $group_args->sort_index = 'documents.'.$args->sort_index; |
| 274 | 307 | $output = executeQueryArray($query_id, $group_args); |
| 275 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 308 | + if(!$output->toBool()||!count($output->data)) { |
|
| 309 | + return $output; |
|
| 310 | + } |
|
| 276 | 311 | |
| 277 | 312 | foreach($output->data as $key => $val) |
| 278 | 313 | { |
| 279 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 314 | + if($val->document_srl) { |
|
| 315 | + $target_srls[] = $val->document_srl; |
|
| 316 | + } |
|
| 280 | 317 | } |
| 281 | 318 | |
| 282 | 319 | $page_navigation = $output->page_navigation; |
@@ -294,14 +331,15 @@ discard block |
||
| 294 | 331 | $output->total_count = $page_navigation->total_count; |
| 295 | 332 | $output->total_page = $page_navigation->total_page; |
| 296 | 333 | $output->page = $page_navigation->cur_page; |
| 297 | - } |
|
| 298 | - else |
|
| 334 | + } else |
|
| 299 | 335 | { |
| 300 | 336 | $output = executeQueryArray($query_id, $args, $columnList); |
| 301 | 337 | } |
| 302 | 338 | } |
| 303 | 339 | // Return if no result or an error occurs |
| 304 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 340 | + if(!$output->toBool()||!count($output->data)) { |
|
| 341 | + return $output; |
|
| 342 | + } |
|
| 305 | 343 | $idx = 0; |
| 306 | 344 | $data = $output->data; |
| 307 | 345 | unset($output->data); |
@@ -316,20 +354,26 @@ discard block |
||
| 316 | 354 | { |
| 317 | 355 | foreach($data as $key => $attribute) |
| 318 | 356 | { |
| 319 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
| 357 | + if($attribute->is_notice == 'Y') { |
|
| 358 | + $virtual_number --; |
|
| 359 | + } |
|
| 320 | 360 | } |
| 321 | 361 | } |
| 322 | 362 | |
| 323 | 363 | foreach($data as $key => $attribute) |
| 324 | 364 | { |
| 325 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 365 | + if($except_notice && $attribute->is_notice == 'Y') { |
|
| 366 | + continue; |
|
| 367 | + } |
|
| 326 | 368 | $document_srl = $attribute->document_srl; |
| 327 | 369 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 328 | 370 | { |
| 329 | 371 | $oDocument = null; |
| 330 | 372 | $oDocument = new documentItem(); |
| 331 | 373 | $oDocument->setAttribute($attribute, false); |
| 332 | - if(Context::get('logged_info')->is_admin == 'Y') $oDocument->setGrant(); |
|
| 374 | + if(Context::get('logged_info')->is_admin == 'Y') { |
|
| 375 | + $oDocument->setGrant(); |
|
| 376 | + } |
|
| 333 | 377 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 334 | 378 | } |
| 335 | 379 | |
@@ -337,7 +381,9 @@ discard block |
||
| 337 | 381 | $virtual_number--; |
| 338 | 382 | } |
| 339 | 383 | |
| 340 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 384 | + if($load_extra_vars) { |
|
| 385 | + $this->setToAllDocumentExtraVars(); |
|
| 386 | + } |
|
| 341 | 387 | |
| 342 | 388 | if(count($output->data)) |
| 343 | 389 | { |
@@ -365,12 +411,16 @@ discard block |
||
| 365 | 411 | $args->module_srl = $obj->module_srl; |
| 366 | 412 | $args->category_srl= $obj->category_srl; |
| 367 | 413 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
| 368 | - if(!$output->toBool()||!$output->data) return; |
|
| 414 | + if(!$output->toBool()||!$output->data) { |
|
| 415 | + return; |
|
| 416 | + } |
|
| 369 | 417 | |
| 370 | 418 | foreach($output->data as $key => $val) |
| 371 | 419 | { |
| 372 | 420 | $document_srl = $val->document_srl; |
| 373 | - if(!$document_srl) continue; |
|
| 421 | + if(!$document_srl) { |
|
| 422 | + continue; |
|
| 423 | + } |
|
| 374 | 424 | |
| 375 | 425 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 376 | 426 | { |
@@ -466,7 +516,9 @@ discard block |
||
| 466 | 516 | |
| 467 | 517 | $oExtraVar->setExtraVarKeys($output->data); |
| 468 | 518 | $keys = $oExtraVar->getExtraVars(); |
| 469 | - if(!$keys) $keys = array(); |
|
| 519 | + if(!$keys) { |
|
| 520 | + $keys = array(); |
|
| 521 | + } |
|
| 470 | 522 | |
| 471 | 523 | if($oCacheHandler->isSupport()) |
| 472 | 524 | { |
@@ -496,7 +548,9 @@ discard block |
||
| 496 | 548 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 497 | 549 | $this->setToAllDocumentExtraVars(); |
| 498 | 550 | } |
| 499 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 551 | + if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) { |
|
| 552 | + ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 553 | + } |
|
| 500 | 554 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
| 501 | 555 | } |
| 502 | 556 | |
@@ -526,7 +580,9 @@ discard block |
||
| 526 | 580 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 527 | 581 | $module_srl = $oDocument->get('module_srl'); |
| 528 | 582 | $member_srl = $oDocument->get('member_srl'); |
| 529 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 583 | + if(!$module_srl) { |
|
| 584 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 585 | + } |
|
| 530 | 586 | |
| 531 | 587 | $oModuleModel = getModel('module'); |
| 532 | 588 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
@@ -599,7 +655,9 @@ discard block |
||
| 599 | 655 | */ |
| 600 | 656 | function getDocumentCount($module_srl, $search_obj = NULL) |
| 601 | 657 | { |
| 602 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
| 658 | + if(is_null($search_obj)) { |
|
| 659 | + $search_obj = new stdClass(); |
|
| 660 | + } |
|
| 603 | 661 | $search_obj->module_srl = $module_srl; |
| 604 | 662 | |
| 605 | 663 | $output = executeQuery('document.getDocumentCount', $search_obj); |
@@ -616,7 +674,9 @@ discard block |
||
| 616 | 674 | function getDocumentCountByGroupStatus($search_obj = NULL) |
| 617 | 675 | { |
| 618 | 676 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
| 619 | - if(!$output->toBool()) return array(); |
|
| 677 | + if(!$output->toBool()) { |
|
| 678 | + return array(); |
|
| 679 | + } |
|
| 620 | 680 | |
| 621 | 681 | return $output->data; |
| 622 | 682 | } |
@@ -655,34 +715,29 @@ discard block |
||
| 655 | 715 | if($sort_check->isExtraVars) |
| 656 | 716 | { |
| 657 | 717 | return 1; |
| 658 | - } |
|
| 659 | - else |
|
| 718 | + } else |
|
| 660 | 719 | { |
| 661 | 720 | if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
| 662 | 721 | { |
| 663 | 722 | if($args->order_type === 'desc') |
| 664 | 723 | { |
| 665 | 724 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 666 | - } |
|
| 667 | - else |
|
| 725 | + } else |
|
| 668 | 726 | { |
| 669 | 727 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 670 | 728 | } |
| 671 | - } |
|
| 672 | - elseif($sort_check->sort_index === 'regdate') |
|
| 729 | + } elseif($sort_check->sort_index === 'regdate') |
|
| 673 | 730 | { |
| 674 | 731 | |
| 675 | 732 | if($args->order_type === 'asc') |
| 676 | 733 | { |
| 677 | 734 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 678 | - } |
|
| 679 | - else |
|
| 735 | + } else |
|
| 680 | 736 | { |
| 681 | 737 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 682 | 738 | } |
| 683 | 739 | |
| 684 | - } |
|
| 685 | - else |
|
| 740 | + } else |
|
| 686 | 741 | { |
| 687 | 742 | return 1; |
| 688 | 743 | } |
@@ -708,15 +763,16 @@ discard block |
||
| 708 | 763 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 709 | 764 | |
| 710 | 765 | $node = $output->data; |
| 711 | - if(!$node) return; |
|
| 766 | + if(!$node) { |
|
| 767 | + return; |
|
| 768 | + } |
|
| 712 | 769 | |
| 713 | 770 | if($node->group_srls) |
| 714 | 771 | { |
| 715 | 772 | $group_srls = explode(',',$node->group_srls); |
| 716 | 773 | unset($node->group_srls); |
| 717 | 774 | $node->group_srls = $group_srls; |
| 718 | - } |
|
| 719 | - else |
|
| 775 | + } else |
|
| 720 | 776 | { |
| 721 | 777 | unset($node->group_srls); |
| 722 | 778 | $node->group_srls = array(); |
@@ -734,7 +790,9 @@ discard block |
||
| 734 | 790 | $args = new stdClass(); |
| 735 | 791 | $args->category_srl = $category_srl; |
| 736 | 792 | $output = executeQuery('document.getChildCategoryCount',$args); |
| 737 | - if($output->data->count > 0) return true; |
|
| 793 | + if($output->data->count > 0) { |
|
| 794 | + return true; |
|
| 795 | + } |
|
| 738 | 796 | return false; |
| 739 | 797 | } |
| 740 | 798 | |
@@ -755,7 +813,9 @@ discard block |
||
| 755 | 813 | if(!file_exists($filename)) |
| 756 | 814 | { |
| 757 | 815 | $oDocumentController = getController('document'); |
| 758 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 816 | + if(!$oDocumentController->makeCategoryFile($module_srl)) { |
|
| 817 | + return array(); |
|
| 818 | + } |
|
| 759 | 819 | } |
| 760 | 820 | |
| 761 | 821 | include($filename); |
@@ -775,7 +835,9 @@ discard block |
||
| 775 | 835 | */ |
| 776 | 836 | function _arrangeCategory(&$document_category, $list, $depth) |
| 777 | 837 | { |
| 778 | - if(!count($list)) return; |
|
| 838 | + if(!count($list)) { |
|
| 839 | + return; |
|
| 840 | + } |
|
| 779 | 841 | $idx = 0; |
| 780 | 842 | $list_order = array(); |
| 781 | 843 | foreach($list as $key => $val) |
@@ -795,8 +857,11 @@ discard block |
||
| 795 | 857 | $obj->childs = array(); |
| 796 | 858 | $obj->grant = $val['grant']; |
| 797 | 859 | |
| 798 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 799 | - else $selected = false; |
|
| 860 | + if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) { |
|
| 861 | + $selected = true; |
|
| 862 | + } else { |
|
| 863 | + $selected = false; |
|
| 864 | + } |
|
| 800 | 865 | |
| 801 | 866 | $obj->selected = $selected; |
| 802 | 867 | |
@@ -807,14 +872,18 @@ discard block |
||
| 807 | 872 | $parent_srl = $obj->parent_srl; |
| 808 | 873 | $document_count = $obj->document_count; |
| 809 | 874 | $expand = $obj->expand; |
| 810 | - if($selected) $expand = true; |
|
| 875 | + if($selected) { |
|
| 876 | + $expand = true; |
|
| 877 | + } |
|
| 811 | 878 | |
| 812 | 879 | while($parent_srl) |
| 813 | 880 | { |
| 814 | 881 | $document_category[$parent_srl]->document_count += $document_count; |
| 815 | 882 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 816 | 883 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 817 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 884 | + if($expand) { |
|
| 885 | + $document_category[$parent_srl]->expand = $expand; |
|
| 886 | + } |
|
| 818 | 887 | |
| 819 | 888 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 820 | 889 | } |
@@ -822,7 +891,9 @@ discard block |
||
| 822 | 891 | |
| 823 | 892 | $document_category[$key] = $obj; |
| 824 | 893 | |
| 825 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 894 | + if(count($val['list'])) { |
|
| 895 | + $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 896 | + } |
|
| 826 | 897 | } |
| 827 | 898 | $document_category[$list_order[0]]->first = true; |
| 828 | 899 | $document_category[$list_order[count($list_order)-1]]->last = true; |
@@ -890,13 +961,20 @@ discard block |
||
| 890 | 961 | } |
| 891 | 962 | // Module_srl passed the array may be a check whether the array |
| 892 | 963 | $args = new stdClass; |
| 893 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 894 | - else $args->module_srl = $obj->module_srl; |
|
| 964 | + if(is_array($obj->module_srl)) { |
|
| 965 | + $args->module_srl = implode(',', $obj->module_srl); |
|
| 966 | + } else { |
|
| 967 | + $args->module_srl = $obj->module_srl; |
|
| 968 | + } |
|
| 895 | 969 | |
| 896 | 970 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 897 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 971 | + if(!$output->toBool()||!$output->data) { |
|
| 972 | + return $output; |
|
| 973 | + } |
|
| 898 | 974 | |
| 899 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 975 | + if(!is_array($output->data)) { |
|
| 976 | + $output->data = array($output->data); |
|
| 977 | + } |
|
| 900 | 978 | |
| 901 | 979 | return $output; |
| 902 | 980 | } |
@@ -916,14 +994,21 @@ discard block |
||
| 916 | 994 | } |
| 917 | 995 | // Module_srl passed the array may be a check whether the array |
| 918 | 996 | $args = new stdClass; |
| 919 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 920 | - else $args->module_srl = $obj->module_srl; |
|
| 997 | + if(is_array($obj->module_srl)) { |
|
| 998 | + $args->module_srl = implode(',', $obj->module_srl); |
|
| 999 | + } else { |
|
| 1000 | + $args->module_srl = $obj->module_srl; |
|
| 1001 | + } |
|
| 921 | 1002 | $args->regdate = $obj->regdate; |
| 922 | 1003 | |
| 923 | 1004 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 924 | - if(!$output->toBool()) return $output; |
|
| 1005 | + if(!$output->toBool()) { |
|
| 1006 | + return $output; |
|
| 1007 | + } |
|
| 925 | 1008 | |
| 926 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 1009 | + if(!is_array($output->data)) { |
|
| 1010 | + $output->data = array($output->data); |
|
| 1011 | + } |
|
| 927 | 1012 | |
| 928 | 1013 | return $output; |
| 929 | 1014 | } |
@@ -934,7 +1019,9 @@ discard block |
||
| 934 | 1019 | */ |
| 935 | 1020 | function getDocumentCategories() |
| 936 | 1021 | { |
| 937 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1022 | + if(!Context::get('is_logged')) { |
|
| 1023 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 1024 | + } |
|
| 938 | 1025 | $module_srl = Context::get('module_srl'); |
| 939 | 1026 | $categories= $this->getCategoryList($module_srl); |
| 940 | 1027 | $lang = Context::get('lang'); |
@@ -1029,7 +1116,9 @@ discard block |
||
| 1029 | 1116 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1030 | 1117 | // Check permissions |
| 1031 | 1118 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1032 | - if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted'); |
|
| 1119 | + if(!$grant->manager) { |
|
| 1120 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 1121 | + } |
|
| 1033 | 1122 | |
| 1034 | 1123 | $category_srl = Context::get('category_srl'); |
| 1035 | 1124 | $category_info = $this->getCategory($category_srl); |
@@ -1049,15 +1138,20 @@ discard block |
||
| 1049 | 1138 | */ |
| 1050 | 1139 | function getDocumentSrlByAlias($mid, $alias) |
| 1051 | 1140 | { |
| 1052 | - if(!$mid || !$alias) return null; |
|
| 1141 | + if(!$mid || !$alias) { |
|
| 1142 | + return null; |
|
| 1143 | + } |
|
| 1053 | 1144 | $site_module_info = Context::get('site_module_info'); |
| 1054 | 1145 | $args = new stdClass; |
| 1055 | 1146 | $args->mid = $mid; |
| 1056 | 1147 | $args->alias_title = $alias; |
| 1057 | 1148 | $args->site_srl = $site_module_info->site_srl; |
| 1058 | 1149 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1059 | - if(!$output->data) return null; |
|
| 1060 | - else return $output->data->document_srl; |
|
| 1150 | + if(!$output->data) { |
|
| 1151 | + return null; |
|
| 1152 | + } else { |
|
| 1153 | + return $output->data->document_srl; |
|
| 1154 | + } |
|
| 1061 | 1155 | } |
| 1062 | 1156 | |
| 1063 | 1157 | /** |
@@ -1068,15 +1162,20 @@ discard block |
||
| 1068 | 1162 | */ |
| 1069 | 1163 | function getDocumentSrlByTitle($module_srl, $title) |
| 1070 | 1164 | { |
| 1071 | - if(!$module_srl || !$title) return null; |
|
| 1165 | + if(!$module_srl || !$title) { |
|
| 1166 | + return null; |
|
| 1167 | + } |
|
| 1072 | 1168 | $args = new stdClass; |
| 1073 | 1169 | $args->module_srl = $module_srl; |
| 1074 | 1170 | $args->title = $title; |
| 1075 | 1171 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1076 | - if(!$output->data) return null; |
|
| 1077 | - else |
|
| 1172 | + if(!$output->data) { |
|
| 1173 | + return null; |
|
| 1174 | + } else |
|
| 1078 | 1175 | { |
| 1079 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1176 | + if(is_array($output->data)) { |
|
| 1177 | + return $output->data[0]->document_srl; |
|
| 1178 | + } |
|
| 1080 | 1179 | return $output->data->document_srl; |
| 1081 | 1180 | } |
| 1082 | 1181 | } |
@@ -1088,13 +1187,18 @@ discard block |
||
| 1088 | 1187 | */ |
| 1089 | 1188 | function getAlias($document_srl) |
| 1090 | 1189 | { |
| 1091 | - if(!$document_srl) return null; |
|
| 1190 | + if(!$document_srl) { |
|
| 1191 | + return null; |
|
| 1192 | + } |
|
| 1092 | 1193 | $args = new stdClass; |
| 1093 | 1194 | $args->document_srl = $document_srl; |
| 1094 | 1195 | $output = executeQueryArray('document.getAliases', $args); |
| 1095 | 1196 | |
| 1096 | - if(!$output->data) return null; |
|
| 1097 | - else return $output->data[0]->alias_title; |
|
| 1197 | + if(!$output->data) { |
|
| 1198 | + return null; |
|
| 1199 | + } else { |
|
| 1200 | + return $output->data[0]->alias_title; |
|
| 1201 | + } |
|
| 1098 | 1202 | } |
| 1099 | 1203 | |
| 1100 | 1204 | /** |
@@ -1151,17 +1255,23 @@ discard block |
||
| 1151 | 1255 | { |
| 1152 | 1256 | case 'title' : |
| 1153 | 1257 | case 'content' : |
| 1154 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1258 | + if($search_keyword) { |
|
| 1259 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1260 | + } |
|
| 1155 | 1261 | $args->{"s_".$search_target} = $search_keyword; |
| 1156 | 1262 | $use_division = true; |
| 1157 | 1263 | break; |
| 1158 | 1264 | case 'title_content' : |
| 1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1265 | + if($search_keyword) { |
|
| 1266 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1267 | + } |
|
| 1160 | 1268 | $args->s_title = $search_keyword; |
| 1161 | 1269 | $args->s_content = $search_keyword; |
| 1162 | 1270 | break; |
| 1163 | 1271 | case 'user_id' : |
| 1164 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1272 | + if($search_keyword) { |
|
| 1273 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1274 | + } |
|
| 1165 | 1275 | $args->s_user_id = $search_keyword; |
| 1166 | 1276 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1167 | 1277 | break; |
@@ -1169,13 +1279,18 @@ discard block |
||
| 1169 | 1279 | case 'nick_name' : |
| 1170 | 1280 | case 'email_address' : |
| 1171 | 1281 | case 'homepage' : |
| 1172 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1282 | + if($search_keyword) { |
|
| 1283 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1284 | + } |
|
| 1173 | 1285 | $args->{"s_".$search_target} = $search_keyword; |
| 1174 | 1286 | break; |
| 1175 | 1287 | case 'is_notice' : |
| 1176 | 1288 | case 'is_secret' : |
| 1177 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1178 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1289 | + if($search_keyword=='N') { |
|
| 1290 | + $args->statusList = array($this->getConfigStatus('public')); |
|
| 1291 | + } elseif($search_keyword=='Y') { |
|
| 1292 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1293 | + } |
|
| 1179 | 1294 | break; |
| 1180 | 1295 | case 'member_srl' : |
| 1181 | 1296 | case 'readed_count' : |
@@ -1217,34 +1332,45 @@ discard block |
||
| 1217 | 1332 | { |
| 1218 | 1333 | $args = new stdClass; |
| 1219 | 1334 | $document_srl = Context::get('document_srl'); |
| 1220 | - if(!$document_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 1335 | + if(!$document_srl) { |
|
| 1336 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 1337 | + } |
|
| 1221 | 1338 | |
| 1222 | 1339 | $point = Context::get('point'); |
| 1223 | - if($point != -1) $point = 1; |
|
| 1340 | + if($point != -1) { |
|
| 1341 | + $point = 1; |
|
| 1342 | + } |
|
| 1224 | 1343 | |
| 1225 | 1344 | $oDocumentModel = getModel('document'); |
| 1226 | 1345 | $columnList = array('document_srl', 'module_srl'); |
| 1227 | 1346 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1228 | 1347 | $module_srl = $oDocument->get('module_srl'); |
| 1229 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1348 | + if(!$module_srl) { |
|
| 1349 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1350 | + } |
|
| 1230 | 1351 | |
| 1231 | 1352 | $oModuleModel = getModel('module'); |
| 1232 | 1353 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
| 1233 | 1354 | if($point == -1) |
| 1234 | 1355 | { |
| 1235 | - if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1356 | + if($document_config->use_vote_down!='S') { |
|
| 1357 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1358 | + } |
|
| 1236 | 1359 | $args->below_point = 0; |
| 1237 | - } |
|
| 1238 | - else |
|
| 1360 | + } else |
|
| 1239 | 1361 | { |
| 1240 | - if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1362 | + if($document_config->use_vote_up!='S') { |
|
| 1363 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1364 | + } |
|
| 1241 | 1365 | $args->more_point = 0; |
| 1242 | 1366 | } |
| 1243 | 1367 | |
| 1244 | 1368 | $args->document_srl = $document_srl; |
| 1245 | 1369 | |
| 1246 | 1370 | $output = executeQueryArray('document.getVotedMemberList',$args); |
| 1247 | - if(!$output->toBool()) return $output; |
|
| 1371 | + if(!$output->toBool()) { |
|
| 1372 | + return $output; |
|
| 1373 | + } |
|
| 1248 | 1374 | |
| 1249 | 1375 | $oMemberModel = getModel('member'); |
| 1250 | 1376 | if($output->data) |
@@ -1266,9 +1392,11 @@ discard block |
||
| 1266 | 1392 | function getStatusNameList() |
| 1267 | 1393 | { |
| 1268 | 1394 | global $lang; |
| 1269 | - if(!isset($lang->status_name_list)) |
|
| 1270 | - return array_flip($this->getStatusList()); |
|
| 1271 | - else return $lang->status_name_list; |
|
| 1395 | + if(!isset($lang->status_name_list)) { |
|
| 1396 | + return array_flip($this->getStatusList()); |
|
| 1397 | + } else { |
|
| 1398 | + return $lang->status_name_list; |
|
| 1399 | + } |
|
| 1272 | 1400 | } |
| 1273 | 1401 | |
| 1274 | 1402 | /** |
@@ -1292,20 +1420,22 @@ discard block |
||
| 1292 | 1420 | if (!$extra_output->data || !$extra_output->toBool()) |
| 1293 | 1421 | { |
| 1294 | 1422 | $sortIndex = 'list_order'; |
| 1295 | - } |
|
| 1296 | - else |
|
| 1423 | + } else |
|
| 1297 | 1424 | { |
| 1298 | 1425 | $check_array = array(); |
| 1299 | 1426 | foreach($extra_output->data as $val) |
| 1300 | 1427 | { |
| 1301 | 1428 | $check_array[] = $val->eid; |
| 1302 | 1429 | } |
| 1303 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1304 | - else $isExtraVars = true; |
|
| 1430 | + if(!in_array($sortIndex, $check_array)) { |
|
| 1431 | + $sortIndex = 'list_order'; |
|
| 1432 | + } else { |
|
| 1433 | + $isExtraVars = true; |
|
| 1434 | + } |
|
| 1305 | 1435 | } |
| 1436 | + } else { |
|
| 1437 | + $sortIndex = 'list_order'; |
|
| 1306 | 1438 | } |
| 1307 | - else |
|
| 1308 | - $sortIndex = 'list_order'; |
|
| 1309 | 1439 | } |
| 1310 | 1440 | $returnObj = new stdClass(); |
| 1311 | 1441 | $returnObj->sort_index = $sortIndex; |
@@ -1344,7 +1474,9 @@ discard block |
||
| 1344 | 1474 | |
| 1345 | 1475 | // Check the target and sequence alignment |
| 1346 | 1476 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1347 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1477 | + if(!isset($orderType[$args->order_type])) { |
|
| 1478 | + $args->order_type = 'asc'; |
|
| 1479 | + } |
|
| 1348 | 1480 | |
| 1349 | 1481 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1350 | 1482 | if($searchOpt->mid) |
@@ -1355,21 +1487,29 @@ discard block |
||
| 1355 | 1487 | } |
| 1356 | 1488 | |
| 1357 | 1489 | // Module_srl passed the array may be a check whether the array |
| 1358 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1359 | - else $args->module_srl = $searchOpt->module_srl; |
|
| 1490 | + if(is_array($searchOpt->module_srl)) { |
|
| 1491 | + $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1492 | + } else { |
|
| 1493 | + $args->module_srl = $searchOpt->module_srl; |
|
| 1494 | + } |
|
| 1360 | 1495 | |
| 1361 | 1496 | // Except for the test module_srl |
| 1362 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1363 | - else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
| 1497 | + if(is_array($searchOpt->exclude_module_srl)) { |
|
| 1498 | + $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1499 | + } else { |
|
| 1500 | + $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
| 1501 | + } |
|
| 1364 | 1502 | |
| 1365 | 1503 | // only admin document list, temp document showing |
| 1366 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1367 | - else |
|
| 1504 | + if($searchOpt->statusList) { |
|
| 1505 | + $args->statusList = $searchOpt->statusList; |
|
| 1506 | + } else |
|
| 1368 | 1507 | { |
| 1369 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1370 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
| 1371 | - else |
|
| 1372 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
| 1508 | + if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) { |
|
| 1509 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
| 1510 | + } else { |
|
| 1511 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
| 1512 | + } |
|
| 1373 | 1513 | } |
| 1374 | 1514 | |
| 1375 | 1515 | // Category is selected, further sub-categories until all conditions |
@@ -1397,18 +1537,24 @@ discard block |
||
| 1397 | 1537 | { |
| 1398 | 1538 | case 'title' : |
| 1399 | 1539 | case 'content' : |
| 1400 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1540 | + if($search_keyword) { |
|
| 1541 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1542 | + } |
|
| 1401 | 1543 | $args->{"s_".$search_target} = $search_keyword; |
| 1402 | 1544 | $use_division = true; |
| 1403 | 1545 | break; |
| 1404 | 1546 | case 'title_content' : |
| 1405 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1547 | + if($search_keyword) { |
|
| 1548 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1549 | + } |
|
| 1406 | 1550 | $args->s_title = $search_keyword; |
| 1407 | 1551 | $args->s_content = $search_keyword; |
| 1408 | 1552 | $use_division = true; |
| 1409 | 1553 | break; |
| 1410 | 1554 | case 'user_id' : |
| 1411 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1555 | + if($search_keyword) { |
|
| 1556 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1557 | + } |
|
| 1412 | 1558 | $args->s_user_id = $search_keyword; |
| 1413 | 1559 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1414 | 1560 | break; |
@@ -1416,18 +1562,28 @@ discard block |
||
| 1416 | 1562 | case 'nick_name' : |
| 1417 | 1563 | case 'email_address' : |
| 1418 | 1564 | case 'homepage' : |
| 1419 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1565 | + if($search_keyword) { |
|
| 1566 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1567 | + } |
|
| 1420 | 1568 | $args->{"s_".$search_target} = $search_keyword; |
| 1421 | 1569 | break; |
| 1422 | 1570 | case 'is_notice' : |
| 1423 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1424 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1425 | - else $args->{"s_".$search_target} = ''; |
|
| 1571 | + if($search_keyword=='N') { |
|
| 1572 | + $args->{"s_".$search_target} = 'N'; |
|
| 1573 | + } elseif($search_keyword=='Y') { |
|
| 1574 | + $args->{"s_".$search_target} = 'Y'; |
|
| 1575 | + } else { |
|
| 1576 | + $args->{"s_".$search_target} = ''; |
|
| 1577 | + } |
|
| 1426 | 1578 | break; |
| 1427 | 1579 | case 'is_secret' : |
| 1428 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1429 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1430 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1580 | + if($search_keyword=='N') { |
|
| 1581 | + $args->statusList = array($this->getConfigStatus('public')); |
|
| 1582 | + } elseif($search_keyword=='Y') { |
|
| 1583 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1584 | + } elseif($search_keyword=='temp') { |
|
| 1585 | + $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1586 | + } |
|
| 1431 | 1587 | break; |
| 1432 | 1588 | case 'member_srl' : |
| 1433 | 1589 | case 'readed_count' : |
@@ -1490,13 +1646,14 @@ discard block |
||
| 1490 | 1646 | if ($searchOpt->isExtraVars) |
| 1491 | 1647 | { |
| 1492 | 1648 | $query_id = 'document.getDocumentListExtraSort'; |
| 1493 | - } |
|
| 1494 | - else |
|
| 1649 | + } else |
|
| 1495 | 1650 | { |
| 1496 | 1651 | /** |
| 1497 | 1652 | * list_order asc sort of division that can be used only when |
| 1498 | 1653 | */ |
| 1499 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1654 | + if($args->sort_index != 'list_order' || $args->order_type != 'asc') { |
|
| 1655 | + $use_division = false; |
|
| 1656 | + } |
|
| 1500 | 1657 | |
| 1501 | 1658 | /** |
| 1502 | 1659 | * If it is true, use_division changed to use the document division |
@@ -1511,8 +1668,7 @@ discard block |
||
| 1511 | 1668 | { |
| 1512 | 1669 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1513 | 1670 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
| 1514 | - } |
|
| 1515 | - else |
|
| 1671 | + } else |
|
| 1516 | 1672 | { |
| 1517 | 1673 | $listSqlID = 'document.getDocumentList'; |
| 1518 | 1674 | $divisionSqlID = 'document.getDocumentDivision'; |
@@ -1569,7 +1725,9 @@ discard block |
||
| 1569 | 1725 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1570 | 1726 | $last_division_args->list_order = $last_division; |
| 1571 | 1727 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1572 | - if($output->data->count<1) $last_division = null; |
|
| 1728 | + if($output->data->count<1) { |
|
| 1729 | + $last_division = null; |
|
| 1730 | + } |
|
| 1573 | 1731 | } |
| 1574 | 1732 | |
| 1575 | 1733 | $args->division = $division; |
@@ -1610,8 +1768,12 @@ discard block |
||
| 1610 | 1768 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1611 | 1769 | $document_list = $output->data; |
| 1612 | 1770 | |
| 1613 | - if(!$document_list) return array(); |
|
| 1614 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1771 | + if(!$document_list) { |
|
| 1772 | + return array(); |
|
| 1773 | + } |
|
| 1774 | + if(!is_array($document_list)) { |
|
| 1775 | + $document_list = array($document_list); |
|
| 1776 | + } |
|
| 1615 | 1777 | |
| 1616 | 1778 | return $document_list; |
| 1617 | 1779 | } |
@@ -1626,8 +1788,7 @@ discard block |
||
| 1626 | 1788 | if(Mobile::isFromMobilePhone()) |
| 1627 | 1789 | { |
| 1628 | 1790 | $iconSkin = $documentConfig->micons; |
| 1629 | - } |
|
| 1630 | - else |
|
| 1791 | + } else |
|
| 1631 | 1792 | { |
| 1632 | 1793 | $iconSkin = $documentConfig->icons; |
| 1633 | 1794 | } |