@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | $component = Context::get('component'); |
| 28 | 28 | |
| 29 | 29 | $site_module_info = Context::get('site_module_info'); |
| 30 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 30 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 31 | 31 | // Get compoenet object |
| 32 | 32 | $oEditorModel = getModel('editor'); |
| 33 | 33 | $oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl); |
| 34 | - if(!$oComponent->toBool()) |
|
| 34 | + if (!$oComponent->toBool()) |
|
| 35 | 35 | { |
| 36 | 36 | Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
| 37 | 37 | $this->setTemplatePath($this->module_path.'tpl'); |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | $component_name = Context::get('component_name'); |
| 59 | 59 | |
| 60 | 60 | $site_module_info = Context::get('site_module_info'); |
| 61 | - $site_srl = (int)$site_module_info->site_srl; |
|
| 61 | + $site_srl = (int) $site_module_info->site_srl; |
|
| 62 | 62 | |
| 63 | 63 | $oEditorModel = getModel('editor'); |
| 64 | 64 | $component = $oEditorModel->getComponent($component_name, $site_srl); |
| 65 | 65 | |
| 66 | - if(!$component->component_name) { |
|
| 66 | + if (!$component->component_name) { |
|
| 67 | 67 | $this->stop('msg_invalid_request'); |
| 68 | 68 | return; |
| 69 | 69 | } |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | $current_module_srl = Context::get('module_srl'); |
| 84 | 84 | $current_module_srls = Context::get('module_srls'); |
| 85 | 85 | |
| 86 | - if(!$current_module_srl && !$current_module_srls) |
|
| 86 | + if (!$current_module_srl && !$current_module_srls) |
|
| 87 | 87 | { |
| 88 | 88 | // Get information of the current module |
| 89 | 89 | $current_module_info = Context::get('current_module_info'); |
| 90 | 90 | $current_module_srl = $current_module_info->module_srl; |
| 91 | - if(!$current_module_srl) return new BaseObject(); |
|
| 91 | + if (!$current_module_srl) return new BaseObject(); |
|
| 92 | 92 | } |
| 93 | 93 | // Get editors settings |
| 94 | 94 | $oEditorModel = getModel('editor'); |
@@ -101,17 +101,17 @@ discard block |
||
| 101 | 101 | $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); |
| 102 | 102 | Context::set('editor_skin_list', $editor_skin_list); |
| 103 | 103 | |
| 104 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin); |
|
| 104 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->editor_skin); |
|
| 105 | 105 | Context::set('editor_colorset_list', $skin_info->colorset); |
| 106 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin); |
|
| 106 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->comment_editor_skin); |
|
| 107 | 107 | Context::set('editor_comment_colorset_list', $skin_info->colorset); |
| 108 | 108 | |
| 109 | 109 | $contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles'); |
| 110 | 110 | $content_style_list = array(); |
| 111 | - for($i=0,$c=count($contents);$i<$c;$i++) |
|
| 111 | + for ($i = 0, $c = count($contents); $i < $c; $i++) |
|
| 112 | 112 | { |
| 113 | 113 | $style = $contents[$i]; |
| 114 | - $info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles'); |
|
| 114 | + $info = $oModuleModel->loadSkinInfo($this->module_path, $style, 'styles'); |
|
| 115 | 115 | $content_style_list[$style] = new stdClass(); |
| 116 | 116 | $content_style_list[$style]->title = $info->title; |
| 117 | 117 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | $skin = Context::get('skin'); |
| 150 | 150 | $oModuleModel = getModel('module'); |
| 151 | - $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin); |
|
| 151 | + $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin); |
|
| 152 | 152 | $colorset = $skin_info->colorset; |
| 153 | 153 | Context::set('colorset', $colorset); |
| 154 | 154 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $mode = Context::get('mode'); |
| 162 | 162 | |
| 163 | - if($mode != 'main') |
|
| 163 | + if ($mode != 'main') |
|
| 164 | 164 | { |
| 165 | 165 | $option_com = new stdClass(); |
| 166 | 166 | $option_com->allow_fileupload = false; |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
| 37 | 37 | $this->setTemplatePath($this->module_path.'tpl'); |
| 38 | 38 | $this->setTemplateFile('component_not_founded'); |
| 39 | - } |
|
| 40 | - else |
|
| 39 | + } else |
|
| 41 | 40 | { |
| 42 | 41 | // Get the result after executing a method to display popup url of the component |
| 43 | 42 | $popup_content = $oComponent->getPopupContent(); |
@@ -88,7 +87,9 @@ discard block |
||
| 88 | 87 | // Get information of the current module |
| 89 | 88 | $current_module_info = Context::get('current_module_info'); |
| 90 | 89 | $current_module_srl = $current_module_info->module_srl; |
| 91 | - if(!$current_module_srl) return new BaseObject(); |
|
| 90 | + if(!$current_module_srl) { |
|
| 91 | + return new BaseObject(); |
|
| 92 | + } |
|
| 92 | 93 | } |
| 93 | 94 | // Get editors settings |
| 94 | 95 | $oEditorModel = getModel('editor'); |
@@ -178,8 +179,7 @@ discard block |
||
| 178 | 179 | $option_com->content_style = $config->comment_content_style; |
| 179 | 180 | $option_com->colorset = $config->sel_comment_editor_colorset; |
| 180 | 181 | $editor = $oEditorModel->getEditor(0, $option_com); |
| 181 | - } |
|
| 182 | - else |
|
| 182 | + } else |
|
| 183 | 183 | { |
| 184 | 184 | $option = new stdClass(); |
| 185 | 185 | $option->allow_fileupload = false; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | $this->editor_sequence = $editor_sequence; |
| 21 | 21 | $this->component_path = $component_path; |
| 22 | - $this->emoticon_path = sprintf('%s%s/images',preg_replace('/^\.\//i','',$this->component_path),'tpl','images'); |
|
| 22 | + $this->emoticon_path = sprintf('%s%s/images', preg_replace('/^\.\//i', '', $this->component_path), 'tpl', 'images'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | function getEmoticonList() |
| 29 | 29 | { |
| 30 | 30 | $emoticon = Context::get('emoticon'); |
| 31 | - if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new BaseObject(-1,'msg_invalid_request'); |
|
| 31 | + if (!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 32 | 32 | |
| 33 | 33 | $list = $this->getEmoticons($emoticon); |
| 34 | 34 | |
| 35 | - $this->add('emoticons', implode("\n",$list)); |
|
| 35 | + $this->add('emoticons', implode("\n", $list)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | $output = array(); |
| 45 | 45 | |
| 46 | 46 | $oDir = dir($emoticon_path); |
| 47 | - while($file = $oDir->read()) |
|
| 47 | + while ($file = $oDir->read()) |
|
| 48 | 48 | { |
| 49 | - if(substr($file,0,1)=='.') continue; |
|
| 50 | - if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file)); |
|
| 49 | + if (substr($file, 0, 1) == '.') continue; |
|
| 50 | + if (preg_match('/\.(jpg|jpeg|gif|png)$/i', $file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path, '', $file)); |
|
| 51 | 51 | } |
| 52 | 52 | $oDir->close(); |
| 53 | - if(count($output)) asort($output); |
|
| 53 | + if (count($output)) asort($output); |
|
| 54 | 54 | return $output; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | // Bringing a list of emoticons directory |
| 63 | 63 | $emoticon_dirs = FileHandler::readDir($this->emoticon_path); |
| 64 | 64 | $emoticon_list = array(); |
| 65 | - if($emoticon_dirs) |
|
| 65 | + if ($emoticon_dirs) |
|
| 66 | 66 | { |
| 67 | - foreach($emoticon_dirs as $emoticon) |
|
| 67 | + foreach ($emoticon_dirs as $emoticon) |
|
| 68 | 68 | { |
| 69 | - if(preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) $emoticon_list[] = $emoticon; |
|
| 69 | + if (preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) $emoticon_list[] = $emoticon; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | Context::set('emoticon_list', $emoticon_list); |
@@ -89,24 +89,24 @@ discard block |
||
| 89 | 89 | $src = $xml_obj->attrs->src; |
| 90 | 90 | $alt = $xml_obj->attrs->alt; |
| 91 | 91 | |
| 92 | - if(!$alt) |
|
| 92 | + if (!$alt) |
|
| 93 | 93 | { |
| 94 | - $tmp_arr = explode('/',$src); |
|
| 94 | + $tmp_arr = explode('/', $src); |
|
| 95 | 95 | $alt = array_pop($tmp_arr); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $src = str_replace(array('&','"'), array('&','&qout;'), $src); |
|
| 99 | - if(!$alt) $alt = $src; |
|
| 98 | + $src = str_replace(array('&', '"'), array('&', '&qout;'), $src); |
|
| 99 | + if (!$alt) $alt = $src; |
|
| 100 | 100 | |
| 101 | 101 | $attr_output = array(); |
| 102 | 102 | $attr_output = array("src=\"".$src."\""); |
| 103 | 103 | |
| 104 | - if($alt) |
|
| 104 | + if ($alt) |
|
| 105 | 105 | { |
| 106 | 106 | $attr_output[] = "alt=\"".$alt."\""; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $code = sprintf("<img %s style=\"border:0px\" />", implode(" ",$attr_output)); |
|
| 109 | + $code = sprintf("<img %s style=\"border:0px\" />", implode(" ", $attr_output)); |
|
| 110 | 110 | |
| 111 | 111 | return $code; |
| 112 | 112 | } |
@@ -28,7 +28,9 @@ discard block |
||
| 28 | 28 | function getEmoticonList() |
| 29 | 29 | { |
| 30 | 30 | $emoticon = Context::get('emoticon'); |
| 31 | - if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new BaseObject(-1,'msg_invalid_request'); |
|
| 31 | + if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) { |
|
| 32 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 33 | + } |
|
| 32 | 34 | |
| 33 | 35 | $list = $this->getEmoticons($emoticon); |
| 34 | 36 | |
@@ -46,11 +48,17 @@ discard block |
||
| 46 | 48 | $oDir = dir($emoticon_path); |
| 47 | 49 | while($file = $oDir->read()) |
| 48 | 50 | { |
| 49 | - if(substr($file,0,1)=='.') continue; |
|
| 50 | - if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file)); |
|
| 51 | + if(substr($file,0,1)=='.') { |
|
| 52 | + continue; |
|
| 53 | + } |
|
| 54 | + if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) { |
|
| 55 | + $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file)); |
|
| 56 | + } |
|
| 51 | 57 | } |
| 52 | 58 | $oDir->close(); |
| 53 | - if(count($output)) asort($output); |
|
| 59 | + if(count($output)) { |
|
| 60 | + asort($output); |
|
| 61 | + } |
|
| 54 | 62 | return $output; |
| 55 | 63 | } |
| 56 | 64 | |
@@ -66,7 +74,9 @@ discard block |
||
| 66 | 74 | { |
| 67 | 75 | foreach($emoticon_dirs as $emoticon) |
| 68 | 76 | { |
| 69 | - if(preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) $emoticon_list[] = $emoticon; |
|
| 77 | + if(preg_match("/^([a-z0-9\_]+)$/i", $emoticon)) { |
|
| 78 | + $emoticon_list[] = $emoticon; |
|
| 79 | + } |
|
| 70 | 80 | } |
| 71 | 81 | } |
| 72 | 82 | Context::set('emoticon_list', $emoticon_list); |
@@ -96,7 +106,9 @@ discard block |
||
| 96 | 106 | } |
| 97 | 107 | |
| 98 | 108 | $src = str_replace(array('&','"'), array('&','&qout;'), $src); |
| 99 | - if(!$alt) $alt = $src; |
|
| 109 | + if(!$alt) { |
|
| 110 | + $alt = $src; |
|
| 111 | + } |
|
| 100 | 112 | |
| 101 | 113 | $attr_output = array(); |
| 102 | 114 | $attr_output = array("src=\"".$src."\""); |
@@ -23,26 +23,26 @@ discard block |
||
| 23 | 23 | $enables = Context::get('enables'); |
| 24 | 24 | $component_names = Context::get('component_names'); |
| 25 | 25 | |
| 26 | - if(!is_array($component_names)) $component_names = array(); |
|
| 27 | - if(!is_array($enables)) $enables = array(); |
|
| 26 | + if (!is_array($component_names)) $component_names = array(); |
|
| 27 | + if (!is_array($enables)) $enables = array(); |
|
| 28 | 28 | |
| 29 | 29 | $unables = array_diff($component_names, $enables); |
| 30 | 30 | $componentList = array(); |
| 31 | 31 | |
| 32 | - foreach($enables as $component_name) |
|
| 32 | + foreach ($enables as $component_name) |
|
| 33 | 33 | { |
| 34 | 34 | $componentList[$component_name] = 'Y'; |
| 35 | 35 | } |
| 36 | - foreach($unables as $component_name) |
|
| 36 | + foreach ($unables as $component_name) |
|
| 37 | 37 | { |
| 38 | 38 | $componentList[$component_name] = 'N'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $output = $this->editorListOrder($component_names,$site_module_info->site_srl); |
|
| 42 | - if(!$output->toBool()) return new BaseObject(); |
|
| 41 | + $output = $this->editorListOrder($component_names, $site_module_info->site_srl); |
|
| 42 | + if (!$output->toBool()) return new BaseObject(); |
|
| 43 | 43 | |
| 44 | - $output = $this->editorCheckUse($componentList,$site_module_info->site_srl); |
|
| 45 | - if(!$output->toBool()) return new BaseObject(); |
|
| 44 | + $output = $this->editorCheckUse($componentList, $site_module_info->site_srl); |
|
| 45 | + if (!$output->toBool()) return new BaseObject(); |
|
| 46 | 46 | |
| 47 | 47 | $oEditorController = getController('editor'); |
| 48 | 48 | $oEditorController->removeCache($site_module_info->site_srl); |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | $args = new stdClass(); |
| 58 | 58 | $args->site_srl = $site_srl; |
| 59 | 59 | |
| 60 | - foreach($componentList as $componentName => $value) |
|
| 60 | + foreach ($componentList as $componentName => $value) |
|
| 61 | 61 | { |
| 62 | 62 | $args->component_name = $componentName; |
| 63 | 63 | $args->enabled = $value; |
| 64 | - if($site_srl == 0) |
|
| 64 | + if ($site_srl == 0) |
|
| 65 | 65 | { |
| 66 | 66 | $output = executeQuery('editor.updateComponent', $args); |
| 67 | 67 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $output = executeQuery('editor.updateSiteComponent', $args); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | - if(!$output->toBool()) return new BaseObject(); |
|
| 73 | + if (!$output->toBool()) return new BaseObject(); |
|
| 74 | 74 | |
| 75 | 75 | unset($componentList); |
| 76 | 76 | return $output; |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | $args = new stdClass(); |
| 85 | 85 | $args->site_srl = $site_srl; |
| 86 | 86 | $list_order_num = '30'; |
| 87 | - if(is_array($component_names)) |
|
| 87 | + if (is_array($component_names)) |
|
| 88 | 88 | { |
| 89 | - foreach($component_names as $name) |
|
| 89 | + foreach ($component_names as $name) |
|
| 90 | 90 | { |
| 91 | 91 | $args->list_order = $list_order_num; |
| 92 | 92 | $args->component_name = $name; |
| 93 | - if($site_srl == 0) |
|
| 93 | + if ($site_srl == 0) |
|
| 94 | 94 | { |
| 95 | 95 | $output = executeQuery('editor.updateComponent', $args); |
| 96 | 96 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $output = executeQuery('editor.updateSiteComponent', $args); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if(!$output->toBool()) return new BaseObject(); |
|
| 102 | + if (!$output->toBool()) return new BaseObject(); |
|
| 103 | 103 | $list_order_num++; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | $args = new stdClass; |
| 125 | 125 | $args->component_name = $component_name; |
| 126 | 126 | $args->extra_vars = serialize($extra_vars); |
| 127 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 127 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 128 | 128 | |
| 129 | - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $args); |
|
| 129 | + if (!$args->site_srl) $output = executeQuery('editor.updateComponent', $args); |
|
| 130 | 130 | else $output = executeQuery('editor.updateSiteComponent', $args); |
| 131 | - if(!$output->toBool()) return $output; |
|
| 131 | + if (!$output->toBool()) return $output; |
|
| 132 | 132 | |
| 133 | 133 | $oEditorController = getController('editor'); |
| 134 | 134 | $oEditorController->removeCache($args->site_srl); |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | $configVars = Context::getRequestVars(); |
| 147 | 147 | |
| 148 | 148 | $config = new stdClass; |
| 149 | - if($configVars->font_defined != 'Y') $config->font_defined = $configVars->font_defined = 'N'; |
|
| 149 | + if ($configVars->font_defined != 'Y') $config->font_defined = $configVars->font_defined = 'N'; |
|
| 150 | 150 | else $config->font_defined = 'Y'; |
| 151 | 151 | |
| 152 | - if($config->font_defined == 'Y') |
|
| 152 | + if ($config->font_defined == 'Y') |
|
| 153 | 153 | $config->content_font = $configVars->content_font_defined; |
| 154 | 154 | else |
| 155 | 155 | $config->content_font = $configVars->content_font; |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | $config->comment_editor_height = $configVars->comment_editor_height; |
| 161 | 161 | $config->content_style = $configVars->content_style; |
| 162 | 162 | |
| 163 | - $config->content_font_size= $configVars->content_font_size.'px'; |
|
| 164 | - $config->sel_editor_colorset= $configVars->sel_editor_colorset; |
|
| 165 | - $config->sel_comment_editor_colorset= $configVars->sel_comment_editor_colorset; |
|
| 163 | + $config->content_font_size = $configVars->content_font_size.'px'; |
|
| 164 | + $config->sel_editor_colorset = $configVars->sel_editor_colorset; |
|
| 165 | + $config->sel_comment_editor_colorset = $configVars->sel_comment_editor_colorset; |
|
| 166 | 166 | |
| 167 | - $oModuleController->insertModuleConfig('editor',$config); |
|
| 167 | + $oModuleController->insertModuleConfig('editor', $config); |
|
| 168 | 168 | $this->setRedirectUrl(Context::get('error_return_url')); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function insertComponent($component_name, $enabled = false, $site_srl = 0) |
| 175 | 175 | { |
| 176 | - if($enabled) $enabled = 'Y'; |
|
| 176 | + if ($enabled) $enabled = 'Y'; |
|
| 177 | 177 | else $enabled = 'N'; |
| 178 | 178 | |
| 179 | 179 | $args = new stdClass; |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | $args->enabled = $enabled; |
| 182 | 182 | $args->site_srl = $site_srl; |
| 183 | 183 | // Check if the component exists |
| 184 | - if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args); |
|
| 184 | + if (!$site_srl) $output = executeQuery('editor.isComponentInserted', $args); |
|
| 185 | 185 | else $output = executeQuery('editor.isSiteComponentInserted', $args); |
| 186 | - if($output->data->count) return new BaseObject(-1, 'msg_component_is_not_founded'); |
|
| 186 | + if ($output->data->count) return new BaseObject(-1, 'msg_component_is_not_founded'); |
|
| 187 | 187 | // Inert a component |
| 188 | 188 | $args->list_order = getNextSequence(); |
| 189 | - if(!$site_srl) $output = executeQuery('editor.insertComponent', $args); |
|
| 189 | + if (!$site_srl) $output = executeQuery('editor.insertComponent', $args); |
|
| 190 | 190 | else $output = executeQuery('editor.insertSiteComponent', $args); |
| 191 | 191 | |
| 192 | 192 | $oEditorController = getController('editor'); |
@@ -23,8 +23,12 @@ discard block |
||
| 23 | 23 | $enables = Context::get('enables'); |
| 24 | 24 | $component_names = Context::get('component_names'); |
| 25 | 25 | |
| 26 | - if(!is_array($component_names)) $component_names = array(); |
|
| 27 | - if(!is_array($enables)) $enables = array(); |
|
| 26 | + if(!is_array($component_names)) { |
|
| 27 | + $component_names = array(); |
|
| 28 | + } |
|
| 29 | + if(!is_array($enables)) { |
|
| 30 | + $enables = array(); |
|
| 31 | + } |
|
| 28 | 32 | |
| 29 | 33 | $unables = array_diff($component_names, $enables); |
| 30 | 34 | $componentList = array(); |
@@ -39,10 +43,14 @@ discard block |
||
| 39 | 43 | } |
| 40 | 44 | |
| 41 | 45 | $output = $this->editorListOrder($component_names,$site_module_info->site_srl); |
| 42 | - if(!$output->toBool()) return new BaseObject(); |
|
| 46 | + if(!$output->toBool()) { |
|
| 47 | + return new BaseObject(); |
|
| 48 | + } |
|
| 43 | 49 | |
| 44 | 50 | $output = $this->editorCheckUse($componentList,$site_module_info->site_srl); |
| 45 | - if(!$output->toBool()) return new BaseObject(); |
|
| 51 | + if(!$output->toBool()) { |
|
| 52 | + return new BaseObject(); |
|
| 53 | + } |
|
| 46 | 54 | |
| 47 | 55 | $oEditorController = getController('editor'); |
| 48 | 56 | $oEditorController->removeCache($site_module_info->site_srl); |
@@ -64,13 +72,14 @@ discard block |
||
| 64 | 72 | if($site_srl == 0) |
| 65 | 73 | { |
| 66 | 74 | $output = executeQuery('editor.updateComponent', $args); |
| 67 | - } |
|
| 68 | - else |
|
| 75 | + } else |
|
| 69 | 76 | { |
| 70 | 77 | $output = executeQuery('editor.updateSiteComponent', $args); |
| 71 | 78 | } |
| 72 | 79 | } |
| 73 | - if(!$output->toBool()) return new BaseObject(); |
|
| 80 | + if(!$output->toBool()) { |
|
| 81 | + return new BaseObject(); |
|
| 82 | + } |
|
| 74 | 83 | |
| 75 | 84 | unset($componentList); |
| 76 | 85 | return $output; |
@@ -93,13 +102,14 @@ discard block |
||
| 93 | 102 | if($site_srl == 0) |
| 94 | 103 | { |
| 95 | 104 | $output = executeQuery('editor.updateComponent', $args); |
| 96 | - } |
|
| 97 | - else |
|
| 105 | + } else |
|
| 98 | 106 | { |
| 99 | 107 | $output = executeQuery('editor.updateSiteComponent', $args); |
| 100 | 108 | } |
| 101 | 109 | |
| 102 | - if(!$output->toBool()) return new BaseObject(); |
|
| 110 | + if(!$output->toBool()) { |
|
| 111 | + return new BaseObject(); |
|
| 112 | + } |
|
| 103 | 113 | $list_order_num++; |
| 104 | 114 | } |
| 105 | 115 | } |
@@ -126,9 +136,14 @@ discard block |
||
| 126 | 136 | $args->extra_vars = serialize($extra_vars); |
| 127 | 137 | $args->site_srl = (int)$site_module_info->site_srl; |
| 128 | 138 | |
| 129 | - if(!$args->site_srl) $output = executeQuery('editor.updateComponent', $args); |
|
| 130 | - else $output = executeQuery('editor.updateSiteComponent', $args); |
|
| 131 | - if(!$output->toBool()) return $output; |
|
| 139 | + if(!$args->site_srl) { |
|
| 140 | + $output = executeQuery('editor.updateComponent', $args); |
|
| 141 | + } else { |
|
| 142 | + $output = executeQuery('editor.updateSiteComponent', $args); |
|
| 143 | + } |
|
| 144 | + if(!$output->toBool()) { |
|
| 145 | + return $output; |
|
| 146 | + } |
|
| 132 | 147 | |
| 133 | 148 | $oEditorController = getController('editor'); |
| 134 | 149 | $oEditorController->removeCache($args->site_srl); |
@@ -146,13 +161,17 @@ discard block |
||
| 146 | 161 | $configVars = Context::getRequestVars(); |
| 147 | 162 | |
| 148 | 163 | $config = new stdClass; |
| 149 | - if($configVars->font_defined != 'Y') $config->font_defined = $configVars->font_defined = 'N'; |
|
| 150 | - else $config->font_defined = 'Y'; |
|
| 164 | + if($configVars->font_defined != 'Y') { |
|
| 165 | + $config->font_defined = $configVars->font_defined = 'N'; |
|
| 166 | + } else { |
|
| 167 | + $config->font_defined = 'Y'; |
|
| 168 | + } |
|
| 151 | 169 | |
| 152 | - if($config->font_defined == 'Y') |
|
| 153 | - $config->content_font = $configVars->content_font_defined; |
|
| 154 | - else |
|
| 155 | - $config->content_font = $configVars->content_font; |
|
| 170 | + if($config->font_defined == 'Y') { |
|
| 171 | + $config->content_font = $configVars->content_font_defined; |
|
| 172 | + } else { |
|
| 173 | + $config->content_font = $configVars->content_font; |
|
| 174 | + } |
|
| 156 | 175 | |
| 157 | 176 | $config->editor_skin = $configVars->editor_skin; |
| 158 | 177 | $config->editor_height = $configVars->editor_height; |
@@ -173,21 +192,32 @@ discard block |
||
| 173 | 192 | */ |
| 174 | 193 | function insertComponent($component_name, $enabled = false, $site_srl = 0) |
| 175 | 194 | { |
| 176 | - if($enabled) $enabled = 'Y'; |
|
| 177 | - else $enabled = 'N'; |
|
| 195 | + if($enabled) { |
|
| 196 | + $enabled = 'Y'; |
|
| 197 | + } else { |
|
| 198 | + $enabled = 'N'; |
|
| 199 | + } |
|
| 178 | 200 | |
| 179 | 201 | $args = new stdClass; |
| 180 | 202 | $args->component_name = $component_name; |
| 181 | 203 | $args->enabled = $enabled; |
| 182 | 204 | $args->site_srl = $site_srl; |
| 183 | 205 | // Check if the component exists |
| 184 | - if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args); |
|
| 185 | - else $output = executeQuery('editor.isSiteComponentInserted', $args); |
|
| 186 | - if($output->data->count) return new BaseObject(-1, 'msg_component_is_not_founded'); |
|
| 206 | + if(!$site_srl) { |
|
| 207 | + $output = executeQuery('editor.isComponentInserted', $args); |
|
| 208 | + } else { |
|
| 209 | + $output = executeQuery('editor.isSiteComponentInserted', $args); |
|
| 210 | + } |
|
| 211 | + if($output->data->count) { |
|
| 212 | + return new BaseObject(-1, 'msg_component_is_not_founded'); |
|
| 213 | + } |
|
| 187 | 214 | // Inert a component |
| 188 | 215 | $args->list_order = getNextSequence(); |
| 189 | - if(!$site_srl) $output = executeQuery('editor.insertComponent', $args); |
|
| 190 | - else $output = executeQuery('editor.insertSiteComponent', $args); |
|
| 216 | + if(!$site_srl) { |
|
| 217 | + $output = executeQuery('editor.insertComponent', $args); |
|
| 218 | + } else { |
|
| 219 | + $output = executeQuery('editor.insertSiteComponent', $args); |
|
| 220 | + } |
|
| 191 | 221 | |
| 192 | 222 | $oEditorController = getController('editor'); |
| 193 | 223 | $oEditorController->removeCache($site_srl); |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | function procPollInsert() |
| 21 | 21 | { |
| 22 | 22 | $stop_date = Context::get('stop_date'); |
| 23 | - if($stop_date < date('Ymd')) |
|
| 23 | + if ($stop_date < date('Ymd')) |
|
| 24 | 24 | { |
| 25 | - $stop_date = date('YmdHis', $_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 25 | + $stop_date = date('YmdHis', $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $logged_info = Context::get('logged_info'); |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | unset($vars->error_return_url); |
| 35 | 35 | unset($vars->stop_date); |
| 36 | 36 | |
| 37 | - foreach($vars as $key => $val) |
|
| 37 | + foreach ($vars as $key => $val) |
|
| 38 | 38 | { |
| 39 | - if(stripos($key, 'tidx')) |
|
| 39 | + if (stripos($key, 'tidx')) |
|
| 40 | 40 | { |
| 41 | 41 | continue; |
| 42 | 42 | } |
@@ -44,32 +44,32 @@ discard block |
||
| 44 | 44 | $tmp_arr = explode('_', $key); |
| 45 | 45 | |
| 46 | 46 | $poll_index = $tmp_arr[1]; |
| 47 | - if(!$poll_index) |
|
| 47 | + if (!$poll_index) |
|
| 48 | 48 | { |
| 49 | 49 | continue; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if(!trim($val)) |
|
| 52 | + if (!trim($val)) |
|
| 53 | 53 | { |
| 54 | 54 | continue; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if($tmp_args[$poll_index] == NULL) |
|
| 57 | + if ($tmp_args[$poll_index] == NULL) |
|
| 58 | 58 | { |
| 59 | 59 | $tmp_args[$poll_index] = new stdClass; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if(!is_array($tmp_args[$poll_index]->item)) |
|
| 62 | + if (!is_array($tmp_args[$poll_index]->item)) |
|
| 63 | 63 | { |
| 64 | 64 | $tmp_args[$poll_index]->item = array(); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if($logged_info->is_admin != 'Y') |
|
| 67 | + if ($logged_info->is_admin != 'Y') |
|
| 68 | 68 | { |
| 69 | 69 | $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - switch($tmp_arr[0]) |
|
| 72 | + switch ($tmp_arr[0]) |
|
| 73 | 73 | { |
| 74 | 74 | case 'title': |
| 75 | 75 | $tmp_args[$poll_index]->title = $val; |
@@ -83,26 +83,26 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - foreach($tmp_args as $key => $val) |
|
| 86 | + foreach ($tmp_args as $key => $val) |
|
| 87 | 87 | { |
| 88 | - if(!$val->checkcount) |
|
| 88 | + if (!$val->checkcount) |
|
| 89 | 89 | { |
| 90 | 90 | $val->checkcount = 1; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if($val->title && count($val->item)) |
|
| 93 | + if ($val->title && count($val->item)) |
|
| 94 | 94 | { |
| 95 | 95 | $args->poll[] = $val; |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if(!count($args->poll)) return new BaseObject(-1, 'cmd_null_item'); |
|
| 99 | + if (!count($args->poll)) return new BaseObject(-1, 'cmd_null_item'); |
|
| 100 | 100 | |
| 101 | 101 | $args->stop_date = $stop_date; |
| 102 | 102 | |
| 103 | 103 | // Configure the variables |
| 104 | 104 | $poll_srl = getNextSequence(); |
| 105 | - $member_srl = $logged_info->member_srl?$logged_info->member_srl:0; |
|
| 105 | + $member_srl = $logged_info->member_srl ? $logged_info->member_srl : 0; |
|
| 106 | 106 | |
| 107 | 107 | $oDB = &DB::getInstance(); |
| 108 | 108 | $oDB->begin(); |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | $poll_args = new stdClass; |
| 112 | 112 | $poll_args->poll_srl = $poll_srl; |
| 113 | 113 | $poll_args->member_srl = $member_srl; |
| 114 | - $poll_args->list_order = $poll_srl*-1; |
|
| 114 | + $poll_args->list_order = $poll_srl * -1; |
|
| 115 | 115 | $poll_args->stop_date = $args->stop_date; |
| 116 | 116 | $poll_args->poll_count = 0; |
| 117 | 117 | $output = executeQuery('poll.insertPoll', $poll_args); |
| 118 | - if(!$output->toBool()) |
|
| 118 | + if (!$output->toBool()) |
|
| 119 | 119 | { |
| 120 | 120 | $oDB->rollback(); |
| 121 | 121 | return $output; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Individual poll registration |
| 125 | - foreach($args->poll as $key => $val) |
|
| 125 | + foreach ($args->poll as $key => $val) |
|
| 126 | 126 | { |
| 127 | 127 | $title_args = new stdClass; |
| 128 | 128 | $title_args->poll_srl = $poll_srl; |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | $title_args->member_srl = $member_srl; |
| 135 | 135 | $title_args->upload_target_srl = $upload_target_srl; |
| 136 | 136 | $output = executeQuery('poll.insertPollTitle', $title_args); |
| 137 | - if(!$output->toBool()) |
|
| 137 | + if (!$output->toBool()) |
|
| 138 | 138 | { |
| 139 | 139 | $oDB->rollback(); |
| 140 | 140 | return $output; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Add the individual survey items |
| 144 | - foreach($val->item as $k => $v) |
|
| 144 | + foreach ($val->item as $k => $v) |
|
| 145 | 145 | { |
| 146 | 146 | $item_args = new stdClass; |
| 147 | 147 | $item_args->poll_srl = $poll_srl; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $item_args->poll_count = 0; |
| 151 | 151 | $item_args->upload_target_srl = $upload_target_srl; |
| 152 | 152 | $output = executeQuery('poll.insertPollItem', $item_args); |
| 153 | - if(!$output->toBool()) |
|
| 153 | + if (!$output->toBool()) |
|
| 154 | 154 | { |
| 155 | 155 | $oDB->rollback(); |
| 156 | 156 | return $output; |
@@ -171,19 +171,19 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $poll_srl = Context::get('poll_srl'); |
| 173 | 173 | $poll_srl_indexes = Context::get('poll_srl_indexes'); |
| 174 | - $tmp_item_srls = explode(',',$poll_srl_indexes); |
|
| 175 | - for($i=0;$i<count($tmp_item_srls);$i++) |
|
| 174 | + $tmp_item_srls = explode(',', $poll_srl_indexes); |
|
| 175 | + for ($i = 0; $i < count($tmp_item_srls); $i++) |
|
| 176 | 176 | { |
| 177 | - $srl = (int)trim($tmp_item_srls[$i]); |
|
| 178 | - if(!$srl) continue; |
|
| 177 | + $srl = (int) trim($tmp_item_srls[$i]); |
|
| 178 | + if (!$srl) continue; |
|
| 179 | 179 | $item_srls[] = $srl; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // If there is no response item, display an error |
| 183 | - if(!count($item_srls)) return new BaseObject(-1, 'msg_check_poll_item'); |
|
| 183 | + if (!count($item_srls)) return new BaseObject(-1, 'msg_check_poll_item'); |
|
| 184 | 184 | // Make sure is the poll has already been taken |
| 185 | 185 | $oPollModel = getModel('poll'); |
| 186 | - if($oPollModel->isPolled($poll_srl)) return new BaseObject(-1, 'msg_already_poll'); |
|
| 186 | + if ($oPollModel->isPolled($poll_srl)) return new BaseObject(-1, 'msg_already_poll'); |
|
| 187 | 187 | |
| 188 | 188 | $oDB = &DB::getInstance(); |
| 189 | 189 | $oDB->begin(); |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | // Update all poll responses related to the post |
| 194 | 194 | $output = executeQuery('poll.updatePoll', $args); |
| 195 | 195 | $output = executeQuery('poll.updatePollTitle', $args); |
| 196 | - if(!$output->toBool()) |
|
| 196 | + if (!$output->toBool()) |
|
| 197 | 197 | { |
| 198 | 198 | $oDB->rollback(); |
| 199 | 199 | return $output; |
| 200 | 200 | } |
| 201 | 201 | // Record each polls selected items |
| 202 | - $args->poll_item_srl = implode(',',$item_srls); |
|
| 202 | + $args->poll_item_srl = implode(',', $item_srls); |
|
| 203 | 203 | $output = executeQuery('poll.updatePollItems', $args); |
| 204 | - if(!$output->toBool()) |
|
| 204 | + if (!$output->toBool()) |
|
| 205 | 205 | { |
| 206 | 206 | $oDB->rollback(); |
| 207 | 207 | return $output; |
@@ -211,12 +211,12 @@ discard block |
||
| 211 | 211 | $log_args->poll_srl = $poll_srl; |
| 212 | 212 | |
| 213 | 213 | $logged_info = Context::get('logged_info'); |
| 214 | - $member_srl = $logged_info->member_srl?$logged_info->member_srl:0; |
|
| 214 | + $member_srl = $logged_info->member_srl ? $logged_info->member_srl : 0; |
|
| 215 | 215 | |
| 216 | 216 | $log_args->member_srl = $member_srl; |
| 217 | 217 | $log_args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 218 | 218 | $output = executeQuery('poll.insertPollLog', $log_args); |
| 219 | - if(!$output->toBool()) |
|
| 219 | + if (!$output->toBool()) |
|
| 220 | 220 | { |
| 221 | 221 | $oDB->rollback(); |
| 222 | 222 | return $output; |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | $oDB->commit(); |
| 226 | 226 | |
| 227 | 227 | $skin = Context::get('skin'); |
| 228 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
| 228 | + if (!$skin || !is_dir(_XE_PATH_.'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
| 229 | 229 | // Get tpl |
| 230 | 230 | $tpl = $oPollModel->getPollHtml($poll_srl, '', $skin); |
| 231 | 231 | |
| 232 | 232 | $this->add('poll_srl', $poll_srl); |
| 233 | - $this->add('tpl',$tpl); |
|
| 233 | + $this->add('tpl', $tpl); |
|
| 234 | 234 | $this->setMessage('success_poll'); |
| 235 | 235 | |
| 236 | 236 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminConfig'); |
@@ -245,13 +245,13 @@ discard block |
||
| 245 | 245 | $poll_srl = Context::get('poll_srl'); |
| 246 | 246 | |
| 247 | 247 | $skin = Context::get('skin'); |
| 248 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
| 248 | + if (!$skin || !is_dir(_XE_PATH_.'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
| 249 | 249 | |
| 250 | 250 | $oPollModel = getModel('poll'); |
| 251 | 251 | $tpl = $oPollModel->getPollResultHtml($poll_srl, $skin); |
| 252 | 252 | |
| 253 | 253 | $this->add('poll_srl', $poll_srl); |
| 254 | - $this->add('tpl',$tpl); |
|
| 254 | + $this->add('tpl', $tpl); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function procPollGetList() |
| 261 | 261 | { |
| 262 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 262 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 263 | 263 | $pollSrls = Context::get('poll_srls'); |
| 264 | - if($pollSrls) $pollSrlList = explode(',', $pollSrls); |
|
| 264 | + if ($pollSrls) $pollSrlList = explode(',', $pollSrls); |
|
| 265 | 265 | |
| 266 | 266 | global $lang; |
| 267 | - if(count($pollSrlList) > 0) |
|
| 267 | + if (count($pollSrlList) > 0) |
|
| 268 | 268 | { |
| 269 | 269 | $oPollAdminModel = getAdminModel('poll'); |
| 270 | 270 | $args = new stdClass; |
@@ -272,11 +272,11 @@ discard block |
||
| 272 | 272 | $output = $oPollAdminModel->getPollListWithMember($args); |
| 273 | 273 | $pollList = $output->data; |
| 274 | 274 | |
| 275 | - if(is_array($pollList)) |
|
| 275 | + if (is_array($pollList)) |
|
| 276 | 276 | { |
| 277 | - foreach($pollList AS $key=>$value) |
|
| 277 | + foreach ($pollList AS $key=>$value) |
|
| 278 | 278 | { |
| 279 | - if($value->checkcount == 1) $value->checkName = $lang->single_check; |
|
| 279 | + if ($value->checkcount == 1) $value->checkName = $lang->single_check; |
|
| 280 | 280 | else $value->checkName = $lang->multi_check; |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -332,29 +332,29 @@ discard block |
||
| 332 | 332 | function triggerDeleteDocumentPoll(&$obj) |
| 333 | 333 | { |
| 334 | 334 | $document_srl = $obj->document_srl; |
| 335 | - if(!$document_srl) return new BaseObject(); |
|
| 335 | + if (!$document_srl) return new BaseObject(); |
|
| 336 | 336 | // Get the poll |
| 337 | 337 | $args = new stdClass(); |
| 338 | 338 | $args->upload_target_srl = $document_srl; |
| 339 | 339 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
| 340 | - if(!$output->data) return new BaseObject(); |
|
| 340 | + if (!$output->data) return new BaseObject(); |
|
| 341 | 341 | |
| 342 | 342 | $poll_srl = $output->data->poll_srl; |
| 343 | - if(!$poll_srl) return new BaseObject(); |
|
| 343 | + if (!$poll_srl) return new BaseObject(); |
|
| 344 | 344 | |
| 345 | 345 | $args->poll_srl = $poll_srl; |
| 346 | 346 | |
| 347 | 347 | $output = executeQuery('poll.deletePoll', $args); |
| 348 | - if(!$output->toBool()) return $output; |
|
| 348 | + if (!$output->toBool()) return $output; |
|
| 349 | 349 | |
| 350 | 350 | $output = executeQuery('poll.deletePollItem', $args); |
| 351 | - if(!$output->toBool()) return $output; |
|
| 351 | + if (!$output->toBool()) return $output; |
|
| 352 | 352 | |
| 353 | 353 | $output = executeQuery('poll.deletePollTitle', $args); |
| 354 | - if(!$output->toBool()) return $output; |
|
| 354 | + if (!$output->toBool()) return $output; |
|
| 355 | 355 | |
| 356 | 356 | $output = executeQuery('poll.deletePollLog', $args); |
| 357 | - if(!$output->toBool()) return $output; |
|
| 357 | + if (!$output->toBool()) return $output; |
|
| 358 | 358 | |
| 359 | 359 | return new BaseObject(); |
| 360 | 360 | } |
@@ -365,29 +365,29 @@ discard block |
||
| 365 | 365 | function triggerDeleteCommentPoll(&$obj) |
| 366 | 366 | { |
| 367 | 367 | $comment_srl = $obj->comment_srl; |
| 368 | - if(!$comment_srl) return new BaseObject(); |
|
| 368 | + if (!$comment_srl) return new BaseObject(); |
|
| 369 | 369 | // Get the poll |
| 370 | 370 | $args = new stdClass(); |
| 371 | 371 | $args->upload_target_srl = $comment_srl; |
| 372 | 372 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
| 373 | - if(!$output->data) return new BaseObject(); |
|
| 373 | + if (!$output->data) return new BaseObject(); |
|
| 374 | 374 | |
| 375 | 375 | $poll_srl = $output->data->poll_srl; |
| 376 | - if(!$poll_srl) return new BaseObject(); |
|
| 376 | + if (!$poll_srl) return new BaseObject(); |
|
| 377 | 377 | |
| 378 | 378 | $args->poll_srl = $poll_srl; |
| 379 | 379 | |
| 380 | 380 | $output = executeQuery('poll.deletePoll', $args); |
| 381 | - if(!$output->toBool()) return $output; |
|
| 381 | + if (!$output->toBool()) return $output; |
|
| 382 | 382 | |
| 383 | 383 | $output = executeQuery('poll.deletePollItem', $args); |
| 384 | - if(!$output->toBool()) return $output; |
|
| 384 | + if (!$output->toBool()) return $output; |
|
| 385 | 385 | |
| 386 | 386 | $output = executeQuery('poll.deletePollTitle', $args); |
| 387 | - if(!$output->toBool()) return $output; |
|
| 387 | + if (!$output->toBool()) return $output; |
|
| 388 | 388 | |
| 389 | 389 | $output = executeQuery('poll.deletePollLog', $args); |
| 390 | - if(!$output->toBool()) return $output; |
|
| 390 | + if (!$output->toBool()) return $output; |
|
| 391 | 391 | |
| 392 | 392 | return new BaseObject(); |
| 393 | 393 | } |
@@ -397,8 +397,8 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | function syncPoll($upload_target_srl, $content) |
| 399 | 399 | { |
| 400 | - $match_cnt = preg_match_all('!<img([^\>]*)poll_srl=(["\']?)([0-9]*)(["\']?)([^\>]*?)\>!is',$content, $matches); |
|
| 401 | - for($i=0;$i<$match_cnt;$i++) |
|
| 400 | + $match_cnt = preg_match_all('!<img([^\>]*)poll_srl=(["\']?)([0-9]*)(["\']?)([^\>]*?)\>!is', $content, $matches); |
|
| 401 | + for ($i = 0; $i < $match_cnt; $i++) |
|
| 402 | 402 | { |
| 403 | 403 | $poll_srl = $matches[3][$i]; |
| 404 | 404 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $output = executeQuery('poll.getPoll', $args); |
| 408 | 408 | $poll = $output->data; |
| 409 | 409 | |
| 410 | - if($poll->upload_target_srl) continue; |
|
| 410 | + if ($poll->upload_target_srl) continue; |
|
| 411 | 411 | |
| 412 | 412 | $args->upload_target_srl = $upload_target_srl; |
| 413 | 413 | $output = executeQuery('poll.updatePollTarget', $args); |
@@ -96,7 +96,9 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if(!count($args->poll)) return new BaseObject(-1, 'cmd_null_item'); |
|
| 99 | + if(!count($args->poll)) { |
|
| 100 | + return new BaseObject(-1, 'cmd_null_item'); |
|
| 101 | + } |
|
| 100 | 102 | |
| 101 | 103 | $args->stop_date = $stop_date; |
| 102 | 104 | |
@@ -175,15 +177,21 @@ discard block |
||
| 175 | 177 | for($i=0;$i<count($tmp_item_srls);$i++) |
| 176 | 178 | { |
| 177 | 179 | $srl = (int)trim($tmp_item_srls[$i]); |
| 178 | - if(!$srl) continue; |
|
| 180 | + if(!$srl) { |
|
| 181 | + continue; |
|
| 182 | + } |
|
| 179 | 183 | $item_srls[] = $srl; |
| 180 | 184 | } |
| 181 | 185 | |
| 182 | 186 | // If there is no response item, display an error |
| 183 | - if(!count($item_srls)) return new BaseObject(-1, 'msg_check_poll_item'); |
|
| 187 | + if(!count($item_srls)) { |
|
| 188 | + return new BaseObject(-1, 'msg_check_poll_item'); |
|
| 189 | + } |
|
| 184 | 190 | // Make sure is the poll has already been taken |
| 185 | 191 | $oPollModel = getModel('poll'); |
| 186 | - if($oPollModel->isPolled($poll_srl)) return new BaseObject(-1, 'msg_already_poll'); |
|
| 192 | + if($oPollModel->isPolled($poll_srl)) { |
|
| 193 | + return new BaseObject(-1, 'msg_already_poll'); |
|
| 194 | + } |
|
| 187 | 195 | |
| 188 | 196 | $oDB = &DB::getInstance(); |
| 189 | 197 | $oDB->begin(); |
@@ -225,7 +233,9 @@ discard block |
||
| 225 | 233 | $oDB->commit(); |
| 226 | 234 | |
| 227 | 235 | $skin = Context::get('skin'); |
| 228 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
| 236 | + if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) { |
|
| 237 | + $skin = 'default'; |
|
| 238 | + } |
|
| 229 | 239 | // Get tpl |
| 230 | 240 | $tpl = $oPollModel->getPollHtml($poll_srl, '', $skin); |
| 231 | 241 | |
@@ -245,7 +255,9 @@ discard block |
||
| 245 | 255 | $poll_srl = Context::get('poll_srl'); |
| 246 | 256 | |
| 247 | 257 | $skin = Context::get('skin'); |
| 248 | - if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) $skin = 'default'; |
|
| 258 | + if(!$skin || !is_dir(_XE_PATH_ . 'modules/poll/skins/'.$skin)) { |
|
| 259 | + $skin = 'default'; |
|
| 260 | + } |
|
| 249 | 261 | |
| 250 | 262 | $oPollModel = getModel('poll'); |
| 251 | 263 | $tpl = $oPollModel->getPollResultHtml($poll_srl, $skin); |
@@ -259,9 +271,13 @@ discard block |
||
| 259 | 271 | */ |
| 260 | 272 | function procPollGetList() |
| 261 | 273 | { |
| 262 | - if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted'); |
|
| 274 | + if(!Context::get('is_logged')) { |
|
| 275 | + return new BaseObject(-1,'msg_not_permitted'); |
|
| 276 | + } |
|
| 263 | 277 | $pollSrls = Context::get('poll_srls'); |
| 264 | - if($pollSrls) $pollSrlList = explode(',', $pollSrls); |
|
| 278 | + if($pollSrls) { |
|
| 279 | + $pollSrlList = explode(',', $pollSrls); |
|
| 280 | + } |
|
| 265 | 281 | |
| 266 | 282 | global $lang; |
| 267 | 283 | if(count($pollSrlList) > 0) |
@@ -276,12 +292,14 @@ discard block |
||
| 276 | 292 | { |
| 277 | 293 | foreach($pollList AS $key=>$value) |
| 278 | 294 | { |
| 279 | - if($value->checkcount == 1) $value->checkName = $lang->single_check; |
|
| 280 | - else $value->checkName = $lang->multi_check; |
|
| 295 | + if($value->checkcount == 1) { |
|
| 296 | + $value->checkName = $lang->single_check; |
|
| 297 | + } else { |
|
| 298 | + $value->checkName = $lang->multi_check; |
|
| 299 | + } |
|
| 281 | 300 | } |
| 282 | 301 | } |
| 283 | - } |
|
| 284 | - else |
|
| 302 | + } else |
|
| 285 | 303 | { |
| 286 | 304 | $pollList = array(); |
| 287 | 305 | $this->setMessage($lang->no_documents); |
@@ -332,29 +350,43 @@ discard block |
||
| 332 | 350 | function triggerDeleteDocumentPoll(&$obj) |
| 333 | 351 | { |
| 334 | 352 | $document_srl = $obj->document_srl; |
| 335 | - if(!$document_srl) return new BaseObject(); |
|
| 353 | + if(!$document_srl) { |
|
| 354 | + return new BaseObject(); |
|
| 355 | + } |
|
| 336 | 356 | // Get the poll |
| 337 | 357 | $args = new stdClass(); |
| 338 | 358 | $args->upload_target_srl = $document_srl; |
| 339 | 359 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
| 340 | - if(!$output->data) return new BaseObject(); |
|
| 360 | + if(!$output->data) { |
|
| 361 | + return new BaseObject(); |
|
| 362 | + } |
|
| 341 | 363 | |
| 342 | 364 | $poll_srl = $output->data->poll_srl; |
| 343 | - if(!$poll_srl) return new BaseObject(); |
|
| 365 | + if(!$poll_srl) { |
|
| 366 | + return new BaseObject(); |
|
| 367 | + } |
|
| 344 | 368 | |
| 345 | 369 | $args->poll_srl = $poll_srl; |
| 346 | 370 | |
| 347 | 371 | $output = executeQuery('poll.deletePoll', $args); |
| 348 | - if(!$output->toBool()) return $output; |
|
| 372 | + if(!$output->toBool()) { |
|
| 373 | + return $output; |
|
| 374 | + } |
|
| 349 | 375 | |
| 350 | 376 | $output = executeQuery('poll.deletePollItem', $args); |
| 351 | - if(!$output->toBool()) return $output; |
|
| 377 | + if(!$output->toBool()) { |
|
| 378 | + return $output; |
|
| 379 | + } |
|
| 352 | 380 | |
| 353 | 381 | $output = executeQuery('poll.deletePollTitle', $args); |
| 354 | - if(!$output->toBool()) return $output; |
|
| 382 | + if(!$output->toBool()) { |
|
| 383 | + return $output; |
|
| 384 | + } |
|
| 355 | 385 | |
| 356 | 386 | $output = executeQuery('poll.deletePollLog', $args); |
| 357 | - if(!$output->toBool()) return $output; |
|
| 387 | + if(!$output->toBool()) { |
|
| 388 | + return $output; |
|
| 389 | + } |
|
| 358 | 390 | |
| 359 | 391 | return new BaseObject(); |
| 360 | 392 | } |
@@ -365,29 +397,43 @@ discard block |
||
| 365 | 397 | function triggerDeleteCommentPoll(&$obj) |
| 366 | 398 | { |
| 367 | 399 | $comment_srl = $obj->comment_srl; |
| 368 | - if(!$comment_srl) return new BaseObject(); |
|
| 400 | + if(!$comment_srl) { |
|
| 401 | + return new BaseObject(); |
|
| 402 | + } |
|
| 369 | 403 | // Get the poll |
| 370 | 404 | $args = new stdClass(); |
| 371 | 405 | $args->upload_target_srl = $comment_srl; |
| 372 | 406 | $output = executeQuery('poll.getPollByTargetSrl', $args); |
| 373 | - if(!$output->data) return new BaseObject(); |
|
| 407 | + if(!$output->data) { |
|
| 408 | + return new BaseObject(); |
|
| 409 | + } |
|
| 374 | 410 | |
| 375 | 411 | $poll_srl = $output->data->poll_srl; |
| 376 | - if(!$poll_srl) return new BaseObject(); |
|
| 412 | + if(!$poll_srl) { |
|
| 413 | + return new BaseObject(); |
|
| 414 | + } |
|
| 377 | 415 | |
| 378 | 416 | $args->poll_srl = $poll_srl; |
| 379 | 417 | |
| 380 | 418 | $output = executeQuery('poll.deletePoll', $args); |
| 381 | - if(!$output->toBool()) return $output; |
|
| 419 | + if(!$output->toBool()) { |
|
| 420 | + return $output; |
|
| 421 | + } |
|
| 382 | 422 | |
| 383 | 423 | $output = executeQuery('poll.deletePollItem', $args); |
| 384 | - if(!$output->toBool()) return $output; |
|
| 424 | + if(!$output->toBool()) { |
|
| 425 | + return $output; |
|
| 426 | + } |
|
| 385 | 427 | |
| 386 | 428 | $output = executeQuery('poll.deletePollTitle', $args); |
| 387 | - if(!$output->toBool()) return $output; |
|
| 429 | + if(!$output->toBool()) { |
|
| 430 | + return $output; |
|
| 431 | + } |
|
| 388 | 432 | |
| 389 | 433 | $output = executeQuery('poll.deletePollLog', $args); |
| 390 | - if(!$output->toBool()) return $output; |
|
| 434 | + if(!$output->toBool()) { |
|
| 435 | + return $output; |
|
| 436 | + } |
|
| 391 | 437 | |
| 392 | 438 | return new BaseObject(); |
| 393 | 439 | } |
@@ -407,7 +453,9 @@ discard block |
||
| 407 | 453 | $output = executeQuery('poll.getPoll', $args); |
| 408 | 454 | $poll = $output->data; |
| 409 | 455 | |
| 410 | - if($poll->upload_target_srl) continue; |
|
| 456 | + if($poll->upload_target_srl) { |
|
| 457 | + continue; |
|
| 458 | + } |
|
| 411 | 459 | |
| 412 | 460 | $args->upload_target_srl = $upload_target_srl; |
| 413 | 461 | $output = executeQuery('poll.updatePollTarget', $args); |
@@ -26,20 +26,20 @@ |
||
| 26 | 26 | $current_module_srl = Context::get('module_srl'); |
| 27 | 27 | $current_module_srls = Context::get('module_srls'); |
| 28 | 28 | |
| 29 | - if(!$current_module_srl && !$current_module_srls) |
|
| 29 | + if (!$current_module_srl && !$current_module_srls) |
|
| 30 | 30 | { |
| 31 | 31 | $current_module_info = Context::get('current_module_info'); |
| 32 | 32 | $current_module_srl = $current_module_info->module_srl; |
| 33 | - if(!$current_module_srl) return new BaseObject(); |
|
| 33 | + if (!$current_module_srl) return new BaseObject(); |
|
| 34 | 34 | } |
| 35 | 35 | // Get the configuration information |
| 36 | 36 | $oModuleModel = getModel('module'); |
| 37 | 37 | $config = $oModuleModel->getModuleConfig('point'); |
| 38 | 38 | |
| 39 | - if($current_module_srl) |
|
| 39 | + if ($current_module_srl) |
|
| 40 | 40 | { |
| 41 | 41 | $module_config = $oModuleModel->getModulePartConfig('point', $current_module_srl); |
| 42 | - if(!$module_config) |
|
| 42 | + if (!$module_config) |
|
| 43 | 43 | { |
| 44 | 44 | $module_config['insert_document'] = $config->insert_document; |
| 45 | 45 | $module_config['insert_comment'] = $config->insert_comment; |
@@ -30,7 +30,9 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $current_module_info = Context::get('current_module_info'); |
| 32 | 32 | $current_module_srl = $current_module_info->module_srl; |
| 33 | - if(!$current_module_srl) return new BaseObject(); |
|
| 33 | + if(!$current_module_srl) { |
|
| 34 | + return new BaseObject(); |
|
| 35 | + } |
|
| 34 | 36 | } |
| 35 | 37 | // Get the configuration information |
| 36 | 38 | $oModuleModel = getModel('module'); |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | $args = Context::getRequestVars(); |
| 27 | 27 | |
| 28 | 28 | //if module IO config is off |
| 29 | - if($args->able_module == 'Y') |
|
| 29 | + if ($args->able_module == 'Y') |
|
| 30 | 30 | { |
| 31 | 31 | // Re-install triggers, if it was disabled. |
| 32 | - if($config->able_module == 'N') |
|
| 32 | + if ($config->able_module == 'N') |
|
| 33 | 33 | { |
| 34 | 34 | $this->moduleUpdate(); |
| 35 | 35 | } |
@@ -39,28 +39,28 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Check the point name |
| 41 | 41 | $config->point_name = $args->point_name; |
| 42 | - if(!$config->point_name) $config->point_name = 'point'; |
|
| 42 | + if (!$config->point_name) $config->point_name = 'point'; |
|
| 43 | 43 | // Specify the default points |
| 44 | - $config->signup_point = (int)$args->signup_point; |
|
| 45 | - $config->login_point = (int)$args->login_point; |
|
| 46 | - $config->insert_document = (int)$args->insert_document; |
|
| 47 | - $config->read_document = (int)$args->read_document; |
|
| 48 | - $config->insert_comment = (int)$args->insert_comment; |
|
| 49 | - $config->upload_file = (int)$args->upload_file; |
|
| 50 | - $config->download_file = (int)$args->download_file; |
|
| 51 | - $config->voted = (int)$args->voted; |
|
| 52 | - $config->blamed = (int)$args->blamed; |
|
| 44 | + $config->signup_point = (int) $args->signup_point; |
|
| 45 | + $config->login_point = (int) $args->login_point; |
|
| 46 | + $config->insert_document = (int) $args->insert_document; |
|
| 47 | + $config->read_document = (int) $args->read_document; |
|
| 48 | + $config->insert_comment = (int) $args->insert_comment; |
|
| 49 | + $config->upload_file = (int) $args->upload_file; |
|
| 50 | + $config->download_file = (int) $args->download_file; |
|
| 51 | + $config->voted = (int) $args->voted; |
|
| 52 | + $config->blamed = (int) $args->blamed; |
|
| 53 | 53 | // The highest level |
| 54 | 54 | $config->max_level = $args->max_level; |
| 55 | - if($config->max_level>1000) $config->max_level = 1000; |
|
| 56 | - if($config->max_level<1) $config->max_level = 1; |
|
| 55 | + if ($config->max_level > 1000) $config->max_level = 1000; |
|
| 56 | + if ($config->max_level < 1) $config->max_level = 1; |
|
| 57 | 57 | // Set the level icon |
| 58 | 58 | $config->level_icon = $args->level_icon; |
| 59 | 59 | // Check if downloads are not allowed |
| 60 | - if($args->disable_download == 'Y') $config->disable_download = 'Y'; |
|
| 60 | + if ($args->disable_download == 'Y') $config->disable_download = 'Y'; |
|
| 61 | 61 | else $config->disable_download = 'N'; |
| 62 | 62 | // Check if reading a document is not allowed |
| 63 | - if($args->disable_read_document == 'Y') $config->disable_read_document = 'Y'; |
|
| 63 | + if ($args->disable_read_document == 'Y') $config->disable_read_document = 'Y'; |
|
| 64 | 64 | else $config->disable_read_document = 'N'; |
| 65 | 65 | |
| 66 | 66 | $oMemberModel = getModel('member'); |
@@ -68,23 +68,23 @@ discard block |
||
| 68 | 68 | $config->point_group = array(); |
| 69 | 69 | |
| 70 | 70 | // Per-level group configurations |
| 71 | - foreach($group_list as $group) |
|
| 71 | + foreach ($group_list as $group) |
|
| 72 | 72 | { |
| 73 | 73 | // Admin group should not be connected to point. |
| 74 | - if($group->is_admin == 'Y' || $group->is_default == 'Y') continue; |
|
| 74 | + if ($group->is_admin == 'Y' || $group->is_default == 'Y') continue; |
|
| 75 | 75 | |
| 76 | 76 | $group_srl = $group->group_srl; |
| 77 | 77 | |
| 78 | - if(isset($args->{'point_group_'.$group_srl})) |
|
| 78 | + if (isset($args->{'point_group_'.$group_srl})) |
|
| 79 | 79 | { |
| 80 | 80 | //if group level is higher than max level, change to max level |
| 81 | - if($args->{'point_group_'.$group_srl} > $args->max_level) |
|
| 81 | + if ($args->{'point_group_'.$group_srl} > $args->max_level) |
|
| 82 | 82 | { |
| 83 | 83 | $args->{'point_group_'.$group_srl} = $args->max_level; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | //if group level is lower than 1, change to 1 |
| 87 | - if($args->{'point_group_'.$group_srl} < 1) |
|
| 87 | + if ($args->{'point_group_'.$group_srl} < 1) |
|
| 88 | 88 | { |
| 89 | 89 | $args->{'point_group_'.$group_srl} = 1; |
| 90 | 90 | } |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | $config->group_reset = $args->group_reset; |
| 96 | 96 | // Per-level point configurations |
| 97 | 97 | unset($config->level_step); |
| 98 | - for($i=1;$i<=$config->max_level;$i++) |
|
| 98 | + for ($i = 1; $i <= $config->max_level; $i++) |
|
| 99 | 99 | { |
| 100 | 100 | $key = "level_step_".$i; |
| 101 | - $config->level_step[$i] = (int)$args->{$key}; |
|
| 101 | + $config->level_step[$i] = (int) $args->{$key}; |
|
| 102 | 102 | } |
| 103 | 103 | // A function to calculate per-level points |
| 104 | 104 | $config->expression = $args->expression; |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | $args = Context::getRequestVars(); |
| 131 | 131 | |
| 132 | 132 | $configTypeList = array('insert_document', 'insert_comment', 'upload_file', 'download_file', 'read_document', 'voted', 'blamed'); |
| 133 | - foreach($configTypeList AS $config) |
|
| 133 | + foreach ($configTypeList AS $config) |
|
| 134 | 134 | { |
| 135 | - if(is_array($args->{$config})) |
|
| 135 | + if (is_array($args->{$config})) |
|
| 136 | 136 | { |
| 137 | - foreach($args->{$config} AS $key=>$value) |
|
| 137 | + foreach ($args->{$config} AS $key=>$value) |
|
| 138 | 138 | { |
| 139 | 139 | $module_config[$key][$config] = $value; |
| 140 | 140 | } |
@@ -142,16 +142,16 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $oModuleController = getController('module'); |
| 145 | - if(count($module_config)) |
|
| 145 | + if (count($module_config)) |
|
| 146 | 146 | { |
| 147 | - foreach($module_config as $module_srl => $config) |
|
| 147 | + foreach ($module_config as $module_srl => $config) |
|
| 148 | 148 | { |
| 149 | - $oModuleController->insertModulePartConfig('point',$module_srl,$config); |
|
| 149 | + $oModuleController->insertModulePartConfig('point', $module_srl, $config); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $this->setMessage('success_updated'); |
| 154 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 154 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 155 | 155 | { |
| 156 | 156 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPointAdminModuleConfig'); |
| 157 | 157 | header('location:'.$returnUrl); |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | function procPointAdminInsertPointModuleConfig() |
| 166 | 166 | { |
| 167 | 167 | $module_srl = Context::get('target_module_srl'); |
| 168 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 168 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 169 | 169 | // In case of batch configuration of several modules |
| 170 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
| 170 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl); |
|
| 171 | 171 | else $module_srl = array($module_srl); |
| 172 | 172 | // Save configurations |
| 173 | 173 | $oModuleController = getController('module'); |
| 174 | - for($i=0;$i<count($module_srl);$i++) |
|
| 174 | + for ($i = 0; $i < count($module_srl); $i++) |
|
| 175 | 175 | { |
| 176 | 176 | $srl = trim($module_srl[$i]); |
| 177 | - if(!$srl) continue; |
|
| 177 | + if (!$srl) continue; |
|
| 178 | 178 | unset($config); |
| 179 | - $config['insert_document'] = (int)Context::get('insert_document'); |
|
| 180 | - $config['insert_comment'] = (int)Context::get('insert_comment'); |
|
| 181 | - $config['upload_file'] = (int)Context::get('upload_file'); |
|
| 182 | - $config['download_file'] = (int)Context::get('download_file'); |
|
| 183 | - $config['read_document'] = (int)Context::get('read_document'); |
|
| 184 | - $config['voted'] = (int)Context::get('voted'); |
|
| 185 | - $config['blamed'] = (int)Context::get('blamed'); |
|
| 179 | + $config['insert_document'] = (int) Context::get('insert_document'); |
|
| 180 | + $config['insert_comment'] = (int) Context::get('insert_comment'); |
|
| 181 | + $config['upload_file'] = (int) Context::get('upload_file'); |
|
| 182 | + $config['download_file'] = (int) Context::get('download_file'); |
|
| 183 | + $config['read_document'] = (int) Context::get('read_document'); |
|
| 184 | + $config['voted'] = (int) Context::get('voted'); |
|
| 185 | + $config['blamed'] = (int) Context::get('blamed'); |
|
| 186 | 186 | $oModuleController->insertModulePartConfig('point', $srl, $config); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | preg_match('/^(\+|-)?([1-9][0-9]*)$/', $point, $m); |
| 205 | 205 | |
| 206 | 206 | $action = ''; |
| 207 | - switch($m[1]) |
|
| 207 | + switch ($m[1]) |
|
| 208 | 208 | { |
| 209 | 209 | case '+': |
| 210 | 210 | $action = 'add'; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $point = $m[2]; |
| 220 | 220 | |
| 221 | 221 | $oPointController = getController('point'); |
| 222 | - $output = $oPointController->setPoint($member_srl, (int)$point, $action); |
|
| 222 | + $output = $oPointController->setPoint($member_srl, (int) $point, $action); |
|
| 223 | 223 | |
| 224 | 224 | $this->setError(-1); |
| 225 | 225 | $this->setMessage('success_updated', 'info'); |
@@ -244,29 +244,29 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | // Get member infomation |
| 246 | 246 | $output = executeQueryArray('point.getMemberCount'); |
| 247 | - if(!$output->toBool()) return $output; |
|
| 247 | + if (!$output->toBool()) return $output; |
|
| 248 | 248 | |
| 249 | - if($output->data) |
|
| 249 | + if ($output->data) |
|
| 250 | 250 | { |
| 251 | - foreach($output->data as $key => $val) |
|
| 251 | + foreach ($output->data as $key => $val) |
|
| 252 | 252 | { |
| 253 | - if(!$val->member_srl) continue; |
|
| 253 | + if (!$val->member_srl) continue; |
|
| 254 | 254 | $member[$val->member_srl] = 0; |
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // Get post information |
| 259 | 259 | $output = executeQueryArray('point.getDocumentPoint'); |
| 260 | - if(!$output->toBool()) return $output; |
|
| 260 | + if (!$output->toBool()) return $output; |
|
| 261 | 261 | |
| 262 | - if($output->data) |
|
| 262 | + if ($output->data) |
|
| 263 | 263 | { |
| 264 | - foreach($output->data as $key => $val) |
|
| 264 | + foreach ($output->data as $key => $val) |
|
| 265 | 265 | { |
| 266 | - if($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
| 266 | + if ($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
| 267 | 267 | else $insert_point = $config->insert_document; |
| 268 | 268 | |
| 269 | - if(!$val->member_srl) continue; |
|
| 269 | + if (!$val->member_srl) continue; |
|
| 270 | 270 | $point = $insert_point * $val->count; |
| 271 | 271 | $member[$val->member_srl] += $point; |
| 272 | 272 | } |
@@ -275,16 +275,16 @@ discard block |
||
| 275 | 275 | $output = null; |
| 276 | 276 | // Get comments information |
| 277 | 277 | $output = executeQueryArray('point.getCommentPoint'); |
| 278 | - if(!$output->toBool()) return $output; |
|
| 278 | + if (!$output->toBool()) return $output; |
|
| 279 | 279 | |
| 280 | - if($output->data) |
|
| 280 | + if ($output->data) |
|
| 281 | 281 | { |
| 282 | - foreach($output->data as $key => $val) |
|
| 282 | + foreach ($output->data as $key => $val) |
|
| 283 | 283 | { |
| 284 | - if($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
| 284 | + if ($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
| 285 | 285 | else $insert_point = $config->insert_comment; |
| 286 | 286 | |
| 287 | - if(!$val->member_srl) continue; |
|
| 287 | + if (!$val->member_srl) continue; |
|
| 288 | 288 | $point = $insert_point * $val->count; |
| 289 | 289 | $member[$val->member_srl] += $point; |
| 290 | 290 | } |
@@ -292,16 +292,16 @@ discard block |
||
| 292 | 292 | $output = null; |
| 293 | 293 | // Get the attached files' information |
| 294 | 294 | $output = executeQueryArray('point.getFilePoint'); |
| 295 | - if(!$output->toBool()) return $output; |
|
| 295 | + if (!$output->toBool()) return $output; |
|
| 296 | 296 | |
| 297 | - if($output->data) |
|
| 297 | + if ($output->data) |
|
| 298 | 298 | { |
| 299 | - foreach($output->data as $key => $val) |
|
| 299 | + foreach ($output->data as $key => $val) |
|
| 300 | 300 | { |
| 301 | - if($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
| 301 | + if ($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
| 302 | 302 | else $insert_point = $config->upload_file; |
| 303 | 303 | |
| 304 | - if(!$val->member_srl) continue; |
|
| 304 | + if (!$val->member_srl) continue; |
|
| 305 | 305 | $point = $insert_point * $val->count; |
| 306 | 306 | $member[$val->member_srl] += $point; |
| 307 | 307 | } |
@@ -309,13 +309,13 @@ discard block |
||
| 309 | 309 | $output = null; |
| 310 | 310 | // Set all members' points to 0 |
| 311 | 311 | $output = executeQuery("point.initMemberPoint"); |
| 312 | - if(!$output->toBool()) return $output; |
|
| 312 | + if (!$output->toBool()) return $output; |
|
| 313 | 313 | // Save the file temporarily |
| 314 | 314 | |
| 315 | 315 | $str = ''; |
| 316 | - foreach($member as $key => $val) |
|
| 316 | + foreach ($member as $key => $val) |
|
| 317 | 317 | { |
| 318 | - $val += (int)$config->signup_point; |
|
| 318 | + $val += (int) $config->signup_point; |
|
| 319 | 319 | $str .= $key.','.$val."\r\n"; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | $this->add('total', count($member)); |
| 325 | 325 | $this->add('position', 0); |
| 326 | - $this->setMessage( sprintf(Context::getLang('point_recal_message'), 0, $this->get('total')) ); |
|
| 326 | + $this->setMessage(sprintf(Context::getLang('point_recal_message'), 0, $this->get('total'))); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -331,35 +331,35 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | function procPointAdminApplyPoint() |
| 333 | 333 | { |
| 334 | - $position = (int)Context::get('position'); |
|
| 335 | - $total = (int)Context::get('total'); |
|
| 334 | + $position = (int) Context::get('position'); |
|
| 335 | + $total = (int) Context::get('total'); |
|
| 336 | 336 | |
| 337 | - if(!file_exists('./files/cache/pointRecal.txt')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 337 | + if (!file_exists('./files/cache/pointRecal.txt')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 338 | 338 | |
| 339 | 339 | $idx = 0; |
| 340 | - $f = fopen("./files/cache/pointRecal.txt","r"); |
|
| 341 | - while(!feof($f)) |
|
| 340 | + $f = fopen("./files/cache/pointRecal.txt", "r"); |
|
| 341 | + while (!feof($f)) |
|
| 342 | 342 | { |
| 343 | 343 | $str = trim(fgets($f, 1024)); |
| 344 | - $idx ++; |
|
| 345 | - if($idx > $position) |
|
| 344 | + $idx++; |
|
| 345 | + if ($idx > $position) |
|
| 346 | 346 | { |
| 347 | - list($member_srl, $point) = explode(',',$str); |
|
| 347 | + list($member_srl, $point) = explode(',', $str); |
|
| 348 | 348 | |
| 349 | 349 | $args = new stdClass(); |
| 350 | 350 | $args->member_srl = $member_srl; |
| 351 | 351 | $args->point = $point; |
| 352 | - $output = executeQuery('point.insertPoint',$args); |
|
| 353 | - if($idx%5000==0) break; |
|
| 352 | + $output = executeQuery('point.insertPoint', $args); |
|
| 353 | + if ($idx % 5000 == 0) break; |
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if(feof($f)) |
|
| 357 | + if (feof($f)) |
|
| 358 | 358 | { |
| 359 | 359 | FileHandler::removeFile('./files/cache/pointRecal.txt'); |
| 360 | 360 | $idx = $total; |
| 361 | 361 | |
| 362 | - FileHandler::rename('./files/member_extra_info/point','./files/member_extra_info/point.old'); |
|
| 362 | + FileHandler::rename('./files/member_extra_info/point', './files/member_extra_info/point.old'); |
|
| 363 | 363 | |
| 364 | 364 | FileHandler::removeDir('./files/member_extra_info/point.old'); |
| 365 | 365 | } |
@@ -377,16 +377,16 @@ discard block |
||
| 377 | 377 | function procPointAdminReset() |
| 378 | 378 | { |
| 379 | 379 | $module_srl = Context::get('module_srls'); |
| 380 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 380 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 381 | 381 | // In case of batch configuration of several modules |
| 382 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
| 382 | + if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl); |
|
| 383 | 383 | else $module_srl = array($module_srl); |
| 384 | 384 | // Save configurations |
| 385 | 385 | $oModuleController = getController('module'); |
| 386 | - for($i=0;$i<count($module_srl);$i++) |
|
| 386 | + for ($i = 0; $i < count($module_srl); $i++) |
|
| 387 | 387 | { |
| 388 | 388 | $srl = trim($module_srl[$i]); |
| 389 | - if(!$srl) continue; |
|
| 389 | + if (!$srl) continue; |
|
| 390 | 390 | $args = new stdClass(); |
| 391 | 391 | $args->module = 'point'; |
| 392 | 392 | $args->module_srl = $srl; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 397 | - if($oCacheHandler->isSupport()) |
|
| 397 | + if ($oCacheHandler->isSupport()) |
|
| 398 | 398 | { |
| 399 | 399 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 400 | 400 | } |
@@ -39,7 +39,9 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Check the point name |
| 41 | 41 | $config->point_name = $args->point_name; |
| 42 | - if(!$config->point_name) $config->point_name = 'point'; |
|
| 42 | + if(!$config->point_name) { |
|
| 43 | + $config->point_name = 'point'; |
|
| 44 | + } |
|
| 43 | 45 | // Specify the default points |
| 44 | 46 | $config->signup_point = (int)$args->signup_point; |
| 45 | 47 | $config->login_point = (int)$args->login_point; |
@@ -52,16 +54,26 @@ discard block |
||
| 52 | 54 | $config->blamed = (int)$args->blamed; |
| 53 | 55 | // The highest level |
| 54 | 56 | $config->max_level = $args->max_level; |
| 55 | - if($config->max_level>1000) $config->max_level = 1000; |
|
| 56 | - if($config->max_level<1) $config->max_level = 1; |
|
| 57 | + if($config->max_level>1000) { |
|
| 58 | + $config->max_level = 1000; |
|
| 59 | + } |
|
| 60 | + if($config->max_level<1) { |
|
| 61 | + $config->max_level = 1; |
|
| 62 | + } |
|
| 57 | 63 | // Set the level icon |
| 58 | 64 | $config->level_icon = $args->level_icon; |
| 59 | 65 | // Check if downloads are not allowed |
| 60 | - if($args->disable_download == 'Y') $config->disable_download = 'Y'; |
|
| 61 | - else $config->disable_download = 'N'; |
|
| 66 | + if($args->disable_download == 'Y') { |
|
| 67 | + $config->disable_download = 'Y'; |
|
| 68 | + } else { |
|
| 69 | + $config->disable_download = 'N'; |
|
| 70 | + } |
|
| 62 | 71 | // Check if reading a document is not allowed |
| 63 | - if($args->disable_read_document == 'Y') $config->disable_read_document = 'Y'; |
|
| 64 | - else $config->disable_read_document = 'N'; |
|
| 72 | + if($args->disable_read_document == 'Y') { |
|
| 73 | + $config->disable_read_document = 'Y'; |
|
| 74 | + } else { |
|
| 75 | + $config->disable_read_document = 'N'; |
|
| 76 | + } |
|
| 65 | 77 | |
| 66 | 78 | $oMemberModel = getModel('member'); |
| 67 | 79 | $group_list = $oMemberModel->getGroups(); |
@@ -71,7 +83,9 @@ discard block |
||
| 71 | 83 | foreach($group_list as $group) |
| 72 | 84 | { |
| 73 | 85 | // Admin group should not be connected to point. |
| 74 | - if($group->is_admin == 'Y' || $group->is_default == 'Y') continue; |
|
| 86 | + if($group->is_admin == 'Y' || $group->is_default == 'Y') { |
|
| 87 | + continue; |
|
| 88 | + } |
|
| 75 | 89 | |
| 76 | 90 | $group_srl = $group->group_srl; |
| 77 | 91 | |
@@ -102,8 +116,7 @@ discard block |
||
| 102 | 116 | } |
| 103 | 117 | // A function to calculate per-level points |
| 104 | 118 | $config->expression = $args->expression; |
| 105 | - } |
|
| 106 | - else |
|
| 119 | + } else |
|
| 107 | 120 | { |
| 108 | 121 | //module IO config is OFF, Other settings will not be modified. |
| 109 | 122 | $config->able_module = 'N'; |
@@ -165,16 +178,23 @@ discard block |
||
| 165 | 178 | function procPointAdminInsertPointModuleConfig() |
| 166 | 179 | { |
| 167 | 180 | $module_srl = Context::get('target_module_srl'); |
| 168 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 181 | + if(!$module_srl) { |
|
| 182 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 183 | + } |
|
| 169 | 184 | // In case of batch configuration of several modules |
| 170 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
| 171 | - else $module_srl = array($module_srl); |
|
| 185 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
| 186 | + $module_srl = explode(',',$module_srl); |
|
| 187 | + } else { |
|
| 188 | + $module_srl = array($module_srl); |
|
| 189 | + } |
|
| 172 | 190 | // Save configurations |
| 173 | 191 | $oModuleController = getController('module'); |
| 174 | 192 | for($i=0;$i<count($module_srl);$i++) |
| 175 | 193 | { |
| 176 | 194 | $srl = trim($module_srl[$i]); |
| 177 | - if(!$srl) continue; |
|
| 195 | + if(!$srl) { |
|
| 196 | + continue; |
|
| 197 | + } |
|
| 178 | 198 | unset($config); |
| 179 | 199 | $config['insert_document'] = (int)Context::get('insert_document'); |
| 180 | 200 | $config['insert_comment'] = (int)Context::get('insert_comment'); |
@@ -244,29 +264,40 @@ discard block |
||
| 244 | 264 | |
| 245 | 265 | // Get member infomation |
| 246 | 266 | $output = executeQueryArray('point.getMemberCount'); |
| 247 | - if(!$output->toBool()) return $output; |
|
| 267 | + if(!$output->toBool()) { |
|
| 268 | + return $output; |
|
| 269 | + } |
|
| 248 | 270 | |
| 249 | 271 | if($output->data) |
| 250 | 272 | { |
| 251 | 273 | foreach($output->data as $key => $val) |
| 252 | 274 | { |
| 253 | - if(!$val->member_srl) continue; |
|
| 275 | + if(!$val->member_srl) { |
|
| 276 | + continue; |
|
| 277 | + } |
|
| 254 | 278 | $member[$val->member_srl] = 0; |
| 255 | 279 | } |
| 256 | 280 | } |
| 257 | 281 | |
| 258 | 282 | // Get post information |
| 259 | 283 | $output = executeQueryArray('point.getDocumentPoint'); |
| 260 | - if(!$output->toBool()) return $output; |
|
| 284 | + if(!$output->toBool()) { |
|
| 285 | + return $output; |
|
| 286 | + } |
|
| 261 | 287 | |
| 262 | 288 | if($output->data) |
| 263 | 289 | { |
| 264 | 290 | foreach($output->data as $key => $val) |
| 265 | 291 | { |
| 266 | - if($module_config[$val->module_srl]['insert_document']) $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
| 267 | - else $insert_point = $config->insert_document; |
|
| 292 | + if($module_config[$val->module_srl]['insert_document']) { |
|
| 293 | + $insert_point = $module_config[$val->module_srl]['insert_document']; |
|
| 294 | + } else { |
|
| 295 | + $insert_point = $config->insert_document; |
|
| 296 | + } |
|
| 268 | 297 | |
| 269 | - if(!$val->member_srl) continue; |
|
| 298 | + if(!$val->member_srl) { |
|
| 299 | + continue; |
|
| 300 | + } |
|
| 270 | 301 | $point = $insert_point * $val->count; |
| 271 | 302 | $member[$val->member_srl] += $point; |
| 272 | 303 | } |
@@ -275,16 +306,23 @@ discard block |
||
| 275 | 306 | $output = null; |
| 276 | 307 | // Get comments information |
| 277 | 308 | $output = executeQueryArray('point.getCommentPoint'); |
| 278 | - if(!$output->toBool()) return $output; |
|
| 309 | + if(!$output->toBool()) { |
|
| 310 | + return $output; |
|
| 311 | + } |
|
| 279 | 312 | |
| 280 | 313 | if($output->data) |
| 281 | 314 | { |
| 282 | 315 | foreach($output->data as $key => $val) |
| 283 | 316 | { |
| 284 | - if($module_config[$val->module_srl]['insert_comment']) $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
| 285 | - else $insert_point = $config->insert_comment; |
|
| 317 | + if($module_config[$val->module_srl]['insert_comment']) { |
|
| 318 | + $insert_point = $module_config[$val->module_srl]['insert_comment']; |
|
| 319 | + } else { |
|
| 320 | + $insert_point = $config->insert_comment; |
|
| 321 | + } |
|
| 286 | 322 | |
| 287 | - if(!$val->member_srl) continue; |
|
| 323 | + if(!$val->member_srl) { |
|
| 324 | + continue; |
|
| 325 | + } |
|
| 288 | 326 | $point = $insert_point * $val->count; |
| 289 | 327 | $member[$val->member_srl] += $point; |
| 290 | 328 | } |
@@ -292,16 +330,23 @@ discard block |
||
| 292 | 330 | $output = null; |
| 293 | 331 | // Get the attached files' information |
| 294 | 332 | $output = executeQueryArray('point.getFilePoint'); |
| 295 | - if(!$output->toBool()) return $output; |
|
| 333 | + if(!$output->toBool()) { |
|
| 334 | + return $output; |
|
| 335 | + } |
|
| 296 | 336 | |
| 297 | 337 | if($output->data) |
| 298 | 338 | { |
| 299 | 339 | foreach($output->data as $key => $val) |
| 300 | 340 | { |
| 301 | - if($module_config[$val->module_srl]['upload_file']) $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
| 302 | - else $insert_point = $config->upload_file; |
|
| 341 | + if($module_config[$val->module_srl]['upload_file']) { |
|
| 342 | + $insert_point = $module_config[$val->module_srl]['upload_file']; |
|
| 343 | + } else { |
|
| 344 | + $insert_point = $config->upload_file; |
|
| 345 | + } |
|
| 303 | 346 | |
| 304 | - if(!$val->member_srl) continue; |
|
| 347 | + if(!$val->member_srl) { |
|
| 348 | + continue; |
|
| 349 | + } |
|
| 305 | 350 | $point = $insert_point * $val->count; |
| 306 | 351 | $member[$val->member_srl] += $point; |
| 307 | 352 | } |
@@ -309,7 +354,9 @@ discard block |
||
| 309 | 354 | $output = null; |
| 310 | 355 | // Set all members' points to 0 |
| 311 | 356 | $output = executeQuery("point.initMemberPoint"); |
| 312 | - if(!$output->toBool()) return $output; |
|
| 357 | + if(!$output->toBool()) { |
|
| 358 | + return $output; |
|
| 359 | + } |
|
| 313 | 360 | // Save the file temporarily |
| 314 | 361 | |
| 315 | 362 | $str = ''; |
@@ -334,7 +381,9 @@ discard block |
||
| 334 | 381 | $position = (int)Context::get('position'); |
| 335 | 382 | $total = (int)Context::get('total'); |
| 336 | 383 | |
| 337 | - if(!file_exists('./files/cache/pointRecal.txt')) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 384 | + if(!file_exists('./files/cache/pointRecal.txt')) { |
|
| 385 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 386 | + } |
|
| 338 | 387 | |
| 339 | 388 | $idx = 0; |
| 340 | 389 | $f = fopen("./files/cache/pointRecal.txt","r"); |
@@ -350,7 +399,9 @@ discard block |
||
| 350 | 399 | $args->member_srl = $member_srl; |
| 351 | 400 | $args->point = $point; |
| 352 | 401 | $output = executeQuery('point.insertPoint',$args); |
| 353 | - if($idx%5000==0) break; |
|
| 402 | + if($idx%5000==0) { |
|
| 403 | + break; |
|
| 404 | + } |
|
| 354 | 405 | } |
| 355 | 406 | } |
| 356 | 407 | |
@@ -377,16 +428,23 @@ discard block |
||
| 377 | 428 | function procPointAdminReset() |
| 378 | 429 | { |
| 379 | 430 | $module_srl = Context::get('module_srls'); |
| 380 | - if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 431 | + if(!$module_srl) { |
|
| 432 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 433 | + } |
|
| 381 | 434 | // In case of batch configuration of several modules |
| 382 | - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); |
|
| 383 | - else $module_srl = array($module_srl); |
|
| 435 | + if(preg_match('/^([0-9,]+)$/',$module_srl)) { |
|
| 436 | + $module_srl = explode(',',$module_srl); |
|
| 437 | + } else { |
|
| 438 | + $module_srl = array($module_srl); |
|
| 439 | + } |
|
| 384 | 440 | // Save configurations |
| 385 | 441 | $oModuleController = getController('module'); |
| 386 | 442 | for($i=0;$i<count($module_srl);$i++) |
| 387 | 443 | { |
| 388 | 444 | $srl = trim($module_srl[$i]); |
| 389 | - if(!$srl) continue; |
|
| 445 | + if(!$srl) { |
|
| 446 | + continue; |
|
| 447 | + } |
|
| 390 | 448 | $args = new stdClass(); |
| 391 | 449 | $args->module = 'point'; |
| 392 | 450 | $args->module_srl = $srl; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class board extends ModuleObject |
| 11 | 11 | { |
| 12 | - var $search_option = array('title_content','title','content','comment','user_name','nick_name','user_id','tag'); ///< 검색 옵션 |
|
| 12 | + var $search_option = array('title_content', 'title', 'content', 'comment', 'user_name', 'nick_name', 'user_id', 'tag'); ///< 검색 옵션 |
|
| 13 | 13 | |
| 14 | 14 | var $order_target = array('list_order', 'update_order', 'regdate', 'voted_count', 'blamed_count', 'readed_count', 'comment_count', 'title', 'nick_name', 'user_name', 'user_id'); // 정렬 옵션 |
| 15 | 15 | |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function board() |
| 27 | 27 | { |
| 28 | - if(!Context::isInstalled()) return; |
|
| 28 | + if (!Context::isInstalled()) return; |
|
| 29 | 29 | |
| 30 | - if(!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
|
| 30 | + if (!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
|
| 31 | 31 | { |
| 32 | 32 | $ssl_actions = array('dispBoardWrite', 'dispBoardWriteComment', 'dispBoardReplyComment', 'dispBoardModifyComment', 'dispBoardDelete', 'dispBoardDeleteComment', 'procBoardInsertDocument', 'procBoardDeleteDocument', 'procBoardInsertComment', 'procBoardDeleteComment', 'procBoardVerificationPassword'); |
| 33 | 33 | Context::addSSLActions($ssl_actions); |
| 34 | 34 | } |
| 35 | - if(!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional') |
|
| 35 | + if (!Context::isExistsSSLAction('dispTempSavedList') && Context::getSslStatus() == 'optional') |
|
| 36 | 36 | { |
| 37 | 37 | Context::addSSLAction('dispTempSavedList'); |
| 38 | 38 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $args = new stdClass; |
| 55 | 55 | $args->site_srl = 0; |
| 56 | 56 | $output = executeQuery('module.getSite', $args); |
| 57 | - if(!$output->data->index_module_srl) |
|
| 57 | + if (!$output->data->index_module_srl) |
|
| 58 | 58 | { |
| 59 | 59 | $args->mid = 'board'; |
| 60 | 60 | $args->module = 'board'; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $args->site_srl = 0; |
| 64 | 64 | $output = $oModuleController->insertModule($args); |
| 65 | 65 | |
| 66 | - if($output->toBool()) |
|
| 66 | + if ($output->toBool()) |
|
| 67 | 67 | { |
| 68 | 68 | $module_srl = $output->get('module_srl'); |
| 69 | 69 | |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | $oModuleController = getController('module'); |
| 89 | 89 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 90 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 90 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 91 | 91 | { |
| 92 | 92 | // 2007. 10. 17 get the member menu trigger |
| 93 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
| 93 | + if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
| 94 | 94 | |
| 95 | 95 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
| 96 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
| 96 | + if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
| 97 | 97 | |
| 98 | 98 | $oModuleController->insertUpdatedLog($version_update_id); |
| 99 | 99 | } |
@@ -109,16 +109,16 @@ discard block |
||
| 109 | 109 | $oModuleModel = getModel('module'); |
| 110 | 110 | $oModuleController = getController('module'); |
| 111 | 111 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 112 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 112 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 113 | 113 | { |
| 114 | 114 | // 2007. 10. 17 check the member menu trigger, if it is not existed then insert |
| 115 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) |
|
| 115 | + if (!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) |
|
| 116 | 116 | { |
| 117 | 117 | $oModuleController->insertTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
| 121 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) |
|
| 121 | + if (!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) |
|
| 122 | 122 | { |
| 123 | 123 | $oModuleController->insertTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after'); |
| 124 | 124 | } |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | function moduleUninstall() |
| 132 | 132 | { |
| 133 | 133 | $output = executeQueryArray("board.getAllBoard"); |
| 134 | - if(!$output->data) return new BaseObject(); |
|
| 134 | + if (!$output->data) return new BaseObject(); |
|
| 135 | 135 | @set_time_limit(0); |
| 136 | 136 | |
| 137 | 137 | $oModuleController = getController('module'); |
| 138 | 138 | |
| 139 | - foreach($output->data as $board) |
|
| 139 | + foreach ($output->data as $board) |
|
| 140 | 140 | { |
| 141 | 141 | $oModuleController->deleteModule($board->module_srl); |
| 142 | 142 | } |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function board() |
| 27 | 27 | { |
| 28 | - if(!Context::isInstalled()) return; |
|
| 28 | + if(!Context::isInstalled()) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | if(!Context::isExistsSSLAction('dispBoardWrite') && Context::getSslStatus() == 'optional') |
| 31 | 33 | { |
@@ -90,10 +92,14 @@ discard block |
||
| 90 | 92 | if($oModuleModel->needUpdate($version_update_id)) |
| 91 | 93 | { |
| 92 | 94 | // 2007. 10. 17 get the member menu trigger |
| 93 | - if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) return true; |
|
| 95 | + if(!$oModuleModel->getTrigger('member.getMemberMenu', 'board', 'controller', 'triggerMemberMenu', 'after')) { |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 94 | 98 | |
| 95 | 99 | // 2011. 09. 20 when add new menu in sitemap, custom menu add |
| 96 | - if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) return true; |
|
| 100 | + if(!$oModuleModel->getTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after')) { |
|
| 101 | + return true; |
|
| 102 | + } |
|
| 97 | 103 | |
| 98 | 104 | $oModuleController->insertUpdatedLog($version_update_id); |
| 99 | 105 | } |
@@ -131,7 +137,9 @@ discard block |
||
| 131 | 137 | function moduleUninstall() |
| 132 | 138 | { |
| 133 | 139 | $output = executeQueryArray("board.getAllBoard"); |
| 134 | - if(!$output->data) return new BaseObject(); |
|
| 140 | + if(!$output->data) { |
|
| 141 | + return new BaseObject(); |
|
| 142 | + } |
|
| 135 | 143 | @set_time_limit(0); |
| 136 | 144 | |
| 137 | 145 | $oModuleController = getController('module'); |
@@ -6,28 +6,28 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | function getSFTPList() |
| 8 | 8 | { |
| 9 | - $ftp_info = Context::getRequestVars(); |
|
| 10 | - if(!$ftp_info->ftp_host) |
|
| 9 | + $ftp_info = Context::getRequestVars(); |
|
| 10 | + if (!$ftp_info->ftp_host) |
|
| 11 | 11 | { |
| 12 | 12 | $ftp_info->ftp_host = "127.0.0.1"; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
| 16 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 16 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 17 | 17 | { |
| 18 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
| 18 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $sftp = ssh2_sftp($connection); |
| 22 | 22 | $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
| 23 | 23 | $dh = @opendir($curpwd); |
| 24 | - if(!$dh) return new BaseObject(-1, 'msg_ftp_invalid_path'); |
|
| 24 | + if (!$dh) return new BaseObject(-1, 'msg_ftp_invalid_path'); |
|
| 25 | 25 | |
| 26 | 26 | $list = array(); |
| 27 | - while(($file = readdir($dh)) !== false) |
|
| 27 | + while (($file = readdir($dh)) !== false) |
|
| 28 | 28 | { |
| 29 | - if(!is_dir($curpwd.$file)) continue; |
|
| 30 | - $list[] = $file . "/"; |
|
| 29 | + if (!is_dir($curpwd.$file)) continue; |
|
| 30 | + $list[] = $file."/"; |
|
| 31 | 31 | } |
| 32 | 32 | closedir($dh); |
| 33 | 33 | $this->add('list', $list); |
@@ -35,33 +35,33 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | function getInstallFTPList() |
| 37 | 37 | { |
| 38 | - if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
| 38 | + if (!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
| 39 | 39 | { |
| 40 | 40 | return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
| 41 | 41 | } |
| 42 | 42 | $this->pwd = $ftp_info->ftp_root_path; |
| 43 | - if(!$ftp_info->ftp_host) |
|
| 43 | + if (!$ftp_info->ftp_host) |
|
| 44 | 44 | { |
| 45 | 45 | $ftp_info->ftp_host = "127.0.0.1"; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if($ftp_info->sftp == 'Y') |
|
| 48 | + if ($ftp_info->sftp == 'Y') |
|
| 49 | 49 | { |
| 50 | 50 | return $this->getSFTPList(); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $_list = NULL; |
| 54 | - if(function_exists('ftp_connect')) |
|
| 54 | + if (function_exists('ftp_connect')) |
|
| 55 | 55 | { |
| 56 | 56 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
| 57 | - if(!$connection) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 58 | - if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 57 | + if (!$connection) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 58 | + if (!@ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 59 | 59 | { |
| 60 | 60 | ftp_close($connection); |
| 61 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
| 61 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if($ftp_info->ftp_pasv != "N") |
|
| 64 | + if ($ftp_info->ftp_pasv != "N") |
|
| 65 | 65 | { |
| 66 | 66 | ftp_pasv($connection, true); |
| 67 | 67 | } |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
| 75 | 75 | $oFtp = new ftp(); |
| 76 | - if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
| 76 | + if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
| 77 | 77 | { |
| 78 | - if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 78 | + if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
| 79 | 79 | { |
| 80 | 80 | $_list = $oFtp->ftp_rawlist($this->pwd); |
| 81 | 81 | $oFtp->ftp_quit(); |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | else |
| 84 | 84 | { |
| 85 | 85 | $oFtp->ftp_quit(); |
| 86 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
| 86 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $list = array(); |
| 92 | - if($_list) |
|
| 92 | + if ($_list) |
|
| 93 | 93 | { |
| 94 | - foreach($_list as $k => $v) |
|
| 94 | + foreach ($_list as $k => $v) |
|
| 95 | 95 | { |
| 96 | 96 | $src = new stdClass(); |
| 97 | 97 | $src->data = $v; |
| 98 | 98 | $res = Context::convertEncoding($src); |
| 99 | 99 | $v = $res->data; |
| 100 | - if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/'; |
|
| 100 | + if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v, ' '), 1).'/'; |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | $this->add('list', $list); |
@@ -21,12 +21,16 @@ discard block |
||
| 21 | 21 | $sftp = ssh2_sftp($connection); |
| 22 | 22 | $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
| 23 | 23 | $dh = @opendir($curpwd); |
| 24 | - if(!$dh) return new BaseObject(-1, 'msg_ftp_invalid_path'); |
|
| 24 | + if(!$dh) { |
|
| 25 | + return new BaseObject(-1, 'msg_ftp_invalid_path'); |
|
| 26 | + } |
|
| 25 | 27 | |
| 26 | 28 | $list = array(); |
| 27 | 29 | while(($file = readdir($dh)) !== false) |
| 28 | 30 | { |
| 29 | - if(!is_dir($curpwd.$file)) continue; |
|
| 31 | + if(!is_dir($curpwd.$file)) { |
|
| 32 | + continue; |
|
| 33 | + } |
|
| 30 | 34 | $list[] = $file . "/"; |
| 31 | 35 | } |
| 32 | 36 | closedir($dh); |
@@ -54,7 +58,9 @@ discard block |
||
| 54 | 58 | if(function_exists('ftp_connect')) |
| 55 | 59 | { |
| 56 | 60 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
| 57 | - if(!$connection) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 61 | + if(!$connection) { |
|
| 62 | + return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
| 63 | + } |
|
| 58 | 64 | if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
| 59 | 65 | { |
| 60 | 66 | ftp_close($connection); |
@@ -68,8 +74,7 @@ discard block |
||
| 68 | 74 | |
| 69 | 75 | $_list = ftp_rawlist($connection, $this->pwd); |
| 70 | 76 | ftp_close($connection); |
| 71 | - } |
|
| 72 | - else |
|
| 77 | + } else |
|
| 73 | 78 | { |
| 74 | 79 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
| 75 | 80 | $oFtp = new ftp(); |
@@ -79,8 +84,7 @@ discard block |
||
| 79 | 84 | { |
| 80 | 85 | $_list = $oFtp->ftp_rawlist($this->pwd); |
| 81 | 86 | $oFtp->ftp_quit(); |
| 82 | - } |
|
| 83 | - else |
|
| 87 | + } else |
|
| 84 | 88 | { |
| 85 | 89 | $oFtp->ftp_quit(); |
| 86 | 90 | return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
@@ -97,7 +101,9 @@ discard block |
||
| 97 | 101 | $src->data = $v; |
| 98 | 102 | $res = Context::convertEncoding($src); |
| 99 | 103 | $v = $res->data; |
| 100 | - if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/'; |
|
| 104 | + if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) { |
|
| 105 | + $list[] = substr(strrchr($v,' '),1) . '/'; |
|
| 106 | + } |
|
| 101 | 107 | } |
| 102 | 108 | } |
| 103 | 109 | $this->add('list', $list); |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | function member() |
| 22 | 22 | { |
| 23 | - if(!Context::isInstalled()) return; |
|
| 23 | + if (!Context::isInstalled()) return; |
|
| 24 | 24 | |
| 25 | 25 | $oModuleModel = getModel('module'); |
| 26 | 26 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 27 | 27 | |
| 28 | 28 | // Set to use SSL upon actions related member join/information/password and so on. 2013.02.15 |
| 29 | - if(!Context::isExistsSSLAction('dispMemberModifyPassword') && Context::getSslStatus() == 'optional') |
|
| 29 | + if (!Context::isExistsSSLAction('dispMemberModifyPassword') && Context::getSslStatus() == 'optional') |
|
| 30 | 30 | { |
| 31 | 31 | $ssl_actions = array('dispMemberModifyPassword', 'dispMemberSignUpForm', 'dispMemberModifyInfo', 'dispMemberModifyEmailAddress', 'dispMemberGetTempPassword', 'dispMemberResendAuthMail', 'dispMemberLoginForm', 'dispMemberFindAccount', 'dispMemberLeave', 'procMemberLogin', 'procMemberModifyPassword', 'procMemberInsert', 'procMemberModifyInfo', 'procMemberFindAccount', 'procMemberModifyEmailAddress', 'procMemberResendAuthMail', 'procMemberLeave'/*, 'getMemberMenu'*/, 'procMemberFindAccountByQuestion'); |
| 32 | 32 | Context::addSSLActions($ssl_actions); |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | $oModuleController = getController('module'); |
| 45 | 45 | |
| 46 | 46 | $oDB = &DB::getInstance(); |
| 47 | - $oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true); |
|
| 47 | + $oDB->addIndex("member_group", "idx_site_title", array("site_srl", "title"), true); |
|
| 48 | 48 | |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | 50 | $config = $oModuleModel->getModuleConfig('member'); |
| 51 | 51 | |
| 52 | - if(empty($config)) |
|
| 52 | + if (empty($config)) |
|
| 53 | 53 | { |
| 54 | 54 | $isNotInstall = true; |
| 55 | 55 | $config = new stdClass; |
@@ -58,29 +58,29 @@ discard block |
||
| 58 | 58 | // Set the basic information |
| 59 | 59 | $config->enable_join = 'Y'; |
| 60 | 60 | $config->enable_openid = 'N'; |
| 61 | - if(!$config->enable_auth_mail) $config->enable_auth_mail = 'N'; |
|
| 62 | - if(!$config->image_name) $config->image_name = 'Y'; |
|
| 63 | - if(!$config->image_mark) $config->image_mark = 'Y'; |
|
| 64 | - if(!$config->profile_image) $config->profile_image = 'Y'; |
|
| 65 | - if(!$config->image_name_max_width) $config->image_name_max_width = '90'; |
|
| 66 | - if(!$config->image_name_max_height) $config->image_name_max_height = '20'; |
|
| 67 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = '20'; |
|
| 68 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = '20'; |
|
| 69 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = '90'; |
|
| 70 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = '90'; |
|
| 71 | - if($config->group_image_mark!='Y') $config->group_image_mark = 'N'; |
|
| 72 | - if(!$config->password_strength) $config->password_strength = 'normal'; |
|
| 61 | + if (!$config->enable_auth_mail) $config->enable_auth_mail = 'N'; |
|
| 62 | + if (!$config->image_name) $config->image_name = 'Y'; |
|
| 63 | + if (!$config->image_mark) $config->image_mark = 'Y'; |
|
| 64 | + if (!$config->profile_image) $config->profile_image = 'Y'; |
|
| 65 | + if (!$config->image_name_max_width) $config->image_name_max_width = '90'; |
|
| 66 | + if (!$config->image_name_max_height) $config->image_name_max_height = '20'; |
|
| 67 | + if (!$config->image_mark_max_width) $config->image_mark_max_width = '20'; |
|
| 68 | + if (!$config->image_mark_max_height) $config->image_mark_max_height = '20'; |
|
| 69 | + if (!$config->profile_image_max_width) $config->profile_image_max_width = '90'; |
|
| 70 | + if (!$config->profile_image_max_height) $config->profile_image_max_height = '90'; |
|
| 71 | + if ($config->group_image_mark != 'Y') $config->group_image_mark = 'N'; |
|
| 72 | + if (!$config->password_strength) $config->password_strength = 'normal'; |
|
| 73 | 73 | |
| 74 | - if(!$config->password_hashing_algorithm) |
|
| 74 | + if (!$config->password_hashing_algorithm) |
|
| 75 | 75 | { |
| 76 | 76 | $oPassword = new Password(); |
| 77 | 77 | $config->password_hashing_algorithm = $oPassword->getBestAlgorithm(); |
| 78 | 78 | } |
| 79 | - if(!$config->password_hashing_work_factor) |
|
| 79 | + if (!$config->password_hashing_work_factor) |
|
| 80 | 80 | { |
| 81 | 81 | $config->password_hashing_work_factor = 8; |
| 82 | 82 | } |
| 83 | - if(!$config->password_hashing_auto_upgrade) |
|
| 83 | + if (!$config->password_hashing_auto_upgrade) |
|
| 84 | 84 | { |
| 85 | 85 | $config->password_hashing_auto_upgrade = 'Y'; |
| 86 | 86 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $oMemberController = getController('member'); |
| 92 | 92 | $oMemberAdminController = getAdminController('member'); |
| 93 | 93 | |
| 94 | - if(!$config->signupForm || !is_array($config->signupForm)) |
|
| 94 | + if (!$config->signupForm || !is_array($config->signupForm)) |
|
| 95 | 95 | { |
| 96 | 96 | $identifier = $isNotInstall ? 'email_address' : 'user_id'; |
| 97 | 97 | |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | $oMemberAdminController->_createFindAccountByQuestion($config->identifier); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $oModuleController->insertModuleConfig('member',$config); |
|
| 109 | + $oModuleController->insertModuleConfig('member', $config); |
|
| 110 | 110 | |
| 111 | 111 | $groups = $oMemberModel->getGroups(); |
| 112 | - if(!count($groups)) |
|
| 112 | + if (!count($groups)) |
|
| 113 | 113 | { |
| 114 | 114 | // Set an administrator, regular member(group1), and associate member(group2) |
| 115 | 115 | $group_args = new stdClass; |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | $admin_args = new stdClass; |
| 136 | 136 | $admin_args->is_admin = 'Y'; |
| 137 | 137 | $output = executeQuery('member.getMemberList', $admin_args); |
| 138 | - if(!$output->data) |
|
| 138 | + if (!$output->data) |
|
| 139 | 139 | { |
| 140 | - $admin_info = Context::gets('password','nick_name','email_address', 'user_id'); |
|
| 141 | - if($admin_info->email_address) |
|
| 140 | + $admin_info = Context::gets('password', 'nick_name', 'email_address', 'user_id'); |
|
| 141 | + if ($admin_info->email_address) |
|
| 142 | 142 | { |
| 143 | 143 | $admin_info->user_name = 'admin'; |
| 144 | 144 | // Insert admin information |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | // Register denied ID(default + module name) |
| 151 | 151 | $oModuleModel = getModel('module'); |
| 152 | 152 | $module_list = $oModuleModel->getModuleList(); |
| 153 | - foreach($module_list as $key => $val) |
|
| 153 | + foreach ($module_list as $key => $val) |
|
| 154 | 154 | { |
| 155 | - $oMemberAdminController->insertDeniedID($val->module,''); |
|
| 155 | + $oMemberAdminController->insertDeniedID($val->module, ''); |
|
| 156 | 156 | } |
| 157 | - $oMemberAdminController->insertDeniedID('www',''); |
|
| 158 | - $oMemberAdminController->insertDeniedID('root',''); |
|
| 159 | - $oMemberAdminController->insertDeniedID('administrator',''); |
|
| 160 | - $oMemberAdminController->insertDeniedID('telnet',''); |
|
| 161 | - $oMemberAdminController->insertDeniedID('ftp',''); |
|
| 162 | - $oMemberAdminController->insertDeniedID('http',''); |
|
| 157 | + $oMemberAdminController->insertDeniedID('www', ''); |
|
| 158 | + $oMemberAdminController->insertDeniedID('root', ''); |
|
| 159 | + $oMemberAdminController->insertDeniedID('administrator', ''); |
|
| 160 | + $oMemberAdminController->insertDeniedID('telnet', ''); |
|
| 161 | + $oMemberAdminController->insertDeniedID('ftp', ''); |
|
| 162 | + $oMemberAdminController->insertDeniedID('http', ''); |
|
| 163 | 163 | // Create cache directory to use in the member module |
| 164 | 164 | FileHandler::makeDir('./files/member_extra_info/image_name'); |
| 165 | 165 | FileHandler::makeDir('./files/member_extra_info/image_mark'); |
@@ -184,76 +184,76 @@ discard block |
||
| 184 | 184 | $oModuleModel = getModel('module'); |
| 185 | 185 | $oModuleController = getController('module'); |
| 186 | 186 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 187 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 187 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 188 | 188 | { |
| 189 | 189 | // check member directory (11/08/2007 added) |
| 190 | - if(!is_dir("./files/member_extra_info")) return true; |
|
| 190 | + if (!is_dir("./files/member_extra_info")) return true; |
|
| 191 | 191 | // check member directory (22/10/2007 added) |
| 192 | - if(!is_dir("./files/member_extra_info/profile_image")) return true; |
|
| 192 | + if (!is_dir("./files/member_extra_info/profile_image")) return true; |
|
| 193 | 193 | // Add a column(is_register) to "member_auth_mail" table (22/04/2008) |
| 194 | 194 | $act = $oDB->isColumnExists("member_auth_mail", "is_register"); |
| 195 | - if(!$act) return true; |
|
| 195 | + if (!$act) return true; |
|
| 196 | 196 | // Add a column(site_srl) to "member_group_member" table (11/15/2008) |
| 197 | - if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true; |
|
| 198 | - if(!$oDB->isColumnExists("member_group", "site_srl")) return true; |
|
| 199 | - if($oDB->isIndexExists("member_group","uni_member_group_title")) return true; |
|
| 197 | + if (!$oDB->isColumnExists("member_group_member", "site_srl")) return true; |
|
| 198 | + if (!$oDB->isColumnExists("member_group", "site_srl")) return true; |
|
| 199 | + if ($oDB->isIndexExists("member_group", "uni_member_group_title")) return true; |
|
| 200 | 200 | |
| 201 | 201 | // Add a column for list_order (05/18/2011) |
| 202 | - if(!$oDB->isColumnExists("member_group", "list_order")) return true; |
|
| 202 | + if (!$oDB->isColumnExists("member_group", "list_order")) return true; |
|
| 203 | 203 | |
| 204 | 204 | // image_mark 추가 (2009. 02. 14) |
| 205 | - if(!$oDB->isColumnExists("member_group", "image_mark")) return true; |
|
| 205 | + if (!$oDB->isColumnExists("member_group", "image_mark")) return true; |
|
| 206 | 206 | // Add c column for password expiration date |
| 207 | - if(!$oDB->isColumnExists("member", "change_password_date")) return true; |
|
| 207 | + if (!$oDB->isColumnExists("member", "change_password_date")) return true; |
|
| 208 | 208 | |
| 209 | 209 | // Add columns of question and answer to verify a password |
| 210 | - if(!$oDB->isColumnExists("member", "find_account_question")) return true; |
|
| 211 | - if(!$oDB->isColumnExists("member", "find_account_answer")) return true; |
|
| 210 | + if (!$oDB->isColumnExists("member", "find_account_question")) return true; |
|
| 211 | + if (!$oDB->isColumnExists("member", "find_account_answer")) return true; |
|
| 212 | 212 | |
| 213 | - if(!$oDB->isColumnExists("member", "list_order")) return true; |
|
| 214 | - if(!$oDB->isIndexExists("member","idx_list_order")) return true; |
|
| 213 | + if (!$oDB->isColumnExists("member", "list_order")) return true; |
|
| 214 | + if (!$oDB->isIndexExists("member", "idx_list_order")) return true; |
|
| 215 | 215 | |
| 216 | 216 | $oModuleModel = getModel('module'); |
| 217 | 217 | $config = $oModuleModel->getModuleConfig('member'); |
| 218 | 218 | // check signup form ordering info |
| 219 | - if(!$config->signupForm) return true; |
|
| 219 | + if (!$config->signupForm) return true; |
|
| 220 | 220 | |
| 221 | - foreach($config->signupForm as $form) |
|
| 221 | + foreach ($config->signupForm as $form) |
|
| 222 | 222 | { |
| 223 | - if($form->name === 'email_address' && $form->isPublic !== 'N') |
|
| 223 | + if ($form->name === 'email_address' && $form->isPublic !== 'N') |
|
| 224 | 224 | { |
| 225 | 225 | return true; |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // check agreement field exist |
| 230 | - if($config->agreement) return true; |
|
| 230 | + if ($config->agreement) return true; |
|
| 231 | 231 | |
| 232 | - if($config->skin) |
|
| 232 | + if ($config->skin) |
|
| 233 | 233 | { |
| 234 | 234 | $config_parse = explode('.', $config->skin); |
| 235 | - if(count($config_parse) > 1) |
|
| 235 | + if (count($config_parse) > 1) |
|
| 236 | 236 | { |
| 237 | 237 | $template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]); |
| 238 | - if(is_dir($template_path)) return true; |
|
| 238 | + if (is_dir($template_path)) return true; |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // supprot multilanguage agreement. |
| 243 | - if(is_readable('./files/member_extra_info/agreement.txt')) return true; |
|
| 243 | + if (is_readable('./files/member_extra_info/agreement.txt')) return true; |
|
| 244 | 244 | |
| 245 | 245 | // 2013. 11. 22 add menu when popup document menu called |
| 246 | - if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) return true; |
|
| 247 | - if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) return true; |
|
| 246 | + if (!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) return true; |
|
| 247 | + if (!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) return true; |
|
| 248 | 248 | |
| 249 | 249 | $oModuleController->insertUpdatedLog($version_update_id); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - if(!is_readable('./files/ruleset/insertMember.xml')) return true; |
|
| 253 | - if(!is_readable('./files/ruleset/login.xml')) return true; |
|
| 254 | - if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true; |
|
| 252 | + if (!is_readable('./files/ruleset/insertMember.xml')) return true; |
|
| 253 | + if (!is_readable('./files/ruleset/login.xml')) return true; |
|
| 254 | + if (!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true; |
|
| 255 | 255 | |
| 256 | - if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) return true; |
|
| 256 | + if ($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) return true; |
|
| 257 | 257 | |
| 258 | 258 | return false; |
| 259 | 259 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $oMemberAdminController = getAdminController('member'); |
| 272 | 272 | $config = $oModuleModel->getModuleConfig('member'); |
| 273 | 273 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 274 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 274 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 275 | 275 | { |
| 276 | 276 | // Check member directory |
| 277 | 277 | FileHandler::makeDir('./files/member_extra_info/image_name'); |
@@ -279,74 +279,74 @@ discard block |
||
| 279 | 279 | FileHandler::makeDir('./files/member_extra_info/signature'); |
| 280 | 280 | FileHandler::makeDir('./files/member_extra_info/profile_image'); |
| 281 | 281 | // Add a column |
| 282 | - if(!$oDB->isColumnExists("member_auth_mail", "is_register")) |
|
| 282 | + if (!$oDB->isColumnExists("member_auth_mail", "is_register")) |
|
| 283 | 283 | { |
| 284 | 284 | $oDB->addColumn("member_auth_mail", "is_register", "char", 1, "N", true); |
| 285 | 285 | } |
| 286 | 286 | // Add a column(site_srl) to "member_group_member" table (11/15/2008) |
| 287 | - if(!$oDB->isColumnExists("member_group_member", "site_srl")) |
|
| 287 | + if (!$oDB->isColumnExists("member_group_member", "site_srl")) |
|
| 288 | 288 | { |
| 289 | 289 | $oDB->addColumn("member_group_member", "site_srl", "number", 11, 0, true); |
| 290 | 290 | $oDB->addIndex("member_group_member", "idx_site_srl", "site_srl", false); |
| 291 | 291 | } |
| 292 | - if(!$oDB->isColumnExists("member_group", "site_srl")) |
|
| 292 | + if (!$oDB->isColumnExists("member_group", "site_srl")) |
|
| 293 | 293 | { |
| 294 | 294 | $oDB->addColumn("member_group", "site_srl", "number", 11, 0, true); |
| 295 | - $oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true); |
|
| 295 | + $oDB->addIndex("member_group", "idx_site_title", array("site_srl", "title"), true); |
|
| 296 | 296 | } |
| 297 | - if($oDB->isIndexExists("member_group","uni_member_group_title")) |
|
| 297 | + if ($oDB->isIndexExists("member_group", "uni_member_group_title")) |
|
| 298 | 298 | { |
| 299 | - $oDB->dropIndex("member_group","uni_member_group_title",true); |
|
| 299 | + $oDB->dropIndex("member_group", "uni_member_group_title", true); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | // Add a column(list_order) to "member_group" table (05/18/2011) |
| 303 | - if(!$oDB->isColumnExists("member_group", "list_order")) |
|
| 303 | + if (!$oDB->isColumnExists("member_group", "list_order")) |
|
| 304 | 304 | { |
| 305 | 305 | $oDB->addColumn("member_group", "list_order", "number", 11, '', true); |
| 306 | - $oDB->addIndex("member_group","idx_list_order", "list_order",false); |
|
| 306 | + $oDB->addIndex("member_group", "idx_list_order", "list_order", false); |
|
| 307 | 307 | $output = executeQuery('member.updateAllMemberGroupListOrder'); |
| 308 | 308 | } |
| 309 | 309 | // Add a column for image_mark (02/14/2009) |
| 310 | - if(!$oDB->isColumnExists("member_group", "image_mark")) |
|
| 310 | + if (!$oDB->isColumnExists("member_group", "image_mark")) |
|
| 311 | 311 | { |
| 312 | 312 | $oDB->addColumn("member_group", "image_mark", "text"); |
| 313 | 313 | } |
| 314 | 314 | // Add a column for password expiration date |
| 315 | - if(!$oDB->isColumnExists("member", "change_password_date")) |
|
| 315 | + if (!$oDB->isColumnExists("member", "change_password_date")) |
|
| 316 | 316 | { |
| 317 | 317 | $oDB->addColumn("member", "change_password_date", "date"); |
| 318 | 318 | executeQuery('member.updateAllChangePasswordDate'); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | // Add columns of question and answer to verify a password |
| 322 | - if(!$oDB->isColumnExists("member", "find_account_question")) |
|
| 322 | + if (!$oDB->isColumnExists("member", "find_account_question")) |
|
| 323 | 323 | { |
| 324 | 324 | $oDB->addColumn("member", "find_account_question", "number", 11); |
| 325 | 325 | } |
| 326 | - if(!$oDB->isColumnExists("member", "find_account_answer")) |
|
| 326 | + if (!$oDB->isColumnExists("member", "find_account_answer")) |
|
| 327 | 327 | { |
| 328 | 328 | $oDB->addColumn("member", "find_account_answer", "varchar", 250); |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - if(!$oDB->isColumnExists("member", "list_order")) |
|
| 331 | + if (!$oDB->isColumnExists("member", "list_order")) |
|
| 332 | 332 | { |
| 333 | 333 | $oDB->addColumn("member", "list_order", "number", 11); |
| 334 | 334 | @set_time_limit(0); |
| 335 | 335 | $args->list_order = 'member_srl'; |
| 336 | - executeQuery('member.updateMemberListOrderAll',$args); |
|
| 336 | + executeQuery('member.updateMemberListOrderAll', $args); |
|
| 337 | 337 | executeQuery('member.updateMemberListOrderAll'); |
| 338 | 338 | } |
| 339 | - if(!$oDB->isIndexExists("member","idx_list_order")) |
|
| 339 | + if (!$oDB->isIndexExists("member", "idx_list_order")) |
|
| 340 | 340 | { |
| 341 | - $oDB->addIndex("member","idx_list_order", array("list_order")); |
|
| 341 | + $oDB->addIndex("member", "idx_list_order", array("list_order")); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | $config = $oModuleModel->getModuleConfig('member'); |
| 345 | 345 | |
| 346 | 346 | // check agreement value exist |
| 347 | - if($config->agreement) |
|
| 347 | + if ($config->agreement) |
|
| 348 | 348 | { |
| 349 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
| 349 | + $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt'; |
|
| 350 | 350 | $output = FileHandler::writeFile($agreement_file, $config->agreement); |
| 351 | 351 | |
| 352 | 352 | $config->agreement = NULL; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | // check signup form ordering info |
| 357 | - if(!$config->signupForm || !is_array($config->signupForm)) |
|
| 357 | + if (!$config->signupForm || !is_array($config->signupForm)) |
|
| 358 | 358 | { |
| 359 | 359 | $identifier = 'email_address'; |
| 360 | 360 | |
@@ -365,9 +365,9 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // 회원정보에서 이메일 노출 제거 |
| 367 | 367 | // @see https://github.com/xpressengine/xe-core/issues/2177 |
| 368 | - foreach($config->signupForm as $form) |
|
| 368 | + foreach ($config->signupForm as $form) |
|
| 369 | 369 | { |
| 370 | - if($form->name === 'email_address') |
|
| 370 | + if ($form->name === 'email_address') |
|
| 371 | 371 | { |
| 372 | 372 | $form->isPublic = 'N'; |
| 373 | 373 | break; |
@@ -375,13 +375,13 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | $oModuleController->updateModuleConfig('member', $config); |
| 377 | 377 | |
| 378 | - if($config->skin) |
|
| 378 | + if ($config->skin) |
|
| 379 | 379 | { |
| 380 | 380 | $config_parse = explode('.', $config->skin); |
| 381 | 381 | if (count($config_parse) > 1) |
| 382 | 382 | { |
| 383 | 383 | $template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]); |
| 384 | - if(is_dir($template_path)) |
|
| 384 | + if (is_dir($template_path)) |
|
| 385 | 385 | { |
| 386 | 386 | $config->skin = implode('|@|', $config_parse); |
| 387 | 387 | $oModuleController = getController('module'); |
@@ -391,15 +391,15 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // 2013. 11. 22 add menu when popup document menu called |
| 394 | - if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) |
|
| 394 | + if (!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) |
|
| 395 | 395 | $oModuleController->insertTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after'); |
| 396 | - if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) |
|
| 396 | + if (!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) |
|
| 397 | 397 | $oModuleController->insertTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after'); |
| 398 | 398 | |
| 399 | - if(is_readable('./files/member_extra_info/agreement.txt')) |
|
| 399 | + if (is_readable('./files/member_extra_info/agreement.txt')) |
|
| 400 | 400 | { |
| 401 | 401 | $source_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 402 | - $target_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
| 402 | + $target_file = _XE_PATH_.'files/member_extra_info/agreement_'.Context::get('lang_type').'.txt'; |
|
| 403 | 403 | |
| 404 | 404 | FileHandler::rename($source_file, $target_file); |
| 405 | 405 | } |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | FileHandler::makeDir('./files/ruleset'); |
| 411 | - if(!is_readable('./files/ruleset/insertMember.xml')) |
|
| 411 | + if (!is_readable('./files/ruleset/insertMember.xml')) |
|
| 412 | 412 | $oMemberAdminController->_createSignupRuleset($config->signupForm); |
| 413 | - if(!is_readable('./files/ruleset/login.xml')) |
|
| 413 | + if (!is_readable('./files/ruleset/login.xml')) |
|
| 414 | 414 | $oMemberAdminController->_createLoginRuleset($config->identifier); |
| 415 | - if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) |
|
| 415 | + if (!is_readable('./files/ruleset/find_member_account_by_question.xml')) |
|
| 416 | 416 | $oMemberAdminController->_createFindAccountByQuestion($config->identifier); |
| 417 | 417 | |
| 418 | - if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) |
|
| 418 | + if ($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) |
|
| 419 | 419 | { |
| 420 | 420 | $oMemberAdminController->_createSignupRuleset($config->signupForm); |
| 421 | 421 | $oModuleController->insertUpdatedLog('member.1.8.43.recreate_signup_ruleset'); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | function recordLoginError($error = 0, $message = 'success') |
| 440 | 440 | { |
| 441 | - if($error == 0) return new BaseObject($error, $message); |
|
| 441 | + if ($error == 0) return new BaseObject($error, $message); |
|
| 442 | 442 | |
| 443 | 443 | // Create a member model object |
| 444 | 444 | $oMemberModel = getModel('member'); |
@@ -446,18 +446,18 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | // Check if there is recoding table. |
| 448 | 448 | $oDB = &DB::getInstance(); |
| 449 | - if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message); |
|
| 449 | + if (!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message); |
|
| 450 | 450 | |
| 451 | 451 | $args = new stdClass(); |
| 452 | 452 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 453 | 453 | |
| 454 | 454 | $output = executeQuery('member.getLoginCountByIp', $args); |
| 455 | - if($output->data && $output->data->count) |
|
| 455 | + if ($output->data && $output->data->count) |
|
| 456 | 456 | { |
| 457 | 457 | $last_update = strtotime($output->data->last_update); |
| 458 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
| 458 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
| 459 | 459 | //update, if IP address access in a short time, update count. If not, make count 1. |
| 460 | - if($term < $config->max_error_count_time) |
|
| 460 | + if ($term < $config->max_error_count_time) |
|
| 461 | 461 | { |
| 462 | 462 | $args->count = $output->data->count + 1; |
| 463 | 463 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | function recordMemberLoginError($error = 0, $message = 'success', $args = NULL) |
| 485 | 485 | { |
| 486 | - if($error == 0 || !$args->member_srl) return new BaseObject($error, $message); |
|
| 486 | + if ($error == 0 || !$args->member_srl) return new BaseObject($error, $message); |
|
| 487 | 487 | |
| 488 | 488 | // Create a member model object |
| 489 | 489 | $oMemberModel = getModel('member'); |
@@ -491,21 +491,21 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | // Check if there is recoding table. |
| 493 | 493 | $oDB = &DB::getInstance(); |
| 494 | - if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message); |
|
| 494 | + if (!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message); |
|
| 495 | 495 | |
| 496 | 496 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
| 497 | - if($output->data && $output->data->content) |
|
| 497 | + if ($output->data && $output->data->content) |
|
| 498 | 498 | { |
| 499 | 499 | //update |
| 500 | 500 | $content = unserialize($output->data->content); |
| 501 | - $content[] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']); |
|
| 501 | + $content[] = array($_SERVER['REMOTE_ADDR'], Context::getLang($message), $_SERVER['REQUEST_TIME']); |
|
| 502 | 502 | $args->content = serialize($content); |
| 503 | 503 | $output = executeQuery('member.updateLoginCountHistoryByMemberSrl', $args); |
| 504 | 504 | } |
| 505 | 505 | else |
| 506 | 506 | { |
| 507 | 507 | //insert |
| 508 | - $content[0] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']); |
|
| 508 | + $content[0] = array($_SERVER['REMOTE_ADDR'], Context::getLang($message), $_SERVER['REQUEST_TIME']); |
|
| 509 | 509 | $args->content = serialize($content); |
| 510 | 510 | $output = executeQuery('member.insertLoginCountHistoryByMemberSrl', $args); |
| 511 | 511 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | function member() |
| 22 | 22 | { |
| 23 | - if(!Context::isInstalled()) return; |
|
| 23 | + if(!Context::isInstalled()) { |
|
| 24 | + return; |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | 27 | $oModuleModel = getModel('module'); |
| 26 | 28 | $member_config = $oModuleModel->getModuleConfig('member'); |
@@ -58,18 +60,42 @@ discard block |
||
| 58 | 60 | // Set the basic information |
| 59 | 61 | $config->enable_join = 'Y'; |
| 60 | 62 | $config->enable_openid = 'N'; |
| 61 | - if(!$config->enable_auth_mail) $config->enable_auth_mail = 'N'; |
|
| 62 | - if(!$config->image_name) $config->image_name = 'Y'; |
|
| 63 | - if(!$config->image_mark) $config->image_mark = 'Y'; |
|
| 64 | - if(!$config->profile_image) $config->profile_image = 'Y'; |
|
| 65 | - if(!$config->image_name_max_width) $config->image_name_max_width = '90'; |
|
| 66 | - if(!$config->image_name_max_height) $config->image_name_max_height = '20'; |
|
| 67 | - if(!$config->image_mark_max_width) $config->image_mark_max_width = '20'; |
|
| 68 | - if(!$config->image_mark_max_height) $config->image_mark_max_height = '20'; |
|
| 69 | - if(!$config->profile_image_max_width) $config->profile_image_max_width = '90'; |
|
| 70 | - if(!$config->profile_image_max_height) $config->profile_image_max_height = '90'; |
|
| 71 | - if($config->group_image_mark!='Y') $config->group_image_mark = 'N'; |
|
| 72 | - if(!$config->password_strength) $config->password_strength = 'normal'; |
|
| 63 | + if(!$config->enable_auth_mail) { |
|
| 64 | + $config->enable_auth_mail = 'N'; |
|
| 65 | + } |
|
| 66 | + if(!$config->image_name) { |
|
| 67 | + $config->image_name = 'Y'; |
|
| 68 | + } |
|
| 69 | + if(!$config->image_mark) { |
|
| 70 | + $config->image_mark = 'Y'; |
|
| 71 | + } |
|
| 72 | + if(!$config->profile_image) { |
|
| 73 | + $config->profile_image = 'Y'; |
|
| 74 | + } |
|
| 75 | + if(!$config->image_name_max_width) { |
|
| 76 | + $config->image_name_max_width = '90'; |
|
| 77 | + } |
|
| 78 | + if(!$config->image_name_max_height) { |
|
| 79 | + $config->image_name_max_height = '20'; |
|
| 80 | + } |
|
| 81 | + if(!$config->image_mark_max_width) { |
|
| 82 | + $config->image_mark_max_width = '20'; |
|
| 83 | + } |
|
| 84 | + if(!$config->image_mark_max_height) { |
|
| 85 | + $config->image_mark_max_height = '20'; |
|
| 86 | + } |
|
| 87 | + if(!$config->profile_image_max_width) { |
|
| 88 | + $config->profile_image_max_width = '90'; |
|
| 89 | + } |
|
| 90 | + if(!$config->profile_image_max_height) { |
|
| 91 | + $config->profile_image_max_height = '90'; |
|
| 92 | + } |
|
| 93 | + if($config->group_image_mark!='Y') { |
|
| 94 | + $config->group_image_mark = 'N'; |
|
| 95 | + } |
|
| 96 | + if(!$config->password_strength) { |
|
| 97 | + $config->password_strength = 'normal'; |
|
| 98 | + } |
|
| 73 | 99 | |
| 74 | 100 | if(!$config->password_hashing_algorithm) |
| 75 | 101 | { |
@@ -187,36 +213,64 @@ discard block |
||
| 187 | 213 | if($oModuleModel->needUpdate($version_update_id)) |
| 188 | 214 | { |
| 189 | 215 | // check member directory (11/08/2007 added) |
| 190 | - if(!is_dir("./files/member_extra_info")) return true; |
|
| 216 | + if(!is_dir("./files/member_extra_info")) { |
|
| 217 | + return true; |
|
| 218 | + } |
|
| 191 | 219 | // check member directory (22/10/2007 added) |
| 192 | - if(!is_dir("./files/member_extra_info/profile_image")) return true; |
|
| 220 | + if(!is_dir("./files/member_extra_info/profile_image")) { |
|
| 221 | + return true; |
|
| 222 | + } |
|
| 193 | 223 | // Add a column(is_register) to "member_auth_mail" table (22/04/2008) |
| 194 | 224 | $act = $oDB->isColumnExists("member_auth_mail", "is_register"); |
| 195 | - if(!$act) return true; |
|
| 225 | + if(!$act) { |
|
| 226 | + return true; |
|
| 227 | + } |
|
| 196 | 228 | // Add a column(site_srl) to "member_group_member" table (11/15/2008) |
| 197 | - if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true; |
|
| 198 | - if(!$oDB->isColumnExists("member_group", "site_srl")) return true; |
|
| 199 | - if($oDB->isIndexExists("member_group","uni_member_group_title")) return true; |
|
| 229 | + if(!$oDB->isColumnExists("member_group_member", "site_srl")) { |
|
| 230 | + return true; |
|
| 231 | + } |
|
| 232 | + if(!$oDB->isColumnExists("member_group", "site_srl")) { |
|
| 233 | + return true; |
|
| 234 | + } |
|
| 235 | + if($oDB->isIndexExists("member_group","uni_member_group_title")) { |
|
| 236 | + return true; |
|
| 237 | + } |
|
| 200 | 238 | |
| 201 | 239 | // Add a column for list_order (05/18/2011) |
| 202 | - if(!$oDB->isColumnExists("member_group", "list_order")) return true; |
|
| 240 | + if(!$oDB->isColumnExists("member_group", "list_order")) { |
|
| 241 | + return true; |
|
| 242 | + } |
|
| 203 | 243 | |
| 204 | 244 | // image_mark 추가 (2009. 02. 14) |
| 205 | - if(!$oDB->isColumnExists("member_group", "image_mark")) return true; |
|
| 245 | + if(!$oDB->isColumnExists("member_group", "image_mark")) { |
|
| 246 | + return true; |
|
| 247 | + } |
|
| 206 | 248 | // Add c column for password expiration date |
| 207 | - if(!$oDB->isColumnExists("member", "change_password_date")) return true; |
|
| 249 | + if(!$oDB->isColumnExists("member", "change_password_date")) { |
|
| 250 | + return true; |
|
| 251 | + } |
|
| 208 | 252 | |
| 209 | 253 | // Add columns of question and answer to verify a password |
| 210 | - if(!$oDB->isColumnExists("member", "find_account_question")) return true; |
|
| 211 | - if(!$oDB->isColumnExists("member", "find_account_answer")) return true; |
|
| 254 | + if(!$oDB->isColumnExists("member", "find_account_question")) { |
|
| 255 | + return true; |
|
| 256 | + } |
|
| 257 | + if(!$oDB->isColumnExists("member", "find_account_answer")) { |
|
| 258 | + return true; |
|
| 259 | + } |
|
| 212 | 260 | |
| 213 | - if(!$oDB->isColumnExists("member", "list_order")) return true; |
|
| 214 | - if(!$oDB->isIndexExists("member","idx_list_order")) return true; |
|
| 261 | + if(!$oDB->isColumnExists("member", "list_order")) { |
|
| 262 | + return true; |
|
| 263 | + } |
|
| 264 | + if(!$oDB->isIndexExists("member","idx_list_order")) { |
|
| 265 | + return true; |
|
| 266 | + } |
|
| 215 | 267 | |
| 216 | 268 | $oModuleModel = getModel('module'); |
| 217 | 269 | $config = $oModuleModel->getModuleConfig('member'); |
| 218 | 270 | // check signup form ordering info |
| 219 | - if(!$config->signupForm) return true; |
|
| 271 | + if(!$config->signupForm) { |
|
| 272 | + return true; |
|
| 273 | + } |
|
| 220 | 274 | |
| 221 | 275 | foreach($config->signupForm as $form) |
| 222 | 276 | { |
@@ -227,7 +281,9 @@ discard block |
||
| 227 | 281 | } |
| 228 | 282 | |
| 229 | 283 | // check agreement field exist |
| 230 | - if($config->agreement) return true; |
|
| 284 | + if($config->agreement) { |
|
| 285 | + return true; |
|
| 286 | + } |
|
| 231 | 287 | |
| 232 | 288 | if($config->skin) |
| 233 | 289 | { |
@@ -235,25 +291,41 @@ discard block |
||
| 235 | 291 | if(count($config_parse) > 1) |
| 236 | 292 | { |
| 237 | 293 | $template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]); |
| 238 | - if(is_dir($template_path)) return true; |
|
| 294 | + if(is_dir($template_path)) { |
|
| 295 | + return true; |
|
| 296 | + } |
|
| 239 | 297 | } |
| 240 | 298 | } |
| 241 | 299 | |
| 242 | 300 | // supprot multilanguage agreement. |
| 243 | - if(is_readable('./files/member_extra_info/agreement.txt')) return true; |
|
| 301 | + if(is_readable('./files/member_extra_info/agreement.txt')) { |
|
| 302 | + return true; |
|
| 303 | + } |
|
| 244 | 304 | |
| 245 | 305 | // 2013. 11. 22 add menu when popup document menu called |
| 246 | - if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) return true; |
|
| 247 | - if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) return true; |
|
| 306 | + if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) { |
|
| 307 | + return true; |
|
| 308 | + } |
|
| 309 | + if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) { |
|
| 310 | + return true; |
|
| 311 | + } |
|
| 248 | 312 | |
| 249 | 313 | $oModuleController->insertUpdatedLog($version_update_id); |
| 250 | 314 | } |
| 251 | 315 | |
| 252 | - if(!is_readable('./files/ruleset/insertMember.xml')) return true; |
|
| 253 | - if(!is_readable('./files/ruleset/login.xml')) return true; |
|
| 254 | - if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true; |
|
| 316 | + if(!is_readable('./files/ruleset/insertMember.xml')) { |
|
| 317 | + return true; |
|
| 318 | + } |
|
| 319 | + if(!is_readable('./files/ruleset/login.xml')) { |
|
| 320 | + return true; |
|
| 321 | + } |
|
| 322 | + if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) { |
|
| 323 | + return true; |
|
| 324 | + } |
|
| 255 | 325 | |
| 256 | - if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) return true; |
|
| 326 | + if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) { |
|
| 327 | + return true; |
|
| 328 | + } |
|
| 257 | 329 | |
| 258 | 330 | return false; |
| 259 | 331 | } |
@@ -391,10 +463,12 @@ discard block |
||
| 391 | 463 | } |
| 392 | 464 | |
| 393 | 465 | // 2013. 11. 22 add menu when popup document menu called |
| 394 | - if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) |
|
| 395 | - $oModuleController->insertTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after'); |
|
| 396 | - if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) |
|
| 397 | - $oModuleController->insertTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after'); |
|
| 466 | + if(!$oModuleModel->getTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after')) { |
|
| 467 | + $oModuleController->insertTrigger('document.getDocumentMenu', 'member', 'controller', 'triggerGetDocumentMenu', 'after'); |
|
| 468 | + } |
|
| 469 | + if(!$oModuleModel->getTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after')) { |
|
| 470 | + $oModuleController->insertTrigger('comment.getCommentMenu', 'member', 'controller', 'triggerGetCommentMenu', 'after'); |
|
| 471 | + } |
|
| 398 | 472 | |
| 399 | 473 | if(is_readable('./files/member_extra_info/agreement.txt')) |
| 400 | 474 | { |
@@ -408,12 +482,15 @@ discard block |
||
| 408 | 482 | } |
| 409 | 483 | |
| 410 | 484 | FileHandler::makeDir('./files/ruleset'); |
| 411 | - if(!is_readable('./files/ruleset/insertMember.xml')) |
|
| 412 | - $oMemberAdminController->_createSignupRuleset($config->signupForm); |
|
| 413 | - if(!is_readable('./files/ruleset/login.xml')) |
|
| 414 | - $oMemberAdminController->_createLoginRuleset($config->identifier); |
|
| 415 | - if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) |
|
| 416 | - $oMemberAdminController->_createFindAccountByQuestion($config->identifier); |
|
| 485 | + if(!is_readable('./files/ruleset/insertMember.xml')) { |
|
| 486 | + $oMemberAdminController->_createSignupRuleset($config->signupForm); |
|
| 487 | + } |
|
| 488 | + if(!is_readable('./files/ruleset/login.xml')) { |
|
| 489 | + $oMemberAdminController->_createLoginRuleset($config->identifier); |
|
| 490 | + } |
|
| 491 | + if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) { |
|
| 492 | + $oMemberAdminController->_createFindAccountByQuestion($config->identifier); |
|
| 493 | + } |
|
| 417 | 494 | |
| 418 | 495 | if($oModuleModel->needUpdate('member.1.8.43.recreate_signup_ruleset')) |
| 419 | 496 | { |
@@ -438,7 +515,9 @@ discard block |
||
| 438 | 515 | */ |
| 439 | 516 | function recordLoginError($error = 0, $message = 'success') |
| 440 | 517 | { |
| 441 | - if($error == 0) return new BaseObject($error, $message); |
|
| 518 | + if($error == 0) { |
|
| 519 | + return new BaseObject($error, $message); |
|
| 520 | + } |
|
| 442 | 521 | |
| 443 | 522 | // Create a member model object |
| 444 | 523 | $oMemberModel = getModel('member'); |
@@ -446,7 +525,9 @@ discard block |
||
| 446 | 525 | |
| 447 | 526 | // Check if there is recoding table. |
| 448 | 527 | $oDB = &DB::getInstance(); |
| 449 | - if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message); |
|
| 528 | + if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') { |
|
| 529 | + return new BaseObject($error, $message); |
|
| 530 | + } |
|
| 450 | 531 | |
| 451 | 532 | $args = new stdClass(); |
| 452 | 533 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
@@ -460,16 +541,14 @@ discard block |
||
| 460 | 541 | if($term < $config->max_error_count_time) |
| 461 | 542 | { |
| 462 | 543 | $args->count = $output->data->count + 1; |
| 463 | - } |
|
| 464 | - else |
|
| 544 | + } else |
|
| 465 | 545 | { |
| 466 | 546 | $args->count = 1; |
| 467 | 547 | } |
| 468 | 548 | unset($oMemberModel); |
| 469 | 549 | unset($config); |
| 470 | 550 | $output = executeQuery('member.updateLoginCountByIp', $args); |
| 471 | - } |
|
| 472 | - else |
|
| 551 | + } else |
|
| 473 | 552 | { |
| 474 | 553 | //insert |
| 475 | 554 | $args->count = 1; |
@@ -483,7 +562,9 @@ discard block |
||
| 483 | 562 | */ |
| 484 | 563 | function recordMemberLoginError($error = 0, $message = 'success', $args = NULL) |
| 485 | 564 | { |
| 486 | - if($error == 0 || !$args->member_srl) return new BaseObject($error, $message); |
|
| 565 | + if($error == 0 || !$args->member_srl) { |
|
| 566 | + return new BaseObject($error, $message); |
|
| 567 | + } |
|
| 487 | 568 | |
| 488 | 569 | // Create a member model object |
| 489 | 570 | $oMemberModel = getModel('member'); |
@@ -491,7 +572,9 @@ discard block |
||
| 491 | 572 | |
| 492 | 573 | // Check if there is recoding table. |
| 493 | 574 | $oDB = &DB::getInstance(); |
| 494 | - if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new BaseObject($error, $message); |
|
| 575 | + if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') { |
|
| 576 | + return new BaseObject($error, $message); |
|
| 577 | + } |
|
| 495 | 578 | |
| 496 | 579 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
| 497 | 580 | if($output->data && $output->data->content) |
@@ -501,8 +584,7 @@ discard block |
||
| 501 | 584 | $content[] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']); |
| 502 | 585 | $args->content = serialize($content); |
| 503 | 586 | $output = executeQuery('member.updateLoginCountHistoryByMemberSrl', $args); |
| 504 | - } |
|
| 505 | - else |
|
| 587 | + } else |
|
| 506 | 588 | { |
| 507 | 589 | //insert |
| 508 | 590 | $content[0] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),$_SERVER['REQUEST_TIME']); |