@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function getEditorConfig($module_srl = null) |
| 25 | 25 | { |
| 26 | - if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) |
|
| 26 | + if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl) |
|
| 27 | 27 | { |
| 28 | 28 | // Get trackback settings of the selected module |
| 29 | 29 | $oModuleModel = getModel('module'); |
@@ -34,55 +34,55 @@ discard block |
||
| 34 | 34 | $oModuleModel = getModel('module'); |
| 35 | 35 | $editor_default_config = $oModuleModel->getModuleConfig('editor'); |
| 36 | 36 | |
| 37 | - if(!is_object($editor_config)) $editor_config = new stdClass(); |
|
| 37 | + if (!is_object($editor_config)) $editor_config = new stdClass(); |
|
| 38 | 38 | |
| 39 | - if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
| 40 | - if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
| 41 | - if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
| 42 | - if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
| 43 | - if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
| 44 | - if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
| 45 | - if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
| 46 | - if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
| 47 | - if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); |
|
| 39 | + if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
| 40 | + if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
| 41 | + if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
| 42 | + if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
| 43 | + if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
| 44 | + if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
| 45 | + if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
| 46 | + if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
| 47 | + if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array(); |
|
| 48 | 48 | |
| 49 | - if(!$editor_config->editor_height) |
|
| 49 | + if (!$editor_config->editor_height) |
|
| 50 | 50 | { |
| 51 | 51 | $editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500; |
| 52 | 52 | } |
| 53 | - if(!$editor_config->comment_editor_height) |
|
| 53 | + if (!$editor_config->comment_editor_height) |
|
| 54 | 54 | { |
| 55 | 55 | $editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120; |
| 56 | 56 | } |
| 57 | - if(!$editor_config->editor_skin) |
|
| 57 | + if (!$editor_config->editor_skin) |
|
| 58 | 58 | { |
| 59 | 59 | $editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor'; |
| 60 | 60 | } |
| 61 | - if(!$editor_config->comment_editor_skin) |
|
| 61 | + if (!$editor_config->comment_editor_skin) |
|
| 62 | 62 | { |
| 63 | 63 | $editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor'; |
| 64 | 64 | } |
| 65 | - if(!$editor_config->content_style) |
|
| 65 | + if (!$editor_config->content_style) |
|
| 66 | 66 | { |
| 67 | 67 | $editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light'; |
| 68 | 68 | } |
| 69 | - if(!$editor_config->content_font && $editor_default_config->content_font) |
|
| 69 | + if (!$editor_config->content_font && $editor_default_config->content_font) |
|
| 70 | 70 | { |
| 71 | 71 | $editor_config->content_font = $editor_default_config->content_font; |
| 72 | 72 | } |
| 73 | - if(!$editor_config->content_font_size && $editor_default_config->content_font_size) |
|
| 73 | + if (!$editor_config->content_font_size && $editor_default_config->content_font_size) |
|
| 74 | 74 | { |
| 75 | 75 | $editor_config->content_font_size = $editor_default_config->content_font_size; |
| 76 | 76 | } |
| 77 | - if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) |
|
| 77 | + if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) |
|
| 78 | 78 | { |
| 79 | 79 | $editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset; |
| 80 | 80 | } |
| 81 | - if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) |
|
| 81 | + if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) |
|
| 82 | 82 | { |
| 83 | 83 | $editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset; |
| 84 | 84 | } |
| 85 | - if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style) |
|
| 85 | + if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style) |
|
| 86 | 86 | { |
| 87 | 87 | $editor_config->comment_content_style = $editor_default_config->comment_content_style; |
| 88 | 88 | } |
@@ -92,25 +92,25 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | function loadDrComponents() |
| 94 | 94 | { |
| 95 | - $drComponentPath = _XE_PATH_ . 'modules/editor/skins/dreditor/drcomponents/'; |
|
| 95 | + $drComponentPath = _XE_PATH_.'modules/editor/skins/dreditor/drcomponents/'; |
|
| 96 | 96 | $drComponentList = FileHandler::readDir($drComponentPath); |
| 97 | 97 | |
| 98 | 98 | $oTemplate = &TemplateHandler::getInstance(); |
| 99 | 99 | |
| 100 | 100 | $drComponentInfo = array(); |
| 101 | - if($drComponentList) |
|
| 101 | + if ($drComponentList) |
|
| 102 | 102 | { |
| 103 | - foreach($drComponentList as $i => $drComponent) |
|
| 103 | + foreach ($drComponentList as $i => $drComponent) |
|
| 104 | 104 | { |
| 105 | 105 | unset($obj); |
| 106 | 106 | $obj = $this->getDrComponentXmlInfo($drComponent); |
| 107 | - Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent)); |
|
| 108 | - $path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent); |
|
| 109 | - $obj->html = $oTemplate->compile($path,$drComponent); |
|
| 107 | + Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent)); |
|
| 108 | + $path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent); |
|
| 109 | + $obj->html = $oTemplate->compile($path, $drComponent); |
|
| 110 | 110 | $drComponentInfo[$drComponent] = $obj; |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | - Context::set('drComponentList',$drComponentInfo); |
|
| 113 | + Context::set('drComponentList', $drComponentInfo); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | function getDrComponentXmlInfo($drComponentName) |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $xml_file = sprintf('%sinfo.xml', $component_path); |
| 123 | 123 | $cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type); |
| 124 | 124 | // Return information after including it after cached xml file exists |
| 125 | - if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 125 | + if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 126 | 126 | { |
| 127 | 127 | include($cache_file); |
| 128 | 128 | return $xml_info; |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | $buff .= sprintf('$xml_info->license_link = %s;', var_export($component_info->license_link, true)); |
| 152 | 152 | |
| 153 | 153 | // Author information |
| 154 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 154 | + if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 155 | 155 | else $author_list = $xml_doc->component->author; |
| 156 | 156 | |
| 157 | - for($i=0; $i < count($author_list); $i++) |
|
| 157 | + for ($i = 0; $i < count($author_list); $i++) |
|
| 158 | 158 | { |
| 159 | 159 | $buff .= sprintf('$xml_info->author['.$i.']->name = %s;', var_export($author_list[$i]->name->body, true)); |
| 160 | 160 | $buff .= sprintf('$xml_info->author['.$i.']->email_address = %s;', var_export($author_list[$i]->attrs->email_address, true)); |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // List extra variables (text type only in the editor component) |
| 165 | 165 | $extra_vars = $xml_doc->component->extra_vars->var; |
| 166 | - if($extra_vars) |
|
| 166 | + if ($extra_vars) |
|
| 167 | 167 | { |
| 168 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 169 | - foreach($extra_vars as $key => $val) |
|
| 168 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 169 | + foreach ($extra_vars as $key => $val) |
|
| 170 | 170 | { |
| 171 | 171 | unset($obj); |
| 172 | 172 | $key = $val->attrs->name; |
@@ -198,50 +198,50 @@ discard block |
||
| 198 | 198 | * Editor's default options |
| 199 | 199 | */ |
| 200 | 200 | // Option setting to allow file upload |
| 201 | - if($upload_target_srl) |
|
| 201 | + if ($upload_target_srl) |
|
| 202 | 202 | { |
| 203 | 203 | $option->editor_sequence = $upload_target_srl; |
| 204 | 204 | } |
| 205 | - if(!$option->allow_fileupload) $allow_fileupload = false; |
|
| 205 | + if (!$option->allow_fileupload) $allow_fileupload = false; |
|
| 206 | 206 | else $allow_fileupload = true; |
| 207 | 207 | // content_style setting |
| 208 | - if(!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
| 208 | + if (!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
| 209 | 209 | Context::set('content_style', $option->content_style); |
| 210 | - Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style); |
|
| 210 | + Context::set('content_style_path', getScriptPath().ltrim($this->module_path, './').'styles/'.$option->content_style); |
|
| 211 | 211 | // Default font setting |
| 212 | 212 | Context::set('content_font', addslashes($option->content_font)); |
| 213 | 213 | Context::set('content_font_size', $option->content_font_size); |
| 214 | 214 | |
| 215 | 215 | // Option setting to allow auto-save |
| 216 | - if(!$option->enable_autosave) $enable_autosave = false; |
|
| 217 | - elseif(Context::get($option->primary_key_name)) $enable_autosave = false; |
|
| 216 | + if (!$option->enable_autosave) $enable_autosave = false; |
|
| 217 | + elseif (Context::get($option->primary_key_name)) $enable_autosave = false; |
|
| 218 | 218 | else $enable_autosave = true; |
| 219 | 219 | // Option setting to allow the default editor component |
| 220 | - if(!$option->enable_default_component) $enable_default_component = false; |
|
| 220 | + if (!$option->enable_default_component) $enable_default_component = false; |
|
| 221 | 221 | else $enable_default_component = true; |
| 222 | 222 | // Option setting to allow other extended components |
| 223 | - if(!$option->enable_component) $enable_component = false; |
|
| 223 | + if (!$option->enable_component) $enable_component = false; |
|
| 224 | 224 | else $enable_component = true; |
| 225 | 225 | // Setting for html-mode |
| 226 | - if($option->disable_html) $html_mode = false; |
|
| 226 | + if ($option->disable_html) $html_mode = false; |
|
| 227 | 227 | else $html_mode = true; |
| 228 | 228 | // Set Height |
| 229 | - if(!$option->height) $editor_height = 300; |
|
| 229 | + if (!$option->height) $editor_height = 300; |
|
| 230 | 230 | else $editor_height = $option->height; |
| 231 | - if(Mobile::isFromMobilePhone()) { |
|
| 231 | + if (Mobile::isFromMobilePhone()) { |
|
| 232 | 232 | $editor_height = 150; |
| 233 | 233 | } |
| 234 | 234 | // Skin Setting |
| 235 | 235 | $skin = $option->skin; |
| 236 | - if(!$skin) $skin = 'ckeditor'; |
|
| 236 | + if (!$skin) $skin = 'ckeditor'; |
|
| 237 | 237 | |
| 238 | 238 | $colorset = $option->colorset; |
| 239 | - if(!$colorset) $colorset = 'moono'; |
|
| 239 | + if (!$colorset) $colorset = 'moono'; |
|
| 240 | 240 | Context::set('colorset', $colorset); |
| 241 | 241 | Context::set('skin', $skin); |
| 242 | 242 | Context::set('module_type', $option->module_type); |
| 243 | 243 | |
| 244 | - if($skin=='dreditor') |
|
| 244 | + if ($skin == 'dreditor') |
|
| 245 | 245 | { |
| 246 | 246 | $this->loadDrComponents(); |
| 247 | 247 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | /** |
| 250 | 250 | * Check the automatic backup feature (do not use if the post is edited) |
| 251 | 251 | */ |
| 252 | - if($enable_autosave) |
|
| 252 | + if ($enable_autosave) |
|
| 253 | 253 | { |
| 254 | 254 | // Extract auto-saved data |
| 255 | 255 | $saved_doc = $this->getSavedDoc($upload_target_srl); |
@@ -261,26 +261,26 @@ discard block |
||
| 261 | 261 | /** |
| 262 | 262 | * Extract editor's unique number (in order to display multiple editors on a single page) |
| 263 | 263 | */ |
| 264 | - if($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
| 264 | + if ($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
| 265 | 265 | else |
| 266 | 266 | { |
| 267 | - if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
| 268 | - $editor_sequence = $_SESSION['_editor_sequence_'] ++; |
|
| 267 | + if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
| 268 | + $editor_sequence = $_SESSION['_editor_sequence_']++; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * Upload setting by using configuration of the file module internally |
| 273 | 273 | */ |
| 274 | 274 | $files_count = 0; |
| 275 | - if($allow_fileupload) |
|
| 275 | + if ($allow_fileupload) |
|
| 276 | 276 | { |
| 277 | 277 | $oFileModel = getModel('file'); |
| 278 | 278 | // Get upload configuration to set on SWFUploader |
| 279 | 279 | $file_config = $oFileModel->getUploadConfig(); |
| 280 | - $file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024; |
|
| 281 | - $file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024; |
|
| 280 | + $file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024; |
|
| 281 | + $file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024; |
|
| 282 | 282 | |
| 283 | - Context::set('file_config',$file_config); |
|
| 283 | + Context::set('file_config', $file_config); |
|
| 284 | 284 | // Configure upload status such as file size |
| 285 | 285 | $upload_status = $oFileModel->getUploadStatus(); |
| 286 | 286 | Context::set('upload_status', $upload_status); |
@@ -288,9 +288,9 @@ discard block |
||
| 288 | 288 | $oFileController = getController('file'); |
| 289 | 289 | $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); |
| 290 | 290 | // Check if the file already exists |
| 291 | - if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 291 | + if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 292 | 292 | } |
| 293 | - Context::set('files_count', (int)$files_count); |
|
| 293 | + Context::set('files_count', (int) $files_count); |
|
| 294 | 294 | |
| 295 | 295 | Context::set('allow_fileupload', $allow_fileupload); |
| 296 | 296 | // Set editor_sequence value |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | * Check editor component |
| 308 | 308 | */ |
| 309 | 309 | $site_module_info = Context::get('site_module_info'); |
| 310 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 311 | - if($enable_component) |
|
| 310 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 311 | + if ($enable_component) |
|
| 312 | 312 | { |
| 313 | - if(!Context::get('component_list')) |
|
| 313 | + if (!Context::get('component_list')) |
|
| 314 | 314 | { |
| 315 | 315 | $component_list = $this->getComponentList(true, $site_srl); |
| 316 | 316 | Context::set('component_list', $component_list); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); |
| 338 | 338 | $tpl_file = 'editor.html'; |
| 339 | 339 | |
| 340 | - if(!file_exists($tpl_path.$tpl_file)) |
|
| 340 | + if (!file_exists($tpl_path.$tpl_file)) |
|
| 341 | 341 | { |
| 342 | 342 | $skin = 'ckeditor'; |
| 343 | 343 | $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $config->module_type = $type; |
| 368 | 368 | |
| 369 | 369 | // Configurations listed according to a type |
| 370 | - if($type == 'document') |
|
| 370 | + if ($type == 'document') |
|
| 371 | 371 | { |
| 372 | 372 | $config->editor_skin = $editor_config->editor_skin; |
| 373 | 373 | $config->content_style = $editor_config->content_style; |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $config->enable_autosave = 'N'; |
| 397 | 397 | } |
| 398 | 398 | // Check a group_list of the currently logged-in user for permission check |
| 399 | - if(Context::get('is_logged')) |
|
| 399 | + if (Context::get('is_logged')) |
|
| 400 | 400 | { |
| 401 | 401 | $logged_info = Context::get('logged_info'); |
| 402 | 402 | $group_list = $logged_info->group_list; |
@@ -415,12 +415,12 @@ discard block |
||
| 415 | 415 | $option->colorset = $config->sel_editor_colorset; |
| 416 | 416 | // Permission check for file upload |
| 417 | 417 | $option->allow_fileupload = false; |
| 418 | - if($logged_info->is_admin=='Y') $option->allow_fileupload = true; |
|
| 419 | - elseif(count($config->upload_file_grant)) |
|
| 418 | + if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true; |
|
| 419 | + elseif (count($config->upload_file_grant)) |
|
| 420 | 420 | { |
| 421 | - foreach($group_list as $group_srl => $group_info) |
|
| 421 | + foreach ($group_list as $group_srl => $group_info) |
|
| 422 | 422 | { |
| 423 | - if(in_array($group_srl, $config->upload_file_grant)) |
|
| 423 | + if (in_array($group_srl, $config->upload_file_grant)) |
|
| 424 | 424 | { |
| 425 | 425 | $option->allow_fileupload = true; |
| 426 | 426 | break; |
@@ -430,12 +430,12 @@ discard block |
||
| 430 | 430 | else $option->allow_fileupload = true; |
| 431 | 431 | // Permission check for using default components |
| 432 | 432 | $option->enable_default_component = false; |
| 433 | - if($logged_info->is_admin=='Y') $option->enable_default_component = true; |
|
| 434 | - elseif(count($config->enable_default_component_grant)) |
|
| 433 | + if ($logged_info->is_admin == 'Y') $option->enable_default_component = true; |
|
| 434 | + elseif (count($config->enable_default_component_grant)) |
|
| 435 | 435 | { |
| 436 | - foreach($group_list as $group_srl => $group_info) |
|
| 436 | + foreach ($group_list as $group_srl => $group_info) |
|
| 437 | 437 | { |
| 438 | - if(in_array($group_srl, $config->enable_default_component_grant)) |
|
| 438 | + if (in_array($group_srl, $config->enable_default_component_grant)) |
|
| 439 | 439 | { |
| 440 | 440 | $option->enable_default_component = true; |
| 441 | 441 | break; |
@@ -445,12 +445,12 @@ discard block |
||
| 445 | 445 | else $option->enable_default_component = true; |
| 446 | 446 | // Permisshion check for using extended components |
| 447 | 447 | $option->enable_component = false; |
| 448 | - if($logged_info->is_admin=='Y') $option->enable_component = true; |
|
| 449 | - elseif(count($config->enable_component_grant)) |
|
| 448 | + if ($logged_info->is_admin == 'Y') $option->enable_component = true; |
|
| 449 | + elseif (count($config->enable_component_grant)) |
|
| 450 | 450 | { |
| 451 | - foreach($group_list as $group_srl => $group_info) |
|
| 451 | + foreach ($group_list as $group_srl => $group_info) |
|
| 452 | 452 | { |
| 453 | - if(in_array($group_srl, $config->enable_component_grant)) |
|
| 453 | + if (in_array($group_srl, $config->enable_component_grant)) |
|
| 454 | 454 | { |
| 455 | 455 | $option->enable_component = true; |
| 456 | 456 | break; |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | else $option->enable_component = true; |
| 461 | 461 | // HTML editing privileges |
| 462 | 462 | $enable_html = false; |
| 463 | - if($logged_info->is_admin=='Y') $enable_html = true; |
|
| 464 | - elseif(count($config->enable_html_grant)) |
|
| 463 | + if ($logged_info->is_admin == 'Y') $enable_html = true; |
|
| 464 | + elseif (count($config->enable_html_grant)) |
|
| 465 | 465 | { |
| 466 | - foreach($group_list as $group_srl => $group_info) |
|
| 466 | + foreach ($group_list as $group_srl => $group_info) |
|
| 467 | 467 | { |
| 468 | - if(in_array($group_srl, $config->enable_html_grant)) |
|
| 468 | + if (in_array($group_srl, $config->enable_html_grant)) |
|
| 469 | 469 | { |
| 470 | 470 | $enable_html = true; |
| 471 | 471 | break; |
@@ -474,12 +474,12 @@ discard block |
||
| 474 | 474 | } |
| 475 | 475 | else $enable_html = true; |
| 476 | 476 | |
| 477 | - if($enable_html) $option->disable_html = false; |
|
| 477 | + if ($enable_html) $option->disable_html = false; |
|
| 478 | 478 | else $option->disable_html = true; |
| 479 | 479 | // Set Height |
| 480 | 480 | $option->height = $config->editor_height; |
| 481 | 481 | // Set an option for Auto-save |
| 482 | - $option->enable_autosave = $config->enable_autosave=='Y'?true:false; |
|
| 482 | + $option->enable_autosave = $config->enable_autosave == 'Y' ?true:false; |
|
| 483 | 483 | // Other settings |
| 484 | 484 | $option->primary_key_name = $primary_key_name; |
| 485 | 485 | $option->content_key_name = $content_key_name; |
@@ -495,31 +495,31 @@ discard block |
||
| 495 | 495 | $auto_save_args = new stdClass(); |
| 496 | 496 | $auto_save_args->module_srl = Context::get('module_srl'); |
| 497 | 497 | // Get the current module if module_srl doesn't exist |
| 498 | - if(!$auto_save_args->module_srl) |
|
| 498 | + if (!$auto_save_args->module_srl) |
|
| 499 | 499 | { |
| 500 | 500 | $current_module_info = Context::get('current_module_info'); |
| 501 | 501 | $auto_save_args->module_srl = $current_module_info->module_srl; |
| 502 | 502 | } |
| 503 | 503 | // Find a document by using member_srl for logged-in user and ipaddress for non-logged user |
| 504 | - if(Context::get('is_logged')) |
|
| 504 | + if (Context::get('is_logged')) |
|
| 505 | 505 | { |
| 506 | 506 | $logged_info = Context::get('logged_info'); |
| 507 | 507 | $auto_save_args->member_srl = $logged_info->member_srl; |
| 508 | 508 | } |
| 509 | 509 | else |
| 510 | 510 | { |
| 511 | - $auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl]; |
|
| 511 | + $auto_save_args->certify_key = $_COOKIE['autosave_certify_key_'.$auto_save_args->module_srl]; |
|
| 512 | 512 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
| 513 | 513 | // 변경 이전에 작성된 게시물 호환성 유지 |
| 514 | - if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 514 | + if (!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 515 | 515 | } |
| 516 | 516 | // Extract auto-saved data from the DB |
| 517 | 517 | $output = executeQuery('editor.getSavedDocument', $auto_save_args); |
| 518 | 518 | $saved_doc = $output->data; |
| 519 | 519 | // Return null if no result is auto-saved |
| 520 | - if(!$saved_doc) return; |
|
| 520 | + if (!$saved_doc) return; |
|
| 521 | 521 | |
| 522 | - if($saved_doc->certify_key && !isset($auto_save_args->certify_key)) |
|
| 522 | + if ($saved_doc->certify_key && !isset($auto_save_args->certify_key)) |
|
| 523 | 523 | { |
| 524 | 524 | return; |
| 525 | 525 | } |
@@ -527,16 +527,16 @@ discard block |
||
| 527 | 527 | // Check if the auto-saved document already exists |
| 528 | 528 | $oDocumentModel = getModel('document'); |
| 529 | 529 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 530 | - if($oSaved->isExists()) return; |
|
| 530 | + if ($oSaved->isExists()) return; |
|
| 531 | 531 | // Move all the files if the auto-saved data contains document_srl and file |
| 532 | 532 | // Then set document_srl to editor_sequence |
| 533 | - if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
|
| 533 | + if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
|
| 534 | 534 | { |
| 535 | 535 | $saved_doc->module_srl = $auto_save_args->module_srl; |
| 536 | 536 | $oFileController = getController('file'); |
| 537 | 537 | $oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl); |
| 538 | 538 | } |
| 539 | - else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
| 539 | + else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
| 540 | 540 | // Change auto-saved data |
| 541 | 541 | $saved_doc->certify_key = $auto_save_args->certify_key; |
| 542 | 542 | $oEditorController = getController('editor'); |
@@ -553,18 +553,18 @@ discard block |
||
| 553 | 553 | */ |
| 554 | 554 | function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) |
| 555 | 555 | { |
| 556 | - if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return; |
|
| 556 | + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return; |
|
| 557 | 557 | |
| 558 | - if(!$this->loaded_component_list[$component][$editor_sequence]) |
|
| 558 | + if (!$this->loaded_component_list[$component][$editor_sequence]) |
|
| 559 | 559 | { |
| 560 | 560 | // Create an object of the component and execute |
| 561 | 561 | $class_path = sprintf('%scomponents/%s/', $this->module_path, $component); |
| 562 | 562 | $class_file = sprintf('%s%s.class.php', $class_path, $component); |
| 563 | - if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 563 | + if (!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 564 | 564 | // Create an object after loading the class file |
| 565 | 565 | require_once($class_file); |
| 566 | 566 | $oComponent = new $component($editor_sequence, $class_path); |
| 567 | - if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 567 | + if (!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 568 | 568 | // Add configuration information |
| 569 | 569 | $component_info = $this->getComponent($component, $site_srl); |
| 570 | 570 | $oComponent->setInfo($component_info); |
@@ -585,14 +585,14 @@ discard block |
||
| 585 | 585 | /** |
| 586 | 586 | * @brief Return the cache file name of editor component list |
| 587 | 587 | */ |
| 588 | - function getCacheFile($filter_enabled= true, $site_srl = 0) |
|
| 588 | + function getCacheFile($filter_enabled = true, $site_srl = 0) |
|
| 589 | 589 | { |
| 590 | 590 | $lang = Context::getLangType(); |
| 591 | 591 | $cache_path = _XE_PATH_.'files/cache/editor/cache/'; |
| 592 | 592 | FileHandler::makeDir($cache_path); |
| 593 | - $cache_file = $cache_path.'component_list.' . $lang .'.'; |
|
| 594 | - if($filter_enabled) $cache_file .= 'filter.'; |
|
| 595 | - if($site_srl) $cache_file .= $site_srl.'.'; |
|
| 593 | + $cache_file = $cache_path.'component_list.'.$lang.'.'; |
|
| 594 | + if ($filter_enabled) $cache_file .= 'filter.'; |
|
| 595 | + if ($site_srl) $cache_file .= $site_srl.'.'; |
|
| 596 | 596 | $cache_file .= 'php'; |
| 597 | 597 | return $cache_file; |
| 598 | 598 | } |
@@ -604,33 +604,33 @@ discard block |
||
| 604 | 604 | if ($filter_enabled) $cache_key[] = 'filter'; |
| 605 | 605 | if ($site_srl) $cache_key[] = $site_srl; |
| 606 | 606 | |
| 607 | - return 'editor.component_list:' . implode('.', $cache_key); |
|
| 607 | + return 'editor.component_list:'.implode('.', $cache_key); |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | /** |
| 611 | 611 | * @brief Return a component list (DB Information included) |
| 612 | 612 | */ |
| 613 | - function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) |
|
| 613 | + function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false) |
|
| 614 | 614 | { |
| 615 | 615 | $component_list = false; |
| 616 | 616 | |
| 617 | 617 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 618 | - if($oCacheHandler->isSupport()) { |
|
| 618 | + if ($oCacheHandler->isSupport()) { |
|
| 619 | 619 | $cache_key = $this->getComponentListCacheKey(false, $site_srl); |
| 620 | 620 | $component_list = $oCacheHandler->get($cache_key); |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - if($from_db || $component_list === false) |
|
| 623 | + if ($from_db || $component_list === false) |
|
| 624 | 624 | { |
| 625 | 625 | $oEditorController = getController('editor'); |
| 626 | 626 | $component_list = $oEditorController->makeCache(false, $site_srl); |
| 627 | 627 | |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - if(!$component_list) return array(); |
|
| 630 | + if (!$component_list) return array(); |
|
| 631 | 631 | |
| 632 | 632 | $logged_info = Context::get('logged_info'); |
| 633 | - if($logged_info && is_array($logged_info->group_list)) |
|
| 633 | + if ($logged_info && is_array($logged_info->group_list)) |
|
| 634 | 634 | { |
| 635 | 635 | $group_list = array_keys($logged_info->group_list); |
| 636 | 636 | } |
@@ -639,45 +639,45 @@ discard block |
||
| 639 | 639 | $group_list = array(); |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - if(count($component_list)) |
|
| 642 | + if (count($component_list)) |
|
| 643 | 643 | { |
| 644 | - foreach($component_list as $key => $val) |
|
| 644 | + foreach ($component_list as $key => $val) |
|
| 645 | 645 | { |
| 646 | - if(!trim($key)) continue; |
|
| 647 | - if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
|
| 646 | + if (!trim($key)) continue; |
|
| 647 | + if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
|
| 648 | 648 | { |
| 649 | 649 | FileHandler::removeFile($cache_file); |
| 650 | 650 | return $this->getComponentList($filter_enabled, $site_srl); |
| 651 | 651 | } |
| 652 | - if(!$filter_enabled) continue; |
|
| 653 | - if($val->enabled == "N") |
|
| 652 | + if (!$filter_enabled) continue; |
|
| 653 | + if ($val->enabled == "N") |
|
| 654 | 654 | { |
| 655 | 655 | unset($component_list->{$key}); |
| 656 | 656 | continue; |
| 657 | 657 | } |
| 658 | - if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
| 659 | - if($val->target_group) |
|
| 658 | + if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
| 659 | + if ($val->target_group) |
|
| 660 | 660 | { |
| 661 | - if(!$logged_info) |
|
| 661 | + if (!$logged_info) |
|
| 662 | 662 | { |
| 663 | 663 | $val->enabled = "N"; |
| 664 | 664 | } |
| 665 | 665 | else |
| 666 | 666 | { |
| 667 | 667 | $is_granted = false; |
| 668 | - foreach($group_list as $group_srl) |
|
| 668 | + foreach ($group_list as $group_srl) |
|
| 669 | 669 | { |
| 670 | - if(in_array($group_srl, $val->target_group)) $is_granted = true; |
|
| 670 | + if (in_array($group_srl, $val->target_group)) $is_granted = true; |
|
| 671 | 671 | } |
| 672 | - if(!$is_granted) $val->enabled = "N"; |
|
| 672 | + if (!$is_granted) $val->enabled = "N"; |
|
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | - if($val->enabled != "N" && $val->mid_list) |
|
| 675 | + if ($val->enabled != "N" && $val->mid_list) |
|
| 676 | 676 | { |
| 677 | 677 | $mid = Context::get('mid'); |
| 678 | - if(!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
| 678 | + if (!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
| 679 | 679 | } |
| 680 | - if($val->enabled == "N") |
|
| 680 | + if ($val->enabled == "N") |
|
| 681 | 681 | { |
| 682 | 682 | unset($component_list->{$key}); |
| 683 | 683 | continue; |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | $args = new stdClass(); |
| 696 | 696 | $args->component_name = $component_name; |
| 697 | 697 | |
| 698 | - if($site_srl) |
|
| 698 | + if ($site_srl) |
|
| 699 | 699 | { |
| 700 | 700 | $args->site_srl = $site_srl; |
| 701 | 701 | $output = executeQuery('editor.getSiteComponent', $args); |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | } |
| 707 | 707 | $component = $output->data; |
| 708 | 708 | |
| 709 | - if(!$output->data) return false; |
|
| 709 | + if (!$output->data) return false; |
|
| 710 | 710 | |
| 711 | 711 | $component_name = $component->component_name; |
| 712 | 712 | |
@@ -718,25 +718,25 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | $xml_info->mid_list = array(); |
| 720 | 720 | |
| 721 | - if($component->extra_vars) |
|
| 721 | + if ($component->extra_vars) |
|
| 722 | 722 | { |
| 723 | 723 | $extra_vars = unserialize($component->extra_vars); |
| 724 | 724 | |
| 725 | - if($extra_vars->target_group) |
|
| 725 | + if ($extra_vars->target_group) |
|
| 726 | 726 | { |
| 727 | 727 | $xml_info->target_group = $extra_vars->target_group; |
| 728 | 728 | unset($extra_vars->target_group); |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - if($extra_vars->mid_list) |
|
| 731 | + if ($extra_vars->mid_list) |
|
| 732 | 732 | { |
| 733 | 733 | $xml_info->mid_list = $extra_vars->mid_list; |
| 734 | 734 | unset($extra_vars->mid_list); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | - if($xml_info->extra_vars) |
|
| 737 | + if ($xml_info->extra_vars) |
|
| 738 | 738 | { |
| 739 | - foreach($xml_info->extra_vars as $key => $val) |
|
| 739 | + foreach ($xml_info->extra_vars as $key => $val) |
|
| 740 | 740 | { |
| 741 | 741 | $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; |
| 742 | 742 | } |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | $cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type); |
| 761 | 761 | |
| 762 | 762 | // Include and return xml file information if cached file exists |
| 763 | - if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 763 | + if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
| 764 | 764 | { |
| 765 | 765 | include($cache_file); |
| 766 | 766 | |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $component_info->component_name = $component; |
| 778 | 778 | $component_info->title = $xml_doc->component->title->body; |
| 779 | 779 | |
| 780 | - if($xml_doc->component->version) |
|
| 780 | + if ($xml_doc->component->version) |
|
| 781 | 781 | { |
| 782 | 782 | $component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body); |
| 783 | 783 | $component_info->version = $xml_doc->component->version->body; |
@@ -803,10 +803,10 @@ discard block |
||
| 803 | 803 | |
| 804 | 804 | // Author information |
| 805 | 805 | $author_list = array(); |
| 806 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 806 | + if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 807 | 807 | else $author_list = $xml_doc->component->author; |
| 808 | 808 | |
| 809 | - for($i = 0; $i < count($author_list); $i++) |
|
| 809 | + for ($i = 0; $i < count($author_list); $i++) |
|
| 810 | 810 | { |
| 811 | 811 | $author = new stdClass; |
| 812 | 812 | $author->name = $author_list[$i]->name->body; |
@@ -817,39 +817,39 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | // List extra variables (text type only for editor component) |
| 819 | 819 | $extra_vars = $xml_doc->component->extra_vars; |
| 820 | - if($extra_vars) |
|
| 820 | + if ($extra_vars) |
|
| 821 | 821 | { |
| 822 | 822 | $extra_var_groups = $extra_vars->group; |
| 823 | - if(!$extra_var_groups) |
|
| 823 | + if (!$extra_var_groups) |
|
| 824 | 824 | { |
| 825 | 825 | $extra_var_groups = $extra_vars; |
| 826 | 826 | } |
| 827 | - if(!is_array($extra_var_groups)) |
|
| 827 | + if (!is_array($extra_var_groups)) |
|
| 828 | 828 | { |
| 829 | 829 | $extra_var_groups = array($extra_var_groups); |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - foreach($extra_var_groups as $group) |
|
| 832 | + foreach ($extra_var_groups as $group) |
|
| 833 | 833 | { |
| 834 | 834 | $extra_vars = $group->var; |
| 835 | - if(!is_array($group->var)) |
|
| 835 | + if (!is_array($group->var)) |
|
| 836 | 836 | { |
| 837 | 837 | $extra_vars = array($group->var); |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | - foreach($extra_vars as $key => $val) |
|
| 840 | + foreach ($extra_vars as $key => $val) |
|
| 841 | 841 | { |
| 842 | - if(!$val) |
|
| 842 | + if (!$val) |
|
| 843 | 843 | { |
| 844 | 844 | continue; |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | $obj = new stdClass(); |
| 848 | - if(!$val->attrs) |
|
| 848 | + if (!$val->attrs) |
|
| 849 | 849 | { |
| 850 | 850 | $val->attrs = new stdClass(); |
| 851 | 851 | } |
| 852 | - if(!$val->attrs->type) |
|
| 852 | + if (!$val->attrs->type) |
|
| 853 | 853 | { |
| 854 | 854 | $val->attrs->type = 'text'; |
| 855 | 855 | } |
@@ -859,26 +859,26 @@ discard block |
||
| 859 | 859 | $obj->title = $val->title->body; |
| 860 | 860 | $obj->type = $val->attrs->type; |
| 861 | 861 | $obj->description = $val->description->body; |
| 862 | - if($obj->name) |
|
| 862 | + if ($obj->name) |
|
| 863 | 863 | { |
| 864 | 864 | $obj->value = $extra_vals->{$obj->name}; |
| 865 | 865 | } |
| 866 | - if(strpos($obj->value, '|@|') != FALSE) |
|
| 866 | + if (strpos($obj->value, '|@|') != FALSE) |
|
| 867 | 867 | { |
| 868 | 868 | $obj->value = explode('|@|', $obj->value); |
| 869 | 869 | } |
| 870 | - if($obj->type == 'mid_list' && !is_array($obj->value)) |
|
| 870 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) |
|
| 871 | 871 | { |
| 872 | 872 | $obj->value = array($obj->value); |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | // 'Select'type obtained from the option list. |
| 876 | - if($val->options && !is_array($val->options)) |
|
| 876 | + if ($val->options && !is_array($val->options)) |
|
| 877 | 877 | { |
| 878 | 878 | $val->options = array($val->options); |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | - for($i = 0, $c = count($val->options); $i < $c; $i++) |
|
| 881 | + for ($i = 0, $c = count($val->options); $i < $c; $i++) |
|
| 882 | 882 | { |
| 883 | 883 | $obj->options[$i] = new stdClass(); |
| 884 | 884 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | $buff = array(); |
| 894 | 894 | $buff[] = '<?php if(!defined(\'__XE__\')) exit();'; |
| 895 | - $buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';'; |
|
| 895 | + $buff[] = '$xml_info = '.var_export($component_info, TRUE).';'; |
|
| 896 | 896 | $buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff)); |
| 897 | 897 | |
| 898 | 898 | FileHandler::writeFile($cache_file, $buff, 'w'); |
@@ -34,17 +34,37 @@ discard block |
||
| 34 | 34 | $oModuleModel = getModel('module'); |
| 35 | 35 | $editor_default_config = $oModuleModel->getModuleConfig('editor'); |
| 36 | 36 | |
| 37 | - if(!is_object($editor_config)) $editor_config = new stdClass(); |
|
| 38 | - |
|
| 39 | - if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y'; |
|
| 40 | - if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array(); |
|
| 41 | - if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array(); |
|
| 42 | - if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array(); |
|
| 43 | - if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array(); |
|
| 44 | - if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array(); |
|
| 45 | - if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array(); |
|
| 46 | - if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array(); |
|
| 47 | - if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array(); |
|
| 37 | + if(!is_object($editor_config)) { |
|
| 38 | + $editor_config = new stdClass(); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if($editor_config->enable_autosave != 'N') { |
|
| 42 | + $editor_config->enable_autosave = 'Y'; |
|
| 43 | + } |
|
| 44 | + if(!is_array($editor_config->enable_html_grant)) { |
|
| 45 | + $editor_config->enable_html_grant = array(); |
|
| 46 | + } |
|
| 47 | + if(!is_array($editor_config->enable_comment_html_grant)) { |
|
| 48 | + $editor_config->enable_comment_html_grant = array(); |
|
| 49 | + } |
|
| 50 | + if(!is_array($editor_config->upload_file_grant)) { |
|
| 51 | + $editor_config->upload_file_grant = array(); |
|
| 52 | + } |
|
| 53 | + if(!is_array($editor_config->comment_upload_file_grant)) { |
|
| 54 | + $editor_config->comment_upload_file_grant = array(); |
|
| 55 | + } |
|
| 56 | + if(!is_array($editor_config->enable_default_component_grant)) { |
|
| 57 | + $editor_config->enable_default_component_grant = array(); |
|
| 58 | + } |
|
| 59 | + if(!is_array($editor_config->enable_comment_default_component_grant)) { |
|
| 60 | + $editor_config->enable_comment_default_component_grant = array(); |
|
| 61 | + } |
|
| 62 | + if(!is_array($editor_config->enable_component_grant)) { |
|
| 63 | + $editor_config->enable_component_grant = array(); |
|
| 64 | + } |
|
| 65 | + if(!is_array($editor_config->enable_comment_component_grant)) { |
|
| 66 | + $editor_config->enable_comment_component_grant= array(); |
|
| 67 | + } |
|
| 48 | 68 | |
| 49 | 69 | if(!$editor_config->editor_height) |
| 50 | 70 | { |
@@ -151,8 +171,11 @@ discard block |
||
| 151 | 171 | $buff .= sprintf('$xml_info->license_link = %s;', var_export($component_info->license_link, true)); |
| 152 | 172 | |
| 153 | 173 | // Author information |
| 154 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 155 | - else $author_list = $xml_doc->component->author; |
|
| 174 | + if(!is_array($xml_doc->component->author)) { |
|
| 175 | + $author_list[] = $xml_doc->component->author; |
|
| 176 | + } else { |
|
| 177 | + $author_list = $xml_doc->component->author; |
|
| 178 | + } |
|
| 156 | 179 | |
| 157 | 180 | for($i=0; $i < count($author_list); $i++) |
| 158 | 181 | { |
@@ -165,7 +188,9 @@ discard block |
||
| 165 | 188 | $extra_vars = $xml_doc->component->extra_vars->var; |
| 166 | 189 | if($extra_vars) |
| 167 | 190 | { |
| 168 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 191 | + if(!is_array($extra_vars)) { |
|
| 192 | + $extra_vars = array($extra_vars); |
|
| 193 | + } |
|
| 169 | 194 | foreach($extra_vars as $key => $val) |
| 170 | 195 | { |
| 171 | 196 | unset($obj); |
@@ -202,10 +227,15 @@ discard block |
||
| 202 | 227 | { |
| 203 | 228 | $option->editor_sequence = $upload_target_srl; |
| 204 | 229 | } |
| 205 | - if(!$option->allow_fileupload) $allow_fileupload = false; |
|
| 206 | - else $allow_fileupload = true; |
|
| 230 | + if(!$option->allow_fileupload) { |
|
| 231 | + $allow_fileupload = false; |
|
| 232 | + } else { |
|
| 233 | + $allow_fileupload = true; |
|
| 234 | + } |
|
| 207 | 235 | // content_style setting |
| 208 | - if(!$option->content_style) $option->content_style = 'ckeditor_light'; |
|
| 236 | + if(!$option->content_style) { |
|
| 237 | + $option->content_style = 'ckeditor_light'; |
|
| 238 | + } |
|
| 209 | 239 | Context::set('content_style', $option->content_style); |
| 210 | 240 | Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style); |
| 211 | 241 | // Default font setting |
@@ -213,30 +243,50 @@ discard block |
||
| 213 | 243 | Context::set('content_font_size', $option->content_font_size); |
| 214 | 244 | |
| 215 | 245 | // Option setting to allow auto-save |
| 216 | - if(!$option->enable_autosave) $enable_autosave = false; |
|
| 217 | - elseif(Context::get($option->primary_key_name)) $enable_autosave = false; |
|
| 218 | - else $enable_autosave = true; |
|
| 246 | + if(!$option->enable_autosave) { |
|
| 247 | + $enable_autosave = false; |
|
| 248 | + } elseif(Context::get($option->primary_key_name)) { |
|
| 249 | + $enable_autosave = false; |
|
| 250 | + } else { |
|
| 251 | + $enable_autosave = true; |
|
| 252 | + } |
|
| 219 | 253 | // Option setting to allow the default editor component |
| 220 | - if(!$option->enable_default_component) $enable_default_component = false; |
|
| 221 | - else $enable_default_component = true; |
|
| 254 | + if(!$option->enable_default_component) { |
|
| 255 | + $enable_default_component = false; |
|
| 256 | + } else { |
|
| 257 | + $enable_default_component = true; |
|
| 258 | + } |
|
| 222 | 259 | // Option setting to allow other extended components |
| 223 | - if(!$option->enable_component) $enable_component = false; |
|
| 224 | - else $enable_component = true; |
|
| 260 | + if(!$option->enable_component) { |
|
| 261 | + $enable_component = false; |
|
| 262 | + } else { |
|
| 263 | + $enable_component = true; |
|
| 264 | + } |
|
| 225 | 265 | // Setting for html-mode |
| 226 | - if($option->disable_html) $html_mode = false; |
|
| 227 | - else $html_mode = true; |
|
| 266 | + if($option->disable_html) { |
|
| 267 | + $html_mode = false; |
|
| 268 | + } else { |
|
| 269 | + $html_mode = true; |
|
| 270 | + } |
|
| 228 | 271 | // Set Height |
| 229 | - if(!$option->height) $editor_height = 300; |
|
| 230 | - else $editor_height = $option->height; |
|
| 272 | + if(!$option->height) { |
|
| 273 | + $editor_height = 300; |
|
| 274 | + } else { |
|
| 275 | + $editor_height = $option->height; |
|
| 276 | + } |
|
| 231 | 277 | if(Mobile::isFromMobilePhone()) { |
| 232 | 278 | $editor_height = 150; |
| 233 | 279 | } |
| 234 | 280 | // Skin Setting |
| 235 | 281 | $skin = $option->skin; |
| 236 | - if(!$skin) $skin = 'ckeditor'; |
|
| 282 | + if(!$skin) { |
|
| 283 | + $skin = 'ckeditor'; |
|
| 284 | + } |
|
| 237 | 285 | |
| 238 | 286 | $colorset = $option->colorset; |
| 239 | - if(!$colorset) $colorset = 'moono'; |
|
| 287 | + if(!$colorset) { |
|
| 288 | + $colorset = 'moono'; |
|
| 289 | + } |
|
| 240 | 290 | Context::set('colorset', $colorset); |
| 241 | 291 | Context::set('skin', $skin); |
| 242 | 292 | Context::set('module_type', $option->module_type); |
@@ -261,10 +311,13 @@ discard block |
||
| 261 | 311 | /** |
| 262 | 312 | * Extract editor's unique number (in order to display multiple editors on a single page) |
| 263 | 313 | */ |
| 264 | - if($option->editor_sequence) $editor_sequence = $option->editor_sequence; |
|
| 265 | - else |
|
| 314 | + if($option->editor_sequence) { |
|
| 315 | + $editor_sequence = $option->editor_sequence; |
|
| 316 | + } else |
|
| 266 | 317 | { |
| 267 | - if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1; |
|
| 318 | + if(!$_SESSION['_editor_sequence_']) { |
|
| 319 | + $_SESSION['_editor_sequence_'] = 1; |
|
| 320 | + } |
|
| 268 | 321 | $editor_sequence = $_SESSION['_editor_sequence_'] ++; |
| 269 | 322 | } |
| 270 | 323 | |
@@ -288,7 +341,9 @@ discard block |
||
| 288 | 341 | $oFileController = getController('file'); |
| 289 | 342 | $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); |
| 290 | 343 | // Check if the file already exists |
| 291 | - if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 344 | + if($upload_target_srl) { |
|
| 345 | + $files_count = $oFileModel->getFilesCount($upload_target_srl); |
|
| 346 | + } |
|
| 292 | 347 | } |
| 293 | 348 | Context::set('files_count', (int)$files_count); |
| 294 | 349 | |
@@ -380,8 +435,7 @@ discard block |
||
| 380 | 435 | $config->enable_html_grant = $editor_config->enable_html_grant; |
| 381 | 436 | $config->editor_height = $editor_config->editor_height; |
| 382 | 437 | $config->enable_autosave = $editor_config->enable_autosave; |
| 383 | - } |
|
| 384 | - else |
|
| 438 | + } else |
|
| 385 | 439 | { |
| 386 | 440 | $config->editor_skin = $editor_config->comment_editor_skin; |
| 387 | 441 | $config->content_style = $editor_config->comment_content_style; |
@@ -400,8 +454,7 @@ discard block |
||
| 400 | 454 | { |
| 401 | 455 | $logged_info = Context::get('logged_info'); |
| 402 | 456 | $group_list = $logged_info->group_list; |
| 403 | - } |
|
| 404 | - else |
|
| 457 | + } else |
|
| 405 | 458 | { |
| 406 | 459 | $group_list = array(); |
| 407 | 460 | } |
@@ -415,8 +468,9 @@ discard block |
||
| 415 | 468 | $option->colorset = $config->sel_editor_colorset; |
| 416 | 469 | // Permission check for file upload |
| 417 | 470 | $option->allow_fileupload = false; |
| 418 | - if($logged_info->is_admin=='Y') $option->allow_fileupload = true; |
|
| 419 | - elseif(count($config->upload_file_grant)) |
|
| 471 | + if($logged_info->is_admin=='Y') { |
|
| 472 | + $option->allow_fileupload = true; |
|
| 473 | + } elseif(count($config->upload_file_grant)) |
|
| 420 | 474 | { |
| 421 | 475 | foreach($group_list as $group_srl => $group_info) |
| 422 | 476 | { |
@@ -426,12 +480,14 @@ discard block |
||
| 426 | 480 | break; |
| 427 | 481 | } |
| 428 | 482 | } |
| 483 | + } else { |
|
| 484 | + $option->allow_fileupload = true; |
|
| 429 | 485 | } |
| 430 | - else $option->allow_fileupload = true; |
|
| 431 | 486 | // Permission check for using default components |
| 432 | 487 | $option->enable_default_component = false; |
| 433 | - if($logged_info->is_admin=='Y') $option->enable_default_component = true; |
|
| 434 | - elseif(count($config->enable_default_component_grant)) |
|
| 488 | + if($logged_info->is_admin=='Y') { |
|
| 489 | + $option->enable_default_component = true; |
|
| 490 | + } elseif(count($config->enable_default_component_grant)) |
|
| 435 | 491 | { |
| 436 | 492 | foreach($group_list as $group_srl => $group_info) |
| 437 | 493 | { |
@@ -441,12 +497,14 @@ discard block |
||
| 441 | 497 | break; |
| 442 | 498 | } |
| 443 | 499 | } |
| 500 | + } else { |
|
| 501 | + $option->enable_default_component = true; |
|
| 444 | 502 | } |
| 445 | - else $option->enable_default_component = true; |
|
| 446 | 503 | // Permisshion check for using extended components |
| 447 | 504 | $option->enable_component = false; |
| 448 | - if($logged_info->is_admin=='Y') $option->enable_component = true; |
|
| 449 | - elseif(count($config->enable_component_grant)) |
|
| 505 | + if($logged_info->is_admin=='Y') { |
|
| 506 | + $option->enable_component = true; |
|
| 507 | + } elseif(count($config->enable_component_grant)) |
|
| 450 | 508 | { |
| 451 | 509 | foreach($group_list as $group_srl => $group_info) |
| 452 | 510 | { |
@@ -456,12 +514,14 @@ discard block |
||
| 456 | 514 | break; |
| 457 | 515 | } |
| 458 | 516 | } |
| 517 | + } else { |
|
| 518 | + $option->enable_component = true; |
|
| 459 | 519 | } |
| 460 | - else $option->enable_component = true; |
|
| 461 | 520 | // HTML editing privileges |
| 462 | 521 | $enable_html = false; |
| 463 | - if($logged_info->is_admin=='Y') $enable_html = true; |
|
| 464 | - elseif(count($config->enable_html_grant)) |
|
| 522 | + if($logged_info->is_admin=='Y') { |
|
| 523 | + $enable_html = true; |
|
| 524 | + } elseif(count($config->enable_html_grant)) |
|
| 465 | 525 | { |
| 466 | 526 | foreach($group_list as $group_srl => $group_info) |
| 467 | 527 | { |
@@ -471,11 +531,15 @@ discard block |
||
| 471 | 531 | break; |
| 472 | 532 | } |
| 473 | 533 | } |
| 534 | + } else { |
|
| 535 | + $enable_html = true; |
|
| 474 | 536 | } |
| 475 | - else $enable_html = true; |
|
| 476 | 537 | |
| 477 | - if($enable_html) $option->disable_html = false; |
|
| 478 | - else $option->disable_html = true; |
|
| 538 | + if($enable_html) { |
|
| 539 | + $option->disable_html = false; |
|
| 540 | + } else { |
|
| 541 | + $option->disable_html = true; |
|
| 542 | + } |
|
| 479 | 543 | // Set Height |
| 480 | 544 | $option->height = $config->editor_height; |
| 481 | 545 | // Set an option for Auto-save |
@@ -505,19 +569,22 @@ discard block |
||
| 505 | 569 | { |
| 506 | 570 | $logged_info = Context::get('logged_info'); |
| 507 | 571 | $auto_save_args->member_srl = $logged_info->member_srl; |
| 508 | - } |
|
| 509 | - else |
|
| 572 | + } else |
|
| 510 | 573 | { |
| 511 | 574 | $auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl]; |
| 512 | 575 | // @see https://github.com/xpressengine/xe-core/issues/2208 |
| 513 | 576 | // 변경 이전에 작성된 게시물 호환성 유지 |
| 514 | - if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 577 | + if(!$auto_save_args->certify_key) { |
|
| 578 | + $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
|
| 579 | + } |
|
| 515 | 580 | } |
| 516 | 581 | // Extract auto-saved data from the DB |
| 517 | 582 | $output = executeQuery('editor.getSavedDocument', $auto_save_args); |
| 518 | 583 | $saved_doc = $output->data; |
| 519 | 584 | // Return null if no result is auto-saved |
| 520 | - if(!$saved_doc) return; |
|
| 585 | + if(!$saved_doc) { |
|
| 586 | + return; |
|
| 587 | + } |
|
| 521 | 588 | |
| 522 | 589 | if($saved_doc->certify_key && !isset($auto_save_args->certify_key)) |
| 523 | 590 | { |
@@ -527,7 +594,9 @@ discard block |
||
| 527 | 594 | // Check if the auto-saved document already exists |
| 528 | 595 | $oDocumentModel = getModel('document'); |
| 529 | 596 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 530 | - if($oSaved->isExists()) return; |
|
| 597 | + if($oSaved->isExists()) { |
|
| 598 | + return; |
|
| 599 | + } |
|
| 531 | 600 | // Move all the files if the auto-saved data contains document_srl and file |
| 532 | 601 | // Then set document_srl to editor_sequence |
| 533 | 602 | if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) |
@@ -535,8 +604,9 @@ discard block |
||
| 535 | 604 | $saved_doc->module_srl = $auto_save_args->module_srl; |
| 536 | 605 | $oFileController = getController('file'); |
| 537 | 606 | $oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl); |
| 607 | + } else if($upload_target_srl) { |
|
| 608 | + $saved_doc->document_srl = $upload_target_srl; |
|
| 538 | 609 | } |
| 539 | - else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; |
|
| 540 | 610 | // Change auto-saved data |
| 541 | 611 | $saved_doc->certify_key = $auto_save_args->certify_key; |
| 542 | 612 | $oEditorController = getController('editor'); |
@@ -553,18 +623,24 @@ discard block |
||
| 553 | 623 | */ |
| 554 | 624 | function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) |
| 555 | 625 | { |
| 556 | - if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return; |
|
| 626 | + if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) { |
|
| 627 | + return; |
|
| 628 | + } |
|
| 557 | 629 | |
| 558 | 630 | if(!$this->loaded_component_list[$component][$editor_sequence]) |
| 559 | 631 | { |
| 560 | 632 | // Create an object of the component and execute |
| 561 | 633 | $class_path = sprintf('%scomponents/%s/', $this->module_path, $component); |
| 562 | 634 | $class_file = sprintf('%s%s.class.php', $class_path, $component); |
| 563 | - if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 635 | + if(!file_exists($class_file)) { |
|
| 636 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 637 | + } |
|
| 564 | 638 | // Create an object after loading the class file |
| 565 | 639 | require_once($class_file); |
| 566 | 640 | $oComponent = new $component($editor_sequence, $class_path); |
| 567 | - if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 641 | + if(!$oComponent) { |
|
| 642 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 643 | + } |
|
| 568 | 644 | // Add configuration information |
| 569 | 645 | $component_info = $this->getComponent($component, $site_srl); |
| 570 | 646 | $oComponent->setInfo($component_info); |
@@ -591,8 +667,12 @@ discard block |
||
| 591 | 667 | $cache_path = _XE_PATH_.'files/cache/editor/cache/'; |
| 592 | 668 | FileHandler::makeDir($cache_path); |
| 593 | 669 | $cache_file = $cache_path.'component_list.' . $lang .'.'; |
| 594 | - if($filter_enabled) $cache_file .= 'filter.'; |
|
| 595 | - if($site_srl) $cache_file .= $site_srl.'.'; |
|
| 670 | + if($filter_enabled) { |
|
| 671 | + $cache_file .= 'filter.'; |
|
| 672 | + } |
|
| 673 | + if($site_srl) { |
|
| 674 | + $cache_file .= $site_srl.'.'; |
|
| 675 | + } |
|
| 596 | 676 | $cache_file .= 'php'; |
| 597 | 677 | return $cache_file; |
| 598 | 678 | } |
@@ -601,8 +681,12 @@ discard block |
||
| 601 | 681 | { |
| 602 | 682 | $cache_key = array(); |
| 603 | 683 | $cache_key[] = Context::getLangType(); |
| 604 | - if ($filter_enabled) $cache_key[] = 'filter'; |
|
| 605 | - if ($site_srl) $cache_key[] = $site_srl; |
|
| 684 | + if ($filter_enabled) { |
|
| 685 | + $cache_key[] = 'filter'; |
|
| 686 | + } |
|
| 687 | + if ($site_srl) { |
|
| 688 | + $cache_key[] = $site_srl; |
|
| 689 | + } |
|
| 606 | 690 | |
| 607 | 691 | return 'editor.component_list:' . implode('.', $cache_key); |
| 608 | 692 | } |
@@ -627,14 +711,15 @@ discard block |
||
| 627 | 711 | |
| 628 | 712 | } |
| 629 | 713 | |
| 630 | - if(!$component_list) return array(); |
|
| 714 | + if(!$component_list) { |
|
| 715 | + return array(); |
|
| 716 | + } |
|
| 631 | 717 | |
| 632 | 718 | $logged_info = Context::get('logged_info'); |
| 633 | 719 | if($logged_info && is_array($logged_info->group_list)) |
| 634 | 720 | { |
| 635 | 721 | $group_list = array_keys($logged_info->group_list); |
| 636 | - } |
|
| 637 | - else |
|
| 722 | + } else |
|
| 638 | 723 | { |
| 639 | 724 | $group_list = array(); |
| 640 | 725 | } |
@@ -643,39 +728,50 @@ discard block |
||
| 643 | 728 | { |
| 644 | 729 | foreach($component_list as $key => $val) |
| 645 | 730 | { |
| 646 | - if(!trim($key)) continue; |
|
| 731 | + if(!trim($key)) { |
|
| 732 | + continue; |
|
| 733 | + } |
|
| 647 | 734 | if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key)) |
| 648 | 735 | { |
| 649 | 736 | FileHandler::removeFile($cache_file); |
| 650 | 737 | return $this->getComponentList($filter_enabled, $site_srl); |
| 651 | 738 | } |
| 652 | - if(!$filter_enabled) continue; |
|
| 739 | + if(!$filter_enabled) { |
|
| 740 | + continue; |
|
| 741 | + } |
|
| 653 | 742 | if($val->enabled == "N") |
| 654 | 743 | { |
| 655 | 744 | unset($component_list->{$key}); |
| 656 | 745 | continue; |
| 657 | 746 | } |
| 658 | - if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue; |
|
| 747 | + if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") { |
|
| 748 | + continue; |
|
| 749 | + } |
|
| 659 | 750 | if($val->target_group) |
| 660 | 751 | { |
| 661 | 752 | if(!$logged_info) |
| 662 | 753 | { |
| 663 | 754 | $val->enabled = "N"; |
| 664 | - } |
|
| 665 | - else |
|
| 755 | + } else |
|
| 666 | 756 | { |
| 667 | 757 | $is_granted = false; |
| 668 | 758 | foreach($group_list as $group_srl) |
| 669 | 759 | { |
| 670 | - if(in_array($group_srl, $val->target_group)) $is_granted = true; |
|
| 760 | + if(in_array($group_srl, $val->target_group)) { |
|
| 761 | + $is_granted = true; |
|
| 762 | + } |
|
| 763 | + } |
|
| 764 | + if(!$is_granted) { |
|
| 765 | + $val->enabled = "N"; |
|
| 671 | 766 | } |
| 672 | - if(!$is_granted) $val->enabled = "N"; |
|
| 673 | 767 | } |
| 674 | 768 | } |
| 675 | 769 | if($val->enabled != "N" && $val->mid_list) |
| 676 | 770 | { |
| 677 | 771 | $mid = Context::get('mid'); |
| 678 | - if(!in_array($mid, $val->mid_list)) $val->enabled = "N"; |
|
| 772 | + if(!in_array($mid, $val->mid_list)) { |
|
| 773 | + $val->enabled = "N"; |
|
| 774 | + } |
|
| 679 | 775 | } |
| 680 | 776 | if($val->enabled == "N") |
| 681 | 777 | { |
@@ -699,14 +795,15 @@ discard block |
||
| 699 | 795 | { |
| 700 | 796 | $args->site_srl = $site_srl; |
| 701 | 797 | $output = executeQuery('editor.getSiteComponent', $args); |
| 702 | - } |
|
| 703 | - else |
|
| 798 | + } else |
|
| 704 | 799 | { |
| 705 | 800 | $output = executeQuery('editor.getComponent', $args); |
| 706 | 801 | } |
| 707 | 802 | $component = $output->data; |
| 708 | 803 | |
| 709 | - if(!$output->data) return false; |
|
| 804 | + if(!$output->data) { |
|
| 805 | + return false; |
|
| 806 | + } |
|
| 710 | 807 | |
| 711 | 808 | $component_name = $component->component_name; |
| 712 | 809 | |
@@ -785,8 +882,7 @@ discard block |
||
| 785 | 882 | $component_info->homepage = $xml_doc->component->link->body; |
| 786 | 883 | $component_info->license = $xml_doc->component->license->body; |
| 787 | 884 | $component_info->license_link = $xml_doc->component->license->attrs->link; |
| 788 | - } |
|
| 789 | - else |
|
| 885 | + } else |
|
| 790 | 886 | { |
| 791 | 887 | sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 792 | 888 | $date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -803,8 +899,11 @@ discard block |
||
| 803 | 899 | |
| 804 | 900 | // Author information |
| 805 | 901 | $author_list = array(); |
| 806 | - if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; |
|
| 807 | - else $author_list = $xml_doc->component->author; |
|
| 902 | + if(!is_array($xml_doc->component->author)) { |
|
| 903 | + $author_list[] = $xml_doc->component->author; |
|
| 904 | + } else { |
|
| 905 | + $author_list = $xml_doc->component->author; |
|
| 906 | + } |
|
| 808 | 907 | |
| 809 | 908 | for($i = 0; $i < count($author_list); $i++) |
| 810 | 909 | { |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | $skin = urlencode(preg_replace("/[^a-z0-9-_]+/i", '', Context::get('skin'))); |
| 26 | 26 | // Get modules/skin information |
| 27 | 27 | $module_path = sprintf("./modules/%s/", $selected_module); |
| 28 | - if(!is_dir($module_path)) $this->stop("msg_invalid_request"); |
|
| 28 | + if (!is_dir($module_path)) $this->stop("msg_invalid_request"); |
|
| 29 | 29 | |
| 30 | 30 | $skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin); |
| 31 | - if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request"); |
|
| 31 | + if (!file_exists($skin_info_xml)) $this->stop("msg_invalid_request"); |
|
| 32 | 32 | |
| 33 | 33 | $oModuleModel = getModel('module'); |
| 34 | 34 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | function dispModuleSelectList() |
| 45 | 45 | { |
| 46 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 46 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 47 | 47 | |
| 48 | 48 | $oModuleModel = getModel('module'); |
| 49 | 49 | $logged_info = Context::get('logged_info'); |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $args = new stdClass(); |
| 59 | 59 | $module_category_exists = false; |
| 60 | - if($logged_info->is_admin == 'Y' && $site_keyword) |
|
| 60 | + if ($logged_info->is_admin == 'Y' && $site_keyword) |
|
| 61 | 61 | { |
| 62 | 62 | $args->site_keyword = $site_keyword; |
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 66 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 67 | 67 | Context::set('site_keyword', null); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if($logged_info->is_admin == 'Y') |
|
| 70 | + if ($logged_info->is_admin == 'Y') |
|
| 71 | 71 | { |
| 72 | 72 | $module_category_exists = true; |
| 73 | 73 | } |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | // Get a list of modules at the site |
| 76 | 76 | $mid_list = array(); |
| 77 | 77 | $output = executeQueryArray('module.getSiteModules', $args); |
| 78 | - if(!$output->data) $output->data = array(); |
|
| 78 | + if (!$output->data) $output->data = array(); |
|
| 79 | 79 | |
| 80 | - foreach($output->data as $key => $val) |
|
| 80 | + foreach ($output->data as $key => $val) |
|
| 81 | 81 | { |
| 82 | 82 | $module = trim($val->module); |
| 83 | - if(!$module) continue; |
|
| 83 | + if (!$module) continue; |
|
| 84 | 84 | |
| 85 | - if(!$oModuleModel->getGrant($val, $logged_info)->access) |
|
| 85 | + if (!$oModuleModel->getGrant($val, $logged_info)->access) |
|
| 86 | 86 | { |
| 87 | 87 | continue; |
| 88 | 88 | } |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | $obj->browser_title = $val->browser_title; |
| 94 | 94 | $mid_list[$module]->list[$category][$val->mid] = $obj; |
| 95 | 95 | |
| 96 | - if(!$selected_module) $selected_module = $module; |
|
| 97 | - if(!$mid_list[$module]->title) |
|
| 96 | + if (!$selected_module) $selected_module = $module; |
|
| 97 | + if (!$mid_list[$module]->title) |
|
| 98 | 98 | { |
| 99 | 99 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
| 100 | 100 | $mid_list[$module]->title = $xml_info->title; |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | function dispModuleFileBox() |
| 118 | 118 | { |
| 119 | 119 | $logged_info = Context::get('logged_info'); |
| 120 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 120 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 121 | 121 | |
| 122 | 122 | $input_name = Context::get('input'); |
| 123 | - if(!preg_match('/^[a-z0-9_]+$/i', $input_name)) |
|
| 123 | + if (!preg_match('/^[a-z0-9_]+$/i', $input_name)) |
|
| 124 | 124 | { |
| 125 | 125 | return new BaseObject(-1, 'msg_invalid_request'); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if(!$input_name) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 128 | + if (!$input_name) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 129 | 129 | |
| 130 | 130 | $addscript = sprintf('<script>//<![CDATA[ |
| 131 | 131 | var selected_filebox_input_name = "%s"; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | Context::set('filebox_list', $output->data); |
| 138 | 138 | |
| 139 | 139 | $filter = Context::get('filter'); |
| 140 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 140 | + if ($filter) Context::set('arrfilter', explode(',', $filter)); |
|
| 141 | 141 | |
| 142 | 142 | Context::set('page_navigation', $output->page_navigation); |
| 143 | 143 | $this->setLayoutFile('popup_layout'); |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | function dispModuleFileBoxAdd() |
| 149 | 149 | { |
| 150 | 150 | $logged_info = Context::get('logged_info'); |
| 151 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 151 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 152 | 152 | |
| 153 | 153 | $filter = Context::get('filter'); |
| 154 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 154 | + if ($filter) Context::set('arrfilter', explode(',', $filter)); |
|
| 155 | 155 | |
| 156 | 156 | $this->setLayoutFile('popup_layout'); |
| 157 | 157 | $this->setTemplateFile('filebox_add'); |
@@ -25,10 +25,14 @@ discard block |
||
| 25 | 25 | $skin = urlencode(preg_replace("/[^a-z0-9-_]+/i", '', Context::get('skin'))); |
| 26 | 26 | // Get modules/skin information |
| 27 | 27 | $module_path = sprintf("./modules/%s/", $selected_module); |
| 28 | - if(!is_dir($module_path)) $this->stop("msg_invalid_request"); |
|
| 28 | + if(!is_dir($module_path)) { |
|
| 29 | + $this->stop("msg_invalid_request"); |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | $skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin); |
| 31 | - if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request"); |
|
| 33 | + if(!file_exists($skin_info_xml)) { |
|
| 34 | + $this->stop("msg_invalid_request"); |
|
| 35 | + } |
|
| 32 | 36 | |
| 33 | 37 | $oModuleModel = getModel('module'); |
| 34 | 38 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
@@ -43,7 +47,9 @@ discard block |
||
| 43 | 47 | */ |
| 44 | 48 | function dispModuleSelectList() |
| 45 | 49 | { |
| 46 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 50 | + if(!Context::get('is_logged')) { |
|
| 51 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 52 | + } |
|
| 47 | 53 | |
| 48 | 54 | $oModuleModel = getModel('module'); |
| 49 | 55 | $logged_info = Context::get('logged_info'); |
@@ -60,8 +66,7 @@ discard block |
||
| 60 | 66 | if($logged_info->is_admin == 'Y' && $site_keyword) |
| 61 | 67 | { |
| 62 | 68 | $args->site_keyword = $site_keyword; |
| 63 | - } |
|
| 64 | - else |
|
| 69 | + } else |
|
| 65 | 70 | { |
| 66 | 71 | $args->site_srl = (int)$site_module_info->site_srl; |
| 67 | 72 | Context::set('site_keyword', null); |
@@ -75,12 +80,16 @@ discard block |
||
| 75 | 80 | // Get a list of modules at the site |
| 76 | 81 | $mid_list = array(); |
| 77 | 82 | $output = executeQueryArray('module.getSiteModules', $args); |
| 78 | - if(!$output->data) $output->data = array(); |
|
| 83 | + if(!$output->data) { |
|
| 84 | + $output->data = array(); |
|
| 85 | + } |
|
| 79 | 86 | |
| 80 | 87 | foreach($output->data as $key => $val) |
| 81 | 88 | { |
| 82 | 89 | $module = trim($val->module); |
| 83 | - if(!$module) continue; |
|
| 90 | + if(!$module) { |
|
| 91 | + continue; |
|
| 92 | + } |
|
| 84 | 93 | |
| 85 | 94 | if(!$oModuleModel->getGrant($val, $logged_info)->access) |
| 86 | 95 | { |
@@ -93,7 +102,9 @@ discard block |
||
| 93 | 102 | $obj->browser_title = $val->browser_title; |
| 94 | 103 | $mid_list[$module]->list[$category][$val->mid] = $obj; |
| 95 | 104 | |
| 96 | - if(!$selected_module) $selected_module = $module; |
|
| 105 | + if(!$selected_module) { |
|
| 106 | + $selected_module = $module; |
|
| 107 | + } |
|
| 97 | 108 | if(!$mid_list[$module]->title) |
| 98 | 109 | { |
| 99 | 110 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
@@ -117,7 +128,9 @@ discard block |
||
| 117 | 128 | function dispModuleFileBox() |
| 118 | 129 | { |
| 119 | 130 | $logged_info = Context::get('logged_info'); |
| 120 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 131 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 132 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 133 | + } |
|
| 121 | 134 | |
| 122 | 135 | $input_name = Context::get('input'); |
| 123 | 136 | if(!preg_match('/^[a-z0-9_]+$/i', $input_name)) |
@@ -125,7 +138,9 @@ discard block |
||
| 125 | 138 | return new BaseObject(-1, 'msg_invalid_request'); |
| 126 | 139 | } |
| 127 | 140 | |
| 128 | - if(!$input_name) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 141 | + if(!$input_name) { |
|
| 142 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 143 | + } |
|
| 129 | 144 | |
| 130 | 145 | $addscript = sprintf('<script>//<![CDATA[ |
| 131 | 146 | var selected_filebox_input_name = "%s"; |
@@ -137,7 +152,9 @@ discard block |
||
| 137 | 152 | Context::set('filebox_list', $output->data); |
| 138 | 153 | |
| 139 | 154 | $filter = Context::get('filter'); |
| 140 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 155 | + if($filter) { |
|
| 156 | + Context::set('arrfilter',explode(',',$filter)); |
|
| 157 | + } |
|
| 141 | 158 | |
| 142 | 159 | Context::set('page_navigation', $output->page_navigation); |
| 143 | 160 | $this->setLayoutFile('popup_layout'); |
@@ -148,10 +165,14 @@ discard block |
||
| 148 | 165 | function dispModuleFileBoxAdd() |
| 149 | 166 | { |
| 150 | 167 | $logged_info = Context::get('logged_info'); |
| 151 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 168 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 169 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 170 | + } |
|
| 152 | 171 | |
| 153 | 172 | $filter = Context::get('filter'); |
| 154 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 173 | + if($filter) { |
|
| 174 | + Context::set('arrfilter',explode(',',$filter)); |
|
| 175 | + } |
|
| 155 | 176 | |
| 156 | 177 | $this->setLayoutFile('popup_layout'); |
| 157 | 178 | $this->setTemplateFile('filebox_add'); |