@@ -238,6 +238,7 @@ |
||
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * @brief AutoSave |
| 241 | + * @param stdClass $args |
|
| 241 | 242 | */ |
| 242 | 243 | function doSaveDoc($args) |
| 243 | 244 | { |
@@ -47,28 +47,28 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if (!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 51 | 51 | |
| 52 | 52 | $oEditorModel = getModel('editor'); |
| 53 | 53 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 54 | + if (!$oComponent->toBool()) return $oComponent; |
|
| 55 | 55 | |
| 56 | - if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 56 | + if (!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 57 | 57 | |
| 58 | 58 | //$output = call_user_method($method, $oComponent); |
| 59 | 59 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 60 | + if (method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | + else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
| 62 | 62 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 63 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 64 | 64 | |
| 65 | 65 | $this->setError($oComponent->getError()); |
| 66 | 66 | $this->setMessage($oComponent->getMessage()); |
| 67 | 67 | |
| 68 | 68 | $vars = $oComponent->getVariables(); |
| 69 | - if(count($vars)) |
|
| 69 | + if (count($vars)) |
|
| 70 | 70 | { |
| 71 | - foreach($vars as $key => $val) |
|
| 71 | + foreach ($vars as $key => $val) |
|
| 72 | 72 | { |
| 73 | 73 | $this->add($key, $val); |
| 74 | 74 | } |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | $module_srl = array(); |
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | |
| 89 | - foreach($target_module_srl as $srl) |
|
| 89 | + foreach ($target_module_srl as $srl) |
|
| 90 | 90 | { |
| 91 | - if(!$srl) continue; |
|
| 91 | + if (!$srl) continue; |
|
| 92 | 92 | |
| 93 | 93 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | - if(!$module_info->module_srl) |
|
| 94 | + if (!$module_info->module_srl) |
|
| 95 | 95 | { |
| 96 | 96 | return new BaseObject(-1, 'msg_invalid_request'); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $module_grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 100 | - if(!$module_grant->manager) |
|
| 100 | + if (!$module_grant->manager) |
|
| 101 | 101 | { |
| 102 | 102 | return new BaseObject(-1, 'msg_not_permitted'); |
| 103 | 103 | } |
@@ -111,32 +111,32 @@ discard block |
||
| 111 | 111 | $editor_config->content_style = Context::get('content_style'); |
| 112 | 112 | $editor_config->comment_content_style = Context::get('comment_content_style'); |
| 113 | 113 | $editor_config->content_font = Context::get('content_font'); |
| 114 | - if($editor_config->content_font) |
|
| 114 | + if ($editor_config->content_font) |
|
| 115 | 115 | { |
| 116 | 116 | $font_list = array(); |
| 117 | - $fonts = explode(',',$editor_config->content_font); |
|
| 118 | - for($i=0,$c=count($fonts);$i<$c;$i++) |
|
| 117 | + $fonts = explode(',', $editor_config->content_font); |
|
| 118 | + for ($i = 0, $c = count($fonts); $i < $c; $i++) |
|
| 119 | 119 | { |
| 120 | - $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
|
| 121 | - if(!$font) continue; |
|
| 120 | + $font = trim(str_replace(array('"', '\''), '', $fonts[$i])); |
|
| 121 | + if (!$font) continue; |
|
| 122 | 122 | $font_list[] = $font; |
| 123 | 123 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 124 | + if (count($font_list)) $editor_config->content_font = '"'.implode('","', $font_list).'"'; |
|
| 125 | 125 | } |
| 126 | 126 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 127 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
| 128 | 128 | $editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset'); |
| 129 | 129 | |
| 130 | - $grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant'); |
|
| 130 | + $grants = array('enable_html_grant', 'enable_comment_html_grant', 'upload_file_grant', 'comment_upload_file_grant', 'enable_default_component_grant', 'enable_comment_default_component_grant', 'enable_component_grant', 'enable_comment_component_grant'); |
|
| 131 | 131 | |
| 132 | - foreach($grants as $key) |
|
| 132 | + foreach ($grants as $key) |
|
| 133 | 133 | { |
| 134 | 134 | $grant = Context::get($key); |
| 135 | - if(!$grant) |
|
| 135 | + if (!$grant) |
|
| 136 | 136 | { |
| 137 | 137 | $editor_config->{$key} = array(); |
| 138 | 138 | } |
| 139 | - else if(is_array($grant)) |
|
| 139 | + else if (is_array($grant)) |
|
| 140 | 140 | { |
| 141 | 141 | $editor_config->{$key} = $grant; |
| 142 | 142 | } |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $editor_config->editor_height = (int)Context::get('editor_height'); |
|
| 150 | - $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
|
| 149 | + $editor_config->editor_height = (int) Context::get('editor_height'); |
|
| 150 | + $editor_config->comment_editor_height = (int) Context::get('comment_editor_height'); |
|
| 151 | 151 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 152 | + if ($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 153 | 153 | |
| 154 | 154 | $oModuleController = getController('module'); |
| 155 | - foreach($module_srl as $srl) |
|
| 155 | + foreach ($module_srl as $srl) |
|
| 156 | 156 | { |
| 157 | 157 | $oModuleController->insertModulePartConfig('editor', $srl, $editor_config); |
| 158 | 158 | } |
@@ -169,31 +169,31 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function triggerEditorComponentCompile(&$content) |
| 171 | 171 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 172 | + if (Context::getResponseMethod() != 'HTML') return new BaseObject(); |
|
| 173 | 173 | |
| 174 | 174 | $module_info = Context::get('module_info'); |
| 175 | 175 | $module_srl = $module_info->module_srl; |
| 176 | - if($module_srl) |
|
| 176 | + if ($module_srl) |
|
| 177 | 177 | { |
| 178 | 178 | $oEditorModel = getModel('editor'); |
| 179 | 179 | $editor_config = $oEditorModel->getEditorConfig($module_srl); |
| 180 | 180 | $content_style = $editor_config->content_style; |
| 181 | - if($content_style) |
|
| 181 | + if ($content_style) |
|
| 182 | 182 | { |
| 183 | - $path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | - if(is_dir($path) && file_exists($path . 'style.ini')) |
|
| 183 | + $path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | + if (is_dir($path) && file_exists($path.'style.ini')) |
|
| 185 | 185 | { |
| 186 | 186 | $ini = file($path.'style.ini'); |
| 187 | - for($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 187 | + for ($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 188 | 188 | { |
| 189 | 189 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 190 | + if (!$file) continue; |
|
| 191 | 191 | |
| 192 | - if(substr_compare($file, '.css', -4) === 0) |
|
| 192 | + if (substr_compare($file, '.css', -4) === 0) |
|
| 193 | 193 | { |
| 194 | 194 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | 195 | } |
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 196 | + elseif (substr_compare($file, '.js', -3) === 0) |
|
| 197 | 197 | { |
| 198 | 198 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 199 | } |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | $content_font = $editor_config->content_font; |
| 204 | 204 | $content_font_size = $editor_config->content_font_size; |
| 205 | - if($content_font || $content_font_size) |
|
| 205 | + if ($content_font || $content_font_size) |
|
| 206 | 206 | { |
| 207 | 207 | $buff = array(); |
| 208 | 208 | $buff[] = '<style> .xe_content { '; |
| 209 | - if($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | - if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 209 | + if ($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | + if ($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 211 | 211 | $buff[] = ' }</style>'; |
| 212 | 212 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 213 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | function transComponent($content) |
| 224 | 224 | { |
| 225 | - $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content); |
|
| 225 | + $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this, 'transEditorComponent'), $content); |
|
| 226 | 226 | return $content; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -237,19 +237,19 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $xml_obj = new stdClass; |
| 239 | 239 | $xml_obj->attrs = new stdClass; |
| 240 | - for($i=0,$c=count($m[0]);$i<$c;$i++) |
|
| 240 | + for ($i = 0, $c = count($m[0]); $i < $c; $i++) |
|
| 241 | 241 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 242 | + if (!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 243 | 243 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 244 | } |
| 245 | 245 | $xml_obj->body = $match[4]; |
| 246 | 246 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 247 | + if (!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 248 | 248 | |
| 249 | 249 | // Get converted codes by using component::transHTML() |
| 250 | 250 | $oEditorModel = getModel('editor'); |
| 251 | 251 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 252 | + if (!is_object($oComponent) || !method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 253 | 253 | |
| 254 | 254 | return $oComponent->transHTML($xml_obj); |
| 255 | 255 | } |
@@ -259,26 +259,26 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function doSaveDoc($args) |
| 261 | 261 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 262 | + if (!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 263 | 263 | |
| 264 | 264 | // Get the current module if module_srl doesn't exist |
| 265 | - if(!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 266 | - if(!$args->module_srl) |
|
| 265 | + if (!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 266 | + if (!$args->module_srl) |
|
| 267 | 267 | { |
| 268 | 268 | $current_module_info = Context::get('current_module_info'); |
| 269 | 269 | $args->module_srl = $current_module_info->module_srl; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if(Context::get('is_logged')) |
|
| 272 | + if (Context::get('is_logged')) |
|
| 273 | 273 | { |
| 274 | 274 | $logged_info = Context::get('logged_info'); |
| 275 | 275 | $args->member_srl = $logged_info->member_srl; |
| 276 | 276 | } |
| 277 | 277 | else |
| 278 | 278 | { |
| 279 | - $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
|
| 280 | - if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 281 | - setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
|
| 279 | + $args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl]; |
|
| 280 | + if (!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 281 | + setcookie('autosave_certify_key_'.$args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | return executeQuery('editor.insertSavedDoc', $args); |
@@ -324,22 +324,22 @@ discard block |
||
| 324 | 324 | $args->module_srl = Context::get('module_srl'); |
| 325 | 325 | |
| 326 | 326 | // Get the current module if module_srl doesn't exist |
| 327 | - if(!$args->module_srl) |
|
| 327 | + if (!$args->module_srl) |
|
| 328 | 328 | { |
| 329 | 329 | $current_module_info = Context::get('current_module_info'); |
| 330 | 330 | $args->module_srl = $current_module_info->module_srl; |
| 331 | 331 | } |
| 332 | - if(Context::get('is_logged')) |
|
| 332 | + if (Context::get('is_logged')) |
|
| 333 | 333 | { |
| 334 | 334 | $logged_info = Context::get('logged_info'); |
| 335 | 335 | $args->member_srl = $logged_info->member_srl; |
| 336 | 336 | } |
| 337 | 337 | else |
| 338 | 338 | { |
| 339 | - $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
|
| 339 | + $args->certify_key = $_COOKIE['autosave_certify_key_'.$args->module_srl]; |
|
| 340 | 340 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
| 341 | 341 | // 변경 이전에 작성된 게시물 호환성 유지 |
| 342 | - if(!$args->certify_key) { |
|
| 342 | + if (!$args->certify_key) { |
|
| 343 | 343 | unset($args->certify_key); |
| 344 | 344 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 345 | 345 | } |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | // Check if the auto-saved document already exists |
| 348 | 348 | $output = executeQuery('editor.getSavedDocument', $args); |
| 349 | 349 | $saved_doc = $output->data; |
| 350 | - if(!$saved_doc) return; |
|
| 350 | + if (!$saved_doc) return; |
|
| 351 | 351 | |
| 352 | 352 | $oDocumentModel = getModel('document'); |
| 353 | 353 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 354 | - if(!$oSaved->isExists()) |
|
| 354 | + if (!$oSaved->isExists()) |
|
| 355 | 355 | { |
| 356 | - if($mode) |
|
| 356 | + if ($mode) |
|
| 357 | 357 | { |
| 358 | 358 | $output = executeQuery('editor.getSavedDocument', $args); |
| 359 | 359 | $output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc); |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | $oEditorModel = getModel('editor'); |
| 383 | 383 | $args = new stdClass; |
| 384 | 384 | |
| 385 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 385 | + if ($filter_enabled) $args->enabled = "Y"; |
|
| 386 | 386 | |
| 387 | - if($site_srl) |
|
| 387 | + if ($site_srl) |
|
| 388 | 388 | { |
| 389 | 389 | $args->site_srl = $site_srl; |
| 390 | 390 | $output = executeQuery('editor.getSiteComponentList', $args); |
@@ -397,10 +397,10 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | // Get information about log-in status and its group |
| 399 | 399 | $is_logged = Context::get('is_logged'); |
| 400 | - if($is_logged) |
|
| 400 | + if ($is_logged) |
|
| 401 | 401 | { |
| 402 | 402 | $logged_info = Context::get('logged_info'); |
| 403 | - if($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 403 | + if ($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 404 | 404 | { |
| 405 | 405 | $group_list = array_keys($logged_info->group_list); |
| 406 | 406 | } |
@@ -408,30 +408,30 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | // Get xml information for looping DB list |
| 411 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 411 | + if (!is_array($db_list)) $db_list = array($db_list); |
|
| 412 | 412 | $component_list = new stdClass(); |
| 413 | - foreach($db_list as $component) |
|
| 413 | + foreach ($db_list as $component) |
|
| 414 | 414 | { |
| 415 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 415 | + if (in_array($component->component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 416 | 416 | |
| 417 | 417 | $component_name = $component->component_name; |
| 418 | - if(!$component_name) continue; |
|
| 418 | + if (!$component_name) continue; |
|
| 419 | 419 | |
| 420 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 420 | + if (!in_array($component_name, $downloaded_list)) continue; |
|
| 421 | 421 | |
| 422 | 422 | unset($xml_info); |
| 423 | 423 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
| 424 | 424 | $xml_info->enabled = $component->enabled; |
| 425 | 425 | |
| 426 | - if($component->extra_vars) |
|
| 426 | + if ($component->extra_vars) |
|
| 427 | 427 | { |
| 428 | 428 | $extra_vars = unserialize($component->extra_vars); |
| 429 | - if($extra_vars->target_group) |
|
| 429 | + if ($extra_vars->target_group) |
|
| 430 | 430 | { |
| 431 | 431 | $xml_info->target_group = $extra_vars->target_group; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - if($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 434 | + if ($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 435 | 435 | { |
| 436 | 436 | $xml_info->mid_list = $extra_vars->mid_list; |
| 437 | 437 | } |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue; |
| 459 | 459 | }*/ |
| 460 | 460 | // Check the configuration of the editor component |
| 461 | - if($xml_info->extra_vars) |
|
| 461 | + if ($xml_info->extra_vars) |
|
| 462 | 462 | { |
| 463 | - foreach($xml_info->extra_vars as $key => $val) |
|
| 463 | + foreach ($xml_info->extra_vars as $key => $val) |
|
| 464 | 464 | { |
| 465 | 465 | $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; |
| 466 | 466 | } |
@@ -471,19 +471,19 @@ discard block |
||
| 471 | 471 | // Get buttons, icons, images |
| 472 | 472 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 473 | 473 | $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; |
| 474 | - if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 475 | - if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 474 | + if (file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 475 | + if (file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Return if it checks enabled only |
| 479 | - if(!$filter_enabled) { |
|
| 479 | + if (!$filter_enabled) { |
|
| 480 | 480 | // Get xml_info of downloaded list |
| 481 | - foreach($downloaded_list as $component_name) |
|
| 481 | + foreach ($downloaded_list as $component_name) |
|
| 482 | 482 | { |
| 483 | - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; |
|
| 484 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 483 | + if (!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; |
|
| 484 | + if (in_array($component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 485 | 485 | // Pass if configured |
| 486 | - if($component_list->{$component_name}) continue; |
|
| 486 | + if ($component_list->{$component_name}) continue; |
|
| 487 | 487 | // Insert data into the DB |
| 488 | 488 | $oEditorController = getAdminController('editor'); |
| 489 | 489 | $oEditorController->insertComponent($component_name, false, $site_srl); |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 500 | - if($oCacheHandler->isSupport()) { |
|
| 500 | + if ($oCacheHandler->isSupport()) { |
|
| 501 | 501 | $cache_key = $oEditorModel->getComponentListCacheKey($filter_enabled, $site_srl); |
| 502 | 502 | $oCacheHandler->put($cache_key, $component_list); |
| 503 | 503 | } |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | FileHandler::removeFile($oEditorModel->getCacheFile(false, $site_srl)); |
| 516 | 516 | |
| 517 | 517 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 518 | - if($oCacheHandler->isSupport()) { |
|
| 518 | + if ($oCacheHandler->isSupport()) { |
|
| 519 | 519 | $cache_key = $oEditorModel->getComponentListCacheKey(true, $site_srl); |
| 520 | 520 | $oCacheHandler->delete($cache_key); |
| 521 | 521 | $cache_key = $oEditorModel->getComponentListCacheKey(false, $site_srl); |
@@ -529,9 +529,9 @@ discard block |
||
| 529 | 529 | $editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl); |
| 530 | 530 | |
| 531 | 531 | $oModuleController = getController('module'); |
| 532 | - if(is_array($obj->moduleSrlList)) |
|
| 532 | + if (is_array($obj->moduleSrlList)) |
|
| 533 | 533 | { |
| 534 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 534 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 535 | 535 | { |
| 536 | 536 | $oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig); |
| 537 | 537 | } |
@@ -47,20 +47,31 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if(!$component) { |
|
| 51 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | $oEditorModel = getModel('editor'); |
| 53 | 55 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 56 | + if(!$oComponent->toBool()) { |
|
| 57 | + return $oComponent; |
|
| 58 | + } |
|
| 55 | 59 | |
| 56 | - if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 60 | + if(!method_exists($oComponent, $method)) { |
|
| 61 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 62 | + } |
|
| 57 | 63 | |
| 58 | 64 | //$output = call_user_method($method, $oComponent); |
| 59 | 65 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 66 | + if(method_exists($oComponent, $method)) { |
|
| 67 | + $output = $oComponent->{$method}(); |
|
| 68 | + } else { |
|
| 69 | + return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 70 | + } |
|
| 62 | 71 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 72 | + if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) { |
|
| 73 | + return $output; |
|
| 74 | + } |
|
| 64 | 75 | |
| 65 | 76 | $this->setError($oComponent->getError()); |
| 66 | 77 | $this->setMessage($oComponent->getMessage()); |
@@ -88,7 +99,9 @@ discard block |
||
| 88 | 99 | |
| 89 | 100 | foreach($target_module_srl as $srl) |
| 90 | 101 | { |
| 91 | - if(!$srl) continue; |
|
| 102 | + if(!$srl) { |
|
| 103 | + continue; |
|
| 104 | + } |
|
| 92 | 105 | |
| 93 | 106 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | 107 | if(!$module_info->module_srl) |
@@ -118,10 +131,14 @@ discard block |
||
| 118 | 131 | for($i=0,$c=count($fonts);$i<$c;$i++) |
| 119 | 132 | { |
| 120 | 133 | $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
| 121 | - if(!$font) continue; |
|
| 134 | + if(!$font) { |
|
| 135 | + continue; |
|
| 136 | + } |
|
| 122 | 137 | $font_list[] = $font; |
| 123 | 138 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 139 | + if(count($font_list)) { |
|
| 140 | + $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 141 | + } |
|
| 125 | 142 | } |
| 126 | 143 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 144 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
@@ -135,12 +152,10 @@ discard block |
||
| 135 | 152 | if(!$grant) |
| 136 | 153 | { |
| 137 | 154 | $editor_config->{$key} = array(); |
| 138 | - } |
|
| 139 | - else if(is_array($grant)) |
|
| 155 | + } else if(is_array($grant)) |
|
| 140 | 156 | { |
| 141 | 157 | $editor_config->{$key} = $grant; |
| 142 | - } |
|
| 143 | - else |
|
| 158 | + } else |
|
| 144 | 159 | { |
| 145 | 160 | $editor_config->{$key} = explode('|@|', $grant); |
| 146 | 161 | } |
@@ -149,7 +164,9 @@ discard block |
||
| 149 | 164 | $editor_config->editor_height = (int)Context::get('editor_height'); |
| 150 | 165 | $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
| 151 | 166 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 167 | + if($editor_config->enable_autosave != 'Y') { |
|
| 168 | + $editor_config->enable_autosave = 'N'; |
|
| 169 | + } |
|
| 153 | 170 | |
| 154 | 171 | $oModuleController = getController('module'); |
| 155 | 172 | foreach($module_srl as $srl) |
@@ -169,7 +186,9 @@ discard block |
||
| 169 | 186 | */ |
| 170 | 187 | function triggerEditorComponentCompile(&$content) |
| 171 | 188 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 189 | + if(Context::getResponseMethod()!='HTML') { |
|
| 190 | + return new BaseObject(); |
|
| 191 | + } |
|
| 173 | 192 | |
| 174 | 193 | $module_info = Context::get('module_info'); |
| 175 | 194 | $module_srl = $module_info->module_srl; |
@@ -187,13 +206,14 @@ discard block |
||
| 187 | 206 | for($i = 0, $c = count($ini); $i < $c; $i++) |
| 188 | 207 | { |
| 189 | 208 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 209 | + if(!$file) { |
|
| 210 | + continue; |
|
| 211 | + } |
|
| 191 | 212 | |
| 192 | 213 | if(substr_compare($file, '.css', -4) === 0) |
| 193 | 214 | { |
| 194 | 215 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | - } |
|
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 216 | + } elseif(substr_compare($file, '.js', -3) === 0) |
|
| 197 | 217 | { |
| 198 | 218 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 219 | } |
@@ -206,8 +226,12 @@ discard block |
||
| 206 | 226 | { |
| 207 | 227 | $buff = array(); |
| 208 | 228 | $buff[] = '<style> .xe_content { '; |
| 209 | - if($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | - if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 229 | + if($content_font) { |
|
| 230 | + $buff[] = 'font-family:'.$content_font.';'; |
|
| 231 | + } |
|
| 232 | + if($content_font_size) { |
|
| 233 | + $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 234 | + } |
|
| 211 | 235 | $buff[] = ' }</style>'; |
| 212 | 236 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 237 | } |
@@ -239,17 +263,23 @@ discard block |
||
| 239 | 263 | $xml_obj->attrs = new stdClass; |
| 240 | 264 | for($i=0,$c=count($m[0]);$i<$c;$i++) |
| 241 | 265 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 266 | + if(!isset($xml_obj->attrs)) { |
|
| 267 | + $xml_obj->attrs = new stdClass; |
|
| 268 | + } |
|
| 243 | 269 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 270 | } |
| 245 | 271 | $xml_obj->body = $match[4]; |
| 246 | 272 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 273 | + if(!$xml_obj->attrs->editor_component) { |
|
| 274 | + return $match[0]; |
|
| 275 | + } |
|
| 248 | 276 | |
| 249 | 277 | // Get converted codes by using component::transHTML() |
| 250 | 278 | $oEditorModel = getModel('editor'); |
| 251 | 279 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 280 | + if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) { |
|
| 281 | + return $match[0]; |
|
| 282 | + } |
|
| 253 | 283 | |
| 254 | 284 | return $oComponent->transHTML($xml_obj); |
| 255 | 285 | } |
@@ -259,10 +289,14 @@ discard block |
||
| 259 | 289 | */ |
| 260 | 290 | function doSaveDoc($args) |
| 261 | 291 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 292 | + if(!$args->document_srl) { |
|
| 293 | + $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 294 | + } |
|
| 263 | 295 | |
| 264 | 296 | // Get the current module if module_srl doesn't exist |
| 265 | - if(!$args->module_srl) $args->module_srl = Context::get('module_srl'); |
|
| 297 | + if(!$args->module_srl) { |
|
| 298 | + $args->module_srl = Context::get('module_srl'); |
|
| 299 | + } |
|
| 266 | 300 | if(!$args->module_srl) |
| 267 | 301 | { |
| 268 | 302 | $current_module_info = Context::get('current_module_info'); |
@@ -273,11 +307,12 @@ discard block |
||
| 273 | 307 | { |
| 274 | 308 | $logged_info = Context::get('logged_info'); |
| 275 | 309 | $args->member_srl = $logged_info->member_srl; |
| 276 | - } |
|
| 277 | - else |
|
| 310 | + } else |
|
| 278 | 311 | { |
| 279 | 312 | $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
| 280 | - if(!$args->certify_key) $args->certify_key = Password::createSecureSalt(40); |
|
| 313 | + if(!$args->certify_key) { |
|
| 314 | + $args->certify_key = Password::createSecureSalt(40); |
|
| 315 | + } |
|
| 281 | 316 | setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, $_SERVER['REQUEST_TIME'] + 3600, '', '', false, true); |
| 282 | 317 | } |
| 283 | 318 | |
@@ -333,8 +368,7 @@ discard block |
||
| 333 | 368 | { |
| 334 | 369 | $logged_info = Context::get('logged_info'); |
| 335 | 370 | $args->member_srl = $logged_info->member_srl; |
| 336 | - } |
|
| 337 | - else |
|
| 371 | + } else |
|
| 338 | 372 | { |
| 339 | 373 | $args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl]; |
| 340 | 374 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
@@ -347,7 +381,9 @@ discard block |
||
| 347 | 381 | // Check if the auto-saved document already exists |
| 348 | 382 | $output = executeQuery('editor.getSavedDocument', $args); |
| 349 | 383 | $saved_doc = $output->data; |
| 350 | - if(!$saved_doc) return; |
|
| 384 | + if(!$saved_doc) { |
|
| 385 | + return; |
|
| 386 | + } |
|
| 351 | 387 | |
| 352 | 388 | $oDocumentModel = getModel('document'); |
| 353 | 389 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
@@ -382,14 +418,17 @@ discard block |
||
| 382 | 418 | $oEditorModel = getModel('editor'); |
| 383 | 419 | $args = new stdClass; |
| 384 | 420 | |
| 385 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 421 | + if($filter_enabled) { |
|
| 422 | + $args->enabled = "Y"; |
|
| 423 | + } |
|
| 386 | 424 | |
| 387 | 425 | if($site_srl) |
| 388 | 426 | { |
| 389 | 427 | $args->site_srl = $site_srl; |
| 390 | 428 | $output = executeQuery('editor.getSiteComponentList', $args); |
| 429 | + } else { |
|
| 430 | + $output = executeQuery('editor.getComponentList', $args); |
|
| 391 | 431 | } |
| 392 | - else $output = executeQuery('editor.getComponentList', $args); |
|
| 393 | 432 | $db_list = $output->data; |
| 394 | 433 | |
| 395 | 434 | // Get a list of files |
@@ -403,21 +442,30 @@ discard block |
||
| 403 | 442 | if($logged_info->group_list && is_array($logged_info->group_list)) |
| 404 | 443 | { |
| 405 | 444 | $group_list = array_keys($logged_info->group_list); |
| 445 | + } else { |
|
| 446 | + $group_list = array(); |
|
| 406 | 447 | } |
| 407 | - else $group_list = array(); |
|
| 408 | 448 | } |
| 409 | 449 | |
| 410 | 450 | // Get xml information for looping DB list |
| 411 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 451 | + if(!is_array($db_list)) { |
|
| 452 | + $db_list = array($db_list); |
|
| 453 | + } |
|
| 412 | 454 | $component_list = new stdClass(); |
| 413 | 455 | foreach($db_list as $component) |
| 414 | 456 | { |
| 415 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 457 | + if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 458 | + continue; |
|
| 459 | + } |
|
| 416 | 460 | |
| 417 | 461 | $component_name = $component->component_name; |
| 418 | - if(!$component_name) continue; |
|
| 462 | + if(!$component_name) { |
|
| 463 | + continue; |
|
| 464 | + } |
|
| 419 | 465 | |
| 420 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 466 | + if(!in_array($component_name, $downloaded_list)) { |
|
| 467 | + continue; |
|
| 468 | + } |
|
| 421 | 469 | |
| 422 | 470 | unset($xml_info); |
| 423 | 471 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
@@ -471,8 +519,12 @@ discard block |
||
| 471 | 519 | // Get buttons, icons, images |
| 472 | 520 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 473 | 521 | $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; |
| 474 | - if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 475 | - if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 522 | + if(file_exists($icon_file)) { |
|
| 523 | + $component_list->{$component_name}->icon = true; |
|
| 524 | + } |
|
| 525 | + if(file_exists($component_icon_file)) { |
|
| 526 | + $component_list->{$component_name}->component_icon = true; |
|
| 527 | + } |
|
| 476 | 528 | } |
| 477 | 529 | |
| 478 | 530 | // Return if it checks enabled only |
@@ -480,10 +532,16 @@ discard block |
||
| 480 | 532 | // Get xml_info of downloaded list |
| 481 | 533 | foreach($downloaded_list as $component_name) |
| 482 | 534 | { |
| 483 | - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) continue; |
|
| 484 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 535 | + if(!is_dir(_XE_PATH_.'modules/editor/components/'.$component_name)) { |
|
| 536 | + continue; |
|
| 537 | + } |
|
| 538 | + if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 539 | + continue; |
|
| 540 | + } |
|
| 485 | 541 | // Pass if configured |
| 486 | - if($component_list->{$component_name}) continue; |
|
| 542 | + if($component_list->{$component_name}) { |
|
| 543 | + continue; |
|
| 544 | + } |
|
| 487 | 545 | // Insert data into the DB |
| 488 | 546 | $oEditorController = getAdminController('editor'); |
| 489 | 547 | $oEditorController->insertComponent($component_name, false, $site_srl); |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | * Make search parameters from object(private) |
| 145 | 145 | * |
| 146 | 146 | * @param object $obj Original searach options |
| 147 | - * @param object $args Result searach options |
|
| 147 | + * @param stdClass $args Result searach options |
|
| 148 | 148 | * @return void |
| 149 | 149 | */ |
| 150 | 150 | function _makeSearchParam(&$obj, &$args) |
@@ -68,28 +68,28 @@ discard block |
||
| 68 | 68 | $this->_makeSearchParam($obj, $args); |
| 69 | 69 | |
| 70 | 70 | // Set valid/invalid state |
| 71 | - if($obj->isvalid == 'Y') $args->isvalid = 'Y'; |
|
| 72 | - elseif($obj->isvalid == 'N') $args->isvalid = 'N'; |
|
| 71 | + if ($obj->isvalid == 'Y') $args->isvalid = 'Y'; |
|
| 72 | + elseif ($obj->isvalid == 'N') $args->isvalid = 'N'; |
|
| 73 | 73 | // Set multimedia/common file |
| 74 | - if($obj->direct_download == 'Y') $args->direct_download = 'Y'; |
|
| 75 | - elseif($obj->direct_download == 'N') $args->direct_download= 'N'; |
|
| 74 | + if ($obj->direct_download == 'Y') $args->direct_download = 'Y'; |
|
| 75 | + elseif ($obj->direct_download == 'N') $args->direct_download = 'N'; |
|
| 76 | 76 | // Set variables |
| 77 | 77 | $args->sort_index = $obj->sort_index; |
| 78 | - $args->page = $obj->page?$obj->page:1; |
|
| 79 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
| 80 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
| 78 | + $args->page = $obj->page ? $obj->page : 1; |
|
| 79 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
| 80 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
| 81 | 81 | $args->s_module_srl = $obj->module_srl; |
| 82 | 82 | $args->exclude_module_srl = $obj->exclude_module_srl; |
| 83 | 83 | // Execute the file.getFileList query |
| 84 | 84 | $output = executeQuery('file.getFileList', $args, $columnList); |
| 85 | 85 | // Return if no result or an error occurs |
| 86 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 86 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
| 87 | 87 | |
| 88 | 88 | $oFileModel = getModel('file'); |
| 89 | 89 | |
| 90 | - foreach($output->data as $key => $file) |
|
| 90 | + foreach ($output->data as $key => $file) |
|
| 91 | 91 | { |
| 92 | - if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true; |
|
| 92 | + if ($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true; |
|
| 93 | 93 | else $file->isCarted = false; |
| 94 | 94 | |
| 95 | 95 | $file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | function getFilesCountByDate($date = '') |
| 134 | 134 | { |
| 135 | - if($date) $args->regDate = date('Ymd', strtotime($date)); |
|
| 135 | + if ($date) $args->regDate = date('Ymd', strtotime($date)); |
|
| 136 | 136 | |
| 137 | 137 | $output = executeQuery('file.getFilesCount', $args); |
| 138 | - if(!$output->toBool()) return 0; |
|
| 138 | + if (!$output->toBool()) return 0; |
|
| 139 | 139 | |
| 140 | 140 | return $output->data->count; |
| 141 | 141 | } |
@@ -150,31 +150,31 @@ discard block |
||
| 150 | 150 | function _makeSearchParam(&$obj, &$args) |
| 151 | 151 | { |
| 152 | 152 | // Search options |
| 153 | - $search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target')); |
|
| 154 | - $search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword')); |
|
| 153 | + $search_target = $obj->search_target ? $obj->search_target : trim(Context::get('search_target')); |
|
| 154 | + $search_keyword = $obj->search_keyword ? $obj->search_keyword : trim(Context::get('search_keyword')); |
|
| 155 | 155 | |
| 156 | - if($search_target && $search_keyword) |
|
| 156 | + if ($search_target && $search_keyword) |
|
| 157 | 157 | { |
| 158 | - switch($search_target) |
|
| 158 | + switch ($search_target) |
|
| 159 | 159 | { |
| 160 | 160 | case 'filename' : |
| 161 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 161 | + if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword); |
|
| 162 | 162 | $args->s_filename = $search_keyword; |
| 163 | 163 | break; |
| 164 | 164 | case 'filesize_more' : |
| 165 | - $args->s_filesize_more = (int)$search_keyword; |
|
| 165 | + $args->s_filesize_more = (int) $search_keyword; |
|
| 166 | 166 | break; |
| 167 | 167 | case 'filesize_mega_more' : |
| 168 | - $args->s_filesize_more = (int)$search_keyword * 1024 * 1024; |
|
| 168 | + $args->s_filesize_more = (int) $search_keyword * 1024 * 1024; |
|
| 169 | 169 | break; |
| 170 | 170 | case 'filesize_less' : |
| 171 | - $args->s_filesize_less = (int)$search_keyword; |
|
| 171 | + $args->s_filesize_less = (int) $search_keyword; |
|
| 172 | 172 | break; |
| 173 | 173 | case 'filesize_mega_less' : |
| 174 | - $args->s_filesize_less = (int)$search_keyword * 1024 * 1024; |
|
| 174 | + $args->s_filesize_less = (int) $search_keyword * 1024 * 1024; |
|
| 175 | 175 | break; |
| 176 | 176 | case 'download_count' : |
| 177 | - $args->s_download_count = (int)$search_keyword; |
|
| 177 | + $args->s_download_count = (int) $search_keyword; |
|
| 178 | 178 | break; |
| 179 | 179 | case 'regdate' : |
| 180 | 180 | $args->s_regdate = $search_keyword; |
@@ -68,11 +68,17 @@ discard block |
||
| 68 | 68 | $this->_makeSearchParam($obj, $args); |
| 69 | 69 | |
| 70 | 70 | // Set valid/invalid state |
| 71 | - if($obj->isvalid == 'Y') $args->isvalid = 'Y'; |
|
| 72 | - elseif($obj->isvalid == 'N') $args->isvalid = 'N'; |
|
| 71 | + if($obj->isvalid == 'Y') { |
|
| 72 | + $args->isvalid = 'Y'; |
|
| 73 | + } elseif($obj->isvalid == 'N') { |
|
| 74 | + $args->isvalid = 'N'; |
|
| 75 | + } |
|
| 73 | 76 | // Set multimedia/common file |
| 74 | - if($obj->direct_download == 'Y') $args->direct_download = 'Y'; |
|
| 75 | - elseif($obj->direct_download == 'N') $args->direct_download= 'N'; |
|
| 77 | + if($obj->direct_download == 'Y') { |
|
| 78 | + $args->direct_download = 'Y'; |
|
| 79 | + } elseif($obj->direct_download == 'N') { |
|
| 80 | + $args->direct_download= 'N'; |
|
| 81 | + } |
|
| 76 | 82 | // Set variables |
| 77 | 83 | $args->sort_index = $obj->sort_index; |
| 78 | 84 | $args->page = $obj->page?$obj->page:1; |
@@ -83,14 +89,19 @@ discard block |
||
| 83 | 89 | // Execute the file.getFileList query |
| 84 | 90 | $output = executeQuery('file.getFileList', $args, $columnList); |
| 85 | 91 | // Return if no result or an error occurs |
| 86 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
| 92 | + if(!$output->toBool()||!count($output->data)) { |
|
| 93 | + return $output; |
|
| 94 | + } |
|
| 87 | 95 | |
| 88 | 96 | $oFileModel = getModel('file'); |
| 89 | 97 | |
| 90 | 98 | foreach($output->data as $key => $file) |
| 91 | 99 | { |
| 92 | - if($_SESSION['file_management'][$file->file_srl]) $file->isCarted = true; |
|
| 93 | - else $file->isCarted = false; |
|
| 100 | + if($_SESSION['file_management'][$file->file_srl]) { |
|
| 101 | + $file->isCarted = true; |
|
| 102 | + } else { |
|
| 103 | + $file->isCarted = false; |
|
| 104 | + } |
|
| 94 | 105 | |
| 95 | 106 | $file->download_url = $oFileModel->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
| 96 | 107 | $output->data[$key] = $file; |
@@ -132,10 +143,14 @@ discard block |
||
| 132 | 143 | */ |
| 133 | 144 | function getFilesCountByDate($date = '') |
| 134 | 145 | { |
| 135 | - if($date) $args->regDate = date('Ymd', strtotime($date)); |
|
| 146 | + if($date) { |
|
| 147 | + $args->regDate = date('Ymd', strtotime($date)); |
|
| 148 | + } |
|
| 136 | 149 | |
| 137 | 150 | $output = executeQuery('file.getFilesCount', $args); |
| 138 | - if(!$output->toBool()) return 0; |
|
| 151 | + if(!$output->toBool()) { |
|
| 152 | + return 0; |
|
| 153 | + } |
|
| 139 | 154 | |
| 140 | 155 | return $output->data->count; |
| 141 | 156 | } |
@@ -158,7 +173,9 @@ discard block |
||
| 158 | 173 | switch($search_target) |
| 159 | 174 | { |
| 160 | 175 | case 'filename' : |
| 161 | - if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 176 | + if($search_keyword) { |
|
| 177 | + $search_keyword = str_replace(' ','%',$search_keyword); |
|
| 178 | + } |
|
| 162 | 179 | $args->s_filename = $search_keyword; |
| 163 | 180 | break; |
| 164 | 181 | case 'filesize_more' : |
@@ -216,6 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | 218 | * Merge item |
| 219 | + * @param string $filename |
|
| 219 | 220 | * @return void |
| 220 | 221 | */ |
| 221 | 222 | function mergeItems($filename) |
@@ -310,6 +311,11 @@ discard block |
||
| 310 | 311 | return $this->key; |
| 311 | 312 | } |
| 312 | 313 | |
| 314 | + /** |
|
| 315 | + * @param string $str |
|
| 316 | + * |
|
| 317 | + * @return string |
|
| 318 | + */ |
|
| 313 | 319 | function _addTagCRTail($str) { |
| 314 | 320 | $str = preg_replace('/<\/([^>]*)></i', "</$1>\r\n<", $str); |
| 315 | 321 | return $str; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $this->filename = $filename; |
| 100 | 100 | |
| 101 | 101 | $this->startTag = $startTag; |
| 102 | - if($endTag) $this->endTag = $endTag; |
|
| 102 | + if ($endTag) $this->endTag = $endTag; |
|
| 103 | 103 | $this->itemStartTag = $itemTag; |
| 104 | 104 | $this->itemEndTag = $itemEndTag; |
| 105 | 105 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $this->cache_path = './files/cache/importer/'.$this->key; |
| 109 | 109 | $this->cache_index_file = $this->cache_path.'/index'; |
| 110 | 110 | |
| 111 | - if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
| 111 | + if (!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
| 112 | 112 | |
| 113 | 113 | return $this->openFile(); |
| 114 | 114 | } |
@@ -120,55 +120,55 @@ discard block |
||
| 120 | 120 | function openFile() |
| 121 | 121 | { |
| 122 | 122 | FileHandler::removeFile($this->cache_index_file); |
| 123 | - $this->index_fd = fopen($this->cache_index_file,"a"); |
|
| 123 | + $this->index_fd = fopen($this->cache_index_file, "a"); |
|
| 124 | 124 | // If local file |
| 125 | - if(strncasecmp('http://', $this->filename, 7) !== 0) |
|
| 125 | + if (strncasecmp('http://', $this->filename, 7) !== 0) |
|
| 126 | 126 | { |
| 127 | - if(!file_exists($this->filename)) return new BaseObject(-1,'msg_no_xml_file'); |
|
| 128 | - $this->fd = fopen($this->filename,"r"); |
|
| 127 | + if (!file_exists($this->filename)) return new BaseObject(-1, 'msg_no_xml_file'); |
|
| 128 | + $this->fd = fopen($this->filename, "r"); |
|
| 129 | 129 | // If remote file |
| 130 | 130 | } |
| 131 | 131 | else |
| 132 | 132 | { |
| 133 | 133 | $url_info = parse_url($this->filename); |
| 134 | - if(!$url_info['port']) $url_info['port'] = 80; |
|
| 135 | - if(!$url_info['path']) $url_info['path'] = '/'; |
|
| 134 | + if (!$url_info['port']) $url_info['port'] = 80; |
|
| 135 | + if (!$url_info['path']) $url_info['path'] = '/'; |
|
| 136 | 136 | |
| 137 | 137 | $this->fd = @fsockopen($url_info['host'], $url_info['port']); |
| 138 | - if(!$this->fd) return new BaseObject(-1,'msg_no_xml_file'); |
|
| 138 | + if (!$this->fd) return new BaseObject(-1, 'msg_no_xml_file'); |
|
| 139 | 139 | // If the file name contains Korean, do urlencode(iconv required) |
| 140 | 140 | $path = $url_info['path']; |
| 141 | - if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) |
|
| 141 | + if (preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path) && function_exists('iconv')) |
|
| 142 | 142 | { |
| 143 | - $path_list = explode('/',$path); |
|
| 143 | + $path_list = explode('/', $path); |
|
| 144 | 144 | $cnt = count($path_list); |
| 145 | - $filename = $path_list[$cnt-1]; |
|
| 146 | - $filename = urlencode(iconv("UTF-8","EUC-KR",$filename)); |
|
| 147 | - $path_list[$cnt-1] = $filename; |
|
| 148 | - $path = implode('/',$path_list); |
|
| 145 | + $filename = $path_list[$cnt - 1]; |
|
| 146 | + $filename = urlencode(iconv("UTF-8", "EUC-KR", $filename)); |
|
| 147 | + $path_list[$cnt - 1] = $filename; |
|
| 148 | + $path = implode('/', $path_list); |
|
| 149 | 149 | $url_info['path'] = $path; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $header = sprintf("GET %s?%s HTTP/1.0\r\nHost: %s\r\nReferer: %s://%s\r\nConnection: Close\r\n\r\n", $url_info['path'], $url_info['query'], $url_info['host'], $url_info['scheme'], $url_info['host']); |
| 153 | 153 | @fwrite($this->fd, $header); |
| 154 | 154 | $buff = ''; |
| 155 | - while(!feof($this->fd)) |
|
| 155 | + while (!feof($this->fd)) |
|
| 156 | 156 | { |
| 157 | 157 | $buff .= $str = fgets($this->fd, 1024); |
| 158 | - if(!trim($str)) break; |
|
| 158 | + if (!trim($str)) break; |
|
| 159 | 159 | } |
| 160 | - if(preg_match('/404 Not Found/i',$buff)) return new BaseObject(-1,'msg_no_xml_file'); |
|
| 160 | + if (preg_match('/404 Not Found/i', $buff)) return new BaseObject(-1, 'msg_no_xml_file'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if($this->startTag) |
|
| 163 | + if ($this->startTag) |
|
| 164 | 164 | { |
| 165 | - while(!feof($this->fd)) |
|
| 165 | + while (!feof($this->fd)) |
|
| 166 | 166 | { |
| 167 | 167 | $str = fgets($this->fd, 1024); |
| 168 | 168 | $pos = strpos($str, $this->startTag); |
| 169 | - if($pos !== false) |
|
| 169 | + if ($pos !== false) |
|
| 170 | 170 | { |
| 171 | - $this->buff = substr($this->buff, $pos+strlen($this->startTag)); |
|
| 171 | + $this->buff = substr($this->buff, $pos + strlen($this->startTag)); |
|
| 172 | 172 | $this->isStarted = true; |
| 173 | 173 | $this->isFinished = false; |
| 174 | 174 | break; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | FileHandler::removeDir($this->cache_path.$this->key); |
| 210 | 210 | $this->index = 0; |
| 211 | - while(!$this->isFinished()) |
|
| 211 | + while (!$this->isFinished()) |
|
| 212 | 212 | { |
| 213 | 213 | $this->getItem(); |
| 214 | 214 | } |
@@ -224,14 +224,14 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | $filename = sprintf('%s/%s', $this->cache_path, $filename); |
| 226 | 226 | |
| 227 | - $index_fd = fopen($this->cache_index_file,"r"); |
|
| 228 | - $fd = fopen($filename,'w'); |
|
| 227 | + $index_fd = fopen($this->cache_index_file, "r"); |
|
| 228 | + $fd = fopen($filename, 'w'); |
|
| 229 | 229 | |
| 230 | 230 | fwrite($fd, '<items>'); |
| 231 | - while(!feof($index_fd)) |
|
| 231 | + while (!feof($index_fd)) |
|
| 232 | 232 | { |
| 233 | - $target_file = trim(fgets($index_fd,1024)); |
|
| 234 | - if(!file_exists($target_file)) continue; |
|
| 233 | + $target_file = trim(fgets($index_fd, 1024)); |
|
| 234 | + if (!file_exists($target_file)) continue; |
|
| 235 | 235 | $buff = FileHandler::readFile($target_file); |
| 236 | 236 | fwrite($fd, FileHandler::readFile($target_file)); |
| 237 | 237 | |
@@ -247,21 +247,21 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | function getItem() |
| 249 | 249 | { |
| 250 | - if($this->isFinished()) return; |
|
| 250 | + if ($this->isFinished()) return; |
|
| 251 | 251 | |
| 252 | - while(!feof($this->fd)) |
|
| 252 | + while (!feof($this->fd)) |
|
| 253 | 253 | { |
| 254 | 254 | $startPos = strpos($this->buff, $this->itemStartTag); |
| 255 | - if($startPos !== false) |
|
| 255 | + if ($startPos !== false) |
|
| 256 | 256 | { |
| 257 | 257 | $this->buff = substr($this->buff, $startPos); |
| 258 | - $this->buff = preg_replace("/\>/",">\r\n",$this->buff,1); |
|
| 258 | + $this->buff = preg_replace("/\>/", ">\r\n", $this->buff, 1); |
|
| 259 | 259 | break; |
| 260 | 260 | } |
| 261 | - elseif($this->endTag) |
|
| 261 | + elseif ($this->endTag) |
|
| 262 | 262 | { |
| 263 | 263 | $endPos = strpos($this->buff, $this->endTag); |
| 264 | - if($endPos !== false) |
|
| 264 | + if ($endPos !== false) |
|
| 265 | 265 | { |
| 266 | 266 | $this->closeFile(); |
| 267 | 267 | return; |
@@ -271,21 +271,21 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | $startPos = strpos($this->buff, $this->itemStartTag); |
| 274 | - if($startPos === false) |
|
| 274 | + if ($startPos === false) |
|
| 275 | 275 | { |
| 276 | 276 | $this->closeFile(); |
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $filename = sprintf('%s/%s.xml',$this->cache_path, $this->index++); |
|
| 280 | + $filename = sprintf('%s/%s.xml', $this->cache_path, $this->index++); |
|
| 281 | 281 | fwrite($this->index_fd, $filename."\r\n"); |
| 282 | 282 | |
| 283 | - $fd = fopen($filename,'w'); |
|
| 283 | + $fd = fopen($filename, 'w'); |
|
| 284 | 284 | |
| 285 | - while(!feof($this->fd)) |
|
| 285 | + while (!feof($this->fd)) |
|
| 286 | 286 | { |
| 287 | 287 | $endPos = strpos($this->buff, $this->itemEndTag); |
| 288 | - if($endPos !== false) |
|
| 288 | + if ($endPos !== false) |
|
| 289 | 289 | { |
| 290 | 290 | $endPos += strlen($this->itemEndTag); |
| 291 | 291 | $buff = substr($this->buff, 0, $endPos); |
@@ -99,7 +99,9 @@ discard block |
||
| 99 | 99 | $this->filename = $filename; |
| 100 | 100 | |
| 101 | 101 | $this->startTag = $startTag; |
| 102 | - if($endTag) $this->endTag = $endTag; |
|
| 102 | + if($endTag) { |
|
| 103 | + $this->endTag = $endTag; |
|
| 104 | + } |
|
| 103 | 105 | $this->itemStartTag = $itemTag; |
| 104 | 106 | $this->itemEndTag = $itemEndTag; |
| 105 | 107 | |
@@ -108,7 +110,9 @@ discard block |
||
| 108 | 110 | $this->cache_path = './files/cache/importer/'.$this->key; |
| 109 | 111 | $this->cache_index_file = $this->cache_path.'/index'; |
| 110 | 112 | |
| 111 | - if(!is_dir($this->cache_path)) FileHandler::makeDir($this->cache_path); |
|
| 113 | + if(!is_dir($this->cache_path)) { |
|
| 114 | + FileHandler::makeDir($this->cache_path); |
|
| 115 | + } |
|
| 112 | 116 | |
| 113 | 117 | return $this->openFile(); |
| 114 | 118 | } |
@@ -124,18 +128,25 @@ discard block |
||
| 124 | 128 | // If local file |
| 125 | 129 | if(strncasecmp('http://', $this->filename, 7) !== 0) |
| 126 | 130 | { |
| 127 | - if(!file_exists($this->filename)) return new BaseObject(-1,'msg_no_xml_file'); |
|
| 131 | + if(!file_exists($this->filename)) { |
|
| 132 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
| 133 | + } |
|
| 128 | 134 | $this->fd = fopen($this->filename,"r"); |
| 129 | 135 | // If remote file |
| 130 | - } |
|
| 131 | - else |
|
| 136 | + } else |
|
| 132 | 137 | { |
| 133 | 138 | $url_info = parse_url($this->filename); |
| 134 | - if(!$url_info['port']) $url_info['port'] = 80; |
|
| 135 | - if(!$url_info['path']) $url_info['path'] = '/'; |
|
| 139 | + if(!$url_info['port']) { |
|
| 140 | + $url_info['port'] = 80; |
|
| 141 | + } |
|
| 142 | + if(!$url_info['path']) { |
|
| 143 | + $url_info['path'] = '/'; |
|
| 144 | + } |
|
| 136 | 145 | |
| 137 | 146 | $this->fd = @fsockopen($url_info['host'], $url_info['port']); |
| 138 | - if(!$this->fd) return new BaseObject(-1,'msg_no_xml_file'); |
|
| 147 | + if(!$this->fd) { |
|
| 148 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
| 149 | + } |
|
| 139 | 150 | // If the file name contains Korean, do urlencode(iconv required) |
| 140 | 151 | $path = $url_info['path']; |
| 141 | 152 | if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) |
@@ -155,9 +166,13 @@ discard block |
||
| 155 | 166 | while(!feof($this->fd)) |
| 156 | 167 | { |
| 157 | 168 | $buff .= $str = fgets($this->fd, 1024); |
| 158 | - if(!trim($str)) break; |
|
| 169 | + if(!trim($str)) { |
|
| 170 | + break; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + if(preg_match('/404 Not Found/i',$buff)) { |
|
| 174 | + return new BaseObject(-1,'msg_no_xml_file'); |
|
| 159 | 175 | } |
| 160 | - if(preg_match('/404 Not Found/i',$buff)) return new BaseObject(-1,'msg_no_xml_file'); |
|
| 161 | 176 | } |
| 162 | 177 | |
| 163 | 178 | if($this->startTag) |
@@ -174,8 +189,7 @@ discard block |
||
| 174 | 189 | break; |
| 175 | 190 | } |
| 176 | 191 | } |
| 177 | - } |
|
| 178 | - else |
|
| 192 | + } else |
|
| 179 | 193 | { |
| 180 | 194 | $this->isStarted = true; |
| 181 | 195 | $this->isFinished = false; |
@@ -231,7 +245,9 @@ discard block |
||
| 231 | 245 | while(!feof($index_fd)) |
| 232 | 246 | { |
| 233 | 247 | $target_file = trim(fgets($index_fd,1024)); |
| 234 | - if(!file_exists($target_file)) continue; |
|
| 248 | + if(!file_exists($target_file)) { |
|
| 249 | + continue; |
|
| 250 | + } |
|
| 235 | 251 | $buff = FileHandler::readFile($target_file); |
| 236 | 252 | fwrite($fd, FileHandler::readFile($target_file)); |
| 237 | 253 | |
@@ -247,7 +263,9 @@ discard block |
||
| 247 | 263 | */ |
| 248 | 264 | function getItem() |
| 249 | 265 | { |
| 250 | - if($this->isFinished()) return; |
|
| 266 | + if($this->isFinished()) { |
|
| 267 | + return; |
|
| 268 | + } |
|
| 251 | 269 | |
| 252 | 270 | while(!feof($this->fd)) |
| 253 | 271 | { |
@@ -257,8 +275,7 @@ discard block |
||
| 257 | 275 | $this->buff = substr($this->buff, $startPos); |
| 258 | 276 | $this->buff = preg_replace("/\>/",">\r\n",$this->buff,1); |
| 259 | 277 | break; |
| 260 | - } |
|
| 261 | - elseif($this->endTag) |
|
| 278 | + } elseif($this->endTag) |
|
| 262 | 279 | { |
| 263 | 280 | $endPos = strpos($this->buff, $this->endTag); |
| 264 | 281 | if($endPos !== false) |
@@ -450,7 +450,7 @@ |
||
| 450 | 450 | * @param int $upload_target_srl |
| 451 | 451 | * @param array $files |
| 452 | 452 | * @param string $buff |
| 453 | - * @return bool |
|
| 453 | + * @return null|boolean |
|
| 454 | 454 | */ |
| 455 | 455 | function importAttaches($fp, $module_srl, $upload_target_srl, &$files, $buff) |
| 456 | 456 | { |
@@ -40,7 +40,9 @@ 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)) { |
|
| 44 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 45 | + } |
|
| 44 | 46 | // First handle categorty information |
| 45 | 47 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
| 46 | 48 | if(file_exists($category_file)) |
@@ -58,15 +60,21 @@ discard block |
||
| 58 | 60 | foreach($categories as $k => $v) |
| 59 | 61 | { |
| 60 | 62 | $category = $v->name; |
| 61 | - if(!$category || $category_titles[$category]) continue; |
|
| 63 | + if(!$category || $category_titles[$category]) { |
|
| 64 | + continue; |
|
| 65 | + } |
|
| 62 | 66 | |
| 63 | 67 | $obj = null; |
| 64 | 68 | $obj->title = $category; |
| 65 | 69 | $obj->module_srl = $module_srl; |
| 66 | - if($v->parent) $obj->parent_srl = $match_sequence[$v->parent]; |
|
| 70 | + if($v->parent) { |
|
| 71 | + $obj->parent_srl = $match_sequence[$v->parent]; |
|
| 72 | + } |
|
| 67 | 73 | $output = $oDocumentController->insertCategory($obj); |
| 68 | 74 | |
| 69 | - if($output->toBool()) $match_sequence[$v->sequence] = $category_titles[$category] = $output->get('category_srl'); |
|
| 75 | + if($output->toBool()) { |
|
| 76 | + $match_sequence[$v->sequence] = $category_titles[$category] = $output->get('category_srl'); |
|
| 77 | + } |
|
| 70 | 78 | } |
| 71 | 79 | $oDocumentController->makeCategoryFile($module_srl); |
| 72 | 80 | } |
@@ -74,28 +82,40 @@ discard block |
||
| 74 | 82 | } |
| 75 | 83 | $category_list = $category_titles = array(); |
| 76 | 84 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
| 77 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 85 | + if(count($category_list)) { |
|
| 86 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
| 87 | + } |
|
| 78 | 88 | // Get administrator information |
| 79 | 89 | $oMemberModel = getModel('member'); |
| 80 | 90 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id); |
| 81 | 91 | $author_xml_id = 0; |
| 82 | 92 | |
| 83 | - if(!$cur) $cur = 0; |
|
| 93 | + if(!$cur) { |
|
| 94 | + $cur = 0; |
|
| 95 | + } |
|
| 84 | 96 | // Open an index file |
| 85 | 97 | $f = fopen($index_file,"r"); |
| 86 | 98 | // Pass if already read |
| 87 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
| 99 | + for($i=0;$i<$cur;$i++) { |
|
| 100 | + fgets($f, 1024); |
|
| 101 | + } |
|
| 88 | 102 | // Read each line until the codition meets |
| 89 | 103 | for($idx=$cur;$idx<$cur+$unit_count;$idx++) |
| 90 | 104 | { |
| 91 | - if(feof($f)) break; |
|
| 105 | + if(feof($f)) { |
|
| 106 | + break; |
|
| 107 | + } |
|
| 92 | 108 | // Find a location |
| 93 | 109 | $target_file = trim(fgets($f, 1024)); |
| 94 | 110 | |
| 95 | - if(!file_exists($target_file)) continue; |
|
| 111 | + if(!file_exists($target_file)) { |
|
| 112 | + continue; |
|
| 113 | + } |
|
| 96 | 114 | // Start importing data |
| 97 | 115 | $fp = fopen($target_file,"r"); |
| 98 | - if(!$fp) continue; |
|
| 116 | + if(!$fp) { |
|
| 117 | + continue; |
|
| 118 | + } |
|
| 99 | 119 | |
| 100 | 120 | $obj = null; |
| 101 | 121 | $obj->module_srl = $module_srl; |
@@ -116,14 +136,17 @@ discard block |
||
| 116 | 136 | $started = true; |
| 117 | 137 | continue; |
| 118 | 138 | // Import the attachment |
| 119 | - } |
|
| 120 | - else if(substr($str,0,12) == '<attachment ') |
|
| 139 | + } else if(substr($str,0,12) == '<attachment ') |
|
| 121 | 140 | { |
| 122 | - if($this->importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) $obj->uploaded_count++; |
|
| 141 | + if($this->importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) { |
|
| 142 | + $obj->uploaded_count++; |
|
| 143 | + } |
|
| 123 | 144 | continue; |
| 124 | 145 | } |
| 125 | 146 | |
| 126 | - if($started) $buff .= $str; |
|
| 147 | + if($started) { |
|
| 148 | + $buff .= $str; |
|
| 149 | + } |
|
| 127 | 150 | } |
| 128 | 151 | |
| 129 | 152 | $xmlDoc = $this->oXmlParser->parse('<post>'.$buff); |
@@ -134,7 +157,9 @@ discard block |
||
| 134 | 157 | { |
| 135 | 158 | $tmp_arr = explode('/',$xmlDoc->post->category->body); |
| 136 | 159 | $category = trim($tmp_arr[count($tmp_arr)-1]); |
| 137 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
| 160 | + if($category_titles[$category]) { |
|
| 161 | + $obj->category_srl = $category_titles[$category]; |
|
| 162 | + } |
|
| 138 | 163 | } |
| 139 | 164 | |
| 140 | 165 | $obj->is_notice = 'N'; |
@@ -148,15 +173,21 @@ discard block |
||
| 148 | 173 | //$obj->allow_trackback = $xmlDoc->post->acceptTrackback->body=='1'?'Y':'N'; |
| 149 | 174 | $obj->regdate = date("YmdHis",$xmlDoc->post->published->body); |
| 150 | 175 | $obj->last_update = date("YmdHis", $xmlDoc->post->modified->body); |
| 151 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 176 | + if(!$obj->last_update) { |
|
| 177 | + $obj->last_update = $obj->regdate; |
|
| 178 | + } |
|
| 152 | 179 | |
| 153 | 180 | $tag = null; |
| 154 | 181 | $tmp_tags = null; |
| 155 | 182 | $tag = $xmlDoc->post->tag; |
| 156 | 183 | if($tag) |
| 157 | 184 | { |
| 158 | - if(!is_array($tag)) $tag = array($tag); |
|
| 159 | - foreach($tag as $key => $val) $tmp_tags[] = $val->body; |
|
| 185 | + if(!is_array($tag)) { |
|
| 186 | + $tag = array($tag); |
|
| 187 | + } |
|
| 188 | + foreach($tag as $key => $val) { |
|
| 189 | + $tmp_tags[] = $val->body; |
|
| 190 | + } |
|
| 160 | 191 | $obj->tags = implode(',',$tmp_tags); |
| 161 | 192 | } |
| 162 | 193 | |
@@ -192,7 +223,9 @@ discard block |
||
| 192 | 223 | if($xmlDoc->post->trackback) |
| 193 | 224 | { |
| 194 | 225 | $trackbacks = $xmlDoc->post->trackback; |
| 195 | - if(!is_array($trackbacks)) $trackbacks = array($trackbacks); |
|
| 226 | + if(!is_array($trackbacks)) { |
|
| 227 | + $trackbacks = array($trackbacks); |
|
| 228 | + } |
|
| 196 | 229 | if(count($trackbacks)) |
| 197 | 230 | { |
| 198 | 231 | foreach($trackbacks as $key => $val) |
@@ -209,7 +242,9 @@ discard block |
||
| 209 | 242 | $tobj->ipaddress = $val->ip->body; |
| 210 | 243 | $tobj->list_order = -1*$tobj->trackback_srl; |
| 211 | 244 | $output = executeQuery('trackback.insertTrackback', $tobj); |
| 212 | - if($output->toBool()) $obj->trackback_count++; |
|
| 245 | + if($output->toBool()) { |
|
| 246 | + $obj->trackback_count++; |
|
| 247 | + } |
|
| 213 | 248 | } |
| 214 | 249 | } |
| 215 | 250 | } |
@@ -218,21 +253,29 @@ discard block |
||
| 218 | 253 | if($xmlDoc->post->comment) |
| 219 | 254 | { |
| 220 | 255 | $comment = $xmlDoc->post->comment; |
| 221 | - if(!is_array($comment)) $comment = array($comment); |
|
| 256 | + if(!is_array($comment)) { |
|
| 257 | + $comment = array($comment); |
|
| 258 | + } |
|
| 222 | 259 | foreach($comment as $key => $val) |
| 223 | 260 | { |
| 224 | 261 | $parent_srl = $this->insertComment($val, $module_srl, $obj->document_srl, $member_info, 0, $author_xml_id); |
| 225 | - if($parent_srl === false) continue; |
|
| 262 | + if($parent_srl === false) { |
|
| 263 | + continue; |
|
| 264 | + } |
|
| 226 | 265 | |
| 227 | 266 | $obj->comment_count++; |
| 228 | 267 | if($val->comment) |
| 229 | 268 | { |
| 230 | 269 | $child_comment = $val->comment; |
| 231 | - if(!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 270 | + if(!is_array($child_comment)) { |
|
| 271 | + $child_comment = array($child_comment); |
|
| 272 | + } |
|
| 232 | 273 | foreach($child_comment as $k => $v) |
| 233 | 274 | { |
| 234 | 275 | $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, $parent_srl, $author_xml_id); |
| 235 | - if($result !== false) $obj->comment_count++; |
|
| 276 | + if($result !== false) { |
|
| 277 | + $obj->comment_count++; |
|
| 278 | + } |
|
| 236 | 279 | } |
| 237 | 280 | } |
| 238 | 281 | } |
@@ -270,7 +313,9 @@ discard block |
||
| 270 | 313 | $args->document_srl = $obj->document_srl; |
| 271 | 314 | $args->tag = trim($tag_list[$i]); |
| 272 | 315 | $args->regdate = $obj->regdate; |
| 273 | - if(!$args->tag) continue; |
|
| 316 | + if(!$args->tag) { |
|
| 317 | + continue; |
|
| 318 | + } |
|
| 274 | 319 | $output = executeQuery('tag.insertTag', $args); |
| 275 | 320 | } |
| 276 | 321 | } |
@@ -282,7 +327,9 @@ discard block |
||
| 282 | 327 | |
| 283 | 328 | fclose($f); |
| 284 | 329 | |
| 285 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 330 | + if(count($category_list)) { |
|
| 331 | + foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
| 332 | + } |
|
| 286 | 333 | // Guestbook information |
| 287 | 334 | $guestbook_file = preg_replace('/index$/i', 'guestbook.xml', $index_file); |
| 288 | 335 | if(file_exists($guestbook_file)) |
@@ -293,7 +340,9 @@ discard block |
||
| 293 | 340 | if($guestbook_module_srl && $xmlDoc->guestbook->comment) |
| 294 | 341 | { |
| 295 | 342 | $comment = $xmlDoc->guestbook->comment; |
| 296 | - if(!is_array($comment)) $comment = array($comment); |
|
| 343 | + if(!is_array($comment)) { |
|
| 344 | + $comment = array($comment); |
|
| 345 | + } |
|
| 297 | 346 | |
| 298 | 347 | if($module_name =='textyle') |
| 299 | 348 | { |
@@ -304,7 +353,9 @@ discard block |
||
| 304 | 353 | if($val->comment) |
| 305 | 354 | { |
| 306 | 355 | $child_comment = $val->comment; |
| 307 | - if(!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 356 | + if(!is_array($child_comment)) { |
|
| 357 | + $child_comment = array($child_comment); |
|
| 358 | + } |
|
| 308 | 359 | foreach($child_comment as $k => $v) |
| 309 | 360 | { |
| 310 | 361 | $result = $this->insertTextyleGuestbookItem($v, $module_srl, $member_info,0,$textyle_guestbook_srl,$author_xml_id); |
@@ -313,8 +364,7 @@ discard block |
||
| 313 | 364 | |
| 314 | 365 | $result = $this->insertTextyleGuestbookItem($val, $module_srl, $member_info,$textyle_guestbook_srl,0,$author_xml_id); |
| 315 | 366 | } |
| 316 | - } |
|
| 317 | - else |
|
| 367 | + } else |
|
| 318 | 368 | { |
| 319 | 369 | foreach($comment as $key => $val) |
| 320 | 370 | { |
@@ -328,13 +378,17 @@ discard block |
||
| 328 | 378 | |
| 329 | 379 | // Extract a title form the bocy |
| 330 | 380 | $obj->title = cut_str(strip_tags($obj->content),20,'...'); |
| 331 | - if ($obj->title == '') $obj->title = 'Untitled'; |
|
| 381 | + if ($obj->title == '') { |
|
| 382 | + $obj->title = 'Untitled'; |
|
| 383 | + } |
|
| 332 | 384 | |
| 333 | 385 | $obj->commentStatus = 'ALLOW'; |
| 334 | 386 | $obj->allow_trackback = 'N'; |
| 335 | 387 | $obj->regdate = date("YmdHis",$val->written->body); |
| 336 | 388 | $obj->last_update = date("YmdHis", $val->written->body); |
| 337 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
| 389 | + if(!$obj->last_update) { |
|
| 390 | + $obj->last_update = $obj->regdate; |
|
| 391 | + } |
|
| 338 | 392 | $obj->tags = ''; |
| 339 | 393 | $obj->readed_count = 0; |
| 340 | 394 | $obj->voted_count = 0; |
@@ -347,8 +401,7 @@ discard block |
||
| 347 | 401 | $obj->member_srl = $member_info->member_srl; |
| 348 | 402 | $obj->email_address = $member_info->email_address; |
| 349 | 403 | $obj->homepage = $member_info->homepage; |
| 350 | - } |
|
| 351 | - else |
|
| 404 | + } else |
|
| 352 | 405 | { |
| 353 | 406 | $obj->password = $val->password->body; |
| 354 | 407 | $obj->nick_name = $val->commenter->name->body; |
@@ -364,11 +417,15 @@ discard block |
||
| 364 | 417 | if($val->comment) |
| 365 | 418 | { |
| 366 | 419 | $child_comment = $val->comment; |
| 367 | - if(!is_array($child_comment)) $child_comment = array($child_comment); |
|
| 420 | + if(!is_array($child_comment)) { |
|
| 421 | + $child_comment = array($child_comment); |
|
| 422 | + } |
|
| 368 | 423 | foreach($child_comment as $k => $v) |
| 369 | 424 | { |
| 370 | 425 | $result = $this->insertComment($v, $module_srl, $obj->document_srl, $member_info, 0,$author_xml_id); |
| 371 | - if($result !== false) $obj->comment_count++; |
|
| 426 | + if($result !== false) { |
|
| 427 | + $obj->comment_count++; |
|
| 428 | + } |
|
| 372 | 429 | } |
| 373 | 430 | } |
| 374 | 431 | |
@@ -399,8 +456,7 @@ discard block |
||
| 399 | 456 | if($textyle_guestbook_srl>0) |
| 400 | 457 | { |
| 401 | 458 | $tobj->textyle_guestbook_srl = $textyle_guestbook_srl; |
| 402 | - } |
|
| 403 | - else |
|
| 459 | + } else |
|
| 404 | 460 | { |
| 405 | 461 | $tobj->textyle_guestbook_srl = getNextSequence(); |
| 406 | 462 | } |
@@ -416,8 +472,7 @@ discard block |
||
| 416 | 472 | $tobj->member_srl = $member_info->member_srl; |
| 417 | 473 | $tobj->homepage = $member_info->homepage; |
| 418 | 474 | $tobj->email_address = $member_info->email_address; |
| 419 | - } |
|
| 420 | - else |
|
| 475 | + } else |
|
| 421 | 476 | { |
| 422 | 477 | $tobj->password = $val->password->body; |
| 423 | 478 | $tobj->nick_name = $val->commenter->name->body; |
@@ -431,15 +486,16 @@ discard block |
||
| 431 | 486 | { |
| 432 | 487 | $tobj->parent_srl = $parent_srl; |
| 433 | 488 | $tobj->list_order = $tobj->parent_srl * -1; |
| 434 | - } |
|
| 435 | - else |
|
| 489 | + } else |
|
| 436 | 490 | { |
| 437 | 491 | $tobj->list_order = $tobj->textyle_guestbook_srl*-1; |
| 438 | 492 | } |
| 439 | 493 | |
| 440 | 494 | $output = executeQuery('textyle.insertTextyleGuestbook', $tobj); |
| 441 | 495 | |
| 442 | - if($output->toBool()) return $tobj->textyle_guestbook_srl; |
|
| 496 | + if($output->toBool()) { |
|
| 497 | + return $tobj->textyle_guestbook_srl; |
|
| 498 | + } |
|
| 443 | 499 | return false; |
| 444 | 500 | } |
| 445 | 501 | |
@@ -465,7 +521,9 @@ discard block |
||
| 465 | 521 | { |
| 466 | 522 | $str = fgets($fp, 1024); |
| 467 | 523 | // If it ends with </attaches>, break |
| 468 | - if(trim($str) == '</attachment>') break; |
|
| 524 | + if(trim($str) == '</attachment>') { |
|
| 525 | + break; |
|
| 526 | + } |
|
| 469 | 527 | // If it starts with <file>, handle the attachement in the xml file |
| 470 | 528 | if(substr($str, 0, 9)=='<content>') |
| 471 | 529 | { |
@@ -475,7 +533,9 @@ discard block |
||
| 475 | 533 | |
| 476 | 534 | $buff .= $str; |
| 477 | 535 | } |
| 478 | - if(!file_exists($file_obj->file)) return false; |
|
| 536 | + if(!file_exists($file_obj->file)) { |
|
| 537 | + return false; |
|
| 538 | + } |
|
| 479 | 539 | |
| 480 | 540 | $buff .= '</attachment>'; |
| 481 | 541 | |
@@ -490,15 +550,16 @@ discard block |
||
| 490 | 550 | $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); |
| 491 | 551 | $filename = $path.$file_obj->source_filename; |
| 492 | 552 | $file_obj->direct_download = 'Y'; |
| 493 | - } |
|
| 494 | - else |
|
| 553 | + } else |
|
| 495 | 554 | { |
| 496 | 555 | $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
| 497 | 556 | $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100))); |
| 498 | 557 | $file_obj->direct_download = 'N'; |
| 499 | 558 | } |
| 500 | 559 | // Create a directory |
| 501 | - if(!FileHandler::makeDir($path)) return; |
|
| 560 | + if(!FileHandler::makeDir($path)) { |
|
| 561 | + return; |
|
| 562 | + } |
|
| 502 | 563 | |
| 503 | 564 | FileHandler::rename($file_obj->file, $filename); |
| 504 | 565 | // Insert to the DB |
@@ -515,8 +576,11 @@ discard block |
||
| 515 | 576 | { |
| 516 | 577 | $uploaded_count++; |
| 517 | 578 | $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); |
|
| 579 | + if($file_obj->direct_download == 'Y') { |
|
| 580 | + $files[$name]->url = $file_obj->uploaded_filename; |
|
| 581 | + } else { |
|
| 582 | + $files[$name]->url = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
| 583 | + } |
|
| 520 | 584 | $files[$name]->direct_download = $file_obj->direct_download; |
| 521 | 585 | $files[$name]->source_filename = $file_obj->source_filename; |
| 522 | 586 | return true; |
@@ -532,9 +596,13 @@ discard block |
||
| 532 | 596 | function getTmpFilename() |
| 533 | 597 | { |
| 534 | 598 | $path = "./files/cache/importer"; |
| 535 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
| 599 | + if(!is_dir($path)) { |
|
| 600 | + FileHandler::makeDir($path); |
|
| 601 | + } |
|
| 536 | 602 | $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
| 537 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
| 603 | + if(file_exists($filename)) { |
|
| 604 | + $filename .= rand(111,999); |
|
| 605 | + } |
|
| 538 | 606 | return $filename; |
| 539 | 607 | } |
| 540 | 608 | |
@@ -553,7 +621,9 @@ discard block |
||
| 553 | 621 | { |
| 554 | 622 | $str = trim(fgets($fp, 1024)); |
| 555 | 623 | $buff .= $str; |
| 556 | - if(substr($str, -10) == '</content>') break; |
|
| 624 | + if(substr($str, -10) == '</content>') { |
|
| 625 | + break; |
|
| 626 | + } |
|
| 557 | 627 | } |
| 558 | 628 | |
| 559 | 629 | $buff = substr($buff, 0, -10); |
@@ -572,7 +642,9 @@ discard block |
||
| 572 | 642 | function _replaceTTAttach($matches) |
| 573 | 643 | { |
| 574 | 644 | $name = $matches[2]; |
| 575 | - if(!$name) return $matches[0]; |
|
| 645 | + if(!$name) { |
|
| 646 | + return $matches[0]; |
|
| 647 | + } |
|
| 576 | 648 | |
| 577 | 649 | $obj = $this->files[$name]; |
| 578 | 650 | // If multimedia file is, |
@@ -583,14 +655,12 @@ discard block |
||
| 583 | 655 | { |
| 584 | 656 | return sprintf('<img editor_component="image_link" src="%s" alt="%s" />', $obj->url, str_replace('"','\\"',$matches[4])); |
| 585 | 657 | // If other multimedia file but image is, |
| 586 | - } |
|
| 587 | - else |
|
| 658 | + } else |
|
| 588 | 659 | { |
| 589 | 660 | return sprintf('<img src="./common/img/blank.gif" editor_component="multimedia_link" multimedia_src="%s" width="400" height="320" style="display:block;width:400px;height:320px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;" auto_start="false" alt="" />', $obj->url); |
| 590 | 661 | } |
| 591 | 662 | // If binary file is |
| 592 | - } |
|
| 593 | - else |
|
| 663 | + } else |
|
| 594 | 664 | { |
| 595 | 665 | return sprintf('<a href="%s">%s</a>', $obj->url, $obj->source_filename); |
| 596 | 666 | } |
@@ -603,7 +673,9 @@ discard block |
||
| 603 | 673 | function _replaceTTMovie($matches) |
| 604 | 674 | { |
| 605 | 675 | $key = $matches[1]; |
| 606 | - if(!$key) return $matches[0]; |
|
| 676 | + if(!$key) { |
|
| 677 | + return $matches[0]; |
|
| 678 | + } |
|
| 607 | 679 | |
| 608 | 680 | return |
| 609 | 681 | '<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">'. |
@@ -645,8 +717,7 @@ discard block |
||
| 645 | 717 | $tobj->member_srl = $member_info->member_srl; |
| 646 | 718 | $tobj->homepage = $member_info->homepage; |
| 647 | 719 | $tobj->email_address = $member_info->email_address; |
| 648 | - } |
|
| 649 | - else |
|
| 720 | + } else |
|
| 650 | 721 | { |
| 651 | 722 | $tobj->password = $val->password->body; |
| 652 | 723 | $tobj->nick_name = $val->commenter->name->body; |
@@ -670,24 +741,28 @@ discard block |
||
| 670 | 741 | $list_args->head = $list_args->arrange = $tobj->comment_srl; |
| 671 | 742 | $list_args->depth = 0; |
| 672 | 743 | // Get parent_srl if parent comment exists |
| 673 | - } |
|
| 674 | - else |
|
| 744 | + } else |
|
| 675 | 745 | { |
| 676 | 746 | // Get parent_srl |
| 677 | 747 | $parent_args->comment_srl = $tobj->parent_srl; |
| 678 | 748 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
| 679 | 749 | // Return if parent comment doesn't exist |
| 680 | - if(!$parent_output->toBool() || !$parent_output->data) return false; |
|
| 750 | + if(!$parent_output->toBool() || !$parent_output->data) { |
|
| 751 | + return false; |
|
| 752 | + } |
|
| 681 | 753 | $parent = $parent_output->data; |
| 682 | 754 | |
| 683 | 755 | $list_args->head = $parent->head; |
| 684 | 756 | $list_args->depth = $parent->depth+1; |
| 685 | - if($list_args->depth<2) $list_args->arrange = $tobj->comment_srl; |
|
| 686 | - else |
|
| 757 | + if($list_args->depth<2) { |
|
| 758 | + $list_args->arrange = $tobj->comment_srl; |
|
| 759 | + } else |
|
| 687 | 760 | { |
| 688 | 761 | $list_args->arrange = $parent->arrange; |
| 689 | 762 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
| 690 | - if(!$output->toBool()) return $output; |
|
| 763 | + if(!$output->toBool()) { |
|
| 764 | + return $output; |
|
| 765 | + } |
|
| 691 | 766 | } |
| 692 | 767 | } |
| 693 | 768 | |
@@ -695,7 +770,9 @@ discard block |
||
| 695 | 770 | if($output->toBool()) |
| 696 | 771 | { |
| 697 | 772 | $output = executeQuery('comment.insertComment', $tobj); |
| 698 | - if($output->toBool()) return $tobj->comment_srl; |
|
| 773 | + if($output->toBool()) { |
|
| 774 | + return $tobj->comment_srl; |
|
| 775 | + } |
|
| 699 | 776 | } |
| 700 | 777 | return false; |
| 701 | 778 | } |
@@ -710,9 +787,14 @@ discard block |
||
| 710 | 787 | */ |
| 711 | 788 | function arrangeCategory($obj, &$category, &$idx, $parent = 0) |
| 712 | 789 | { |
| 713 | - if(!$obj->category) return; |
|
| 714 | - if(!is_array($obj->category)) $c = array($obj->category); |
|
| 715 | - else $c = $obj->category; |
|
| 790 | + if(!$obj->category) { |
|
| 791 | + return; |
|
| 792 | + } |
|
| 793 | + if(!is_array($obj->category)) { |
|
| 794 | + $c = array($obj->category); |
|
| 795 | + } else { |
|
| 796 | + $c = $obj->category; |
|
| 797 | + } |
|
| 716 | 798 | foreach($c as $val) |
| 717 | 799 | { |
| 718 | 800 | $idx++; |
@@ -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|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|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; |
@@ -545,6 +545,7 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | /** |
| 547 | 547 | * @brief Install an each module |
| 548 | + * @param string $module_path |
|
| 548 | 549 | */ |
| 549 | 550 | function installModule($module, $module_path) |
| 550 | 551 | { |
@@ -614,6 +615,7 @@ discard block |
||
| 614 | 615 | /** |
| 615 | 616 | * @brief Create etc config file |
| 616 | 617 | * Create the config file when all settings are completed |
| 618 | + * @param stdClass $config_info |
|
| 617 | 619 | */ |
| 618 | 620 | function makeEtcConfigFile($config_info) |
| 619 | 621 | { |
@@ -413,7 +413,7 @@ |
||
| 413 | 413 | * make a file to files/config and check url approach by ".htaccess" rules |
| 414 | 414 | * |
| 415 | 415 | * @return bool |
| 416 | - */ |
|
| 416 | + */ |
|
| 417 | 417 | function checkRewriteUsable() { |
| 418 | 418 | $checkString = "isApproached"; |
| 419 | 419 | $checkFilePath = 'files/config/tmpRewriteCheck.txt'; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | function init() |
| 18 | 18 | { |
| 19 | 19 | // Error occurs if already installed |
| 20 | - if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled()) |
|
| 20 | + if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled()) |
|
| 21 | 21 | { |
| 22 | 22 | $this->stop('msg_already_installed'); |
| 23 | 23 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | function _procDBSetting() |
| 87 | 87 | { |
| 88 | 88 | // Get DB-related variables |
| 89 | - $con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix'); |
|
| 89 | + $con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix'); |
|
| 90 | 90 | |
| 91 | 91 | $db_info = new stdClass(); |
| 92 | 92 | $db_info->master_db = get_object_vars($con_string); |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | // Check if available to connect to the DB |
| 102 | 102 | $oDB = &DB::getInstance(); |
| 103 | 103 | $output = $oDB->getError(); |
| 104 | - if(!$output->toBool()) return $output; |
|
| 105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
| 104 | + if (!$output->toBool()) return $output; |
|
| 105 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
| 106 | 106 | |
| 107 | 107 | // Create a db temp config file |
| 108 | - if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
| 108 | + if (!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
| 109 | 109 | |
| 110 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 110 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 111 | 111 | { |
| 112 | 112 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm'); |
| 113 | 113 | header('location:'.$returnUrl); |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | function procConfigSetting() |
| 122 | 122 | { |
| 123 | 123 | // Get variables |
| 124 | - $config_info = Context::gets('use_rewrite','time_zone'); |
|
| 125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
| 124 | + $config_info = Context::gets('use_rewrite', 'time_zone'); |
|
| 125 | + if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N'; |
|
| 126 | 126 | |
| 127 | 127 | // Create a db temp config file |
| 128 | - if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed'); |
|
| 128 | + if (!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed'); |
|
| 129 | 129 | |
| 130 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 130 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 131 | 131 | { |
| 132 | 132 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm'); |
| 133 | 133 | header('location:'.$returnUrl); |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | function procInstall() |
| 142 | 142 | { |
| 143 | 143 | // Check if it is already installed |
| 144 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
| 144 | + if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
| 145 | 145 | |
| 146 | 146 | Context::loadLang('modules/member/lang'); |
| 147 | 147 | $oMemberModel = getModel('member'); |
| 148 | 148 | $vars = Context::getRequestVars(); |
| 149 | 149 | |
| 150 | - if(!$oMemberModel->checkPasswordStrength($vars->password, 'high')) |
|
| 150 | + if (!$oMemberModel->checkPasswordStrength($vars->password, 'high')) |
|
| 151 | 151 | { |
| 152 | 152 | Context::loadLang('modules/member/lang'); |
| 153 | 153 | $message = Context::getLang('about_password_strength'); |
@@ -160,15 +160,15 @@ discard block |
||
| 160 | 160 | Context::set('logged_info', $logged_info); |
| 161 | 161 | |
| 162 | 162 | // check install config |
| 163 | - if(Context::get('install_config')) |
|
| 163 | + if (Context::get('install_config')) |
|
| 164 | 164 | { |
| 165 | 165 | $db_info = $this->_makeDbInfoByInstallConfig(); |
| 166 | 166 | } |
| 167 | 167 | // install by default XE UI |
| 168 | 168 | else |
| 169 | 169 | { |
| 170 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
| 171 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
| 170 | + if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
| 171 | + if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Set DB type and information |
@@ -176,30 +176,30 @@ discard block |
||
| 176 | 176 | // Create DB Instance |
| 177 | 177 | $oDB = &DB::getInstance(); |
| 178 | 178 | // Check if available to connect to the DB |
| 179 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
| 179 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
| 180 | 180 | |
| 181 | 181 | // Install all the modules |
| 182 | 182 | try { |
| 183 | 183 | $oDB->begin(); |
| 184 | 184 | $this->installDownloadedModule(); |
| 185 | 185 | $oDB->commit(); |
| 186 | - } catch(Exception $e) { |
|
| 186 | + } catch (Exception $e) { |
|
| 187 | 187 | $oDB->rollback(); |
| 188 | 188 | return new BaseObject(-1, $e->getMessage()); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // Create a config file |
| 192 | - if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
| 192 | + if (!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
| 193 | 193 | |
| 194 | 194 | // load script |
| 195 | - $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
|
| 196 | - if(count($scripts)>0) |
|
| 195 | + $scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/'); |
|
| 196 | + if (count($scripts) > 0) |
|
| 197 | 197 | { |
| 198 | 198 | sort($scripts); |
| 199 | - foreach($scripts as $script) |
|
| 199 | + foreach ($scripts as $script) |
|
| 200 | 200 | { |
| 201 | 201 | $script_path = FileHandler::getRealPath('./modules/install/script/'); |
| 202 | - $output = include($script_path . $script); |
|
| 202 | + $output = include($script_path.$script); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | unset($_SESSION['use_rewrite']); |
| 214 | 214 | |
| 215 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 215 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 216 | 216 | { |
| 217 | 217 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); |
| 218 | 218 | header('location:'.$returnUrl); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $db_info->use_rewrite = Context::get('use_rewrite'); |
| 243 | 243 | $db_info->time_zone = Context::get('time_zone'); |
| 244 | 244 | |
| 245 | - if($_SERVER['HTTPS'] == 'on') |
|
| 245 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 246 | 246 | { |
| 247 | 247 | $https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT']; |
| 248 | 248 | $https_port = (!$https_port != 443) ? $https_port : null; |
@@ -252,8 +252,8 @@ discard block |
||
| 252 | 252 | $http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT']; |
| 253 | 253 | $http_port = (!$http_port != 80) ? $http_port : null; |
| 254 | 254 | } |
| 255 | - if($http_port) $db_info->http_port = $http_port; |
|
| 256 | - if($https_port) $db_info->https_port = $https_port; |
|
| 255 | + if ($http_port) $db_info->http_port = $http_port; |
|
| 256 | + if ($https_port) $db_info->https_port = $https_port; |
|
| 257 | 257 | |
| 258 | 258 | return $db_info; |
| 259 | 259 | } |
@@ -263,57 +263,57 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | function procInstallFTP() |
| 265 | 265 | { |
| 266 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
| 267 | - $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
|
| 268 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
| 269 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
| 270 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
| 271 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
| 266 | + if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
| 267 | + $ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path'); |
|
| 268 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
| 269 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
| 270 | + if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
| 271 | + if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
| 272 | 272 | |
| 273 | 273 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
| 274 | 274 | $buff[] = "\$ftp_info = new stdClass();"; |
| 275 | - foreach($ftp_info as $key => $val) |
|
| 275 | + foreach ($ftp_info as $key => $val) |
|
| 276 | 276 | { |
| 277 | - $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val)); |
|
| 277 | + $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val)); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | // If safe_mode |
| 281 | - if(ini_get('safe_mode')) |
|
| 281 | + if (ini_get('safe_mode')) |
|
| 282 | 282 | { |
| 283 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
| 283 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed'); |
|
| 284 | 284 | |
| 285 | 285 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
| 286 | 286 | $oFtp = new ftp(); |
| 287 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 287 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 288 | 288 | |
| 289 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 289 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 290 | 290 | { |
| 291 | 291 | $oFtp->ftp_quit(); |
| 292 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
| 292 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
| 295 | + if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
| 296 | 296 | { |
| 297 | 297 | $oFtp->ftp_quit(); |
| 298 | - return new BaseObject(-1,'msg_ftp_mkdir_fail'); |
|
| 298 | + return new BaseObject(-1, 'msg_ftp_mkdir_fail'); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
| 301 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
| 302 | 302 | { |
| 303 | 303 | $oFtp->ftp_quit(); |
| 304 | - return new BaseObject(-1,'msg_ftp_chmod_fail'); |
|
| 304 | + return new BaseObject(-1, 'msg_ftp_chmod_fail'); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
| 307 | + if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
| 308 | 308 | { |
| 309 | 309 | $oFtp->ftp_quit(); |
| 310 | - return new BaseObject(-1,'msg_ftp_mkdir_fail'); |
|
| 310 | + return new BaseObject(-1, 'msg_ftp_mkdir_fail'); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
| 313 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
| 314 | 314 | { |
| 315 | 315 | $oFtp->ftp_quit(); |
| 316 | - return new BaseObject(-1,'msg_ftp_chmod_fail'); |
|
| 316 | + return new BaseObject(-1, 'msg_ftp_chmod_fail'); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | $oFtp->ftp_quit(); |
@@ -324,31 +324,31 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | function procInstallCheckFtp() |
| 326 | 326 | { |
| 327 | - $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
|
| 328 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
| 329 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
| 330 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
| 327 | + $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); |
|
| 328 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
| 329 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
| 330 | + if (!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
| 331 | 331 | |
| 332 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
| 332 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed'); |
|
| 333 | 333 | |
| 334 | - if($ftp_info->sftp == 'Y') |
|
| 334 | + if ($ftp_info->sftp == 'Y') |
|
| 335 | 335 | { |
| 336 | 336 | $connection = ssh2_connect('localhost', $ftp_info->ftp_port); |
| 337 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 337 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 338 | 338 | { |
| 339 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
| 339 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | else |
| 343 | 343 | { |
| 344 | 344 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
| 345 | 345 | $oFtp = new ftp(); |
| 346 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
| 346 | + if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
| 347 | 347 | |
| 348 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 348 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 349 | 349 | { |
| 350 | 350 | $oFtp->ftp_quit(); |
| 351 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
| 351 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
| 352 | 352 | } |
| 353 | 353 | $oFtp->ftp_quit(); |
| 354 | 354 | } |
@@ -365,36 +365,36 @@ discard block |
||
| 365 | 365 | $checklist = array(); |
| 366 | 366 | // 0. check your version of php (5.2.4 or higher) |
| 367 | 367 | $checklist['php_version'] = true; |
| 368 | - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
| 368 | + if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
| 369 | 369 | { |
| 370 | 370 | $checklist['php_version'] = false; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
| 373 | + if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
| 374 | 374 | { |
| 375 | 375 | Context::set('phpversion_warning', true); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | // 1. Check permission |
| 379 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
| 379 | + if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true; |
|
| 380 | 380 | else $checklist['permission'] = false; |
| 381 | 381 | // 2. Check if xml_parser_create exists |
| 382 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
| 382 | + if (function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
| 383 | 383 | else $checklist['xml'] = false; |
| 384 | 384 | // 3. Check if ini_get (session.auto_start) == 1 |
| 385 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
| 385 | + if (ini_get('session.auto_start') != 1) $checklist['session'] = true; |
|
| 386 | 386 | else $checklist['session'] = false; |
| 387 | 387 | // 4. Check if iconv exists |
| 388 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
| 388 | + if (function_exists('iconv')) $checklist['iconv'] = true; |
|
| 389 | 389 | else $checklist['iconv'] = false; |
| 390 | 390 | // 5. Check gd(imagecreatefromgif function) |
| 391 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
| 391 | + if (function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
| 392 | 392 | else $checklist['gd'] = false; |
| 393 | 393 | // 6. Check DB |
| 394 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
| 394 | + if (DB::getEnableList()) $checklist['db'] = true; |
|
| 395 | 395 | else $checklist['db'] = false; |
| 396 | 396 | |
| 397 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
| 397 | + if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
| 398 | 398 | else $install_enable = true; |
| 399 | 399 | |
| 400 | 400 | // Save the checked result to the Context |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | $license_agreement = ($vars->license_agreement == 'Y') ? true : false; |
| 416 | 416 | |
| 417 | - if($license_agreement) |
|
| 417 | + if ($license_agreement) |
|
| 418 | 418 | { |
| 419 | 419 | $currentTime = $_SERVER['REQUEST_TIME']; |
| 420 | 420 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | return new BaseObject(-1, 'msg_must_accept_license_agreement'); |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 428 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 429 | 429 | { |
| 430 | 430 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); |
| 431 | 431 | $this->setRedirectUrl($returnUrl); |
@@ -448,25 +448,25 @@ discard block |
||
| 448 | 448 | $hostname = $_SERVER['SERVER_NAME']; |
| 449 | 449 | $port = $_SERVER['SERVER_PORT']; |
| 450 | 450 | $str_port = ''; |
| 451 | - if($port) |
|
| 451 | + if ($port) |
|
| 452 | 452 | { |
| 453 | - $str_port = ':' . $port; |
|
| 453 | + $str_port = ':'.$port; |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | $tmpPath = $_SERVER['DOCUMENT_ROOT']; |
| 457 | 457 | |
| 458 | 458 | //if DIRECTORY_SEPARATOR is not /(IIS) |
| 459 | - if(DIRECTORY_SEPARATOR !== '/') |
|
| 459 | + if (DIRECTORY_SEPARATOR !== '/') |
|
| 460 | 460 | { |
| 461 | 461 | //change to slash for compare |
| 462 | 462 | $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | - $query = "/JUST/CHECK/REWRITE/" . $checkFilePath; |
|
| 465 | + $query = "/JUST/CHECK/REWRITE/".$checkFilePath; |
|
| 466 | 466 | $currentPath = str_replace($tmpPath, "", _XE_PATH_); |
| 467 | - if($currentPath != "") |
|
| 467 | + if ($currentPath != "") |
|
| 468 | 468 | { |
| 469 | - $query = $currentPath . $query; |
|
| 469 | + $query = $currentPath.$query; |
|
| 470 | 470 | } |
| 471 | 471 | $requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query); |
| 472 | 472 | $requestConfig = array(); |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | './files/cache/template_compiled', |
| 492 | 492 | ); |
| 493 | 493 | |
| 494 | - foreach($directory_list as $dir) |
|
| 494 | + foreach ($directory_list as $dir) |
|
| 495 | 495 | { |
| 496 | 496 | FileHandler::makeDir($dir); |
| 497 | 497 | } |
@@ -507,57 +507,57 @@ discard block |
||
| 507 | 507 | $oModuleModel = getModel('module'); |
| 508 | 508 | // Create a table ny finding schemas/*.xml file in each module |
| 509 | 509 | $module_list = FileHandler::readDir('./modules/', NULL, false, true); |
| 510 | - foreach($module_list as $module_path) |
|
| 510 | + foreach ($module_list as $module_path) |
|
| 511 | 511 | { |
| 512 | 512 | // Get module name |
| 513 | - $tmp_arr = explode('/',$module_path); |
|
| 514 | - $module = $tmp_arr[count($tmp_arr)-1]; |
|
| 513 | + $tmp_arr = explode('/', $module_path); |
|
| 514 | + $module = $tmp_arr[count($tmp_arr) - 1]; |
|
| 515 | 515 | |
| 516 | 516 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
| 517 | - if(!$xml_info) continue; |
|
| 517 | + if (!$xml_info) continue; |
|
| 518 | 518 | $modules[$xml_info->category][] = $module; |
| 519 | 519 | } |
| 520 | 520 | // Install "module" module in advance |
| 521 | - $this->installModule('module','./modules/module'); |
|
| 521 | + $this->installModule('module', './modules/module'); |
|
| 522 | 522 | $oModule = getClass('module'); |
| 523 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 523 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 524 | 524 | // Determine the order of module installation depending on category |
| 525 | - $install_step = array('system','content','member'); |
|
| 525 | + $install_step = array('system', 'content', 'member'); |
|
| 526 | 526 | // Install all the remaining modules |
| 527 | - foreach($install_step as $category) |
|
| 527 | + foreach ($install_step as $category) |
|
| 528 | 528 | { |
| 529 | - if(count($modules[$category])) |
|
| 529 | + if (count($modules[$category])) |
|
| 530 | 530 | { |
| 531 | - foreach($modules[$category] as $module) |
|
| 531 | + foreach ($modules[$category] as $module) |
|
| 532 | 532 | { |
| 533 | - if($module == 'module') continue; |
|
| 533 | + if ($module == 'module') continue; |
|
| 534 | 534 | $this->installModule($module, sprintf('./modules/%s', $module)); |
| 535 | 535 | |
| 536 | 536 | $oModule = getClass($module); |
| 537 | - if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
| 537 | + if (is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
| 538 | 538 | { |
| 539 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 539 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 540 | 540 | } |
| 541 | 541 | } |
| 542 | 542 | unset($modules[$category]); |
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | // Install all the remaining modules |
| 546 | - if(count($modules)) |
|
| 546 | + if (count($modules)) |
|
| 547 | 547 | { |
| 548 | - foreach($modules as $category => $module_list) |
|
| 548 | + foreach ($modules as $category => $module_list) |
|
| 549 | 549 | { |
| 550 | - if(count($module_list)) |
|
| 550 | + if (count($module_list)) |
|
| 551 | 551 | { |
| 552 | - foreach($module_list as $module) |
|
| 552 | + foreach ($module_list as $module) |
|
| 553 | 553 | { |
| 554 | - if($module == 'module') continue; |
|
| 554 | + if ($module == 'module') continue; |
|
| 555 | 555 | $this->installModule($module, sprintf('./modules/%s', $module)); |
| 556 | 556 | |
| 557 | 557 | $oModule = getClass($module); |
| 558 | - if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
| 558 | + if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
| 559 | 559 | { |
| 560 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 560 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | } |
@@ -579,31 +579,31 @@ discard block |
||
| 579 | 579 | $schema_files = FileHandler::readDir($schema_dir, NULL, false, true); |
| 580 | 580 | |
| 581 | 581 | $file_cnt = count($schema_files); |
| 582 | - for($i=0;$i<$file_cnt;$i++) |
|
| 582 | + for ($i = 0; $i < $file_cnt; $i++) |
|
| 583 | 583 | { |
| 584 | 584 | $file = trim($schema_files[$i]); |
| 585 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
| 585 | + if (!$file || substr($file, -4) != '.xml') continue; |
|
| 586 | 586 | $output = $oDB->createTableByXmlFile($file); |
| 587 | - if($output === false) |
|
| 587 | + if ($output === false) |
|
| 588 | 588 | throw new Exception('msg_create_table_failed'); |
| 589 | 589 | } |
| 590 | 590 | // Create a table and module instance and then execute install() method |
| 591 | 591 | unset($oModule); |
| 592 | 592 | $oModule = getClass($module); |
| 593 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
| 593 | + if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
| 594 | 594 | return new BaseObject(); |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | function _getDBConfigFileContents($db_info) |
| 598 | 598 | { |
| 599 | - if(substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
| 599 | + if (substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
| 600 | 600 | { |
| 601 | 601 | $db_info->master_db['db_table_prefix'] .= '_'; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - foreach($db_info->slave_db as &$slave) |
|
| 604 | + foreach ($db_info->slave_db as &$slave) |
|
| 605 | 605 | { |
| 606 | - if(substr($slave['db_table_prefix'], -1) != '_') |
|
| 606 | + if (substr($slave['db_table_prefix'], -1) != '_') |
|
| 607 | 607 | { |
| 608 | 608 | $slave['db_table_prefix'] .= '_'; |
| 609 | 609 | } |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | |
| 612 | 612 | $buff = array(); |
| 613 | 613 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
| 614 | - $buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';'; |
|
| 614 | + $buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';'; |
|
| 615 | 615 | |
| 616 | 616 | return implode(PHP_EOL, $buff); |
| 617 | 617 | } |
@@ -625,13 +625,13 @@ discard block |
||
| 625 | 625 | $db_tmp_config_file = $this->db_tmp_config_file; |
| 626 | 626 | |
| 627 | 627 | $db_info = Context::getDBInfo(); |
| 628 | - if(!$db_info) return; |
|
| 628 | + if (!$db_info) return; |
|
| 629 | 629 | |
| 630 | 630 | $buff = $this->_getDBConfigFileContents($db_info); |
| 631 | 631 | |
| 632 | 632 | FileHandler::writeFile($db_tmp_config_file, $buff); |
| 633 | 633 | |
| 634 | - if(@file_exists($db_tmp_config_file)) return true; |
|
| 634 | + if (@file_exists($db_tmp_config_file)) return true; |
|
| 635 | 635 | return false; |
| 636 | 636 | } |
| 637 | 637 | |
@@ -644,14 +644,14 @@ discard block |
||
| 644 | 644 | $etc_tmp_config_file = $this->etc_tmp_config_file; |
| 645 | 645 | |
| 646 | 646 | $buff = '<?php if(!defined("__XE__")) exit();'."\n"; |
| 647 | - foreach($config_info as $key => $val) |
|
| 647 | + foreach ($config_info as $key => $val) |
|
| 648 | 648 | { |
| 649 | - $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
| 649 | + $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
| 653 | 653 | |
| 654 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
| 654 | + if (@file_exists($etc_tmp_config_file)) return true; |
|
| 655 | 655 | return false; |
| 656 | 656 | } |
| 657 | 657 | |
@@ -666,13 +666,13 @@ discard block |
||
| 666 | 666 | //if(file_exists($config_file)) return; |
| 667 | 667 | |
| 668 | 668 | $db_info = Context::getDBInfo(); |
| 669 | - if(!$db_info) return; |
|
| 669 | + if (!$db_info) return; |
|
| 670 | 670 | |
| 671 | 671 | $buff = $this->_getDBConfigFileContents($db_info); |
| 672 | 672 | |
| 673 | 673 | FileHandler::writeFile($config_file, $buff); |
| 674 | 674 | |
| 675 | - if(@file_exists($config_file)) |
|
| 675 | + if (@file_exists($config_file)) |
|
| 676 | 676 | { |
| 677 | 677 | FileHandler::removeFile($this->db_tmp_config_file); |
| 678 | 678 | FileHandler::removeFile($this->etc_tmp_config_file); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | function installByConfig($install_config_file) |
| 688 | 688 | { |
| 689 | 689 | include $install_config_file; |
| 690 | - if(!is_array($auto_config)) return false; |
|
| 690 | + if (!is_array($auto_config)) return false; |
|
| 691 | 691 | |
| 692 | 692 | $auto_config['module'] = 'install'; |
| 693 | 693 | $auto_config['act'] = 'procInstall'; |
@@ -695,22 +695,22 @@ discard block |
||
| 695 | 695 | $fstr = "<%s><![CDATA[%s]]></%s>\r\n"; |
| 696 | 696 | $fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n"; |
| 697 | 697 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
| 698 | - foreach($auto_config as $k => $v) |
|
| 698 | + foreach ($auto_config as $k => $v) |
|
| 699 | 699 | { |
| 700 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
| 700 | + if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k); |
|
| 701 | 701 | } |
| 702 | 702 | $body .= "</params>\r\n</methodCall>"; |
| 703 | 703 | |
| 704 | - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body); |
|
| 704 | + $header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body); |
|
| 705 | 705 | $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5); |
| 706 | 706 | |
| 707 | - if($fp) |
|
| 707 | + if ($fp) |
|
| 708 | 708 | { |
| 709 | 709 | fputs($fp, $header); |
| 710 | - while(!feof($fp)) |
|
| 710 | + while (!feof($fp)) |
|
| 711 | 711 | { |
| 712 | 712 | $line = trim(fgets($fp, 4096)); |
| 713 | - if(strncmp('<error>', $line, 7) === 0) |
|
| 713 | + if (strncmp('<error>', $line, 7) === 0) |
|
| 714 | 714 | { |
| 715 | 715 | fclose($fp); |
| 716 | 716 | return false; |
@@ -101,11 +101,17 @@ discard block |
||
| 101 | 101 | // Check if available to connect to the DB |
| 102 | 102 | $oDB = &DB::getInstance(); |
| 103 | 103 | $output = $oDB->getError(); |
| 104 | - if(!$output->toBool()) return $output; |
|
| 105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
| 104 | + if(!$output->toBool()) { |
|
| 105 | + return $output; |
|
| 106 | + } |
|
| 107 | + if(!$oDB->isConnected()) { |
|
| 108 | + return $oDB->getError(); |
|
| 109 | + } |
|
| 106 | 110 | |
| 107 | 111 | // Create a db temp config file |
| 108 | - if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
| 112 | + if(!$this->makeDBConfigFile()) { |
|
| 113 | + return new BaseObject(-1, 'msg_install_failed'); |
|
| 114 | + } |
|
| 109 | 115 | |
| 110 | 116 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
| 111 | 117 | { |
@@ -122,10 +128,14 @@ discard block |
||
| 122 | 128 | { |
| 123 | 129 | // Get variables |
| 124 | 130 | $config_info = Context::gets('use_rewrite','time_zone'); |
| 125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
| 131 | + if($config_info->use_rewrite!='Y') { |
|
| 132 | + $config_info->use_rewrite = 'N'; |
|
| 133 | + } |
|
| 126 | 134 | |
| 127 | 135 | // Create a db temp config file |
| 128 | - if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed'); |
|
| 136 | + if(!$this->makeEtcConfigFile($config_info)) { |
|
| 137 | + return new BaseObject(-1, 'msg_install_failed'); |
|
| 138 | + } |
|
| 129 | 139 | |
| 130 | 140 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
| 131 | 141 | { |
@@ -141,7 +151,9 @@ discard block |
||
| 141 | 151 | function procInstall() |
| 142 | 152 | { |
| 143 | 153 | // Check if it is already installed |
| 144 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
| 154 | + if(Context::isInstalled()) { |
|
| 155 | + return new BaseObject(-1, 'msg_already_installed'); |
|
| 156 | + } |
|
| 145 | 157 | |
| 146 | 158 | Context::loadLang('modules/member/lang'); |
| 147 | 159 | $oMemberModel = getModel('member'); |
@@ -167,8 +179,12 @@ discard block |
||
| 167 | 179 | // install by default XE UI |
| 168 | 180 | else |
| 169 | 181 | { |
| 170 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
| 171 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
| 182 | + if(FileHandler::exists($this->db_tmp_config_file)) { |
|
| 183 | + include $this->db_tmp_config_file; |
|
| 184 | + } |
|
| 185 | + if(FileHandler::exists($this->etc_tmp_config_file)) { |
|
| 186 | + include $this->etc_tmp_config_file; |
|
| 187 | + } |
|
| 172 | 188 | } |
| 173 | 189 | |
| 174 | 190 | // Set DB type and information |
@@ -176,7 +192,9 @@ discard block |
||
| 176 | 192 | // Create DB Instance |
| 177 | 193 | $oDB = &DB::getInstance(); |
| 178 | 194 | // Check if available to connect to the DB |
| 179 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
| 195 | + if(!$oDB->isConnected()) { |
|
| 196 | + return $oDB->getError(); |
|
| 197 | + } |
|
| 180 | 198 | |
| 181 | 199 | // Install all the modules |
| 182 | 200 | try { |
@@ -189,7 +207,9 @@ discard block |
||
| 189 | 207 | } |
| 190 | 208 | |
| 191 | 209 | // Create a config file |
| 192 | - if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
| 210 | + if(!$this->makeConfigFile()) { |
|
| 211 | + return new BaseObject(-1, 'msg_install_failed'); |
|
| 212 | + } |
|
| 193 | 213 | |
| 194 | 214 | // load script |
| 195 | 215 | $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
@@ -246,14 +266,17 @@ discard block |
||
| 246 | 266 | { |
| 247 | 267 | $https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT']; |
| 248 | 268 | $https_port = (!$https_port != 443) ? $https_port : null; |
| 249 | - } |
|
| 250 | - else |
|
| 269 | + } else |
|
| 251 | 270 | { |
| 252 | 271 | $http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT']; |
| 253 | 272 | $http_port = (!$http_port != 80) ? $http_port : null; |
| 254 | 273 | } |
| 255 | - if($http_port) $db_info->http_port = $http_port; |
|
| 256 | - if($https_port) $db_info->https_port = $https_port; |
|
| 274 | + if($http_port) { |
|
| 275 | + $db_info->http_port = $http_port; |
|
| 276 | + } |
|
| 277 | + if($https_port) { |
|
| 278 | + $db_info->https_port = $https_port; |
|
| 279 | + } |
|
| 257 | 280 | |
| 258 | 281 | return $db_info; |
| 259 | 282 | } |
@@ -263,12 +286,20 @@ discard block |
||
| 263 | 286 | */ |
| 264 | 287 | function procInstallFTP() |
| 265 | 288 | { |
| 266 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
| 289 | + if(Context::isInstalled()) { |
|
| 290 | + return new BaseObject(-1, 'msg_already_installed'); |
|
| 291 | + } |
|
| 267 | 292 | $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
| 268 | 293 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
| 269 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
| 270 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
| 271 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
| 294 | + if(!$ftp_info->ftp_port) { |
|
| 295 | + $ftp_info->ftp_port = 21; |
|
| 296 | + } |
|
| 297 | + if(!$ftp_info->ftp_host) { |
|
| 298 | + $ftp_info->ftp_host = '127.0.0.1'; |
|
| 299 | + } |
|
| 300 | + if(!$ftp_info->ftp_root_path) { |
|
| 301 | + $ftp_info->ftp_root_path = '/'; |
|
| 302 | + } |
|
| 272 | 303 | |
| 273 | 304 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
| 274 | 305 | $buff[] = "\$ftp_info = new stdClass();"; |
@@ -280,11 +311,15 @@ discard block |
||
| 280 | 311 | // If safe_mode |
| 281 | 312 | if(ini_get('safe_mode')) |
| 282 | 313 | { |
| 283 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
| 314 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
| 315 | + return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
| 316 | + } |
|
| 284 | 317 | |
| 285 | 318 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
| 286 | 319 | $oFtp = new ftp(); |
| 287 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 320 | + if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) { |
|
| 321 | + return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 322 | + } |
|
| 288 | 323 | |
| 289 | 324 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
| 290 | 325 | { |
@@ -326,10 +361,16 @@ discard block |
||
| 326 | 361 | { |
| 327 | 362 | $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
| 328 | 363 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
| 329 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
| 330 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
| 364 | + if(!$ftp_info->ftp_port) { |
|
| 365 | + $ftp_info->ftp_port = 21; |
|
| 366 | + } |
|
| 367 | + if(!$ftp_info->sftp) { |
|
| 368 | + $ftp_info->sftp = 'N'; |
|
| 369 | + } |
|
| 331 | 370 | |
| 332 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
| 371 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
| 372 | + return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
| 373 | + } |
|
| 333 | 374 | |
| 334 | 375 | if($ftp_info->sftp == 'Y') |
| 335 | 376 | { |
@@ -338,12 +379,13 @@ discard block |
||
| 338 | 379 | { |
| 339 | 380 | return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
| 340 | 381 | } |
| 341 | - } |
|
| 342 | - else |
|
| 382 | + } else |
|
| 343 | 383 | { |
| 344 | 384 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
| 345 | 385 | $oFtp = new ftp(); |
| 346 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
| 386 | + if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) { |
|
| 387 | + return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
| 388 | + } |
|
| 347 | 389 | |
| 348 | 390 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
| 349 | 391 | { |
@@ -376,26 +418,47 @@ discard block |
||
| 376 | 418 | } |
| 377 | 419 | |
| 378 | 420 | // 1. Check permission |
| 379 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
| 380 | - else $checklist['permission'] = false; |
|
| 421 | + if(is_writable('./')||is_writable('./files')) { |
|
| 422 | + $checklist['permission'] = true; |
|
| 423 | + } else { |
|
| 424 | + $checklist['permission'] = false; |
|
| 425 | + } |
|
| 381 | 426 | // 2. Check if xml_parser_create exists |
| 382 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
| 383 | - else $checklist['xml'] = false; |
|
| 427 | + if(function_exists('xml_parser_create')) { |
|
| 428 | + $checklist['xml'] = true; |
|
| 429 | + } else { |
|
| 430 | + $checklist['xml'] = false; |
|
| 431 | + } |
|
| 384 | 432 | // 3. Check if ini_get (session.auto_start) == 1 |
| 385 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
| 386 | - else $checklist['session'] = false; |
|
| 433 | + if(ini_get('session.auto_start')!=1) { |
|
| 434 | + $checklist['session'] = true; |
|
| 435 | + } else { |
|
| 436 | + $checklist['session'] = false; |
|
| 437 | + } |
|
| 387 | 438 | // 4. Check if iconv exists |
| 388 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
| 389 | - else $checklist['iconv'] = false; |
|
| 439 | + if(function_exists('iconv')) { |
|
| 440 | + $checklist['iconv'] = true; |
|
| 441 | + } else { |
|
| 442 | + $checklist['iconv'] = false; |
|
| 443 | + } |
|
| 390 | 444 | // 5. Check gd(imagecreatefromgif function) |
| 391 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
| 392 | - else $checklist['gd'] = false; |
|
| 445 | + if(function_exists('imagecreatefromgif')) { |
|
| 446 | + $checklist['gd'] = true; |
|
| 447 | + } else { |
|
| 448 | + $checklist['gd'] = false; |
|
| 449 | + } |
|
| 393 | 450 | // 6. Check DB |
| 394 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
| 395 | - else $checklist['db'] = false; |
|
| 451 | + if(DB::getEnableList()) { |
|
| 452 | + $checklist['db'] = true; |
|
| 453 | + } else { |
|
| 454 | + $checklist['db'] = false; |
|
| 455 | + } |
|
| 396 | 456 | |
| 397 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
| 398 | - else $install_enable = true; |
|
| 457 | + if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) { |
|
| 458 | + $install_enable = false; |
|
| 459 | + } else { |
|
| 460 | + $install_enable = true; |
|
| 461 | + } |
|
| 399 | 462 | |
| 400 | 463 | // Save the checked result to the Context |
| 401 | 464 | Context::set('checklist', $checklist); |
@@ -418,8 +481,7 @@ discard block |
||
| 418 | 481 | { |
| 419 | 482 | $currentTime = $_SERVER['REQUEST_TIME']; |
| 420 | 483 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
| 421 | - } |
|
| 422 | - else |
|
| 484 | + } else |
|
| 423 | 485 | { |
| 424 | 486 | FileHandler::removeFile($this->flagLicenseAgreement); |
| 425 | 487 | return new BaseObject(-1, 'msg_must_accept_license_agreement'); |
@@ -514,13 +576,17 @@ discard block |
||
| 514 | 576 | $module = $tmp_arr[count($tmp_arr)-1]; |
| 515 | 577 | |
| 516 | 578 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
| 517 | - if(!$xml_info) continue; |
|
| 579 | + if(!$xml_info) { |
|
| 580 | + continue; |
|
| 581 | + } |
|
| 518 | 582 | $modules[$xml_info->category][] = $module; |
| 519 | 583 | } |
| 520 | 584 | // Install "module" module in advance |
| 521 | 585 | $this->installModule('module','./modules/module'); |
| 522 | 586 | $oModule = getClass('module'); |
| 523 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 587 | + if($oModule->checkUpdate()) { |
|
| 588 | + $oModule->moduleUpdate(); |
|
| 589 | + } |
|
| 524 | 590 | // Determine the order of module installation depending on category |
| 525 | 591 | $install_step = array('system','content','member'); |
| 526 | 592 | // Install all the remaining modules |
@@ -530,13 +596,17 @@ discard block |
||
| 530 | 596 | { |
| 531 | 597 | foreach($modules[$category] as $module) |
| 532 | 598 | { |
| 533 | - if($module == 'module') continue; |
|
| 599 | + if($module == 'module') { |
|
| 600 | + continue; |
|
| 601 | + } |
|
| 534 | 602 | $this->installModule($module, sprintf('./modules/%s', $module)); |
| 535 | 603 | |
| 536 | 604 | $oModule = getClass($module); |
| 537 | 605 | if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
| 538 | 606 | { |
| 539 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 607 | + if($oModule->checkUpdate()) { |
|
| 608 | + $oModule->moduleUpdate(); |
|
| 609 | + } |
|
| 540 | 610 | } |
| 541 | 611 | } |
| 542 | 612 | unset($modules[$category]); |
@@ -551,13 +621,17 @@ discard block |
||
| 551 | 621 | { |
| 552 | 622 | foreach($module_list as $module) |
| 553 | 623 | { |
| 554 | - if($module == 'module') continue; |
|
| 624 | + if($module == 'module') { |
|
| 625 | + continue; |
|
| 626 | + } |
|
| 555 | 627 | $this->installModule($module, sprintf('./modules/%s', $module)); |
| 556 | 628 | |
| 557 | 629 | $oModule = getClass($module); |
| 558 | 630 | if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
| 559 | 631 | { |
| 560 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
| 632 | + if($oModule->checkUpdate()) { |
|
| 633 | + $oModule->moduleUpdate(); |
|
| 634 | + } |
|
| 561 | 635 | } |
| 562 | 636 | } |
| 563 | 637 | } |
@@ -582,15 +656,20 @@ discard block |
||
| 582 | 656 | for($i=0;$i<$file_cnt;$i++) |
| 583 | 657 | { |
| 584 | 658 | $file = trim($schema_files[$i]); |
| 585 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
| 659 | + if(!$file || substr($file,-4)!='.xml') { |
|
| 660 | + continue; |
|
| 661 | + } |
|
| 586 | 662 | $output = $oDB->createTableByXmlFile($file); |
| 587 | - if($output === false) |
|
| 588 | - throw new Exception('msg_create_table_failed'); |
|
| 663 | + if($output === false) { |
|
| 664 | + throw new Exception('msg_create_table_failed'); |
|
| 665 | + } |
|
| 589 | 666 | } |
| 590 | 667 | // Create a table and module instance and then execute install() method |
| 591 | 668 | unset($oModule); |
| 592 | 669 | $oModule = getClass($module); |
| 593 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
| 670 | + if(method_exists($oModule, 'moduleInstall')) { |
|
| 671 | + $oModule->moduleInstall(); |
|
| 672 | + } |
|
| 594 | 673 | return new BaseObject(); |
| 595 | 674 | } |
| 596 | 675 | |
@@ -625,13 +704,17 @@ discard block |
||
| 625 | 704 | $db_tmp_config_file = $this->db_tmp_config_file; |
| 626 | 705 | |
| 627 | 706 | $db_info = Context::getDBInfo(); |
| 628 | - if(!$db_info) return; |
|
| 707 | + if(!$db_info) { |
|
| 708 | + return; |
|
| 709 | + } |
|
| 629 | 710 | |
| 630 | 711 | $buff = $this->_getDBConfigFileContents($db_info); |
| 631 | 712 | |
| 632 | 713 | FileHandler::writeFile($db_tmp_config_file, $buff); |
| 633 | 714 | |
| 634 | - if(@file_exists($db_tmp_config_file)) return true; |
|
| 715 | + if(@file_exists($db_tmp_config_file)) { |
|
| 716 | + return true; |
|
| 717 | + } |
|
| 635 | 718 | return false; |
| 636 | 719 | } |
| 637 | 720 | |
@@ -651,7 +734,9 @@ discard block |
||
| 651 | 734 | |
| 652 | 735 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
| 653 | 736 | |
| 654 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
| 737 | + if(@file_exists($etc_tmp_config_file)) { |
|
| 738 | + return true; |
|
| 739 | + } |
|
| 655 | 740 | return false; |
| 656 | 741 | } |
| 657 | 742 | |
@@ -666,7 +751,9 @@ discard block |
||
| 666 | 751 | //if(file_exists($config_file)) return; |
| 667 | 752 | |
| 668 | 753 | $db_info = Context::getDBInfo(); |
| 669 | - if(!$db_info) return; |
|
| 754 | + if(!$db_info) { |
|
| 755 | + return; |
|
| 756 | + } |
|
| 670 | 757 | |
| 671 | 758 | $buff = $this->_getDBConfigFileContents($db_info); |
| 672 | 759 | |
@@ -687,7 +774,9 @@ discard block |
||
| 687 | 774 | function installByConfig($install_config_file) |
| 688 | 775 | { |
| 689 | 776 | include $install_config_file; |
| 690 | - if(!is_array($auto_config)) return false; |
|
| 777 | + if(!is_array($auto_config)) { |
|
| 778 | + return false; |
|
| 779 | + } |
|
| 691 | 780 | |
| 692 | 781 | $auto_config['module'] = 'install'; |
| 693 | 782 | $auto_config['act'] = 'procInstall'; |
@@ -697,7 +786,9 @@ discard block |
||
| 697 | 786 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
| 698 | 787 | foreach($auto_config as $k => $v) |
| 699 | 788 | { |
| 700 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
| 789 | + if(!in_array($k,array('host','port','path'))) { |
|
| 790 | + $body .= sprintf($fstr,$k,$v,$k); |
|
| 791 | + } |
|
| 701 | 792 | } |
| 702 | 793 | $body .= "</params>\r\n</methodCall>"; |
| 703 | 794 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * get layout setting view. |
| 19 | - * @return void |
|
| 19 | + * @return string|null |
|
| 20 | 20 | */ |
| 21 | 21 | public function getLayoutAdminSetInfoView() |
| 22 | 22 | { |
@@ -115,14 +115,17 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
| 117 | 117 | $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
| 118 | - } |
|
| 119 | - else |
|
| 118 | + } else |
|
| 120 | 119 | { |
| 121 | 120 | $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 122 | 121 | $layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl); |
| 123 | 122 | |
| 124 | - if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
| 125 | - if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
| 123 | + if(!file_exists($layout_file)) { |
|
| 124 | + $layout_file = $layout_info->path . 'layout.html'; |
|
| 125 | + } |
|
| 126 | + if(!file_exists($layout_css_file)) { |
|
| 127 | + $layout_css_file = $layout_info->path . 'layout.css'; |
|
| 128 | + } |
|
| 126 | 129 | } |
| 127 | 130 | |
| 128 | 131 | if(file_exists($layout_css_file)) |
@@ -182,7 +185,9 @@ discard block |
||
| 182 | 185 | { |
| 183 | 186 | $target = ($viewType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
| 184 | 187 | $designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $siteSrl); |
| 185 | - if(FileHandler::exists($designInfoFile)) include($designInfoFile); |
|
| 188 | + if(FileHandler::exists($designInfoFile)) { |
|
| 189 | + include($designInfoFile); |
|
| 190 | + } |
|
| 186 | 191 | |
| 187 | 192 | if(!$designInfo || !$designInfo->{$target}) |
| 188 | 193 | { |
@@ -30,27 +30,27 @@ discard block |
||
| 30 | 30 | preg_match_all('/<!--#JSPLUGIN:(.*)-->/', $html, $m); |
| 31 | 31 | $pluginList = $m[1]; |
| 32 | 32 | |
| 33 | - foreach($pluginList as $plugin) |
|
| 33 | + foreach ($pluginList as $plugin) |
|
| 34 | 34 | { |
| 35 | 35 | $info = Context::getJavascriptPluginInfo($plugin); |
| 36 | - if(!$info) |
|
| 36 | + if (!$info) |
|
| 37 | 37 | { |
| 38 | 38 | continue; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - foreach($info->jsList as $js) |
|
| 41 | + foreach ($info->jsList as $js) |
|
| 42 | 42 | { |
| 43 | 43 | $script .= sprintf('<script src="%s"></script>', $js); |
| 44 | 44 | } |
| 45 | - foreach($info->cssList as $css) |
|
| 45 | + foreach ($info->cssList as $css) |
|
| 46 | 46 | { |
| 47 | 47 | $csss .= sprintf('<link rel="stylesheet" href="%s" />', $css); |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $this->add('html', $csss . $script . $html); |
|
| 51 | + $this->add('html', $csss.$script.$html); |
|
| 52 | 52 | |
| 53 | - if($isReturn) |
|
| 53 | + if ($isReturn) |
|
| 54 | 54 | { |
| 55 | 55 | return $this->get('html'); |
| 56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 66 | 66 | |
| 67 | 67 | // Error appears if there is no layout information is registered |
| 68 | - if(!$layout_info) |
|
| 68 | + if (!$layout_info) |
|
| 69 | 69 | { |
| 70 | 70 | return $this->stop('msg_invalid_request'); |
| 71 | 71 | } |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | $layout_info = $security->encodeHTML('.', 'author..', 'extra_var..'); |
| 83 | 83 | |
| 84 | 84 | $layout_info->description = nl2br(trim($layout_info->description)); |
| 85 | - if(!is_object($layout_info->extra_var)) |
|
| 85 | + if (!is_object($layout_info->extra_var)) |
|
| 86 | 86 | { |
| 87 | 87 | $layout_info->extra_var = new StdClass(); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - foreach($layout_info->extra_var as $var_name => $val) |
|
| 90 | + foreach ($layout_info->extra_var as $var_name => $val) |
|
| 91 | 91 | { |
| 92 | - if(isset($layout_info->{$var_name}->description)) |
|
| 92 | + if (isset($layout_info->{$var_name}->description)) |
|
| 93 | 93 | { |
| 94 | 94 | $layout_info->{$var_name}->description = nl2br(trim($val->description)); |
| 95 | 95 | } |
@@ -105,27 +105,27 @@ discard block |
||
| 105 | 105 | $oLayoutModel = getModel('layout'); |
| 106 | 106 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 107 | 107 | // Error appears if there is no layout information is registered |
| 108 | - if(!$layout_info) |
|
| 108 | + if (!$layout_info) |
|
| 109 | 109 | { |
| 110 | 110 | return $this->dispLayoutAdminInstalledList(); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // Get Layout Code |
| 114 | - if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)) |
|
| 114 | + if ($oLayoutModel->useDefaultLayout($layout_info->layout_srl)) |
|
| 115 | 115 | { |
| 116 | - $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
|
| 117 | - $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
|
| 116 | + $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
|
| 117 | + $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
|
| 118 | 118 | } |
| 119 | 119 | else |
| 120 | 120 | { |
| 121 | 121 | $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 122 | 122 | $layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl); |
| 123 | 123 | |
| 124 | - if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
| 125 | - if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
| 124 | + if (!file_exists($layout_file)) $layout_file = $layout_info->path.'layout.html'; |
|
| 125 | + if (!file_exists($layout_css_file)) $layout_css_file = $layout_info->path.'layout.css'; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if(file_exists($layout_css_file)) |
|
| 128 | + if (file_exists($layout_css_file)) |
|
| 129 | 129 | { |
| 130 | 130 | $layout_code_css = FileHandler::readFile($layout_css_file); |
| 131 | 131 | Context::set('layout_code_css', $layout_code_css); |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | public function getSiteDefaultLayout($viewType = 'P', $siteSrl = 0) |
| 182 | 182 | { |
| 183 | 183 | $target = ($viewType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
| 184 | - $designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $siteSrl); |
|
| 185 | - if(FileHandler::exists($designInfoFile)) include($designInfoFile); |
|
| 184 | + $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $siteSrl); |
|
| 185 | + if (FileHandler::exists($designInfoFile)) include($designInfoFile); |
|
| 186 | 186 | |
| 187 | - if(!$designInfo || !$designInfo->{$target}) |
|
| 187 | + if (!$designInfo || !$designInfo->{$target}) |
|
| 188 | 188 | { |
| 189 | 189 | return 0; |
| 190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $oModel = getModel('layout'); |
| 193 | 193 | $layout_info = $oModel->getLayout($designInfo->{$target}); |
| 194 | 194 | |
| 195 | - if(!$layout_info) |
|
| 195 | + if (!$layout_info) |
|
| 196 | 196 | { |
| 197 | 197 | return 0; |
| 198 | 198 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * It uses caching to reduce time for xml parsing .. |
| 436 | 436 | * @param string $layout |
| 437 | 437 | * @param object $info |
| 438 | - * @param string $layoutType (P : PC, M : Mobile) |
|
| 438 | + * @param string $layout_type (P : PC, M : Mobile) |
|
| 439 | 439 | * @return object info of layout |
| 440 | 440 | */ |
| 441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P") |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | /** |
| 738 | 738 | * Return a list of images which are uploaded on the layout setting page |
| 739 | 739 | * @param int $layout_srl |
| 740 | - * @return array image list in layout |
|
| 740 | + * @return string[] image list in layout |
|
| 741 | 741 | */ |
| 742 | 742 | function getUserLayoutImageList($layout_srl) |
| 743 | 743 | { |
@@ -892,7 +892,6 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | /** |
| 894 | 894 | * layout cache |
| 895 | - * @param int $layout_srl |
|
| 896 | 895 | * @param string $lang_type |
| 897 | 896 | * @return string |
| 898 | 897 | */ |
@@ -972,7 +971,7 @@ discard block |
||
| 972 | 971 | /** |
| 973 | 972 | * Temp file list for User Layout |
| 974 | 973 | * @param int $layout_srl |
| 975 | - * @return array temp files info |
|
| 974 | + * @return string[] temp files info |
|
| 976 | 975 | */ |
| 977 | 976 | function getUserLayoutTempFileList($layout_srl) |
| 978 | 977 | { |
@@ -986,7 +985,7 @@ discard block |
||
| 986 | 985 | /** |
| 987 | 986 | * Saved file list for User Layout |
| 988 | 987 | * @param int $layout_srl |
| 989 | - * @return array files info |
|
| 988 | + * @return string[] files info |
|
| 990 | 989 | */ |
| 991 | 990 | function getUserLayoutFileList($layout_srl) |
| 992 | 991 | { |
@@ -92,16 +92,14 @@ discard block |
||
| 92 | 92 | if(count($token) == 2) |
| 93 | 93 | { |
| 94 | 94 | $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); |
| 95 | - } |
|
| 96 | - else |
|
| 95 | + } else |
|
| 97 | 96 | { |
| 98 | 97 | $thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); |
| 99 | 98 | } |
| 100 | 99 | if(is_readable($thumbnailPath)) |
| 101 | 100 | { |
| 102 | 101 | $val->thumbnail = $thumbnailPath; |
| 103 | - } |
|
| 104 | - else |
|
| 102 | + } else |
|
| 105 | 103 | { |
| 106 | 104 | $val->thumbnail = sprintf('./modules/layout/tpl/img/noThumbnail.png'); |
| 107 | 105 | } |
@@ -140,8 +138,7 @@ discard block |
||
| 140 | 138 | if($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
| 141 | 139 | { |
| 142 | 140 | $instanceList[] = $iInfo->layout; |
| 143 | - } |
|
| 144 | - else |
|
| 141 | + } else |
|
| 145 | 142 | { |
| 146 | 143 | unset($output->data[$no]); |
| 147 | 144 | } |
@@ -176,8 +173,7 @@ discard block |
||
| 176 | 173 | $oLayoutAdminController->insertLayout($insertArgs); |
| 177 | 174 | $isCreateInstance = TRUE; |
| 178 | 175 | } |
| 179 | - } |
|
| 180 | - else |
|
| 176 | + } else |
|
| 181 | 177 | { |
| 182 | 178 | // Get downloaded name list have no instance |
| 183 | 179 | $noInstanceList = array_diff($downloadedList, $instanceList); |
@@ -230,8 +226,7 @@ discard block |
||
| 230 | 226 | { |
| 231 | 227 | $pathPrefix = _XE_PATH_ . 'layouts/'; |
| 232 | 228 | $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s'; |
| 233 | - } |
|
| 234 | - else |
|
| 229 | + } else |
|
| 235 | 230 | { |
| 236 | 231 | $pathPrefix = _XE_PATH_ . 'm.layouts/'; |
| 237 | 232 | $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s'; |
@@ -241,8 +236,7 @@ discard block |
||
| 241 | 236 | { |
| 242 | 237 | list($themeName, $layoutName) = explode('|@|', $layout); |
| 243 | 238 | $path = sprintf($themePathFormat, $themeName, $layoutName); |
| 244 | - } |
|
| 245 | - else |
|
| 239 | + } else |
|
| 246 | 240 | { |
| 247 | 241 | $path = $pathPrefix . $layout; |
| 248 | 242 | } |
@@ -262,7 +256,9 @@ discard block |
||
| 262 | 256 | $args = new stdClass(); |
| 263 | 257 | $args->layout_srl = $layout_srl; |
| 264 | 258 | $output = executeQuery('layout.getLayout', $args); |
| 265 | - if(!$output->data) return; |
|
| 259 | + if(!$output->data) { |
|
| 260 | + return; |
|
| 261 | + } |
|
| 266 | 262 | |
| 267 | 263 | // Return xml file informaton after listing up the layout and extra_vars |
| 268 | 264 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); |
@@ -295,20 +291,19 @@ discard block |
||
| 295 | 291 | if(count($layout_parse) > 1) |
| 296 | 292 | { |
| 297 | 293 | $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; |
| 298 | - } |
|
| 299 | - else if($layout_name == 'faceoff') |
|
| 294 | + } else if($layout_name == 'faceoff') |
|
| 300 | 295 | { |
| 301 | 296 | $class_path = './modules/layout/faceoff/'; |
| 302 | - } |
|
| 303 | - else if($layout_type == "M") |
|
| 297 | + } else if($layout_type == "M") |
|
| 304 | 298 | { |
| 305 | 299 | $class_path = sprintf("./m.layouts/%s/", $layout_name); |
| 306 | - } |
|
| 307 | - else |
|
| 300 | + } else |
|
| 308 | 301 | { |
| 309 | 302 | $class_path = sprintf('./layouts/%s/', $layout_name); |
| 310 | 303 | } |
| 311 | - if(is_dir($class_path)) return $class_path; |
|
| 304 | + if(is_dir($class_path)) { |
|
| 305 | + return $class_path; |
|
| 306 | + } |
|
| 312 | 307 | return ""; |
| 313 | 308 | } |
| 314 | 309 | |
@@ -321,12 +316,16 @@ discard block |
||
| 321 | 316 | */ |
| 322 | 317 | function getDownloadedLayoutList($layout_type = "P", $withAutoinstallInfo = false) |
| 323 | 318 | { |
| 324 | - if ($withAutoinstallInfo) $oAutoinstallModel = getModel('autoinstall'); |
|
| 319 | + if ($withAutoinstallInfo) { |
|
| 320 | + $oAutoinstallModel = getModel('autoinstall'); |
|
| 321 | + } |
|
| 325 | 322 | |
| 326 | 323 | // Get a list of downloaded layout and installed layout |
| 327 | 324 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type); |
| 328 | 325 | $searched_count = count($searched_list); |
| 329 | - if(!$searched_count) return; |
|
| 326 | + if(!$searched_count) { |
|
| 327 | + return; |
|
| 328 | + } |
|
| 330 | 329 | |
| 331 | 330 | // natcasesort($searched_list); |
| 332 | 331 | // Return information for looping searched list of layouts |
@@ -414,17 +413,20 @@ discard block |
||
| 414 | 413 | { |
| 415 | 414 | $directory = './m.layouts'; |
| 416 | 415 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES'; |
| 417 | - } |
|
| 418 | - else |
|
| 416 | + } else |
|
| 419 | 417 | { |
| 420 | 418 | $directory = './layouts'; |
| 421 | 419 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; |
| 422 | 420 | } |
| 423 | 421 | |
| 424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
| 422 | + if($GLOBALS[$globalValueKey]) { |
|
| 423 | + return $GLOBALS[$globalValueKey]; |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | 426 | $searchedList = FileHandler::readDir($directory); |
| 427 | - if (!$searchedList) $searchedList = array(); |
|
| 427 | + if (!$searchedList) { |
|
| 428 | + $searchedList = array(); |
|
| 429 | + } |
|
| 428 | 430 | $GLOBALS[$globalValueKey] = $searchedList; |
| 429 | 431 | |
| 430 | 432 | return $searchedList; |
@@ -456,11 +458,17 @@ discard block |
||
| 456 | 458 | } |
| 457 | 459 | |
| 458 | 460 | // Get a path of the requested module. Return if not exists. |
| 459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
| 460 | - if(!is_dir($layout_path)) return; |
|
| 461 | + if(!$layout_path) { |
|
| 462 | + $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
| 463 | + } |
|
| 464 | + if(!is_dir($layout_path)) { |
|
| 465 | + return; |
|
| 466 | + } |
|
| 461 | 467 | |
| 462 | 468 | // Read the xml file for module skin information |
| 463 | - if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
| 469 | + if(!$xml_file) { |
|
| 470 | + $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
| 471 | + } |
|
| 464 | 472 | if(!file_exists($xml_file)) |
| 465 | 473 | { |
| 466 | 474 | $layout_info = new stdClass; |
@@ -479,8 +487,7 @@ discard block |
||
| 479 | 487 | if(!$layout_srl) |
| 480 | 488 | { |
| 481 | 489 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); |
| 482 | - } |
|
| 483 | - else |
|
| 490 | + } else |
|
| 484 | 491 | { |
| 485 | 492 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType()); |
| 486 | 493 | } |
@@ -511,10 +518,15 @@ discard block |
||
| 511 | 518 | $oXmlParser = new XmlParser(); |
| 512 | 519 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 513 | 520 | |
| 514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
| 515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
| 521 | + if($tmp_xml_obj->layout) { |
|
| 522 | + $xml_obj = $tmp_xml_obj->layout; |
|
| 523 | + } elseif($tmp_xml_obj->skin) { |
|
| 524 | + $xml_obj = $tmp_xml_obj->skin; |
|
| 525 | + } |
|
| 516 | 526 | |
| 517 | - if(!$xml_obj) return; |
|
| 527 | + if(!$xml_obj) { |
|
| 528 | + return; |
|
| 529 | + } |
|
| 518 | 530 | |
| 519 | 531 | $buff = array(); |
| 520 | 532 | $buff[] = '$layout_info = new stdClass;'; |
@@ -540,8 +552,11 @@ discard block |
||
| 540 | 552 | $buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); |
| 541 | 553 | |
| 542 | 554 | // Author information |
| 543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 544 | - else $author_list = $xml_obj->author; |
|
| 555 | + if(!is_array($xml_obj->author)) { |
|
| 556 | + $author_list[] = $xml_obj->author; |
|
| 557 | + } else { |
|
| 558 | + $author_list = $xml_obj->author; |
|
| 559 | + } |
|
| 545 | 560 | |
| 546 | 561 | $buff[] = '$layout_info->author = array();'; |
| 547 | 562 | for($i=0, $c=count($author_list); $i<$c; $i++) |
@@ -554,8 +569,12 @@ discard block |
||
| 554 | 569 | |
| 555 | 570 | // Extra vars (user defined variables to use in a template) |
| 556 | 571 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 572 | + if(!$extra_var_groups) { |
|
| 573 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 574 | + } |
|
| 575 | + if(!is_array($extra_var_groups)) { |
|
| 576 | + $extra_var_groups = array($extra_var_groups); |
|
| 577 | + } |
|
| 559 | 578 | |
| 560 | 579 | $buff[] = '$layout_info->extra_var = new stdClass;'; |
| 561 | 580 | $extra_var_count = 0; |
@@ -564,7 +583,9 @@ discard block |
||
| 564 | 583 | $extra_vars = $group->var; |
| 565 | 584 | if($extra_vars) |
| 566 | 585 | { |
| 567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 586 | + if(!is_array($extra_vars)) { |
|
| 587 | + $extra_vars = array($extra_vars); |
|
| 588 | + } |
|
| 568 | 589 | |
| 569 | 590 | $count = count($extra_vars); |
| 570 | 591 | $extra_var_count += $count; |
@@ -583,8 +604,12 @@ discard block |
||
| 583 | 604 | $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
| 584 | 605 | |
| 585 | 606 | $options = $var->options; |
| 586 | - if(!$options) continue; |
|
| 587 | - if(!is_array($options)) $options = array($options); |
|
| 607 | + if(!$options) { |
|
| 608 | + continue; |
|
| 609 | + } |
|
| 610 | + if(!is_array($options)) { |
|
| 611 | + $options = array($options); |
|
| 612 | + } |
|
| 588 | 613 | |
| 589 | 614 | $buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); |
| 590 | 615 | $options_count = count($options); |
@@ -616,7 +641,9 @@ discard block |
||
| 616 | 641 | if($xml_obj->menus->menu) |
| 617 | 642 | { |
| 618 | 643 | $menus = $xml_obj->menus->menu; |
| 619 | - if(!is_array($menus)) $menus = array($menus); |
|
| 644 | + if(!is_array($menus)) { |
|
| 645 | + $menus = array($menus); |
|
| 646 | + } |
|
| 620 | 647 | |
| 621 | 648 | $menu_count = count($menus); |
| 622 | 649 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
@@ -624,7 +651,9 @@ discard block |
||
| 624 | 651 | for($i=0;$i<$menu_count;$i++) |
| 625 | 652 | { |
| 626 | 653 | $name = $menus[$i]->attrs->name; |
| 627 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 654 | + if($menus[$i]->attrs->default == "true") { |
|
| 655 | + $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 656 | + } |
|
| 628 | 657 | $buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); |
| 629 | 658 | $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); |
| 630 | 659 | $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
@@ -635,8 +664,7 @@ discard block |
||
| 635 | 664 | $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
| 636 | 665 | } |
| 637 | 666 | } |
| 638 | - } |
|
| 639 | - else |
|
| 667 | + } else |
|
| 640 | 668 | { |
| 641 | 669 | // Layout title, version and other information |
| 642 | 670 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -655,14 +683,20 @@ discard block |
||
| 655 | 683 | $buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); |
| 656 | 684 | // Extra vars (user defined variables to use in a template) |
| 657 | 685 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 686 | + if(!$extra_var_groups) { |
|
| 687 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 688 | + } |
|
| 689 | + if(!is_array($extra_var_groups)) { |
|
| 690 | + $extra_var_groups = array($extra_var_groups); |
|
| 691 | + } |
|
| 660 | 692 | foreach($extra_var_groups as $group) |
| 661 | 693 | { |
| 662 | 694 | $extra_vars = $group->var; |
| 663 | 695 | if($extra_vars) |
| 664 | 696 | { |
| 665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 697 | + if(!is_array($extra_vars)) { |
|
| 698 | + $extra_vars = array($extra_vars); |
|
| 699 | + } |
|
| 666 | 700 | |
| 667 | 701 | $extra_var_count = count($extra_vars); |
| 668 | 702 | |
@@ -680,9 +714,13 @@ discard block |
||
| 680 | 714 | $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
| 681 | 715 | |
| 682 | 716 | $options = $var->options; |
| 683 | - if(!$options) continue; |
|
| 717 | + if(!$options) { |
|
| 718 | + continue; |
|
| 719 | + } |
|
| 684 | 720 | |
| 685 | - if(!is_array($options)) $options = array($options); |
|
| 721 | + if(!is_array($options)) { |
|
| 722 | + $options = array($options); |
|
| 723 | + } |
|
| 686 | 724 | $options_count = count($options); |
| 687 | 725 | for($j=0;$j<$options_count;$j++) |
| 688 | 726 | { |
@@ -695,14 +733,18 @@ discard block |
||
| 695 | 733 | if($xml_obj->menus->menu) |
| 696 | 734 | { |
| 697 | 735 | $menus = $xml_obj->menus->menu; |
| 698 | - if(!is_array($menus)) $menus = array($menus); |
|
| 736 | + if(!is_array($menus)) { |
|
| 737 | + $menus = array($menus); |
|
| 738 | + } |
|
| 699 | 739 | |
| 700 | 740 | $menu_count = count($menus); |
| 701 | 741 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
| 702 | 742 | for($i=0;$i<$menu_count;$i++) |
| 703 | 743 | { |
| 704 | 744 | $name = $menus[$i]->attrs->name; |
| 705 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 745 | + if($menus[$i]->attrs->default == "true") { |
|
| 746 | + $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 747 | + } |
|
| 706 | 748 | $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); |
| 707 | 749 | $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
| 708 | 750 | $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); |
@@ -724,7 +766,9 @@ discard block |
||
| 724 | 766 | } |
| 725 | 767 | |
| 726 | 768 | FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); |
| 727 | - if(FileHandler::exists($cache_file)) include($cache_file); |
|
| 769 | + if(FileHandler::exists($cache_file)) { |
|
| 770 | + include($cache_file); |
|
| 771 | + } |
|
| 728 | 772 | |
| 729 | 773 | if(!$layout_info->title) |
| 730 | 774 | { |
@@ -798,7 +842,9 @@ discard block |
||
| 798 | 842 | */ |
| 799 | 843 | function getUserLayoutFaceOffCss($layout_srl) |
| 800 | 844 | { |
| 801 | - if($this->useUserLayoutTemp == 'temp') return; |
|
| 845 | + if($this->useUserLayoutTemp == 'temp') { |
|
| 846 | + return; |
|
| 847 | + } |
|
| 802 | 848 | return $this->_getUserLayoutFaceOffCss($layout_srl); |
| 803 | 849 | } |
| 804 | 850 | |
@@ -833,7 +879,9 @@ discard block |
||
| 833 | 879 | if($this->useUserLayoutTemp == 'temp') |
| 834 | 880 | { |
| 835 | 881 | $temp = $this->getUserLayoutTempHtml($layout_srl); |
| 836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp); |
|
| 882 | + if(FileHandler::exists($temp) === FALSE) { |
|
| 883 | + FileHandler::copyFile($src,$temp); |
|
| 884 | + } |
|
| 837 | 885 | return $temp; |
| 838 | 886 | } |
| 839 | 887 | |
@@ -861,7 +909,9 @@ discard block |
||
| 861 | 909 | if($this->useUserLayoutTemp == 'temp') |
| 862 | 910 | { |
| 863 | 911 | $temp = $this->getUserLayoutTempIni($layout_srl); |
| 864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp); |
|
| 912 | + if(!file_exists(FileHandler::getRealPath($temp))) { |
|
| 913 | + FileHandler::copyFile($src,$temp); |
|
| 914 | + } |
|
| 865 | 915 | return $temp; |
| 866 | 916 | } |
| 867 | 917 | |
@@ -901,8 +951,7 @@ discard block |
||
| 901 | 951 | if($layout_type=='P') |
| 902 | 952 | { |
| 903 | 953 | return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
| 904 | - } |
|
| 905 | - else |
|
| 954 | + } else |
|
| 906 | 955 | { |
| 907 | 956 | return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
| 908 | 957 | } |
@@ -1020,11 +1069,16 @@ discard block |
||
| 1020 | 1069 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); |
| 1021 | 1070 | // CSS generated in the layout manager |
| 1022 | 1071 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); |
| 1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
| 1072 | + if($faceoff_layout_css) { |
|
| 1073 | + Context::addCSSFile($faceoff_layout_css); |
|
| 1074 | + } |
|
| 1024 | 1075 | // CSS output for the widget |
| 1025 | 1076 | Context::loadFile($this->module_path.'/tpl/css/widget.css', true); |
| 1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1027 | - else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1077 | + if($layout_info->extra_var->colorset->value == 'black') { |
|
| 1078 | + Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1079 | + } else { |
|
| 1080 | + Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1081 | + } |
|
| 1028 | 1082 | // Different page displayed upon user's permission |
| 1029 | 1083 | $logged_info = Context::get('logged_info'); |
| 1030 | 1084 | // Display edit button for faceoff layout |
@@ -31,21 +31,21 @@ discard block |
||
| 31 | 31 | * @param array $columnList |
| 32 | 32 | * @return array layout lists in site |
| 33 | 33 | */ |
| 34 | - function getLayoutList($site_srl = 0, $layout_type="P", $columnList = array()) |
|
| 34 | + function getLayoutList($site_srl = 0, $layout_type = "P", $columnList = array()) |
|
| 35 | 35 | { |
| 36 | - if(!$site_srl) |
|
| 36 | + if (!$site_srl) |
|
| 37 | 37 | { |
| 38 | 38 | $site_module_info = Context::get('site_module_info'); |
| 39 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 39 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 40 | 40 | } |
| 41 | 41 | $args = new stdClass(); |
| 42 | 42 | $args->site_srl = $site_srl; |
| 43 | 43 | $args->layout_type = $layout_type; |
| 44 | 44 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
| 45 | 45 | |
| 46 | - foreach($output->data as $no => &$val) |
|
| 46 | + foreach ($output->data as $no => &$val) |
|
| 47 | 47 | { |
| 48 | - if(!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
| 48 | + if (!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
| 49 | 49 | { |
| 50 | 50 | unset($output->data[$no]); |
| 51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $oLayoutAdminModel = getAdminModel('layout'); |
| 55 | 55 | $siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl); |
| 56 | - if($siteDefaultLayoutSrl) |
|
| 56 | + if ($siteDefaultLayoutSrl) |
|
| 57 | 57 | { |
| 58 | 58 | $siteDefaultLayoutInfo = $this->getlayout($siteDefaultLayoutSrl); |
| 59 | 59 | $newLayout = sprintf('%s, %s', $siteDefaultLayoutInfo->title, $siteDefaultLayoutInfo->layout); |
@@ -80,24 +80,24 @@ discard block |
||
| 80 | 80 | $layoutList = $this->getLayoutInstanceList($siteSrl, $layoutType); |
| 81 | 81 | $thumbs = array(); |
| 82 | 82 | |
| 83 | - foreach($layoutList as $key => $val) |
|
| 83 | + foreach ($layoutList as $key => $val) |
|
| 84 | 84 | { |
| 85 | - if($thumbs[$val->layouts]) |
|
| 85 | + if ($thumbs[$val->layouts]) |
|
| 86 | 86 | { |
| 87 | 87 | $val->thumbnail = $thumbs[$val->layouts]; |
| 88 | 88 | continue; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $token = explode('|@|', $val->layout); |
| 92 | - if(count($token) == 2) |
|
| 92 | + if (count($token) == 2) |
|
| 93 | 93 | { |
| 94 | - $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); |
|
| 94 | + $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png', $token[0], $token[1]); |
|
| 95 | 95 | } |
| 96 | 96 | else |
| 97 | 97 | { |
| 98 | - $thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); |
|
| 98 | + $thumbnailPath = sprintf('./layouts/%s/thumbnail.png', $val->layout); |
|
| 99 | 99 | } |
| 100 | - if(is_readable($thumbnailPath)) |
|
| 100 | + if (is_readable($thumbnailPath)) |
|
| 101 | 101 | { |
| 102 | 102 | $val->thumbnail = $thumbnailPath; |
| 103 | 103 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if (!$siteSrl) |
| 124 | 124 | { |
| 125 | 125 | $siteModuleInfo = Context::get('site_module_info'); |
| 126 | - $siteSrl = (int)$siteModuleInfo->site_srl; |
|
| 126 | + $siteSrl = (int) $siteModuleInfo->site_srl; |
|
| 127 | 127 | } |
| 128 | 128 | $args = new stdClass(); |
| 129 | 129 | $args->site_srl = $siteSrl; |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | // Create instance name list |
| 135 | 135 | $instanceList = array(); |
| 136 | - if(is_array($output->data)) |
|
| 136 | + if (is_array($output->data)) |
|
| 137 | 137 | { |
| 138 | - foreach($output->data as $no => $iInfo) |
|
| 138 | + foreach ($output->data as $no => $iInfo) |
|
| 139 | 139 | { |
| 140 | - if($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 140 | + if ($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 141 | 141 | { |
| 142 | 142 | $instanceList[] = $iInfo->layout; |
| 143 | 143 | } |
@@ -152,18 +152,18 @@ discard block |
||
| 152 | 152 | $downloadedList = array(); |
| 153 | 153 | $titleList = array(); |
| 154 | 154 | $_downloadedList = $this->getDownloadedLayoutList($layoutType); |
| 155 | - if(is_array($_downloadedList)) |
|
| 155 | + if (is_array($_downloadedList)) |
|
| 156 | 156 | { |
| 157 | - foreach($_downloadedList as $dLayoutInfo) |
|
| 157 | + foreach ($_downloadedList as $dLayoutInfo) |
|
| 158 | 158 | { |
| 159 | 159 | $downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout; |
| 160 | 160 | $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title; |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if($layout) |
|
| 164 | + if ($layout) |
|
| 165 | 165 | { |
| 166 | - if(count($instanceList) < 1 && $downloadedList[$layout]) |
|
| 166 | + if (count($instanceList) < 1 && $downloadedList[$layout]) |
|
| 167 | 167 | { |
| 168 | 168 | $insertArgs = new stdClass(); |
| 169 | 169 | $insertArgs->site_srl = $siteSrl; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | // Get downloaded name list have no instance |
| 183 | 183 | $noInstanceList = array_diff($downloadedList, $instanceList); |
| 184 | - foreach($noInstanceList as $layoutName) |
|
| 184 | + foreach ($noInstanceList as $layoutName) |
|
| 185 | 185 | { |
| 186 | 186 | $insertArgs = new stdClass(); |
| 187 | 187 | $insertArgs->site_srl = $siteSrl; |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // If create layout instance, reload instance list |
| 200 | - if($isCreateInstance) |
|
| 200 | + if ($isCreateInstance) |
|
| 201 | 201 | { |
| 202 | 202 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
| 203 | 203 | |
| 204 | - if(is_array($output->data)) |
|
| 204 | + if (is_array($output->data)) |
|
| 205 | 205 | { |
| 206 | - foreach($output->data as $no => $iInfo) |
|
| 206 | + foreach ($output->data as $no => $iInfo) |
|
| 207 | 207 | { |
| 208 | - if(!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 208 | + if (!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
| 209 | 209 | { |
| 210 | 210 | unset($output->data[$no]); |
| 211 | 211 | } |
@@ -226,28 +226,28 @@ discard block |
||
| 226 | 226 | function isExistsLayoutFile($layout, $layoutType) |
| 227 | 227 | { |
| 228 | 228 | //TODO If remove a support themes, remove this codes also. |
| 229 | - if($layoutType == 'P') |
|
| 229 | + if ($layoutType == 'P') |
|
| 230 | 230 | { |
| 231 | - $pathPrefix = _XE_PATH_ . 'layouts/'; |
|
| 232 | - $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s'; |
|
| 231 | + $pathPrefix = _XE_PATH_.'layouts/'; |
|
| 232 | + $themePathFormat = _XE_PATH_.'themes/%s/layouts/%s'; |
|
| 233 | 233 | } |
| 234 | 234 | else |
| 235 | 235 | { |
| 236 | - $pathPrefix = _XE_PATH_ . 'm.layouts/'; |
|
| 237 | - $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s'; |
|
| 236 | + $pathPrefix = _XE_PATH_.'m.layouts/'; |
|
| 237 | + $themePathFormat = _XE_PATH_.'themes/%s/m.layouts/%s'; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if(strpos($layout, '|@|') !== FALSE) |
|
| 240 | + if (strpos($layout, '|@|') !== FALSE) |
|
| 241 | 241 | { |
| 242 | 242 | list($themeName, $layoutName) = explode('|@|', $layout); |
| 243 | 243 | $path = sprintf($themePathFormat, $themeName, $layoutName); |
| 244 | 244 | } |
| 245 | 245 | else |
| 246 | 246 | { |
| 247 | - $path = $pathPrefix . $layout; |
|
| 247 | + $path = $pathPrefix.$layout; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - return is_readable($path . '/layout.html'); |
|
| 250 | + return is_readable($path.'/layout.html'); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $args = new stdClass(); |
| 263 | 263 | $args->layout_srl = $layout_srl; |
| 264 | 264 | $output = executeQuery('layout.getLayout', $args); |
| 265 | - if(!$output->data) return; |
|
| 265 | + if (!$output->data) return; |
|
| 266 | 266 | |
| 267 | 267 | // Return xml file informaton after listing up the layout and extra_vars |
| 268 | 268 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $args = new stdClass(); |
| 276 | 276 | $args->layout_srl = $layout_srl; |
| 277 | 277 | $output = executeQuery('layout.getLayout', $args, $columnList); |
| 278 | - if(!$output->toBool()) |
|
| 278 | + if (!$output->toBool()) |
|
| 279 | 279 | { |
| 280 | 280 | return; |
| 281 | 281 | } |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | function getLayoutPath($layout_name = "", $layout_type = "P") |
| 293 | 293 | { |
| 294 | 294 | $layout_parse = explode('|@|', $layout_name); |
| 295 | - if(count($layout_parse) > 1) |
|
| 295 | + if (count($layout_parse) > 1) |
|
| 296 | 296 | { |
| 297 | 297 | $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; |
| 298 | 298 | } |
| 299 | - else if($layout_name == 'faceoff') |
|
| 299 | + else if ($layout_name == 'faceoff') |
|
| 300 | 300 | { |
| 301 | 301 | $class_path = './modules/layout/faceoff/'; |
| 302 | 302 | } |
| 303 | - else if($layout_type == "M") |
|
| 303 | + else if ($layout_type == "M") |
|
| 304 | 304 | { |
| 305 | 305 | $class_path = sprintf("./m.layouts/%s/", $layout_name); |
| 306 | 306 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | { |
| 309 | 309 | $class_path = sprintf('./layouts/%s/', $layout_name); |
| 310 | 310 | } |
| 311 | - if(is_dir($class_path)) return $class_path; |
|
| 311 | + if (is_dir($class_path)) return $class_path; |
|
| 312 | 312 | return ""; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -326,24 +326,24 @@ discard block |
||
| 326 | 326 | // Get a list of downloaded layout and installed layout |
| 327 | 327 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type); |
| 328 | 328 | $searched_count = count($searched_list); |
| 329 | - if(!$searched_count) return; |
|
| 329 | + if (!$searched_count) return; |
|
| 330 | 330 | |
| 331 | 331 | // natcasesort($searched_list); |
| 332 | 332 | // Return information for looping searched list of layouts |
| 333 | 333 | $list = array(); |
| 334 | - for($i=0;$i<$searched_count;$i++) |
|
| 334 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 335 | 335 | { |
| 336 | 336 | // Name of the layout |
| 337 | 337 | $layout = $searched_list[$i]; |
| 338 | 338 | // Get information of the layout |
| 339 | 339 | $layout_info = $this->getLayoutInfo($layout, null, $layout_type); |
| 340 | 340 | |
| 341 | - if(!$layout_info) |
|
| 341 | + if (!$layout_info) |
|
| 342 | 342 | { |
| 343 | 343 | continue; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - if($withAutoinstallInfo) |
|
| 346 | + if ($withAutoinstallInfo) |
|
| 347 | 347 | { |
| 348 | 348 | // get easyinstall remove url |
| 349 | 349 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($layout_info->path); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $layout_info->need_update = $package[$packageSrl]->need_update; |
| 355 | 355 | |
| 356 | 356 | // get easyinstall update url |
| 357 | - if($layout_info->need_update) |
|
| 357 | + if ($layout_info->need_update) |
|
| 358 | 358 | { |
| 359 | 359 | $layout_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl); |
| 360 | 360 | } |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | function sortLayoutByTitle($a, $b) |
| 373 | 373 | { |
| 374 | - if(!$a->title) |
|
| 374 | + if (!$a->title) |
|
| 375 | 375 | { |
| 376 | 376 | $a->title = $a->layout; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if(!$b->title) |
|
| 379 | + if (!$b->title) |
|
| 380 | 380 | { |
| 381 | 381 | $b->title = $b->layout; |
| 382 | 382 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $aTitle = strtolower($a->title); |
| 385 | 385 | $bTitle = strtolower($b->title); |
| 386 | 386 | |
| 387 | - if($aTitle == $bTitle) |
|
| 387 | + if ($aTitle == $bTitle) |
|
| 388 | 388 | { |
| 389 | 389 | return 0; |
| 390 | 390 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | function _getInstalledLayoutDirectories($layoutType = 'P') |
| 412 | 412 | { |
| 413 | - if($layoutType == 'M') |
|
| 413 | + if ($layoutType == 'M') |
|
| 414 | 414 | { |
| 415 | 415 | $directory = './m.layouts'; |
| 416 | 416 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES'; |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
| 424 | + if ($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
| 425 | 425 | |
| 426 | 426 | $searchedList = FileHandler::readDir($directory); |
| 427 | 427 | if (!$searchedList) $searchedList = array(); |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P") |
| 442 | 442 | { |
| 443 | - if($info) |
|
| 443 | + if ($info) |
|
| 444 | 444 | { |
| 445 | 445 | $layout_title = $info->title; |
| 446 | 446 | $layout = $info->layout; |
@@ -448,35 +448,35 @@ discard block |
||
| 448 | 448 | $site_srl = $info->site_srl; |
| 449 | 449 | $vars = unserialize($info->extra_vars); |
| 450 | 450 | |
| 451 | - if($info->module_srl) |
|
| 451 | + if ($info->module_srl) |
|
| 452 | 452 | { |
| 453 | - $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/','',$info->layout_path); |
|
| 453 | + $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/', '', $info->layout_path); |
|
| 454 | 454 | $xml_file = sprintf('%sskin.xml', $layout_path); |
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | // Get a path of the requested module. Return if not exists. |
| 459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
| 460 | - if(!is_dir($layout_path)) return; |
|
| 459 | + if (!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
| 460 | + if (!is_dir($layout_path)) return; |
|
| 461 | 461 | |
| 462 | 462 | // Read the xml file for module skin information |
| 463 | - if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
| 464 | - if(!file_exists($xml_file)) |
|
| 463 | + if (!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
| 464 | + if (!file_exists($xml_file)) |
|
| 465 | 465 | { |
| 466 | 466 | $layout_info = new stdClass; |
| 467 | 467 | $layout_info->title = $layout; |
| 468 | 468 | $layout_info->layout = $layout; |
| 469 | 469 | $layout_info->path = $layout_path; |
| 470 | 470 | $layout_info->layout_title = $layout_title; |
| 471 | - if(!$layout_info->layout_type) |
|
| 471 | + if (!$layout_info->layout_type) |
|
| 472 | 472 | { |
| 473 | - $layout_info->layout_type = $layout_type; |
|
| 473 | + $layout_info->layout_type = $layout_type; |
|
| 474 | 474 | } |
| 475 | 475 | return $layout_info; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Include the cache file if it is valid and then return $layout_info variable |
| 479 | - if(!$layout_srl) |
|
| 479 | + if (!$layout_srl) |
|
| 480 | 480 | { |
| 481 | 481 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); |
| 482 | 482 | } |
@@ -485,22 +485,22 @@ discard block |
||
| 485 | 485 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType()); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) |
|
| 488 | + if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 489 | 489 | { |
| 490 | 490 | include($cache_file); |
| 491 | 491 | |
| 492 | - if($layout_info->extra_var && $vars) |
|
| 492 | + if ($layout_info->extra_var && $vars) |
|
| 493 | 493 | { |
| 494 | - foreach($vars as $key => $value) |
|
| 494 | + foreach ($vars as $key => $value) |
|
| 495 | 495 | { |
| 496 | - if(!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
| 496 | + if (!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
| 497 | 497 | { |
| 498 | 498 | $layout_info->{$key} = $value; |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if(!$layout_info->title) |
|
| 503 | + if (!$layout_info->title) |
|
| 504 | 504 | { |
| 505 | 505 | $layout_info->title = $layout; |
| 506 | 506 | } |
@@ -511,16 +511,16 @@ discard block |
||
| 511 | 511 | $oXmlParser = new XmlParser(); |
| 512 | 512 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 513 | 513 | |
| 514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
| 515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
| 514 | + if ($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
| 515 | + elseif ($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
| 516 | 516 | |
| 517 | - if(!$xml_obj) return; |
|
| 517 | + if (!$xml_obj) return; |
|
| 518 | 518 | |
| 519 | 519 | $buff = array(); |
| 520 | 520 | $buff[] = '$layout_info = new stdClass;'; |
| 521 | 521 | $buff[] = sprintf('$layout_info->site_srl = "%s";', $site_srl); |
| 522 | 522 | |
| 523 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 523 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 524 | 524 | { |
| 525 | 525 | // Layout title, version and other information |
| 526 | 526 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -540,11 +540,11 @@ discard block |
||
| 540 | 540 | $buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); |
| 541 | 541 | |
| 542 | 542 | // Author information |
| 543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 543 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 544 | 544 | else $author_list = $xml_obj->author; |
| 545 | 545 | |
| 546 | 546 | $buff[] = '$layout_info->author = array();'; |
| 547 | - for($i=0, $c=count($author_list); $i<$c; $i++) |
|
| 547 | + for ($i = 0, $c = count($author_list); $i < $c; $i++) |
|
| 548 | 548 | { |
| 549 | 549 | $buff[] = sprintf('$layout_info->author[%d] = new stdClass;', $i); |
| 550 | 550 | $buff[] = sprintf('$layout_info->author[%d]->name = "%s";', $i, $author_list[$i]->name->body); |
@@ -554,22 +554,22 @@ discard block |
||
| 554 | 554 | |
| 555 | 555 | // Extra vars (user defined variables to use in a template) |
| 556 | 556 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 557 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 558 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 559 | 559 | |
| 560 | 560 | $buff[] = '$layout_info->extra_var = new stdClass;'; |
| 561 | 561 | $extra_var_count = 0; |
| 562 | - foreach($extra_var_groups as $group) |
|
| 562 | + foreach ($extra_var_groups as $group) |
|
| 563 | 563 | { |
| 564 | 564 | $extra_vars = $group->var; |
| 565 | - if($extra_vars) |
|
| 565 | + if ($extra_vars) |
|
| 566 | 566 | { |
| 567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 567 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 568 | 568 | |
| 569 | 569 | $count = count($extra_vars); |
| 570 | 570 | $extra_var_count += $count; |
| 571 | 571 | |
| 572 | - for($i=0;$i<$count;$i++) |
|
| 572 | + for ($i = 0; $i < $count; $i++) |
|
| 573 | 573 | { |
| 574 | 574 | unset($var, $options); |
| 575 | 575 | $var = $extra_vars[$i]; |
@@ -580,26 +580,26 @@ discard block |
||
| 580 | 580 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
| 581 | 581 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
| 582 | 582 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
| 583 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
| 583 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
| 584 | 584 | |
| 585 | 585 | $options = $var->options; |
| 586 | - if(!$options) continue; |
|
| 587 | - if(!is_array($options)) $options = array($options); |
|
| 586 | + if (!$options) continue; |
|
| 587 | + if (!is_array($options)) $options = array($options); |
|
| 588 | 588 | |
| 589 | 589 | $buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); |
| 590 | 590 | $options_count = count($options); |
| 591 | 591 | $thumbnail_exist = false; |
| 592 | - for($j=0; $j < $options_count; $j++) |
|
| 592 | + for ($j = 0; $j < $options_count; $j++) |
|
| 593 | 593 | { |
| 594 | 594 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"] = new stdClass;', $var->attrs->name, $options[$j]->attrs->value); |
| 595 | 595 | $thumbnail = $options[$j]->attrs->src; |
| 596 | - if($thumbnail) |
|
| 596 | + if ($thumbnail) |
|
| 597 | 597 | { |
| 598 | 598 | $thumbnail = $layout_path.$thumbnail; |
| 599 | - if(file_exists($thumbnail)) |
|
| 599 | + if (file_exists($thumbnail)) |
|
| 600 | 600 | { |
| 601 | 601 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->thumbnail = "%s";', $var->attrs->name, $options[$j]->attrs->value, $thumbnail); |
| 602 | - if(!$thumbnail_exist) |
|
| 602 | + if (!$thumbnail_exist) |
|
| 603 | 603 | { |
| 604 | 604 | $buff[] = sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name); |
| 605 | 605 | $thumbnail_exist = true; |
@@ -613,26 +613,26 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
| 615 | 615 | // Menu |
| 616 | - if($xml_obj->menus->menu) |
|
| 616 | + if ($xml_obj->menus->menu) |
|
| 617 | 617 | { |
| 618 | 618 | $menus = $xml_obj->menus->menu; |
| 619 | - if(!is_array($menus)) $menus = array($menus); |
|
| 619 | + if (!is_array($menus)) $menus = array($menus); |
|
| 620 | 620 | |
| 621 | 621 | $menu_count = count($menus); |
| 622 | 622 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
| 623 | 623 | $buff[] = '$layout_info->menu = new stdClass;'; |
| 624 | - for($i=0;$i<$menu_count;$i++) |
|
| 624 | + for ($i = 0; $i < $menu_count; $i++) |
|
| 625 | 625 | { |
| 626 | 626 | $name = $menus[$i]->attrs->name; |
| 627 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 627 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 628 | 628 | $buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); |
| 629 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); |
|
| 630 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
| 631 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->attrs->maxdepth); |
|
| 629 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $menus[$i]->attrs->name); |
|
| 630 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
| 631 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->attrs->maxdepth); |
|
| 632 | 632 | |
| 633 | 633 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
| 634 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
| 635 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
| 634 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
| 635 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | } |
@@ -655,19 +655,19 @@ discard block |
||
| 655 | 655 | $buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); |
| 656 | 656 | // Extra vars (user defined variables to use in a template) |
| 657 | 657 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 660 | - foreach($extra_var_groups as $group) |
|
| 658 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 659 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 660 | + foreach ($extra_var_groups as $group) |
|
| 661 | 661 | { |
| 662 | 662 | $extra_vars = $group->var; |
| 663 | - if($extra_vars) |
|
| 663 | + if ($extra_vars) |
|
| 664 | 664 | { |
| 665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 665 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 666 | 666 | |
| 667 | 667 | $extra_var_count = count($extra_vars); |
| 668 | 668 | |
| 669 | 669 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
| 670 | - for($i=0;$i<$extra_var_count;$i++) |
|
| 670 | + for ($i = 0; $i < $extra_var_count; $i++) |
|
| 671 | 671 | { |
| 672 | 672 | unset($var, $options); |
| 673 | 673 | $var = $extra_vars[$i]; |
@@ -677,14 +677,14 @@ discard block |
||
| 677 | 677 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
| 678 | 678 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
| 679 | 679 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
| 680 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
| 680 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
| 681 | 681 | |
| 682 | 682 | $options = $var->options; |
| 683 | - if(!$options) continue; |
|
| 683 | + if (!$options) continue; |
|
| 684 | 684 | |
| 685 | - if(!is_array($options)) $options = array($options); |
|
| 685 | + if (!is_array($options)) $options = array($options); |
|
| 686 | 686 | $options_count = count($options); |
| 687 | - for($j=0;$j<$options_count;$j++) |
|
| 687 | + for ($j = 0; $j < $options_count; $j++) |
|
| 688 | 688 | { |
| 689 | 689 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->value->body, $options[$j]->title->body); |
| 690 | 690 | } |
@@ -692,23 +692,23 @@ discard block |
||
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | // Menu |
| 695 | - if($xml_obj->menus->menu) |
|
| 695 | + if ($xml_obj->menus->menu) |
|
| 696 | 696 | { |
| 697 | 697 | $menus = $xml_obj->menus->menu; |
| 698 | - if(!is_array($menus)) $menus = array($menus); |
|
| 698 | + if (!is_array($menus)) $menus = array($menus); |
|
| 699 | 699 | |
| 700 | 700 | $menu_count = count($menus); |
| 701 | 701 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
| 702 | - for($i=0;$i<$menu_count;$i++) |
|
| 702 | + for ($i = 0; $i < $menu_count; $i++) |
|
| 703 | 703 | { |
| 704 | 704 | $name = $menus[$i]->attrs->name; |
| 705 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 706 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); |
|
| 707 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
| 708 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); |
|
| 705 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
| 706 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $name); |
|
| 707 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
| 708 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->maxdepth->body); |
|
| 709 | 709 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
| 710 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
| 711 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
| 710 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
| 711 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | 714 | } |
@@ -718,15 +718,15 @@ discard block |
||
| 718 | 718 | $layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl); |
| 719 | 719 | $header_script = trim($layout_config->header_script); |
| 720 | 720 | |
| 721 | - if($header_script) |
|
| 721 | + if ($header_script) |
|
| 722 | 722 | { |
| 723 | 723 | $buff[] = sprintf(' $layout_info->header_script = %s; ', var_export($header_script, true)); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); |
|
| 727 | - if(FileHandler::exists($cache_file)) include($cache_file); |
|
| 726 | + FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); '.join(PHP_EOL, $buff)); |
|
| 727 | + if (FileHandler::exists($cache_file)) include($cache_file); |
|
| 728 | 728 | |
| 729 | - if(!$layout_info->title) |
|
| 729 | + if (!$layout_info->title) |
|
| 730 | 730 | { |
| 731 | 731 | $layout_info->title = $layout; |
| 732 | 732 | } |
@@ -750,12 +750,12 @@ discard block |
||
| 750 | 750 | * @param string $layout_name |
| 751 | 751 | * @return array |
| 752 | 752 | */ |
| 753 | - function getUserLayoutIniConfig($layout_srl, $layout_name=null) |
|
| 753 | + function getUserLayoutIniConfig($layout_srl, $layout_name = null) |
|
| 754 | 754 | { |
| 755 | 755 | $file = $this->getUserLayoutIni($layout_srl); |
| 756 | - if($layout_name && FileHandler::exists($file) === FALSE) |
|
| 756 | + if ($layout_name && FileHandler::exists($file) === FALSE) |
|
| 757 | 757 | { |
| 758 | - FileHandler::copyFile($this->getDefaultLayoutIni($layout_name),$this->getUserLayoutIni($layout_srl)); |
|
| 758 | + FileHandler::copyFile($this->getDefaultLayoutIni($layout_name), $this->getUserLayoutIni($layout_srl)); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | return FileHandler::readIniFile($file); |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | */ |
| 769 | 769 | function getUserLayoutPath($layout_srl) |
| 770 | 770 | { |
| 771 | - return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl,3)); |
|
| 771 | + return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl, 3)); |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | /** |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | */ |
| 779 | 779 | function getUserLayoutImagePath($layout_srl) |
| 780 | 780 | { |
| 781 | - return $this->getUserLayoutPath($layout_srl). 'images/'; |
|
| 781 | + return $this->getUserLayoutPath($layout_srl).'images/'; |
|
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | /** |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | function getUserLayoutCss($layout_srl) |
| 790 | 790 | { |
| 791 | - return $this->getUserLayoutPath($layout_srl). 'layout.css'; |
|
| 791 | + return $this->getUserLayoutPath($layout_srl).'layout.css'; |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | /** |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | */ |
| 799 | 799 | function getUserLayoutFaceOffCss($layout_srl) |
| 800 | 800 | { |
| 801 | - if($this->useUserLayoutTemp == 'temp') return; |
|
| 801 | + if ($this->useUserLayoutTemp == 'temp') return; |
|
| 802 | 802 | return $this->_getUserLayoutFaceOffCss($layout_srl); |
| 803 | 803 | } |
| 804 | 804 | |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | */ |
| 810 | 810 | function _getUserLayoutFaceOffCss($layout_srl) |
| 811 | 811 | { |
| 812 | - return $this->getUserLayoutPath($layout_srl). 'faceoff.css'; |
|
| 812 | + return $this->getUserLayoutPath($layout_srl).'faceoff.css'; |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | /** |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | function getUserLayoutTempFaceOffCss($layout_srl) |
| 821 | 821 | { |
| 822 | - return $this->getUserLayoutPath($layout_srl). 'tmp.faceoff.css'; |
|
| 822 | + return $this->getUserLayoutPath($layout_srl).'tmp.faceoff.css'; |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | /** |
@@ -829,11 +829,11 @@ discard block |
||
| 829 | 829 | */ |
| 830 | 830 | function getUserLayoutHtml($layout_srl) |
| 831 | 831 | { |
| 832 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.html'; |
|
| 833 | - if($this->useUserLayoutTemp == 'temp') |
|
| 832 | + $src = $this->getUserLayoutPath($layout_srl).'layout.html'; |
|
| 833 | + if ($this->useUserLayoutTemp == 'temp') |
|
| 834 | 834 | { |
| 835 | 835 | $temp = $this->getUserLayoutTempHtml($layout_srl); |
| 836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp); |
|
| 836 | + if (FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src, $temp); |
|
| 837 | 837 | return $temp; |
| 838 | 838 | } |
| 839 | 839 | |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | */ |
| 848 | 848 | function getUserLayoutTempHtml($layout_srl) |
| 849 | 849 | { |
| 850 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.html'; |
|
| 850 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.html'; |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | /** |
@@ -857,11 +857,11 @@ discard block |
||
| 857 | 857 | */ |
| 858 | 858 | function getUserLayoutIni($layout_srl) |
| 859 | 859 | { |
| 860 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.ini'; |
|
| 861 | - if($this->useUserLayoutTemp == 'temp') |
|
| 860 | + $src = $this->getUserLayoutPath($layout_srl).'layout.ini'; |
|
| 861 | + if ($this->useUserLayoutTemp == 'temp') |
|
| 862 | 862 | { |
| 863 | 863 | $temp = $this->getUserLayoutTempIni($layout_srl); |
| 864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp); |
|
| 864 | + if (!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src, $temp); |
|
| 865 | 865 | return $temp; |
| 866 | 866 | } |
| 867 | 867 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | */ |
| 876 | 876 | function getUserLayoutTempIni($layout_srl) |
| 877 | 877 | { |
| 878 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.ini'; |
|
| 878 | + return $this->getUserLayoutPath($layout_srl).'tmp.layout.ini'; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | /** |
@@ -885,9 +885,9 @@ discard block |
||
| 885 | 885 | * @param string $lang_type |
| 886 | 886 | * @return string |
| 887 | 887 | */ |
| 888 | - function getUserLayoutCache($layout_srl,$lang_type) |
|
| 888 | + function getUserLayoutCache($layout_srl, $lang_type) |
|
| 889 | 889 | { |
| 890 | - return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php"; |
|
| 890 | + return $this->getUserLayoutPath($layout_srl)."{$lang_type}.cache.php"; |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | /** |
@@ -896,15 +896,15 @@ discard block |
||
| 896 | 896 | * @param string $lang_type |
| 897 | 897 | * @return string |
| 898 | 898 | */ |
| 899 | - function getLayoutCache($layout_name,$lang_type,$layout_type='P') |
|
| 899 | + function getLayoutCache($layout_name, $lang_type, $layout_type = 'P') |
|
| 900 | 900 | { |
| 901 | - if($layout_type=='P') |
|
| 901 | + if ($layout_type == 'P') |
|
| 902 | 902 | { |
| 903 | - return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
| 903 | + return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
| 904 | 904 | } |
| 905 | 905 | else |
| 906 | 906 | { |
| 907 | - return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
| 907 | + return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
| 908 | 908 | } |
| 909 | 909 | } |
| 910 | 910 | |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | */ |
| 916 | 916 | function getDefaultLayoutIni($layout_name) |
| 917 | 917 | { |
| 918 | - return $this->getDefaultLayoutPath($layout_name). 'layout.ini'; |
|
| 918 | + return $this->getDefaultLayoutPath($layout_name).'layout.ini'; |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | /** |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | */ |
| 926 | 926 | function getDefaultLayoutHtml($layout_name) |
| 927 | 927 | { |
| 928 | - return $this->getDefaultLayoutPath($layout_name). 'layout.html'; |
|
| 928 | + return $this->getDefaultLayoutPath($layout_name).'layout.html'; |
|
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | /** |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | */ |
| 936 | 936 | function getDefaultLayoutCss($layout_name) |
| 937 | 937 | { |
| 938 | - return $this->getDefaultLayoutPath($layout_name). 'css/layout.css'; |
|
| 938 | + return $this->getDefaultLayoutPath($layout_name).'css/layout.css'; |
|
| 939 | 939 | } |
| 940 | 940 | |
| 941 | 941 | /** |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | * @param string $flag (default 'temp') |
| 965 | 965 | * @return void |
| 966 | 966 | */ |
| 967 | - function setUseUserLayoutTemp($flag='temp') |
|
| 967 | + function setUseUserLayoutTemp($flag = 'temp') |
|
| 968 | 968 | { |
| 969 | 969 | $this->useUserLayoutTemp = $flag; |
| 970 | 970 | } |
@@ -998,11 +998,11 @@ discard block |
||
| 998 | 998 | ); |
| 999 | 999 | |
| 1000 | 1000 | $image_path = $this->getUserLayoutImagePath($layout_srl); |
| 1001 | - $image_list = FileHandler::readDir($image_path,'/(.*(?:jpg|jpeg|gif|bmp|png)$)/i'); |
|
| 1001 | + $image_list = FileHandler::readDir($image_path, '/(.*(?:jpg|jpeg|gif|bmp|png)$)/i'); |
|
| 1002 | 1002 | |
| 1003 | - foreach($image_list as $image) |
|
| 1003 | + foreach ($image_list as $image) |
|
| 1004 | 1004 | { |
| 1005 | - $file_list[] = 'images/' . $image; |
|
| 1005 | + $file_list[] = 'images/'.$image; |
|
| 1006 | 1006 | } |
| 1007 | 1007 | return $file_list; |
| 1008 | 1008 | } |
@@ -1020,20 +1020,20 @@ discard block |
||
| 1020 | 1020 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); |
| 1021 | 1021 | // CSS generated in the layout manager |
| 1022 | 1022 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); |
| 1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
| 1023 | + if ($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
| 1024 | 1024 | // CSS output for the widget |
| 1025 | 1025 | Context::loadFile($this->module_path.'/tpl/css/widget.css', true); |
| 1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1026 | + if ($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
| 1027 | 1027 | else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
| 1028 | 1028 | // Different page displayed upon user's permission |
| 1029 | 1029 | $logged_info = Context::get('logged_info'); |
| 1030 | 1030 | // Display edit button for faceoff layout |
| 1031 | - if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1031 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1032 | 1032 | { |
| 1033 | - Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); |
|
| 1033 | + Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); |
|
| 1034 | 1034 | } |
| 1035 | 1035 | // Display menu when editing the faceOff page |
| 1036 | - if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1036 | + if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
| 1037 | 1037 | { |
| 1038 | 1038 | $oTemplate = &TemplateHandler::getInstance(); |
| 1039 | 1039 | Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu')); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * Arrange Contents |
| 26 | 26 | * |
| 27 | - * @param array $content_list |
|
| 27 | + * @param string $content_list |
|
| 28 | 28 | * |
| 29 | 29 | * @return array |
| 30 | 30 | */ |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Arrange Contents |
| 43 | 43 | * |
| 44 | - * @param array $content_list |
|
| 44 | + * @param array $content |
|
| 45 | 45 | * |
| 46 | 46 | * @return array |
| 47 | 47 | */ |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | function dispSavedDocumentList(&$oModule) |
| 18 | 18 | { |
| 19 | 19 | $document_list = $this->arrangeContentList(Context::get('document_list')); |
| 20 | - $oModule->add('document_list',$document_list); |
|
| 21 | - $oModule->add('page_navigation',Context::get('page_navigation')); |
|
| 20 | + $oModule->add('document_list', $document_list); |
|
| 21 | + $oModule->add('page_navigation', Context::get('page_navigation')); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | function arrangeContentList($content_list) |
| 32 | 32 | { |
| 33 | 33 | $output = array(); |
| 34 | - if(count($content_list)) |
|
| 34 | + if (count($content_list)) |
|
| 35 | 35 | { |
| 36 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 36 | + foreach ($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 37 | 37 | } |
| 38 | 38 | return $output; |
| 39 | 39 | } |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | function arrangeContent($content) |
| 49 | 49 | { |
| 50 | 50 | $output = null; |
| 51 | - if($content) |
|
| 51 | + if ($content) |
|
| 52 | 52 | { |
| 53 | - $output= $content->gets('document_srl','category_srl','nick_name','user_id','user_name','title','content','tags','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status'); |
|
| 53 | + $output = $content->gets('document_srl', 'category_srl', 'nick_name', 'user_id', 'user_name', 'title', 'content', 'tags', 'voted_count', 'blamed_count', 'comment_count', 'regdate', 'last_update', 'extra_vars', 'status'); |
|
| 54 | 54 | } |
| 55 | 55 | return $output; |
| 56 | 56 | } |
@@ -33,7 +33,9 @@ |
||
| 33 | 33 | $output = array(); |
| 34 | 34 | if(count($content_list)) |
| 35 | 35 | { |
| 36 | - foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val); |
|
| 36 | + foreach($content_list as $key => $val) { |
|
| 37 | + $output[] = $this->arrangeContent($val); |
|
| 38 | + } |
|
| 37 | 39 | } |
| 38 | 40 | return $output; |
| 39 | 41 | } |
@@ -297,6 +297,7 @@ |
||
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | 299 | * @brief Return member information with member_srl |
| 300 | + * @param string $member_srl |
|
| 300 | 301 | */ |
| 301 | 302 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
| 302 | 303 | { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | static $member_config; |
| 28 | 28 | |
| 29 | - if($member_config) |
|
| 29 | + if ($member_config) |
|
| 30 | 30 | { |
| 31 | 31 | return $member_config; |
| 32 | 32 | } |
@@ -35,47 +35,47 @@ discard block |
||
| 35 | 35 | $oModuleModel = getModel('module'); |
| 36 | 36 | $config = $oModuleModel->getModuleConfig('member'); |
| 37 | 37 | |
| 38 | - if(!$config->signupForm || !is_array($config->signupForm)) |
|
| 38 | + if (!$config->signupForm || !is_array($config->signupForm)) |
|
| 39 | 39 | { |
| 40 | 40 | $oMemberAdminController = getAdminController('member'); |
| 41 | 41 | $identifier = ($config->identifier) ? $config->identifier : 'email_address'; |
| 42 | 42 | $config->signupForm = $oMemberAdminController->createSignupForm($identifier); |
| 43 | 43 | } |
| 44 | 44 | //for multi language |
| 45 | - foreach($config->signupForm AS $key=>$value) |
|
| 45 | + foreach ($config->signupForm AS $key=>$value) |
|
| 46 | 46 | { |
| 47 | 47 | $config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title; |
| 48 | - if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
| 49 | - if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
| 48 | + if ($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
| 49 | + if ($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Get terms of user |
| 53 | 53 | $config->agreement = memberModel::_getAgreement(); |
| 54 | 54 | |
| 55 | - if(!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
| 55 | + if (!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
| 56 | 56 | |
| 57 | - if(!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
| 58 | - if(!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
| 59 | - if(!$config->image_name_max_filesize) $config->image_name_max_filesize = null; |
|
| 60 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
| 61 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
| 62 | - if(!$config->image_mark_max_filesize) $config->image_mark_max_filesize = null; |
|
| 63 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
| 64 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
| 65 | - if(!$config->profile_image_max_filesize) $config->profile_image_max_filesize = null; |
|
| 57 | + if (!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
| 58 | + if (!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
| 59 | + if (!$config->image_name_max_filesize) $config->image_name_max_filesize = null; |
|
| 60 | + if (!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
| 61 | + if (!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
| 62 | + if (!$config->image_mark_max_filesize) $config->image_mark_max_filesize = null; |
|
| 63 | + if (!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
| 64 | + if (!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
| 65 | + if (!$config->profile_image_max_filesize) $config->profile_image_max_filesize = null; |
|
| 66 | 66 | |
| 67 | - if(!$config->skin) $config->skin = 'default'; |
|
| 68 | - if(!$config->colorset) $config->colorset = 'white'; |
|
| 69 | - if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
| 70 | - if(!$config->group_image_mark) $config->group_image_mark = "N"; |
|
| 67 | + if (!$config->skin) $config->skin = 'default'; |
|
| 68 | + if (!$config->colorset) $config->colorset = 'white'; |
|
| 69 | + if (!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
| 70 | + if (!$config->group_image_mark) $config->group_image_mark = "N"; |
|
| 71 | 71 | |
| 72 | - if(!$config->identifier) $config->identifier = 'user_id'; |
|
| 72 | + if (!$config->identifier) $config->identifier = 'user_id'; |
|
| 73 | 73 | |
| 74 | - if(!$config->max_error_count) $config->max_error_count = 10; |
|
| 75 | - if(!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
| 74 | + if (!$config->max_error_count) $config->max_error_count = 10; |
|
| 75 | + if (!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
| 76 | 76 | |
| 77 | - if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
| 78 | - if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
| 77 | + if (!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
| 78 | + if (!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
| 79 | 79 | |
| 80 | 80 | $member_config = $config; |
| 81 | 81 | |
@@ -84,24 +84,24 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | function _getAgreement() |
| 86 | 86 | { |
| 87 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
| 88 | - if(is_readable($agreement_file)) |
|
| 87 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt'; |
|
| 88 | + if (is_readable($agreement_file)) |
|
| 89 | 89 | { |
| 90 | 90 | return FileHandler::readFile($agreement_file); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $db_info = Context::getDBInfo(); |
| 94 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $db_info->lang_type . '.txt'; |
|
| 95 | - if(is_readable($agreement_file)) |
|
| 94 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$db_info->lang_type.'.txt'; |
|
| 95 | + if (is_readable($agreement_file)) |
|
| 96 | 96 | { |
| 97 | 97 | return FileHandler::readFile($agreement_file); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $lang_selected = Context::loadLangSelected(); |
| 101 | - foreach($lang_selected as $key => $val) |
|
| 101 | + foreach ($lang_selected as $key => $val) |
|
| 102 | 102 | { |
| 103 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . $key . '.txt'; |
|
| 104 | - if(is_readable($agreement_file)) |
|
| 103 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.$key.'.txt'; |
|
| 104 | + if (is_readable($agreement_file)) |
|
| 105 | 105 | { |
| 106 | 106 | return FileHandler::readFile($agreement_file); |
| 107 | 107 | } |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | $logged_info = Context::get('logged_info'); |
| 122 | 122 | $act = Context::get('cur_act'); |
| 123 | 123 | // When click user's own nickname |
| 124 | - if($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
| 124 | + if ($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
| 125 | 125 | // When click other's nickname |
| 126 | 126 | else $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
| 127 | 127 | |
| 128 | 128 | $member_srl = $member_info->member_srl; |
| 129 | - if(!$member_srl) return; |
|
| 129 | + if (!$member_srl) return; |
|
| 130 | 130 | // List variables |
| 131 | 131 | $user_id = $member_info->user_id; |
| 132 | 132 | $user_name = $member_info->user_name; |
@@ -135,18 +135,18 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $oMemberController = getController('member'); |
| 137 | 137 | // Display member information (Don't display to non-logged user) |
| 138 | - if($logged_info->member_srl) |
|
| 138 | + if ($logged_info->member_srl) |
|
| 139 | 139 | { |
| 140 | - $url = getUrl('','mid',$mid,'act','dispMemberInfo','member_srl',$member_srl); |
|
| 141 | - $oMemberController->addMemberPopupMenu($url,'cmd_view_member_info',$icon_path,'self'); |
|
| 140 | + $url = getUrl('', 'mid', $mid, 'act', 'dispMemberInfo', 'member_srl', $member_srl); |
|
| 141 | + $oMemberController->addMemberPopupMenu($url, 'cmd_view_member_info', $icon_path, 'self'); |
|
| 142 | 142 | } |
| 143 | 143 | // When click other's nickname |
| 144 | - if($member_srl != $logged_info->member_srl && $logged_info->member_srl) |
|
| 144 | + if ($member_srl != $logged_info->member_srl && $logged_info->member_srl) |
|
| 145 | 145 | { |
| 146 | 146 | // Get email config |
| 147 | - foreach($this->module_config->signupForm as $field) |
|
| 147 | + foreach ($this->module_config->signupForm as $field) |
|
| 148 | 148 | { |
| 149 | - if($field->name == 'email_address') |
|
| 149 | + if ($field->name == 'email_address') |
|
| 150 | 150 | { |
| 151 | 151 | $email_config = $field; |
| 152 | 152 | break; |
@@ -154,36 +154,36 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // Send an email only if email address is public |
| 157 | - if(($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) |
|
| 157 | + if (($logged_info->is_admin == 'Y' || $email_config->isPublic == 'Y') && $member_info->email_address) |
|
| 158 | 158 | { |
| 159 | 159 | $url = 'mailto:'.escape($member_info->email_address, false); |
| 160 | - $oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path); |
|
| 160 | + $oMemberController->addMemberPopupMenu($url, 'cmd_send_email', $icon_path); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | // View homepage info |
| 164 | - if($member_info->homepage) |
|
| 164 | + if ($member_info->homepage) |
|
| 165 | 165 | $oMemberController->addMemberPopupMenu(escape($member_info->homepage, false), 'homepage', '', 'blank'); |
| 166 | 166 | // View blog info |
| 167 | - if($member_info->blog) |
|
| 167 | + if ($member_info->blog) |
|
| 168 | 168 | $oMemberController->addMemberPopupMenu(escape($member_info->blog, false), 'blog', '', 'blank'); |
| 169 | 169 | // Call a trigger (after) |
| 170 | 170 | ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null); |
| 171 | 171 | // Display a menu for editting member info to a top administrator |
| 172 | - if($logged_info->is_admin == 'Y') |
|
| 172 | + if ($logged_info->is_admin == 'Y') |
|
| 173 | 173 | { |
| 174 | - $url = getUrl('','module','admin','act','dispMemberAdminInsert','member_srl',$member_srl); |
|
| 175 | - $oMemberController->addMemberPopupMenu($url,'cmd_manage_member_info',$icon_path,'MemberModifyInfo'); |
|
| 174 | + $url = getUrl('', 'module', 'admin', 'act', 'dispMemberAdminInsert', 'member_srl', $member_srl); |
|
| 175 | + $oMemberController->addMemberPopupMenu($url, 'cmd_manage_member_info', $icon_path, 'MemberModifyInfo'); |
|
| 176 | 176 | |
| 177 | - $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','member_srl','search_keyword',$member_srl); |
|
| 178 | - $oMemberController->addMemberPopupMenu($url,'cmd_trace_document',$icon_path,'TraceMemberDocument'); |
|
| 177 | + $url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl); |
|
| 178 | + $oMemberController->addMemberPopupMenu($url, 'cmd_trace_document', $icon_path, 'TraceMemberDocument'); |
|
| 179 | 179 | |
| 180 | - $url = getUrl('','module','admin','act','dispCommentAdminList','search_target','member_srl','search_keyword',$member_srl); |
|
| 181 | - $oMemberController->addMemberPopupMenu($url,'cmd_trace_comment',$icon_path,'TraceMemberComment'); |
|
| 180 | + $url = getUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_target', 'member_srl', 'search_keyword', $member_srl); |
|
| 181 | + $oMemberController->addMemberPopupMenu($url, 'cmd_trace_comment', $icon_path, 'TraceMemberComment'); |
|
| 182 | 182 | } |
| 183 | 183 | // Change a language of pop-up menu |
| 184 | 184 | $menus = Context::get('member_popup_menu_list'); |
| 185 | 185 | $menus_count = count($menus); |
| 186 | - for($i=0;$i<$menus_count;$i++) |
|
| 186 | + for ($i = 0; $i < $menus_count; $i++) |
|
| 187 | 187 | { |
| 188 | 188 | $menus[$i]->str = Context::getLang($menus[$i]->str); |
| 189 | 189 | } |
@@ -195,16 +195,16 @@ discard block |
||
| 195 | 195 | * @brief Check if logged-in |
| 196 | 196 | */ |
| 197 | 197 | function isLogged() { |
| 198 | - if($_SESSION['is_logged']) |
|
| 198 | + if ($_SESSION['is_logged']) |
|
| 199 | 199 | { |
| 200 | - if(Mobile::isFromMobilePhone()) |
|
| 200 | + if (Mobile::isFromMobilePhone()) |
|
| 201 | 201 | { |
| 202 | 202 | return true; |
| 203 | 203 | } |
| 204 | - elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
| 204 | + elseif (filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
| 205 | 205 | { |
| 206 | 206 | // IPv6: require same /48 |
| 207 | - if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
|
| 207 | + if (strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
|
| 208 | 208 | { |
| 209 | 209 | return true; |
| 210 | 210 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | else |
| 213 | 213 | { |
| 214 | 214 | // IPv4: require same /24 |
| 215 | - if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
|
| 215 | + if (ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
|
| 216 | 216 | { |
| 217 | 217 | return true; |
| 218 | 218 | } |
@@ -229,23 +229,23 @@ discard block |
||
| 229 | 229 | function getLoggedInfo() |
| 230 | 230 | { |
| 231 | 231 | // Return session info if session info is requested and the user is logged-in |
| 232 | - if($this->isLogged()) |
|
| 232 | + if ($this->isLogged()) |
|
| 233 | 233 | { |
| 234 | 234 | $logged_info = Context::get('logged_info'); |
| 235 | 235 | // Admin/Group list defined depending on site_module_info |
| 236 | 236 | $site_module_info = Context::get('site_module_info'); |
| 237 | - if($site_module_info->site_srl) |
|
| 237 | + if ($site_module_info->site_srl) |
|
| 238 | 238 | { |
| 239 | 239 | $logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl); |
| 240 | 240 | // Add is_site_admin bool variable into logged_info if site_administrator is |
| 241 | 241 | $oModuleModel = getModel('module'); |
| 242 | - if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
| 242 | + if ($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
| 243 | 243 | else $logged_info->is_site_admin = false; |
| 244 | 244 | } |
| 245 | 245 | else |
| 246 | 246 | { |
| 247 | 247 | // Register a default group if the site doesn't have a member group |
| 248 | - if(count($logged_info->group_list) === 0) |
|
| 248 | + if (count($logged_info->group_list) === 0) |
|
| 249 | 249 | { |
| 250 | 250 | $default_group = $this->getDefaultGroup(0); |
| 251 | 251 | $oMemberController = getController('member'); |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | function getMemberInfoByUserID($user_id, $columnList = array()) |
| 270 | 270 | { |
| 271 | - if(!$user_id) return; |
|
| 271 | + if (!$user_id) return; |
|
| 272 | 272 | |
| 273 | 273 | $args = new stdClass; |
| 274 | 274 | $args->user_id = $user_id; |
| 275 | 275 | $output = executeQuery('member.getMemberInfo', $args); |
| 276 | - if(!$output->toBool()) return $output; |
|
| 277 | - if(!$output->data) return; |
|
| 276 | + if (!$output->toBool()) return $output; |
|
| 277 | + if (!$output->data) return; |
|
| 278 | 278 | |
| 279 | 279 | $member_info = $this->arrangeMemberInfo($output->data); |
| 280 | 280 | |
@@ -286,12 +286,12 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | function getMemberInfoByEmailAddress($email_address) |
| 288 | 288 | { |
| 289 | - if(!$email_address) return; |
|
| 289 | + if (!$email_address) return; |
|
| 290 | 290 | |
| 291 | 291 | $args = new stdClass(); |
| 292 | 292 | |
| 293 | - $db_info = Context::getDBInfo (); |
|
| 294 | - if($db_info->master_db['db_type'] == "cubrid") |
|
| 293 | + $db_info = Context::getDBInfo(); |
|
| 294 | + if ($db_info->master_db['db_type'] == "cubrid") |
|
| 295 | 295 | { |
| 296 | 296 | $args->email_address = strtolower($email_address); |
| 297 | 297 | $output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args); |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | $output = executeQuery('member.getMemberInfoByEmailAddress', $args); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - if(!$output->toBool()) return $output; |
|
| 306 | - if(!$output->data) return; |
|
| 305 | + if (!$output->toBool()) return $output; |
|
| 306 | + if (!$output->data) return; |
|
| 307 | 307 | |
| 308 | 308 | $member_info = $this->arrangeMemberInfo($output->data); |
| 309 | 309 | return $member_info; |
@@ -314,36 +314,36 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
| 316 | 316 | { |
| 317 | - if(!$member_srl) return; |
|
| 317 | + if (!$member_srl) return; |
|
| 318 | 318 | |
| 319 | 319 | //columnList size zero... get full member info |
| 320 | - if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
|
| 320 | + if (!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
|
| 321 | 321 | { |
| 322 | 322 | $GLOBALS['__member_info__'][$member_srl] = false; |
| 323 | 323 | |
| 324 | 324 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 325 | - if($oCacheHandler->isSupport()) |
|
| 325 | + if ($oCacheHandler->isSupport()) |
|
| 326 | 326 | { |
| 327 | 327 | $columnList = array(); |
| 328 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 328 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 329 | 329 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 330 | 330 | $GLOBALS['__member_info__'][$member_srl] = $oCacheHandler->get($cache_key); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if($GLOBALS['__member_info__'][$member_srl] === false) |
|
| 333 | + if ($GLOBALS['__member_info__'][$member_srl] === false) |
|
| 334 | 334 | { |
| 335 | 335 | $args = new stdClass(); |
| 336 | 336 | $args->member_srl = $member_srl; |
| 337 | 337 | $output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList); |
| 338 | - if(!$output->data) |
|
| 338 | + if (!$output->data) |
|
| 339 | 339 | { |
| 340 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
| 340 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
| 341 | 341 | return; |
| 342 | 342 | } |
| 343 | 343 | $this->arrangeMemberInfo($output->data, $site_srl); |
| 344 | 344 | |
| 345 | 345 | //insert in cache |
| 346 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
| 346 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | function arrangeMemberInfo($info, $site_srl = 0) |
| 357 | 357 | { |
| 358 | - if(!$GLOBALS['__member_info__'][$info->member_srl]) |
|
| 358 | + if (!$GLOBALS['__member_info__'][$info->member_srl]) |
|
| 359 | 359 | { |
| 360 | 360 | $oModuleModel = getModel('module'); |
| 361 | 361 | $config = $oModuleModel->getModuleConfig('member'); |
@@ -364,25 +364,25 @@ discard block |
||
| 364 | 364 | $info->profile_image = $this->getProfileImage($info->member_srl); |
| 365 | 365 | $info->image_name = $this->getImageName($info->member_srl); |
| 366 | 366 | $info->image_mark = $this->getImageMark($info->member_srl); |
| 367 | - if($config->group_image_mark=='Y') |
|
| 367 | + if ($config->group_image_mark == 'Y') |
|
| 368 | 368 | { |
| 369 | - $info->group_mark = $this->getGroupImageMark($info->member_srl,$site_srl); |
|
| 369 | + $info->group_mark = $this->getGroupImageMark($info->member_srl, $site_srl); |
|
| 370 | 370 | } |
| 371 | 371 | $info->signature = $this->getSignature($info->member_srl); |
| 372 | 372 | $info->group_list = $this->getMemberGroups($info->member_srl, $site_srl); |
| 373 | 373 | |
| 374 | 374 | $extra_vars = unserialize($info->extra_vars); |
| 375 | 375 | unset($info->extra_vars); |
| 376 | - if($extra_vars) |
|
| 376 | + if ($extra_vars) |
|
| 377 | 377 | { |
| 378 | - foreach($extra_vars as $key => $val) |
|
| 378 | + foreach ($extra_vars as $key => $val) |
|
| 379 | 379 | { |
| 380 | - if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
| 381 | - if(!$info->{$key}) $info->{$key} = $val; |
|
| 380 | + if (!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
| 381 | + if (!$info->{$key}) $info->{$key} = $val; |
|
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if(strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer)) |
|
| 385 | + if (strlen($info->find_account_answer) == 32 && preg_match('/[a-zA-Z0-9]+/', $info->find_account_answer)) |
|
| 386 | 386 | { |
| 387 | 387 | $info->find_account_answer = null; |
| 388 | 388 | } |
@@ -394,13 +394,13 @@ discard block |
||
| 394 | 394 | $info->homepage = strip_tags($info->homepage); |
| 395 | 395 | $info->blog = strip_tags($info->blog); |
| 396 | 396 | |
| 397 | - if($extra_vars) |
|
| 397 | + if ($extra_vars) |
|
| 398 | 398 | { |
| 399 | - foreach($extra_vars as $key => $val) |
|
| 399 | + foreach ($extra_vars as $key => $val) |
|
| 400 | 400 | { |
| 401 | - if(is_array($val)) |
|
| 401 | + if (is_array($val)) |
|
| 402 | 402 | { |
| 403 | - $oSecurity->encodeHTML($key . '.'); |
|
| 403 | + $oSecurity->encodeHTML($key.'.'); |
|
| 404 | 404 | } |
| 405 | 405 | else |
| 406 | 406 | { |
@@ -411,12 +411,12 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | // Check format. |
| 413 | 413 | $oValidator = new Validator(); |
| 414 | - if(!$oValidator->applyRule('url', $info->homepage)) |
|
| 414 | + if (!$oValidator->applyRule('url', $info->homepage)) |
|
| 415 | 415 | { |
| 416 | 416 | $info->homepage = ''; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - if(!$oValidator->applyRule('url', $info->blog)) |
|
| 419 | + if (!$oValidator->applyRule('url', $info->blog)) |
|
| 420 | 420 | { |
| 421 | 421 | $info->blog = ''; |
| 422 | 422 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | function getLoggedMemberSrl() |
| 467 | 467 | { |
| 468 | - if(!$this->isLogged()) return; |
|
| 468 | + if (!$this->isLogged()) return; |
|
| 469 | 469 | return $_SESSION['member_srl']; |
| 470 | 470 | } |
| 471 | 471 | |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | function getLoggedUserID() |
| 476 | 476 | { |
| 477 | - if(!$this->isLogged()) return; |
|
| 477 | + if (!$this->isLogged()) return; |
|
| 478 | 478 | $logged_info = Context::get('logged_info'); |
| 479 | 479 | return $logged_info->user_id; |
| 480 | 480 | } |
@@ -489,16 +489,16 @@ discard block |
||
| 489 | 489 | // cache controll |
| 490 | 490 | $group_list = false; |
| 491 | 491 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 492 | - if($oCacheHandler->isSupport()) |
|
| 492 | + if ($oCacheHandler->isSupport()) |
|
| 493 | 493 | { |
| 494 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_'.$site_srl; |
|
| 494 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
| 495 | 495 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 496 | 496 | $group_list = $oCacheHandler->get($cache_key); |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - if(!$member_groups[$member_srl][$site_srl] || $force_reload) |
|
| 499 | + if (!$member_groups[$member_srl][$site_srl] || $force_reload) |
|
| 500 | 500 | { |
| 501 | - if($group_list === false) |
|
| 501 | + if ($group_list === false) |
|
| 502 | 502 | { |
| 503 | 503 | $args = new stdClass(); |
| 504 | 504 | $args->member_srl = $member_srl; |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | $output = executeQueryArray('member.getMemberGroups', $args); |
| 507 | 507 | $group_list = $output->data; |
| 508 | 508 | //insert in cache |
| 509 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
| 509 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
| 510 | 510 | } |
| 511 | - if(!$group_list) return array(); |
|
| 511 | + if (!$group_list) return array(); |
|
| 512 | 512 | |
| 513 | - foreach($group_list as $group) |
|
| 513 | + foreach ($group_list as $group) |
|
| 514 | 514 | { |
| 515 | 515 | $result[$group->group_srl] = $group->title; |
| 516 | 516 | } |
@@ -524,14 +524,14 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | function getMembersGroups($member_srls, $site_srl = 0) |
| 526 | 526 | { |
| 527 | - $args->member_srls = implode(',',$member_srls); |
|
| 527 | + $args->member_srls = implode(',', $member_srls); |
|
| 528 | 528 | $args->site_srl = $site_srl; |
| 529 | 529 | $args->sort_index = 'list_order'; |
| 530 | 530 | $output = executeQueryArray('member.getMembersGroups', $args); |
| 531 | - if(!$output->data) return array(); |
|
| 531 | + if (!$output->data) return array(); |
|
| 532 | 532 | |
| 533 | 533 | $result = array(); |
| 534 | - foreach($output->data as $key=>$val) |
|
| 534 | + foreach ($output->data as $key=>$val) |
|
| 535 | 535 | { |
| 536 | 536 | $result[$val->member_srl][] = $val->title; |
| 537 | 537 | } |
@@ -545,21 +545,21 @@ discard block |
||
| 545 | 545 | { |
| 546 | 546 | $default_group = false; |
| 547 | 547 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 548 | - if($oCacheHandler->isSupport()) |
|
| 548 | + if ($oCacheHandler->isSupport()) |
|
| 549 | 549 | { |
| 550 | 550 | $columnList = array(); |
| 551 | - $object_key = 'default_group_' . $site_srl; |
|
| 551 | + $object_key = 'default_group_'.$site_srl; |
|
| 552 | 552 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 553 | 553 | $default_group = $oCacheHandler->get($cache_key); |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - if($default_group === false) |
|
| 556 | + if ($default_group === false) |
|
| 557 | 557 | { |
| 558 | 558 | $args = new stdClass(); |
| 559 | 559 | $args->site_srl = $site_srl; |
| 560 | 560 | $output = executeQuery('member.getDefaultGroup', $args, $columnList); |
| 561 | 561 | $default_group = $output->data; |
| 562 | - if($oCacheHandler->isSupport()) |
|
| 562 | + if ($oCacheHandler->isSupport()) |
|
| 563 | 563 | { |
| 564 | 564 | $oCacheHandler->put($cache_key, $default_group); |
| 565 | 565 | } |
@@ -593,25 +593,25 @@ discard block |
||
| 593 | 593 | */ |
| 594 | 594 | function getGroups($site_srl = 0) |
| 595 | 595 | { |
| 596 | - if(!$GLOBALS['__group_info__'][$site_srl]) |
|
| 596 | + if (!$GLOBALS['__group_info__'][$site_srl]) |
|
| 597 | 597 | { |
| 598 | 598 | $result = array(); |
| 599 | 599 | |
| 600 | - if(!isset($site_srl)) |
|
| 600 | + if (!isset($site_srl)) |
|
| 601 | 601 | { |
| 602 | 602 | $site_srl = 0; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | $group_list = false; |
| 606 | 606 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 607 | - if($oCacheHandler->isSupport()) |
|
| 607 | + if ($oCacheHandler->isSupport()) |
|
| 608 | 608 | { |
| 609 | 609 | $object_key = 'member_groups:site_'.$site_srl; |
| 610 | 610 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 611 | 611 | $group_list = $oCacheHandler->get($cache_key); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - if($group_list === false) |
|
| 614 | + if ($group_list === false) |
|
| 615 | 615 | { |
| 616 | 616 | $args = new stdClass(); |
| 617 | 617 | $args->site_srl = $site_srl; |
@@ -620,16 +620,16 @@ discard block |
||
| 620 | 620 | $output = executeQueryArray('member.getGroups', $args); |
| 621 | 621 | $group_list = $output->data; |
| 622 | 622 | //insert in cache |
| 623 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
| 623 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - if(!$group_list) |
|
| 626 | + if (!$group_list) |
|
| 627 | 627 | { |
| 628 | 628 | return array(); |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | |
| 632 | - foreach($group_list as $val) |
|
| 632 | + foreach ($group_list as $val) |
|
| 633 | 633 | { |
| 634 | 634 | $result[$val->group_srl] = $val; |
| 635 | 635 | } |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | // Set to ignore if a super administrator. |
| 661 | 661 | $logged_info = Context::get('logged_info'); |
| 662 | 662 | |
| 663 | - if(!$this->join_form_list) |
|
| 663 | + if (!$this->join_form_list) |
|
| 664 | 664 | { |
| 665 | 665 | // Argument setting to sort list_order column |
| 666 | 666 | $args = new stdClass(); |
@@ -668,11 +668,11 @@ discard block |
||
| 668 | 668 | $output = executeQuery('member.getJoinFormList', $args); |
| 669 | 669 | // NULL if output data deosn't exist |
| 670 | 670 | $join_form_list = $output->data; |
| 671 | - if(!$join_form_list) return NULL; |
|
| 671 | + if (!$join_form_list) return NULL; |
|
| 672 | 672 | // Need to unserialize because serialized array is inserted into DB in case of default_value |
| 673 | - if(!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
| 673 | + if (!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
| 674 | 674 | $join_form_count = count($join_form_list); |
| 675 | - for($i=0;$i<$join_form_count;$i++) |
|
| 675 | + for ($i = 0; $i < $join_form_count; $i++) |
|
| 676 | 676 | { |
| 677 | 677 | $join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name); |
| 678 | 678 | |
@@ -684,10 +684,10 @@ discard block |
||
| 684 | 684 | // Add language variable |
| 685 | 685 | $lang->extend_vars[$column_name] = $column_title; |
| 686 | 686 | // unserialize if the data type if checkbox, select and so on |
| 687 | - if(in_array($column_type, array('checkbox','select','radio'))) |
|
| 687 | + if (in_array($column_type, array('checkbox', 'select', 'radio'))) |
|
| 688 | 688 | { |
| 689 | 689 | $join_form_list[$i]->default_value = unserialize($default_value); |
| 690 | - if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
| 690 | + if (!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
| 691 | 691 | } |
| 692 | 692 | else |
| 693 | 693 | { |
@@ -699,16 +699,16 @@ discard block |
||
| 699 | 699 | $this->join_form_list = $list; |
| 700 | 700 | } |
| 701 | 701 | // Get object style if the filter_response is true |
| 702 | - if($filter_response && count($this->join_form_list)) |
|
| 702 | + if ($filter_response && count($this->join_form_list)) |
|
| 703 | 703 | { |
| 704 | - foreach($this->join_form_list as $key => $val) |
|
| 704 | + foreach ($this->join_form_list as $key => $val) |
|
| 705 | 705 | { |
| 706 | - if($val->is_active != 'Y') continue; |
|
| 706 | + if ($val->is_active != 'Y') continue; |
|
| 707 | 707 | unset($obj); |
| 708 | 708 | $obj->type = $val->column_type; |
| 709 | 709 | $obj->name = $val->column_name; |
| 710 | 710 | $obj->lang = $val->column_title; |
| 711 | - if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false; |
|
| 711 | + if ($logged_info->is_admin != 'Y') $obj->required = $val->required == 'Y' ?true:false; |
|
| 712 | 712 | else $obj->required = false; |
| 713 | 713 | $filter_output[] = $obj; |
| 714 | 714 | |
@@ -735,15 +735,15 @@ discard block |
||
| 735 | 735 | $args->sort_index = "list_order"; |
| 736 | 736 | $output = executeQueryArray('member.getJoinFormList', $args); |
| 737 | 737 | |
| 738 | - if(!$output->toBool()) |
|
| 738 | + if (!$output->toBool()) |
|
| 739 | 739 | { |
| 740 | 740 | return array(); |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | $joinFormList = array(); |
| 744 | - foreach($output->data as $val) |
|
| 744 | + foreach ($output->data as $val) |
|
| 745 | 745 | { |
| 746 | - if($val->is_active != 'Y') |
|
| 746 | + if ($val->is_active != 'Y') |
|
| 747 | 747 | { |
| 748 | 748 | continue; |
| 749 | 749 | } |
@@ -760,20 +760,20 @@ discard block |
||
| 760 | 760 | function getCombineJoinForm($member_info) |
| 761 | 761 | { |
| 762 | 762 | $extend_form_list = $this->getJoinFormlist(); |
| 763 | - if(!$extend_form_list) return; |
|
| 763 | + if (!$extend_form_list) return; |
|
| 764 | 764 | // Member info is open only to an administrator and him/herself when is_private is true. |
| 765 | 765 | $logged_info = Context::get('logged_info'); |
| 766 | 766 | |
| 767 | - foreach($extend_form_list as $srl => $item) |
|
| 767 | + foreach ($extend_form_list as $srl => $item) |
|
| 768 | 768 | { |
| 769 | 769 | $column_name = $item->column_name; |
| 770 | 770 | $value = $member_info->{$column_name}; |
| 771 | 771 | |
| 772 | 772 | // Change values depening on the type of extend form |
| 773 | - switch($item->column_type) |
|
| 773 | + switch ($item->column_type) |
|
| 774 | 774 | { |
| 775 | 775 | case 'checkbox' : |
| 776 | - if($value && !is_array($value)) $value = array($value); |
|
| 776 | + if ($value && !is_array($value)) $value = array($value); |
|
| 777 | 777 | break; |
| 778 | 778 | case 'text' : |
| 779 | 779 | case 'homepage' : |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | |
| 788 | 788 | $extend_form_list[$srl]->value = $value; |
| 789 | 789 | |
| 790 | - if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true; |
|
| 790 | + if ($member_info->{'open_'.$column_name} == 'Y') $extend_form_list[$srl]->is_opened = true; |
|
| 791 | 791 | else $extend_form_list[$srl]->is_opened = false; |
| 792 | 792 | } |
| 793 | 793 | return $extend_form_list; |
@@ -801,12 +801,12 @@ discard block |
||
| 801 | 801 | $args->member_join_form_srl = $member_join_form_srl; |
| 802 | 802 | $output = executeQuery('member.getJoinForm', $args); |
| 803 | 803 | $join_form = $output->data; |
| 804 | - if(!$join_form) return NULL; |
|
| 804 | + if (!$join_form) return NULL; |
|
| 805 | 805 | |
| 806 | 806 | $column_type = $join_form->column_type; |
| 807 | 807 | $default_value = $join_form->default_value; |
| 808 | 808 | |
| 809 | - if(in_array($column_type, array('checkbox','select','radio'))) |
|
| 809 | + if (in_array($column_type, array('checkbox', 'select', 'radio'))) |
|
| 810 | 810 | { |
| 811 | 811 | $join_form->default_value = unserialize($default_value); |
| 812 | 812 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | function getDeniedIDList() |
| 825 | 825 | { |
| 826 | - if(!$this->denied_id_list) |
|
| 826 | + if (!$this->denied_id_list) |
|
| 827 | 827 | { |
| 828 | 828 | $args->sort_index = "list_order"; |
| 829 | 829 | $args->page = Context::get('page'); |
@@ -839,14 +839,14 @@ discard block |
||
| 839 | 839 | function getDeniedIDs() |
| 840 | 840 | { |
| 841 | 841 | $output = executeQueryArray('member.getDeniedIDs'); |
| 842 | - if(!$output->toBool()) return array(); |
|
| 842 | + if (!$output->toBool()) return array(); |
|
| 843 | 843 | return $output->data; |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | function getDeniedNickNames() |
| 847 | 847 | { |
| 848 | 848 | $output = executeQueryArray('member.getDeniedNickNames'); |
| 849 | - if(!$output->toBool()) |
|
| 849 | + if (!$output->toBool()) |
|
| 850 | 850 | { |
| 851 | 851 | return array(); |
| 852 | 852 | } |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | $args = new stdClass(); |
| 863 | 863 | $args->user_id = $user_id; |
| 864 | 864 | $output = executeQuery('member.chkDeniedID', $args); |
| 865 | - if($output->data->count) return true; |
|
| 865 | + if ($output->data->count) return true; |
|
| 866 | 866 | return false; |
| 867 | 867 | } |
| 868 | 868 | |
@@ -874,8 +874,8 @@ discard block |
||
| 874 | 874 | $args = new stdClass(); |
| 875 | 875 | $args->nick_name = $nickName; |
| 876 | 876 | $output = executeQuery('member.chkDeniedNickName', $args); |
| 877 | - if($output->data->count) return true; |
|
| 878 | - if(!$output->toBool()) |
|
| 877 | + if ($output->data->count) return true; |
|
| 878 | + if (!$output->toBool()) |
|
| 879 | 879 | { |
| 880 | 880 | return true; |
| 881 | 881 | } |
@@ -886,20 +886,20 @@ discard block |
||
| 886 | 886 | */ |
| 887 | 887 | function getProfileImage($member_srl) |
| 888 | 888 | { |
| 889 | - if(!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) |
|
| 889 | + if (!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) |
|
| 890 | 890 | { |
| 891 | 891 | $GLOBALS['__member_info__']['profile_image'][$member_srl] = null; |
| 892 | - $exts = array('gif','jpg','png'); |
|
| 893 | - for($i=0;$i<3;$i++) |
|
| 892 | + $exts = array('gif', 'jpg', 'png'); |
|
| 893 | + for ($i = 0; $i < 3; $i++) |
|
| 894 | 894 | { |
| 895 | 895 | $image_name_file = sprintf('files/member_extra_info/profile_image/%s%d.%s', getNumberingPath($member_srl), $member_srl, $exts[$i]); |
| 896 | - if(file_exists($image_name_file)) |
|
| 896 | + if (file_exists($image_name_file)) |
|
| 897 | 897 | { |
| 898 | 898 | list($width, $height, $type, $attrs) = getimagesize($image_name_file); |
| 899 | 899 | $info = new stdClass(); |
| 900 | 900 | $info->width = $width; |
| 901 | 901 | $info->height = $height; |
| 902 | - $info->src = Context::getRequestUri().$image_name_file . '?' . date('YmdHis', filemtime($image_name_file)); |
|
| 902 | + $info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file)); |
|
| 903 | 903 | $info->file = './'.$image_name_file; |
| 904 | 904 | $GLOBALS['__member_info__']['profile_image'][$member_srl] = $info; |
| 905 | 905 | break; |
@@ -915,16 +915,16 @@ discard block |
||
| 915 | 915 | */ |
| 916 | 916 | function getImageName($member_srl) |
| 917 | 917 | { |
| 918 | - if(!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) |
|
| 918 | + if (!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) |
|
| 919 | 919 | { |
| 920 | 920 | $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
| 921 | - if(file_exists($image_name_file)) |
|
| 921 | + if (file_exists($image_name_file)) |
|
| 922 | 922 | { |
| 923 | 923 | list($width, $height, $type, $attrs) = getimagesize($image_name_file); |
| 924 | 924 | $info = new stdClass; |
| 925 | 925 | $info->width = $width; |
| 926 | 926 | $info->height = $height; |
| 927 | - $info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file)); |
|
| 927 | + $info->src = Context::getRequestUri().$image_name_file.'?'.date('YmdHis', filemtime($image_name_file)); |
|
| 928 | 928 | $info->file = './'.$image_name_file; |
| 929 | 929 | $GLOBALS['__member_info__']['image_name'][$member_srl] = $info; |
| 930 | 930 | } |
@@ -938,15 +938,15 @@ discard block |
||
| 938 | 938 | */ |
| 939 | 939 | function getImageMark($member_srl) |
| 940 | 940 | { |
| 941 | - if(!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) |
|
| 941 | + if (!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) |
|
| 942 | 942 | { |
| 943 | 943 | $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); |
| 944 | - if(file_exists($image_mark_file)) |
|
| 944 | + if (file_exists($image_mark_file)) |
|
| 945 | 945 | { |
| 946 | 946 | list($width, $height, $type, $attrs) = getimagesize($image_mark_file); |
| 947 | 947 | $info->width = $width; |
| 948 | 948 | $info->height = $height; |
| 949 | - $info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file)); |
|
| 949 | + $info->src = Context::getRequestUri().$image_mark_file.'?'.date('YmdHis', filemtime($image_mark_file)); |
|
| 950 | 950 | $info->file = './'.$image_mark_file; |
| 951 | 951 | $GLOBALS['__member_info__']['image_mark'][$member_srl] = $info; |
| 952 | 952 | } |
@@ -960,27 +960,27 @@ discard block |
||
| 960 | 960 | /** |
| 961 | 961 | * @brief Get the image mark of the group |
| 962 | 962 | */ |
| 963 | - function getGroupImageMark($member_srl,$site_srl=0) |
|
| 963 | + function getGroupImageMark($member_srl, $site_srl = 0) |
|
| 964 | 964 | { |
| 965 | - if(!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl])) |
|
| 965 | + if (!isset($GLOBALS['__member_info__']['group_image_mark'][$member_srl])) |
|
| 966 | 966 | { |
| 967 | 967 | $oModuleModel = getModel('module'); |
| 968 | 968 | $config = $oModuleModel->getModuleConfig('member'); |
| 969 | - if($config->group_image_mark!='Y') |
|
| 969 | + if ($config->group_image_mark != 'Y') |
|
| 970 | 970 | { |
| 971 | 971 | return null; |
| 972 | 972 | } |
| 973 | - $member_group = $this->getMemberGroups($member_srl,$site_srl); |
|
| 973 | + $member_group = $this->getMemberGroups($member_srl, $site_srl); |
|
| 974 | 974 | $groups_info = $this->getGroups($site_srl); |
| 975 | - if(count($member_group) > 0 && is_array($member_group)) |
|
| 975 | + if (count($member_group) > 0 && is_array($member_group)) |
|
| 976 | 976 | { |
| 977 | 977 | $memberGroups = array_keys($member_group); |
| 978 | 978 | |
| 979 | - foreach($groups_info as $group_srl=>$group_info) |
|
| 979 | + foreach ($groups_info as $group_srl=>$group_info) |
|
| 980 | 980 | { |
| 981 | - if(in_array($group_srl, $memberGroups)) |
|
| 981 | + if (in_array($group_srl, $memberGroups)) |
|
| 982 | 982 | { |
| 983 | - if($group_info->image_mark) |
|
| 983 | + if ($group_info->image_mark) |
|
| 984 | 984 | { |
| 985 | 985 | $info = new stdClass(); |
| 986 | 986 | $info->title = $group_info->title; |
@@ -1004,10 +1004,10 @@ discard block |
||
| 1004 | 1004 | */ |
| 1005 | 1005 | function getSignature($member_srl) |
| 1006 | 1006 | { |
| 1007 | - if(!isset($GLOBALS['__member_info__']['signature'][$member_srl])) |
|
| 1007 | + if (!isset($GLOBALS['__member_info__']['signature'][$member_srl])) |
|
| 1008 | 1008 | { |
| 1009 | 1009 | $filename = sprintf('files/member_extra_info/signature/%s%d.signature.php', getNumberingPath($member_srl), $member_srl); |
| 1010 | - if(file_exists($filename)) |
|
| 1010 | + if (file_exists($filename)) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | $buff = FileHandler::readFile($filename); |
| 1013 | 1013 | $signature = preg_replace('/<\?.*?\?>/', '', $buff); |
@@ -1025,10 +1025,10 @@ discard block |
||
| 1025 | 1025 | * @param int $member_srl Set this to member_srl when comparing a member's password (optional) |
| 1026 | 1026 | * @return bool |
| 1027 | 1027 | */ |
| 1028 | - function isValidPassword($hashed_password, $password_text, $member_srl=null) |
|
| 1028 | + function isValidPassword($hashed_password, $password_text, $member_srl = null) |
|
| 1029 | 1029 | { |
| 1030 | 1030 | // False if no password in entered |
| 1031 | - if(!$password_text) |
|
| 1031 | + if (!$password_text) |
|
| 1032 | 1032 | { |
| 1033 | 1033 | return false; |
| 1034 | 1034 | } |
@@ -1037,31 +1037,31 @@ discard block |
||
| 1037 | 1037 | $oPassword = new Password(); |
| 1038 | 1038 | $current_algorithm = $oPassword->checkAlgorithm($hashed_password); |
| 1039 | 1039 | $match = $oPassword->checkPassword($password_text, $hashed_password, $current_algorithm); |
| 1040 | - if(!$match) |
|
| 1040 | + if (!$match) |
|
| 1041 | 1041 | { |
| 1042 | 1042 | return false; |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | // Update the encryption method if necessary |
| 1046 | 1046 | $config = $this->getMemberConfig(); |
| 1047 | - if($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') |
|
| 1047 | + if ($member_srl > 0 && $config->password_hashing_auto_upgrade != 'N') |
|
| 1048 | 1048 | { |
| 1049 | 1049 | $need_upgrade = false; |
| 1050 | 1050 | |
| 1051 | - if(!$need_upgrade) |
|
| 1051 | + if (!$need_upgrade) |
|
| 1052 | 1052 | { |
| 1053 | 1053 | $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm(); |
| 1054 | - if($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
| 1054 | + if ($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | - if(!$need_upgrade) |
|
| 1057 | + if (!$need_upgrade) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | $required_work_factor = $oPassword->getWorkFactor(); |
| 1060 | 1060 | $current_work_factor = $oPassword->checkWorkFactor($hashed_password); |
| 1061 | - if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
| 1061 | + if ($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | - if($need_upgrade === true) |
|
| 1064 | + if ($need_upgrade === true) |
|
| 1065 | 1065 | { |
| 1066 | 1066 | $args = new stdClass(); |
| 1067 | 1067 | $args->member_srl = $member_srl; |
@@ -1089,27 +1089,27 @@ discard block |
||
| 1089 | 1089 | function checkPasswordStrength($password, $strength) |
| 1090 | 1090 | { |
| 1091 | 1091 | $logged_info = Context::get('logged_info'); |
| 1092 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1092 | + if ($logged_info->is_admin == 'Y') return true; |
|
| 1093 | 1093 | |
| 1094 | - if($strength == NULL) |
|
| 1094 | + if ($strength == NULL) |
|
| 1095 | 1095 | { |
| 1096 | 1096 | $config = $this->getMemberConfig(); |
| 1097 | - $strength = $config->password_strength?$config->password_strength:'normal'; |
|
| 1097 | + $strength = $config->password_strength ? $config->password_strength : 'normal'; |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | $length = strlen($password); |
| 1101 | 1101 | |
| 1102 | 1102 | switch ($strength) { |
| 1103 | 1103 | case 'high': |
| 1104 | - if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
| 1104 | + if ($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
| 1105 | 1105 | /* no break */ |
| 1106 | 1106 | |
| 1107 | 1107 | case 'normal': |
| 1108 | - if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
| 1108 | + if ($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
| 1109 | 1109 | break; |
| 1110 | 1110 | |
| 1111 | 1111 | case 'low': |
| 1112 | - if($length < 4) return false; |
|
| 1112 | + if ($length < 4) return false; |
|
| 1113 | 1113 | break; |
| 1114 | 1114 | } |
| 1115 | 1115 | |
@@ -1120,11 +1120,11 @@ discard block |
||
| 1120 | 1120 | { |
| 1121 | 1121 | $groupSrl = 0; |
| 1122 | 1122 | $output = $this->getGroups($site_srl); |
| 1123 | - if(is_array($output)) |
|
| 1123 | + if (is_array($output)) |
|
| 1124 | 1124 | { |
| 1125 | - foreach($output AS $key=>$value) |
|
| 1125 | + foreach ($output AS $key=>$value) |
|
| 1126 | 1126 | { |
| 1127 | - if($value->is_admin == 'Y') |
|
| 1127 | + if ($value->is_admin == 'Y') |
|
| 1128 | 1128 | { |
| 1129 | 1129 | $groupSrl = $value->group_srl; |
| 1130 | 1130 | break; |
@@ -45,37 +45,79 @@ discard block |
||
| 45 | 45 | foreach($config->signupForm AS $key=>$value) |
| 46 | 46 | { |
| 47 | 47 | $config->signupForm[$key]->title = ($value->isDefaultForm) ? Context::getLang($value->name) : $value->title; |
| 48 | - if($config->signupForm[$key]->isPublic != 'N') $config->signupForm[$key]->isPublic = 'Y'; |
|
| 49 | - if($value->name == 'find_account_question') $config->signupForm[$key]->isPublic = 'N'; |
|
| 48 | + if($config->signupForm[$key]->isPublic != 'N') { |
|
| 49 | + $config->signupForm[$key]->isPublic = 'Y'; |
|
| 50 | + } |
|
| 51 | + if($value->name == 'find_account_question') { |
|
| 52 | + $config->signupForm[$key]->isPublic = 'N'; |
|
| 53 | + } |
|
| 50 | 54 | } |
| 51 | 55 | |
| 52 | 56 | // Get terms of user |
| 53 | 57 | $config->agreement = memberModel::_getAgreement(); |
| 54 | 58 | |
| 55 | - if(!$config->webmaster_name) $config->webmaster_name = 'webmaster'; |
|
| 59 | + if(!$config->webmaster_name) { |
|
| 60 | + $config->webmaster_name = 'webmaster'; |
|
| 61 | + } |
|
| 56 | 62 | |
| 57 | - if(!$config->image_name_max_width) $config->image_name_max_width = 90; |
|
| 58 | - if(!$config->image_name_max_height) $config->image_name_max_height = 20; |
|
| 59 | - if(!$config->image_name_max_filesize) $config->image_name_max_filesize = null; |
|
| 60 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = 20; |
|
| 61 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = 20; |
|
| 62 | - if(!$config->image_mark_max_filesize) $config->image_mark_max_filesize = null; |
|
| 63 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = 90; |
|
| 64 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = 90; |
|
| 65 | - if(!$config->profile_image_max_filesize) $config->profile_image_max_filesize = null; |
|
| 63 | + if(!$config->image_name_max_width) { |
|
| 64 | + $config->image_name_max_width = 90; |
|
| 65 | + } |
|
| 66 | + if(!$config->image_name_max_height) { |
|
| 67 | + $config->image_name_max_height = 20; |
|
| 68 | + } |
|
| 69 | + if(!$config->image_name_max_filesize) { |
|
| 70 | + $config->image_name_max_filesize = null; |
|
| 71 | + } |
|
| 72 | + if(!$config->image_mark_max_width) { |
|
| 73 | + $config->image_mark_max_width = 20; |
|
| 74 | + } |
|
| 75 | + if(!$config->image_mark_max_height) { |
|
| 76 | + $config->image_mark_max_height = 20; |
|
| 77 | + } |
|
| 78 | + if(!$config->image_mark_max_filesize) { |
|
| 79 | + $config->image_mark_max_filesize = null; |
|
| 80 | + } |
|
| 81 | + if(!$config->profile_image_max_width) { |
|
| 82 | + $config->profile_image_max_width = 90; |
|
| 83 | + } |
|
| 84 | + if(!$config->profile_image_max_height) { |
|
| 85 | + $config->profile_image_max_height = 90; |
|
| 86 | + } |
|
| 87 | + if(!$config->profile_image_max_filesize) { |
|
| 88 | + $config->profile_image_max_filesize = null; |
|
| 89 | + } |
|
| 66 | 90 | |
| 67 | - if(!$config->skin) $config->skin = 'default'; |
|
| 68 | - if(!$config->colorset) $config->colorset = 'white'; |
|
| 69 | - if(!$config->editor_skin || $config->editor_skin == 'default') $config->editor_skin = 'ckeditor'; |
|
| 70 | - if(!$config->group_image_mark) $config->group_image_mark = "N"; |
|
| 91 | + if(!$config->skin) { |
|
| 92 | + $config->skin = 'default'; |
|
| 93 | + } |
|
| 94 | + if(!$config->colorset) { |
|
| 95 | + $config->colorset = 'white'; |
|
| 96 | + } |
|
| 97 | + if(!$config->editor_skin || $config->editor_skin == 'default') { |
|
| 98 | + $config->editor_skin = 'ckeditor'; |
|
| 99 | + } |
|
| 100 | + if(!$config->group_image_mark) { |
|
| 101 | + $config->group_image_mark = "N"; |
|
| 102 | + } |
|
| 71 | 103 | |
| 72 | - if(!$config->identifier) $config->identifier = 'user_id'; |
|
| 104 | + if(!$config->identifier) { |
|
| 105 | + $config->identifier = 'user_id'; |
|
| 106 | + } |
|
| 73 | 107 | |
| 74 | - if(!$config->max_error_count) $config->max_error_count = 10; |
|
| 75 | - if(!$config->max_error_count_time) $config->max_error_count_time = 300; |
|
| 108 | + if(!$config->max_error_count) { |
|
| 109 | + $config->max_error_count = 10; |
|
| 110 | + } |
|
| 111 | + if(!$config->max_error_count_time) { |
|
| 112 | + $config->max_error_count_time = 300; |
|
| 113 | + } |
|
| 76 | 114 | |
| 77 | - if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') $config->signature_editor_skin = 'ckeditor'; |
|
| 78 | - if(!$config->sel_editor_colorset) $config->sel_editor_colorset = 'moono'; |
|
| 115 | + if(!$config->signature_editor_skin || $config->signature_editor_skin == 'default') { |
|
| 116 | + $config->signature_editor_skin = 'ckeditor'; |
|
| 117 | + } |
|
| 118 | + if(!$config->sel_editor_colorset) { |
|
| 119 | + $config->sel_editor_colorset = 'moono'; |
|
| 120 | + } |
|
| 79 | 121 | |
| 80 | 122 | $member_config = $config; |
| 81 | 123 | |
@@ -121,12 +163,18 @@ discard block |
||
| 121 | 163 | $logged_info = Context::get('logged_info'); |
| 122 | 164 | $act = Context::get('cur_act'); |
| 123 | 165 | // When click user's own nickname |
| 124 | - if($member_srl == $logged_info->member_srl) $member_info = $logged_info; |
|
| 166 | + if($member_srl == $logged_info->member_srl) { |
|
| 167 | + $member_info = $logged_info; |
|
| 168 | + } |
|
| 125 | 169 | // When click other's nickname |
| 126 | - else $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
|
| 170 | + else { |
|
| 171 | + $member_info = $this->getMemberInfoByMemberSrl($member_srl); |
|
| 172 | + } |
|
| 127 | 173 | |
| 128 | 174 | $member_srl = $member_info->member_srl; |
| 129 | - if(!$member_srl) return; |
|
| 175 | + if(!$member_srl) { |
|
| 176 | + return; |
|
| 177 | + } |
|
| 130 | 178 | // List variables |
| 131 | 179 | $user_id = $member_info->user_id; |
| 132 | 180 | $user_name = $member_info->user_name; |
@@ -161,11 +209,13 @@ discard block |
||
| 161 | 209 | } |
| 162 | 210 | } |
| 163 | 211 | // View homepage info |
| 164 | - if($member_info->homepage) |
|
| 165 | - $oMemberController->addMemberPopupMenu(escape($member_info->homepage, false), 'homepage', '', 'blank'); |
|
| 212 | + if($member_info->homepage) { |
|
| 213 | + $oMemberController->addMemberPopupMenu(escape($member_info->homepage, false), 'homepage', '', 'blank'); |
|
| 214 | + } |
|
| 166 | 215 | // View blog info |
| 167 | - if($member_info->blog) |
|
| 168 | - $oMemberController->addMemberPopupMenu(escape($member_info->blog, false), 'blog', '', 'blank'); |
|
| 216 | + if($member_info->blog) { |
|
| 217 | + $oMemberController->addMemberPopupMenu(escape($member_info->blog, false), 'blog', '', 'blank'); |
|
| 218 | + } |
|
| 169 | 219 | // Call a trigger (after) |
| 170 | 220 | ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null); |
| 171 | 221 | // Display a menu for editting member info to a top administrator |
@@ -200,16 +250,14 @@ discard block |
||
| 200 | 250 | if(Mobile::isFromMobilePhone()) |
| 201 | 251 | { |
| 202 | 252 | return true; |
| 203 | - } |
|
| 204 | - elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
| 253 | + } elseif(filter_var($_SESSION['ipaddress'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) |
|
| 205 | 254 | { |
| 206 | 255 | // IPv6: require same /48 |
| 207 | 256 | if(strncmp(inet_pton($_SESSION['ipaddress']), inet_pton($_SERVER['REMOTE_ADDR']), 6) == 0) |
| 208 | 257 | { |
| 209 | 258 | return true; |
| 210 | 259 | } |
| 211 | - } |
|
| 212 | - else |
|
| 260 | + } else |
|
| 213 | 261 | { |
| 214 | 262 | // IPv4: require same /24 |
| 215 | 263 | if(ip2long($_SESSION['ipaddress']) >> 8 == ip2long($_SERVER['REMOTE_ADDR']) >> 8) |
@@ -239,10 +287,12 @@ discard block |
||
| 239 | 287 | $logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl); |
| 240 | 288 | // Add is_site_admin bool variable into logged_info if site_administrator is |
| 241 | 289 | $oModuleModel = getModel('module'); |
| 242 | - if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; |
|
| 243 | - else $logged_info->is_site_admin = false; |
|
| 244 | - } |
|
| 245 | - else |
|
| 290 | + if($oModuleModel->isSiteAdmin($logged_info)) { |
|
| 291 | + $logged_info->is_site_admin = true; |
|
| 292 | + } else { |
|
| 293 | + $logged_info->is_site_admin = false; |
|
| 294 | + } |
|
| 295 | + } else |
|
| 246 | 296 | { |
| 247 | 297 | // Register a default group if the site doesn't have a member group |
| 248 | 298 | if(count($logged_info->group_list) === 0) |
@@ -268,13 +318,19 @@ discard block |
||
| 268 | 318 | */ |
| 269 | 319 | function getMemberInfoByUserID($user_id, $columnList = array()) |
| 270 | 320 | { |
| 271 | - if(!$user_id) return; |
|
| 321 | + if(!$user_id) { |
|
| 322 | + return; |
|
| 323 | + } |
|
| 272 | 324 | |
| 273 | 325 | $args = new stdClass; |
| 274 | 326 | $args->user_id = $user_id; |
| 275 | 327 | $output = executeQuery('member.getMemberInfo', $args); |
| 276 | - if(!$output->toBool()) return $output; |
|
| 277 | - if(!$output->data) return; |
|
| 328 | + if(!$output->toBool()) { |
|
| 329 | + return $output; |
|
| 330 | + } |
|
| 331 | + if(!$output->data) { |
|
| 332 | + return; |
|
| 333 | + } |
|
| 278 | 334 | |
| 279 | 335 | $member_info = $this->arrangeMemberInfo($output->data); |
| 280 | 336 | |
@@ -286,7 +342,9 @@ discard block |
||
| 286 | 342 | */ |
| 287 | 343 | function getMemberInfoByEmailAddress($email_address) |
| 288 | 344 | { |
| 289 | - if(!$email_address) return; |
|
| 345 | + if(!$email_address) { |
|
| 346 | + return; |
|
| 347 | + } |
|
| 290 | 348 | |
| 291 | 349 | $args = new stdClass(); |
| 292 | 350 | |
@@ -295,15 +353,18 @@ discard block |
||
| 295 | 353 | { |
| 296 | 354 | $args->email_address = strtolower($email_address); |
| 297 | 355 | $output = executeQuery('member.getMemberInfoByEmailAddressForCubrid', $args); |
| 298 | - } |
|
| 299 | - else |
|
| 356 | + } else |
|
| 300 | 357 | { |
| 301 | 358 | $args->email_address = $email_address; |
| 302 | 359 | $output = executeQuery('member.getMemberInfoByEmailAddress', $args); |
| 303 | 360 | } |
| 304 | 361 | |
| 305 | - if(!$output->toBool()) return $output; |
|
| 306 | - if(!$output->data) return; |
|
| 362 | + if(!$output->toBool()) { |
|
| 363 | + return $output; |
|
| 364 | + } |
|
| 365 | + if(!$output->data) { |
|
| 366 | + return; |
|
| 367 | + } |
|
| 307 | 368 | |
| 308 | 369 | $member_info = $this->arrangeMemberInfo($output->data); |
| 309 | 370 | return $member_info; |
@@ -314,7 +375,9 @@ discard block |
||
| 314 | 375 | */ |
| 315 | 376 | function getMemberInfoByMemberSrl($member_srl, $site_srl = 0, $columnList = array()) |
| 316 | 377 | { |
| 317 | - if(!$member_srl) return; |
|
| 378 | + if(!$member_srl) { |
|
| 379 | + return; |
|
| 380 | + } |
|
| 318 | 381 | |
| 319 | 382 | //columnList size zero... get full member info |
| 320 | 383 | if(!$GLOBALS['__member_info__'][$member_srl] || count($columnList) == 0) |
@@ -337,13 +400,17 @@ discard block |
||
| 337 | 400 | $output = executeQuery('member.getMemberInfoByMemberSrl', $args, $columnList); |
| 338 | 401 | if(!$output->data) |
| 339 | 402 | { |
| 340 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, new stdClass); |
|
| 403 | + if($oCacheHandler->isSupport()) { |
|
| 404 | + $oCacheHandler->put($cache_key, new stdClass); |
|
| 405 | + } |
|
| 341 | 406 | return; |
| 342 | 407 | } |
| 343 | 408 | $this->arrangeMemberInfo($output->data, $site_srl); |
| 344 | 409 | |
| 345 | 410 | //insert in cache |
| 346 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
| 411 | + if($oCacheHandler->isSupport()) { |
|
| 412 | + $oCacheHandler->put($cache_key, $GLOBALS['__member_info__'][$member_srl]); |
|
| 413 | + } |
|
| 347 | 414 | } |
| 348 | 415 | } |
| 349 | 416 | |
@@ -377,8 +444,12 @@ discard block |
||
| 377 | 444 | { |
| 378 | 445 | foreach($extra_vars as $key => $val) |
| 379 | 446 | { |
| 380 | - if(!is_array($val) && strpos($val, '|@|') !== FALSE) $val = explode('|@|', $val); |
|
| 381 | - if(!$info->{$key}) $info->{$key} = $val; |
|
| 447 | + if(!is_array($val) && strpos($val, '|@|') !== FALSE) { |
|
| 448 | + $val = explode('|@|', $val); |
|
| 449 | + } |
|
| 450 | + if(!$info->{$key}) { |
|
| 451 | + $info->{$key} = $val; |
|
| 452 | + } |
|
| 382 | 453 | } |
| 383 | 454 | } |
| 384 | 455 | |
@@ -401,8 +472,7 @@ discard block |
||
| 401 | 472 | if(is_array($val)) |
| 402 | 473 | { |
| 403 | 474 | $oSecurity->encodeHTML($key . '.'); |
| 404 | - } |
|
| 405 | - else |
|
| 475 | + } else |
|
| 406 | 476 | { |
| 407 | 477 | $oSecurity->encodeHTML($key); |
| 408 | 478 | } |
@@ -465,7 +535,9 @@ discard block |
||
| 465 | 535 | */ |
| 466 | 536 | function getLoggedMemberSrl() |
| 467 | 537 | { |
| 468 | - if(!$this->isLogged()) return; |
|
| 538 | + if(!$this->isLogged()) { |
|
| 539 | + return; |
|
| 540 | + } |
|
| 469 | 541 | return $_SESSION['member_srl']; |
| 470 | 542 | } |
| 471 | 543 | |
@@ -474,7 +546,9 @@ discard block |
||
| 474 | 546 | */ |
| 475 | 547 | function getLoggedUserID() |
| 476 | 548 | { |
| 477 | - if(!$this->isLogged()) return; |
|
| 549 | + if(!$this->isLogged()) { |
|
| 550 | + return; |
|
| 551 | + } |
|
| 478 | 552 | $logged_info = Context::get('logged_info'); |
| 479 | 553 | return $logged_info->user_id; |
| 480 | 554 | } |
@@ -506,9 +580,13 @@ discard block |
||
| 506 | 580 | $output = executeQueryArray('member.getMemberGroups', $args); |
| 507 | 581 | $group_list = $output->data; |
| 508 | 582 | //insert in cache |
| 509 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
| 583 | + if($oCacheHandler->isSupport()) { |
|
| 584 | + $oCacheHandler->put($cache_key, $group_list); |
|
| 585 | + } |
|
| 586 | + } |
|
| 587 | + if(!$group_list) { |
|
| 588 | + return array(); |
|
| 510 | 589 | } |
| 511 | - if(!$group_list) return array(); |
|
| 512 | 590 | |
| 513 | 591 | foreach($group_list as $group) |
| 514 | 592 | { |
@@ -528,7 +606,9 @@ discard block |
||
| 528 | 606 | $args->site_srl = $site_srl; |
| 529 | 607 | $args->sort_index = 'list_order'; |
| 530 | 608 | $output = executeQueryArray('member.getMembersGroups', $args); |
| 531 | - if(!$output->data) return array(); |
|
| 609 | + if(!$output->data) { |
|
| 610 | + return array(); |
|
| 611 | + } |
|
| 532 | 612 | |
| 533 | 613 | $result = array(); |
| 534 | 614 | foreach($output->data as $key=>$val) |
@@ -620,7 +700,9 @@ discard block |
||
| 620 | 700 | $output = executeQueryArray('member.getGroups', $args); |
| 621 | 701 | $group_list = $output->data; |
| 622 | 702 | //insert in cache |
| 623 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $group_list); |
|
| 703 | + if($oCacheHandler->isSupport()) { |
|
| 704 | + $oCacheHandler->put($cache_key, $group_list); |
|
| 705 | + } |
|
| 624 | 706 | } |
| 625 | 707 | |
| 626 | 708 | if(!$group_list) |
@@ -668,9 +750,13 @@ discard block |
||
| 668 | 750 | $output = executeQuery('member.getJoinFormList', $args); |
| 669 | 751 | // NULL if output data deosn't exist |
| 670 | 752 | $join_form_list = $output->data; |
| 671 | - if(!$join_form_list) return NULL; |
|
| 753 | + if(!$join_form_list) { |
|
| 754 | + return NULL; |
|
| 755 | + } |
|
| 672 | 756 | // Need to unserialize because serialized array is inserted into DB in case of default_value |
| 673 | - if(!is_array($join_form_list)) $join_form_list = array($join_form_list); |
|
| 757 | + if(!is_array($join_form_list)) { |
|
| 758 | + $join_form_list = array($join_form_list); |
|
| 759 | + } |
|
| 674 | 760 | $join_form_count = count($join_form_list); |
| 675 | 761 | for($i=0;$i<$join_form_count;$i++) |
| 676 | 762 | { |
@@ -687,9 +773,10 @@ discard block |
||
| 687 | 773 | if(in_array($column_type, array('checkbox','select','radio'))) |
| 688 | 774 | { |
| 689 | 775 | $join_form_list[$i]->default_value = unserialize($default_value); |
| 690 | - if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; |
|
| 691 | - } |
|
| 692 | - else |
|
| 776 | + if(!$join_form_list[$i]->default_value[0]) { |
|
| 777 | + $join_form_list[$i]->default_value = ''; |
|
| 778 | + } |
|
| 779 | + } else |
|
| 693 | 780 | { |
| 694 | 781 | $join_form_list[$i]->default_value = ''; |
| 695 | 782 | } |
@@ -703,13 +790,18 @@ discard block |
||
| 703 | 790 | { |
| 704 | 791 | foreach($this->join_form_list as $key => $val) |
| 705 | 792 | { |
| 706 | - if($val->is_active != 'Y') continue; |
|
| 793 | + if($val->is_active != 'Y') { |
|
| 794 | + continue; |
|
| 795 | + } |
|
| 707 | 796 | unset($obj); |
| 708 | 797 | $obj->type = $val->column_type; |
| 709 | 798 | $obj->name = $val->column_name; |
| 710 | 799 | $obj->lang = $val->column_title; |
| 711 | - if($logged_info->is_admin != 'Y') $obj->required = $val->required=='Y'?true:false; |
|
| 712 | - else $obj->required = false; |
|
| 800 | + if($logged_info->is_admin != 'Y') { |
|
| 801 | + $obj->required = $val->required=='Y'?true:false; |
|
| 802 | + } else { |
|
| 803 | + $obj->required = false; |
|
| 804 | + } |
|
| 713 | 805 | $filter_output[] = $obj; |
| 714 | 806 | |
| 715 | 807 | unset($open_obj); |
@@ -760,7 +852,9 @@ discard block |
||
| 760 | 852 | function getCombineJoinForm($member_info) |
| 761 | 853 | { |
| 762 | 854 | $extend_form_list = $this->getJoinFormlist(); |
| 763 | - if(!$extend_form_list) return; |
|
| 855 | + if(!$extend_form_list) { |
|
| 856 | + return; |
|
| 857 | + } |
|
| 764 | 858 | // Member info is open only to an administrator and him/herself when is_private is true. |
| 765 | 859 | $logged_info = Context::get('logged_info'); |
| 766 | 860 | |
@@ -773,7 +867,9 @@ discard block |
||
| 773 | 867 | switch($item->column_type) |
| 774 | 868 | { |
| 775 | 869 | case 'checkbox' : |
| 776 | - if($value && !is_array($value)) $value = array($value); |
|
| 870 | + if($value && !is_array($value)) { |
|
| 871 | + $value = array($value); |
|
| 872 | + } |
|
| 777 | 873 | break; |
| 778 | 874 | case 'text' : |
| 779 | 875 | case 'homepage' : |
@@ -787,8 +883,11 @@ discard block |
||
| 787 | 883 | |
| 788 | 884 | $extend_form_list[$srl]->value = $value; |
| 789 | 885 | |
| 790 | - if($member_info->{'open_'.$column_name}=='Y') $extend_form_list[$srl]->is_opened = true; |
|
| 791 | - else $extend_form_list[$srl]->is_opened = false; |
|
| 886 | + if($member_info->{'open_'.$column_name}=='Y') { |
|
| 887 | + $extend_form_list[$srl]->is_opened = true; |
|
| 888 | + } else { |
|
| 889 | + $extend_form_list[$srl]->is_opened = false; |
|
| 890 | + } |
|
| 792 | 891 | } |
| 793 | 892 | return $extend_form_list; |
| 794 | 893 | } |
@@ -801,7 +900,9 @@ discard block |
||
| 801 | 900 | $args->member_join_form_srl = $member_join_form_srl; |
| 802 | 901 | $output = executeQuery('member.getJoinForm', $args); |
| 803 | 902 | $join_form = $output->data; |
| 804 | - if(!$join_form) return NULL; |
|
| 903 | + if(!$join_form) { |
|
| 904 | + return NULL; |
|
| 905 | + } |
|
| 805 | 906 | |
| 806 | 907 | $column_type = $join_form->column_type; |
| 807 | 908 | $default_value = $join_form->default_value; |
@@ -809,8 +910,7 @@ discard block |
||
| 809 | 910 | if(in_array($column_type, array('checkbox','select','radio'))) |
| 810 | 911 | { |
| 811 | 912 | $join_form->default_value = unserialize($default_value); |
| 812 | - } |
|
| 813 | - else |
|
| 913 | + } else |
|
| 814 | 914 | { |
| 815 | 915 | $join_form->default_value = ''; |
| 816 | 916 | } |
@@ -839,7 +939,9 @@ discard block |
||
| 839 | 939 | function getDeniedIDs() |
| 840 | 940 | { |
| 841 | 941 | $output = executeQueryArray('member.getDeniedIDs'); |
| 842 | - if(!$output->toBool()) return array(); |
|
| 942 | + if(!$output->toBool()) { |
|
| 943 | + return array(); |
|
| 944 | + } |
|
| 843 | 945 | return $output->data; |
| 844 | 946 | } |
| 845 | 947 | |
@@ -862,7 +964,9 @@ discard block |
||
| 862 | 964 | $args = new stdClass(); |
| 863 | 965 | $args->user_id = $user_id; |
| 864 | 966 | $output = executeQuery('member.chkDeniedID', $args); |
| 865 | - if($output->data->count) return true; |
|
| 967 | + if($output->data->count) { |
|
| 968 | + return true; |
|
| 969 | + } |
|
| 866 | 970 | return false; |
| 867 | 971 | } |
| 868 | 972 | |
@@ -874,7 +978,9 @@ discard block |
||
| 874 | 978 | $args = new stdClass(); |
| 875 | 979 | $args->nick_name = $nickName; |
| 876 | 980 | $output = executeQuery('member.chkDeniedNickName', $args); |
| 877 | - if($output->data->count) return true; |
|
| 981 | + if($output->data->count) { |
|
| 982 | + return true; |
|
| 983 | + } |
|
| 878 | 984 | if(!$output->toBool()) |
| 879 | 985 | { |
| 880 | 986 | return true; |
@@ -927,8 +1033,9 @@ discard block |
||
| 927 | 1033 | $info->src = Context::getRequestUri().$image_name_file. '?' . date('YmdHis', filemtime($image_name_file)); |
| 928 | 1034 | $info->file = './'.$image_name_file; |
| 929 | 1035 | $GLOBALS['__member_info__']['image_name'][$member_srl] = $info; |
| 1036 | + } else { |
|
| 1037 | + $GLOBALS['__member_info__']['image_name'][$member_srl] = null; |
|
| 930 | 1038 | } |
| 931 | - else $GLOBALS['__member_info__']['image_name'][$member_srl] = null; |
|
| 932 | 1039 | } |
| 933 | 1040 | return $GLOBALS['__member_info__']['image_name'][$member_srl]; |
| 934 | 1041 | } |
@@ -949,8 +1056,9 @@ discard block |
||
| 949 | 1056 | $info->src = Context::getRequestUri().$image_mark_file . '?' . date('YmdHis', filemtime($image_mark_file)); |
| 950 | 1057 | $info->file = './'.$image_mark_file; |
| 951 | 1058 | $GLOBALS['__member_info__']['image_mark'][$member_srl] = $info; |
| 1059 | + } else { |
|
| 1060 | + $GLOBALS['__member_info__']['image_mark'][$member_srl] = null; |
|
| 952 | 1061 | } |
| 953 | - else $GLOBALS['__member_info__']['image_mark'][$member_srl] = null; |
|
| 954 | 1062 | } |
| 955 | 1063 | |
| 956 | 1064 | return $GLOBALS['__member_info__']['image_mark'][$member_srl]; |
@@ -992,9 +1100,13 @@ discard block |
||
| 992 | 1100 | } |
| 993 | 1101 | } |
| 994 | 1102 | } |
| 995 | - if (!$info) $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N'; |
|
| 1103 | + if (!$info) { |
|
| 1104 | + $GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N'; |
|
| 1105 | + } |
|
| 1106 | + } |
|
| 1107 | + if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') { |
|
| 1108 | + return null; |
|
| 996 | 1109 | } |
| 997 | - if ($GLOBALS['__member_info__']['group_image_mark'][$member_srl] == 'N') return null; |
|
| 998 | 1110 | |
| 999 | 1111 | return $GLOBALS['__member_info__']['group_image_mark'][$member_srl]; |
| 1000 | 1112 | } |
@@ -1012,8 +1124,9 @@ discard block |
||
| 1012 | 1124 | $buff = FileHandler::readFile($filename); |
| 1013 | 1125 | $signature = preg_replace('/<\?.*?\?>/', '', $buff); |
| 1014 | 1126 | $GLOBALS['__member_info__']['signature'][$member_srl] = $signature; |
| 1127 | + } else { |
|
| 1128 | + $GLOBALS['__member_info__']['signature'][$member_srl] = null; |
|
| 1015 | 1129 | } |
| 1016 | - else $GLOBALS['__member_info__']['signature'][$member_srl] = null; |
|
| 1017 | 1130 | } |
| 1018 | 1131 | return $GLOBALS['__member_info__']['signature'][$member_srl]; |
| 1019 | 1132 | } |
@@ -1051,14 +1164,18 @@ discard block |
||
| 1051 | 1164 | if(!$need_upgrade) |
| 1052 | 1165 | { |
| 1053 | 1166 | $required_algorithm = $oPassword->getCurrentlySelectedAlgorithm(); |
| 1054 | - if($required_algorithm !== $current_algorithm) $need_upgrade = true; |
|
| 1167 | + if($required_algorithm !== $current_algorithm) { |
|
| 1168 | + $need_upgrade = true; |
|
| 1169 | + } |
|
| 1055 | 1170 | } |
| 1056 | 1171 | |
| 1057 | 1172 | if(!$need_upgrade) |
| 1058 | 1173 | { |
| 1059 | 1174 | $required_work_factor = $oPassword->getWorkFactor(); |
| 1060 | 1175 | $current_work_factor = $oPassword->checkWorkFactor($hashed_password); |
| 1061 | - if($current_work_factor !== false && $required_work_factor > $current_work_factor) $need_upgrade = true; |
|
| 1176 | + if($current_work_factor !== false && $required_work_factor > $current_work_factor) { |
|
| 1177 | + $need_upgrade = true; |
|
| 1178 | + } |
|
| 1062 | 1179 | } |
| 1063 | 1180 | |
| 1064 | 1181 | if($need_upgrade === true) |
@@ -1089,7 +1206,9 @@ discard block |
||
| 1089 | 1206 | function checkPasswordStrength($password, $strength) |
| 1090 | 1207 | { |
| 1091 | 1208 | $logged_info = Context::get('logged_info'); |
| 1092 | - if($logged_info->is_admin == 'Y') return true; |
|
| 1209 | + if($logged_info->is_admin == 'Y') { |
|
| 1210 | + return true; |
|
| 1211 | + } |
|
| 1093 | 1212 | |
| 1094 | 1213 | if($strength == NULL) |
| 1095 | 1214 | { |
@@ -1101,15 +1220,21 @@ discard block |
||
| 1101 | 1220 | |
| 1102 | 1221 | switch ($strength) { |
| 1103 | 1222 | case 'high': |
| 1104 | - if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) return false; |
|
| 1223 | + if($length < 8 || !preg_match('/[^a-zA-Z0-9]/', $password)) { |
|
| 1224 | + return false; |
|
| 1225 | + } |
|
| 1105 | 1226 | /* no break */ |
| 1106 | 1227 | |
| 1107 | 1228 | case 'normal': |
| 1108 | - if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) return false; |
|
| 1229 | + if($length < 6 || !preg_match('/[a-zA-Z]/', $password) || !preg_match('/[0-9]/', $password)) { |
|
| 1230 | + return false; |
|
| 1231 | + } |
|
| 1109 | 1232 | break; |
| 1110 | 1233 | |
| 1111 | 1234 | case 'low': |
| 1112 | - if($length < 4) return false; |
|
| 1235 | + if($length < 4) { |
|
| 1236 | + return false; |
|
| 1237 | + } |
|
| 1113 | 1238 | break; |
| 1114 | 1239 | } |
| 1115 | 1240 | |