@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function getDocumentExtraVarsFromDB($documentSrls) |
| 37 | 37 | { |
| 38 | - if(!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 38 | + if (!is_array($documentSrls) || count($documentSrls) == 0) |
|
| 39 | 39 | { |
| 40 | 40 | return new Object(-1, 'msg_invalid_request'); |
| 41 | 41 | } |
@@ -56,52 +56,52 @@ discard block |
||
| 56 | 56 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
| 57 | 57 | |
| 58 | 58 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
| 59 | - if(count($_document_list) <= 0) return; |
|
| 59 | + if (count($_document_list) <= 0) return; |
|
| 60 | 60 | |
| 61 | 61 | // Find all called the document object variable has been set extension |
| 62 | 62 | $document_srls = array(); |
| 63 | - foreach($_document_list as $key => $val) |
|
| 63 | + foreach ($_document_list as $key => $val) |
|
| 64 | 64 | { |
| 65 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 65 | + if (!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 66 | 66 | $checked_documents[$val->document_srl] = true; |
| 67 | 67 | $document_srls[] = $val->document_srl; |
| 68 | 68 | } |
| 69 | 69 | // If the document number, return detected |
| 70 | - if(!count($document_srls)) return; |
|
| 70 | + if (!count($document_srls)) return; |
|
| 71 | 71 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
| 72 | 72 | //$obj->document_srl = implode(',',$document_srls); |
| 73 | 73 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
| 74 | - if($output->toBool() && $output->data) |
|
| 74 | + if ($output->toBool() && $output->data) |
|
| 75 | 75 | { |
| 76 | - foreach($output->data as $key => $val) |
|
| 76 | + foreach ($output->data as $key => $val) |
|
| 77 | 77 | { |
| 78 | - if(!isset($val->value)) continue; |
|
| 79 | - 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); |
|
| 78 | + if (!isset($val->value)) continue; |
|
| 79 | + 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 | 80 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $user_lang_code = Context::getLangType(); |
| 85 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
| 85 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
| 86 | 86 | { |
| 87 | 87 | $document_srl = $document_srls[$i]; |
| 88 | 88 | unset($vars); |
| 89 | 89 | |
| 90 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 90 | + if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 91 | 91 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
| 92 | 92 | $extra_keys = $this->getExtraKeys($module_srl); |
| 93 | 93 | $vars = $extra_vars[$document_srl]; |
| 94 | 94 | $document_lang_code = $_document_list[$document_srl]->get('lang_code'); |
| 95 | 95 | // Expand the variable processing |
| 96 | - if(count($extra_keys)) |
|
| 96 | + if (count($extra_keys)) |
|
| 97 | 97 | { |
| 98 | - foreach($extra_keys as $idx => $key) |
|
| 98 | + foreach ($extra_keys as $idx => $key) |
|
| 99 | 99 | { |
| 100 | 100 | $extra_keys[$idx] = clone($key); |
| 101 | 101 | $val = $vars[$idx]; |
| 102 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 103 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 104 | - else if(isset($val[0])) $v = $val[0]; |
|
| 102 | + if (isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 103 | + else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 104 | + else if (isset($val[0])) $v = $val[0]; |
|
| 105 | 105 | else $v = null; |
| 106 | 106 | $extra_keys[$idx]->value = $v; |
| 107 | 107 | } |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | $evars = new ExtraVar($module_srl); |
| 112 | 112 | $evars->setExtraVarKeys($extra_keys); |
| 113 | 113 | // Title Processing |
| 114 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 114 | + if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]); |
|
| 115 | 115 | // Information processing |
| 116 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 116 | + if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]); |
|
| 117 | 117 | |
| 118 | - if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
| 118 | + if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
|
| 119 | 119 | { |
| 120 | 120 | unset($checked_documents[$document_srl]); |
| 121 | 121 | } |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | * @param array $columnList |
| 133 | 133 | * @return documentItem |
| 134 | 134 | */ |
| 135 | - function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 135 | + function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 136 | 136 | { |
| 137 | - if(!$document_srl) return new documentItem(); |
|
| 137 | + if (!$document_srl) return new documentItem(); |
|
| 138 | 138 | |
| 139 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 139 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 140 | 140 | { |
| 141 | 141 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
| 142 | 142 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 143 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 143 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 144 | 144 | } |
| 145 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 145 | + if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 146 | 146 | |
| 147 | 147 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 148 | 148 | } |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | * @param array $columnList |
| 156 | 156 | * @return array value type is documentItem |
| 157 | 157 | */ |
| 158 | - function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
|
| 158 | + function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array()) |
|
| 159 | 159 | { |
| 160 | - if(is_array($document_srls)) |
|
| 160 | + if (is_array($document_srls)) |
|
| 161 | 161 | { |
| 162 | 162 | $list_count = count($document_srls); |
| 163 | - $document_srls = implode(',',$document_srls); |
|
| 163 | + $document_srls = implode(',', $document_srls); |
|
| 164 | 164 | } |
| 165 | 165 | else |
| 166 | 166 | { |
@@ -173,33 +173,33 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $output = executeQuery('document.getDocuments', $args, $columnList); |
| 175 | 175 | $document_list = $output->data; |
| 176 | - if(!$document_list) return; |
|
| 177 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 176 | + if (!$document_list) return; |
|
| 177 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 178 | 178 | |
| 179 | 179 | $document_count = count($document_list); |
| 180 | - foreach($document_list as $key => $attribute) |
|
| 180 | + foreach ($document_list as $key => $attribute) |
|
| 181 | 181 | { |
| 182 | 182 | $document_srl = $attribute->document_srl; |
| 183 | - if(!$document_srl) continue; |
|
| 183 | + if (!$document_srl) continue; |
|
| 184 | 184 | |
| 185 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 185 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 186 | 186 | { |
| 187 | 187 | $oDocument = null; |
| 188 | 188 | $oDocument = new documentItem(); |
| 189 | 189 | $oDocument->setAttribute($attribute, false); |
| 190 | - if($is_admin) $oDocument->setGrant(); |
|
| 190 | + if ($is_admin) $oDocument->setGrant(); |
|
| 191 | 191 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 197 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 198 | 198 | |
| 199 | 199 | $output = null; |
| 200 | - if(count($result)) |
|
| 200 | + if (count($result)) |
|
| 201 | 201 | { |
| 202 | - foreach($result as $document_srl => $val) |
|
| 202 | + foreach ($result as $document_srl => $val) |
|
| 203 | 203 | { |
| 204 | 204 | $output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 205 | 205 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @param array $columnList |
| 217 | 217 | * @return Object |
| 218 | 218 | */ |
| 219 | - function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) |
|
| 219 | + function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array()) |
|
| 220 | 220 | { |
| 221 | 221 | $sort_check = $this->_setSortIndex($obj, $load_extra_vars); |
| 222 | 222 | $obj->sort_index = $sort_check->sort_index; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | // Call trigger (before) |
| 227 | 227 | // This trigger can be used to set an alternative output using a different search method |
| 228 | 228 | $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); |
| 229 | - if($output instanceof Object && !$output->toBool()) |
|
| 229 | + if ($output instanceof Object && !$output->toBool()) |
|
| 230 | 230 | { |
| 231 | 231 | return $output; |
| 232 | 232 | } |
@@ -243,10 +243,10 @@ discard block |
||
| 243 | 243 | $output = $obj->use_alternate_output; |
| 244 | 244 | unset($obj->use_alternate_output); |
| 245 | 245 | } |
| 246 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 246 | + elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars')) |
|
| 247 | 247 | { |
| 248 | 248 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
| 249 | - $args->sort_index = str_replace('documents.','',$args->sort_index); |
|
| 249 | + $args->sort_index = str_replace('documents.', '', $args->sort_index); |
|
| 250 | 250 | $output = executeQueryArray($query_id, $args); |
| 251 | 251 | } |
| 252 | 252 | elseif ($sort_check->isExtraVars) |
@@ -258,16 +258,16 @@ discard block |
||
| 258 | 258 | // document.getDocumentList query execution |
| 259 | 259 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
| 260 | 260 | $groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1); |
| 261 | - if(isset($groupByQuery[$query_id])) |
|
| 261 | + if (isset($groupByQuery[$query_id])) |
|
| 262 | 262 | { |
| 263 | 263 | $group_args = clone($args); |
| 264 | 264 | $group_args->sort_index = 'documents.'.$args->sort_index; |
| 265 | 265 | $output = executeQueryArray($query_id, $group_args); |
| 266 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 266 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 267 | 267 | |
| 268 | - foreach($output->data as $key => $val) |
|
| 268 | + foreach ($output->data as $key => $val) |
|
| 269 | 269 | { |
| 270 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 270 | + if ($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | $page_navigation = $output->page_navigation; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $virtual_number = $keys[0]; |
| 276 | 276 | |
| 277 | 277 | $target_args = new stdClass(); |
| 278 | - $target_args->document_srls = implode(',',$target_srls); |
|
| 278 | + $target_args->document_srls = implode(',', $target_srls); |
|
| 279 | 279 | $target_args->list_order = $args->sort_index; |
| 280 | 280 | $target_args->order_type = $args->order_type; |
| 281 | 281 | $target_args->list_count = $args->list_count; |
@@ -292,35 +292,35 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | // Return if no result or an error occurs |
| 295 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 295 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 296 | 296 | $idx = 0; |
| 297 | 297 | $data = $output->data; |
| 298 | 298 | unset($output->data); |
| 299 | 299 | |
| 300 | - if(!isset($virtual_number)) |
|
| 300 | + if (!isset($virtual_number)) |
|
| 301 | 301 | { |
| 302 | 302 | $keys = array_keys($data); |
| 303 | 303 | $virtual_number = $keys[0]; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if($except_notice) |
|
| 306 | + if ($except_notice) |
|
| 307 | 307 | { |
| 308 | - foreach($data as $key => $attribute) |
|
| 308 | + foreach ($data as $key => $attribute) |
|
| 309 | 309 | { |
| 310 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
| 310 | + if ($attribute->is_notice == 'Y') $virtual_number--; |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - foreach($data as $key => $attribute) |
|
| 314 | + foreach ($data as $key => $attribute) |
|
| 315 | 315 | { |
| 316 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 316 | + if ($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 317 | 317 | $document_srl = $attribute->document_srl; |
| 318 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 318 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 319 | 319 | { |
| 320 | 320 | $oDocument = null; |
| 321 | 321 | $oDocument = new documentItem(); |
| 322 | 322 | $oDocument->setAttribute($attribute, false); |
| 323 | - if($is_admin) $oDocument->setGrant(); |
|
| 323 | + if ($is_admin) $oDocument->setGrant(); |
|
| 324 | 324 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -328,11 +328,11 @@ discard block |
||
| 328 | 328 | $virtual_number--; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 331 | + if ($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 332 | 332 | |
| 333 | - if(count($output->data)) |
|
| 333 | + if (count($output->data)) |
|
| 334 | 334 | { |
| 335 | - foreach($output->data as $number => $document) |
|
| 335 | + foreach ($output->data as $number => $document) |
|
| 336 | 336 | { |
| 337 | 337 | $output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl]; |
| 338 | 338 | } |
@@ -354,16 +354,16 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | $args = new stdClass(); |
| 356 | 356 | $args->module_srl = $obj->module_srl; |
| 357 | - $args->category_srl= $obj->category_srl; |
|
| 357 | + $args->category_srl = $obj->category_srl; |
|
| 358 | 358 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
| 359 | - if(!$output->toBool()||!$output->data) return; |
|
| 359 | + if (!$output->toBool() || !$output->data) return; |
|
| 360 | 360 | |
| 361 | - foreach($output->data as $key => $val) |
|
| 361 | + foreach ($output->data as $key => $val) |
|
| 362 | 362 | { |
| 363 | 363 | $document_srl = $val->document_srl; |
| 364 | - if(!$document_srl) continue; |
|
| 364 | + if (!$document_srl) continue; |
|
| 365 | 365 | |
| 366 | - if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 366 | + if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
|
| 367 | 367 | { |
| 368 | 368 | $oDocument = null; |
| 369 | 369 | $oDocument = new documentItem(); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | $this->setToAllDocumentExtraVars(); |
| 376 | 376 | |
| 377 | - foreach($result->data as $document_srl => $val) |
|
| 377 | + foreach ($result->data as $document_srl => $val) |
|
| 378 | 378 | { |
| 379 | 379 | $result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 380 | 380 | } |
@@ -390,20 +390,20 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | function getExtraKeys($module_srl) |
| 392 | 392 | { |
| 393 | - if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 393 | + if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) |
|
| 394 | 394 | { |
| 395 | 395 | $keys = false; |
| 396 | 396 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 397 | - if($oCacheHandler->isSupport()) |
|
| 397 | + if ($oCacheHandler->isSupport()) |
|
| 398 | 398 | { |
| 399 | - $object_key = 'module_document_extra_keys:' . $module_srl; |
|
| 399 | + $object_key = 'module_document_extra_keys:'.$module_srl; |
|
| 400 | 400 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 401 | 401 | $keys = $oCacheHandler->get($cache_key); |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | $oExtraVar = ExtraVar::getInstance($module_srl); |
| 405 | 405 | |
| 406 | - if($keys === false) |
|
| 406 | + if ($keys === false) |
|
| 407 | 407 | { |
| 408 | 408 | $obj = new stdClass(); |
| 409 | 409 | $obj->module_srl = $module_srl; |
@@ -413,13 +413,13 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | // correcting index order |
| 415 | 415 | $isFixed = FALSE; |
| 416 | - if(is_array($output->data)) |
|
| 416 | + if (is_array($output->data)) |
|
| 417 | 417 | { |
| 418 | 418 | $prevIdx = 0; |
| 419 | - foreach($output->data as $no => $value) |
|
| 419 | + foreach ($output->data as $no => $value) |
|
| 420 | 420 | { |
| 421 | 421 | // case first |
| 422 | - if($prevIdx == 0 && $value->idx != 1) |
|
| 422 | + if ($prevIdx == 0 && $value->idx != 1) |
|
| 423 | 423 | { |
| 424 | 424 | $args = new stdClass(); |
| 425 | 425 | $args->module_srl = $module_srl; |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | // case others |
| 436 | - if($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 436 | + if ($prevIdx > 0 && $prevIdx + 1 != $value->idx) |
|
| 437 | 437 | { |
| 438 | 438 | $args = new stdClass(); |
| 439 | 439 | $args->module_srl = $module_srl; |
@@ -450,16 +450,16 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - if($isFixed) |
|
| 453 | + if ($isFixed) |
|
| 454 | 454 | { |
| 455 | 455 | $output = executeQueryArray('document.getDocumentExtraKeys', $obj); |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | $oExtraVar->setExtraVarKeys($output->data); |
| 459 | 459 | $keys = $oExtraVar->getExtraVars(); |
| 460 | - if(!$keys) $keys = array(); |
|
| 460 | + if (!$keys) $keys = array(); |
|
| 461 | 461 | |
| 462 | - if($oCacheHandler->isSupport()) |
|
| 462 | + if ($oCacheHandler->isSupport()) |
|
| 463 | 463 | { |
| 464 | 464 | $oCacheHandler->put($cache_key, $keys); |
| 465 | 465 | } |
@@ -480,14 +480,14 @@ discard block |
||
| 480 | 480 | */ |
| 481 | 481 | function getExtraVars($module_srl, $document_srl) |
| 482 | 482 | { |
| 483 | - if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 483 | + if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) |
|
| 484 | 484 | { |
| 485 | 485 | // Extended to extract the values of variables set |
| 486 | 486 | $oDocument = $this->getDocument($document_srl, false); |
| 487 | 487 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 488 | 488 | $this->setToAllDocumentExtraVars(); |
| 489 | 489 | } |
| 490 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 490 | + if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 491 | 491 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
| 492 | 492 | } |
| 493 | 493 | |
@@ -510,71 +510,71 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | $oDocumentController = getController('document'); |
| 512 | 512 | // Members must be a possible feature |
| 513 | - if($logged_info->member_srl) |
|
| 513 | + if ($logged_info->member_srl) |
|
| 514 | 514 | { |
| 515 | 515 | $oDocumentModel = getModel('document'); |
| 516 | 516 | $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); |
| 517 | 517 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 518 | 518 | $module_srl = $oDocument->get('module_srl'); |
| 519 | 519 | $member_srl = $oDocument->get('member_srl'); |
| 520 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 520 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 521 | 521 | |
| 522 | 522 | $oModuleModel = getModel('module'); |
| 523 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 524 | - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) |
|
| 523 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 524 | + if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl) |
|
| 525 | 525 | { |
| 526 | 526 | // Add a Referral Button |
| 527 | 527 | $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); |
| 528 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); |
|
| 528 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript'); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) |
|
| 531 | + if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl) |
|
| 532 | 532 | { |
| 533 | 533 | // Add button to negative |
| 534 | - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 535 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); |
|
| 534 | + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); |
|
| 535 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript'); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | // Adding Report |
| 539 | 539 | $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); |
| 540 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript'); |
|
| 540 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript'); |
|
| 541 | 541 | |
| 542 | 542 | // Add Bookmark button |
| 543 | 543 | $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); |
| 544 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript'); |
|
| 544 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript'); |
|
| 545 | 545 | } |
| 546 | 546 | // Add print button |
| 547 | - $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); |
|
| 548 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument'); |
|
| 547 | + $url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl); |
|
| 548 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument'); |
|
| 549 | 549 | // Call a trigger (after) |
| 550 | 550 | ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); |
| 551 | - if($this->grant->manager) |
|
| 551 | + if ($this->grant->manager) |
|
| 552 | 552 | { |
| 553 | 553 | $str_confirm = Context::getLang('confirm_move'); |
| 554 | 554 | $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); |
| 555 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript'); |
|
| 555 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript'); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | // If you are managing to find posts by ip |
| 559 | - if($logged_info->is_admin == 'Y') |
|
| 559 | + if ($logged_info->is_admin == 'Y') |
|
| 560 | 560 | { |
| 561 | 561 | $oDocumentModel = getModel('document'); |
| 562 | - $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 562 | + $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle |
|
| 563 | 563 | |
| 564 | - if($oDocument->isExists()) |
|
| 564 | + if ($oDocument->isExists()) |
|
| 565 | 565 | { |
| 566 | 566 | // Find a post equivalent to ip address |
| 567 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress()); |
|
| 568 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); |
|
| 567 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress()); |
|
| 568 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress'); |
|
| 569 | 569 | |
| 570 | 570 | $url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress()); |
| 571 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript'); |
|
| 571 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript'); |
|
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | // Changing the language of pop-up menu |
| 575 | 575 | $menus = Context::get('document_popup_menu_list'); |
| 576 | 576 | $menus_count = count($menus); |
| 577 | - for($i=0;$i<$menus_count;$i++) |
|
| 577 | + for ($i = 0; $i < $menus_count; $i++) |
|
| 578 | 578 | { |
| 579 | 579 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
| 580 | 580 | } |
@@ -590,13 +590,13 @@ discard block |
||
| 590 | 590 | */ |
| 591 | 591 | function getDocumentCount($module_srl, $search_obj = NULL) |
| 592 | 592 | { |
| 593 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
| 593 | + if (is_null($search_obj)) $search_obj = new stdClass(); |
|
| 594 | 594 | $search_obj->module_srl = $module_srl; |
| 595 | 595 | |
| 596 | 596 | $output = executeQuery('document.getDocumentCount', $search_obj); |
| 597 | 597 | // Return total number of |
| 598 | 598 | $total_count = $output->data->count; |
| 599 | - return (int)$total_count; |
|
| 599 | + return (int) $total_count; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /** |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | function getDocumentCountByGroupStatus($search_obj = NULL) |
| 608 | 608 | { |
| 609 | 609 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
| 610 | - if(!$output->toBool()) return array(); |
|
| 610 | + if (!$output->toBool()) return array(); |
|
| 611 | 611 | |
| 612 | 612 | return $output->data; |
| 613 | 613 | } |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | $output = executeQuery('document.getDocumentExtraVarsCount', $args); |
| 627 | 627 | // Return total number of |
| 628 | 628 | $total_count = $output->data->count; |
| 629 | - return (int)$total_count; |
|
| 629 | + return (int) $total_count; |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | /** |
@@ -643,17 +643,17 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | $this->_setSearchOption($opt, $args, $query_id, $use_division); |
| 645 | 645 | |
| 646 | - if($sort_check->isExtraVars) |
|
| 646 | + if ($sort_check->isExtraVars) |
|
| 647 | 647 | { |
| 648 | 648 | return 1; |
| 649 | 649 | } |
| 650 | 650 | else |
| 651 | 651 | { |
| 652 | - if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 652 | + if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
|
| 653 | 653 | { |
| 654 | - if($args->order_type === 'desc') |
|
| 654 | + if ($args->order_type === 'desc') |
|
| 655 | 655 | { |
| 656 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 656 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 657 | 657 | } |
| 658 | 658 | else |
| 659 | 659 | { |
@@ -667,9 +667,9 @@ discard block |
||
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | // Guhanhu total number of the article search page |
| 670 | - $output = executeQuery($query_id . 'Page', $args); |
|
| 670 | + $output = executeQuery($query_id.'Page', $args); |
|
| 671 | 671 | $count = $output->data->count; |
| 672 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
| 672 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
| 673 | 673 | return $page; |
| 674 | 674 | } |
| 675 | 675 | |
@@ -681,16 +681,16 @@ discard block |
||
| 681 | 681 | */ |
| 682 | 682 | function getCategory($category_srl, $columnList = array()) |
| 683 | 683 | { |
| 684 | - $args =new stdClass(); |
|
| 684 | + $args = new stdClass(); |
|
| 685 | 685 | $args->category_srl = $category_srl; |
| 686 | 686 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 687 | 687 | |
| 688 | 688 | $node = $output->data; |
| 689 | - if(!$node) return; |
|
| 689 | + if (!$node) return; |
|
| 690 | 690 | |
| 691 | - if($node->group_srls) |
|
| 691 | + if ($node->group_srls) |
|
| 692 | 692 | { |
| 693 | - $group_srls = explode(',',$node->group_srls); |
|
| 693 | + $group_srls = explode(',', $node->group_srls); |
|
| 694 | 694 | unset($node->group_srls); |
| 695 | 695 | $node->group_srls = $group_srls; |
| 696 | 696 | } |
@@ -711,8 +711,8 @@ discard block |
||
| 711 | 711 | { |
| 712 | 712 | $args = new stdClass(); |
| 713 | 713 | $args->category_srl = $category_srl; |
| 714 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
| 715 | - if($output->data->count > 0) return true; |
|
| 714 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
| 715 | + if ($output->data->count > 0) return true; |
|
| 716 | 716 | return false; |
| 717 | 717 | } |
| 718 | 718 | |
@@ -728,10 +728,10 @@ discard block |
||
| 728 | 728 | // Category of the target module file swollen |
| 729 | 729 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
| 730 | 730 | // If the target file to the cache file regeneration category |
| 731 | - if(!file_exists($filename)) |
|
| 731 | + if (!file_exists($filename)) |
|
| 732 | 732 | { |
| 733 | 733 | $oDocumentController = getController('document'); |
| 734 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 734 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | include($filename); |
@@ -751,10 +751,10 @@ discard block |
||
| 751 | 751 | */ |
| 752 | 752 | function _arrangeCategory(&$document_category, $list, $depth) |
| 753 | 753 | { |
| 754 | - if(!count($list)) return; |
|
| 754 | + if (!count($list)) return; |
|
| 755 | 755 | $idx = 0; |
| 756 | 756 | $list_order = array(); |
| 757 | - foreach($list as $key => $val) |
|
| 757 | + foreach ($list as $key => $val) |
|
| 758 | 758 | { |
| 759 | 759 | $obj = new stdClass; |
| 760 | 760 | $obj->mid = $val['mid']; |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | $obj->parent_srl = $val['parent_srl']; |
| 764 | 764 | $obj->title = $obj->text = $val['text']; |
| 765 | 765 | $obj->description = $val['description']; |
| 766 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
| 766 | + $obj->expand = $val['expand'] == 'Y' ? true : false; |
|
| 767 | 767 | $obj->color = $val['color']; |
| 768 | 768 | $obj->document_count = $val['document_count']; |
| 769 | 769 | $obj->depth = $depth; |
@@ -771,26 +771,26 @@ discard block |
||
| 771 | 771 | $obj->childs = array(); |
| 772 | 772 | $obj->grant = $val['grant']; |
| 773 | 773 | |
| 774 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 774 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 775 | 775 | else $selected = false; |
| 776 | 776 | |
| 777 | 777 | $obj->selected = $selected; |
| 778 | 778 | |
| 779 | 779 | $list_order[$idx++] = $obj->category_srl; |
| 780 | 780 | // If you have a parent category of child nodes apply data |
| 781 | - if($obj->parent_srl) |
|
| 781 | + if ($obj->parent_srl) |
|
| 782 | 782 | { |
| 783 | 783 | $parent_srl = $obj->parent_srl; |
| 784 | 784 | $document_count = $obj->document_count; |
| 785 | 785 | $expand = $obj->expand; |
| 786 | - if($selected) $expand = true; |
|
| 786 | + if ($selected) $expand = true; |
|
| 787 | 787 | |
| 788 | - while($parent_srl) |
|
| 788 | + while ($parent_srl) |
|
| 789 | 789 | { |
| 790 | 790 | $document_category[$parent_srl]->document_count += $document_count; |
| 791 | 791 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 792 | 792 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 793 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 793 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 794 | 794 | |
| 795 | 795 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 796 | 796 | } |
@@ -798,10 +798,10 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | $document_category[$key] = $obj; |
| 800 | 800 | |
| 801 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 801 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
| 802 | 802 | } |
| 803 | 803 | $document_category[$list_order[0]]->first = true; |
| 804 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
| 804 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
| 805 | 805 | } |
| 806 | 806 | |
| 807 | 807 | /** |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | $args->module_srl = $module_srl; |
| 817 | 817 | $args->category_srl = $category_srl; |
| 818 | 818 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
| 819 | - return (int)$output->data->count; |
|
| 819 | + return (int) $output->data->count; |
|
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | /** |
@@ -826,8 +826,8 @@ discard block |
||
| 826 | 826 | */ |
| 827 | 827 | function getCategoryXmlFile($module_srl) |
| 828 | 828 | { |
| 829 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
| 830 | - if(!file_exists($xml_file)) |
|
| 829 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
| 830 | + if (!file_exists($xml_file)) |
|
| 831 | 831 | { |
| 832 | 832 | $oDocumentController = getController('document'); |
| 833 | 833 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -842,8 +842,8 @@ discard block |
||
| 842 | 842 | */ |
| 843 | 843 | function getCategoryPhpFile($module_srl) |
| 844 | 844 | { |
| 845 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
| 846 | - if(!file_exists($php_file)) |
|
| 845 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
| 846 | + if (!file_exists($php_file)) |
|
| 847 | 847 | { |
| 848 | 848 | $oDocumentController = getController('document'); |
| 849 | 849 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | */ |
| 859 | 859 | function getMonthlyArchivedList($obj) |
| 860 | 860 | { |
| 861 | - if($obj->mid) |
|
| 861 | + if ($obj->mid) |
|
| 862 | 862 | { |
| 863 | 863 | $oModuleModel = getModel('module'); |
| 864 | 864 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -866,13 +866,13 @@ discard block |
||
| 866 | 866 | } |
| 867 | 867 | // Module_srl passed the array may be a check whether the array |
| 868 | 868 | $args = new stdClass; |
| 869 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 869 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 870 | 870 | else $args->module_srl = $obj->module_srl; |
| 871 | 871 | |
| 872 | 872 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 873 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 873 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 874 | 874 | |
| 875 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 875 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 876 | 876 | |
| 877 | 877 | return $output; |
| 878 | 878 | } |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | */ |
| 885 | 885 | function getDailyArchivedList($obj) |
| 886 | 886 | { |
| 887 | - if($obj->mid) |
|
| 887 | + if ($obj->mid) |
|
| 888 | 888 | { |
| 889 | 889 | $oModuleModel = getModel('module'); |
| 890 | 890 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -892,14 +892,14 @@ discard block |
||
| 892 | 892 | } |
| 893 | 893 | // Module_srl passed the array may be a check whether the array |
| 894 | 894 | $args = new stdClass; |
| 895 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 895 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 896 | 896 | else $args->module_srl = $obj->module_srl; |
| 897 | 897 | $args->regdate = $obj->regdate; |
| 898 | 898 | |
| 899 | 899 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 900 | - if(!$output->toBool()) return $output; |
|
| 900 | + if (!$output->toBool()) return $output; |
|
| 901 | 901 | |
| 902 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 902 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 903 | 903 | |
| 904 | 904 | return $output; |
| 905 | 905 | } |
@@ -910,17 +910,17 @@ discard block |
||
| 910 | 910 | */ |
| 911 | 911 | function getDocumentCategories() |
| 912 | 912 | { |
| 913 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 913 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 914 | 914 | $module_srl = Context::get('module_srl'); |
| 915 | - $categories= $this->getCategoryList($module_srl); |
|
| 915 | + $categories = $this->getCategoryList($module_srl); |
|
| 916 | 916 | $lang = Context::get('lang'); |
| 917 | 917 | // No additional category |
| 918 | 918 | $output = "0,0,{$lang->none_category}\n"; |
| 919 | - if($categories) |
|
| 919 | + if ($categories) |
|
| 920 | 920 | { |
| 921 | - foreach($categories as $category_srl => $category) |
|
| 921 | + foreach ($categories as $category_srl => $category) |
|
| 922 | 922 | { |
| 923 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
| 923 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | $this->add('categories', $output); |
@@ -932,13 +932,13 @@ discard block |
||
| 932 | 932 | */ |
| 933 | 933 | function getDocumentConfig() |
| 934 | 934 | { |
| 935 | - if(!$GLOBALS['__document_config__']) |
|
| 935 | + if (!$GLOBALS['__document_config__']) |
|
| 936 | 936 | { |
| 937 | 937 | $oModuleModel = getModel('module'); |
| 938 | 938 | $config = $oModuleModel->getModuleConfig('document'); |
| 939 | 939 | |
| 940 | - if(!$config) $config = new stdClass(); |
|
| 941 | - if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
| 940 | + if (!$config) $config = new stdClass(); |
|
| 941 | + if (!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
| 942 | 942 | $GLOBALS['__document_config__'] = $config; |
| 943 | 943 | } |
| 944 | 944 | return $GLOBALS['__document_config__']; |
@@ -1003,11 +1003,11 @@ discard block |
||
| 1003 | 1003 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1004 | 1004 | // Check permissions |
| 1005 | 1005 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1006 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
| 1006 | + if (!$grant->manager) return new Object(-1, 'msg_not_permitted'); |
|
| 1007 | 1007 | |
| 1008 | 1008 | $category_srl = Context::get('category_srl'); |
| 1009 | 1009 | $category_info = $this->getCategory($category_srl); |
| 1010 | - if(!$category_info) |
|
| 1010 | + if (!$category_info) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | return new Object(-1, 'msg_invalid_request'); |
| 1013 | 1013 | } |
@@ -1023,14 +1023,14 @@ discard block |
||
| 1023 | 1023 | */ |
| 1024 | 1024 | function getDocumentSrlByAlias($mid, $alias) |
| 1025 | 1025 | { |
| 1026 | - if(!$mid || !$alias) return null; |
|
| 1026 | + if (!$mid || !$alias) return null; |
|
| 1027 | 1027 | $site_module_info = Context::get('site_module_info'); |
| 1028 | 1028 | $args = new stdClass; |
| 1029 | 1029 | $args->mid = $mid; |
| 1030 | 1030 | $args->alias_title = $alias; |
| 1031 | 1031 | $args->site_srl = $site_module_info->site_srl; |
| 1032 | 1032 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1033 | - if(!$output->data) return null; |
|
| 1033 | + if (!$output->data) return null; |
|
| 1034 | 1034 | else return $output->data->document_srl; |
| 1035 | 1035 | } |
| 1036 | 1036 | |
@@ -1042,15 +1042,15 @@ discard block |
||
| 1042 | 1042 | */ |
| 1043 | 1043 | function getDocumentSrlByTitle($module_srl, $title) |
| 1044 | 1044 | { |
| 1045 | - if(!$module_srl || !$title) return null; |
|
| 1045 | + if (!$module_srl || !$title) return null; |
|
| 1046 | 1046 | $args = new stdClass; |
| 1047 | 1047 | $args->module_srl = $module_srl; |
| 1048 | 1048 | $args->title = $title; |
| 1049 | 1049 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1050 | - if(!$output->data) return null; |
|
| 1050 | + if (!$output->data) return null; |
|
| 1051 | 1051 | else |
| 1052 | 1052 | { |
| 1053 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1053 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1054 | 1054 | return $output->data->document_srl; |
| 1055 | 1055 | } |
| 1056 | 1056 | } |
@@ -1062,12 +1062,12 @@ discard block |
||
| 1062 | 1062 | */ |
| 1063 | 1063 | function getAlias($document_srl) |
| 1064 | 1064 | { |
| 1065 | - if(!$document_srl) return null; |
|
| 1065 | + if (!$document_srl) return null; |
|
| 1066 | 1066 | $args = new stdClass; |
| 1067 | 1067 | $args->document_srl = $document_srl; |
| 1068 | 1068 | $output = executeQueryArray('document.getAliases', $args); |
| 1069 | 1069 | |
| 1070 | - if(!$output->data) return null; |
|
| 1070 | + if (!$output->data) return null; |
|
| 1071 | 1071 | else return $output->data[0]->alias_title; |
| 1072 | 1072 | } |
| 1073 | 1073 | |
@@ -1110,32 +1110,32 @@ discard block |
||
| 1110 | 1110 | { |
| 1111 | 1111 | // Variable check |
| 1112 | 1112 | $args = new stdClass; |
| 1113 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
| 1113 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
| 1114 | 1114 | $args->sort_index = $obj->sort_index; |
| 1115 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
| 1116 | - $args->page = $obj->page?$obj->page:1; |
|
| 1117 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
| 1118 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
| 1115 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
| 1116 | + $args->page = $obj->page ? $obj->page : 1; |
|
| 1117 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
| 1118 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
| 1119 | 1119 | // Search options |
| 1120 | 1120 | $search_target = $obj->search_target; |
| 1121 | 1121 | $search_keyword = $obj->search_keyword; |
| 1122 | - if($search_target && $search_keyword) |
|
| 1122 | + if ($search_target && $search_keyword) |
|
| 1123 | 1123 | { |
| 1124 | - switch($search_target) |
|
| 1124 | + switch ($search_target) |
|
| 1125 | 1125 | { |
| 1126 | 1126 | case 'title' : |
| 1127 | 1127 | case 'content' : |
| 1128 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1128 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1129 | 1129 | $args->{"s_".$search_target} = $search_keyword; |
| 1130 | 1130 | $use_division = true; |
| 1131 | 1131 | break; |
| 1132 | 1132 | case 'title_content' : |
| 1133 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1133 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1134 | 1134 | $args->s_title = $search_keyword; |
| 1135 | 1135 | $args->s_content = $search_keyword; |
| 1136 | 1136 | break; |
| 1137 | 1137 | case 'user_id' : |
| 1138 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1138 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1139 | 1139 | $args->s_user_id = $search_keyword; |
| 1140 | 1140 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1141 | 1141 | break; |
@@ -1143,13 +1143,13 @@ discard block |
||
| 1143 | 1143 | case 'nick_name' : |
| 1144 | 1144 | case 'email_address' : |
| 1145 | 1145 | case 'homepage' : |
| 1146 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1146 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1147 | 1147 | $args->{"s_".$search_target} = $search_keyword; |
| 1148 | 1148 | break; |
| 1149 | 1149 | case 'is_notice' : |
| 1150 | 1150 | case 'is_secret' : |
| 1151 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1152 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1151 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1152 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1153 | 1153 | break; |
| 1154 | 1154 | case 'member_srl' : |
| 1155 | 1155 | case 'readed_count' : |
@@ -1158,7 +1158,7 @@ discard block |
||
| 1158 | 1158 | case 'comment_count' : |
| 1159 | 1159 | case 'trackback_count' : |
| 1160 | 1160 | case 'uploaded_count' : |
| 1161 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1161 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1162 | 1162 | break; |
| 1163 | 1163 | case 'regdate' : |
| 1164 | 1164 | case 'last_update' : |
@@ -1170,9 +1170,9 @@ discard block |
||
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | 1172 | $output = executeQueryArray('document.getTrashList', $args); |
| 1173 | - if($output->data) |
|
| 1173 | + if ($output->data) |
|
| 1174 | 1174 | { |
| 1175 | - foreach($output->data as $key => $attribute) |
|
| 1175 | + foreach ($output->data as $key => $attribute) |
|
| 1176 | 1176 | { |
| 1177 | 1177 | $oDocument = null; |
| 1178 | 1178 | $oDocument = new documentItem(); |
@@ -1191,46 +1191,46 @@ discard block |
||
| 1191 | 1191 | { |
| 1192 | 1192 | $args = new stdClass; |
| 1193 | 1193 | $document_srl = Context::get('document_srl'); |
| 1194 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 1194 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1195 | 1195 | |
| 1196 | 1196 | $point = Context::get('point'); |
| 1197 | - if($point != -1) $point = 1; |
|
| 1197 | + if ($point != -1) $point = 1; |
|
| 1198 | 1198 | |
| 1199 | 1199 | $oDocumentModel = getModel('document'); |
| 1200 | 1200 | $columnList = array('document_srl', 'module_srl'); |
| 1201 | 1201 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1202 | 1202 | $module_srl = $oDocument->get('module_srl'); |
| 1203 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1203 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1204 | 1204 | |
| 1205 | 1205 | $oModuleModel = getModel('module'); |
| 1206 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 1207 | - if($point == -1) |
|
| 1206 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 1207 | + if ($point == -1) |
|
| 1208 | 1208 | { |
| 1209 | - if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1209 | + if ($document_config->use_vote_down != 'S') return new Object(-1, 'msg_invalid_request'); |
|
| 1210 | 1210 | $args->below_point = 0; |
| 1211 | 1211 | } |
| 1212 | 1212 | else |
| 1213 | 1213 | { |
| 1214 | - if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1214 | + if ($document_config->use_vote_up != 'S') return new Object(-1, 'msg_invalid_request'); |
|
| 1215 | 1215 | $args->more_point = 0; |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | 1218 | $args->document_srl = $document_srl; |
| 1219 | 1219 | |
| 1220 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
| 1221 | - if(!$output->toBool()) return $output; |
|
| 1220 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
| 1221 | + if (!$output->toBool()) return $output; |
|
| 1222 | 1222 | |
| 1223 | 1223 | $oMemberModel = getModel('member'); |
| 1224 | - if($output->data) |
|
| 1224 | + if ($output->data) |
|
| 1225 | 1225 | { |
| 1226 | - foreach($output->data as $k => $d) |
|
| 1226 | + foreach ($output->data as $k => $d) |
|
| 1227 | 1227 | { |
| 1228 | 1228 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
| 1229 | 1229 | $output->data[$k]->src = $profile_image->src; |
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | - $this->add('voted_member_list',$output->data); |
|
| 1233 | + $this->add('voted_member_list', $output->data); |
|
| 1234 | 1234 | } |
| 1235 | 1235 | |
| 1236 | 1236 | /** |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | function getStatusNameList() |
| 1241 | 1241 | { |
| 1242 | 1242 | global $lang; |
| 1243 | - if(!isset($lang->status_name_list)) |
|
| 1243 | + if (!isset($lang->status_name_list)) |
|
| 1244 | 1244 | return array_flip($this->getStatusList()); |
| 1245 | 1245 | else return $lang->status_name_list; |
| 1246 | 1246 | } |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | { |
| 1256 | 1256 | $sortIndex = $obj->sort_index; |
| 1257 | 1257 | $isExtraVars = false; |
| 1258 | - 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'))) |
|
| 1258 | + 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'))) |
|
| 1259 | 1259 | { |
| 1260 | 1260 | // get module_srl extra_vars list |
| 1261 | 1261 | if ($load_extra_vars) |
@@ -1270,11 +1270,11 @@ discard block |
||
| 1270 | 1270 | else |
| 1271 | 1271 | { |
| 1272 | 1272 | $check_array = array(); |
| 1273 | - foreach($extra_output->data as $val) |
|
| 1273 | + foreach ($extra_output->data as $val) |
|
| 1274 | 1274 | { |
| 1275 | 1275 | $check_array[] = $val->eid; |
| 1276 | 1276 | } |
| 1277 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1277 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1278 | 1278 | else $isExtraVars = true; |
| 1279 | 1279 | } |
| 1280 | 1280 | } |
@@ -1302,13 +1302,13 @@ discard block |
||
| 1302 | 1302 | { |
| 1303 | 1303 | // Variable check |
| 1304 | 1304 | $args = new stdClass(); |
| 1305 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
| 1305 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
| 1306 | 1306 | $args->order_type = $searchOpt->order_type; |
| 1307 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
| 1308 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
| 1309 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
| 1310 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
| 1311 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
| 1307 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
| 1308 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
| 1309 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
| 1310 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
| 1311 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
| 1312 | 1312 | $args->member_srl = $searchOpt->member_srl; |
| 1313 | 1313 | |
| 1314 | 1314 | $logged_info = Context::get('logged_info'); |
@@ -1317,10 +1317,10 @@ discard block |
||
| 1317 | 1317 | |
| 1318 | 1318 | // Check the target and sequence alignment |
| 1319 | 1319 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1320 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1320 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1321 | 1321 | |
| 1322 | 1322 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1323 | - if($searchOpt->mid) |
|
| 1323 | + if ($searchOpt->mid) |
|
| 1324 | 1324 | { |
| 1325 | 1325 | $oModuleModel = getModel('module'); |
| 1326 | 1326 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1328,30 +1328,30 @@ discard block |
||
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | // Module_srl passed the array may be a check whether the array |
| 1331 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1331 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1332 | 1332 | else $args->module_srl = $searchOpt->module_srl; |
| 1333 | 1333 | |
| 1334 | 1334 | // Except for the test module_srl |
| 1335 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1335 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1336 | 1336 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
| 1337 | 1337 | |
| 1338 | 1338 | // only admin document list, temp document showing |
| 1339 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1339 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1340 | 1340 | else |
| 1341 | 1341 | { |
| 1342 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1342 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1343 | 1343 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
| 1344 | 1344 | else |
| 1345 | 1345 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | // Category is selected, further sub-categories until all conditions |
| 1349 | - if($args->category_srl) |
|
| 1349 | + if ($args->category_srl) |
|
| 1350 | 1350 | { |
| 1351 | 1351 | $category_list = $this->getCategoryList($args->module_srl); |
| 1352 | 1352 | $category_info = $category_list[$args->category_srl]; |
| 1353 | 1353 | $category_info->childs[] = $args->category_srl; |
| 1354 | - $args->category_srl = implode(',',$category_info->childs); |
|
| 1354 | + $args->category_srl = implode(',', $category_info->childs); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1364,24 +1364,24 @@ discard block |
||
| 1364 | 1364 | $search_target = $searchOpt->search_target; |
| 1365 | 1365 | $search_keyword = $searchOpt->search_keyword; |
| 1366 | 1366 | |
| 1367 | - if($search_target && $search_keyword) |
|
| 1367 | + if ($search_target && $search_keyword) |
|
| 1368 | 1368 | { |
| 1369 | - switch($search_target) |
|
| 1369 | + switch ($search_target) |
|
| 1370 | 1370 | { |
| 1371 | 1371 | case 'title' : |
| 1372 | 1372 | case 'content' : |
| 1373 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1373 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1374 | 1374 | $args->{"s_".$search_target} = $search_keyword; |
| 1375 | 1375 | $use_division = true; |
| 1376 | 1376 | break; |
| 1377 | 1377 | case 'title_content' : |
| 1378 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1378 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1379 | 1379 | $args->s_title = $search_keyword; |
| 1380 | 1380 | $args->s_content = $search_keyword; |
| 1381 | 1381 | $use_division = true; |
| 1382 | 1382 | break; |
| 1383 | 1383 | case 'user_id' : |
| 1384 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1384 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1385 | 1385 | $args->s_user_id = $search_keyword; |
| 1386 | 1386 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1387 | 1387 | break; |
@@ -1389,18 +1389,18 @@ discard block |
||
| 1389 | 1389 | case 'nick_name' : |
| 1390 | 1390 | case 'email_address' : |
| 1391 | 1391 | case 'homepage' : |
| 1392 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1392 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1393 | 1393 | $args->{"s_".$search_target} = $search_keyword; |
| 1394 | 1394 | break; |
| 1395 | 1395 | case 'is_notice' : |
| 1396 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1397 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1396 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
| 1397 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1398 | 1398 | else $args->{"s_".$search_target} = ''; |
| 1399 | 1399 | break; |
| 1400 | 1400 | case 'is_secret' : |
| 1401 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1402 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1403 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1401 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1402 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1403 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1404 | 1404 | break; |
| 1405 | 1405 | case 'member_srl' : |
| 1406 | 1406 | case 'readed_count' : |
@@ -1408,10 +1408,10 @@ discard block |
||
| 1408 | 1408 | case 'comment_count' : |
| 1409 | 1409 | case 'trackback_count' : |
| 1410 | 1410 | case 'uploaded_count' : |
| 1411 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1411 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1412 | 1412 | break; |
| 1413 | 1413 | case 'blamed_count' : |
| 1414 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
| 1414 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
| 1415 | 1415 | break; |
| 1416 | 1416 | case 'regdate' : |
| 1417 | 1417 | case 'last_update' : |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | $use_division = true; |
| 1425 | 1425 | break; |
| 1426 | 1426 | case 'tag' : |
| 1427 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
| 1427 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
| 1428 | 1428 | $query_id = 'document.getDocumentListWithinTag'; |
| 1429 | 1429 | break; |
| 1430 | 1430 | case 'extra_vars': |
@@ -1432,9 +1432,9 @@ discard block |
||
| 1432 | 1432 | $query_id = 'document.getDocumentListWithinExtraVars'; |
| 1433 | 1433 | break; |
| 1434 | 1434 | default : |
| 1435 | - if(strpos($search_target,'extra_vars')!==false) { |
|
| 1435 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
| 1436 | 1436 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
| 1437 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
| 1437 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
| 1438 | 1438 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1439 | 1439 | $query_id = 'document.getDocumentListWithExtraVars'; |
| 1440 | 1440 | } |
@@ -1451,18 +1451,18 @@ discard block |
||
| 1451 | 1451 | /** |
| 1452 | 1452 | * list_order asc sort of division that can be used only when |
| 1453 | 1453 | */ |
| 1454 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1454 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1455 | 1455 | |
| 1456 | 1456 | /** |
| 1457 | 1457 | * If it is true, use_division changed to use the document division |
| 1458 | 1458 | */ |
| 1459 | - if($use_division) |
|
| 1459 | + if ($use_division) |
|
| 1460 | 1460 | { |
| 1461 | 1461 | // Division begins |
| 1462 | - $division = (int)Context::get('division'); |
|
| 1462 | + $division = (int) Context::get('division'); |
|
| 1463 | 1463 | |
| 1464 | 1464 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
| 1465 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1465 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1466 | 1466 | { |
| 1467 | 1467 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1468 | 1468 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1474,7 +1474,7 @@ discard block |
||
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | 1476 | // If you do not value the best division top |
| 1477 | - if(!$division) |
|
| 1477 | + if (!$division) |
|
| 1478 | 1478 | { |
| 1479 | 1479 | $division_args = new stdClass(); |
| 1480 | 1480 | $division_args->module_srl = $args->module_srl; |
@@ -1485,7 +1485,7 @@ discard block |
||
| 1485 | 1485 | $division_args->statusList = $args->statusList; |
| 1486 | 1486 | |
| 1487 | 1487 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
| 1488 | - if($output->data) |
|
| 1488 | + if ($output->data) |
|
| 1489 | 1489 | { |
| 1490 | 1490 | $item = array_pop($output->data); |
| 1491 | 1491 | $division = $item->list_order; |
@@ -1494,10 +1494,10 @@ discard block |
||
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | // The last division |
| 1497 | - $last_division = (int)Context::get('last_division'); |
|
| 1497 | + $last_division = (int) Context::get('last_division'); |
|
| 1498 | 1498 | |
| 1499 | 1499 | // Division after division from the 5000 value of the specified Wanted |
| 1500 | - if(!$last_division) |
|
| 1500 | + if (!$last_division) |
|
| 1501 | 1501 | { |
| 1502 | 1502 | $last_division_args = new stdClass(); |
| 1503 | 1503 | $last_division_args->module_srl = $args->module_srl; |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | $last_division_args->page = 5001; |
| 1510 | 1510 | |
| 1511 | 1511 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
| 1512 | - if($output->data) |
|
| 1512 | + if ($output->data) |
|
| 1513 | 1513 | { |
| 1514 | 1514 | $item = array_pop($output->data); |
| 1515 | 1515 | $last_division = $item->list_order; |
@@ -1517,14 +1517,14 @@ discard block |
||
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | // Make sure that after last_division article |
| 1520 | - if($last_division) |
|
| 1520 | + if ($last_division) |
|
| 1521 | 1521 | { |
| 1522 | 1522 | $last_division_args = new stdClass(); |
| 1523 | 1523 | $last_division_args->module_srl = $args->module_srl; |
| 1524 | 1524 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1525 | 1525 | $last_division_args->list_order = $last_division; |
| 1526 | 1526 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1527 | - if($output->data->count<1) $last_division = null; |
|
| 1527 | + if ($output->data->count < 1) $last_division = null; |
|
| 1528 | 1528 | } |
| 1529 | 1529 | |
| 1530 | 1530 | $args->division = $division; |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | * @param int $count |
| 1558 | 1558 | * @return object |
| 1559 | 1559 | */ |
| 1560 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
| 1560 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
| 1561 | 1561 | { |
| 1562 | 1562 | $args = new stdClass(); |
| 1563 | 1563 | $args->member_srl = $member_srl; |
@@ -1565,8 +1565,8 @@ discard block |
||
| 1565 | 1565 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1566 | 1566 | $document_list = $output->data; |
| 1567 | 1567 | |
| 1568 | - if(!$document_list) return array(); |
|
| 1569 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1568 | + if (!$document_list) return array(); |
|
| 1569 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 1570 | 1570 | |
| 1571 | 1571 | return $document_list; |
| 1572 | 1572 | } |
@@ -56,18 +56,24 @@ discard block |
||
| 56 | 56 | $_document_list = &$GLOBALS['XE_DOCUMENT_LIST']; |
| 57 | 57 | |
| 58 | 58 | // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings |
| 59 | - if(count($_document_list) <= 0) return; |
|
| 59 | + if(count($_document_list) <= 0) { |
|
| 60 | + return; |
|
| 61 | + } |
|
| 60 | 62 | |
| 61 | 63 | // Find all called the document object variable has been set extension |
| 62 | 64 | $document_srls = array(); |
| 63 | 65 | foreach($_document_list as $key => $val) |
| 64 | 66 | { |
| 65 | - if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; |
|
| 67 | + if(!$val->document_srl || $checked_documents[$val->document_srl]) { |
|
| 68 | + continue; |
|
| 69 | + } |
|
| 66 | 70 | $checked_documents[$val->document_srl] = true; |
| 67 | 71 | $document_srls[] = $val->document_srl; |
| 68 | 72 | } |
| 69 | 73 | // If the document number, return detected |
| 70 | - if(!count($document_srls)) return; |
|
| 74 | + if(!count($document_srls)) { |
|
| 75 | + return; |
|
| 76 | + } |
|
| 71 | 77 | // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable |
| 72 | 78 | //$obj->document_srl = implode(',',$document_srls); |
| 73 | 79 | $output = $this->getDocumentExtraVarsFromDB($document_srls); |
@@ -75,8 +81,12 @@ discard block |
||
| 75 | 81 | { |
| 76 | 82 | foreach($output->data as $key => $val) |
| 77 | 83 | { |
| 78 | - if(!isset($val->value)) continue; |
|
| 79 | - 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); |
|
| 84 | + if(!isset($val->value)) { |
|
| 85 | + continue; |
|
| 86 | + } |
|
| 87 | + if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) { |
|
| 88 | + $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value); |
|
| 89 | + } |
|
| 80 | 90 | $extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value); |
| 81 | 91 | } |
| 82 | 92 | } |
@@ -87,7 +97,9 @@ discard block |
||
| 87 | 97 | $document_srl = $document_srls[$i]; |
| 88 | 98 | unset($vars); |
| 89 | 99 | |
| 90 | - if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue; |
|
| 100 | + if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) { |
|
| 101 | + continue; |
|
| 102 | + } |
|
| 91 | 103 | $module_srl = $_document_list[$document_srl]->get('module_srl'); |
| 92 | 104 | $extra_keys = $this->getExtraKeys($module_srl); |
| 93 | 105 | $vars = $extra_vars[$document_srl]; |
@@ -99,10 +111,15 @@ discard block |
||
| 99 | 111 | { |
| 100 | 112 | $extra_keys[$idx] = clone($key); |
| 101 | 113 | $val = $vars[$idx]; |
| 102 | - if(isset($val[$user_lang_code])) $v = $val[$user_lang_code]; |
|
| 103 | - else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code]; |
|
| 104 | - else if(isset($val[0])) $v = $val[0]; |
|
| 105 | - else $v = null; |
|
| 114 | + if(isset($val[$user_lang_code])) { |
|
| 115 | + $v = $val[$user_lang_code]; |
|
| 116 | + } else if(isset($val[$document_lang_code])) { |
|
| 117 | + $v = $val[$document_lang_code]; |
|
| 118 | + } else if(isset($val[0])) { |
|
| 119 | + $v = $val[0]; |
|
| 120 | + } else { |
|
| 121 | + $v = null; |
|
| 122 | + } |
|
| 106 | 123 | $extra_keys[$idx]->value = $v; |
| 107 | 124 | } |
| 108 | 125 | } |
@@ -111,9 +128,13 @@ discard block |
||
| 111 | 128 | $evars = new ExtraVar($module_srl); |
| 112 | 129 | $evars->setExtraVarKeys($extra_keys); |
| 113 | 130 | // Title Processing |
| 114 | - if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 131 | + if($vars[-1][$user_lang_code]) { |
|
| 132 | + $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]); |
|
| 133 | + } |
|
| 115 | 134 | // Information processing |
| 116 | - if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 135 | + if($vars[-2][$user_lang_code]) { |
|
| 136 | + $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]); |
|
| 137 | + } |
|
| 117 | 138 | |
| 118 | 139 | if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]) |
| 119 | 140 | { |
@@ -134,15 +155,21 @@ discard block |
||
| 134 | 155 | */ |
| 135 | 156 | function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) |
| 136 | 157 | { |
| 137 | - if(!$document_srl) return new documentItem(); |
|
| 158 | + if(!$document_srl) { |
|
| 159 | + return new documentItem(); |
|
| 160 | + } |
|
| 138 | 161 | |
| 139 | 162 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 140 | 163 | { |
| 141 | 164 | $oDocument = new documentItem($document_srl, $load_extra_vars, $columnList); |
| 142 | 165 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 143 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 166 | + if($load_extra_vars) { |
|
| 167 | + $this->setToAllDocumentExtraVars(); |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + if($is_admin) { |
|
| 171 | + $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 144 | 172 | } |
| 145 | - if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant(); |
|
| 146 | 173 | |
| 147 | 174 | return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 148 | 175 | } |
@@ -161,8 +188,7 @@ discard block |
||
| 161 | 188 | { |
| 162 | 189 | $list_count = count($document_srls); |
| 163 | 190 | $document_srls = implode(',',$document_srls); |
| 164 | - } |
|
| 165 | - else |
|
| 191 | + } else |
|
| 166 | 192 | { |
| 167 | 193 | $list_count = 1; |
| 168 | 194 | } |
@@ -173,28 +199,38 @@ discard block |
||
| 173 | 199 | |
| 174 | 200 | $output = executeQuery('document.getDocuments', $args, $columnList); |
| 175 | 201 | $document_list = $output->data; |
| 176 | - if(!$document_list) return; |
|
| 177 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 202 | + if(!$document_list) { |
|
| 203 | + return; |
|
| 204 | + } |
|
| 205 | + if(!is_array($document_list)) { |
|
| 206 | + $document_list = array($document_list); |
|
| 207 | + } |
|
| 178 | 208 | |
| 179 | 209 | $document_count = count($document_list); |
| 180 | 210 | foreach($document_list as $key => $attribute) |
| 181 | 211 | { |
| 182 | 212 | $document_srl = $attribute->document_srl; |
| 183 | - if(!$document_srl) continue; |
|
| 213 | + if(!$document_srl) { |
|
| 214 | + continue; |
|
| 215 | + } |
|
| 184 | 216 | |
| 185 | 217 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 186 | 218 | { |
| 187 | 219 | $oDocument = null; |
| 188 | 220 | $oDocument = new documentItem(); |
| 189 | 221 | $oDocument->setAttribute($attribute, false); |
| 190 | - if($is_admin) $oDocument->setGrant(); |
|
| 222 | + if($is_admin) { |
|
| 223 | + $oDocument->setGrant(); |
|
| 224 | + } |
|
| 191 | 225 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 192 | 226 | } |
| 193 | 227 | |
| 194 | 228 | $result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]; |
| 195 | 229 | } |
| 196 | 230 | |
| 197 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 231 | + if($load_extra_vars) { |
|
| 232 | + $this->setToAllDocumentExtraVars(); |
|
| 233 | + } |
|
| 198 | 234 | |
| 199 | 235 | $output = null; |
| 200 | 236 | if(count($result)) |
@@ -242,18 +278,15 @@ discard block |
||
| 242 | 278 | { |
| 243 | 279 | $output = $obj->use_alternate_output; |
| 244 | 280 | unset($obj->use_alternate_output); |
| 245 | - } |
|
| 246 | - elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 281 | + } elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars')) |
|
| 247 | 282 | { |
| 248 | 283 | $query_id = 'document.getDocumentListWithinExtraVarsExtraSort'; |
| 249 | 284 | $args->sort_index = str_replace('documents.','',$args->sort_index); |
| 250 | 285 | $output = executeQueryArray($query_id, $args); |
| 251 | - } |
|
| 252 | - elseif ($sort_check->isExtraVars) |
|
| 286 | + } elseif ($sort_check->isExtraVars) |
|
| 253 | 287 | { |
| 254 | 288 | $output = executeQueryArray($query_id, $args); |
| 255 | - } |
|
| 256 | - else |
|
| 289 | + } else |
|
| 257 | 290 | { |
| 258 | 291 | // document.getDocumentList query execution |
| 259 | 292 | // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because |
@@ -263,11 +296,15 @@ discard block |
||
| 263 | 296 | $group_args = clone($args); |
| 264 | 297 | $group_args->sort_index = 'documents.'.$args->sort_index; |
| 265 | 298 | $output = executeQueryArray($query_id, $group_args); |
| 266 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 299 | + if(!$output->toBool()||!count($output->data)) { |
|
| 300 | + return $output; |
|
| 301 | + } |
|
| 267 | 302 | |
| 268 | 303 | foreach($output->data as $key => $val) |
| 269 | 304 | { |
| 270 | - if($val->document_srl) $target_srls[] = $val->document_srl; |
|
| 305 | + if($val->document_srl) { |
|
| 306 | + $target_srls[] = $val->document_srl; |
|
| 307 | + } |
|
| 271 | 308 | } |
| 272 | 309 | |
| 273 | 310 | $page_navigation = $output->page_navigation; |
@@ -285,14 +322,15 @@ discard block |
||
| 285 | 322 | $output->total_count = $page_navigation->total_count; |
| 286 | 323 | $output->total_page = $page_navigation->total_page; |
| 287 | 324 | $output->page = $page_navigation->cur_page; |
| 288 | - } |
|
| 289 | - else |
|
| 325 | + } else |
|
| 290 | 326 | { |
| 291 | 327 | $output = executeQueryArray($query_id, $args, $columnList); |
| 292 | 328 | } |
| 293 | 329 | } |
| 294 | 330 | // Return if no result or an error occurs |
| 295 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 331 | + if(!$output->toBool()||!count($output->data)) { |
|
| 332 | + return $output; |
|
| 333 | + } |
|
| 296 | 334 | $idx = 0; |
| 297 | 335 | $data = $output->data; |
| 298 | 336 | unset($output->data); |
@@ -307,20 +345,26 @@ discard block |
||
| 307 | 345 | { |
| 308 | 346 | foreach($data as $key => $attribute) |
| 309 | 347 | { |
| 310 | - if($attribute->is_notice == 'Y') $virtual_number --; |
|
| 348 | + if($attribute->is_notice == 'Y') { |
|
| 349 | + $virtual_number --; |
|
| 350 | + } |
|
| 311 | 351 | } |
| 312 | 352 | } |
| 313 | 353 | |
| 314 | 354 | foreach($data as $key => $attribute) |
| 315 | 355 | { |
| 316 | - if($except_notice && $attribute->is_notice == 'Y') continue; |
|
| 356 | + if($except_notice && $attribute->is_notice == 'Y') { |
|
| 357 | + continue; |
|
| 358 | + } |
|
| 317 | 359 | $document_srl = $attribute->document_srl; |
| 318 | 360 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 319 | 361 | { |
| 320 | 362 | $oDocument = null; |
| 321 | 363 | $oDocument = new documentItem(); |
| 322 | 364 | $oDocument->setAttribute($attribute, false); |
| 323 | - if($is_admin) $oDocument->setGrant(); |
|
| 365 | + if($is_admin) { |
|
| 366 | + $oDocument->setGrant(); |
|
| 367 | + } |
|
| 324 | 368 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 325 | 369 | } |
| 326 | 370 | |
@@ -328,7 +372,9 @@ discard block |
||
| 328 | 372 | $virtual_number--; |
| 329 | 373 | } |
| 330 | 374 | |
| 331 | - if($load_extra_vars) $this->setToAllDocumentExtraVars(); |
|
| 375 | + if($load_extra_vars) { |
|
| 376 | + $this->setToAllDocumentExtraVars(); |
|
| 377 | + } |
|
| 332 | 378 | |
| 333 | 379 | if(count($output->data)) |
| 334 | 380 | { |
@@ -356,12 +402,16 @@ discard block |
||
| 356 | 402 | $args->module_srl = $obj->module_srl; |
| 357 | 403 | $args->category_srl= $obj->category_srl; |
| 358 | 404 | $output = executeQueryArray('document.getNoticeList', $args, $columnList); |
| 359 | - if(!$output->toBool()||!$output->data) return; |
|
| 405 | + if(!$output->toBool()||!$output->data) { |
|
| 406 | + return; |
|
| 407 | + } |
|
| 360 | 408 | |
| 361 | 409 | foreach($output->data as $key => $val) |
| 362 | 410 | { |
| 363 | 411 | $document_srl = $val->document_srl; |
| 364 | - if(!$document_srl) continue; |
|
| 412 | + if(!$document_srl) { |
|
| 413 | + continue; |
|
| 414 | + } |
|
| 365 | 415 | |
| 366 | 416 | if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) |
| 367 | 417 | { |
@@ -457,7 +507,9 @@ discard block |
||
| 457 | 507 | |
| 458 | 508 | $oExtraVar->setExtraVarKeys($output->data); |
| 459 | 509 | $keys = $oExtraVar->getExtraVars(); |
| 460 | - if(!$keys) $keys = array(); |
|
| 510 | + if(!$keys) { |
|
| 511 | + $keys = array(); |
|
| 512 | + } |
|
| 461 | 513 | |
| 462 | 514 | if($oCacheHandler->isSupport()) |
| 463 | 515 | { |
@@ -487,7 +539,9 @@ discard block |
||
| 487 | 539 | $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; |
| 488 | 540 | $this->setToAllDocumentExtraVars(); |
| 489 | 541 | } |
| 490 | - if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 542 | + if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) { |
|
| 543 | + ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]); |
|
| 544 | + } |
|
| 491 | 545 | return $GLOBALS['XE_EXTRA_VARS'][$document_srl]; |
| 492 | 546 | } |
| 493 | 547 | |
@@ -517,7 +571,9 @@ discard block |
||
| 517 | 571 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 518 | 572 | $module_srl = $oDocument->get('module_srl'); |
| 519 | 573 | $member_srl = $oDocument->get('member_srl'); |
| 520 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 574 | + if(!$module_srl) { |
|
| 575 | + return new Object(-1, 'msg_invalid_request'); |
|
| 576 | + } |
|
| 521 | 577 | |
| 522 | 578 | $oModuleModel = getModel('module'); |
| 523 | 579 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
@@ -590,7 +646,9 @@ discard block |
||
| 590 | 646 | */ |
| 591 | 647 | function getDocumentCount($module_srl, $search_obj = NULL) |
| 592 | 648 | { |
| 593 | - if(is_null($search_obj)) $search_obj = new stdClass(); |
|
| 649 | + if(is_null($search_obj)) { |
|
| 650 | + $search_obj = new stdClass(); |
|
| 651 | + } |
|
| 594 | 652 | $search_obj->module_srl = $module_srl; |
| 595 | 653 | |
| 596 | 654 | $output = executeQuery('document.getDocumentCount', $search_obj); |
@@ -607,7 +665,9 @@ discard block |
||
| 607 | 665 | function getDocumentCountByGroupStatus($search_obj = NULL) |
| 608 | 666 | { |
| 609 | 667 | $output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj); |
| 610 | - if(!$output->toBool()) return array(); |
|
| 668 | + if(!$output->toBool()) { |
|
| 669 | + return array(); |
|
| 670 | + } |
|
| 611 | 671 | |
| 612 | 672 | return $output->data; |
| 613 | 673 | } |
@@ -646,21 +706,18 @@ discard block |
||
| 646 | 706 | if($sort_check->isExtraVars) |
| 647 | 707 | { |
| 648 | 708 | return 1; |
| 649 | - } |
|
| 650 | - else |
|
| 709 | + } else |
|
| 651 | 710 | { |
| 652 | 711 | if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order') |
| 653 | 712 | { |
| 654 | 713 | if($args->order_type === 'desc') |
| 655 | 714 | { |
| 656 | 715 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 657 | - } |
|
| 658 | - else |
|
| 716 | + } else |
|
| 659 | 717 | { |
| 660 | 718 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 661 | 719 | } |
| 662 | - } |
|
| 663 | - else |
|
| 720 | + } else |
|
| 664 | 721 | { |
| 665 | 722 | return 1; |
| 666 | 723 | } |
@@ -686,15 +743,16 @@ discard block |
||
| 686 | 743 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 687 | 744 | |
| 688 | 745 | $node = $output->data; |
| 689 | - if(!$node) return; |
|
| 746 | + if(!$node) { |
|
| 747 | + return; |
|
| 748 | + } |
|
| 690 | 749 | |
| 691 | 750 | if($node->group_srls) |
| 692 | 751 | { |
| 693 | 752 | $group_srls = explode(',',$node->group_srls); |
| 694 | 753 | unset($node->group_srls); |
| 695 | 754 | $node->group_srls = $group_srls; |
| 696 | - } |
|
| 697 | - else |
|
| 755 | + } else |
|
| 698 | 756 | { |
| 699 | 757 | unset($node->group_srls); |
| 700 | 758 | $node->group_srls = array(); |
@@ -712,7 +770,9 @@ discard block |
||
| 712 | 770 | $args = new stdClass(); |
| 713 | 771 | $args->category_srl = $category_srl; |
| 714 | 772 | $output = executeQuery('document.getChildCategoryCount',$args); |
| 715 | - if($output->data->count > 0) return true; |
|
| 773 | + if($output->data->count > 0) { |
|
| 774 | + return true; |
|
| 775 | + } |
|
| 716 | 776 | return false; |
| 717 | 777 | } |
| 718 | 778 | |
@@ -731,7 +791,9 @@ discard block |
||
| 731 | 791 | if(!file_exists($filename)) |
| 732 | 792 | { |
| 733 | 793 | $oDocumentController = getController('document'); |
| 734 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 794 | + if(!$oDocumentController->makeCategoryFile($module_srl)) { |
|
| 795 | + return array(); |
|
| 796 | + } |
|
| 735 | 797 | } |
| 736 | 798 | |
| 737 | 799 | include($filename); |
@@ -751,7 +813,9 @@ discard block |
||
| 751 | 813 | */ |
| 752 | 814 | function _arrangeCategory(&$document_category, $list, $depth) |
| 753 | 815 | { |
| 754 | - if(!count($list)) return; |
|
| 816 | + if(!count($list)) { |
|
| 817 | + return; |
|
| 818 | + } |
|
| 755 | 819 | $idx = 0; |
| 756 | 820 | $list_order = array(); |
| 757 | 821 | foreach($list as $key => $val) |
@@ -771,8 +835,11 @@ discard block |
||
| 771 | 835 | $obj->childs = array(); |
| 772 | 836 | $obj->grant = $val['grant']; |
| 773 | 837 | |
| 774 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 775 | - else $selected = false; |
|
| 838 | + if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) { |
|
| 839 | + $selected = true; |
|
| 840 | + } else { |
|
| 841 | + $selected = false; |
|
| 842 | + } |
|
| 776 | 843 | |
| 777 | 844 | $obj->selected = $selected; |
| 778 | 845 | |
@@ -783,14 +850,18 @@ discard block |
||
| 783 | 850 | $parent_srl = $obj->parent_srl; |
| 784 | 851 | $document_count = $obj->document_count; |
| 785 | 852 | $expand = $obj->expand; |
| 786 | - if($selected) $expand = true; |
|
| 853 | + if($selected) { |
|
| 854 | + $expand = true; |
|
| 855 | + } |
|
| 787 | 856 | |
| 788 | 857 | while($parent_srl) |
| 789 | 858 | { |
| 790 | 859 | $document_category[$parent_srl]->document_count += $document_count; |
| 791 | 860 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 792 | 861 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 793 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 862 | + if($expand) { |
|
| 863 | + $document_category[$parent_srl]->expand = $expand; |
|
| 864 | + } |
|
| 794 | 865 | |
| 795 | 866 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 796 | 867 | } |
@@ -798,7 +869,9 @@ discard block |
||
| 798 | 869 | |
| 799 | 870 | $document_category[$key] = $obj; |
| 800 | 871 | |
| 801 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 872 | + if(count($val['list'])) { |
|
| 873 | + $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 874 | + } |
|
| 802 | 875 | } |
| 803 | 876 | $document_category[$list_order[0]]->first = true; |
| 804 | 877 | $document_category[$list_order[count($list_order)-1]]->last = true; |
@@ -866,13 +939,20 @@ discard block |
||
| 866 | 939 | } |
| 867 | 940 | // Module_srl passed the array may be a check whether the array |
| 868 | 941 | $args = new stdClass; |
| 869 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 870 | - else $args->module_srl = $obj->module_srl; |
|
| 942 | + if(is_array($obj->module_srl)) { |
|
| 943 | + $args->module_srl = implode(',', $obj->module_srl); |
|
| 944 | + } else { |
|
| 945 | + $args->module_srl = $obj->module_srl; |
|
| 946 | + } |
|
| 871 | 947 | |
| 872 | 948 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 873 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 949 | + if(!$output->toBool()||!$output->data) { |
|
| 950 | + return $output; |
|
| 951 | + } |
|
| 874 | 952 | |
| 875 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 953 | + if(!is_array($output->data)) { |
|
| 954 | + $output->data = array($output->data); |
|
| 955 | + } |
|
| 876 | 956 | |
| 877 | 957 | return $output; |
| 878 | 958 | } |
@@ -892,14 +972,21 @@ discard block |
||
| 892 | 972 | } |
| 893 | 973 | // Module_srl passed the array may be a check whether the array |
| 894 | 974 | $args = new stdClass; |
| 895 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 896 | - else $args->module_srl = $obj->module_srl; |
|
| 975 | + if(is_array($obj->module_srl)) { |
|
| 976 | + $args->module_srl = implode(',', $obj->module_srl); |
|
| 977 | + } else { |
|
| 978 | + $args->module_srl = $obj->module_srl; |
|
| 979 | + } |
|
| 897 | 980 | $args->regdate = $obj->regdate; |
| 898 | 981 | |
| 899 | 982 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 900 | - if(!$output->toBool()) return $output; |
|
| 983 | + if(!$output->toBool()) { |
|
| 984 | + return $output; |
|
| 985 | + } |
|
| 901 | 986 | |
| 902 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 987 | + if(!is_array($output->data)) { |
|
| 988 | + $output->data = array($output->data); |
|
| 989 | + } |
|
| 903 | 990 | |
| 904 | 991 | return $output; |
| 905 | 992 | } |
@@ -910,7 +997,9 @@ discard block |
||
| 910 | 997 | */ |
| 911 | 998 | function getDocumentCategories() |
| 912 | 999 | { |
| 913 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 1000 | + if(!Context::get('is_logged')) { |
|
| 1001 | + return new Object(-1,'msg_not_permitted'); |
|
| 1002 | + } |
|
| 914 | 1003 | $module_srl = Context::get('module_srl'); |
| 915 | 1004 | $categories= $this->getCategoryList($module_srl); |
| 916 | 1005 | $lang = Context::get('lang'); |
@@ -937,8 +1026,12 @@ discard block |
||
| 937 | 1026 | $oModuleModel = getModel('module'); |
| 938 | 1027 | $config = $oModuleModel->getModuleConfig('document'); |
| 939 | 1028 | |
| 940 | - if(!$config) $config = new stdClass(); |
|
| 941 | - if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
| 1029 | + if(!$config) { |
|
| 1030 | + $config = new stdClass(); |
|
| 1031 | + } |
|
| 1032 | + if(!$config->thumbnail_type) { |
|
| 1033 | + $config->thumbnail_type = 'crop'; |
|
| 1034 | + } |
|
| 942 | 1035 | $GLOBALS['__document_config__'] = $config; |
| 943 | 1036 | } |
| 944 | 1037 | return $GLOBALS['__document_config__']; |
@@ -1003,7 +1096,9 @@ discard block |
||
| 1003 | 1096 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1004 | 1097 | // Check permissions |
| 1005 | 1098 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1006 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
| 1099 | + if(!$grant->manager) { |
|
| 1100 | + return new Object(-1,'msg_not_permitted'); |
|
| 1101 | + } |
|
| 1007 | 1102 | |
| 1008 | 1103 | $category_srl = Context::get('category_srl'); |
| 1009 | 1104 | $category_info = $this->getCategory($category_srl); |
@@ -1023,15 +1118,20 @@ discard block |
||
| 1023 | 1118 | */ |
| 1024 | 1119 | function getDocumentSrlByAlias($mid, $alias) |
| 1025 | 1120 | { |
| 1026 | - if(!$mid || !$alias) return null; |
|
| 1121 | + if(!$mid || !$alias) { |
|
| 1122 | + return null; |
|
| 1123 | + } |
|
| 1027 | 1124 | $site_module_info = Context::get('site_module_info'); |
| 1028 | 1125 | $args = new stdClass; |
| 1029 | 1126 | $args->mid = $mid; |
| 1030 | 1127 | $args->alias_title = $alias; |
| 1031 | 1128 | $args->site_srl = $site_module_info->site_srl; |
| 1032 | 1129 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1033 | - if(!$output->data) return null; |
|
| 1034 | - else return $output->data->document_srl; |
|
| 1130 | + if(!$output->data) { |
|
| 1131 | + return null; |
|
| 1132 | + } else { |
|
| 1133 | + return $output->data->document_srl; |
|
| 1134 | + } |
|
| 1035 | 1135 | } |
| 1036 | 1136 | |
| 1037 | 1137 | /** |
@@ -1042,15 +1142,20 @@ discard block |
||
| 1042 | 1142 | */ |
| 1043 | 1143 | function getDocumentSrlByTitle($module_srl, $title) |
| 1044 | 1144 | { |
| 1045 | - if(!$module_srl || !$title) return null; |
|
| 1145 | + if(!$module_srl || !$title) { |
|
| 1146 | + return null; |
|
| 1147 | + } |
|
| 1046 | 1148 | $args = new stdClass; |
| 1047 | 1149 | $args->module_srl = $module_srl; |
| 1048 | 1150 | $args->title = $title; |
| 1049 | 1151 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1050 | - if(!$output->data) return null; |
|
| 1051 | - else |
|
| 1152 | + if(!$output->data) { |
|
| 1153 | + return null; |
|
| 1154 | + } else |
|
| 1052 | 1155 | { |
| 1053 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1156 | + if(is_array($output->data)) { |
|
| 1157 | + return $output->data[0]->document_srl; |
|
| 1158 | + } |
|
| 1054 | 1159 | return $output->data->document_srl; |
| 1055 | 1160 | } |
| 1056 | 1161 | } |
@@ -1062,13 +1167,18 @@ discard block |
||
| 1062 | 1167 | */ |
| 1063 | 1168 | function getAlias($document_srl) |
| 1064 | 1169 | { |
| 1065 | - if(!$document_srl) return null; |
|
| 1170 | + if(!$document_srl) { |
|
| 1171 | + return null; |
|
| 1172 | + } |
|
| 1066 | 1173 | $args = new stdClass; |
| 1067 | 1174 | $args->document_srl = $document_srl; |
| 1068 | 1175 | $output = executeQueryArray('document.getAliases', $args); |
| 1069 | 1176 | |
| 1070 | - if(!$output->data) return null; |
|
| 1071 | - else return $output->data[0]->alias_title; |
|
| 1177 | + if(!$output->data) { |
|
| 1178 | + return null; |
|
| 1179 | + } else { |
|
| 1180 | + return $output->data[0]->alias_title; |
|
| 1181 | + } |
|
| 1072 | 1182 | } |
| 1073 | 1183 | |
| 1074 | 1184 | /** |
@@ -1125,17 +1235,23 @@ discard block |
||
| 1125 | 1235 | { |
| 1126 | 1236 | case 'title' : |
| 1127 | 1237 | case 'content' : |
| 1128 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1238 | + if($search_keyword) { |
|
| 1239 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1240 | + } |
|
| 1129 | 1241 | $args->{"s_".$search_target} = $search_keyword; |
| 1130 | 1242 | $use_division = true; |
| 1131 | 1243 | break; |
| 1132 | 1244 | case 'title_content' : |
| 1133 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1245 | + if($search_keyword) { |
|
| 1246 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1247 | + } |
|
| 1134 | 1248 | $args->s_title = $search_keyword; |
| 1135 | 1249 | $args->s_content = $search_keyword; |
| 1136 | 1250 | break; |
| 1137 | 1251 | case 'user_id' : |
| 1138 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1252 | + if($search_keyword) { |
|
| 1253 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1254 | + } |
|
| 1139 | 1255 | $args->s_user_id = $search_keyword; |
| 1140 | 1256 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1141 | 1257 | break; |
@@ -1143,13 +1259,18 @@ discard block |
||
| 1143 | 1259 | case 'nick_name' : |
| 1144 | 1260 | case 'email_address' : |
| 1145 | 1261 | case 'homepage' : |
| 1146 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1262 | + if($search_keyword) { |
|
| 1263 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1264 | + } |
|
| 1147 | 1265 | $args->{"s_".$search_target} = $search_keyword; |
| 1148 | 1266 | break; |
| 1149 | 1267 | case 'is_notice' : |
| 1150 | 1268 | case 'is_secret' : |
| 1151 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1152 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1269 | + if($search_keyword=='N') { |
|
| 1270 | + $args->statusList = array($this->getConfigStatus('public')); |
|
| 1271 | + } elseif($search_keyword=='Y') { |
|
| 1272 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1273 | + } |
|
| 1153 | 1274 | break; |
| 1154 | 1275 | case 'member_srl' : |
| 1155 | 1276 | case 'readed_count' : |
@@ -1191,34 +1312,45 @@ discard block |
||
| 1191 | 1312 | { |
| 1192 | 1313 | $args = new stdClass; |
| 1193 | 1314 | $document_srl = Context::get('document_srl'); |
| 1194 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 1315 | + if(!$document_srl) { |
|
| 1316 | + return new Object(-1,'msg_invalid_request'); |
|
| 1317 | + } |
|
| 1195 | 1318 | |
| 1196 | 1319 | $point = Context::get('point'); |
| 1197 | - if($point != -1) $point = 1; |
|
| 1320 | + if($point != -1) { |
|
| 1321 | + $point = 1; |
|
| 1322 | + } |
|
| 1198 | 1323 | |
| 1199 | 1324 | $oDocumentModel = getModel('document'); |
| 1200 | 1325 | $columnList = array('document_srl', 'module_srl'); |
| 1201 | 1326 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1202 | 1327 | $module_srl = $oDocument->get('module_srl'); |
| 1203 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1328 | + if(!$module_srl) { |
|
| 1329 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1330 | + } |
|
| 1204 | 1331 | |
| 1205 | 1332 | $oModuleModel = getModel('module'); |
| 1206 | 1333 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
| 1207 | 1334 | if($point == -1) |
| 1208 | 1335 | { |
| 1209 | - if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1336 | + if($document_config->use_vote_down!='S') { |
|
| 1337 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1338 | + } |
|
| 1210 | 1339 | $args->below_point = 0; |
| 1211 | - } |
|
| 1212 | - else |
|
| 1340 | + } else |
|
| 1213 | 1341 | { |
| 1214 | - if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1342 | + if($document_config->use_vote_up!='S') { |
|
| 1343 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1344 | + } |
|
| 1215 | 1345 | $args->more_point = 0; |
| 1216 | 1346 | } |
| 1217 | 1347 | |
| 1218 | 1348 | $args->document_srl = $document_srl; |
| 1219 | 1349 | |
| 1220 | 1350 | $output = executeQueryArray('document.getVotedMemberList',$args); |
| 1221 | - if(!$output->toBool()) return $output; |
|
| 1351 | + if(!$output->toBool()) { |
|
| 1352 | + return $output; |
|
| 1353 | + } |
|
| 1222 | 1354 | |
| 1223 | 1355 | $oMemberModel = getModel('member'); |
| 1224 | 1356 | if($output->data) |
@@ -1240,9 +1372,11 @@ discard block |
||
| 1240 | 1372 | function getStatusNameList() |
| 1241 | 1373 | { |
| 1242 | 1374 | global $lang; |
| 1243 | - if(!isset($lang->status_name_list)) |
|
| 1244 | - return array_flip($this->getStatusList()); |
|
| 1245 | - else return $lang->status_name_list; |
|
| 1375 | + if(!isset($lang->status_name_list)) { |
|
| 1376 | + return array_flip($this->getStatusList()); |
|
| 1377 | + } else { |
|
| 1378 | + return $lang->status_name_list; |
|
| 1379 | + } |
|
| 1246 | 1380 | } |
| 1247 | 1381 | |
| 1248 | 1382 | /** |
@@ -1266,20 +1400,22 @@ discard block |
||
| 1266 | 1400 | if (!$extra_output->data || !$extra_output->toBool()) |
| 1267 | 1401 | { |
| 1268 | 1402 | $sortIndex = 'list_order'; |
| 1269 | - } |
|
| 1270 | - else |
|
| 1403 | + } else |
|
| 1271 | 1404 | { |
| 1272 | 1405 | $check_array = array(); |
| 1273 | 1406 | foreach($extra_output->data as $val) |
| 1274 | 1407 | { |
| 1275 | 1408 | $check_array[] = $val->eid; |
| 1276 | 1409 | } |
| 1277 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1278 | - else $isExtraVars = true; |
|
| 1410 | + if(!in_array($sortIndex, $check_array)) { |
|
| 1411 | + $sortIndex = 'list_order'; |
|
| 1412 | + } else { |
|
| 1413 | + $isExtraVars = true; |
|
| 1414 | + } |
|
| 1279 | 1415 | } |
| 1416 | + } else { |
|
| 1417 | + $sortIndex = 'list_order'; |
|
| 1280 | 1418 | } |
| 1281 | - else |
|
| 1282 | - $sortIndex = 'list_order'; |
|
| 1283 | 1419 | } |
| 1284 | 1420 | $returnObj = new stdClass(); |
| 1285 | 1421 | $returnObj->sort_index = $sortIndex; |
@@ -1317,7 +1453,9 @@ discard block |
||
| 1317 | 1453 | |
| 1318 | 1454 | // Check the target and sequence alignment |
| 1319 | 1455 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1320 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1456 | + if(!isset($orderType[$args->order_type])) { |
|
| 1457 | + $args->order_type = 'asc'; |
|
| 1458 | + } |
|
| 1321 | 1459 | |
| 1322 | 1460 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1323 | 1461 | if($searchOpt->mid) |
@@ -1328,21 +1466,29 @@ discard block |
||
| 1328 | 1466 | } |
| 1329 | 1467 | |
| 1330 | 1468 | // Module_srl passed the array may be a check whether the array |
| 1331 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1332 | - else $args->module_srl = $searchOpt->module_srl; |
|
| 1469 | + if(is_array($searchOpt->module_srl)) { |
|
| 1470 | + $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1471 | + } else { |
|
| 1472 | + $args->module_srl = $searchOpt->module_srl; |
|
| 1473 | + } |
|
| 1333 | 1474 | |
| 1334 | 1475 | // Except for the test module_srl |
| 1335 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1336 | - else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
| 1476 | + if(is_array($searchOpt->exclude_module_srl)) { |
|
| 1477 | + $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1478 | + } else { |
|
| 1479 | + $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
| 1480 | + } |
|
| 1337 | 1481 | |
| 1338 | 1482 | // only admin document list, temp document showing |
| 1339 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1340 | - else |
|
| 1483 | + if($searchOpt->statusList) { |
|
| 1484 | + $args->statusList = $searchOpt->statusList; |
|
| 1485 | + } else |
|
| 1341 | 1486 | { |
| 1342 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1343 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
| 1344 | - else |
|
| 1345 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
| 1487 | + if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) { |
|
| 1488 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
| 1489 | + } else { |
|
| 1490 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
| 1491 | + } |
|
| 1346 | 1492 | } |
| 1347 | 1493 | |
| 1348 | 1494 | // Category is selected, further sub-categories until all conditions |
@@ -1370,18 +1516,24 @@ discard block |
||
| 1370 | 1516 | { |
| 1371 | 1517 | case 'title' : |
| 1372 | 1518 | case 'content' : |
| 1373 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1519 | + if($search_keyword) { |
|
| 1520 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1521 | + } |
|
| 1374 | 1522 | $args->{"s_".$search_target} = $search_keyword; |
| 1375 | 1523 | $use_division = true; |
| 1376 | 1524 | break; |
| 1377 | 1525 | case 'title_content' : |
| 1378 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1526 | + if($search_keyword) { |
|
| 1527 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1528 | + } |
|
| 1379 | 1529 | $args->s_title = $search_keyword; |
| 1380 | 1530 | $args->s_content = $search_keyword; |
| 1381 | 1531 | $use_division = true; |
| 1382 | 1532 | break; |
| 1383 | 1533 | case 'user_id' : |
| 1384 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1534 | + if($search_keyword) { |
|
| 1535 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1536 | + } |
|
| 1385 | 1537 | $args->s_user_id = $search_keyword; |
| 1386 | 1538 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1387 | 1539 | break; |
@@ -1389,18 +1541,28 @@ discard block |
||
| 1389 | 1541 | case 'nick_name' : |
| 1390 | 1542 | case 'email_address' : |
| 1391 | 1543 | case 'homepage' : |
| 1392 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1544 | + if($search_keyword) { |
|
| 1545 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1546 | + } |
|
| 1393 | 1547 | $args->{"s_".$search_target} = $search_keyword; |
| 1394 | 1548 | break; |
| 1395 | 1549 | case 'is_notice' : |
| 1396 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1397 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1398 | - else $args->{"s_".$search_target} = ''; |
|
| 1550 | + if($search_keyword=='N') { |
|
| 1551 | + $args->{"s_".$search_target} = 'N'; |
|
| 1552 | + } elseif($search_keyword=='Y') { |
|
| 1553 | + $args->{"s_".$search_target} = 'Y'; |
|
| 1554 | + } else { |
|
| 1555 | + $args->{"s_".$search_target} = ''; |
|
| 1556 | + } |
|
| 1399 | 1557 | break; |
| 1400 | 1558 | case 'is_secret' : |
| 1401 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1402 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1403 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1559 | + if($search_keyword=='N') { |
|
| 1560 | + $args->statusList = array($this->getConfigStatus('public')); |
|
| 1561 | + } elseif($search_keyword=='Y') { |
|
| 1562 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1563 | + } elseif($search_keyword=='temp') { |
|
| 1564 | + $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1565 | + } |
|
| 1404 | 1566 | break; |
| 1405 | 1567 | case 'member_srl' : |
| 1406 | 1568 | case 'readed_count' : |
@@ -1445,13 +1607,14 @@ discard block |
||
| 1445 | 1607 | if ($searchOpt->isExtraVars) |
| 1446 | 1608 | { |
| 1447 | 1609 | $query_id = 'document.getDocumentListExtraSort'; |
| 1448 | - } |
|
| 1449 | - else |
|
| 1610 | + } else |
|
| 1450 | 1611 | { |
| 1451 | 1612 | /** |
| 1452 | 1613 | * list_order asc sort of division that can be used only when |
| 1453 | 1614 | */ |
| 1454 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1615 | + if($args->sort_index != 'list_order' || $args->order_type != 'asc') { |
|
| 1616 | + $use_division = false; |
|
| 1617 | + } |
|
| 1455 | 1618 | |
| 1456 | 1619 | /** |
| 1457 | 1620 | * If it is true, use_division changed to use the document division |
@@ -1466,8 +1629,7 @@ discard block |
||
| 1466 | 1629 | { |
| 1467 | 1630 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1468 | 1631 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
| 1469 | - } |
|
| 1470 | - else |
|
| 1632 | + } else |
|
| 1471 | 1633 | { |
| 1472 | 1634 | $listSqlID = 'document.getDocumentList'; |
| 1473 | 1635 | $divisionSqlID = 'document.getDocumentDivision'; |
@@ -1524,7 +1686,9 @@ discard block |
||
| 1524 | 1686 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1525 | 1687 | $last_division_args->list_order = $last_division; |
| 1526 | 1688 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1527 | - if($output->data->count<1) $last_division = null; |
|
| 1689 | + if($output->data->count<1) { |
|
| 1690 | + $last_division = null; |
|
| 1691 | + } |
|
| 1528 | 1692 | } |
| 1529 | 1693 | |
| 1530 | 1694 | $args->division = $division; |
@@ -1565,8 +1729,12 @@ discard block |
||
| 1565 | 1729 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1566 | 1730 | $document_list = $output->data; |
| 1567 | 1731 | |
| 1568 | - if(!$document_list) return array(); |
|
| 1569 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1732 | + if(!$document_list) { |
|
| 1733 | + return array(); |
|
| 1734 | + } |
|
| 1735 | + if(!is_array($document_list)) { |
|
| 1736 | + $document_list = array($document_list); |
|
| 1737 | + } |
|
| 1570 | 1738 | |
| 1571 | 1739 | return $document_list; |
| 1572 | 1740 | } |