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