@@ -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,29 +643,29 @@ 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 | { |
| 660 | 660 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | - elseif($sort_check->sort_index === 'regdate') |
|
| 663 | + elseif ($sort_check->sort_index === 'regdate') |
|
| 664 | 664 | { |
| 665 | 665 | |
| 666 | - if($args->order_type === 'asc') |
|
| 666 | + if ($args->order_type === 'asc') |
|
| 667 | 667 | { |
| 668 | - $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 668 | + $args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
|
| 669 | 669 | } |
| 670 | 670 | else |
| 671 | 671 | { |
@@ -680,9 +680,9 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | // Guhanhu total number of the article search page |
| 683 | - $output = executeQuery($query_id . 'Page', $args); |
|
| 683 | + $output = executeQuery($query_id.'Page', $args); |
|
| 684 | 684 | $count = $output->data->count; |
| 685 | - $page = (int)(($count-1)/$opt->list_count)+1; |
|
| 685 | + $page = (int) (($count - 1) / $opt->list_count) + 1; |
|
| 686 | 686 | return $page; |
| 687 | 687 | } |
| 688 | 688 | |
@@ -694,16 +694,16 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | function getCategory($category_srl, $columnList = array()) |
| 696 | 696 | { |
| 697 | - $args =new stdClass(); |
|
| 697 | + $args = new stdClass(); |
|
| 698 | 698 | $args->category_srl = $category_srl; |
| 699 | 699 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 700 | 700 | |
| 701 | 701 | $node = $output->data; |
| 702 | - if(!$node) return; |
|
| 702 | + if (!$node) return; |
|
| 703 | 703 | |
| 704 | - if($node->group_srls) |
|
| 704 | + if ($node->group_srls) |
|
| 705 | 705 | { |
| 706 | - $group_srls = explode(',',$node->group_srls); |
|
| 706 | + $group_srls = explode(',', $node->group_srls); |
|
| 707 | 707 | unset($node->group_srls); |
| 708 | 708 | $node->group_srls = $group_srls; |
| 709 | 709 | } |
@@ -724,8 +724,8 @@ discard block |
||
| 724 | 724 | { |
| 725 | 725 | $args = new stdClass(); |
| 726 | 726 | $args->category_srl = $category_srl; |
| 727 | - $output = executeQuery('document.getChildCategoryCount',$args); |
|
| 728 | - if($output->data->count > 0) return true; |
|
| 727 | + $output = executeQuery('document.getChildCategoryCount', $args); |
|
| 728 | + if ($output->data->count > 0) return true; |
|
| 729 | 729 | return false; |
| 730 | 730 | } |
| 731 | 731 | |
@@ -741,10 +741,10 @@ discard block |
||
| 741 | 741 | // Category of the target module file swollen |
| 742 | 742 | $filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl); |
| 743 | 743 | // If the target file to the cache file regeneration category |
| 744 | - if(!file_exists($filename)) |
|
| 744 | + if (!file_exists($filename)) |
|
| 745 | 745 | { |
| 746 | 746 | $oDocumentController = getController('document'); |
| 747 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 747 | + if (!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | include($filename); |
@@ -764,10 +764,10 @@ discard block |
||
| 764 | 764 | */ |
| 765 | 765 | function _arrangeCategory(&$document_category, $list, $depth) |
| 766 | 766 | { |
| 767 | - if(!count($list)) return; |
|
| 767 | + if (!count($list)) return; |
|
| 768 | 768 | $idx = 0; |
| 769 | 769 | $list_order = array(); |
| 770 | - foreach($list as $key => $val) |
|
| 770 | + foreach ($list as $key => $val) |
|
| 771 | 771 | { |
| 772 | 772 | $obj = new stdClass; |
| 773 | 773 | $obj->mid = $val['mid']; |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | $obj->parent_srl = $val['parent_srl']; |
| 777 | 777 | $obj->title = $obj->text = $val['text']; |
| 778 | 778 | $obj->description = $val['description']; |
| 779 | - $obj->expand = $val['expand']=='Y'?true:false; |
|
| 779 | + $obj->expand = $val['expand'] == 'Y' ? true : false; |
|
| 780 | 780 | $obj->color = $val['color']; |
| 781 | 781 | $obj->document_count = $val['document_count']; |
| 782 | 782 | $obj->depth = $depth; |
@@ -784,26 +784,26 @@ discard block |
||
| 784 | 784 | $obj->childs = array(); |
| 785 | 785 | $obj->grant = $val['grant']; |
| 786 | 786 | |
| 787 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 787 | + if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 788 | 788 | else $selected = false; |
| 789 | 789 | |
| 790 | 790 | $obj->selected = $selected; |
| 791 | 791 | |
| 792 | 792 | $list_order[$idx++] = $obj->category_srl; |
| 793 | 793 | // If you have a parent category of child nodes apply data |
| 794 | - if($obj->parent_srl) |
|
| 794 | + if ($obj->parent_srl) |
|
| 795 | 795 | { |
| 796 | 796 | $parent_srl = $obj->parent_srl; |
| 797 | 797 | $document_count = $obj->document_count; |
| 798 | 798 | $expand = $obj->expand; |
| 799 | - if($selected) $expand = true; |
|
| 799 | + if ($selected) $expand = true; |
|
| 800 | 800 | |
| 801 | - while($parent_srl) |
|
| 801 | + while ($parent_srl) |
|
| 802 | 802 | { |
| 803 | 803 | $document_category[$parent_srl]->document_count += $document_count; |
| 804 | 804 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 805 | 805 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 806 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 806 | + if ($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 807 | 807 | |
| 808 | 808 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 809 | 809 | } |
@@ -811,10 +811,10 @@ discard block |
||
| 811 | 811 | |
| 812 | 812 | $document_category[$key] = $obj; |
| 813 | 813 | |
| 814 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 814 | + if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1); |
|
| 815 | 815 | } |
| 816 | 816 | $document_category[$list_order[0]]->first = true; |
| 817 | - $document_category[$list_order[count($list_order)-1]]->last = true; |
|
| 817 | + $document_category[$list_order[count($list_order) - 1]]->last = true; |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /** |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | $args->module_srl = $module_srl; |
| 830 | 830 | $args->category_srl = $category_srl; |
| 831 | 831 | $output = executeQuery('document.getCategoryDocumentCount', $args); |
| 832 | - return (int)$output->data->count; |
|
| 832 | + return (int) $output->data->count; |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | /** |
@@ -839,8 +839,8 @@ discard block |
||
| 839 | 839 | */ |
| 840 | 840 | function getCategoryXmlFile($module_srl) |
| 841 | 841 | { |
| 842 | - $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); |
|
| 843 | - if(!file_exists($xml_file)) |
|
| 842 | + $xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl); |
|
| 843 | + if (!file_exists($xml_file)) |
|
| 844 | 844 | { |
| 845 | 845 | $oDocumentController = getController('document'); |
| 846 | 846 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -855,8 +855,8 @@ discard block |
||
| 855 | 855 | */ |
| 856 | 856 | function getCategoryPhpFile($module_srl) |
| 857 | 857 | { |
| 858 | - $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); |
|
| 859 | - if(!file_exists($php_file)) |
|
| 858 | + $php_file = sprintf('files/cache/document_category/%s.php', $module_srl); |
|
| 859 | + if (!file_exists($php_file)) |
|
| 860 | 860 | { |
| 861 | 861 | $oDocumentController = getController('document'); |
| 862 | 862 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | */ |
| 872 | 872 | function getMonthlyArchivedList($obj) |
| 873 | 873 | { |
| 874 | - if($obj->mid) |
|
| 874 | + if ($obj->mid) |
|
| 875 | 875 | { |
| 876 | 876 | $oModuleModel = getModel('module'); |
| 877 | 877 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -879,13 +879,13 @@ discard block |
||
| 879 | 879 | } |
| 880 | 880 | // Module_srl passed the array may be a check whether the array |
| 881 | 881 | $args = new stdClass; |
| 882 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 882 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 883 | 883 | else $args->module_srl = $obj->module_srl; |
| 884 | 884 | |
| 885 | 885 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 886 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 886 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 887 | 887 | |
| 888 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 888 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 889 | 889 | |
| 890 | 890 | return $output; |
| 891 | 891 | } |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | */ |
| 898 | 898 | function getDailyArchivedList($obj) |
| 899 | 899 | { |
| 900 | - if($obj->mid) |
|
| 900 | + if ($obj->mid) |
|
| 901 | 901 | { |
| 902 | 902 | $oModuleModel = getModel('module'); |
| 903 | 903 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -905,14 +905,14 @@ discard block |
||
| 905 | 905 | } |
| 906 | 906 | // Module_srl passed the array may be a check whether the array |
| 907 | 907 | $args = new stdClass; |
| 908 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 908 | + if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 909 | 909 | else $args->module_srl = $obj->module_srl; |
| 910 | 910 | $args->regdate = $obj->regdate; |
| 911 | 911 | |
| 912 | 912 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 913 | - if(!$output->toBool()) return $output; |
|
| 913 | + if (!$output->toBool()) return $output; |
|
| 914 | 914 | |
| 915 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 915 | + if (!is_array($output->data)) $output->data = array($output->data); |
|
| 916 | 916 | |
| 917 | 917 | return $output; |
| 918 | 918 | } |
@@ -923,17 +923,17 @@ discard block |
||
| 923 | 923 | */ |
| 924 | 924 | function getDocumentCategories() |
| 925 | 925 | { |
| 926 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 926 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 927 | 927 | $module_srl = Context::get('module_srl'); |
| 928 | - $categories= $this->getCategoryList($module_srl); |
|
| 928 | + $categories = $this->getCategoryList($module_srl); |
|
| 929 | 929 | $lang = Context::get('lang'); |
| 930 | 930 | // No additional category |
| 931 | 931 | $output = "0,0,{$lang->none_category}\n"; |
| 932 | - if($categories) |
|
| 932 | + if ($categories) |
|
| 933 | 933 | { |
| 934 | - foreach($categories as $category_srl => $category) |
|
| 934 | + foreach ($categories as $category_srl => $category) |
|
| 935 | 935 | { |
| 936 | - $output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title); |
|
| 936 | + $output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title); |
|
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | 939 | $this->add('categories', $output); |
@@ -945,13 +945,13 @@ discard block |
||
| 945 | 945 | */ |
| 946 | 946 | function getDocumentConfig() |
| 947 | 947 | { |
| 948 | - if(!$GLOBALS['__document_config__']) |
|
| 948 | + if (!$GLOBALS['__document_config__']) |
|
| 949 | 949 | { |
| 950 | 950 | $oModuleModel = getModel('module'); |
| 951 | 951 | $config = $oModuleModel->getModuleConfig('document'); |
| 952 | 952 | |
| 953 | - if(!$config) $config = new stdClass(); |
|
| 954 | - if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
| 953 | + if (!$config) $config = new stdClass(); |
|
| 954 | + if (!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
| 955 | 955 | $GLOBALS['__document_config__'] = $config; |
| 956 | 956 | } |
| 957 | 957 | return $GLOBALS['__document_config__']; |
@@ -1016,11 +1016,11 @@ discard block |
||
| 1016 | 1016 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1017 | 1017 | // Check permissions |
| 1018 | 1018 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1019 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
| 1019 | + if (!$grant->manager) return new Object(-1, 'msg_not_permitted'); |
|
| 1020 | 1020 | |
| 1021 | 1021 | $category_srl = Context::get('category_srl'); |
| 1022 | 1022 | $category_info = $this->getCategory($category_srl); |
| 1023 | - if(!$category_info) |
|
| 1023 | + if (!$category_info) |
|
| 1024 | 1024 | { |
| 1025 | 1025 | return new Object(-1, 'msg_invalid_request'); |
| 1026 | 1026 | } |
@@ -1036,14 +1036,14 @@ discard block |
||
| 1036 | 1036 | */ |
| 1037 | 1037 | function getDocumentSrlByAlias($mid, $alias) |
| 1038 | 1038 | { |
| 1039 | - if(!$mid || !$alias) return null; |
|
| 1039 | + if (!$mid || !$alias) return null; |
|
| 1040 | 1040 | $site_module_info = Context::get('site_module_info'); |
| 1041 | 1041 | $args = new stdClass; |
| 1042 | 1042 | $args->mid = $mid; |
| 1043 | 1043 | $args->alias_title = $alias; |
| 1044 | 1044 | $args->site_srl = $site_module_info->site_srl; |
| 1045 | 1045 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1046 | - if(!$output->data) return null; |
|
| 1046 | + if (!$output->data) return null; |
|
| 1047 | 1047 | else return $output->data->document_srl; |
| 1048 | 1048 | } |
| 1049 | 1049 | |
@@ -1055,15 +1055,15 @@ discard block |
||
| 1055 | 1055 | */ |
| 1056 | 1056 | function getDocumentSrlByTitle($module_srl, $title) |
| 1057 | 1057 | { |
| 1058 | - if(!$module_srl || !$title) return null; |
|
| 1058 | + if (!$module_srl || !$title) return null; |
|
| 1059 | 1059 | $args = new stdClass; |
| 1060 | 1060 | $args->module_srl = $module_srl; |
| 1061 | 1061 | $args->title = $title; |
| 1062 | 1062 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1063 | - if(!$output->data) return null; |
|
| 1063 | + if (!$output->data) return null; |
|
| 1064 | 1064 | else |
| 1065 | 1065 | { |
| 1066 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1066 | + if (is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1067 | 1067 | return $output->data->document_srl; |
| 1068 | 1068 | } |
| 1069 | 1069 | } |
@@ -1075,12 +1075,12 @@ discard block |
||
| 1075 | 1075 | */ |
| 1076 | 1076 | function getAlias($document_srl) |
| 1077 | 1077 | { |
| 1078 | - if(!$document_srl) return null; |
|
| 1078 | + if (!$document_srl) return null; |
|
| 1079 | 1079 | $args = new stdClass; |
| 1080 | 1080 | $args->document_srl = $document_srl; |
| 1081 | 1081 | $output = executeQueryArray('document.getAliases', $args); |
| 1082 | 1082 | |
| 1083 | - if(!$output->data) return null; |
|
| 1083 | + if (!$output->data) return null; |
|
| 1084 | 1084 | else return $output->data[0]->alias_title; |
| 1085 | 1085 | } |
| 1086 | 1086 | |
@@ -1123,32 +1123,32 @@ discard block |
||
| 1123 | 1123 | { |
| 1124 | 1124 | // Variable check |
| 1125 | 1125 | $args = new stdClass; |
| 1126 | - $args->category_srl = $obj->category_srl?$obj->category_srl:null; |
|
| 1126 | + $args->category_srl = $obj->category_srl ? $obj->category_srl : null; |
|
| 1127 | 1127 | $args->sort_index = $obj->sort_index; |
| 1128 | - $args->order_type = $obj->order_type?$obj->order_type:'desc'; |
|
| 1129 | - $args->page = $obj->page?$obj->page:1; |
|
| 1130 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
| 1131 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
| 1128 | + $args->order_type = $obj->order_type ? $obj->order_type : 'desc'; |
|
| 1129 | + $args->page = $obj->page ? $obj->page : 1; |
|
| 1130 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
| 1131 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
| 1132 | 1132 | // Search options |
| 1133 | 1133 | $search_target = $obj->search_target; |
| 1134 | 1134 | $search_keyword = $obj->search_keyword; |
| 1135 | - if($search_target && $search_keyword) |
|
| 1135 | + if ($search_target && $search_keyword) |
|
| 1136 | 1136 | { |
| 1137 | - switch($search_target) |
|
| 1137 | + switch ($search_target) |
|
| 1138 | 1138 | { |
| 1139 | 1139 | case 'title' : |
| 1140 | 1140 | case 'content' : |
| 1141 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1141 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1142 | 1142 | $args->{"s_".$search_target} = $search_keyword; |
| 1143 | 1143 | $use_division = true; |
| 1144 | 1144 | break; |
| 1145 | 1145 | case 'title_content' : |
| 1146 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1146 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1147 | 1147 | $args->s_title = $search_keyword; |
| 1148 | 1148 | $args->s_content = $search_keyword; |
| 1149 | 1149 | break; |
| 1150 | 1150 | case 'user_id' : |
| 1151 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1151 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1152 | 1152 | $args->s_user_id = $search_keyword; |
| 1153 | 1153 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1154 | 1154 | break; |
@@ -1156,13 +1156,13 @@ discard block |
||
| 1156 | 1156 | case 'nick_name' : |
| 1157 | 1157 | case 'email_address' : |
| 1158 | 1158 | case 'homepage' : |
| 1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1159 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1160 | 1160 | $args->{"s_".$search_target} = $search_keyword; |
| 1161 | 1161 | break; |
| 1162 | 1162 | case 'is_notice' : |
| 1163 | 1163 | case 'is_secret' : |
| 1164 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1165 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1164 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1165 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1166 | 1166 | break; |
| 1167 | 1167 | case 'member_srl' : |
| 1168 | 1168 | case 'readed_count' : |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | case 'comment_count' : |
| 1172 | 1172 | case 'trackback_count' : |
| 1173 | 1173 | case 'uploaded_count' : |
| 1174 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1174 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1175 | 1175 | break; |
| 1176 | 1176 | case 'regdate' : |
| 1177 | 1177 | case 'last_update' : |
@@ -1183,9 +1183,9 @@ discard block |
||
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | $output = executeQueryArray('document.getTrashList', $args); |
| 1186 | - if($output->data) |
|
| 1186 | + if ($output->data) |
|
| 1187 | 1187 | { |
| 1188 | - foreach($output->data as $key => $attribute) |
|
| 1188 | + foreach ($output->data as $key => $attribute) |
|
| 1189 | 1189 | { |
| 1190 | 1190 | $oDocument = null; |
| 1191 | 1191 | $oDocument = new documentItem(); |
@@ -1204,46 +1204,46 @@ discard block |
||
| 1204 | 1204 | { |
| 1205 | 1205 | $args = new stdClass; |
| 1206 | 1206 | $document_srl = Context::get('document_srl'); |
| 1207 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 1207 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1208 | 1208 | |
| 1209 | 1209 | $point = Context::get('point'); |
| 1210 | - if($point != -1) $point = 1; |
|
| 1210 | + if ($point != -1) $point = 1; |
|
| 1211 | 1211 | |
| 1212 | 1212 | $oDocumentModel = getModel('document'); |
| 1213 | 1213 | $columnList = array('document_srl', 'module_srl'); |
| 1214 | 1214 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1215 | 1215 | $module_srl = $oDocument->get('module_srl'); |
| 1216 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1216 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1217 | 1217 | |
| 1218 | 1218 | $oModuleModel = getModel('module'); |
| 1219 | - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
|
| 1220 | - if($point == -1) |
|
| 1219 | + $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); |
|
| 1220 | + if ($point == -1) |
|
| 1221 | 1221 | { |
| 1222 | - if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1222 | + if ($document_config->use_vote_down != 'S') return new Object(-1, 'msg_invalid_request'); |
|
| 1223 | 1223 | $args->below_point = 0; |
| 1224 | 1224 | } |
| 1225 | 1225 | else |
| 1226 | 1226 | { |
| 1227 | - if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1227 | + if ($document_config->use_vote_up != 'S') return new Object(-1, 'msg_invalid_request'); |
|
| 1228 | 1228 | $args->more_point = 0; |
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | $args->document_srl = $document_srl; |
| 1232 | 1232 | |
| 1233 | - $output = executeQueryArray('document.getVotedMemberList',$args); |
|
| 1234 | - if(!$output->toBool()) return $output; |
|
| 1233 | + $output = executeQueryArray('document.getVotedMemberList', $args); |
|
| 1234 | + if (!$output->toBool()) return $output; |
|
| 1235 | 1235 | |
| 1236 | 1236 | $oMemberModel = getModel('member'); |
| 1237 | - if($output->data) |
|
| 1237 | + if ($output->data) |
|
| 1238 | 1238 | { |
| 1239 | - foreach($output->data as $k => $d) |
|
| 1239 | + foreach ($output->data as $k => $d) |
|
| 1240 | 1240 | { |
| 1241 | 1241 | $profile_image = $oMemberModel->getProfileImage($d->member_srl); |
| 1242 | 1242 | $output->data[$k]->src = $profile_image->src; |
| 1243 | 1243 | } |
| 1244 | 1244 | } |
| 1245 | 1245 | |
| 1246 | - $this->add('voted_member_list',$output->data); |
|
| 1246 | + $this->add('voted_member_list', $output->data); |
|
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | /** |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | function getStatusNameList() |
| 1254 | 1254 | { |
| 1255 | 1255 | global $lang; |
| 1256 | - if(!isset($lang->status_name_list)) |
|
| 1256 | + if (!isset($lang->status_name_list)) |
|
| 1257 | 1257 | return array_flip($this->getStatusList()); |
| 1258 | 1258 | else return $lang->status_name_list; |
| 1259 | 1259 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | { |
| 1269 | 1269 | $sortIndex = $obj->sort_index; |
| 1270 | 1270 | $isExtraVars = false; |
| 1271 | - 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'))) |
|
| 1271 | + 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'))) |
|
| 1272 | 1272 | { |
| 1273 | 1273 | // get module_srl extra_vars list |
| 1274 | 1274 | if ($load_extra_vars) |
@@ -1283,11 +1283,11 @@ discard block |
||
| 1283 | 1283 | else |
| 1284 | 1284 | { |
| 1285 | 1285 | $check_array = array(); |
| 1286 | - foreach($extra_output->data as $val) |
|
| 1286 | + foreach ($extra_output->data as $val) |
|
| 1287 | 1287 | { |
| 1288 | 1288 | $check_array[] = $val->eid; |
| 1289 | 1289 | } |
| 1290 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1290 | + if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1291 | 1291 | else $isExtraVars = true; |
| 1292 | 1292 | } |
| 1293 | 1293 | } |
@@ -1315,13 +1315,13 @@ discard block |
||
| 1315 | 1315 | { |
| 1316 | 1316 | // Variable check |
| 1317 | 1317 | $args = new stdClass(); |
| 1318 | - $args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null; |
|
| 1318 | + $args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null; |
|
| 1319 | 1319 | $args->order_type = $searchOpt->order_type; |
| 1320 | - $args->page = $searchOpt->page?$searchOpt->page:1; |
|
| 1321 | - $args->list_count = $searchOpt->list_count?$searchOpt->list_count:20; |
|
| 1322 | - $args->page_count = $searchOpt->page_count?$searchOpt->page_count:10; |
|
| 1323 | - $args->start_date = $searchOpt->start_date?$searchOpt->start_date:null; |
|
| 1324 | - $args->end_date = $searchOpt->end_date?$searchOpt->end_date:null; |
|
| 1320 | + $args->page = $searchOpt->page ? $searchOpt->page : 1; |
|
| 1321 | + $args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20; |
|
| 1322 | + $args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10; |
|
| 1323 | + $args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null; |
|
| 1324 | + $args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null; |
|
| 1325 | 1325 | $args->member_srl = $searchOpt->member_srl; |
| 1326 | 1326 | |
| 1327 | 1327 | $logged_info = Context::get('logged_info'); |
@@ -1330,10 +1330,10 @@ discard block |
||
| 1330 | 1330 | |
| 1331 | 1331 | // Check the target and sequence alignment |
| 1332 | 1332 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1333 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1333 | + if (!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1334 | 1334 | |
| 1335 | 1335 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1336 | - if($searchOpt->mid) |
|
| 1336 | + if ($searchOpt->mid) |
|
| 1337 | 1337 | { |
| 1338 | 1338 | $oModuleModel = getModel('module'); |
| 1339 | 1339 | $args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -1341,30 +1341,30 @@ discard block |
||
| 1341 | 1341 | } |
| 1342 | 1342 | |
| 1343 | 1343 | // Module_srl passed the array may be a check whether the array |
| 1344 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1344 | + if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1345 | 1345 | else $args->module_srl = $searchOpt->module_srl; |
| 1346 | 1346 | |
| 1347 | 1347 | // Except for the test module_srl |
| 1348 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1348 | + if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1349 | 1349 | else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
| 1350 | 1350 | |
| 1351 | 1351 | // only admin document list, temp document showing |
| 1352 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1352 | + if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1353 | 1353 | else |
| 1354 | 1354 | { |
| 1355 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1355 | + if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1356 | 1356 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
| 1357 | 1357 | else |
| 1358 | 1358 | $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | 1361 | // Category is selected, further sub-categories until all conditions |
| 1362 | - if($args->category_srl) |
|
| 1362 | + if ($args->category_srl) |
|
| 1363 | 1363 | { |
| 1364 | 1364 | $category_list = $this->getCategoryList($args->module_srl); |
| 1365 | 1365 | $category_info = $category_list[$args->category_srl]; |
| 1366 | 1366 | $category_info->childs[] = $args->category_srl; |
| 1367 | - $args->category_srl = implode(',',$category_info->childs); |
|
| 1367 | + $args->category_srl = implode(',', $category_info->childs); |
|
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | // Used to specify the default query id (based on several search options to query id modified) |
@@ -1377,24 +1377,24 @@ discard block |
||
| 1377 | 1377 | $search_target = $searchOpt->search_target; |
| 1378 | 1378 | $search_keyword = $searchOpt->search_keyword; |
| 1379 | 1379 | |
| 1380 | - if($search_target && $search_keyword) |
|
| 1380 | + if ($search_target && $search_keyword) |
|
| 1381 | 1381 | { |
| 1382 | - switch($search_target) |
|
| 1382 | + switch ($search_target) |
|
| 1383 | 1383 | { |
| 1384 | 1384 | case 'title' : |
| 1385 | 1385 | case 'content' : |
| 1386 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1386 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1387 | 1387 | $args->{"s_".$search_target} = $search_keyword; |
| 1388 | 1388 | $use_division = true; |
| 1389 | 1389 | break; |
| 1390 | 1390 | case 'title_content' : |
| 1391 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1391 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1392 | 1392 | $args->s_title = $search_keyword; |
| 1393 | 1393 | $args->s_content = $search_keyword; |
| 1394 | 1394 | $use_division = true; |
| 1395 | 1395 | break; |
| 1396 | 1396 | case 'user_id' : |
| 1397 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1397 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1398 | 1398 | $args->s_user_id = $search_keyword; |
| 1399 | 1399 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1400 | 1400 | break; |
@@ -1402,18 +1402,18 @@ discard block |
||
| 1402 | 1402 | case 'nick_name' : |
| 1403 | 1403 | case 'email_address' : |
| 1404 | 1404 | case 'homepage' : |
| 1405 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1405 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 1406 | 1406 | $args->{"s_".$search_target} = $search_keyword; |
| 1407 | 1407 | break; |
| 1408 | 1408 | case 'is_notice' : |
| 1409 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1410 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1409 | + if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N'; |
|
| 1410 | + elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1411 | 1411 | else $args->{"s_".$search_target} = ''; |
| 1412 | 1412 | break; |
| 1413 | 1413 | case 'is_secret' : |
| 1414 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1415 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1416 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1414 | + if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1415 | + elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1416 | + elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1417 | 1417 | break; |
| 1418 | 1418 | case 'member_srl' : |
| 1419 | 1419 | case 'readed_count' : |
@@ -1421,10 +1421,10 @@ discard block |
||
| 1421 | 1421 | case 'comment_count' : |
| 1422 | 1422 | case 'trackback_count' : |
| 1423 | 1423 | case 'uploaded_count' : |
| 1424 | - $args->{"s_".$search_target} = (int)$search_keyword; |
|
| 1424 | + $args->{"s_".$search_target} = (int) $search_keyword; |
|
| 1425 | 1425 | break; |
| 1426 | 1426 | case 'blamed_count' : |
| 1427 | - $args->{"s_".$search_target} = (int)$search_keyword * -1; |
|
| 1427 | + $args->{"s_".$search_target} = (int) $search_keyword * -1; |
|
| 1428 | 1428 | break; |
| 1429 | 1429 | case 'regdate' : |
| 1430 | 1430 | case 'last_update' : |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | $use_division = true; |
| 1438 | 1438 | break; |
| 1439 | 1439 | case 'tag' : |
| 1440 | - $args->s_tags = str_replace(' ','%',$search_keyword); |
|
| 1440 | + $args->s_tags = str_replace(' ', '%', $search_keyword); |
|
| 1441 | 1441 | $query_id = 'document.getDocumentListWithinTag'; |
| 1442 | 1442 | break; |
| 1443 | 1443 | case 'extra_vars': |
@@ -1445,9 +1445,9 @@ discard block |
||
| 1445 | 1445 | $query_id = 'document.getDocumentListWithinExtraVars'; |
| 1446 | 1446 | break; |
| 1447 | 1447 | default : |
| 1448 | - if(strpos($search_target,'extra_vars')!==false) { |
|
| 1448 | + if (strpos($search_target, 'extra_vars') !== false) { |
|
| 1449 | 1449 | $args->var_idx = substr($search_target, strlen('extra_vars')); |
| 1450 | - $args->var_value = str_replace(' ','%',$search_keyword); |
|
| 1450 | + $args->var_value = str_replace(' ', '%', $search_keyword); |
|
| 1451 | 1451 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1452 | 1452 | $query_id = 'document.getDocumentListWithExtraVars'; |
| 1453 | 1453 | } |
@@ -1464,18 +1464,18 @@ discard block |
||
| 1464 | 1464 | /** |
| 1465 | 1465 | * list_order asc sort of division that can be used only when |
| 1466 | 1466 | */ |
| 1467 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1467 | + if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1468 | 1468 | |
| 1469 | 1469 | /** |
| 1470 | 1470 | * If it is true, use_division changed to use the document division |
| 1471 | 1471 | */ |
| 1472 | - if($use_division) |
|
| 1472 | + if ($use_division) |
|
| 1473 | 1473 | { |
| 1474 | 1474 | // Division begins |
| 1475 | - $division = (int)Context::get('division'); |
|
| 1475 | + $division = (int) Context::get('division'); |
|
| 1476 | 1476 | |
| 1477 | 1477 | // order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan |
| 1478 | - if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1478 | + if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5)) |
|
| 1479 | 1479 | { |
| 1480 | 1480 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1481 | 1481 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | // If you do not value the best division top |
| 1490 | - if(!$division) |
|
| 1490 | + if (!$division) |
|
| 1491 | 1491 | { |
| 1492 | 1492 | $division_args = new stdClass(); |
| 1493 | 1493 | $division_args->module_srl = $args->module_srl; |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | $division_args->statusList = $args->statusList; |
| 1499 | 1499 | |
| 1500 | 1500 | $output = executeQuery($divisionSqlID, $division_args, array('list_order')); |
| 1501 | - if($output->data) |
|
| 1501 | + if ($output->data) |
|
| 1502 | 1502 | { |
| 1503 | 1503 | $item = array_pop($output->data); |
| 1504 | 1504 | $division = $item->list_order; |
@@ -1507,10 +1507,10 @@ discard block |
||
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | 1509 | // The last division |
| 1510 | - $last_division = (int)Context::get('last_division'); |
|
| 1510 | + $last_division = (int) Context::get('last_division'); |
|
| 1511 | 1511 | |
| 1512 | 1512 | // Division after division from the 5000 value of the specified Wanted |
| 1513 | - if(!$last_division) |
|
| 1513 | + if (!$last_division) |
|
| 1514 | 1514 | { |
| 1515 | 1515 | $last_division_args = new stdClass(); |
| 1516 | 1516 | $last_division_args->module_srl = $args->module_srl; |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | $last_division_args->page = 5001; |
| 1523 | 1523 | |
| 1524 | 1524 | $output = executeQuery($divisionSqlID, $last_division_args, array('list_order')); |
| 1525 | - if($output->data) |
|
| 1525 | + if ($output->data) |
|
| 1526 | 1526 | { |
| 1527 | 1527 | $item = array_pop($output->data); |
| 1528 | 1528 | $last_division = $item->list_order; |
@@ -1530,14 +1530,14 @@ discard block |
||
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | // Make sure that after last_division article |
| 1533 | - if($last_division) |
|
| 1533 | + if ($last_division) |
|
| 1534 | 1534 | { |
| 1535 | 1535 | $last_division_args = new stdClass(); |
| 1536 | 1536 | $last_division_args->module_srl = $args->module_srl; |
| 1537 | 1537 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1538 | 1538 | $last_division_args->list_order = $last_division; |
| 1539 | 1539 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1540 | - if($output->data->count<1) $last_division = null; |
|
| 1540 | + if ($output->data->count < 1) $last_division = null; |
|
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 | $args->division = $division; |
@@ -1570,7 +1570,7 @@ discard block |
||
| 1570 | 1570 | * @param int $count |
| 1571 | 1571 | * @return object |
| 1572 | 1572 | */ |
| 1573 | - function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 ) |
|
| 1573 | + function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0) |
|
| 1574 | 1574 | { |
| 1575 | 1575 | $args = new stdClass(); |
| 1576 | 1576 | $args->member_srl = $member_srl; |
@@ -1578,8 +1578,8 @@ discard block |
||
| 1578 | 1578 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1579 | 1579 | $document_list = $output->data; |
| 1580 | 1580 | |
| 1581 | - if(!$document_list) return array(); |
|
| 1582 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1581 | + if (!$document_list) return array(); |
|
| 1582 | + if (!is_array($document_list)) $document_list = array($document_list); |
|
| 1583 | 1583 | |
| 1584 | 1584 | return $document_list; |
| 1585 | 1585 | } |
@@ -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,34 +706,29 @@ 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 | - elseif($sort_check->sort_index === 'regdate') |
|
| 720 | + } elseif($sort_check->sort_index === 'regdate') |
|
| 664 | 721 | { |
| 665 | 722 | |
| 666 | 723 | if($args->order_type === 'asc') |
| 667 | 724 | { |
| 668 | 725 | $args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 669 | - } |
|
| 670 | - else |
|
| 726 | + } else |
|
| 671 | 727 | { |
| 672 | 728 | $args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index); |
| 673 | 729 | } |
| 674 | 730 | |
| 675 | - } |
|
| 676 | - else |
|
| 731 | + } else |
|
| 677 | 732 | { |
| 678 | 733 | return 1; |
| 679 | 734 | } |
@@ -699,15 +754,16 @@ discard block |
||
| 699 | 754 | $output = executeQuery('document.getCategory', $args, $columnList); |
| 700 | 755 | |
| 701 | 756 | $node = $output->data; |
| 702 | - if(!$node) return; |
|
| 757 | + if(!$node) { |
|
| 758 | + return; |
|
| 759 | + } |
|
| 703 | 760 | |
| 704 | 761 | if($node->group_srls) |
| 705 | 762 | { |
| 706 | 763 | $group_srls = explode(',',$node->group_srls); |
| 707 | 764 | unset($node->group_srls); |
| 708 | 765 | $node->group_srls = $group_srls; |
| 709 | - } |
|
| 710 | - else |
|
| 766 | + } else |
|
| 711 | 767 | { |
| 712 | 768 | unset($node->group_srls); |
| 713 | 769 | $node->group_srls = array(); |
@@ -725,7 +781,9 @@ discard block |
||
| 725 | 781 | $args = new stdClass(); |
| 726 | 782 | $args->category_srl = $category_srl; |
| 727 | 783 | $output = executeQuery('document.getChildCategoryCount',$args); |
| 728 | - if($output->data->count > 0) return true; |
|
| 784 | + if($output->data->count > 0) { |
|
| 785 | + return true; |
|
| 786 | + } |
|
| 729 | 787 | return false; |
| 730 | 788 | } |
| 731 | 789 | |
@@ -744,7 +802,9 @@ discard block |
||
| 744 | 802 | if(!file_exists($filename)) |
| 745 | 803 | { |
| 746 | 804 | $oDocumentController = getController('document'); |
| 747 | - if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); |
|
| 805 | + if(!$oDocumentController->makeCategoryFile($module_srl)) { |
|
| 806 | + return array(); |
|
| 807 | + } |
|
| 748 | 808 | } |
| 749 | 809 | |
| 750 | 810 | include($filename); |
@@ -764,7 +824,9 @@ discard block |
||
| 764 | 824 | */ |
| 765 | 825 | function _arrangeCategory(&$document_category, $list, $depth) |
| 766 | 826 | { |
| 767 | - if(!count($list)) return; |
|
| 827 | + if(!count($list)) { |
|
| 828 | + return; |
|
| 829 | + } |
|
| 768 | 830 | $idx = 0; |
| 769 | 831 | $list_order = array(); |
| 770 | 832 | foreach($list as $key => $val) |
@@ -784,8 +846,11 @@ discard block |
||
| 784 | 846 | $obj->childs = array(); |
| 785 | 847 | $obj->grant = $val['grant']; |
| 786 | 848 | |
| 787 | - if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true; |
|
| 788 | - else $selected = false; |
|
| 849 | + if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) { |
|
| 850 | + $selected = true; |
|
| 851 | + } else { |
|
| 852 | + $selected = false; |
|
| 853 | + } |
|
| 789 | 854 | |
| 790 | 855 | $obj->selected = $selected; |
| 791 | 856 | |
@@ -796,14 +861,18 @@ discard block |
||
| 796 | 861 | $parent_srl = $obj->parent_srl; |
| 797 | 862 | $document_count = $obj->document_count; |
| 798 | 863 | $expand = $obj->expand; |
| 799 | - if($selected) $expand = true; |
|
| 864 | + if($selected) { |
|
| 865 | + $expand = true; |
|
| 866 | + } |
|
| 800 | 867 | |
| 801 | 868 | while($parent_srl) |
| 802 | 869 | { |
| 803 | 870 | $document_category[$parent_srl]->document_count += $document_count; |
| 804 | 871 | $document_category[$parent_srl]->childs[] = $obj->category_srl; |
| 805 | 872 | $document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs); |
| 806 | - if($expand) $document_category[$parent_srl]->expand = $expand; |
|
| 873 | + if($expand) { |
|
| 874 | + $document_category[$parent_srl]->expand = $expand; |
|
| 875 | + } |
|
| 807 | 876 | |
| 808 | 877 | $parent_srl = $document_category[$parent_srl]->parent_srl; |
| 809 | 878 | } |
@@ -811,7 +880,9 @@ discard block |
||
| 811 | 880 | |
| 812 | 881 | $document_category[$key] = $obj; |
| 813 | 882 | |
| 814 | - if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 883 | + if(count($val['list'])) { |
|
| 884 | + $this->_arrangeCategory($document_category, $val['list'], $depth+1); |
|
| 885 | + } |
|
| 815 | 886 | } |
| 816 | 887 | $document_category[$list_order[0]]->first = true; |
| 817 | 888 | $document_category[$list_order[count($list_order)-1]]->last = true; |
@@ -879,13 +950,20 @@ discard block |
||
| 879 | 950 | } |
| 880 | 951 | // Module_srl passed the array may be a check whether the array |
| 881 | 952 | $args = new stdClass; |
| 882 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 883 | - else $args->module_srl = $obj->module_srl; |
|
| 953 | + if(is_array($obj->module_srl)) { |
|
| 954 | + $args->module_srl = implode(',', $obj->module_srl); |
|
| 955 | + } else { |
|
| 956 | + $args->module_srl = $obj->module_srl; |
|
| 957 | + } |
|
| 884 | 958 | |
| 885 | 959 | $output = executeQuery('document.getMonthlyArchivedList', $args); |
| 886 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 960 | + if(!$output->toBool()||!$output->data) { |
|
| 961 | + return $output; |
|
| 962 | + } |
|
| 887 | 963 | |
| 888 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 964 | + if(!is_array($output->data)) { |
|
| 965 | + $output->data = array($output->data); |
|
| 966 | + } |
|
| 889 | 967 | |
| 890 | 968 | return $output; |
| 891 | 969 | } |
@@ -905,14 +983,21 @@ discard block |
||
| 905 | 983 | } |
| 906 | 984 | // Module_srl passed the array may be a check whether the array |
| 907 | 985 | $args = new stdClass; |
| 908 | - if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); |
|
| 909 | - else $args->module_srl = $obj->module_srl; |
|
| 986 | + if(is_array($obj->module_srl)) { |
|
| 987 | + $args->module_srl = implode(',', $obj->module_srl); |
|
| 988 | + } else { |
|
| 989 | + $args->module_srl = $obj->module_srl; |
|
| 990 | + } |
|
| 910 | 991 | $args->regdate = $obj->regdate; |
| 911 | 992 | |
| 912 | 993 | $output = executeQuery('document.getDailyArchivedList', $args); |
| 913 | - if(!$output->toBool()) return $output; |
|
| 994 | + if(!$output->toBool()) { |
|
| 995 | + return $output; |
|
| 996 | + } |
|
| 914 | 997 | |
| 915 | - if(!is_array($output->data)) $output->data = array($output->data); |
|
| 998 | + if(!is_array($output->data)) { |
|
| 999 | + $output->data = array($output->data); |
|
| 1000 | + } |
|
| 916 | 1001 | |
| 917 | 1002 | return $output; |
| 918 | 1003 | } |
@@ -923,7 +1008,9 @@ discard block |
||
| 923 | 1008 | */ |
| 924 | 1009 | function getDocumentCategories() |
| 925 | 1010 | { |
| 926 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 1011 | + if(!Context::get('is_logged')) { |
|
| 1012 | + return new Object(-1,'msg_not_permitted'); |
|
| 1013 | + } |
|
| 927 | 1014 | $module_srl = Context::get('module_srl'); |
| 928 | 1015 | $categories= $this->getCategoryList($module_srl); |
| 929 | 1016 | $lang = Context::get('lang'); |
@@ -950,8 +1037,12 @@ discard block |
||
| 950 | 1037 | $oModuleModel = getModel('module'); |
| 951 | 1038 | $config = $oModuleModel->getModuleConfig('document'); |
| 952 | 1039 | |
| 953 | - if(!$config) $config = new stdClass(); |
|
| 954 | - if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'; |
|
| 1040 | + if(!$config) { |
|
| 1041 | + $config = new stdClass(); |
|
| 1042 | + } |
|
| 1043 | + if(!$config->thumbnail_type) { |
|
| 1044 | + $config->thumbnail_type = 'crop'; |
|
| 1045 | + } |
|
| 955 | 1046 | $GLOBALS['__document_config__'] = $config; |
| 956 | 1047 | } |
| 957 | 1048 | return $GLOBALS['__document_config__']; |
@@ -1016,7 +1107,9 @@ discard block |
||
| 1016 | 1107 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
| 1017 | 1108 | // Check permissions |
| 1018 | 1109 | $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); |
| 1019 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
| 1110 | + if(!$grant->manager) { |
|
| 1111 | + return new Object(-1,'msg_not_permitted'); |
|
| 1112 | + } |
|
| 1020 | 1113 | |
| 1021 | 1114 | $category_srl = Context::get('category_srl'); |
| 1022 | 1115 | $category_info = $this->getCategory($category_srl); |
@@ -1036,15 +1129,20 @@ discard block |
||
| 1036 | 1129 | */ |
| 1037 | 1130 | function getDocumentSrlByAlias($mid, $alias) |
| 1038 | 1131 | { |
| 1039 | - if(!$mid || !$alias) return null; |
|
| 1132 | + if(!$mid || !$alias) { |
|
| 1133 | + return null; |
|
| 1134 | + } |
|
| 1040 | 1135 | $site_module_info = Context::get('site_module_info'); |
| 1041 | 1136 | $args = new stdClass; |
| 1042 | 1137 | $args->mid = $mid; |
| 1043 | 1138 | $args->alias_title = $alias; |
| 1044 | 1139 | $args->site_srl = $site_module_info->site_srl; |
| 1045 | 1140 | $output = executeQuery('document.getDocumentSrlByAlias', $args); |
| 1046 | - if(!$output->data) return null; |
|
| 1047 | - else return $output->data->document_srl; |
|
| 1141 | + if(!$output->data) { |
|
| 1142 | + return null; |
|
| 1143 | + } else { |
|
| 1144 | + return $output->data->document_srl; |
|
| 1145 | + } |
|
| 1048 | 1146 | } |
| 1049 | 1147 | |
| 1050 | 1148 | /** |
@@ -1055,15 +1153,20 @@ discard block |
||
| 1055 | 1153 | */ |
| 1056 | 1154 | function getDocumentSrlByTitle($module_srl, $title) |
| 1057 | 1155 | { |
| 1058 | - if(!$module_srl || !$title) return null; |
|
| 1156 | + if(!$module_srl || !$title) { |
|
| 1157 | + return null; |
|
| 1158 | + } |
|
| 1059 | 1159 | $args = new stdClass; |
| 1060 | 1160 | $args->module_srl = $module_srl; |
| 1061 | 1161 | $args->title = $title; |
| 1062 | 1162 | $output = executeQuery('document.getDocumentSrlByTitle', $args); |
| 1063 | - if(!$output->data) return null; |
|
| 1064 | - else |
|
| 1163 | + if(!$output->data) { |
|
| 1164 | + return null; |
|
| 1165 | + } else |
|
| 1065 | 1166 | { |
| 1066 | - if(is_array($output->data)) return $output->data[0]->document_srl; |
|
| 1167 | + if(is_array($output->data)) { |
|
| 1168 | + return $output->data[0]->document_srl; |
|
| 1169 | + } |
|
| 1067 | 1170 | return $output->data->document_srl; |
| 1068 | 1171 | } |
| 1069 | 1172 | } |
@@ -1075,13 +1178,18 @@ discard block |
||
| 1075 | 1178 | */ |
| 1076 | 1179 | function getAlias($document_srl) |
| 1077 | 1180 | { |
| 1078 | - if(!$document_srl) return null; |
|
| 1181 | + if(!$document_srl) { |
|
| 1182 | + return null; |
|
| 1183 | + } |
|
| 1079 | 1184 | $args = new stdClass; |
| 1080 | 1185 | $args->document_srl = $document_srl; |
| 1081 | 1186 | $output = executeQueryArray('document.getAliases', $args); |
| 1082 | 1187 | |
| 1083 | - if(!$output->data) return null; |
|
| 1084 | - else return $output->data[0]->alias_title; |
|
| 1188 | + if(!$output->data) { |
|
| 1189 | + return null; |
|
| 1190 | + } else { |
|
| 1191 | + return $output->data[0]->alias_title; |
|
| 1192 | + } |
|
| 1085 | 1193 | } |
| 1086 | 1194 | |
| 1087 | 1195 | /** |
@@ -1138,17 +1246,23 @@ discard block |
||
| 1138 | 1246 | { |
| 1139 | 1247 | case 'title' : |
| 1140 | 1248 | case 'content' : |
| 1141 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1249 | + if($search_keyword) { |
|
| 1250 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1251 | + } |
|
| 1142 | 1252 | $args->{"s_".$search_target} = $search_keyword; |
| 1143 | 1253 | $use_division = true; |
| 1144 | 1254 | break; |
| 1145 | 1255 | case 'title_content' : |
| 1146 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1256 | + if($search_keyword) { |
|
| 1257 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1258 | + } |
|
| 1147 | 1259 | $args->s_title = $search_keyword; |
| 1148 | 1260 | $args->s_content = $search_keyword; |
| 1149 | 1261 | break; |
| 1150 | 1262 | case 'user_id' : |
| 1151 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1263 | + if($search_keyword) { |
|
| 1264 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1265 | + } |
|
| 1152 | 1266 | $args->s_user_id = $search_keyword; |
| 1153 | 1267 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1154 | 1268 | break; |
@@ -1156,13 +1270,18 @@ discard block |
||
| 1156 | 1270 | case 'nick_name' : |
| 1157 | 1271 | case 'email_address' : |
| 1158 | 1272 | case 'homepage' : |
| 1159 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1273 | + if($search_keyword) { |
|
| 1274 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1275 | + } |
|
| 1160 | 1276 | $args->{"s_".$search_target} = $search_keyword; |
| 1161 | 1277 | break; |
| 1162 | 1278 | case 'is_notice' : |
| 1163 | 1279 | case 'is_secret' : |
| 1164 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1165 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1280 | + if($search_keyword=='N') { |
|
| 1281 | + $args->statusList = array($this->getConfigStatus('public')); |
|
| 1282 | + } elseif($search_keyword=='Y') { |
|
| 1283 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1284 | + } |
|
| 1166 | 1285 | break; |
| 1167 | 1286 | case 'member_srl' : |
| 1168 | 1287 | case 'readed_count' : |
@@ -1204,34 +1323,45 @@ discard block |
||
| 1204 | 1323 | { |
| 1205 | 1324 | $args = new stdClass; |
| 1206 | 1325 | $document_srl = Context::get('document_srl'); |
| 1207 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 1326 | + if(!$document_srl) { |
|
| 1327 | + return new Object(-1,'msg_invalid_request'); |
|
| 1328 | + } |
|
| 1208 | 1329 | |
| 1209 | 1330 | $point = Context::get('point'); |
| 1210 | - if($point != -1) $point = 1; |
|
| 1331 | + if($point != -1) { |
|
| 1332 | + $point = 1; |
|
| 1333 | + } |
|
| 1211 | 1334 | |
| 1212 | 1335 | $oDocumentModel = getModel('document'); |
| 1213 | 1336 | $columnList = array('document_srl', 'module_srl'); |
| 1214 | 1337 | $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); |
| 1215 | 1338 | $module_srl = $oDocument->get('module_srl'); |
| 1216 | - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1339 | + if(!$module_srl) { |
|
| 1340 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1341 | + } |
|
| 1217 | 1342 | |
| 1218 | 1343 | $oModuleModel = getModel('module'); |
| 1219 | 1344 | $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); |
| 1220 | 1345 | if($point == -1) |
| 1221 | 1346 | { |
| 1222 | - if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1347 | + if($document_config->use_vote_down!='S') { |
|
| 1348 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1349 | + } |
|
| 1223 | 1350 | $args->below_point = 0; |
| 1224 | - } |
|
| 1225 | - else |
|
| 1351 | + } else |
|
| 1226 | 1352 | { |
| 1227 | - if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request'); |
|
| 1353 | + if($document_config->use_vote_up!='S') { |
|
| 1354 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1355 | + } |
|
| 1228 | 1356 | $args->more_point = 0; |
| 1229 | 1357 | } |
| 1230 | 1358 | |
| 1231 | 1359 | $args->document_srl = $document_srl; |
| 1232 | 1360 | |
| 1233 | 1361 | $output = executeQueryArray('document.getVotedMemberList',$args); |
| 1234 | - if(!$output->toBool()) return $output; |
|
| 1362 | + if(!$output->toBool()) { |
|
| 1363 | + return $output; |
|
| 1364 | + } |
|
| 1235 | 1365 | |
| 1236 | 1366 | $oMemberModel = getModel('member'); |
| 1237 | 1367 | if($output->data) |
@@ -1253,9 +1383,11 @@ discard block |
||
| 1253 | 1383 | function getStatusNameList() |
| 1254 | 1384 | { |
| 1255 | 1385 | global $lang; |
| 1256 | - if(!isset($lang->status_name_list)) |
|
| 1257 | - return array_flip($this->getStatusList()); |
|
| 1258 | - else return $lang->status_name_list; |
|
| 1386 | + if(!isset($lang->status_name_list)) { |
|
| 1387 | + return array_flip($this->getStatusList()); |
|
| 1388 | + } else { |
|
| 1389 | + return $lang->status_name_list; |
|
| 1390 | + } |
|
| 1259 | 1391 | } |
| 1260 | 1392 | |
| 1261 | 1393 | /** |
@@ -1279,20 +1411,22 @@ discard block |
||
| 1279 | 1411 | if (!$extra_output->data || !$extra_output->toBool()) |
| 1280 | 1412 | { |
| 1281 | 1413 | $sortIndex = 'list_order'; |
| 1282 | - } |
|
| 1283 | - else |
|
| 1414 | + } else |
|
| 1284 | 1415 | { |
| 1285 | 1416 | $check_array = array(); |
| 1286 | 1417 | foreach($extra_output->data as $val) |
| 1287 | 1418 | { |
| 1288 | 1419 | $check_array[] = $val->eid; |
| 1289 | 1420 | } |
| 1290 | - if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order'; |
|
| 1291 | - else $isExtraVars = true; |
|
| 1421 | + if(!in_array($sortIndex, $check_array)) { |
|
| 1422 | + $sortIndex = 'list_order'; |
|
| 1423 | + } else { |
|
| 1424 | + $isExtraVars = true; |
|
| 1425 | + } |
|
| 1292 | 1426 | } |
| 1427 | + } else { |
|
| 1428 | + $sortIndex = 'list_order'; |
|
| 1293 | 1429 | } |
| 1294 | - else |
|
| 1295 | - $sortIndex = 'list_order'; |
|
| 1296 | 1430 | } |
| 1297 | 1431 | $returnObj = new stdClass(); |
| 1298 | 1432 | $returnObj->sort_index = $sortIndex; |
@@ -1330,7 +1464,9 @@ discard block |
||
| 1330 | 1464 | |
| 1331 | 1465 | // Check the target and sequence alignment |
| 1332 | 1466 | $orderType = array('desc' => 1, 'asc' => 1); |
| 1333 | - if(!isset($orderType[$args->order_type])) $args->order_type = 'asc'; |
|
| 1467 | + if(!isset($orderType[$args->order_type])) { |
|
| 1468 | + $args->order_type = 'asc'; |
|
| 1469 | + } |
|
| 1334 | 1470 | |
| 1335 | 1471 | // If that came across mid module_srl instead of a direct module_srl guhaejum |
| 1336 | 1472 | if($searchOpt->mid) |
@@ -1341,21 +1477,29 @@ discard block |
||
| 1341 | 1477 | } |
| 1342 | 1478 | |
| 1343 | 1479 | // Module_srl passed the array may be a check whether the array |
| 1344 | - if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1345 | - else $args->module_srl = $searchOpt->module_srl; |
|
| 1480 | + if(is_array($searchOpt->module_srl)) { |
|
| 1481 | + $args->module_srl = implode(',', $searchOpt->module_srl); |
|
| 1482 | + } else { |
|
| 1483 | + $args->module_srl = $searchOpt->module_srl; |
|
| 1484 | + } |
|
| 1346 | 1485 | |
| 1347 | 1486 | // Except for the test module_srl |
| 1348 | - if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1349 | - else $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
| 1487 | + if(is_array($searchOpt->exclude_module_srl)) { |
|
| 1488 | + $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl); |
|
| 1489 | + } else { |
|
| 1490 | + $args->exclude_module_srl = $searchOpt->exclude_module_srl; |
|
| 1491 | + } |
|
| 1350 | 1492 | |
| 1351 | 1493 | // only admin document list, temp document showing |
| 1352 | - if($searchOpt->statusList) $args->statusList = $searchOpt->statusList; |
|
| 1353 | - else |
|
| 1494 | + if($searchOpt->statusList) { |
|
| 1495 | + $args->statusList = $searchOpt->statusList; |
|
| 1496 | + } else |
|
| 1354 | 1497 | { |
| 1355 | - if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) |
|
| 1356 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
| 1357 | - else |
|
| 1358 | - $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
| 1498 | + if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) { |
|
| 1499 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp')); |
|
| 1500 | + } else { |
|
| 1501 | + $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public')); |
|
| 1502 | + } |
|
| 1359 | 1503 | } |
| 1360 | 1504 | |
| 1361 | 1505 | // Category is selected, further sub-categories until all conditions |
@@ -1383,18 +1527,24 @@ discard block |
||
| 1383 | 1527 | { |
| 1384 | 1528 | case 'title' : |
| 1385 | 1529 | case 'content' : |
| 1386 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1530 | + if($search_keyword) { |
|
| 1531 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1532 | + } |
|
| 1387 | 1533 | $args->{"s_".$search_target} = $search_keyword; |
| 1388 | 1534 | $use_division = true; |
| 1389 | 1535 | break; |
| 1390 | 1536 | case 'title_content' : |
| 1391 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1537 | + if($search_keyword) { |
|
| 1538 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1539 | + } |
|
| 1392 | 1540 | $args->s_title = $search_keyword; |
| 1393 | 1541 | $args->s_content = $search_keyword; |
| 1394 | 1542 | $use_division = true; |
| 1395 | 1543 | break; |
| 1396 | 1544 | case 'user_id' : |
| 1397 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1545 | + if($search_keyword) { |
|
| 1546 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1547 | + } |
|
| 1398 | 1548 | $args->s_user_id = $search_keyword; |
| 1399 | 1549 | $args->sort_index = 'documents.'.$args->sort_index; |
| 1400 | 1550 | break; |
@@ -1402,18 +1552,28 @@ discard block |
||
| 1402 | 1552 | case 'nick_name' : |
| 1403 | 1553 | case 'email_address' : |
| 1404 | 1554 | case 'homepage' : |
| 1405 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1555 | + if($search_keyword) { |
|
| 1556 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 1557 | + } |
|
| 1406 | 1558 | $args->{"s_".$search_target} = $search_keyword; |
| 1407 | 1559 | break; |
| 1408 | 1560 | case 'is_notice' : |
| 1409 | - if($search_keyword=='N') $args->{"s_".$search_target} = 'N'; |
|
| 1410 | - elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y'; |
|
| 1411 | - else $args->{"s_".$search_target} = ''; |
|
| 1561 | + if($search_keyword=='N') { |
|
| 1562 | + $args->{"s_".$search_target} = 'N'; |
|
| 1563 | + } elseif($search_keyword=='Y') { |
|
| 1564 | + $args->{"s_".$search_target} = 'Y'; |
|
| 1565 | + } else { |
|
| 1566 | + $args->{"s_".$search_target} = ''; |
|
| 1567 | + } |
|
| 1412 | 1568 | break; |
| 1413 | 1569 | case 'is_secret' : |
| 1414 | - if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public')); |
|
| 1415 | - elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1416 | - elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1570 | + if($search_keyword=='N') { |
|
| 1571 | + $args->statusList = array($this->getConfigStatus('public')); |
|
| 1572 | + } elseif($search_keyword=='Y') { |
|
| 1573 | + $args->statusList = array($this->getConfigStatus('secret')); |
|
| 1574 | + } elseif($search_keyword=='temp') { |
|
| 1575 | + $args->statusList = array($this->getConfigStatus('temp')); |
|
| 1576 | + } |
|
| 1417 | 1577 | break; |
| 1418 | 1578 | case 'member_srl' : |
| 1419 | 1579 | case 'readed_count' : |
@@ -1458,13 +1618,14 @@ discard block |
||
| 1458 | 1618 | if ($searchOpt->isExtraVars) |
| 1459 | 1619 | { |
| 1460 | 1620 | $query_id = 'document.getDocumentListExtraSort'; |
| 1461 | - } |
|
| 1462 | - else |
|
| 1621 | + } else |
|
| 1463 | 1622 | { |
| 1464 | 1623 | /** |
| 1465 | 1624 | * list_order asc sort of division that can be used only when |
| 1466 | 1625 | */ |
| 1467 | - if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; |
|
| 1626 | + if($args->sort_index != 'list_order' || $args->order_type != 'asc') { |
|
| 1627 | + $use_division = false; |
|
| 1628 | + } |
|
| 1468 | 1629 | |
| 1469 | 1630 | /** |
| 1470 | 1631 | * If it is true, use_division changed to use the document division |
@@ -1479,8 +1640,7 @@ discard block |
||
| 1479 | 1640 | { |
| 1480 | 1641 | $listSqlID = 'document.getDocumentListUseIndex'; |
| 1481 | 1642 | $divisionSqlID = 'document.getDocumentDivisionUseIndex'; |
| 1482 | - } |
|
| 1483 | - else |
|
| 1643 | + } else |
|
| 1484 | 1644 | { |
| 1485 | 1645 | $listSqlID = 'document.getDocumentList'; |
| 1486 | 1646 | $divisionSqlID = 'document.getDocumentDivision'; |
@@ -1537,7 +1697,9 @@ discard block |
||
| 1537 | 1697 | $last_division_args->exclude_module_srl = $args->exclude_module_srl; |
| 1538 | 1698 | $last_division_args->list_order = $last_division; |
| 1539 | 1699 | $output = executeQuery('document.getDocumentDivisionCount', $last_division_args); |
| 1540 | - if($output->data->count<1) $last_division = null; |
|
| 1700 | + if($output->data->count<1) { |
|
| 1701 | + $last_division = null; |
|
| 1702 | + } |
|
| 1541 | 1703 | } |
| 1542 | 1704 | |
| 1543 | 1705 | $args->division = $division; |
@@ -1578,8 +1740,12 @@ discard block |
||
| 1578 | 1740 | $output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList); |
| 1579 | 1741 | $document_list = $output->data; |
| 1580 | 1742 | |
| 1581 | - if(!$document_list) return array(); |
|
| 1582 | - if(!is_array($document_list)) $document_list = array($document_list); |
|
| 1743 | + if(!$document_list) { |
|
| 1744 | + return array(); |
|
| 1745 | + } |
|
| 1746 | + if(!is_array($document_list)) { |
|
| 1747 | + $document_list = array($document_list); |
|
| 1748 | + } |
|
| 1583 | 1749 | |
| 1584 | 1750 | return $document_list; |
| 1585 | 1751 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param string $module_name |
| 32 | 32 | * @return int |
| 33 | 33 | */ |
| 34 | - function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name=null) |
|
| 34 | + function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name = null) |
|
| 35 | 35 | { |
| 36 | 36 | // Pre-create the objects needed |
| 37 | 37 | $this->oXmlParser = new XmlParser(); |
@@ -40,33 +40,33 @@ discard block |
||
| 40 | 40 | $oDocumentModel = getModel('document'); |
| 41 | 41 | $category_list = $category_titles = array(); |
| 42 | 42 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 43 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 43 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 44 | 44 | // First handle categorty information |
| 45 | 45 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
| 46 | - if(file_exists($category_file)) |
|
| 46 | + if (file_exists($category_file)) |
|
| 47 | 47 | { |
| 48 | 48 | // Create the xmlParser object |
| 49 | 49 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); |
| 50 | 50 | // List category information |
| 51 | - if($xmlDoc->categories->category) |
|
| 51 | + if ($xmlDoc->categories->category) |
|
| 52 | 52 | { |
| 53 | 53 | $categories = array(); |
| 54 | 54 | $idx = 0; |
| 55 | 55 | $this->arrangeCategory($xmlDoc->categories, $categories, $idx, 0); |
| 56 | 56 | |
| 57 | 57 | $match_sequence = array(); |
| 58 | - foreach($categories as $k => $v) |
|
| 58 | + foreach ($categories as $k => $v) |
|
| 59 | 59 | { |
| 60 | 60 | $category = $v->name; |
| 61 | - if(!$category || $category_titles[$category]) continue; |
|
| 61 | + if (!$category || $category_titles[$category]) continue; |
|
| 62 | 62 | |
| 63 | 63 | $obj = null; |
| 64 | 64 | $obj->title = $category; |
| 65 | 65 | $obj->module_srl = $module_srl; |
| 66 | - if($v->parent) $obj->parent_srl = $match_sequence[$v->parent]; |
|
| 66 | + if ($v->parent) $obj->parent_srl = $match_sequence[$v->parent]; |
|
| 67 | 67 | $output = $oDocumentController->insertCategory($obj); |
| 68 | 68 | |
| 69 | - if($output->toBool()) $match_sequence[$v->sequence] = $category_titles[$category] = $output->get('category_srl'); |
|
| 69 | + if ($output->toBool()) $match_sequence[$v->sequence] = $category_titles[$category] = $output->get('category_srl'); |
|
| 70 | 70 | } |
| 71 | 71 | $oDocumentController->makeCategoryFile($module_srl); |
| 72 | 72 | } |
@@ -74,28 +74,28 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | $category_list = $category_titles = array(); |
| 76 | 76 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 77 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 77 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 78 | 78 | // Get administrator information |
| 79 | 79 | $oMemberModel = getModel('member'); |
| 80 | 80 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id); |
| 81 | 81 | $author_xml_id = 0; |
| 82 | 82 | |
| 83 | - if(!$cur) $cur = 0; |
|
| 83 | + if (!$cur) $cur = 0; |
|
| 84 | 84 | // Open an index file |
| 85 | - $f = fopen($index_file,"r"); |
|
| 85 | + $f = fopen($index_file, "r"); |
|
| 86 | 86 | // Pass if already read |
| 87 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 87 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
| 88 | 88 | // Read each line until the codition meets |
| 89 | - for($idx=$cur;$idx<$cur+$unit_count;$idx++) |
|
| 89 | + for ($idx = $cur; $idx < $cur + $unit_count; $idx++) |
|
| 90 | 90 | { |
| 91 | - if(feof($f)) break; |
|
| 91 | + if (feof($f)) break; |
|
| 92 | 92 | // Find a location |
| 93 | 93 | $target_file = trim(fgets($f, 1024)); |
| 94 | 94 | |
| 95 | - if(!file_exists($target_file)) continue; |
|
| 95 | + if (!file_exists($target_file)) continue; |
|
| 96 | 96 | // Start importing data |
| 97 | - $fp = fopen($target_file,"r"); |
|
| 98 | - if(!$fp) continue; |
|
| 97 | + $fp = fopen($target_file, "r"); |
|
| 98 | + if (!$fp) continue; |
|
| 99 | 99 | |
| 100 | 100 | $obj = null; |
| 101 | 101 | $obj->module_srl = $module_srl; |
@@ -107,57 +107,57 @@ discard block |
||
| 107 | 107 | $started = false; |
| 108 | 108 | $buff = null; |
| 109 | 109 | // Start importing from the body data |
| 110 | - while(!feof($fp)) |
|
| 110 | + while (!feof($fp)) |
|
| 111 | 111 | { |
| 112 | 112 | $str = fgets($fp, 1024); |
| 113 | 113 | // Prepare an item |
| 114 | - if(substr($str,0,5) == '<post') |
|
| 114 | + if (substr($str, 0, 5) == '<post') |
|
| 115 | 115 | { |
| 116 | 116 | $started = true; |
| 117 | 117 | continue; |
| 118 | 118 | // Import the attachment |
| 119 | 119 | } |
| 120 | - else if(substr($str,0,12) == '<attachment ') |
|
| 120 | + else if (substr($str, 0, 12) == '<attachment ') |
|
| 121 | 121 | { |
| 122 | - if($this->importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) $obj->uploaded_count++; |
|
| 122 | + if ($this->importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) $obj->uploaded_count++; |
|
| 123 | 123 | continue; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if($started) $buff .= $str; |
|
| 126 | + if ($started) $buff .= $str; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $xmlDoc = $this->oXmlParser->parse('<post>'.$buff); |
| 130 | 130 | |
| 131 | 131 | $author_xml_id = $xmlDoc->post->author->body; |
| 132 | 132 | |
| 133 | - if($xmlDoc->post->category->body) |
|
| 133 | + if ($xmlDoc->post->category->body) |
|
| 134 | 134 | { |
| 135 | - $tmp_arr = explode('/',$xmlDoc->post->category->body); |
|
| 136 | - $category = trim($tmp_arr[count($tmp_arr)-1]); |
|
| 137 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
| 135 | + $tmp_arr = explode('/', $xmlDoc->post->category->body); |
|
| 136 | + $category = trim($tmp_arr[count($tmp_arr) - 1]); |
|
| 137 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $obj->is_notice = 'N'; |
| 141 | - $obj->status = in_array($xmlDoc->post->visibility->body, array('public','syndicated'))?$oDocumentModel->getConfigStatus('public'):$oDocumentModel->getConfigStatus('secret'); |
|
| 141 | + $obj->status = in_array($xmlDoc->post->visibility->body, array('public', 'syndicated')) ? $oDocumentModel->getConfigStatus('public') : $oDocumentModel->getConfigStatus('secret'); |
|
| 142 | 142 | $obj->title = $xmlDoc->post->title->body; |
| 143 | 143 | $obj->content = $xmlDoc->post->content->body; |
| 144 | 144 | $obj->password = md5($xmlDoc->post->password->body); |
| 145 | - $obj->commentStatus = $xmlDoc->post->acceptcomment->body=='1'?'ALLOW':'DENY'; |
|
| 146 | - $obj->allow_trackback = $xmlDoc->post->accepttrackback->body=='1'?'Y':'N'; |
|
| 145 | + $obj->commentStatus = $xmlDoc->post->acceptcomment->body == '1' ? 'ALLOW' : 'DENY'; |
|
| 146 | + $obj->allow_trackback = $xmlDoc->post->accepttrackback->body == '1' ? 'Y' : 'N'; |
|
| 147 | 147 | //$obj->allow_comment = $xmlDoc->post->acceptComment->body=='1'?'Y':'N'; |
| 148 | 148 | //$obj->allow_trackback = $xmlDoc->post->acceptTrackback->body=='1'?'Y':'N'; |
| 149 | - $obj->regdate = date("YmdHis",$xmlDoc->post->published->body); |
|
| 149 | + $obj->regdate = date("YmdHis", $xmlDoc->post->published->body); |
|
| 150 | 150 | $obj->last_update = date("YmdHis", $xmlDoc->post->modified->body); |
| 151 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 151 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 152 | 152 | |
| 153 | 153 | $tag = null; |
| 154 | 154 | $tmp_tags = null; |
| 155 | 155 | $tag = $xmlDoc->post->tag; |
| 156 | - if($tag) |
|
| 156 | + if ($tag) |
|
| 157 | 157 | { |
| 158 | - if(!is_array($tag)) $tag = array($tag); |
|
| 159 | - foreach($tag as $key => $val) $tmp_tags[] = $val->body; |
|
| 160 | - $obj->tags = implode(',',$tmp_tags); |
|
| 158 | + if (!is_array($tag)) $tag = array($tag); |
|
| 159 | + foreach ($tag as $key => $val) $tmp_tags[] = $val->body; |
|
| 160 | + $obj->tags = implode(',', $tmp_tags); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $obj->readed_count = 0; |
@@ -169,33 +169,33 @@ discard block |
||
| 169 | 169 | $obj->email_address = $member_info->email_address; |
| 170 | 170 | $obj->homepage = $member_info->homepage; |
| 171 | 171 | $obj->ipaddress = $_REMOTE['SERVER_ADDR']; |
| 172 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
|
| 172 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1; |
|
| 173 | 173 | $obj->notify_message = 'N'; |
| 174 | 174 | // Change content information (attachment) |
| 175 | - $obj->content = str_replace('[##_ATTACH_PATH_##]/','',$obj->content); |
|
| 176 | - if(count($files)) |
|
| 175 | + $obj->content = str_replace('[##_ATTACH_PATH_##]/', '', $obj->content); |
|
| 176 | + if (count($files)) |
|
| 177 | 177 | { |
| 178 | - foreach($files as $key => $val) { |
|
| 179 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val->url.'"',$obj->content); |
|
| 178 | + foreach ($files as $key => $val) { |
|
| 179 | + $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val->url.'"', $obj->content); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $obj->content = preg_replace_callback('!\[##_Movie\|([^\|]*)\|(.*?)_##\]!is', array($this, '_replaceTTMovie'), $obj->content); |
| 184 | 184 | |
| 185 | - if(count($files)) |
|
| 185 | + if (count($files)) |
|
| 186 | 186 | { |
| 187 | 187 | $this->files = $files; |
| 188 | 188 | $obj->content = preg_replace_callback('!\[##_([a-z0-9]+)\|([^\|]*)\|([^\|]*)\|(.*?)_##\]!is', array($this, '_replaceTTAttach'), $obj->content); |
| 189 | 189 | } |
| 190 | 190 | // Trackback inserted |
| 191 | 191 | $obj->trackback_count = 0; |
| 192 | - if($xmlDoc->post->trackback) |
|
| 192 | + if ($xmlDoc->post->trackback) |
|
| 193 | 193 | { |
| 194 | 194 | $trackbacks = $xmlDoc->post->trackback; |
| 195 | - if(!is_array($trackbacks)) $trackbacks = array($trackbacks); |
|
| 196 | - if(count($trackbacks)) |
|
| 195 | + if (!is_array($trackbacks)) $trackbacks = array($trackbacks); |
|
| 196 | + if (count($trackbacks)) |
|
| 197 | 197 | { |
| 198 | - foreach($trackbacks as $key => $val) |
|
| 198 | + foreach ($trackbacks as $key => $val) |
|
| 199 | 199 | { |
| 200 | 200 | $tobj = null; |
| 201 | 201 | $tobj->trackback_srl = getNextSequence(); |
@@ -205,40 +205,40 @@ discard block |
||
| 205 | 205 | $tobj->title = $val->title->body; |
| 206 | 206 | $tobj->blog_name = $val->site->body; |
| 207 | 207 | $tobj->excerpt = $val->excerpt->body; |
| 208 | - $tobj->regdate = date("YmdHis",$val->received->body); |
|
| 208 | + $tobj->regdate = date("YmdHis", $val->received->body); |
|
| 209 | 209 | $tobj->ipaddress = $val->ip->body; |
| 210 | - $tobj->list_order = -1*$tobj->trackback_srl; |
|
| 210 | + $tobj->list_order = -1 * $tobj->trackback_srl; |
|
| 211 | 211 | $output = executeQuery('trackback.insertTrackback', $tobj); |
| 212 | - if($output->toBool()) $obj->trackback_count++; |
|
| 212 | + if ($output->toBool()) $obj->trackback_count++; |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | // Comment |
| 217 | 217 | $obj->comment_count = 0; |
| 218 | - if($xmlDoc->post->comment) |
|
| 218 | + if ($xmlDoc->post->comment) |
|
| 219 | 219 | { |
| 220 | 220 | $comment = $xmlDoc->post->comment; |
| 221 | - if(!is_array($comment)) $comment = array($comment); |
|
| 222 | - foreach($comment as $key => $val) |
|
| 221 | + if (!is_array($comment)) $comment = array($comment); |
|
| 222 | + foreach ($comment as $key => $val) |
|
| 223 | 223 | { |
| 224 | 224 | $parent_srl = $this->insertComment($val, $module_srl, $obj->document_srl, $member_info, 0, $author_xml_id); |
| 225 | - if($parent_srl === false) continue; |
|
| 225 | + if ($parent_srl === false) continue; |
|
| 226 | 226 | |
| 227 | 227 | $obj->comment_count++; |
| 228 | - if($val->comment) |
|
| 228 | + if ($val->comment) |
|
| 229 | 229 | { |
| 230 | 230 | $child_comment = $val->comment; |
| 231 | - if(!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 232 | - foreach($child_comment as $k => $v) |
|
| 231 | + if (!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 232 | + foreach ($child_comment as $k => $v) |
|
| 233 | 233 | { |
| 234 | 234 | $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, $parent_srl, $author_xml_id); |
| 235 | - if($result !== false) $obj->comment_count++; |
|
| 235 | + if ($result !== false) $obj->comment_count++; |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if($module_name == 'textyle') |
|
| 241 | + if ($module_name == 'textyle') |
|
| 242 | 242 | { |
| 243 | 243 | $args->document_srl = $obj->document_srl; |
| 244 | 244 | $args->module_srl = $obj->module_srl; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | // Visibility value of published state |
| 248 | 248 | $status_published = array('public', 'syndicated'); |
| 249 | 249 | // Save state if not published |
| 250 | - if(!in_array($xmlDoc->post->visibility->body, $status_published)) |
|
| 250 | + if (!in_array($xmlDoc->post->visibility->body, $status_published)) |
|
| 251 | 251 | { |
| 252 | 252 | $obj->module_srl = $member_info->member_srl; |
| 253 | 253 | } |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | // Document |
| 256 | 256 | $output = executeQuery('document.insertDocument', $obj); |
| 257 | 257 | |
| 258 | - if($output->toBool()) |
|
| 258 | + if ($output->toBool()) |
|
| 259 | 259 | { |
| 260 | 260 | // Tags |
| 261 | - if($obj->tags) |
|
| 261 | + if ($obj->tags) |
|
| 262 | 262 | { |
| 263 | - $tag_list = explode(',',$obj->tags); |
|
| 263 | + $tag_list = explode(',', $obj->tags); |
|
| 264 | 264 | $tag_count = count($tag_list); |
| 265 | - for($i=0;$i<$tag_count;$i++) |
|
| 265 | + for ($i = 0; $i < $tag_count; $i++) |
|
| 266 | 266 | { |
| 267 | 267 | $args = new stdClass; |
| 268 | 268 | $args->tag_srl = getNextSequence(); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $args->document_srl = $obj->document_srl; |
| 271 | 271 | $args->tag = trim($tag_list[$i]); |
| 272 | 272 | $args->regdate = $obj->regdate; |
| 273 | - if(!$args->tag) continue; |
|
| 273 | + if (!$args->tag) continue; |
|
| 274 | 274 | $output = executeQuery('tag.insertTag', $args); |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -282,63 +282,63 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | fclose($f); |
| 284 | 284 | |
| 285 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 285 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 286 | 286 | // Guestbook information |
| 287 | 287 | $guestbook_file = preg_replace('/index$/i', 'guestbook.xml', $index_file); |
| 288 | - if(file_exists($guestbook_file)) |
|
| 288 | + if (file_exists($guestbook_file)) |
|
| 289 | 289 | { |
| 290 | 290 | // Create the xmlParser object |
| 291 | 291 | $xmlDoc = $this->oXmlParser->loadXmlFile($guestbook_file); |
| 292 | 292 | // Handle guest book information |
| 293 | - if($guestbook_module_srl && $xmlDoc->guestbook->comment) |
|
| 293 | + if ($guestbook_module_srl && $xmlDoc->guestbook->comment) |
|
| 294 | 294 | { |
| 295 | 295 | $comment = $xmlDoc->guestbook->comment; |
| 296 | - if(!is_array($comment)) $comment = array($comment); |
|
| 296 | + if (!is_array($comment)) $comment = array($comment); |
|
| 297 | 297 | |
| 298 | - if($module_name =='textyle') |
|
| 298 | + if ($module_name == 'textyle') |
|
| 299 | 299 | { |
| 300 | - foreach($comment as $key => $val) |
|
| 300 | + foreach ($comment as $key => $val) |
|
| 301 | 301 | { |
| 302 | - $textyle_guestbook_srl = getNextSequence(); |
|
| 302 | + $textyle_guestbook_srl = getNextSequence(); |
|
| 303 | 303 | |
| 304 | - if($val->comment) |
|
| 304 | + if ($val->comment) |
|
| 305 | 305 | { |
| 306 | 306 | $child_comment = $val->comment; |
| 307 | - if(!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 308 | - foreach($child_comment as $k => $v) |
|
| 307 | + if (!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 308 | + foreach ($child_comment as $k => $v) |
|
| 309 | 309 | { |
| 310 | - $result = $this->insertTextyleGuestbookItem($v, $module_srl, $member_info,0,$textyle_guestbook_srl,$author_xml_id); |
|
| 310 | + $result = $this->insertTextyleGuestbookItem($v, $module_srl, $member_info, 0, $textyle_guestbook_srl, $author_xml_id); |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - $result = $this->insertTextyleGuestbookItem($val, $module_srl, $member_info,$textyle_guestbook_srl,0,$author_xml_id); |
|
| 314 | + $result = $this->insertTextyleGuestbookItem($val, $module_srl, $member_info, $textyle_guestbook_srl, 0, $author_xml_id); |
|
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | else |
| 318 | 318 | { |
| 319 | - foreach($comment as $key => $val) |
|
| 319 | + foreach ($comment as $key => $val) |
|
| 320 | 320 | { |
| 321 | 321 | $obj = null; |
| 322 | 322 | $obj->module_srl = $guestbook_module_srl; |
| 323 | 323 | $obj->document_srl = getNextSequence(); |
| 324 | 324 | $obj->uploaded_count = 0; |
| 325 | 325 | $obj->is_notice = 'N'; |
| 326 | - $obj->status = $val->secret->body=='1'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); |
|
| 326 | + $obj->status = $val->secret->body == '1' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); |
|
| 327 | 327 | $obj->content = nl2br($val->content->body); |
| 328 | 328 | |
| 329 | 329 | // Extract a title form the bocy |
| 330 | - $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
|
| 330 | + $obj->title = cut_str(strip_tags($obj->content), 20, '...'); |
|
| 331 | 331 | if ($obj->title == '') $obj->title = 'Untitled'; |
| 332 | 332 | |
| 333 | 333 | $obj->commentStatus = 'ALLOW'; |
| 334 | 334 | $obj->allow_trackback = 'N'; |
| 335 | - $obj->regdate = date("YmdHis",$val->written->body); |
|
| 335 | + $obj->regdate = date("YmdHis", $val->written->body); |
|
| 336 | 336 | $obj->last_update = date("YmdHis", $val->written->body); |
| 337 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 337 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 338 | 338 | $obj->tags = ''; |
| 339 | 339 | $obj->readed_count = 0; |
| 340 | 340 | $obj->voted_count = 0; |
| 341 | - if($author_xml_id && $val->commenter->attrs->id == $author_xml_id) |
|
| 341 | + if ($author_xml_id && $val->commenter->attrs->id == $author_xml_id) |
|
| 342 | 342 | { |
| 343 | 343 | $obj->password = ''; |
| 344 | 344 | $obj->nick_name = $member_info->nick_name; |
@@ -356,19 +356,19 @@ discard block |
||
| 356 | 356 | $homepage = $val->commenter->homepage->body; |
| 357 | 357 | } |
| 358 | 358 | $obj->ipaddress = $val->commenter->ip->body; |
| 359 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
|
| 359 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1; |
|
| 360 | 360 | $obj->notify_message = 'N'; |
| 361 | 361 | $obj->trackback_count = 0; |
| 362 | 362 | |
| 363 | 363 | $obj->comment_count = 0; |
| 364 | - if($val->comment) |
|
| 364 | + if ($val->comment) |
|
| 365 | 365 | { |
| 366 | 366 | $child_comment = $val->comment; |
| 367 | - if(!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 368 | - foreach($child_comment as $k => $v) |
|
| 367 | + if (!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 368 | + foreach ($child_comment as $k => $v) |
|
| 369 | 369 | { |
| 370 | - $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, 0,$author_xml_id); |
|
| 371 | - if($result !== false) $obj->comment_count++; |
|
| 370 | + $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, 0, $author_xml_id); |
|
| 371 | + if ($result !== false) $obj->comment_count++; |
|
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | FileHandler::removeFile($guestbook_file); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - return $idx-1; |
|
| 383 | + return $idx - 1; |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -393,10 +393,10 @@ discard block |
||
| 393 | 393 | * @param int $author_xml_id |
| 394 | 394 | * @return int|bool |
| 395 | 395 | */ |
| 396 | - function insertTextyleGuestbookItem($val, $module_srl, $member_info, $textyle_guestbook_srl,$parent_srl = 0, $author_xml_id=null) |
|
| 396 | + function insertTextyleGuestbookItem($val, $module_srl, $member_info, $textyle_guestbook_srl, $parent_srl = 0, $author_xml_id = null) |
|
| 397 | 397 | { |
| 398 | 398 | $tobj = null; |
| 399 | - if($textyle_guestbook_srl>0) |
|
| 399 | + if ($textyle_guestbook_srl > 0) |
|
| 400 | 400 | { |
| 401 | 401 | $tobj->textyle_guestbook_srl = $textyle_guestbook_srl; |
| 402 | 402 | } |
@@ -405,9 +405,9 @@ discard block |
||
| 405 | 405 | $tobj->textyle_guestbook_srl = getNextSequence(); |
| 406 | 406 | } |
| 407 | 407 | $tobj->module_srl = $module_srl; |
| 408 | - $tobj->is_secret = $val->secret->body=='1'?1:-1; |
|
| 408 | + $tobj->is_secret = $val->secret->body == '1' ? 1 : -1; |
|
| 409 | 409 | $tobj->content = nl2br($val->content->body); |
| 410 | - if($author_xml_id && $val->commenter->attrs->id == $author_xml_id) |
|
| 410 | + if ($author_xml_id && $val->commenter->attrs->id == $author_xml_id) |
|
| 411 | 411 | { |
| 412 | 412 | $tobj->password = ''; |
| 413 | 413 | $tobj->nick_name = $member_info->nick_name; |
@@ -424,22 +424,22 @@ discard block |
||
| 424 | 424 | $tobj->homepage = $val->commenter->homepage->body; |
| 425 | 425 | $tobj->member_srl = 0; |
| 426 | 426 | } |
| 427 | - $tobj->last_update = $tobj->regdate = date("YmdHis",$val->written->body); |
|
| 427 | + $tobj->last_update = $tobj->regdate = date("YmdHis", $val->written->body); |
|
| 428 | 428 | $tobj->ipaddress = $val->commenter->ip->body; |
| 429 | 429 | |
| 430 | - if($parent_srl>0) |
|
| 430 | + if ($parent_srl > 0) |
|
| 431 | 431 | { |
| 432 | 432 | $tobj->parent_srl = $parent_srl; |
| 433 | 433 | $tobj->list_order = $tobj->parent_srl * -1; |
| 434 | 434 | } |
| 435 | 435 | else |
| 436 | 436 | { |
| 437 | - $tobj->list_order = $tobj->textyle_guestbook_srl*-1; |
|
| 437 | + $tobj->list_order = $tobj->textyle_guestbook_srl * -1; |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | $output = executeQuery('textyle.insertTextyleGuestbook', $tobj); |
| 441 | 441 | |
| 442 | - if($output->toBool()) return $tobj->textyle_guestbook_srl; |
|
| 442 | + if ($output->toBool()) return $tobj->textyle_guestbook_srl; |
|
| 443 | 443 | return false; |
| 444 | 444 | } |
| 445 | 445 | |
@@ -456,18 +456,18 @@ discard block |
||
| 456 | 456 | { |
| 457 | 457 | $uploaded_count = 0; |
| 458 | 458 | |
| 459 | - $file_obj = null; |
|
| 459 | + $file_obj = null; |
|
| 460 | 460 | $file_obj->file_srl = getNextSequence(); |
| 461 | 461 | $file_obj->upload_target_srl = $upload_target_srl; |
| 462 | 462 | $file_obj->module_srl = $module_srl; |
| 463 | 463 | |
| 464 | - while(!feof($fp)) |
|
| 464 | + while (!feof($fp)) |
|
| 465 | 465 | { |
| 466 | 466 | $str = fgets($fp, 1024); |
| 467 | 467 | // If it ends with </attaches>, break |
| 468 | - if(trim($str) == '</attachment>') break; |
|
| 468 | + if (trim($str) == '</attachment>') break; |
|
| 469 | 469 | // If it starts with <file>, handle the attachement in the xml file |
| 470 | - if(substr($str, 0, 9)=='<content>') |
|
| 470 | + if (substr($str, 0, 9) == '<content>') |
|
| 471 | 471 | { |
| 472 | 472 | $file_obj->file = $this->saveTemporaryFile($fp, $str); |
| 473 | 473 | continue; |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | $buff .= $str; |
| 477 | 477 | } |
| 478 | - if(!file_exists($file_obj->file)) return false; |
|
| 478 | + if (!file_exists($file_obj->file)) return false; |
|
| 479 | 479 | |
| 480 | 480 | $buff .= '</attachment>'; |
| 481 | 481 | |
@@ -485,20 +485,20 @@ discard block |
||
| 485 | 485 | $file_obj->download_count = $xmlDoc->attachment->downloads->body; |
| 486 | 486 | $name = $xmlDoc->attachment->name->body; |
| 487 | 487 | // Set upload path by checking if the attachement is an image or other kind of file |
| 488 | - if(preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|swf|wav|webm|webp|wma|wmv)$/i", $file_obj->source_filename)) |
|
| 488 | + if (preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|swf|wav|webm|webp|wma|wmv)$/i", $file_obj->source_filename)) |
|
| 489 | 489 | { |
| 490 | - $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); |
|
| 490 | + $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 491 | 491 | $filename = $path.$file_obj->source_filename; |
| 492 | 492 | $file_obj->direct_download = 'Y'; |
| 493 | 493 | } |
| 494 | 494 | else |
| 495 | 495 | { |
| 496 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
| 497 | - $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100))); |
|
| 496 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 497 | + $filename = $path.md5(crypt(rand(1000000, 900000), rand(0, 100))); |
|
| 498 | 498 | $file_obj->direct_download = 'N'; |
| 499 | 499 | } |
| 500 | 500 | // Create a directory |
| 501 | - if(!FileHandler::makeDir($path)) return; |
|
| 501 | + if (!FileHandler::makeDir($path)) return; |
|
| 502 | 502 | |
| 503 | 503 | FileHandler::rename($file_obj->file, $filename); |
| 504 | 504 | // Insert to the DB |
@@ -507,16 +507,16 @@ discard block |
||
| 507 | 507 | $file_obj->file_size = filesize($filename); |
| 508 | 508 | $file_obj->comment = NULL; |
| 509 | 509 | $file_obj->member_srl = 0; |
| 510 | - $file_obj->sid = md5(rand(rand(1111111,4444444),rand(4444445,9999999))); |
|
| 510 | + $file_obj->sid = md5(rand(rand(1111111, 4444444), rand(4444445, 9999999))); |
|
| 511 | 511 | $file_obj->isvalid = 'Y'; |
| 512 | 512 | $output = executeQuery('file.insertFile', $file_obj); |
| 513 | 513 | |
| 514 | - if($output->toBool()) |
|
| 514 | + if ($output->toBool()) |
|
| 515 | 515 | { |
| 516 | 516 | $uploaded_count++; |
| 517 | 517 | $tmp_obj = null; |
| 518 | - if($file_obj->direct_download == 'Y') $files[$name]->url = $file_obj->uploaded_filename; |
|
| 519 | - else $files[$name]->url = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
| 518 | + if ($file_obj->direct_download == 'Y') $files[$name]->url = $file_obj->uploaded_filename; |
|
| 519 | + else $files[$name]->url = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); |
|
| 520 | 520 | $files[$name]->direct_download = $file_obj->direct_download; |
| 521 | 521 | $files[$name]->source_filename = $file_obj->source_filename; |
| 522 | 522 | return true; |
@@ -532,9 +532,9 @@ discard block |
||
| 532 | 532 | function getTmpFilename() |
| 533 | 533 | { |
| 534 | 534 | $path = "./files/cache/importer"; |
| 535 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
| 536 | - $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
|
| 537 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
| 535 | + if (!is_dir($path)) FileHandler::makeDir($path); |
|
| 536 | + $filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); |
|
| 537 | + if (file_exists($filename)) $filename .= rand(111, 999); |
|
| 538 | 538 | return $filename; |
| 539 | 539 | } |
| 540 | 540 | |
@@ -549,11 +549,11 @@ discard block |
||
| 549 | 549 | $temp_filename = $this->getTmpFilename(); |
| 550 | 550 | $buff = substr($buff, 9); |
| 551 | 551 | |
| 552 | - while(!feof($fp)) |
|
| 552 | + while (!feof($fp)) |
|
| 553 | 553 | { |
| 554 | 554 | $str = trim(fgets($fp, 1024)); |
| 555 | 555 | $buff .= $str; |
| 556 | - if(substr($str, -10) == '</content>') break; |
|
| 556 | + if (substr($str, -10) == '</content>') break; |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | $buff = substr($buff, 0, -10); |
@@ -572,16 +572,16 @@ discard block |
||
| 572 | 572 | function _replaceTTAttach($matches) |
| 573 | 573 | { |
| 574 | 574 | $name = $matches[2]; |
| 575 | - if(!$name) return $matches[0]; |
|
| 575 | + if (!$name) return $matches[0]; |
|
| 576 | 576 | |
| 577 | 577 | $obj = $this->files[$name]; |
| 578 | 578 | // If multimedia file is, |
| 579 | - if($obj->direct_download == 'Y') |
|
| 579 | + if ($obj->direct_download == 'Y') |
|
| 580 | 580 | { |
| 581 | 581 | // If image file is |
| 582 | - if(preg_match('/\.(jpg|gif|jpeg|png)$/i', $obj->source_filename)) |
|
| 582 | + if (preg_match('/\.(jpg|gif|jpeg|png)$/i', $obj->source_filename)) |
|
| 583 | 583 | { |
| 584 | - return sprintf('<img editor_component="image_link" src="%s" alt="%s" />', $obj->url, str_replace('"','\\"',$matches[4])); |
|
| 584 | + return sprintf('<img editor_component="image_link" src="%s" alt="%s" />', $obj->url, str_replace('"', '\\"', $matches[4])); |
|
| 585 | 585 | // If other multimedia file but image is, |
| 586 | 586 | } |
| 587 | 587 | else |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | function _replaceTTMovie($matches) |
| 604 | 604 | { |
| 605 | 605 | $key = $matches[1]; |
| 606 | - if(!$key) return $matches[0]; |
|
| 606 | + if (!$key) return $matches[0]; |
|
| 607 | 607 | |
| 608 | 608 | return |
| 609 | 609 | '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="402">'. |
@@ -631,12 +631,12 @@ discard block |
||
| 631 | 631 | $tobj->comment_srl = getNextSequence(); |
| 632 | 632 | $tobj->module_srl = $module_srl; |
| 633 | 633 | $tobj->document_srl = $document_srl; |
| 634 | - $tobj->is_secret = $val->secret->body=='1'?'Y':'N'; |
|
| 634 | + $tobj->is_secret = $val->secret->body == '1' ? 'Y' : 'N'; |
|
| 635 | 635 | $tobj->notify_message = 'N'; |
| 636 | 636 | $tobj->content = nl2br($val->content->body); |
| 637 | 637 | $tobj->voted_count = 0; |
| 638 | 638 | $tobj->status = 1; |
| 639 | - if($author_xml_id && $val->commenter->attrs->id == $author_xml_id) |
|
| 639 | + if ($author_xml_id && $val->commenter->attrs->id == $author_xml_id) |
|
| 640 | 640 | { |
| 641 | 641 | $tobj->password = ''; |
| 642 | 642 | $tobj->nick_name = $member_info->nick_name; |
@@ -653,9 +653,9 @@ discard block |
||
| 653 | 653 | $tobj->homepage = $val->commenter->homepage->body; |
| 654 | 654 | $tobj->member_srl = 0; |
| 655 | 655 | } |
| 656 | - $tobj->last_update = $tobj->regdate = date("YmdHis",$val->written->body); |
|
| 656 | + $tobj->last_update = $tobj->regdate = date("YmdHis", $val->written->body); |
|
| 657 | 657 | $tobj->ipaddress = $val->commenter->ip->body; |
| 658 | - $tobj->list_order = $tobj->comment_srl*-1; |
|
| 658 | + $tobj->list_order = $tobj->comment_srl * -1; |
|
| 659 | 659 | $tobj->sequence = $sequence; |
| 660 | 660 | $tobj->parent_srl = $parent_srl; |
| 661 | 661 | // Comment list first |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | $list_args->module_srl = $tobj->module_srl; |
| 666 | 666 | $list_args->regdate = $tobj->regdate; |
| 667 | 667 | // Set data directly if parent comment doesn't exist |
| 668 | - if(!$tobj->parent_srl) |
|
| 668 | + if (!$tobj->parent_srl) |
|
| 669 | 669 | { |
| 670 | 670 | $list_args->head = $list_args->arrange = $tobj->comment_srl; |
| 671 | 671 | $list_args->depth = 0; |
@@ -677,25 +677,25 @@ discard block |
||
| 677 | 677 | $parent_args->comment_srl = $tobj->parent_srl; |
| 678 | 678 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
| 679 | 679 | // Return if parent comment doesn't exist |
| 680 | - if(!$parent_output->toBool() || !$parent_output->data) return false; |
|
| 680 | + if (!$parent_output->toBool() || !$parent_output->data) return false; |
|
| 681 | 681 | $parent = $parent_output->data; |
| 682 | 682 | |
| 683 | 683 | $list_args->head = $parent->head; |
| 684 | - $list_args->depth = $parent->depth+1; |
|
| 685 | - if($list_args->depth<2) $list_args->arrange = $tobj->comment_srl; |
|
| 684 | + $list_args->depth = $parent->depth + 1; |
|
| 685 | + if ($list_args->depth < 2) $list_args->arrange = $tobj->comment_srl; |
|
| 686 | 686 | else |
| 687 | 687 | { |
| 688 | 688 | $list_args->arrange = $parent->arrange; |
| 689 | 689 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
| 690 | - if(!$output->toBool()) return $output; |
|
| 690 | + if (!$output->toBool()) return $output; |
|
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | $output = executeQuery('comment.insertCommentList', $list_args); |
| 695 | - if($output->toBool()) |
|
| 695 | + if ($output->toBool()) |
|
| 696 | 696 | { |
| 697 | 697 | $output = executeQuery('comment.insertComment', $tobj); |
| 698 | - if($output->toBool()) return $tobj->comment_srl; |
|
| 698 | + if ($output->toBool()) return $tobj->comment_srl; |
|
| 699 | 699 | } |
| 700 | 700 | return false; |
| 701 | 701 | } |
@@ -710,10 +710,10 @@ discard block |
||
| 710 | 710 | */ |
| 711 | 711 | function arrangeCategory($obj, &$category, &$idx, $parent = 0) |
| 712 | 712 | { |
| 713 | - if(!$obj->category) return; |
|
| 714 | - if(!is_array($obj->category)) $c = array($obj->category); |
|
| 713 | + if (!$obj->category) return; |
|
| 714 | + if (!is_array($obj->category)) $c = array($obj->category); |
|
| 715 | 715 | else $c = $obj->category; |
| 716 | - foreach($c as $val) |
|
| 716 | + foreach ($c as $val) |
|
| 717 | 717 | { |
| 718 | 718 | $idx++; |
| 719 | 719 | $priority = $val->priority->body; |
@@ -29,24 +29,24 @@ discard block |
||
| 29 | 29 | $file_info = $_FILES['Filedata']; |
| 30 | 30 | |
| 31 | 31 | // An error appears if not a normally uploaded file |
| 32 | - if(!is_uploaded_file($file_info['tmp_name'])) exit(); |
|
| 32 | + if (!is_uploaded_file($file_info['tmp_name'])) exit(); |
|
| 33 | 33 | |
| 34 | 34 | // Basic variables setting |
| 35 | 35 | $oFileModel = getModel('file'); |
| 36 | 36 | $editor_sequence = Context::get('editor_sequence'); |
| 37 | 37 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 38 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 38 | + if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 39 | 39 | $module_srl = $this->module_srl; |
| 40 | 40 | // Exit a session if there is neither upload permission nor information |
| 41 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 41 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 42 | 42 | // Extract from session information if upload_target_srl is not specified |
| 43 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 43 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 44 | 44 | // Create if upload_target_srl is not defined in the session information |
| 45 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 45 | + if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 46 | 46 | |
| 47 | 47 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
| 48 | 48 | Context::setResponseMethod('JSON'); |
| 49 | - if($output->error != '0') $this->stop($output->message); |
|
| 49 | + if ($output->error != '0') $this->stop($output->message); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -61,26 +61,26 @@ discard block |
||
| 61 | 61 | $callback = Context::get('callback'); |
| 62 | 62 | $module_srl = $this->module_srl; |
| 63 | 63 | $upload_target_srl = intval(Context::get('uploadTargetSrl')); |
| 64 | - if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 64 | + if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); |
|
| 65 | 65 | |
| 66 | 66 | // Exit a session if there is neither upload permission nor information |
| 67 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 67 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 68 | 68 | // Extract from session information if upload_target_srl is not specified |
| 69 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 69 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 70 | 70 | // Create if upload_target_srl is not defined in the session information |
| 71 | - if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 71 | + if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); |
|
| 72 | 72 | // Delete and then attempt to re-upload if file_srl is requested |
| 73 | 73 | $file_srl = Context::get('file_srl'); |
| 74 | - if($file_srl) $this->deleteFile($file_srl); |
|
| 74 | + if ($file_srl) $this->deleteFile($file_srl); |
|
| 75 | 75 | |
| 76 | 76 | $file_info = Context::get('Filedata'); |
| 77 | 77 | // An error appears if not a normally uploaded file |
| 78 | - if(is_uploaded_file($file_info['tmp_name'])) { |
|
| 78 | + if (is_uploaded_file($file_info['tmp_name'])) { |
|
| 79 | 79 | $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); |
| 80 | - Context::set('uploaded_fileinfo',$output); |
|
| 80 | + Context::set('uploaded_fileinfo', $output); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - Context::set('layout','none'); |
|
| 83 | + Context::set('layout', 'none'); |
|
| 84 | 84 | |
| 85 | 85 | $this->setTemplatePath($this->module_path.'tpl'); |
| 86 | 86 | $this->setTemplateFile('iframe'); |
@@ -97,24 +97,24 @@ discard block |
||
| 97 | 97 | $width = Context::get('width'); |
| 98 | 98 | $height = Context::get('height'); |
| 99 | 99 | |
| 100 | - if(!$file_srl || !$width) |
|
| 100 | + if (!$file_srl || !$width) |
|
| 101 | 101 | { |
| 102 | - return new Object(-1,'msg_invalid_request'); |
|
| 102 | + return new Object(-1, 'msg_invalid_request'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $oFileModel = getModel('file'); |
| 106 | 106 | $fileInfo = $oFileModel->getFile($file_srl); |
| 107 | - if(!$fileInfo || $fileInfo->direct_download != 'Y') |
|
| 107 | + if (!$fileInfo || $fileInfo->direct_download != 'Y') |
|
| 108 | 108 | { |
| 109 | - return new Object(-1,'msg_invalid_request'); |
|
| 109 | + return new Object(-1, 'msg_invalid_request'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $source_src = $fileInfo->uploaded_filename; |
| 113 | - $output_src = $source_src . '.resized' . strrchr($source_src,'.'); |
|
| 113 | + $output_src = $source_src.'.resized'.strrchr($source_src, '.'); |
|
| 114 | 114 | |
| 115 | - if(!$height) $height = $width-1; |
|
| 115 | + if (!$height) $height = $width - 1; |
|
| 116 | 116 | |
| 117 | - if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio')) |
|
| 117 | + if (FileHandler::createImageFile($source_src, $output_src, $width, $height, '', 'ratio')) |
|
| 118 | 118 | { |
| 119 | 119 | $output = new stdClass(); |
| 120 | 120 | $output->info = getimagesize($output_src); |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | else |
| 124 | 124 | { |
| 125 | - return new Object(-1,'msg_invalid_request'); |
|
| 125 | + return new Object(-1, 'msg_invalid_request'); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $this->add('resized_info',$output); |
|
| 128 | + $this->add('resized_info', $output); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $oFileModel = getModel('file'); |
| 165 | 165 | |
| 166 | - if(isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted'); |
|
| 166 | + if (isset($this->grant->access) && $this->grant->access !== true) return new Object(-1, 'msg_not_permitted'); |
|
| 167 | 167 | |
| 168 | 168 | $file_srl = Context::get('file_srl'); |
| 169 | 169 | $sid = Context::get('sid'); |
@@ -172,26 +172,26 @@ discard block |
||
| 172 | 172 | $columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type'); |
| 173 | 173 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 174 | 174 | // If the requested file information is incorrect, an error that file cannot be found appears |
| 175 | - if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); |
|
| 175 | + if ($file_obj->file_srl != $file_srl || $file_obj->sid != $sid) return $this->stop('msg_file_not_found'); |
|
| 176 | 176 | // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) |
| 177 | - if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); |
|
| 177 | + if ($logged_info->is_admin != 'Y' && $file_obj->isvalid != 'Y') return $this->stop('msg_not_permitted_download'); |
|
| 178 | 178 | // File name |
| 179 | 179 | $filename = $file_obj->source_filename; |
| 180 | 180 | $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); |
| 181 | 181 | // Not allow the file outlink |
| 182 | - if($file_module_config->allow_outlink == 'N') |
|
| 182 | + if ($file_module_config->allow_outlink == 'N') |
|
| 183 | 183 | { |
| 184 | 184 | // Handles extension to allow outlink |
| 185 | - if($file_module_config->allow_outlink_format) |
|
| 185 | + if ($file_module_config->allow_outlink_format) |
|
| 186 | 186 | { |
| 187 | 187 | $allow_outlink_format_array = array(); |
| 188 | 188 | $allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); |
| 189 | - if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 189 | + if (!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format; |
|
| 190 | 190 | |
| 191 | - foreach($allow_outlink_format_array as $val) |
|
| 191 | + foreach ($allow_outlink_format_array as $val) |
|
| 192 | 192 | { |
| 193 | 193 | $val = trim($val); |
| 194 | - if(preg_match("/\.{$val}$/i", $filename)) |
|
| 194 | + if (preg_match("/\.{$val}$/i", $filename)) |
|
| 195 | 195 | { |
| 196 | 196 | $file_module_config->allow_outlink = 'Y'; |
| 197 | 197 | break; |
@@ -199,21 +199,21 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | // Sites that outlink is allowed |
| 202 | - if($file_module_config->allow_outlink != 'Y') |
|
| 202 | + if ($file_module_config->allow_outlink != 'Y') |
|
| 203 | 203 | { |
| 204 | 204 | $referer = parse_url($_SERVER["HTTP_REFERER"]); |
| 205 | - if($referer['host'] != $_SERVER['HTTP_HOST']) |
|
| 205 | + if ($referer['host'] != $_SERVER['HTTP_HOST']) |
|
| 206 | 206 | { |
| 207 | - if($file_module_config->allow_outlink_site) |
|
| 207 | + if ($file_module_config->allow_outlink_site) |
|
| 208 | 208 | { |
| 209 | 209 | $allow_outlink_site_array = array(); |
| 210 | 210 | $allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site); |
| 211 | - if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 211 | + if (!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site; |
|
| 212 | 212 | |
| 213 | - foreach($allow_outlink_site_array as $val) |
|
| 213 | + foreach ($allow_outlink_site_array as $val) |
|
| 214 | 214 | { |
| 215 | 215 | $site = parse_url(trim($val)); |
| 216 | - if($site['host'] == $referer['host']) |
|
| 216 | + if ($site['host'] == $referer['host']) |
|
| 217 | 217 | { |
| 218 | 218 | $file_module_config->allow_outlink = 'Y'; |
| 219 | 219 | break; |
@@ -223,49 +223,49 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | else $file_module_config->allow_outlink = 'Y'; |
| 225 | 225 | } |
| 226 | - if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 226 | + if ($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // Check if a permission for file download is granted |
| 230 | 230 | $downloadGrantCount = 0; |
| 231 | - if(is_array($file_module_config->download_grant)) |
|
| 231 | + if (is_array($file_module_config->download_grant)) |
|
| 232 | 232 | { |
| 233 | - foreach($file_module_config->download_grant AS $value) |
|
| 234 | - if($value) $downloadGrantCount++; |
|
| 233 | + foreach ($file_module_config->download_grant AS $value) |
|
| 234 | + if ($value) $downloadGrantCount++; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
|
| 237 | + if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0) |
|
| 238 | 238 | { |
| 239 | - if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 239 | + if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
|
| 240 | 240 | $logged_info = Context::get('logged_info'); |
| 241 | - if($logged_info->is_admin != 'Y') |
|
| 241 | + if ($logged_info->is_admin != 'Y') |
|
| 242 | 242 | { |
| 243 | - $oModuleModel =& getModel('module'); |
|
| 243 | + $oModuleModel = & getModel('module'); |
|
| 244 | 244 | $columnList = array('module_srl', 'site_srl'); |
| 245 | 245 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($file_obj->module_srl, $columnList); |
| 246 | 246 | |
| 247 | - if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 247 | + if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
|
| 248 | 248 | { |
| 249 | - $oMemberModel =& getModel('member'); |
|
| 249 | + $oMemberModel = & getModel('member'); |
|
| 250 | 250 | $member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
| 251 | 251 | |
| 252 | 252 | $is_permitted = false; |
| 253 | - for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
| 253 | + for ($i = 0; $i < count($file_module_config->download_grant); $i++) |
|
| 254 | 254 | { |
| 255 | 255 | $group_srl = $file_module_config->download_grant[$i]; |
| 256 | - if($member_groups[$group_srl]) |
|
| 256 | + if ($member_groups[$group_srl]) |
|
| 257 | 257 | { |
| 258 | 258 | $is_permitted = true; |
| 259 | 259 | break; |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | - if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 262 | + if (!$is_permitted) return $this->stop('msg_not_permitted_download'); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | // Call a trigger (before) |
| 267 | 267 | $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); |
| 268 | - if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); |
|
| 268 | + if (!$output->toBool()) return $this->stop(($output->message) ? $output->message : 'msg_not_permitted_download'); |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | // 다운로드 후 (가상) |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $random = new Password(); |
| 280 | 280 | $file_key = $_SESSION['__XE_FILE_KEY__'][$file_srl] = $random->createSecureSalt(32, 'hex'); |
| 281 | - header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput','file_srl',$file_srl,'file_key',$file_key)); |
|
| 281 | + header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key)); |
|
| 282 | 282 | Context::close(); |
| 283 | 283 | exit(); |
| 284 | 284 | |
@@ -289,18 +289,18 @@ discard block |
||
| 289 | 289 | $oFileModel = getModel('file'); |
| 290 | 290 | $file_srl = Context::get('file_srl'); |
| 291 | 291 | $file_key = Context::get('file_key'); |
| 292 | - if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 292 | + if (strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true; |
|
| 293 | 293 | |
| 294 | - if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 294 | + if ($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__'; |
|
| 295 | 295 | else $session_key = '__XE_FILE_KEY__'; |
| 296 | 296 | $columnList = array('source_filename', 'uploaded_filename', 'file_size'); |
| 297 | 297 | $file_obj = $oFileModel->getFile($file_srl, $columnList); |
| 298 | 298 | |
| 299 | 299 | $uploaded_filename = $file_obj->uploaded_filename; |
| 300 | 300 | |
| 301 | - if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 301 | + if (!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found'); |
|
| 302 | 302 | |
| 303 | - if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
| 303 | + if (!$file_key || $_SESSION[$session_key][$file_srl] != $file_key) |
|
| 304 | 304 | { |
| 305 | 305 | unset($_SESSION[$session_key][$file_srl]); |
| 306 | 306 | return $this->stop('msg_invalid_request'); |
@@ -309,34 +309,34 @@ discard block |
||
| 309 | 309 | $file_size = $file_obj->file_size; |
| 310 | 310 | $filename = $file_obj->source_filename; |
| 311 | 311 | |
| 312 | - if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
| 312 | + if (preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11) |
|
| 313 | 313 | { |
| 314 | - if($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) |
|
| 314 | + if ($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT'])) |
|
| 315 | 315 | { |
| 316 | - $filename_param = 'filename="' . $filename . '"'; |
|
| 316 | + $filename_param = 'filename="'.$filename.'"'; |
|
| 317 | 317 | } |
| 318 | 318 | else |
| 319 | 319 | { |
| 320 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
|
| 320 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"'; |
|
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | - elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 323 | + elseif (preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6) |
|
| 324 | 324 | { |
| 325 | - $filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"'; |
|
| 325 | + $filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"'; |
|
| 326 | 326 | } |
| 327 | - elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 327 | + elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 328 | 328 | { |
| 329 | 329 | $filename = rawurlencode($filename); |
| 330 | - $filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"'; |
|
| 330 | + $filename_param = 'filename="'.preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1).'"'; |
|
| 331 | 331 | } |
| 332 | 332 | else |
| 333 | 333 | { |
| 334 | - $filename_param = 'filename="' . $filename . '"'; |
|
| 334 | + $filename_param = 'filename="'.$filename.'"'; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - if($is_android) |
|
| 337 | + if ($is_android) |
|
| 338 | 338 | { |
| 339 | - if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 339 | + if ($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | unset($_SESSION[$session_key][$file_srl]); |
@@ -344,21 +344,21 @@ discard block |
||
| 344 | 344 | Context::close(); |
| 345 | 345 | |
| 346 | 346 | $fp = fopen($uploaded_filename, 'rb'); |
| 347 | - if(!$fp) return $this->stop('msg_file_not_found'); |
|
| 347 | + if (!$fp) return $this->stop('msg_file_not_found'); |
|
| 348 | 348 | |
| 349 | 349 | header("Cache-Control: "); |
| 350 | 350 | header("Pragma: "); |
| 351 | 351 | header("Content-Type: application/octet-stream"); |
| 352 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 352 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 353 | 353 | |
| 354 | - header("Content-Length: " .(string)($file_size)); |
|
| 355 | - header('Content-Disposition: attachment; ' . $filename_param); |
|
| 354 | + header("Content-Length: ".(string) ($file_size)); |
|
| 355 | + header('Content-Disposition: attachment; '.$filename_param); |
|
| 356 | 356 | header("Content-Transfer-Encoding: binary\n"); |
| 357 | 357 | |
| 358 | 358 | // if file size is lager than 10MB, use fread function (#18675748) |
| 359 | - if(filesize($uploaded_filename) > 1024 * 1024) |
|
| 359 | + if (filesize($uploaded_filename) > 1024 * 1024) |
|
| 360 | 360 | { |
| 361 | - while(!feof($fp)) echo fread($fp, 1024); |
|
| 361 | + while (!feof($fp)) echo fread($fp, 1024); |
|
| 362 | 362 | fclose($fp); |
| 363 | 363 | } |
| 364 | 364 | else |
@@ -380,36 +380,36 @@ discard block |
||
| 380 | 380 | $editor_sequence = Context::get('editor_sequence'); |
| 381 | 381 | $file_srl = Context::get('file_srl'); |
| 382 | 382 | $file_srls = Context::get('file_srls'); |
| 383 | - if($file_srls) $file_srl = $file_srls; |
|
| 383 | + if ($file_srls) $file_srl = $file_srls; |
|
| 384 | 384 | // Exit a session if there is neither upload permission nor information |
| 385 | - if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 385 | + if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); |
|
| 386 | 386 | |
| 387 | 387 | $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
| 388 | 388 | |
| 389 | 389 | $logged_info = Context::get('logged_info'); |
| 390 | 390 | $oFileModel = getModel('file'); |
| 391 | 391 | |
| 392 | - $srls = explode(',',$file_srl); |
|
| 393 | - if(!count($srls)) return; |
|
| 392 | + $srls = explode(',', $file_srl); |
|
| 393 | + if (!count($srls)) return; |
|
| 394 | 394 | |
| 395 | - for($i=0;$i<count($srls);$i++) |
|
| 395 | + for ($i = 0; $i < count($srls); $i++) |
|
| 396 | 396 | { |
| 397 | - $srl = (int)$srls[$i]; |
|
| 398 | - if(!$srl) continue; |
|
| 397 | + $srl = (int) $srls[$i]; |
|
| 398 | + if (!$srl) continue; |
|
| 399 | 399 | |
| 400 | 400 | $args = new stdClass; |
| 401 | 401 | $args->file_srl = $srl; |
| 402 | 402 | $output = executeQuery('file.getFile', $args); |
| 403 | - if(!$output->toBool()) continue; |
|
| 403 | + if (!$output->toBool()) continue; |
|
| 404 | 404 | |
| 405 | 405 | $file_info = $output->data; |
| 406 | - if(!$file_info) continue; |
|
| 406 | + if (!$file_info) continue; |
|
| 407 | 407 | |
| 408 | 408 | $file_grant = $oFileModel->getFileGrant($file_info, $logged_info); |
| 409 | 409 | |
| 410 | - if(!$file_grant->is_deletable) continue; |
|
| 410 | + if (!$file_grant->is_deletable) continue; |
|
| 411 | 411 | |
| 412 | - if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 412 | + if ($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl); |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | |
@@ -420,23 +420,23 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | function procFileGetList() |
| 422 | 422 | { |
| 423 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 423 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 424 | 424 | $fileSrls = Context::get('file_srls'); |
| 425 | - if($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 425 | + if ($fileSrls) $fileSrlList = explode(',', $fileSrls); |
|
| 426 | 426 | |
| 427 | 427 | global $lang; |
| 428 | - if(count($fileSrlList) > 0) |
|
| 428 | + if (count($fileSrlList) > 0) |
|
| 429 | 429 | { |
| 430 | 430 | $oFileModel = getModel('file'); |
| 431 | 431 | $fileList = $oFileModel->getFile($fileSrlList); |
| 432 | - if(!is_array($fileList)) $fileList = array($fileList); |
|
| 432 | + if (!is_array($fileList)) $fileList = array($fileList); |
|
| 433 | 433 | |
| 434 | - if(is_array($fileList)) |
|
| 434 | + if (is_array($fileList)) |
|
| 435 | 435 | { |
| 436 | - foreach($fileList AS $key=>$value) |
|
| 436 | + foreach ($fileList AS $key=>$value) |
|
| 437 | 437 | { |
| 438 | 438 | $value->human_file_size = FileHandler::filesize($value->file_size); |
| 439 | - if($value->isvalid=='Y') $value->validName = $lang->is_valid; |
|
| 439 | + if ($value->isvalid == 'Y') $value->validName = $lang->is_valid; |
|
| 440 | 440 | else $value->validName = $lang->is_stand_by; |
| 441 | 441 | } |
| 442 | 442 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | function triggerCheckAttached(&$obj) |
| 459 | 459 | { |
| 460 | 460 | $document_srl = $obj->document_srl; |
| 461 | - if(!$document_srl) return new Object(); |
|
| 461 | + if (!$document_srl) return new Object(); |
|
| 462 | 462 | // Get numbers of attachments |
| 463 | 463 | $oFileModel = getModel('file'); |
| 464 | 464 | $obj->uploaded_count = $oFileModel->getFilesCount($document_srl); |
@@ -475,10 +475,10 @@ discard block |
||
| 475 | 475 | function triggerAttachFiles(&$obj) |
| 476 | 476 | { |
| 477 | 477 | $document_srl = $obj->document_srl; |
| 478 | - if(!$document_srl) return new Object(); |
|
| 478 | + if (!$document_srl) return new Object(); |
|
| 479 | 479 | |
| 480 | 480 | $output = $this->setFilesValid($document_srl); |
| 481 | - if(!$output->toBool()) return $output; |
|
| 481 | + if (!$output->toBool()) return $output; |
|
| 482 | 482 | |
| 483 | 483 | return new Object(); |
| 484 | 484 | } |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | function triggerDeleteAttached(&$obj) |
| 493 | 493 | { |
| 494 | 494 | $document_srl = $obj->document_srl; |
| 495 | - if(!$document_srl) return new Object(); |
|
| 495 | + if (!$document_srl) return new Object(); |
|
| 496 | 496 | |
| 497 | 497 | $output = $this->deleteFiles($document_srl); |
| 498 | 498 | return $output; |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | function triggerCommentCheckAttached(&$obj) |
| 508 | 508 | { |
| 509 | 509 | $comment_srl = $obj->comment_srl; |
| 510 | - if(!$comment_srl) return new Object(); |
|
| 510 | + if (!$comment_srl) return new Object(); |
|
| 511 | 511 | // Get numbers of attachments |
| 512 | 512 | $oFileModel = getModel('file'); |
| 513 | 513 | $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl); |
@@ -525,10 +525,10 @@ discard block |
||
| 525 | 525 | { |
| 526 | 526 | $comment_srl = $obj->comment_srl; |
| 527 | 527 | $uploaded_count = $obj->uploaded_count; |
| 528 | - if(!$comment_srl || !$uploaded_count) return new Object(); |
|
| 528 | + if (!$comment_srl || !$uploaded_count) return new Object(); |
|
| 529 | 529 | |
| 530 | 530 | $output = $this->setFilesValid($comment_srl); |
| 531 | - if(!$output->toBool()) return $output; |
|
| 531 | + if (!$output->toBool()) return $output; |
|
| 532 | 532 | |
| 533 | 533 | return new Object(); |
| 534 | 534 | } |
@@ -542,9 +542,9 @@ discard block |
||
| 542 | 542 | function triggerCommentDeleteAttached(&$obj) |
| 543 | 543 | { |
| 544 | 544 | $comment_srl = $obj->comment_srl; |
| 545 | - if(!$comment_srl) return new Object(); |
|
| 545 | + if (!$comment_srl) return new Object(); |
|
| 546 | 546 | |
| 547 | - if($obj->isMoveToTrash) return new Object(); |
|
| 547 | + if ($obj->isMoveToTrash) return new Object(); |
|
| 548 | 548 | |
| 549 | 549 | $output = $this->deleteFiles($comment_srl); |
| 550 | 550 | return $output; |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | function triggerDeleteModuleFiles(&$obj) |
| 560 | 560 | { |
| 561 | 561 | $module_srl = $obj->module_srl; |
| 562 | - if(!$module_srl) return new Object(); |
|
| 562 | + if (!$module_srl) return new Object(); |
|
| 563 | 563 | |
| 564 | 564 | $oFileController = getAdminController('file'); |
| 565 | 565 | return $oFileController->deleteModuleFiles($module_srl); |
@@ -572,9 +572,9 @@ discard block |
||
| 572 | 572 | * @param int $upload_target_srl |
| 573 | 573 | * @return void |
| 574 | 574 | */ |
| 575 | - function setUploadInfo($editor_sequence, $upload_target_srl=0) |
|
| 575 | + function setUploadInfo($editor_sequence, $upload_target_srl = 0) |
|
| 576 | 576 | { |
| 577 | - if(!isset($_SESSION['upload_info'][$editor_sequence])) |
|
| 577 | + if (!isset($_SESSION['upload_info'][$editor_sequence])) |
|
| 578 | 578 | { |
| 579 | 579 | $_SESSION['upload_info'][$editor_sequence] = new stdClass(); |
| 580 | 580 | } |
@@ -634,36 +634,36 @@ discard block |
||
| 634 | 634 | $trigger_obj->module_srl = $module_srl; |
| 635 | 635 | $trigger_obj->upload_target_srl = $upload_target_srl; |
| 636 | 636 | $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); |
| 637 | - if(!$output->toBool()) return $output; |
|
| 637 | + if (!$output->toBool()) return $output; |
|
| 638 | 638 | |
| 639 | 639 | // A workaround for Firefox upload bug |
| 640 | - if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
| 640 | + if (preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) |
|
| 641 | 641 | { |
| 642 | 642 | $file_info['name'] = base64_decode(strtr($match[1], ':', '/')); |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | - if(!$manual_insert) |
|
| 645 | + if (!$manual_insert) |
|
| 646 | 646 | { |
| 647 | 647 | // Get the file configurations |
| 648 | 648 | $logged_info = Context::get('logged_info'); |
| 649 | - if($logged_info->is_admin != 'Y') |
|
| 649 | + if ($logged_info->is_admin != 'Y') |
|
| 650 | 650 | { |
| 651 | 651 | $oFileModel = getModel('file'); |
| 652 | 652 | $config = $oFileModel->getFileConfig($module_srl); |
| 653 | 653 | |
| 654 | 654 | // check file type |
| 655 | - if(isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
| 655 | + if (isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*') |
|
| 656 | 656 | { |
| 657 | 657 | $filetypes = explode(';', $config->allowed_filetypes); |
| 658 | 658 | $ext = array(); |
| 659 | - foreach($filetypes as $item) { |
|
| 659 | + foreach ($filetypes as $item) { |
|
| 660 | 660 | $item = explode('.', $item); |
| 661 | 661 | $ext[] = strtolower($item[1]); |
| 662 | 662 | } |
| 663 | 663 | $uploaded_ext = explode('.', $file_info['name']); |
| 664 | 664 | $uploaded_ext = strtolower(array_pop($uploaded_ext)); |
| 665 | 665 | |
| 666 | - if(!in_array($uploaded_ext, $ext)) |
|
| 666 | + if (!in_array($uploaded_ext, $ext)) |
|
| 667 | 667 | { |
| 668 | 668 | return $this->stop('msg_not_allowed_filetype'); |
| 669 | 669 | } |
@@ -672,63 +672,63 @@ discard block |
||
| 672 | 672 | $allowed_filesize = $config->allowed_filesize * 1024 * 1024; |
| 673 | 673 | $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; |
| 674 | 674 | // An error appears if file size exceeds a limit |
| 675 | - if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 675 | + if ($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 676 | 676 | // Get total file size of all attachements (from DB) |
| 677 | 677 | $size_args = new stdClass; |
| 678 | 678 | $size_args->upload_target_srl = $upload_target_srl; |
| 679 | 679 | $output = executeQuery('file.getAttachedFileSize', $size_args); |
| 680 | - $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']); |
|
| 681 | - if($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 680 | + $attached_size = (int) $output->data->attached_size + filesize($file_info['tmp_name']); |
|
| 681 | + if ($attached_size > $allowed_attach_size) return new Object(-1, 'msg_exceeds_limit_size'); |
|
| 682 | 682 | } |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | // https://github.com/xpressengine/xe-core/issues/1713 |
| 686 | - $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']); |
|
| 686 | + $file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']); |
|
| 687 | 687 | $file_info['name'] = removeHackTag($file_info['name']); |
| 688 | - $file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']); |
|
| 688 | + $file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']); |
|
| 689 | 689 | |
| 690 | 690 | // Get random number generator |
| 691 | 691 | $random = new Password(); |
| 692 | 692 | |
| 693 | 693 | // Set upload path by checking if the attachement is an image or other kinds of file |
| 694 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) |
|
| 694 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) |
|
| 695 | 695 | { |
| 696 | - $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); |
|
| 696 | + $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 697 | 697 | |
| 698 | 698 | // special character to '_' |
| 699 | 699 | // change to random file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter |
| 700 | - $ext = substr(strrchr($file_info['name'],'.'),1); |
|
| 700 | + $ext = substr(strrchr($file_info['name'], '.'), 1); |
|
| 701 | 701 | //$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']); |
| 702 | 702 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
| 703 | 703 | $filename = $path.$_filename; |
| 704 | 704 | $idx = 1; |
| 705 | - while(file_exists($filename)) |
|
| 705 | + while (file_exists($filename)) |
|
| 706 | 706 | { |
| 707 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1',$_filename); |
|
| 707 | + $filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); |
|
| 708 | 708 | $idx++; |
| 709 | 709 | } |
| 710 | 710 | $direct_download = 'Y'; |
| 711 | 711 | } |
| 712 | 712 | else |
| 713 | 713 | { |
| 714 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
| 714 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
| 715 | 715 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
| 716 | 716 | $direct_download = 'N'; |
| 717 | 717 | } |
| 718 | 718 | // Create a directory |
| 719 | - if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create'); |
|
| 719 | + if (!FileHandler::makeDir($path)) return new Object(-1, 'msg_not_permitted_create'); |
|
| 720 | 720 | |
| 721 | 721 | // Check uploaded file |
| 722 | - if(!checkUploadedFile($file_info['tmp_name'])) return new Object(-1,'msg_file_upload_error'); |
|
| 722 | + if (!checkUploadedFile($file_info['tmp_name'])) return new Object(-1, 'msg_file_upload_error'); |
|
| 723 | 723 | |
| 724 | 724 | // Get random number generator |
| 725 | 725 | $random = new Password(); |
| 726 | 726 | |
| 727 | 727 | // Move the file |
| 728 | - if($manual_insert) |
|
| 728 | + if ($manual_insert) |
|
| 729 | 729 | { |
| 730 | 730 | @copy($file_info['tmp_name'], $filename); |
| 731 | - if(!file_exists($filename)) |
|
| 731 | + if (!file_exists($filename)) |
|
| 732 | 732 | { |
| 733 | 733 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 734 | 734 | @copy($file_info['tmp_name'], $filename); |
@@ -736,10 +736,10 @@ discard block |
||
| 736 | 736 | } |
| 737 | 737 | else |
| 738 | 738 | { |
| 739 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
| 739 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) |
|
| 740 | 740 | { |
| 741 | 741 | $filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext; |
| 742 | - if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error'); |
|
| 742 | + if (!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1, 'msg_file_upload_error'); |
|
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | // Get member information |
@@ -760,10 +760,10 @@ discard block |
||
| 760 | 760 | $args->sid = $random->createSecureSalt(32, 'hex'); |
| 761 | 761 | |
| 762 | 762 | $output = executeQuery('file.insertFile', $args); |
| 763 | - if(!$output->toBool()) return $output; |
|
| 763 | + if (!$output->toBool()) return $output; |
|
| 764 | 764 | // Call a trigger (after) |
| 765 | 765 | $trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); |
| 766 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 766 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 767 | 767 | |
| 768 | 768 | $_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true; |
| 769 | 769 | |
@@ -806,18 +806,18 @@ discard block |
||
| 806 | 806 | */ |
| 807 | 807 | function deleteFile($file_srl) |
| 808 | 808 | { |
| 809 | - if(!$file_srl) return; |
|
| 809 | + if (!$file_srl) return; |
|
| 810 | 810 | |
| 811 | 811 | $srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl); |
| 812 | - if(!count($srls)) return; |
|
| 812 | + if (!count($srls)) return; |
|
| 813 | 813 | |
| 814 | 814 | $oDocumentController = getController('document'); |
| 815 | 815 | $documentSrlList = array(); |
| 816 | 816 | |
| 817 | - foreach($srls as $srl) |
|
| 817 | + foreach ($srls as $srl) |
|
| 818 | 818 | { |
| 819 | - $srl = (int)$srl; |
|
| 820 | - if(!$srl) |
|
| 819 | + $srl = (int) $srl; |
|
| 820 | + if (!$srl) |
|
| 821 | 821 | { |
| 822 | 822 | continue; |
| 823 | 823 | } |
@@ -826,14 +826,14 @@ discard block |
||
| 826 | 826 | $args->file_srl = $srl; |
| 827 | 827 | $output = executeQuery('file.getFile', $args); |
| 828 | 828 | |
| 829 | - if(!$output->toBool() || !$output->data) |
|
| 829 | + if (!$output->toBool() || !$output->data) |
|
| 830 | 830 | { |
| 831 | 831 | continue; |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | $file_info = $output->data; |
| 835 | 835 | |
| 836 | - if($file_info->upload_target_srl) |
|
| 836 | + if ($file_info->upload_target_srl) |
|
| 837 | 837 | { |
| 838 | 838 | $documentSrlList[] = $file_info->upload_target_srl; |
| 839 | 839 | } |
@@ -844,15 +844,15 @@ discard block |
||
| 844 | 844 | // Call a trigger (before) |
| 845 | 845 | $trigger_obj = $output->data; |
| 846 | 846 | $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); |
| 847 | - if(!$output->toBool()) return $output; |
|
| 847 | + if (!$output->toBool()) return $output; |
|
| 848 | 848 | |
| 849 | 849 | // Remove from the DB |
| 850 | 850 | $output = executeQuery('file.deleteFile', $args); |
| 851 | - if(!$output->toBool()) return $output; |
|
| 851 | + if (!$output->toBool()) return $output; |
|
| 852 | 852 | |
| 853 | 853 | // Call a trigger (after) |
| 854 | 854 | $trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); |
| 855 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 855 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 856 | 856 | |
| 857 | 857 | // If successfully deleted, remove the file |
| 858 | 858 | FileHandler::removeFile($uploaded_filename); |
@@ -876,28 +876,28 @@ discard block |
||
| 876 | 876 | $columnList = array('file_srl', 'uploaded_filename', 'module_srl'); |
| 877 | 877 | $file_list = $oFileModel->getFiles($upload_target_srl, $columnList); |
| 878 | 878 | // Success returned if no attachement exists |
| 879 | - if(!is_array($file_list)||!count($file_list)) return new Object(); |
|
| 879 | + if (!is_array($file_list) || !count($file_list)) return new Object(); |
|
| 880 | 880 | |
| 881 | 881 | // Delete the file |
| 882 | 882 | $path = array(); |
| 883 | 883 | $file_count = count($file_list); |
| 884 | - for($i=0;$i<$file_count;$i++) |
|
| 884 | + for ($i = 0; $i < $file_count; $i++) |
|
| 885 | 885 | { |
| 886 | 886 | $this->deleteFile($file_list[$i]->file_srl); |
| 887 | 887 | |
| 888 | 888 | $uploaded_filename = $file_list[$i]->uploaded_filename; |
| 889 | 889 | $path_info = pathinfo($uploaded_filename); |
| 890 | - if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 890 | + if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | // Remove from the DB |
| 894 | 894 | $args = new stdClass(); |
| 895 | 895 | $args->upload_target_srl = $upload_target_srl; |
| 896 | 896 | $output = executeQuery('file.deleteFiles', $args); |
| 897 | - if(!$output->toBool()) return $output; |
|
| 897 | + if (!$output->toBool()) return $output; |
|
| 898 | 898 | |
| 899 | 899 | // Remove a file directory of the document |
| 900 | - for($i=0, $c=count($path); $i<$c; $i++) |
|
| 900 | + for ($i = 0, $c = count($path); $i < $c; $i++) |
|
| 901 | 901 | { |
| 902 | 902 | FileHandler::removeBlankDir($path[$i]); |
| 903 | 903 | } |
@@ -915,23 +915,23 @@ discard block |
||
| 915 | 915 | */ |
| 916 | 916 | function moveFile($source_srl, $target_module_srl, $target_srl) |
| 917 | 917 | { |
| 918 | - if($source_srl == $target_srl) return; |
|
| 918 | + if ($source_srl == $target_srl) return; |
|
| 919 | 919 | |
| 920 | 920 | $oFileModel = getModel('file'); |
| 921 | 921 | $file_list = $oFileModel->getFiles($source_srl); |
| 922 | - if(!$file_list) return; |
|
| 922 | + if (!$file_list) return; |
|
| 923 | 923 | |
| 924 | 924 | $file_count = count($file_list); |
| 925 | 925 | |
| 926 | - for($i=0;$i<$file_count;$i++) |
|
| 926 | + for ($i = 0; $i < $file_count; $i++) |
|
| 927 | 927 | { |
| 928 | 928 | unset($file_info); |
| 929 | 929 | $file_info = $file_list[$i]; |
| 930 | 930 | $old_file = $file_info->uploaded_filename; |
| 931 | 931 | // Determine the file path by checking if the file is an image or other kinds |
| 932 | - if(preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|swf|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) |
|
| 932 | + if (preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|swf|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename)) |
|
| 933 | 933 | { |
| 934 | - $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); |
|
| 934 | + $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl, $target_srl); |
|
| 935 | 935 | $new_file = $path.$file_info->source_filename; |
| 936 | 936 | } |
| 937 | 937 | else |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | $new_file = $path.$random->createSecureSalt(32, 'hex'); |
| 942 | 942 | } |
| 943 | 943 | // Pass if a target document to move is same |
| 944 | - if($old_file == $new_file) continue; |
|
| 944 | + if ($old_file == $new_file) continue; |
|
| 945 | 945 | // Create a directory |
| 946 | 946 | FileHandler::makeDir($path); |
| 947 | 947 | // Move the file |
@@ -961,18 +961,18 @@ discard block |
||
| 961 | 961 | $vars = Context::getRequestVars(); |
| 962 | 962 | $logged_info = Context::get('logged_info'); |
| 963 | 963 | |
| 964 | - if(!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request'); |
|
| 964 | + if (!$vars->editor_sequence) return new Object(-1, 'msg_invalid_request'); |
|
| 965 | 965 | |
| 966 | 966 | $upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl; |
| 967 | 967 | |
| 968 | 968 | $oFileModel = getModel('file'); |
| 969 | 969 | $file_info = $oFileModel->getFile($vars->file_srl); |
| 970 | 970 | |
| 971 | - if(!$file_info) return new Object(-1, 'msg_not_founded'); |
|
| 971 | + if (!$file_info) return new Object(-1, 'msg_not_founded'); |
|
| 972 | 972 | |
| 973 | - if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted'); |
|
| 973 | + if (!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new Object(-1, 'msg_not_permitted'); |
|
| 974 | 974 | |
| 975 | - $args = new stdClass(); |
|
| 975 | + $args = new stdClass(); |
|
| 976 | 976 | $args->file_srl = $vars->file_srl; |
| 977 | 977 | $args->upload_target_srl = $upload_target_srl; |
| 978 | 978 | |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | |
| 982 | 982 | $args->cover_image = 'N'; |
| 983 | 983 | $output = executeQuery('file.updateClearCoverImage', $args); |
| 984 | - if(!$output->toBool()) |
|
| 984 | + if (!$output->toBool()) |
|
| 985 | 985 | { |
| 986 | 986 | $oDB->rollback(); |
| 987 | 987 | return $output; |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | |
| 990 | 990 | $args->cover_image = 'Y'; |
| 991 | 991 | $output = executeQuery('file.updateCoverImage', $args); |
| 992 | - if(!$output->toBool()) |
|
| 992 | + if (!$output->toBool()) |
|
| 993 | 993 | { |
| 994 | 994 | $oDB->rollback(); |
| 995 | 995 | return $output; |
@@ -1021,9 +1021,9 @@ discard block |
||
| 1021 | 1021 | $fileConfig = $oModuleModel->getModulePartConfig('file', $obj->originModuleSrl); |
| 1022 | 1022 | |
| 1023 | 1023 | $oModuleController = getController('module'); |
| 1024 | - if(is_array($obj->moduleSrlList)) |
|
| 1024 | + if (is_array($obj->moduleSrlList)) |
|
| 1025 | 1025 | { |
| 1026 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 1026 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 1027 | 1027 | { |
| 1028 | 1028 | $oModuleController->insertModulePartConfig('file', $moduleSrl, $fileConfig); |
| 1029 | 1029 | } |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $gallery_info = new stdClass(); |
| 47 | 47 | $gallery_info->srl = rand(111111, 999999); |
| 48 | - $gallery_info->border_thickness = (int)$xml_obj->attrs->border_thickness; |
|
| 48 | + $gallery_info->border_thickness = (int) $xml_obj->attrs->border_thickness; |
|
| 49 | 49 | $gallery_info->gallery_style = $xml_obj->attrs->gallery_style; |
| 50 | 50 | $color_preg = "/^([a-fA-F0-9]{6})/"; |
| 51 | - $gallery_info->border_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->border_color); |
|
| 52 | - $gallery_info->bg_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->bg_color); |
|
| 51 | + $gallery_info->border_color = preg_replace($color_preg, "#$1", $xml_obj->attrs->border_color); |
|
| 52 | + $gallery_info->bg_color = preg_replace($color_preg, "#$1", $xml_obj->attrs->bg_color); |
|
| 53 | 53 | $gallery_info->gallery_align = $xml_obj->attrs->gallery_align; |
| 54 | 54 | |
| 55 | - if(!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) { |
|
| 55 | + if (!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) { |
|
| 56 | 56 | $gallery_info->gallery_align = 'center'; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | $gallery_info->images_list = preg_grep("/^[a-z0-9\/]+\.(gif|jpe?g|png)+$/i", $images_list); |
| 63 | 63 | |
| 64 | 64 | // If you set the output to output the XML code generated a list of the image |
| 65 | - if(Context::getResponseMethod() == 'XMLRPC') |
|
| 65 | + if (Context::getResponseMethod() == 'XMLRPC') |
|
| 66 | 66 | { |
| 67 | 67 | $output = array(); |
| 68 | - for($i=0;$i<count($gallery_info->images_list);$i++) |
|
| 68 | + for ($i = 0; $i < count($gallery_info->images_list); $i++) |
|
| 69 | 69 | { |
| 70 | 70 | $output[] = sprintf('<img src="%s" alt="" />', $gallery_info->images_list[$i]); |
| 71 | 71 | } |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | return implode('<br />', $output); |
| 74 | 74 | } |
| 75 | 75 | // HTML gallery output, the output settings via the template for the conversion to generate the html code should |
| 76 | - preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches); |
|
| 76 | + preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches); |
|
| 77 | 77 | $gallery_info->width = trim($matches[3][0]); |
| 78 | - if(!$gallery_info->width) $gallery_info->width = 400; |
|
| 78 | + if (!$gallery_info->width) $gallery_info->width = 400; |
|
| 79 | 79 | |
| 80 | 80 | Context::set('gallery_info', $gallery_info); |
| 81 | 81 | |
| 82 | 82 | $tpl_path = $this->component_path.'tpl'; |
| 83 | 83 | Context::set("tpl_path", $tpl_path); |
| 84 | 84 | |
| 85 | - if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html'; |
|
| 85 | + if ($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html'; |
|
| 86 | 86 | else $tpl_file = 'slide_gallery.html'; |
| 87 | 87 | |
| 88 | 88 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | function read($session_key) |
| 23 | 23 | { |
| 24 | - if(!$session_key || !$this->session_started) return; |
|
| 24 | + if (!$session_key || !$this->session_started) return; |
|
| 25 | 25 | |
| 26 | 26 | $args = new stdClass(); |
| 27 | 27 | $args->session_key = $session_key; |
| 28 | 28 | $columnList = array('session_key', 'cur_mid', 'val'); |
| 29 | 29 | $output = executeQuery('session.getSession', $args, $columnList); |
| 30 | 30 | |
| 31 | - if(!$output->data) |
|
| 31 | + if (!$output->data) |
|
| 32 | 32 | { |
| 33 | 33 | return ''; |
| 34 | 34 | } |
@@ -46,47 +46,47 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function getLoggedMembers($args) |
| 48 | 48 | { |
| 49 | - if(!$args->site_srl) |
|
| 49 | + if (!$args->site_srl) |
|
| 50 | 50 | { |
| 51 | 51 | $site_module_info = Context::get('site_module_info'); |
| 52 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 52 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 53 | 53 | } |
| 54 | - if(!$args->list_count) $args->list_count = 20; |
|
| 55 | - if(!$args->page) $args->page = 1; |
|
| 56 | - if(!$args->period_time) $args->period_time = 3; |
|
| 57 | - $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time*60); |
|
| 54 | + if (!$args->list_count) $args->list_count = 20; |
|
| 55 | + if (!$args->page) $args->page = 1; |
|
| 56 | + if (!$args->period_time) $args->period_time = 3; |
|
| 57 | + $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time * 60); |
|
| 58 | 58 | |
| 59 | 59 | $output = executeQueryArray('session.getLoggedMembers', $args); |
| 60 | - if(!$output->toBool()) return $output; |
|
| 60 | + if (!$output->toBool()) return $output; |
|
| 61 | 61 | |
| 62 | 62 | $member_srls = array(); |
| 63 | 63 | $member_keys = array(); |
| 64 | - if(count($output->data)) |
|
| 64 | + if (count($output->data)) |
|
| 65 | 65 | { |
| 66 | - foreach($output->data as $key => $val) |
|
| 66 | + foreach ($output->data as $key => $val) |
|
| 67 | 67 | { |
| 68 | 68 | $member_srls[$key] = $val->member_srl; |
| 69 | 69 | $member_keys[$val->member_srl] = $key; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if(Context::get('is_logged')) |
|
| 73 | + if (Context::get('is_logged')) |
|
| 74 | 74 | { |
| 75 | 75 | $logged_info = Context::get('logged_info'); |
| 76 | - if(!in_array($logged_info->member_srl, $member_srls)) |
|
| 76 | + if (!in_array($logged_info->member_srl, $member_srls)) |
|
| 77 | 77 | { |
| 78 | 78 | $member_srls[0] = $logged_info->member_srl; |
| 79 | 79 | $member_keys[$logged_info->member_srl] = 0; |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if(!count($member_srls)) return $output; |
|
| 83 | + if (!count($member_srls)) return $output; |
|
| 84 | 84 | |
| 85 | - $member_args->member_srl = implode(',',$member_srls); |
|
| 85 | + $member_args->member_srl = implode(',', $member_srls); |
|
| 86 | 86 | $member_output = executeQueryArray('member.getMembers', $member_args); |
| 87 | - if($member_output->data) |
|
| 87 | + if ($member_output->data) |
|
| 88 | 88 | { |
| 89 | - foreach($member_output->data as $key => $val) |
|
| 89 | + foreach ($member_output->data as $key => $val) |
|
| 90 | 90 | { |
| 91 | 91 | $output->data[$member_keys[$val->member_srl]] = $val; |
| 92 | 92 | } |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | function read($session_key) |
| 23 | 23 | { |
| 24 | - if(!$session_key || !$this->session_started) return; |
|
| 24 | + if(!$session_key || !$this->session_started) { |
|
| 25 | + return; |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | 28 | $args = new stdClass(); |
| 27 | 29 | $args->session_key = $session_key; |
@@ -51,13 +53,21 @@ discard block |
||
| 51 | 53 | $site_module_info = Context::get('site_module_info'); |
| 52 | 54 | $args->site_srl = (int)$site_module_info->site_srl; |
| 53 | 55 | } |
| 54 | - if(!$args->list_count) $args->list_count = 20; |
|
| 55 | - if(!$args->page) $args->page = 1; |
|
| 56 | - if(!$args->period_time) $args->period_time = 3; |
|
| 56 | + if(!$args->list_count) { |
|
| 57 | + $args->list_count = 20; |
|
| 58 | + } |
|
| 59 | + if(!$args->page) { |
|
| 60 | + $args->page = 1; |
|
| 61 | + } |
|
| 62 | + if(!$args->period_time) { |
|
| 63 | + $args->period_time = 3; |
|
| 64 | + } |
|
| 57 | 65 | $args->last_update = date("YmdHis", $_SERVER['REQUEST_TIME'] - $args->period_time*60); |
| 58 | 66 | |
| 59 | 67 | $output = executeQueryArray('session.getLoggedMembers', $args); |
| 60 | - if(!$output->toBool()) return $output; |
|
| 68 | + if(!$output->toBool()) { |
|
| 69 | + return $output; |
|
| 70 | + } |
|
| 61 | 71 | |
| 62 | 72 | $member_srls = array(); |
| 63 | 73 | $member_keys = array(); |
@@ -80,7 +90,9 @@ discard block |
||
| 80 | 90 | } |
| 81 | 91 | } |
| 82 | 92 | |
| 83 | - if(!count($member_srls)) return $output; |
|
| 93 | + if(!count($member_srls)) { |
|
| 94 | + return $output; |
|
| 95 | + } |
|
| 84 | 96 | |
| 85 | 97 | $member_args->member_srl = implode(',',$member_srls); |
| 86 | 98 | $member_output = executeQueryArray('member.getMembers', $member_args); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
| 164 | 164 | static $theInstance = null; |
| 165 | - if(!$theInstance) |
|
| 165 | + if (!$theInstance) |
|
| 166 | 166 | { |
| 167 | 167 | $theInstance = new Context(); |
| 168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // include ssl action cache file |
| 184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
| 185 | - if(is_readable($this->sslActionCacheFile)) |
|
| 185 | + if (is_readable($this->sslActionCacheFile)) |
|
| 186 | 186 | { |
| 187 | 187 | require($this->sslActionCacheFile); |
| 188 | - if(isset($sslActions)) |
|
| 188 | + if (isset($sslActions)) |
|
| 189 | 189 | { |
| 190 | 190 | $this->ssl_actions = $sslActions; |
| 191 | 191 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | function init() |
| 202 | 202 | { |
| 203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
| 204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 205 | 205 | { |
| 206 | 206 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
| 207 | 207 | |
| 208 | 208 | // If content is not XML JSON, unset |
| 209 | - if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 209 | + if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 210 | 210 | { |
| 211 | 211 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
| 212 | 212 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | $this->_setUploadedArgument(); |
| 229 | 229 | |
| 230 | 230 | $this->loadDBInfo(); |
| 231 | - if($this->db_info->use_sitelock == 'Y') |
|
| 231 | + if ($this->db_info->use_sitelock == 'Y') |
|
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 234 | 234 | |
| 235 | - if(!IpFilter::filter($whitelist)) |
|
| 235 | + if (!IpFilter::filter($whitelist)) |
|
| 236 | 236 | { |
| 237 | 237 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
| 238 | 238 | $message = $this->db_info->sitelock_message; |
@@ -242,52 +242,52 @@ discard block |
||
| 242 | 242 | define('_XE_SITELOCK_MESSAGE_', $message); |
| 243 | 243 | |
| 244 | 244 | header("HTTP/1.1 403 Forbidden"); |
| 245 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 245 | + if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html')) |
|
| 246 | 246 | { |
| 247 | - include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
|
| 247 | + include _XE_PATH_.'common/tpl/sitelock.user.html'; |
|
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | - include _XE_PATH_ . 'common/tpl/sitelock.html'; |
|
| 251 | + include _XE_PATH_.'common/tpl/sitelock.html'; |
|
| 252 | 252 | } |
| 253 | 253 | exit; |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // If XE is installed, get virtual site information |
| 258 | - if(self::isInstalled()) |
|
| 258 | + if (self::isInstalled()) |
|
| 259 | 259 | { |
| 260 | 260 | $oModuleModel = getModel('module'); |
| 261 | 261 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 262 | 262 | |
| 263 | - if(!isset($site_module_info)) |
|
| 263 | + if (!isset($site_module_info)) |
|
| 264 | 264 | { |
| 265 | 265 | $site_module_info = new stdClass(); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
| 269 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 269 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 270 | 270 | { |
| 271 | 271 | $site_module_info->domain = $this->db_info->default_url; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $this->set('site_module_info', $site_module_info); |
| 275 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 275 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 276 | 276 | { |
| 277 | 277 | $this->set('vid', $site_module_info->domain, TRUE); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if(!isset($this->db_info)) |
|
| 280 | + if (!isset($this->db_info)) |
|
| 281 | 281 | { |
| 282 | 282 | $this->db_info = new stdClass(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $this->db_info->lang_type = $site_module_info->default_language; |
| 286 | - if(!$this->db_info->lang_type) |
|
| 286 | + if (!$this->db_info->lang_type) |
|
| 287 | 287 | { |
| 288 | 288 | $this->db_info->lang_type = 'en'; |
| 289 | 289 | } |
| 290 | - if(!$this->db_info->use_db_session) |
|
| 290 | + if (!$this->db_info->use_db_session) |
|
| 291 | 291 | { |
| 292 | 292 | $this->db_info->use_db_session = 'N'; |
| 293 | 293 | } |
@@ -297,30 +297,30 @@ discard block |
||
| 297 | 297 | $lang_supported = $this->loadLangSelected(); |
| 298 | 298 | |
| 299 | 299 | // Retrieve language type set in user's cookie |
| 300 | - if($this->lang_type = $this->get('l')) |
|
| 300 | + if ($this->lang_type = $this->get('l')) |
|
| 301 | 301 | { |
| 302 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
| 302 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
| 303 | 303 | { |
| 304 | 304 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + elseif ($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // If it's not exists, follow default language type set in db_info |
| 313 | - if(!$this->lang_type) |
|
| 313 | + if (!$this->lang_type) |
|
| 314 | 314 | { |
| 315 | 315 | $this->lang_type = $this->db_info->lang_type; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // if still lang_type has not been set or has not-supported type , set as English. |
| 319 | - if(!$this->lang_type) |
|
| 319 | + if (!$this->lang_type) |
|
| 320 | 320 | { |
| 321 | 321 | $this->lang_type = 'en'; |
| 322 | 322 | } |
| 323 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 323 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 324 | 324 | { |
| 325 | 325 | $this->lang_type = 'en'; |
| 326 | 326 | } |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | $this->setLangType($this->lang_type); |
| 330 | 330 | |
| 331 | 331 | // load module module's language file according to language setting |
| 332 | - $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
|
| 332 | + $this->loadLang(_XE_PATH_.'modules/module/lang'); |
|
| 333 | 333 | |
| 334 | 334 | // set session handler |
| 335 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 335 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 336 | 336 | { |
| 337 | 337 | $oSessionModel = getModel('session'); |
| 338 | 338 | $oSessionController = getController('session'); |
@@ -341,11 +341,11 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
| 345 | 345 | session_start(); |
| 346 | 346 | |
| 347 | 347 | // set authentication information in Context and session |
| 348 | - if(self::isInstalled()) |
|
| 348 | + if (self::isInstalled()) |
|
| 349 | 349 | { |
| 350 | 350 | $oModuleModel = getModel('module'); |
| 351 | 351 | $oModuleModel->loadModuleExtends(); |
@@ -353,15 +353,15 @@ discard block |
||
| 353 | 353 | $oMemberModel = getModel('member'); |
| 354 | 354 | $oMemberController = getController('member'); |
| 355 | 355 | |
| 356 | - if($oMemberController && $oMemberModel) |
|
| 356 | + if ($oMemberController && $oMemberModel) |
|
| 357 | 357 | { |
| 358 | 358 | // if signed in, validate it. |
| 359 | - if($oMemberModel->isLogged()) |
|
| 359 | + if ($oMemberModel->isLogged()) |
|
| 360 | 360 | { |
| 361 | 361 | $oMemberController->setSessionInfo(); |
| 362 | 362 | } |
| 363 | 363 | // check auto sign-in |
| 364 | - elseif($_COOKIE['xeak']) |
|
| 364 | + elseif ($_COOKIE['xeak']) |
|
| 365 | 365 | { |
| 366 | 366 | $oMemberController->doAutologin(); |
| 367 | 367 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | // load common language file |
| 375 | 375 | $this->lang = &$GLOBALS['lang']; |
| 376 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
| 376 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
| 377 | 377 | |
| 378 | 378 | // check if using rewrite module |
| 379 | 379 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -381,28 +381,28 @@ discard block |
||
| 381 | 381 | // set locations for javascript use |
| 382 | 382 | $url = array(); |
| 383 | 383 | $current_url = self::getRequestUri(); |
| 384 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 384 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 385 | 385 | { |
| 386 | - if($this->get_vars) |
|
| 386 | + if ($this->get_vars) |
|
| 387 | 387 | { |
| 388 | 388 | $url = array(); |
| 389 | - foreach($this->get_vars as $key => $val) |
|
| 389 | + foreach ($this->get_vars as $key => $val) |
|
| 390 | 390 | { |
| 391 | - if(is_array($val) && count($val) > 0) |
|
| 391 | + if (is_array($val) && count($val) > 0) |
|
| 392 | 392 | { |
| 393 | - foreach($val as $k => $v) |
|
| 393 | + foreach ($val as $k => $v) |
|
| 394 | 394 | { |
| 395 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 395 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | - elseif($val) |
|
| 398 | + elseif ($val) |
|
| 399 | 399 | { |
| 400 | - $url[] = $key . '=' . urlencode($val); |
|
| 400 | + $url[] = $key.'='.urlencode($val); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 405 | + if ($url) $current_url .= '?'.join('&', $url); |
|
| 406 | 406 | } |
| 407 | 407 | else |
| 408 | 408 | { |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | $this->set('current_url', $current_url); |
| 418 | 418 | $this->set('request_uri', self::getRequestUri()); |
| 419 | 419 | |
| 420 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
| 420 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
| 421 | 421 | { |
| 422 | 422 | $this->set('current_url', self::decodeIdna($current_url)); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 425 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 426 | 426 | { |
| 427 | 427 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
| 428 | 428 | } |
@@ -447,19 +447,19 @@ discard block |
||
| 447 | 447 | { |
| 448 | 448 | $self = self::getInstance(); |
| 449 | 449 | |
| 450 | - if(!$self->isInstalled()) |
|
| 450 | + if (!$self->isInstalled()) |
|
| 451 | 451 | { |
| 452 | 452 | return; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $config_file = $self->getConfigFile(); |
| 456 | - if(is_readable($config_file)) |
|
| 456 | + if (is_readable($config_file)) |
|
| 457 | 457 | { |
| 458 | 458 | include($config_file); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | // If master_db information does not exist, the config file needs to be updated |
| 462 | - if(!isset($db_info->master_db)) |
|
| 462 | + if (!isset($db_info->master_db)) |
|
| 463 | 463 | { |
| 464 | 464 | $db_info->master_db = array(); |
| 465 | 465 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 478 | 478 | unset($db_info->db_table_prefix); |
| 479 | 479 | |
| 480 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 480 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 481 | 481 | { |
| 482 | 482 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 483 | 483 | } |
@@ -489,33 +489,33 @@ discard block |
||
| 489 | 489 | $oInstallController->makeConfigFile(); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(!$db_info->use_prepared_statements) |
|
| 492 | + if (!$db_info->use_prepared_statements) |
|
| 493 | 493 | { |
| 494 | 494 | $db_info->use_prepared_statements = 'Y'; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - if(!$db_info->time_zone) |
|
| 497 | + if (!$db_info->time_zone) |
|
| 498 | 498 | $db_info->time_zone = date('O'); |
| 499 | 499 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 500 | 500 | |
| 501 | - if($db_info->qmail_compatibility != 'Y') |
|
| 501 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 502 | 502 | $db_info->qmail_compatibility = 'N'; |
| 503 | 503 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 504 | 504 | |
| 505 | - if(!$db_info->use_db_session) |
|
| 505 | + if (!$db_info->use_db_session) |
|
| 506 | 506 | $db_info->use_db_session = 'N'; |
| 507 | - if(!$db_info->use_ssl) |
|
| 507 | + if (!$db_info->use_ssl) |
|
| 508 | 508 | $db_info->use_ssl = 'none'; |
| 509 | 509 | $this->set('_use_ssl', $db_info->use_ssl); |
| 510 | 510 | |
| 511 | 511 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 512 | 512 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 513 | 513 | |
| 514 | - if(!$db_info->sitelock_whitelist) { |
|
| 514 | + if (!$db_info->sitelock_whitelist) { |
|
| 515 | 515 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 518 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 519 | 519 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 520 | 520 | } |
| 521 | 521 | |
@@ -586,10 +586,10 @@ discard block |
||
| 586 | 586 | function loadLangSupported() |
| 587 | 587 | { |
| 588 | 588 | static $lang_supported = null; |
| 589 | - if(!$lang_supported) |
|
| 589 | + if (!$lang_supported) |
|
| 590 | 590 | { |
| 591 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
| 592 | - foreach($langs as $val) |
|
| 591 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
| 592 | + foreach ($langs as $val) |
|
| 593 | 593 | { |
| 594 | 594 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 595 | 595 | $lang_text = trim($lang_text); |
@@ -607,17 +607,17 @@ discard block |
||
| 607 | 607 | function loadLangSelected() |
| 608 | 608 | { |
| 609 | 609 | static $lang_selected = null; |
| 610 | - if(!$lang_selected) |
|
| 610 | + if (!$lang_selected) |
|
| 611 | 611 | { |
| 612 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
| 613 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
| 614 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 612 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
| 613 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
| 614 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 615 | 615 | { |
| 616 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
| 616 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
| 617 | 617 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 620 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 621 | 621 | { |
| 622 | 622 | $buff = FileHandler::readFile($orig_lang_file); |
| 623 | 623 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | else |
| 627 | 627 | { |
| 628 | 628 | $langs = file($selected_lang_file); |
| 629 | - foreach($langs as $val) |
|
| 629 | + foreach ($langs as $val) |
|
| 630 | 630 | { |
| 631 | 631 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 632 | 632 | $lang_text = trim($lang_text); |
@@ -645,44 +645,44 @@ discard block |
||
| 645 | 645 | function checkSSO() |
| 646 | 646 | { |
| 647 | 647 | // pass if it's not GET request or XE is not yet installed |
| 648 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 648 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 649 | 649 | { |
| 650 | 650 | return TRUE; |
| 651 | 651 | } |
| 652 | 652 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 653 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 653 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 654 | 654 | { |
| 655 | 655 | return TRUE; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // pass if default URL is not set |
| 659 | 659 | $default_url = trim($this->db_info->default_url); |
| 660 | - if(!$default_url) |
|
| 660 | + if (!$default_url) |
|
| 661 | 661 | { |
| 662 | 662 | return TRUE; |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 665 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 666 | 666 | { |
| 667 | 667 | $default_url .= '/'; |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | // for sites recieving SSO valdiation |
| 671 | - if($default_url == self::getRequestUri()) |
|
| 671 | + if ($default_url == self::getRequestUri()) |
|
| 672 | 672 | { |
| 673 | - if(self::get('url')) |
|
| 673 | + if (self::get('url')) |
|
| 674 | 674 | { |
| 675 | 675 | $url = base64_decode(self::get('url')); |
| 676 | 676 | $url_info = parse_url($url); |
| 677 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
| 677 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
| 678 | 678 | { |
| 679 | 679 | echo self::get('lang')->msg_invalid_request; |
| 680 | 680 | return false; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
| 684 | - $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 685 | - header('location:' . $redirect_url); |
|
| 683 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
| 684 | + $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 685 | + header('location:'.$redirect_url); |
|
| 686 | 686 | |
| 687 | 687 | return FALSE; |
| 688 | 688 | } |
@@ -691,9 +691,9 @@ discard block |
||
| 691 | 691 | else |
| 692 | 692 | { |
| 693 | 693 | // result handling : set session_name() |
| 694 | - if($session_name = self::get('SSOID')) |
|
| 694 | + if ($session_name = self::get('SSOID')) |
|
| 695 | 695 | { |
| 696 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
| 696 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
| 697 | 697 | { |
| 698 | 698 | echo self::get('lang')->msg_invalid_request; |
| 699 | 699 | return false; |
@@ -702,17 +702,17 @@ discard block |
||
| 702 | 702 | setcookie(session_name(), $session_name); |
| 703 | 703 | |
| 704 | 704 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
| 705 | - header('location:' . $url); |
|
| 705 | + header('location:'.$url); |
|
| 706 | 706 | return FALSE; |
| 707 | 707 | // send SSO request |
| 708 | 708 | } |
| 709 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 709 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 710 | 710 | { |
| 711 | 711 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
| 712 | 712 | $origin_url = self::getRequestUrl(); |
| 713 | 713 | $origin_sig = Password::createSignature($origin_url); |
| 714 | 714 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
| 715 | - header('location:' . $url); |
|
| 715 | + header('location:'.$url); |
|
| 716 | 716 | return FALSE; |
| 717 | 717 | } |
| 718 | 718 | } |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | { |
| 740 | 740 | $self = self::getInstance(); |
| 741 | 741 | |
| 742 | - if(!$self->isFTPRegisted()) |
|
| 742 | + if (!$self->isFTPRegisted()) |
|
| 743 | 743 | { |
| 744 | 744 | return null; |
| 745 | 745 | } |
@@ -757,15 +757,15 @@ discard block |
||
| 757 | 757 | */ |
| 758 | 758 | function addBrowserTitle($site_title) |
| 759 | 759 | { |
| 760 | - if(!$site_title) |
|
| 760 | + if (!$site_title) |
|
| 761 | 761 | { |
| 762 | 762 | return; |
| 763 | 763 | } |
| 764 | 764 | $self = self::getInstance(); |
| 765 | 765 | |
| 766 | - if($self->site_title) |
|
| 766 | + if ($self->site_title) |
|
| 767 | 767 | { |
| 768 | - $self->site_title .= ' - ' . $site_title; |
|
| 768 | + $self->site_title .= ' - '.$site_title; |
|
| 769 | 769 | } |
| 770 | 770 | else |
| 771 | 771 | { |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | function setBrowserTitle($site_title) |
| 783 | 783 | { |
| 784 | - if(!$site_title) |
|
| 784 | + if (!$site_title) |
|
| 785 | 785 | { |
| 786 | 786 | return; |
| 787 | 787 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | $oModuleModel = getModel('module'); |
| 814 | 814 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 815 | 815 | |
| 816 | - if(isset($moduleConfig->siteTitle)) |
|
| 816 | + if (isset($moduleConfig->siteTitle)) |
|
| 817 | 817 | { |
| 818 | 818 | return $moduleConfig->siteTitle; |
| 819 | 819 | } |
@@ -840,30 +840,30 @@ discard block |
||
| 840 | 840 | global $lang; |
| 841 | 841 | |
| 842 | 842 | $self = self::getInstance(); |
| 843 | - if(!$self->lang_type) |
|
| 843 | + if (!$self->lang_type) |
|
| 844 | 844 | { |
| 845 | 845 | return; |
| 846 | 846 | } |
| 847 | - if(!is_object($lang)) |
|
| 847 | + if (!is_object($lang)) |
|
| 848 | 848 | { |
| 849 | 849 | $lang = new stdClass; |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 852 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 853 | 853 | { |
| 854 | 854 | $filename = $self->_loadPhpLang($path); |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - if(!is_array($self->loaded_lang_files)) |
|
| 857 | + if (!is_array($self->loaded_lang_files)) |
|
| 858 | 858 | { |
| 859 | 859 | $self->loaded_lang_files = array(); |
| 860 | 860 | } |
| 861 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 861 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 862 | 862 | { |
| 863 | 863 | return; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | - if($filename && is_readable($filename)) |
|
| 866 | + if ($filename && is_readable($filename)) |
|
| 867 | 867 | { |
| 868 | 868 | $self->loaded_lang_files[] = $filename; |
| 869 | 869 | include($filename); |
@@ -884,24 +884,24 @@ discard block |
||
| 884 | 884 | { |
| 885 | 885 | global $lang; |
| 886 | 886 | |
| 887 | - if(!$path) return; |
|
| 887 | + if (!$path) return; |
|
| 888 | 888 | |
| 889 | - $_path = 'eval://' . $path; |
|
| 889 | + $_path = 'eval://'.$path; |
|
| 890 | 890 | |
| 891 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 891 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 892 | 892 | { |
| 893 | 893 | return; |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 896 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 897 | 897 | { |
| 898 | 898 | $path .= '/'; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
| 901 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
| 902 | 902 | $content = $oXmlLangParser->getCompileContent(); |
| 903 | 903 | |
| 904 | - if($content) |
|
| 904 | + if ($content) |
|
| 905 | 905 | { |
| 906 | 906 | $this->loaded_lang_files[] = $_path; |
| 907 | 907 | eval($content); |
@@ -916,9 +916,9 @@ discard block |
||
| 916 | 916 | */ |
| 917 | 917 | function _loadXmlLang($path) |
| 918 | 918 | { |
| 919 | - if(!$path) return; |
|
| 919 | + if (!$path) return; |
|
| 920 | 920 | |
| 921 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
| 921 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
| 922 | 922 | return $oXmlLangParser->compile(); |
| 923 | 923 | } |
| 924 | 924 | |
@@ -930,22 +930,22 @@ discard block |
||
| 930 | 930 | */ |
| 931 | 931 | function _loadPhpLang($path) |
| 932 | 932 | { |
| 933 | - if(!$path) return; |
|
| 933 | + if (!$path) return; |
|
| 934 | 934 | |
| 935 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 935 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 936 | 936 | { |
| 937 | 937 | $path .= '/'; |
| 938 | 938 | } |
| 939 | - $path_tpl = $path . '%s.lang.php'; |
|
| 939 | + $path_tpl = $path.'%s.lang.php'; |
|
| 940 | 940 | $file = sprintf($path_tpl, $this->lang_type); |
| 941 | 941 | |
| 942 | 942 | $langs = array('ko', 'en'); // this will be configurable. |
| 943 | - while(!is_readable($file) && $langs[0]) |
|
| 943 | + while (!is_readable($file) && $langs[0]) |
|
| 944 | 944 | { |
| 945 | 945 | $file = sprintf($path_tpl, array_shift($langs)); |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - if(!is_readable($file)) |
|
| 948 | + if (!is_readable($file)) |
|
| 949 | 949 | { |
| 950 | 950 | return FALSE; |
| 951 | 951 | } |
@@ -987,11 +987,11 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | function getLang($code) |
| 989 | 989 | { |
| 990 | - if(!$code) |
|
| 990 | + if (!$code) |
|
| 991 | 991 | { |
| 992 | 992 | return; |
| 993 | 993 | } |
| 994 | - if($GLOBALS['lang']->{$code}) |
|
| 994 | + if ($GLOBALS['lang']->{$code}) |
|
| 995 | 995 | { |
| 996 | 996 | return $GLOBALS['lang']->{$code}; |
| 997 | 997 | } |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | */ |
| 1008 | 1008 | function setLang($code, $val) |
| 1009 | 1009 | { |
| 1010 | - if(!isset($GLOBALS['lang'])) |
|
| 1010 | + if (!isset($GLOBALS['lang'])) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | $GLOBALS['lang'] = new stdClass(); |
| 1013 | 1013 | } |
@@ -1035,17 +1035,17 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | $obj = clone $source_obj; |
| 1037 | 1037 | |
| 1038 | - foreach($charset_list as $charset) |
|
| 1038 | + foreach ($charset_list as $charset) |
|
| 1039 | 1039 | { |
| 1040 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1040 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1041 | 1041 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1042 | - if($flag) |
|
| 1042 | + if ($flag) |
|
| 1043 | 1043 | { |
| 1044 | - if($charset == 'UTF-8') |
|
| 1044 | + if ($charset == 'UTF-8') |
|
| 1045 | 1045 | { |
| 1046 | 1046 | return $obj; |
| 1047 | 1047 | } |
| 1048 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1048 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1049 | 1049 | return $obj; |
| 1050 | 1050 | } |
| 1051 | 1051 | } |
@@ -1064,11 +1064,11 @@ discard block |
||
| 1064 | 1064 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1065 | 1065 | { |
| 1066 | 1066 | static $flag = TRUE; |
| 1067 | - if($charset) |
|
| 1067 | + if ($charset) |
|
| 1068 | 1068 | { |
| 1069 | - if(is_array($val)) |
|
| 1070 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1071 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1069 | + if (is_array($val)) |
|
| 1070 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1071 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1072 | 1072 | else $flag = FALSE; |
| 1073 | 1073 | } |
| 1074 | 1074 | else |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | { |
| 1093 | 1093 | if (is_array($val)) |
| 1094 | 1094 | { |
| 1095 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1095 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1096 | 1096 | } |
| 1097 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1097 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | /** |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | */ |
| 1106 | 1106 | function convertEncodingStr($str) |
| 1107 | 1107 | { |
| 1108 | - if(!$str) return null; |
|
| 1108 | + if (!$str) return null; |
|
| 1109 | 1109 | $obj = new stdClass(); |
| 1110 | 1110 | $obj->str = $str; |
| 1111 | 1111 | $obj = self::convertEncoding($obj); |
@@ -1114,9 +1114,9 @@ discard block |
||
| 1114 | 1114 | |
| 1115 | 1115 | function decodeIdna($domain) |
| 1116 | 1116 | { |
| 1117 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1117 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1118 | 1118 | { |
| 1119 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1119 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1120 | 1120 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1121 | 1121 | $domain = $IDN->decode($domain); |
| 1122 | 1122 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | { |
| 1148 | 1148 | $self = self::getInstance(); |
| 1149 | 1149 | |
| 1150 | - if($self->response_method) |
|
| 1150 | + if ($self->response_method) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | return $self->response_method; |
| 1153 | 1153 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1188 | 1188 | |
| 1189 | 1189 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1190 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1190 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1191 | 1191 | { |
| 1192 | 1192 | $this->isSuccessInit = FALSE; |
| 1193 | 1193 | } |
@@ -1200,30 +1200,30 @@ discard block |
||
| 1200 | 1200 | */ |
| 1201 | 1201 | function _setRequestArgument() |
| 1202 | 1202 | { |
| 1203 | - if(!count($_REQUEST)) |
|
| 1203 | + if (!count($_REQUEST)) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | return; |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | $requestMethod = $this->getRequestMethod(); |
| 1209 | - foreach($_REQUEST as $key => $val) |
|
| 1209 | + foreach ($_REQUEST as $key => $val) |
|
| 1210 | 1210 | { |
| 1211 | - if($val === '' || self::get($key)) |
|
| 1211 | + if ($val === '' || self::get($key)) |
|
| 1212 | 1212 | { |
| 1213 | 1213 | continue; |
| 1214 | 1214 | } |
| 1215 | 1215 | $key = htmlentities($key); |
| 1216 | 1216 | $val = $this->_filterRequestVar($key, $val); |
| 1217 | 1217 | |
| 1218 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1218 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1219 | 1219 | { |
| 1220 | 1220 | $set_to_vars = TRUE; |
| 1221 | 1221 | } |
| 1222 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1222 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1223 | 1223 | { |
| 1224 | 1224 | $set_to_vars = TRUE; |
| 1225 | 1225 | } |
| 1226 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1226 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1227 | 1227 | { |
| 1228 | 1228 | $set_to_vars = TRUE; |
| 1229 | 1229 | } |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | $set_to_vars = FALSE; |
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | - if($set_to_vars) |
|
| 1235 | + if ($set_to_vars) |
|
| 1236 | 1236 | { |
| 1237 | 1237 | $this->_recursiveCheckVar($val); |
| 1238 | 1238 | } |
@@ -1243,20 +1243,20 @@ discard block |
||
| 1243 | 1243 | |
| 1244 | 1244 | function _recursiveCheckVar($val) |
| 1245 | 1245 | { |
| 1246 | - if(is_string($val)) |
|
| 1246 | + if (is_string($val)) |
|
| 1247 | 1247 | { |
| 1248 | - foreach($this->patterns as $pattern) |
|
| 1248 | + foreach ($this->patterns as $pattern) |
|
| 1249 | 1249 | { |
| 1250 | - if(preg_match($pattern, $val)) |
|
| 1250 | + if (preg_match($pattern, $val)) |
|
| 1251 | 1251 | { |
| 1252 | 1252 | $this->isSuccessInit = FALSE; |
| 1253 | 1253 | return; |
| 1254 | 1254 | } |
| 1255 | 1255 | } |
| 1256 | 1256 | } |
| 1257 | - else if(is_array($val)) |
|
| 1257 | + else if (is_array($val)) |
|
| 1258 | 1258 | { |
| 1259 | - foreach($val as $val2) |
|
| 1259 | + foreach ($val as $val2) |
|
| 1260 | 1260 | { |
| 1261 | 1261 | $this->_recursiveCheckVar($val2); |
| 1262 | 1262 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | */ |
| 1271 | 1271 | function _setJSONRequestArgument() |
| 1272 | 1272 | { |
| 1273 | - if($this->getRequestMethod() != 'JSON') |
|
| 1273 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1274 | 1274 | { |
| 1275 | 1275 | return; |
| 1276 | 1276 | } |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | $params = array(); |
| 1279 | 1279 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1280 | 1280 | |
| 1281 | - foreach($params as $key => $val) |
|
| 1281 | + foreach ($params as $key => $val) |
|
| 1282 | 1282 | { |
| 1283 | 1283 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
| 1284 | 1284 | } |
@@ -1291,13 +1291,13 @@ discard block |
||
| 1291 | 1291 | */ |
| 1292 | 1292 | function _setXmlRpcArgument() |
| 1293 | 1293 | { |
| 1294 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1294 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1295 | 1295 | { |
| 1296 | 1296 | return; |
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1300 | - if(Security::detectingXEE($xml)) |
|
| 1300 | + if (Security::detectingXEE($xml)) |
|
| 1301 | 1301 | { |
| 1302 | 1302 | header("HTTP/1.0 400 Bad Request"); |
| 1303 | 1303 | exit; |
@@ -1309,12 +1309,12 @@ discard block |
||
| 1309 | 1309 | $params = $xml_obj->methodcall->params; |
| 1310 | 1310 | unset($params->node_name, $params->attrs, $params->body); |
| 1311 | 1311 | |
| 1312 | - if(!count(get_object_vars($params))) |
|
| 1312 | + if (!count(get_object_vars($params))) |
|
| 1313 | 1313 | { |
| 1314 | 1314 | return; |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | - foreach($params as $key => $val) |
|
| 1317 | + foreach ($params as $key => $val) |
|
| 1318 | 1318 | { |
| 1319 | 1319 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1320 | 1320 | } |
@@ -1329,10 +1329,10 @@ discard block |
||
| 1329 | 1329 | */ |
| 1330 | 1330 | function _filterXmlVars($key, $val) |
| 1331 | 1331 | { |
| 1332 | - if(is_array($val)) |
|
| 1332 | + if (is_array($val)) |
|
| 1333 | 1333 | { |
| 1334 | 1334 | $stack = array(); |
| 1335 | - foreach($val as $k => $v) |
|
| 1335 | + foreach ($val as $k => $v) |
|
| 1336 | 1336 | { |
| 1337 | 1337 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1338 | 1338 | } |
@@ -1342,20 +1342,20 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | $body = $val->body; |
| 1344 | 1344 | unset($val->node_name, $val->attrs, $val->body); |
| 1345 | - if(!count(get_object_vars($val))) |
|
| 1345 | + if (!count(get_object_vars($val))) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | return $this->_filterRequestVar($key, $body, 0); |
| 1348 | 1348 | } |
| 1349 | 1349 | |
| 1350 | 1350 | $stack = new stdClass(); |
| 1351 | - foreach($val as $k => $v) |
|
| 1351 | + foreach ($val as $k => $v) |
|
| 1352 | 1352 | { |
| 1353 | 1353 | $output = $this->_filterXmlVars($k, $v); |
| 1354 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1354 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1355 | 1355 | { |
| 1356 | 1356 | $output = array($output); |
| 1357 | 1357 | } |
| 1358 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1358 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1359 | 1359 | { |
| 1360 | 1360 | return $output; |
| 1361 | 1361 | } |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | $stack->{$k} = $output; |
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | - if(!count(get_object_vars($stack))) |
|
| 1366 | + if (!count(get_object_vars($stack))) |
|
| 1367 | 1367 | { |
| 1368 | 1368 | return NULL; |
| 1369 | 1369 | } |
@@ -1382,32 +1382,32 @@ discard block |
||
| 1382 | 1382 | */ |
| 1383 | 1383 | function _filterRequestVar($key, $val, $do_stripslashes = 1) |
| 1384 | 1384 | { |
| 1385 | - if(!($isArray = is_array($val))) |
|
| 1385 | + if (!($isArray = is_array($val))) |
|
| 1386 | 1386 | { |
| 1387 | 1387 | $val = array($val); |
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | $result = array(); |
| 1391 | - foreach($val as $k => $v) |
|
| 1391 | + foreach ($val as $k => $v) |
|
| 1392 | 1392 | { |
| 1393 | 1393 | $k = htmlentities($k); |
| 1394 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1394 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1395 | 1395 | { |
| 1396 | 1396 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1397 | 1397 | } |
| 1398 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1398 | + elseif ($key === 'mid' || $key === 'search_keyword') |
|
| 1399 | 1399 | { |
| 1400 | 1400 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1401 | 1401 | } |
| 1402 | - elseif($key === 'vid') |
|
| 1402 | + elseif ($key === 'vid') |
|
| 1403 | 1403 | { |
| 1404 | 1404 | $result[$k] = urlencode($v); |
| 1405 | 1405 | } |
| 1406 | - elseif($key === 'xe_validator_id') |
|
| 1406 | + elseif ($key === 'xe_validator_id') |
|
| 1407 | 1407 | { |
| 1408 | 1408 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1409 | 1409 | } |
| 1410 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1410 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1411 | 1411 | { |
| 1412 | 1412 | unset($result[$k]); |
| 1413 | 1413 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
| 1415 | 1415 | { |
| 1416 | 1416 | $result[$k] = $v; |
| 1417 | 1417 | |
| 1418 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1418 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1419 | 1419 | { |
| 1420 | 1420 | if (is_array($result[$k])) |
| 1421 | 1421 | { |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | } |
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | - if(is_array($result[$k])) |
|
| 1430 | + if (is_array($result[$k])) |
|
| 1431 | 1431 | { |
| 1432 | 1432 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1433 | 1433 | } |
@@ -1459,17 +1459,17 @@ discard block |
||
| 1459 | 1459 | */ |
| 1460 | 1460 | function _setUploadedArgument() |
| 1461 | 1461 | { |
| 1462 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1462 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1463 | 1463 | { |
| 1464 | 1464 | return; |
| 1465 | 1465 | } |
| 1466 | 1466 | |
| 1467 | - foreach($_FILES as $key => $val) |
|
| 1467 | + foreach ($_FILES as $key => $val) |
|
| 1468 | 1468 | { |
| 1469 | 1469 | $tmp_name = $val['tmp_name']; |
| 1470 | - if(!is_array($tmp_name)) |
|
| 1470 | + if (!is_array($tmp_name)) |
|
| 1471 | 1471 | { |
| 1472 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1472 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1473 | 1473 | { |
| 1474 | 1474 | continue; |
| 1475 | 1475 | } |
@@ -1479,9 +1479,9 @@ discard block |
||
| 1479 | 1479 | } |
| 1480 | 1480 | else |
| 1481 | 1481 | { |
| 1482 | - for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1482 | + for ($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1483 | 1483 | { |
| 1484 | - if($val['size'][$i] > 0) |
|
| 1484 | + if ($val['size'][$i] > 0) |
|
| 1485 | 1485 | { |
| 1486 | 1486 | $file['name'] = $val['name'][$i]; |
| 1487 | 1487 | $file['type'] = $val['type'][$i]; |
@@ -1513,16 +1513,16 @@ discard block |
||
| 1513 | 1513 | function getRequestUrl() |
| 1514 | 1514 | { |
| 1515 | 1515 | static $url = null; |
| 1516 | - if(is_null($url)) |
|
| 1516 | + if (is_null($url)) |
|
| 1517 | 1517 | { |
| 1518 | 1518 | $url = self::getRequestUri(); |
| 1519 | - if(count($_GET) > 0) |
|
| 1519 | + if (count($_GET) > 0) |
|
| 1520 | 1520 | { |
| 1521 | - foreach($_GET as $key => $val) |
|
| 1521 | + foreach ($_GET as $key => $val) |
|
| 1522 | 1522 | { |
| 1523 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1523 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1524 | 1524 | } |
| 1525 | - $url .= '?' . join('&', $vars); |
|
| 1525 | + $url .= '?'.join('&', $vars); |
|
| 1526 | 1526 | } |
| 1527 | 1527 | } |
| 1528 | 1528 | return $url; |
@@ -1537,7 +1537,7 @@ discard block |
||
| 1537 | 1537 | $self = self::getInstance(); |
| 1538 | 1538 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1539 | 1539 | |
| 1540 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1540 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1541 | 1541 | { |
| 1542 | 1542 | unset($js_callback_func); |
| 1543 | 1543 | unset($_GET['xe_js_callback']); |
@@ -1565,22 +1565,22 @@ discard block |
||
| 1565 | 1565 | $self = self::getInstance(); |
| 1566 | 1566 | |
| 1567 | 1567 | // retrieve virtual site information |
| 1568 | - if(is_null($site_module_info)) |
|
| 1568 | + if (is_null($site_module_info)) |
|
| 1569 | 1569 | { |
| 1570 | 1570 | $site_module_info = self::get('site_module_info'); |
| 1571 | 1571 | } |
| 1572 | 1572 | |
| 1573 | 1573 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1574 | - if($domain && isSiteID($domain)) |
|
| 1574 | + if ($domain && isSiteID($domain)) |
|
| 1575 | 1575 | { |
| 1576 | 1576 | $vid = $domain; |
| 1577 | 1577 | $domain = ''; |
| 1578 | 1578 | } |
| 1579 | 1579 | |
| 1580 | 1580 | // If $domain, $vid are not set, use current site information |
| 1581 | - if(!$domain && !$vid) |
|
| 1581 | + if (!$domain && !$vid) |
|
| 1582 | 1582 | { |
| 1583 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1583 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1584 | 1584 | { |
| 1585 | 1585 | $vid = $site_module_info->domain; |
| 1586 | 1586 | } |
@@ -1591,21 +1591,21 @@ discard block |
||
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | 1593 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1594 | - if($domain) |
|
| 1594 | + if ($domain) |
|
| 1595 | 1595 | { |
| 1596 | 1596 | $domain_info = parse_url($domain); |
| 1597 | - if(is_null($current_info)) |
|
| 1597 | + if (is_null($current_info)) |
|
| 1598 | 1598 | { |
| 1599 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
| 1599 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
| 1600 | 1600 | } |
| 1601 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1601 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
| 1602 | 1602 | { |
| 1603 | 1603 | unset($domain); |
| 1604 | 1604 | } |
| 1605 | 1605 | else |
| 1606 | 1606 | { |
| 1607 | 1607 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1608 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1608 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1609 | 1609 | { |
| 1610 | 1610 | $domain .= '/'; |
| 1611 | 1611 | } |
@@ -1615,10 +1615,10 @@ discard block |
||
| 1615 | 1615 | $get_vars = array(); |
| 1616 | 1616 | |
| 1617 | 1617 | // If there is no GET variables or first argument is '' to reset variables |
| 1618 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1618 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1619 | 1619 | { |
| 1620 | 1620 | // rearrange args_list |
| 1621 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1621 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1622 | 1622 | { |
| 1623 | 1623 | array_shift($args_list); |
| 1624 | 1624 | } |
@@ -1630,13 +1630,13 @@ discard block |
||
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | // arrange args_list |
| 1633 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1633 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1634 | 1634 | { |
| 1635 | 1635 | $key = $args_list[$i]; |
| 1636 | 1636 | $val = trim($args_list[$i + 1]); |
| 1637 | 1637 | |
| 1638 | 1638 | // If value is not set, remove the key |
| 1639 | - if(!isset($val) || !strlen($val)) |
|
| 1639 | + if (!isset($val) || !strlen($val)) |
|
| 1640 | 1640 | { |
| 1641 | 1641 | unset($get_vars[$key]); |
| 1642 | 1642 | continue; |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | |
| 1648 | 1648 | // remove vid, rnd |
| 1649 | 1649 | unset($get_vars['rnd']); |
| 1650 | - if($vid) |
|
| 1650 | + if ($vid) |
|
| 1651 | 1651 | { |
| 1652 | 1652 | $get_vars['vid'] = $vid; |
| 1653 | 1653 | } |
@@ -1664,17 +1664,17 @@ discard block |
||
| 1664 | 1664 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1665 | 1665 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1666 | 1666 | ); |
| 1667 | - if($act_alias[$act]) |
|
| 1667 | + if ($act_alias[$act]) |
|
| 1668 | 1668 | { |
| 1669 | 1669 | $get_vars['act'] = $act_alias[$act]; |
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | // organize URL |
| 1673 | 1673 | $query = ''; |
| 1674 | - if(count($get_vars) > 0) |
|
| 1674 | + if (count($get_vars) > 0) |
|
| 1675 | 1675 | { |
| 1676 | 1676 | // if using rewrite mod |
| 1677 | - if($self->allow_rewrite) |
|
| 1677 | + if ($self->allow_rewrite) |
|
| 1678 | 1678 | { |
| 1679 | 1679 | $var_keys = array_keys($get_vars); |
| 1680 | 1680 | sort($var_keys); |
@@ -1694,8 +1694,8 @@ discard block |
||
| 1694 | 1694 | 'vid' => $vid, |
| 1695 | 1695 | 'mid' => $mid, |
| 1696 | 1696 | 'mid.vid' => "$vid/$mid", |
| 1697 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
| 1698 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
| 1697 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
| 1698 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
| 1699 | 1699 | 'document_srl' => $srl, |
| 1700 | 1700 | 'document_srl.mid' => "$mid/$srl", |
| 1701 | 1701 | 'document_srl.vid' => "$vid/$srl", |
@@ -1712,66 +1712,66 @@ discard block |
||
| 1712 | 1712 | $query = $target_map[$target]; |
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | - if(!$query) |
|
| 1715 | + if (!$query) |
|
| 1716 | 1716 | { |
| 1717 | 1717 | $queries = array(); |
| 1718 | - foreach($get_vars as $key => $val) |
|
| 1718 | + foreach ($get_vars as $key => $val) |
|
| 1719 | 1719 | { |
| 1720 | - if(is_array($val) && count($val) > 0) |
|
| 1720 | + if (is_array($val) && count($val) > 0) |
|
| 1721 | 1721 | { |
| 1722 | - foreach($val as $k => $v) |
|
| 1722 | + foreach ($val as $k => $v) |
|
| 1723 | 1723 | { |
| 1724 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 1724 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
| 1725 | 1725 | } |
| 1726 | 1726 | } |
| 1727 | - elseif(!is_array($val)) |
|
| 1727 | + elseif (!is_array($val)) |
|
| 1728 | 1728 | { |
| 1729 | - $queries[] = $key . '=' . urlencode($val); |
|
| 1729 | + $queries[] = $key.'='.urlencode($val); |
|
| 1730 | 1730 | } |
| 1731 | 1731 | } |
| 1732 | - if(count($queries) > 0) |
|
| 1732 | + if (count($queries) > 0) |
|
| 1733 | 1733 | { |
| 1734 | - $query = 'index.php?' . join('&', $queries); |
|
| 1734 | + $query = 'index.php?'.join('&', $queries); |
|
| 1735 | 1735 | } |
| 1736 | 1736 | } |
| 1737 | 1737 | } |
| 1738 | 1738 | |
| 1739 | 1739 | // If using SSL always |
| 1740 | 1740 | $_use_ssl = $self->get('_use_ssl'); |
| 1741 | - if($_use_ssl == 'always') |
|
| 1741 | + if ($_use_ssl == 'always') |
|
| 1742 | 1742 | { |
| 1743 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1743 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1744 | 1744 | // optional SSL use |
| 1745 | 1745 | } |
| 1746 | - elseif($_use_ssl == 'optional') |
|
| 1746 | + elseif ($_use_ssl == 'optional') |
|
| 1747 | 1747 | { |
| 1748 | 1748 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1749 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
| 1749 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
| 1750 | 1750 | // no SSL |
| 1751 | 1751 | } |
| 1752 | 1752 | else |
| 1753 | 1753 | { |
| 1754 | 1754 | // currently on SSL but target is not based on SSL |
| 1755 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1755 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1756 | 1756 | { |
| 1757 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1757 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1758 | 1758 | } |
| 1759 | - else if($domain) // if $domain is set |
|
| 1759 | + else if ($domain) // if $domain is set |
|
| 1760 | 1760 | { |
| 1761 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
| 1761 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
| 1762 | 1762 | } |
| 1763 | 1763 | else |
| 1764 | 1764 | { |
| 1765 | - $query = getScriptPath() . $query; |
|
| 1765 | + $query = getScriptPath().$query; |
|
| 1766 | 1766 | } |
| 1767 | 1767 | } |
| 1768 | 1768 | |
| 1769 | - if(!$encode) |
|
| 1769 | + if (!$encode) |
|
| 1770 | 1770 | { |
| 1771 | 1771 | return $query; |
| 1772 | 1772 | } |
| 1773 | 1773 | |
| 1774 | - if(!$autoEncode) |
|
| 1774 | + if (!$autoEncode) |
|
| 1775 | 1775 | { |
| 1776 | 1776 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1777 | 1777 | } |
@@ -1780,16 +1780,16 @@ discard block |
||
| 1780 | 1780 | $encode_queries = array(); |
| 1781 | 1781 | $parsedUrl = parse_url($query); |
| 1782 | 1782 | parse_str($parsedUrl['query'], $output); |
| 1783 | - foreach($output as $key => $value) |
|
| 1783 | + foreach ($output as $key => $value) |
|
| 1784 | 1784 | { |
| 1785 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1785 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1786 | 1786 | { |
| 1787 | 1787 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1788 | 1788 | } |
| 1789 | - $encode_queries[] = $key . '=' . $value; |
|
| 1789 | + $encode_queries[] = $key.'='.$value; |
|
| 1790 | 1790 | } |
| 1791 | 1791 | |
| 1792 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1792 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1793 | 1793 | } |
| 1794 | 1794 | |
| 1795 | 1795 | /** |
@@ -1804,17 +1804,17 @@ discard block |
||
| 1804 | 1804 | static $url = array(); |
| 1805 | 1805 | |
| 1806 | 1806 | // Check HTTP Request |
| 1807 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1807 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1808 | 1808 | { |
| 1809 | 1809 | return; |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | - if(self::get('_use_ssl') == 'always') |
|
| 1812 | + if (self::get('_use_ssl') == 'always') |
|
| 1813 | 1813 | { |
| 1814 | 1814 | $ssl_mode = ENFORCE_SSL; |
| 1815 | 1815 | } |
| 1816 | 1816 | |
| 1817 | - if($domain) |
|
| 1817 | + if ($domain) |
|
| 1818 | 1818 | { |
| 1819 | 1819 | $domain_key = md5($domain); |
| 1820 | 1820 | } |
@@ -1823,14 +1823,14 @@ discard block |
||
| 1823 | 1823 | $domain_key = 'default'; |
| 1824 | 1824 | } |
| 1825 | 1825 | |
| 1826 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1826 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1827 | 1827 | { |
| 1828 | 1828 | return $url[$ssl_mode][$domain_key]; |
| 1829 | 1829 | } |
| 1830 | 1830 | |
| 1831 | 1831 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1832 | 1832 | |
| 1833 | - switch($ssl_mode) |
|
| 1833 | + switch ($ssl_mode) |
|
| 1834 | 1834 | { |
| 1835 | 1835 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1836 | 1836 | break; |
@@ -1840,34 +1840,34 @@ discard block |
||
| 1840 | 1840 | break; |
| 1841 | 1841 | } |
| 1842 | 1842 | |
| 1843 | - if($domain) |
|
| 1843 | + if ($domain) |
|
| 1844 | 1844 | { |
| 1845 | 1845 | $target_url = trim($domain); |
| 1846 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1846 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1847 | 1847 | { |
| 1848 | - $target_url.= '/'; |
|
| 1848 | + $target_url .= '/'; |
|
| 1849 | 1849 | } |
| 1850 | 1850 | } |
| 1851 | 1851 | else |
| 1852 | 1852 | { |
| 1853 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
| 1853 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | - $url_info = parse_url('http://' . $target_url); |
|
| 1856 | + $url_info = parse_url('http://'.$target_url); |
|
| 1857 | 1857 | |
| 1858 | - if($current_use_ssl != $use_ssl) |
|
| 1858 | + if ($current_use_ssl != $use_ssl) |
|
| 1859 | 1859 | { |
| 1860 | 1860 | unset($url_info['port']); |
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | - if($use_ssl) |
|
| 1863 | + if ($use_ssl) |
|
| 1864 | 1864 | { |
| 1865 | 1865 | $port = self::get('_https_port'); |
| 1866 | - if($port && $port != 443) |
|
| 1866 | + if ($port && $port != 443) |
|
| 1867 | 1867 | { |
| 1868 | 1868 | $url_info['port'] = $port; |
| 1869 | 1869 | } |
| 1870 | - elseif($url_info['port'] == 443) |
|
| 1870 | + elseif ($url_info['port'] == 443) |
|
| 1871 | 1871 | { |
| 1872 | 1872 | unset($url_info['port']); |
| 1873 | 1873 | } |
@@ -1875,17 +1875,17 @@ discard block |
||
| 1875 | 1875 | else |
| 1876 | 1876 | { |
| 1877 | 1877 | $port = self::get('_http_port'); |
| 1878 | - if($port && $port != 80) |
|
| 1878 | + if ($port && $port != 80) |
|
| 1879 | 1879 | { |
| 1880 | 1880 | $url_info['port'] = $port; |
| 1881 | 1881 | } |
| 1882 | - elseif($url_info['port'] == 80) |
|
| 1882 | + elseif ($url_info['port'] == 80) |
|
| 1883 | 1883 | { |
| 1884 | 1884 | unset($url_info['port']); |
| 1885 | 1885 | } |
| 1886 | 1886 | } |
| 1887 | 1887 | |
| 1888 | - $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); |
|
| 1888 | + $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']); |
|
| 1889 | 1889 | |
| 1890 | 1890 | return $url[$ssl_mode][$domain_key]; |
| 1891 | 1891 | } |
@@ -1902,16 +1902,16 @@ discard block |
||
| 1902 | 1902 | { |
| 1903 | 1903 | $self = self::getInstance(); |
| 1904 | 1904 | $self->context->{$key} = $val; |
| 1905 | - if($set_to_get_vars === FALSE) |
|
| 1905 | + if ($set_to_get_vars === FALSE) |
|
| 1906 | 1906 | { |
| 1907 | 1907 | return; |
| 1908 | 1908 | } |
| 1909 | - if($val === NULL || $val === '') |
|
| 1909 | + if ($val === NULL || $val === '') |
|
| 1910 | 1910 | { |
| 1911 | 1911 | unset($self->get_vars->{$key}); |
| 1912 | 1912 | return; |
| 1913 | 1913 | } |
| 1914 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1914 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1915 | 1915 | { |
| 1916 | 1916 | $self->get_vars->{$key} = $val; |
| 1917 | 1917 | } |
@@ -1927,7 +1927,7 @@ discard block |
||
| 1927 | 1927 | { |
| 1928 | 1928 | $self = self::getInstance(); |
| 1929 | 1929 | |
| 1930 | - if(!isset($self->context->{$key})) |
|
| 1930 | + if (!isset($self->context->{$key})) |
|
| 1931 | 1931 | { |
| 1932 | 1932 | return null; |
| 1933 | 1933 | } |
@@ -1942,7 +1942,7 @@ discard block |
||
| 1942 | 1942 | function gets() |
| 1943 | 1943 | { |
| 1944 | 1944 | $num_args = func_num_args(); |
| 1945 | - if($num_args < 1) |
|
| 1945 | + if ($num_args < 1) |
|
| 1946 | 1946 | { |
| 1947 | 1947 | return; |
| 1948 | 1948 | } |
@@ -1950,7 +1950,7 @@ discard block |
||
| 1950 | 1950 | |
| 1951 | 1951 | $args_list = func_get_args(); |
| 1952 | 1952 | $output = new stdClass(); |
| 1953 | - foreach($args_list as $v) |
|
| 1953 | + foreach ($args_list as $v) |
|
| 1954 | 1954 | { |
| 1955 | 1955 | $output->{$v} = $self->get($v); |
| 1956 | 1956 | } |
@@ -1976,7 +1976,7 @@ discard block |
||
| 1976 | 1976 | function getRequestVars() |
| 1977 | 1977 | { |
| 1978 | 1978 | $self = self::getInstance(); |
| 1979 | - if($self->get_vars) |
|
| 1979 | + if ($self->get_vars) |
|
| 1980 | 1980 | { |
| 1981 | 1981 | return clone($self->get_vars); |
| 1982 | 1982 | } |
@@ -1993,13 +1993,13 @@ discard block |
||
| 1993 | 1993 | { |
| 1994 | 1994 | $self = self::getInstance(); |
| 1995 | 1995 | |
| 1996 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 1996 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 1997 | 1997 | { |
| 1998 | 1998 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 1999 | 1999 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2000 | 2000 | } |
| 2001 | 2001 | |
| 2002 | - if(!isset($self->ssl_actions[$action])) |
|
| 2002 | + if (!isset($self->ssl_actions[$action])) |
|
| 2003 | 2003 | { |
| 2004 | 2004 | $self->ssl_actions[$action] = 1; |
| 2005 | 2005 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2017,16 +2017,16 @@ discard block |
||
| 2017 | 2017 | { |
| 2018 | 2018 | $self = self::getInstance(); |
| 2019 | 2019 | |
| 2020 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2020 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2021 | 2021 | { |
| 2022 | 2022 | unset($self->ssl_actions); |
| 2023 | 2023 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2024 | 2024 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | - foreach($action_array as $action) |
|
| 2027 | + foreach ($action_array as $action) |
|
| 2028 | 2028 | { |
| 2029 | - if(!isset($self->ssl_actions[$action])) |
|
| 2029 | + if (!isset($self->ssl_actions[$action])) |
|
| 2030 | 2030 | { |
| 2031 | 2031 | $self->ssl_actions[$action] = 1; |
| 2032 | 2032 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2045,7 +2045,7 @@ discard block |
||
| 2045 | 2045 | { |
| 2046 | 2046 | $self = self::getInstance(); |
| 2047 | 2047 | |
| 2048 | - if($self->isExistsSSLAction($action)) |
|
| 2048 | + if ($self->isExistsSSLAction($action)) |
|
| 2049 | 2049 | { |
| 2050 | 2050 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2051 | 2051 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2062,7 +2062,7 @@ discard block |
||
| 2062 | 2062 | function getSSLActions() |
| 2063 | 2063 | { |
| 2064 | 2064 | $self = self::getInstance(); |
| 2065 | - if($self->getSslStatus() == 'optional') |
|
| 2065 | + if ($self->getSslStatus() == 'optional') |
|
| 2066 | 2066 | { |
| 2067 | 2067 | return $self->ssl_actions; |
| 2068 | 2068 | } |
@@ -2089,12 +2089,12 @@ discard block |
||
| 2089 | 2089 | */ |
| 2090 | 2090 | function normalizeFilePath($file) |
| 2091 | 2091 | { |
| 2092 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2092 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2093 | 2093 | { |
| 2094 | - $file = './' . $file; |
|
| 2094 | + $file = './'.$file; |
|
| 2095 | 2095 | } |
| 2096 | 2096 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2097 | - while(strpos($file, '/../') !== FALSE) |
|
| 2097 | + while (strpos($file, '/../') !== FALSE) |
|
| 2098 | 2098 | { |
| 2099 | 2099 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2100 | 2100 | } |
@@ -2113,13 +2113,13 @@ discard block |
||
| 2113 | 2113 | { |
| 2114 | 2114 | $file = self::normalizeFilePath($file); |
| 2115 | 2115 | $script_path = getScriptPath(); |
| 2116 | - if(strpos($file, './') === 0) |
|
| 2116 | + if (strpos($file, './') === 0) |
|
| 2117 | 2117 | { |
| 2118 | - $file = $script_path . substr($file, 2); |
|
| 2118 | + $file = $script_path.substr($file, 2); |
|
| 2119 | 2119 | } |
| 2120 | - elseif(strpos($file, '../') === 0) |
|
| 2120 | + elseif (strpos($file, '../') === 0) |
|
| 2121 | 2121 | { |
| 2122 | - $file = self::normalizeFilePath($script_path . $file); |
|
| 2122 | + $file = self::normalizeFilePath($script_path.$file); |
|
| 2123 | 2123 | } |
| 2124 | 2124 | |
| 2125 | 2125 | return $file; |
@@ -2189,12 +2189,12 @@ discard block |
||
| 2189 | 2189 | */ |
| 2190 | 2190 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2191 | 2191 | { |
| 2192 | - if($isRuleset) |
|
| 2192 | + if ($isRuleset) |
|
| 2193 | 2193 | { |
| 2194 | - if(strpos($file, '#') !== FALSE) |
|
| 2194 | + if (strpos($file, '#') !== FALSE) |
|
| 2195 | 2195 | { |
| 2196 | 2196 | $file = str_replace('#', '', $file); |
| 2197 | - if(!is_readable($file)) |
|
| 2197 | + if (!is_readable($file)) |
|
| 2198 | 2198 | { |
| 2199 | 2199 | $file = $autoPath; |
| 2200 | 2200 | } |
@@ -2259,9 +2259,9 @@ discard block |
||
| 2259 | 2259 | ksort($files); |
| 2260 | 2260 | $files = array_values($files); |
| 2261 | 2261 | $filenames = array(); |
| 2262 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2262 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2263 | 2263 | { |
| 2264 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2264 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2265 | 2265 | { |
| 2266 | 2266 | unset($files[$i]); |
| 2267 | 2267 | } |
@@ -2346,14 +2346,14 @@ discard block |
||
| 2346 | 2346 | */ |
| 2347 | 2347 | function getJavascriptPluginInfo($pluginName) |
| 2348 | 2348 | { |
| 2349 | - if($plugin_name == 'ui.datepicker') |
|
| 2349 | + if ($plugin_name == 'ui.datepicker') |
|
| 2350 | 2350 | { |
| 2351 | 2351 | $plugin_name = 'ui'; |
| 2352 | 2352 | } |
| 2353 | 2353 | |
| 2354 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
| 2355 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2356 | - if(!is_readable($info_file)) |
|
| 2354 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
| 2355 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2356 | + if (!is_readable($info_file)) |
|
| 2357 | 2357 | { |
| 2358 | 2358 | return; |
| 2359 | 2359 | } |
@@ -2363,32 +2363,32 @@ discard block |
||
| 2363 | 2363 | $result->jsList = array(); |
| 2364 | 2364 | $result->cssList = array(); |
| 2365 | 2365 | |
| 2366 | - foreach($list as $filename) |
|
| 2366 | + foreach ($list as $filename) |
|
| 2367 | 2367 | { |
| 2368 | 2368 | $filename = trim($filename); |
| 2369 | - if(!$filename) |
|
| 2369 | + if (!$filename) |
|
| 2370 | 2370 | { |
| 2371 | 2371 | continue; |
| 2372 | 2372 | } |
| 2373 | 2373 | |
| 2374 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2374 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2375 | 2375 | { |
| 2376 | 2376 | $filename = substr($filename, 2); |
| 2377 | 2377 | } |
| 2378 | 2378 | |
| 2379 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2379 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2380 | 2380 | { |
| 2381 | - $result->jsList[] = $plugin_path . $filename; |
|
| 2381 | + $result->jsList[] = $plugin_path.$filename; |
|
| 2382 | 2382 | } |
| 2383 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2383 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2384 | 2384 | { |
| 2385 | - $result->cssList[] = $plugin_path . $filename; |
|
| 2385 | + $result->cssList[] = $plugin_path.$filename; |
|
| 2386 | 2386 | } |
| 2387 | 2387 | } |
| 2388 | 2388 | |
| 2389 | - if(is_dir($plugin_path . 'lang')) |
|
| 2389 | + if (is_dir($plugin_path.'lang')) |
|
| 2390 | 2390 | { |
| 2391 | - $result->langPath = $plugin_path . 'lang'; |
|
| 2391 | + $result->langPath = $plugin_path.'lang'; |
|
| 2392 | 2392 | } |
| 2393 | 2393 | |
| 2394 | 2394 | return $result; |
@@ -2404,50 +2404,50 @@ discard block |
||
| 2404 | 2404 | static $loaded_plugins = array(); |
| 2405 | 2405 | |
| 2406 | 2406 | $self = self::getInstance(); |
| 2407 | - if($plugin_name == 'ui.datepicker') |
|
| 2407 | + if ($plugin_name == 'ui.datepicker') |
|
| 2408 | 2408 | { |
| 2409 | 2409 | $plugin_name = 'ui'; |
| 2410 | 2410 | } |
| 2411 | 2411 | |
| 2412 | - if($loaded_plugins[$plugin_name]) |
|
| 2412 | + if ($loaded_plugins[$plugin_name]) |
|
| 2413 | 2413 | { |
| 2414 | 2414 | return; |
| 2415 | 2415 | } |
| 2416 | 2416 | $loaded_plugins[$plugin_name] = TRUE; |
| 2417 | 2417 | |
| 2418 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
| 2419 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2420 | - if(!is_readable($info_file)) |
|
| 2418 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
| 2419 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2420 | + if (!is_readable($info_file)) |
|
| 2421 | 2421 | { |
| 2422 | 2422 | return; |
| 2423 | 2423 | } |
| 2424 | 2424 | |
| 2425 | 2425 | $list = file($info_file); |
| 2426 | - foreach($list as $filename) |
|
| 2426 | + foreach ($list as $filename) |
|
| 2427 | 2427 | { |
| 2428 | 2428 | $filename = trim($filename); |
| 2429 | - if(!$filename) |
|
| 2429 | + if (!$filename) |
|
| 2430 | 2430 | { |
| 2431 | 2431 | continue; |
| 2432 | 2432 | } |
| 2433 | 2433 | |
| 2434 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2434 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2435 | 2435 | { |
| 2436 | 2436 | $filename = substr($filename, 2); |
| 2437 | 2437 | } |
| 2438 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2438 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2439 | 2439 | { |
| 2440 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
| 2440 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
| 2441 | 2441 | } |
| 2442 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2442 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2443 | 2443 | { |
| 2444 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
| 2444 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
| 2445 | 2445 | } |
| 2446 | 2446 | } |
| 2447 | 2447 | |
| 2448 | - if(is_dir($plugin_path . 'lang')) |
|
| 2448 | + if (is_dir($plugin_path.'lang')) |
|
| 2449 | 2449 | { |
| 2450 | - $self->loadLang($plugin_path . 'lang'); |
|
| 2450 | + $self->loadLang($plugin_path.'lang'); |
|
| 2451 | 2451 | } |
| 2452 | 2452 | } |
| 2453 | 2453 | |
@@ -2460,7 +2460,7 @@ discard block |
||
| 2460 | 2460 | function addHtmlHeader($header) |
| 2461 | 2461 | { |
| 2462 | 2462 | $self = self::getInstance(); |
| 2463 | - $self->html_header .= "\n" . $header; |
|
| 2463 | + $self->html_header .= "\n".$header; |
|
| 2464 | 2464 | } |
| 2465 | 2465 | |
| 2466 | 2466 | function clearHtmlHeader() |
@@ -2512,7 +2512,7 @@ discard block |
||
| 2512 | 2512 | function addBodyHeader($header) |
| 2513 | 2513 | { |
| 2514 | 2514 | $self = self::getInstance(); |
| 2515 | - $self->body_header .= "\n" . $header; |
|
| 2515 | + $self->body_header .= "\n".$header; |
|
| 2516 | 2516 | } |
| 2517 | 2517 | |
| 2518 | 2518 | /** |
@@ -2534,7 +2534,7 @@ discard block |
||
| 2534 | 2534 | function addHtmlFooter($footer) |
| 2535 | 2535 | { |
| 2536 | 2536 | $self = self::getInstance(); |
| 2537 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
| 2537 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
| 2538 | 2538 | } |
| 2539 | 2539 | |
| 2540 | 2540 | /** |
@@ -2555,7 +2555,7 @@ discard block |
||
| 2555 | 2555 | */ |
| 2556 | 2556 | function getConfigFile() |
| 2557 | 2557 | { |
| 2558 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
| 2558 | + return _XE_PATH_.'files/config/db.config.php'; |
|
| 2559 | 2559 | } |
| 2560 | 2560 | |
| 2561 | 2561 | /** |
@@ -2565,7 +2565,7 @@ discard block |
||
| 2565 | 2565 | */ |
| 2566 | 2566 | function getFTPConfigFile() |
| 2567 | 2567 | { |
| 2568 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
| 2568 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
| 2569 | 2569 | } |
| 2570 | 2570 | |
| 2571 | 2571 | /** |
@@ -2617,14 +2617,14 @@ discard block |
||
| 2617 | 2617 | $_path = explode('/', $path); |
| 2618 | 2618 | $_base = explode('/', $base_url); |
| 2619 | 2619 | |
| 2620 | - if(!$_base[count($_base) - 1]) |
|
| 2620 | + if (!$_base[count($_base) - 1]) |
|
| 2621 | 2621 | { |
| 2622 | 2622 | array_pop($_base); |
| 2623 | 2623 | } |
| 2624 | 2624 | |
| 2625 | - foreach($_xe as $idx => $dir) |
|
| 2625 | + foreach ($_xe as $idx => $dir) |
|
| 2626 | 2626 | { |
| 2627 | - if($_path[0] != $dir) |
|
| 2627 | + if ($_path[0] != $dir) |
|
| 2628 | 2628 | { |
| 2629 | 2629 | break; |
| 2630 | 2630 | } |
@@ -2632,9 +2632,9 @@ discard block |
||
| 2632 | 2632 | } |
| 2633 | 2633 | |
| 2634 | 2634 | $idx = count($_xe) - $idx - 1; |
| 2635 | - while($idx--) |
|
| 2635 | + while ($idx--) |
|
| 2636 | 2636 | { |
| 2637 | - if(count($_base) > 0) |
|
| 2637 | + if (count($_base) > 0) |
|
| 2638 | 2638 | { |
| 2639 | 2639 | array_shift($_base); |
| 2640 | 2640 | } |
@@ -2644,13 +2644,13 @@ discard block |
||
| 2644 | 2644 | } |
| 2645 | 2645 | } |
| 2646 | 2646 | |
| 2647 | - if(count($_base) > 0) |
|
| 2647 | + if (count($_base) > 0) |
|
| 2648 | 2648 | { |
| 2649 | 2649 | array_unshift($_path, join('/', $_base)); |
| 2650 | 2650 | } |
| 2651 | 2651 | |
| 2652 | - $path = '/' . join('/', $_path); |
|
| 2653 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2652 | + $path = '/'.join('/', $_path); |
|
| 2653 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2654 | 2654 | { |
| 2655 | 2655 | $path .= '/'; |
| 2656 | 2656 | } |
@@ -2665,13 +2665,13 @@ discard block |
||
| 2665 | 2665 | { |
| 2666 | 2666 | $self = self::getInstance(); |
| 2667 | 2667 | |
| 2668 | - if(!is_array($self->meta_tags)) |
|
| 2668 | + if (!is_array($self->meta_tags)) |
|
| 2669 | 2669 | { |
| 2670 | 2670 | $self->meta_tags = array(); |
| 2671 | 2671 | } |
| 2672 | 2672 | |
| 2673 | 2673 | $ret = array(); |
| 2674 | - foreach($self->meta_tags as $key => $val) |
|
| 2674 | + foreach ($self->meta_tags as $key => $val) |
|
| 2675 | 2675 | { |
| 2676 | 2676 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2677 | 2677 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2691,7 +2691,7 @@ discard block |
||
| 2691 | 2691 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
| 2692 | 2692 | { |
| 2693 | 2693 | $self = self::getInstance(); |
| 2694 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
| 2694 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
| 2695 | 2695 | } |
| 2696 | 2696 | |
| 2697 | 2697 | } |
@@ -230,7 +230,9 @@ discard block |
||
| 230 | 230 | $this->loadDBInfo(); |
| 231 | 231 | if($this->db_info->use_sitelock == 'Y') |
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if(is_array($this->db_info->sitelock_whitelist)) { |
|
| 234 | + $whitelist = $this->db_info->sitelock_whitelist; |
|
| 235 | + } |
|
| 234 | 236 | |
| 235 | 237 | if(!IpFilter::filter($whitelist)) |
| 236 | 238 | { |
@@ -245,8 +247,7 @@ discard block |
||
| 245 | 247 | if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
| 246 | 248 | { |
| 247 | 249 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
| 248 | - } |
|
| 249 | - else |
|
| 250 | + } else |
|
| 250 | 251 | { |
| 251 | 252 | include _XE_PATH_ . 'common/tpl/sitelock.html'; |
| 252 | 253 | } |
@@ -303,8 +304,7 @@ discard block |
||
| 303 | 304 | { |
| 304 | 305 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); |
| 305 | 306 | } |
| 306 | - } |
|
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + } elseif($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
@@ -341,7 +341,9 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if($sess = $_POST[session_name()]) { |
|
| 345 | + session_id($sess); |
|
| 346 | + } |
|
| 345 | 347 | session_start(); |
| 346 | 348 | |
| 347 | 349 | // set authentication information in Context and session |
@@ -394,22 +396,21 @@ discard block |
||
| 394 | 396 | { |
| 395 | 397 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
| 396 | 398 | } |
| 397 | - } |
|
| 398 | - elseif($val) |
|
| 399 | + } elseif($val) |
|
| 399 | 400 | { |
| 400 | 401 | $url[] = $key . '=' . urlencode($val); |
| 401 | 402 | } |
| 402 | 403 | } |
| 403 | 404 | |
| 404 | 405 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 406 | - } |
|
| 407 | - else |
|
| 406 | + if($url) { |
|
| 407 | + $current_url .= '?' . join('&', $url); |
|
| 408 | + } |
|
| 409 | + } else |
|
| 408 | 410 | { |
| 409 | 411 | $current_url = $this->getUrl(); |
| 410 | 412 | } |
| 411 | - } |
|
| 412 | - else |
|
| 413 | + } else |
|
| 413 | 414 | { |
| 414 | 415 | $current_url = self::getRequestUri(); |
| 415 | 416 | } |
@@ -494,18 +495,22 @@ discard block |
||
| 494 | 495 | $db_info->use_prepared_statements = 'Y'; |
| 495 | 496 | } |
| 496 | 497 | |
| 497 | - if(!$db_info->time_zone) |
|
| 498 | - $db_info->time_zone = date('O'); |
|
| 498 | + if(!$db_info->time_zone) { |
|
| 499 | + $db_info->time_zone = date('O'); |
|
| 500 | + } |
|
| 499 | 501 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 500 | 502 | |
| 501 | - if($db_info->qmail_compatibility != 'Y') |
|
| 502 | - $db_info->qmail_compatibility = 'N'; |
|
| 503 | + if($db_info->qmail_compatibility != 'Y') { |
|
| 504 | + $db_info->qmail_compatibility = 'N'; |
|
| 505 | + } |
|
| 503 | 506 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 504 | 507 | |
| 505 | - if(!$db_info->use_db_session) |
|
| 506 | - $db_info->use_db_session = 'N'; |
|
| 507 | - if(!$db_info->use_ssl) |
|
| 508 | - $db_info->use_ssl = 'none'; |
|
| 508 | + if(!$db_info->use_db_session) { |
|
| 509 | + $db_info->use_db_session = 'N'; |
|
| 510 | + } |
|
| 511 | + if(!$db_info->use_ssl) { |
|
| 512 | + $db_info->use_ssl = 'none'; |
|
| 513 | + } |
|
| 509 | 514 | $this->set('_use_ssl', $db_info->use_ssl); |
| 510 | 515 | |
| 511 | 516 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
@@ -622,8 +627,7 @@ discard block |
||
| 622 | 627 | $buff = FileHandler::readFile($orig_lang_file); |
| 623 | 628 | FileHandler::writeFile($selected_lang_file, $buff); |
| 624 | 629 | $lang_selected = self::loadLangSupported(); |
| 625 | - } |
|
| 626 | - else |
|
| 630 | + } else |
|
| 627 | 631 | { |
| 628 | 632 | $langs = file($selected_lang_file); |
| 629 | 633 | foreach($langs as $val) |
@@ -687,8 +691,7 @@ discard block |
||
| 687 | 691 | return FALSE; |
| 688 | 692 | } |
| 689 | 693 | // for sites requesting SSO validation |
| 690 | - } |
|
| 691 | - else |
|
| 694 | + } else |
|
| 692 | 695 | { |
| 693 | 696 | // result handling : set session_name() |
| 694 | 697 | if($session_name = self::get('SSOID')) |
@@ -705,8 +708,7 @@ discard block |
||
| 705 | 708 | header('location:' . $url); |
| 706 | 709 | return FALSE; |
| 707 | 710 | // send SSO request |
| 708 | - } |
|
| 709 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 711 | + } else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 710 | 712 | { |
| 711 | 713 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
| 712 | 714 | $origin_url = self::getRequestUrl(); |
@@ -766,8 +768,7 @@ discard block |
||
| 766 | 768 | if($self->site_title) |
| 767 | 769 | { |
| 768 | 770 | $self->site_title .= ' - ' . $site_title; |
| 769 | - } |
|
| 770 | - else |
|
| 771 | + } else |
|
| 771 | 772 | { |
| 772 | 773 | $self->site_title = $site_title; |
| 773 | 774 | } |
@@ -867,8 +868,7 @@ discard block |
||
| 867 | 868 | { |
| 868 | 869 | $self->loaded_lang_files[] = $filename; |
| 869 | 870 | include($filename); |
| 870 | - } |
|
| 871 | - else |
|
| 871 | + } else |
|
| 872 | 872 | { |
| 873 | 873 | $self->_evalxmlLang($path); |
| 874 | 874 | } |
@@ -884,7 +884,9 @@ discard block |
||
| 884 | 884 | { |
| 885 | 885 | global $lang; |
| 886 | 886 | |
| 887 | - if(!$path) return; |
|
| 887 | + if(!$path) { |
|
| 888 | + return; |
|
| 889 | + } |
|
| 888 | 890 | |
| 889 | 891 | $_path = 'eval://' . $path; |
| 890 | 892 | |
@@ -916,7 +918,9 @@ discard block |
||
| 916 | 918 | */ |
| 917 | 919 | function _loadXmlLang($path) |
| 918 | 920 | { |
| 919 | - if(!$path) return; |
|
| 921 | + if(!$path) { |
|
| 922 | + return; |
|
| 923 | + } |
|
| 920 | 924 | |
| 921 | 925 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
| 922 | 926 | return $oXmlLangParser->compile(); |
@@ -930,7 +934,9 @@ discard block |
||
| 930 | 934 | */ |
| 931 | 935 | function _loadPhpLang($path) |
| 932 | 936 | { |
| 933 | - if(!$path) return; |
|
| 937 | + if(!$path) { |
|
| 938 | + return; |
|
| 939 | + } |
|
| 934 | 940 | |
| 935 | 941 | if(substr_compare($path, '/', -1) !== 0) |
| 936 | 942 | { |
@@ -1066,12 +1072,14 @@ discard block |
||
| 1066 | 1072 | static $flag = TRUE; |
| 1067 | 1073 | if($charset) |
| 1068 | 1074 | { |
| 1069 | - if(is_array($val)) |
|
| 1070 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1071 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1072 | - else $flag = FALSE; |
|
| 1073 | - } |
|
| 1074 | - else |
|
| 1075 | + if(is_array($val)) { |
|
| 1076 | + array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1077 | + } else if($val && iconv($charset,$charset,$val)!=$val) { |
|
| 1078 | + $flag = FALSE; |
|
| 1079 | + } else { |
|
| 1080 | + $flag = FALSE; |
|
| 1081 | + } |
|
| 1082 | + } else |
|
| 1075 | 1083 | { |
| 1076 | 1084 | $return = $flag; |
| 1077 | 1085 | $flag = TRUE; |
@@ -1093,8 +1101,9 @@ discard block |
||
| 1093 | 1101 | if (is_array($val)) |
| 1094 | 1102 | { |
| 1095 | 1103 | array_walk($val,'Context::doConvertEncoding',$charset); |
| 1104 | + } else { |
|
| 1105 | + $val = iconv($charset,'UTF-8',$val); |
|
| 1096 | 1106 | } |
| 1097 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1098 | 1107 | } |
| 1099 | 1108 | |
| 1100 | 1109 | /** |
@@ -1105,7 +1114,9 @@ discard block |
||
| 1105 | 1114 | */ |
| 1106 | 1115 | function convertEncodingStr($str) |
| 1107 | 1116 | { |
| 1108 | - if(!$str) return null; |
|
| 1117 | + if(!$str) { |
|
| 1118 | + return null; |
|
| 1119 | + } |
|
| 1109 | 1120 | $obj = new stdClass(); |
| 1110 | 1121 | $obj->str = $str; |
| 1111 | 1122 | $obj = self::convertEncoding($obj); |
@@ -1218,16 +1229,13 @@ discard block |
||
| 1218 | 1229 | if($requestMethod == 'GET' && isset($_GET[$key])) |
| 1219 | 1230 | { |
| 1220 | 1231 | $set_to_vars = TRUE; |
| 1221 | - } |
|
| 1222 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1232 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1223 | 1233 | { |
| 1224 | 1234 | $set_to_vars = TRUE; |
| 1225 | - } |
|
| 1226 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1235 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1227 | 1236 | { |
| 1228 | 1237 | $set_to_vars = TRUE; |
| 1229 | - } |
|
| 1230 | - else |
|
| 1238 | + } else |
|
| 1231 | 1239 | { |
| 1232 | 1240 | $set_to_vars = FALSE; |
| 1233 | 1241 | } |
@@ -1253,8 +1261,7 @@ discard block |
||
| 1253 | 1261 | return; |
| 1254 | 1262 | } |
| 1255 | 1263 | } |
| 1256 | - } |
|
| 1257 | - else if(is_array($val)) |
|
| 1264 | + } else if(is_array($val)) |
|
| 1258 | 1265 | { |
| 1259 | 1266 | foreach($val as $val2) |
| 1260 | 1267 | { |
@@ -1394,24 +1401,19 @@ discard block |
||
| 1394 | 1401 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
| 1395 | 1402 | { |
| 1396 | 1403 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1397 | - } |
|
| 1398 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1404 | + } elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1399 | 1405 | { |
| 1400 | 1406 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1401 | - } |
|
| 1402 | - elseif($key === 'vid') |
|
| 1407 | + } elseif($key === 'vid') |
|
| 1403 | 1408 | { |
| 1404 | 1409 | $result[$k] = urlencode($v); |
| 1405 | - } |
|
| 1406 | - elseif($key === 'xe_validator_id') |
|
| 1410 | + } elseif($key === 'xe_validator_id') |
|
| 1407 | 1411 | { |
| 1408 | 1412 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1409 | - } |
|
| 1410 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1413 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1411 | 1414 | { |
| 1412 | 1415 | unset($result[$k]); |
| 1413 | - } |
|
| 1414 | - else |
|
| 1416 | + } else |
|
| 1415 | 1417 | { |
| 1416 | 1418 | $result[$k] = $v; |
| 1417 | 1419 | |
@@ -1420,8 +1422,7 @@ discard block |
||
| 1420 | 1422 | if (is_array($result[$k])) |
| 1421 | 1423 | { |
| 1422 | 1424 | array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); |
| 1423 | - } |
|
| 1424 | - else |
|
| 1425 | + } else |
|
| 1425 | 1426 | { |
| 1426 | 1427 | $result[$k] = stripslashes($result[$k]); |
| 1427 | 1428 | } |
@@ -1430,8 +1431,7 @@ discard block |
||
| 1430 | 1431 | if(is_array($result[$k])) |
| 1431 | 1432 | { |
| 1432 | 1433 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1433 | - } |
|
| 1434 | - else |
|
| 1434 | + } else |
|
| 1435 | 1435 | { |
| 1436 | 1436 | $result[$k] = trim($result[$k]); |
| 1437 | 1437 | } |
@@ -1476,8 +1476,7 @@ discard block |
||
| 1476 | 1476 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1477 | 1477 | $this->set($key, $val, TRUE); |
| 1478 | 1478 | $this->is_uploaded = TRUE; |
| 1479 | - } |
|
| 1480 | - else |
|
| 1479 | + } else |
|
| 1481 | 1480 | { |
| 1482 | 1481 | for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
| 1483 | 1482 | { |
@@ -1583,8 +1582,7 @@ discard block |
||
| 1583 | 1582 | if($site_module_info->domain && isSiteID($site_module_info->domain)) |
| 1584 | 1583 | { |
| 1585 | 1584 | $vid = $site_module_info->domain; |
| 1586 | - } |
|
| 1587 | - else |
|
| 1585 | + } else |
|
| 1588 | 1586 | { |
| 1589 | 1587 | $domain = $site_module_info->domain; |
| 1590 | 1588 | } |
@@ -1601,8 +1599,7 @@ discard block |
||
| 1601 | 1599 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
| 1602 | 1600 | { |
| 1603 | 1601 | unset($domain); |
| 1604 | - } |
|
| 1605 | - else |
|
| 1602 | + } else |
|
| 1606 | 1603 | { |
| 1607 | 1604 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1608 | 1605 | if(substr_compare($domain, '/', -1) !== 0) |
@@ -1622,8 +1619,7 @@ discard block |
||
| 1622 | 1619 | { |
| 1623 | 1620 | array_shift($args_list); |
| 1624 | 1621 | } |
| 1625 | - } |
|
| 1626 | - else |
|
| 1622 | + } else |
|
| 1627 | 1623 | { |
| 1628 | 1624 | // Otherwise, make GET variables into array |
| 1629 | 1625 | $get_vars = get_object_vars($self->get_vars); |
@@ -1650,8 +1646,7 @@ discard block |
||
| 1650 | 1646 | if($vid) |
| 1651 | 1647 | { |
| 1652 | 1648 | $get_vars['vid'] = $vid; |
| 1653 | - } |
|
| 1654 | - else |
|
| 1649 | + } else |
|
| 1655 | 1650 | { |
| 1656 | 1651 | unset($get_vars['vid']); |
| 1657 | 1652 | } |
@@ -1723,8 +1718,7 @@ discard block |
||
| 1723 | 1718 | { |
| 1724 | 1719 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
| 1725 | 1720 | } |
| 1726 | - } |
|
| 1727 | - elseif(!is_array($val)) |
|
| 1721 | + } elseif(!is_array($val)) |
|
| 1728 | 1722 | { |
| 1729 | 1723 | $queries[] = $key . '=' . urlencode($val); |
| 1730 | 1724 | } |
@@ -1742,25 +1736,23 @@ discard block |
||
| 1742 | 1736 | { |
| 1743 | 1737 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1744 | 1738 | // optional SSL use |
| 1745 | - } |
|
| 1746 | - elseif($_use_ssl == 'optional') |
|
| 1739 | + } elseif($_use_ssl == 'optional') |
|
| 1747 | 1740 | { |
| 1748 | 1741 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1749 | 1742 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
| 1750 | 1743 | // no SSL |
| 1751 | - } |
|
| 1752 | - else |
|
| 1744 | + } else |
|
| 1753 | 1745 | { |
| 1754 | 1746 | // currently on SSL but target is not based on SSL |
| 1755 | 1747 | if($_SERVER['HTTPS'] == 'on') |
| 1756 | 1748 | { |
| 1757 | 1749 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1758 | - } |
|
| 1759 | - else if($domain) // if $domain is set |
|
| 1750 | + } else if($domain) { |
|
| 1751 | + // if $domain is set |
|
| 1760 | 1752 | { |
| 1761 | 1753 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
| 1762 | 1754 | } |
| 1763 | - else |
|
| 1755 | + } else |
|
| 1764 | 1756 | { |
| 1765 | 1757 | $query = getScriptPath() . $query; |
| 1766 | 1758 | } |
@@ -1817,8 +1809,7 @@ discard block |
||
| 1817 | 1809 | if($domain) |
| 1818 | 1810 | { |
| 1819 | 1811 | $domain_key = md5($domain); |
| 1820 | - } |
|
| 1821 | - else |
|
| 1812 | + } else |
|
| 1822 | 1813 | { |
| 1823 | 1814 | $domain_key = 'default'; |
| 1824 | 1815 | } |
@@ -1847,8 +1838,7 @@ discard block |
||
| 1847 | 1838 | { |
| 1848 | 1839 | $target_url.= '/'; |
| 1849 | 1840 | } |
| 1850 | - } |
|
| 1851 | - else |
|
| 1841 | + } else |
|
| 1852 | 1842 | { |
| 1853 | 1843 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
| 1854 | 1844 | } |
@@ -1866,20 +1856,17 @@ discard block |
||
| 1866 | 1856 | if($port && $port != 443) |
| 1867 | 1857 | { |
| 1868 | 1858 | $url_info['port'] = $port; |
| 1869 | - } |
|
| 1870 | - elseif($url_info['port'] == 443) |
|
| 1859 | + } elseif($url_info['port'] == 443) |
|
| 1871 | 1860 | { |
| 1872 | 1861 | unset($url_info['port']); |
| 1873 | 1862 | } |
| 1874 | - } |
|
| 1875 | - else |
|
| 1863 | + } else |
|
| 1876 | 1864 | { |
| 1877 | 1865 | $port = self::get('_http_port'); |
| 1878 | 1866 | if($port && $port != 80) |
| 1879 | 1867 | { |
| 1880 | 1868 | $url_info['port'] = $port; |
| 1881 | - } |
|
| 1882 | - elseif($url_info['port'] == 80) |
|
| 1869 | + } elseif($url_info['port'] == 80) |
|
| 1883 | 1870 | { |
| 1884 | 1871 | unset($url_info['port']); |
| 1885 | 1872 | } |
@@ -2116,8 +2103,7 @@ discard block |
||
| 2116 | 2103 | if(strpos($file, './') === 0) |
| 2117 | 2104 | { |
| 2118 | 2105 | $file = $script_path . substr($file, 2); |
| 2119 | - } |
|
| 2120 | - elseif(strpos($file, '../') === 0) |
|
| 2106 | + } elseif(strpos($file, '../') === 0) |
|
| 2121 | 2107 | { |
| 2122 | 2108 | $file = self::normalizeFilePath($script_path . $file); |
| 2123 | 2109 | } |
@@ -2379,8 +2365,7 @@ discard block |
||
| 2379 | 2365 | if(substr_compare($filename, '.js', -3) === 0) |
| 2380 | 2366 | { |
| 2381 | 2367 | $result->jsList[] = $plugin_path . $filename; |
| 2382 | - } |
|
| 2383 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2368 | + } elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2384 | 2369 | { |
| 2385 | 2370 | $result->cssList[] = $plugin_path . $filename; |
| 2386 | 2371 | } |
@@ -2637,8 +2622,7 @@ discard block |
||
| 2637 | 2622 | if(count($_base) > 0) |
| 2638 | 2623 | { |
| 2639 | 2624 | array_shift($_base); |
| 2640 | - } |
|
| 2641 | - else |
|
| 2625 | + } else |
|
| 2642 | 2626 | { |
| 2643 | 2627 | array_unshift($_base, '..'); |
| 2644 | 2628 | } |