@@ -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); |
@@ -47,28 +47,28 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if (!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 51 | 51 | |
| 52 | 52 | $oEditorModel = getModel('editor'); |
| 53 | 53 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 54 | + if (!$oComponent->toBool()) return $oComponent; |
|
| 55 | 55 | |
| 56 | - if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 56 | + if (!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 57 | 57 | |
| 58 | 58 | //$output = call_user_method($method, $oComponent); |
| 59 | 59 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 60 | + if (method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | + else return new BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
| 62 | 62 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 63 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 64 | 64 | |
| 65 | 65 | $this->setError($oComponent->getError()); |
| 66 | 66 | $this->setMessage($oComponent->getMessage()); |
| 67 | 67 | |
| 68 | 68 | $vars = $oComponent->getVariables(); |
| 69 | - if(count($vars)) |
|
| 69 | + if (count($vars)) |
|
| 70 | 70 | { |
| 71 | - foreach($vars as $key => $val) |
|
| 71 | + foreach ($vars as $key => $val) |
|
| 72 | 72 | { |
| 73 | 73 | $this->add($key, $val); |
| 74 | 74 | } |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | $module_srl = array(); |
| 87 | 87 | $oModuleModel = getModel('module'); |
| 88 | 88 | |
| 89 | - foreach($target_module_srl as $srl) |
|
| 89 | + foreach ($target_module_srl as $srl) |
|
| 90 | 90 | { |
| 91 | - if(!$srl) continue; |
|
| 91 | + if (!$srl) continue; |
|
| 92 | 92 | |
| 93 | 93 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | - if(!$module_info->module_srl) |
|
| 94 | + if (!$module_info->module_srl) |
|
| 95 | 95 | { |
| 96 | 96 | return new BaseObject(-1, 'msg_invalid_request'); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $module_grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 100 | - if(!$module_grant->manager) |
|
| 100 | + if (!$module_grant->manager) |
|
| 101 | 101 | { |
| 102 | 102 | return new BaseObject(-1, 'msg_not_permitted'); |
| 103 | 103 | } |
@@ -111,32 +111,32 @@ discard block |
||
| 111 | 111 | $editor_config->content_style = Context::get('content_style'); |
| 112 | 112 | $editor_config->comment_content_style = Context::get('comment_content_style'); |
| 113 | 113 | $editor_config->content_font = Context::get('content_font'); |
| 114 | - if($editor_config->content_font) |
|
| 114 | + if ($editor_config->content_font) |
|
| 115 | 115 | { |
| 116 | 116 | $font_list = array(); |
| 117 | - $fonts = explode(',',$editor_config->content_font); |
|
| 118 | - for($i=0,$c=count($fonts);$i<$c;$i++) |
|
| 117 | + $fonts = explode(',', $editor_config->content_font); |
|
| 118 | + for ($i = 0, $c = count($fonts); $i < $c; $i++) |
|
| 119 | 119 | { |
| 120 | - $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
|
| 121 | - if(!$font) continue; |
|
| 120 | + $font = trim(str_replace(array('"', '\''), '', $fonts[$i])); |
|
| 121 | + if (!$font) continue; |
|
| 122 | 122 | $font_list[] = $font; |
| 123 | 123 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 124 | + if (count($font_list)) $editor_config->content_font = '"'.implode('","', $font_list).'"'; |
|
| 125 | 125 | } |
| 126 | 126 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 127 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
| 128 | 128 | $editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset'); |
| 129 | 129 | |
| 130 | - $grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant'); |
|
| 130 | + $grants = array('enable_html_grant', 'enable_comment_html_grant', 'upload_file_grant', 'comment_upload_file_grant', 'enable_default_component_grant', 'enable_comment_default_component_grant', 'enable_component_grant', 'enable_comment_component_grant'); |
|
| 131 | 131 | |
| 132 | - foreach($grants as $key) |
|
| 132 | + foreach ($grants as $key) |
|
| 133 | 133 | { |
| 134 | 134 | $grant = Context::get($key); |
| 135 | - if(!$grant) |
|
| 135 | + if (!$grant) |
|
| 136 | 136 | { |
| 137 | 137 | $editor_config->{$key} = array(); |
| 138 | 138 | } |
| 139 | - else if(is_array($grant)) |
|
| 139 | + else if (is_array($grant)) |
|
| 140 | 140 | { |
| 141 | 141 | $editor_config->{$key} = $grant; |
| 142 | 142 | } |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $editor_config->editor_height = (int)Context::get('editor_height'); |
|
| 150 | - $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
|
| 149 | + $editor_config->editor_height = (int) Context::get('editor_height'); |
|
| 150 | + $editor_config->comment_editor_height = (int) Context::get('comment_editor_height'); |
|
| 151 | 151 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 152 | + if ($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 153 | 153 | |
| 154 | 154 | $oModuleController = getController('module'); |
| 155 | - foreach($module_srl as $srl) |
|
| 155 | + foreach ($module_srl as $srl) |
|
| 156 | 156 | { |
| 157 | 157 | $oModuleController->insertModulePartConfig('editor', $srl, $editor_config); |
| 158 | 158 | } |
@@ -169,31 +169,31 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function triggerEditorComponentCompile(&$content) |
| 171 | 171 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 172 | + if (Context::getResponseMethod() != 'HTML') return new BaseObject(); |
|
| 173 | 173 | |
| 174 | 174 | $module_info = Context::get('module_info'); |
| 175 | 175 | $module_srl = $module_info->module_srl; |
| 176 | - if($module_srl) |
|
| 176 | + if ($module_srl) |
|
| 177 | 177 | { |
| 178 | 178 | $oEditorModel = getModel('editor'); |
| 179 | 179 | $editor_config = $oEditorModel->getEditorConfig($module_srl); |
| 180 | 180 | $content_style = $editor_config->content_style; |
| 181 | - if($content_style) |
|
| 181 | + if ($content_style) |
|
| 182 | 182 | { |
| 183 | - $path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | - if(is_dir($path) && file_exists($path . 'style.ini')) |
|
| 183 | + $path = _XE_PATH_.'modules/editor/styles/'.$content_style.'/'; |
|
| 184 | + if (is_dir($path) && file_exists($path.'style.ini')) |
|
| 185 | 185 | { |
| 186 | 186 | $ini = file($path.'style.ini'); |
| 187 | - for($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 187 | + for ($i = 0, $c = count($ini); $i < $c; $i++) |
|
| 188 | 188 | { |
| 189 | 189 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 190 | + if (!$file) continue; |
|
| 191 | 191 | |
| 192 | - if(substr_compare($file, '.css', -4) === 0) |
|
| 192 | + if (substr_compare($file, '.css', -4) === 0) |
|
| 193 | 193 | { |
| 194 | 194 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | 195 | } |
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 196 | + elseif (substr_compare($file, '.js', -3) === 0) |
|
| 197 | 197 | { |
| 198 | 198 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 199 | } |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | } |
| 203 | 203 | $content_font = $editor_config->content_font; |
| 204 | 204 | $content_font_size = $editor_config->content_font_size; |
| 205 | - if($content_font || $content_font_size) |
|
| 205 | + if ($content_font || $content_font_size) |
|
| 206 | 206 | { |
| 207 | 207 | $buff = array(); |
| 208 | 208 | $buff[] = '<style> .xe_content { '; |
| 209 | - if($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | - if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 209 | + if ($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | + if ($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 211 | 211 | $buff[] = ' }</style>'; |
| 212 | 212 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 213 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | function transComponent($content) |
| 224 | 224 | { |
| 225 | - $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content); |
|
| 225 | + $content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this, 'transEditorComponent'), $content); |
|
| 226 | 226 | return $content; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -237,19 +237,19 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $xml_obj = new stdClass; |
| 239 | 239 | $xml_obj->attrs = new stdClass; |
| 240 | - for($i=0,$c=count($m[0]);$i<$c;$i++) |
|
| 240 | + for ($i = 0, $c = count($m[0]); $i < $c; $i++) |
|
| 241 | 241 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 242 | + if (!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 243 | 243 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 244 | } |
| 245 | 245 | $xml_obj->body = $match[4]; |
| 246 | 246 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 247 | + if (!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 248 | 248 | |
| 249 | 249 | // Get converted codes by using component::transHTML() |
| 250 | 250 | $oEditorModel = getModel('editor'); |
| 251 | 251 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 252 | + if (!is_object($oComponent) || !method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 253 | 253 | |
| 254 | 254 | return $oComponent->transHTML($xml_obj); |
| 255 | 255 | } |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function doSaveDoc($args) |
| 261 | 261 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 263 | - if(Context::get('is_logged')) |
|
| 262 | + if (!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 263 | + if (Context::get('is_logged')) |
|
| 264 | 264 | { |
| 265 | 265 | $logged_info = Context::get('logged_info'); |
| 266 | 266 | $args->member_srl = $logged_info->member_srl; |
@@ -271,11 +271,11 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // Get the current module if module_srl doesn't exist |
| 274 | - if(!$args->module_srl) |
|
| 274 | + if (!$args->module_srl) |
|
| 275 | 275 | { |
| 276 | 276 | $args->module_srl = Context::get('module_srl'); |
| 277 | 277 | } |
| 278 | - if(!$args->module_srl) |
|
| 278 | + if (!$args->module_srl) |
|
| 279 | 279 | { |
| 280 | 280 | $current_module_info = Context::get('current_module_info'); |
| 281 | 281 | $args->module_srl = $current_module_info->module_srl; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | function deleteSavedDoc($mode = false) |
| 322 | 322 | { |
| 323 | 323 | $args = new stdClass(); |
| 324 | - if(Context::get('is_logged')) |
|
| 324 | + if (Context::get('is_logged')) |
|
| 325 | 325 | { |
| 326 | 326 | $logged_info = Context::get('logged_info'); |
| 327 | 327 | $args->member_srl = $logged_info->member_srl; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | $args->module_srl = Context::get('module_srl'); |
| 334 | 334 | // Get the current module if module_srl doesn't exist |
| 335 | - if(!$args->module_srl) |
|
| 335 | + if (!$args->module_srl) |
|
| 336 | 336 | { |
| 337 | 337 | $current_module_info = Context::get('current_module_info'); |
| 338 | 338 | $args->module_srl = $current_module_info->module_srl; |
@@ -340,13 +340,13 @@ discard block |
||
| 340 | 340 | // Check if the auto-saved document already exists |
| 341 | 341 | $output = executeQuery('editor.getSavedDocument', $args); |
| 342 | 342 | $saved_doc = $output->data; |
| 343 | - if(!$saved_doc) return; |
|
| 343 | + if (!$saved_doc) return; |
|
| 344 | 344 | |
| 345 | 345 | $oDocumentModel = getModel('document'); |
| 346 | 346 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
| 347 | - if(!$oSaved->isExists()) |
|
| 347 | + if (!$oSaved->isExists()) |
|
| 348 | 348 | { |
| 349 | - if($mode) |
|
| 349 | + if ($mode) |
|
| 350 | 350 | { |
| 351 | 351 | $output = executeQuery('editor.getSavedDocument', $args); |
| 352 | 352 | $output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc); |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | $oEditorModel = getModel('editor'); |
| 375 | 375 | $args = new stdClass; |
| 376 | 376 | |
| 377 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 377 | + if ($filter_enabled) $args->enabled = "Y"; |
|
| 378 | 378 | |
| 379 | - if($site_srl) |
|
| 379 | + if ($site_srl) |
|
| 380 | 380 | { |
| 381 | 381 | $args->site_srl = $site_srl; |
| 382 | 382 | $output = executeQuery('editor.getSiteComponentList', $args); |
@@ -389,10 +389,10 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | // Get information about log-in status and its group |
| 391 | 391 | $is_logged = Context::get('is_logged'); |
| 392 | - if($is_logged) |
|
| 392 | + if ($is_logged) |
|
| 393 | 393 | { |
| 394 | 394 | $logged_info = Context::get('logged_info'); |
| 395 | - if($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 395 | + if ($logged_info->group_list && is_array($logged_info->group_list)) |
|
| 396 | 396 | { |
| 397 | 397 | $group_list = array_keys($logged_info->group_list); |
| 398 | 398 | } |
@@ -400,30 +400,30 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // Get xml information for looping DB list |
| 403 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 403 | + if (!is_array($db_list)) $db_list = array($db_list); |
|
| 404 | 404 | $component_list = new stdClass(); |
| 405 | - foreach($db_list as $component) |
|
| 405 | + foreach ($db_list as $component) |
|
| 406 | 406 | { |
| 407 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 407 | + if (in_array($component->component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 408 | 408 | |
| 409 | 409 | $component_name = $component->component_name; |
| 410 | - if(!$component_name) continue; |
|
| 410 | + if (!$component_name) continue; |
|
| 411 | 411 | |
| 412 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 412 | + if (!in_array($component_name, $downloaded_list)) continue; |
|
| 413 | 413 | |
| 414 | 414 | unset($xml_info); |
| 415 | 415 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
| 416 | 416 | $xml_info->enabled = $component->enabled; |
| 417 | 417 | |
| 418 | - if($component->extra_vars) |
|
| 418 | + if ($component->extra_vars) |
|
| 419 | 419 | { |
| 420 | 420 | $extra_vars = unserialize($component->extra_vars); |
| 421 | - if($extra_vars->target_group) |
|
| 421 | + if ($extra_vars->target_group) |
|
| 422 | 422 | { |
| 423 | 423 | $xml_info->target_group = $extra_vars->target_group; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 426 | + if ($extra_vars->mid_list && count($extra_vars->mid_list)) |
|
| 427 | 427 | { |
| 428 | 428 | $xml_info->mid_list = $extra_vars->mid_list; |
| 429 | 429 | } |
@@ -450,9 +450,9 @@ discard block |
||
| 450 | 450 | if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue; |
| 451 | 451 | }*/ |
| 452 | 452 | // Check the configuration of the editor component |
| 453 | - if($xml_info->extra_vars) |
|
| 453 | + if ($xml_info->extra_vars) |
|
| 454 | 454 | { |
| 455 | - foreach($xml_info->extra_vars as $key => $val) |
|
| 455 | + foreach ($xml_info->extra_vars as $key => $val) |
|
| 456 | 456 | { |
| 457 | 457 | $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; |
| 458 | 458 | } |
@@ -463,25 +463,25 @@ discard block |
||
| 463 | 463 | // Get buttons, icons, images |
| 464 | 464 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 465 | 465 | $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; |
| 466 | - if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 467 | - if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 466 | + if (file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 467 | + if (file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | // Return if it checks enabled only |
| 471 | - if($filter_enabled) |
|
| 471 | + if ($filter_enabled) |
|
| 472 | 472 | { |
| 473 | 473 | $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); |
| 474 | - $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list))); |
|
| 474 | + $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list))); |
|
| 475 | 475 | FileHandler::writeFile($cache_file, $buff); |
| 476 | 476 | return $component_list; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | // Get xml_info of downloaded list |
| 480 | - foreach($downloaded_list as $component_name) |
|
| 480 | + foreach ($downloaded_list as $component_name) |
|
| 481 | 481 | { |
| 482 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 482 | + if (in_array($component_name, array('colorpicker_text', 'colorpicker_bg'))) continue; |
|
| 483 | 483 | // Pass if configured |
| 484 | - if($component_list->{$component_name}) continue; |
|
| 484 | + if ($component_list->{$component_name}) continue; |
|
| 485 | 485 | // Insert data into the DB |
| 486 | 486 | $oEditorController = getAdminController('editor'); |
| 487 | 487 | $oEditorController->insertComponent($component_name, false, $site_srl); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); |
| 497 | - $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list))); |
|
| 497 | + $buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list))); |
|
| 498 | 498 | FileHandler::writeFile($cache_file, $buff); |
| 499 | 499 | |
| 500 | 500 | return $component_list; |
@@ -516,9 +516,9 @@ discard block |
||
| 516 | 516 | $editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl); |
| 517 | 517 | |
| 518 | 518 | $oModuleController = getController('module'); |
| 519 | - if(is_array($obj->moduleSrlList)) |
|
| 519 | + if (is_array($obj->moduleSrlList)) |
|
| 520 | 520 | { |
| 521 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 521 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 522 | 522 | { |
| 523 | 523 | $oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig); |
| 524 | 524 | } |
@@ -47,20 +47,31 @@ discard block |
||
| 47 | 47 | { |
| 48 | 48 | $component = Context::get('component'); |
| 49 | 49 | $method = Context::get('method'); |
| 50 | - if(!$component) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 50 | + if(!$component) { |
|
| 51 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | $oEditorModel = getModel('editor'); |
| 53 | 55 | $oComponent = &$oEditorModel->getComponentObject($component); |
| 54 | - if(!$oComponent->toBool()) return $oComponent; |
|
| 56 | + if(!$oComponent->toBool()) { |
|
| 57 | + return $oComponent; |
|
| 58 | + } |
|
| 55 | 59 | |
| 56 | - if(!method_exists($oComponent, $method)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 60 | + if(!method_exists($oComponent, $method)) { |
|
| 61 | + return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); |
|
| 62 | + } |
|
| 57 | 63 | |
| 58 | 64 | //$output = call_user_method($method, $oComponent); |
| 59 | 65 | //$output = call_user_func(array($oComponent, $method)); |
| 60 | - if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); |
|
| 61 | - else return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 66 | + if(method_exists($oComponent, $method)) { |
|
| 67 | + $output = $oComponent->{$method}(); |
|
| 68 | + } else { |
|
| 69 | + return new BaseObject(-1,sprintf('%s method is not exists', $method)); |
|
| 70 | + } |
|
| 62 | 71 | |
| 63 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) return $output; |
|
| 72 | + if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) { |
|
| 73 | + return $output; |
|
| 74 | + } |
|
| 64 | 75 | |
| 65 | 76 | $this->setError($oComponent->getError()); |
| 66 | 77 | $this->setMessage($oComponent->getMessage()); |
@@ -88,7 +99,9 @@ discard block |
||
| 88 | 99 | |
| 89 | 100 | foreach($target_module_srl as $srl) |
| 90 | 101 | { |
| 91 | - if(!$srl) continue; |
|
| 102 | + if(!$srl) { |
|
| 103 | + continue; |
|
| 104 | + } |
|
| 92 | 105 | |
| 93 | 106 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); |
| 94 | 107 | if(!$module_info->module_srl) |
@@ -118,10 +131,14 @@ discard block |
||
| 118 | 131 | for($i=0,$c=count($fonts);$i<$c;$i++) |
| 119 | 132 | { |
| 120 | 133 | $font = trim(str_replace(array('"','\''),'',$fonts[$i])); |
| 121 | - if(!$font) continue; |
|
| 134 | + if(!$font) { |
|
| 135 | + continue; |
|
| 136 | + } |
|
| 122 | 137 | $font_list[] = $font; |
| 123 | 138 | } |
| 124 | - if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 139 | + if(count($font_list)) { |
|
| 140 | + $editor_config->content_font = '"'.implode('","',$font_list).'"'; |
|
| 141 | + } |
|
| 125 | 142 | } |
| 126 | 143 | $editor_config->content_font_size = Context::get('content_font_size'); |
| 127 | 144 | $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); |
@@ -135,12 +152,10 @@ discard block |
||
| 135 | 152 | if(!$grant) |
| 136 | 153 | { |
| 137 | 154 | $editor_config->{$key} = array(); |
| 138 | - } |
|
| 139 | - else if(is_array($grant)) |
|
| 155 | + } else if(is_array($grant)) |
|
| 140 | 156 | { |
| 141 | 157 | $editor_config->{$key} = $grant; |
| 142 | - } |
|
| 143 | - else |
|
| 158 | + } else |
|
| 144 | 159 | { |
| 145 | 160 | $editor_config->{$key} = explode('|@|', $grant); |
| 146 | 161 | } |
@@ -149,7 +164,9 @@ discard block |
||
| 149 | 164 | $editor_config->editor_height = (int)Context::get('editor_height'); |
| 150 | 165 | $editor_config->comment_editor_height = (int)Context::get('comment_editor_height'); |
| 151 | 166 | $editor_config->enable_autosave = Context::get('enable_autosave'); |
| 152 | - if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N'; |
|
| 167 | + if($editor_config->enable_autosave != 'Y') { |
|
| 168 | + $editor_config->enable_autosave = 'N'; |
|
| 169 | + } |
|
| 153 | 170 | |
| 154 | 171 | $oModuleController = getController('module'); |
| 155 | 172 | foreach($module_srl as $srl) |
@@ -169,7 +186,9 @@ discard block |
||
| 169 | 186 | */ |
| 170 | 187 | function triggerEditorComponentCompile(&$content) |
| 171 | 188 | { |
| 172 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
| 189 | + if(Context::getResponseMethod()!='HTML') { |
|
| 190 | + return new BaseObject(); |
|
| 191 | + } |
|
| 173 | 192 | |
| 174 | 193 | $module_info = Context::get('module_info'); |
| 175 | 194 | $module_srl = $module_info->module_srl; |
@@ -187,13 +206,14 @@ discard block |
||
| 187 | 206 | for($i = 0, $c = count($ini); $i < $c; $i++) |
| 188 | 207 | { |
| 189 | 208 | $file = trim($ini[$i]); |
| 190 | - if(!$file) continue; |
|
| 209 | + if(!$file) { |
|
| 210 | + continue; |
|
| 211 | + } |
|
| 191 | 212 | |
| 192 | 213 | if(substr_compare($file, '.css', -4) === 0) |
| 193 | 214 | { |
| 194 | 215 | Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 195 | - } |
|
| 196 | - elseif(substr_compare($file, '.js', -3) === 0) |
|
| 216 | + } elseif(substr_compare($file, '.js', -3) === 0) |
|
| 197 | 217 | { |
| 198 | 218 | Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false); |
| 199 | 219 | } |
@@ -206,8 +226,12 @@ discard block |
||
| 206 | 226 | { |
| 207 | 227 | $buff = array(); |
| 208 | 228 | $buff[] = '<style> .xe_content { '; |
| 209 | - if($content_font) $buff[] = 'font-family:'.$content_font.';'; |
|
| 210 | - if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 229 | + if($content_font) { |
|
| 230 | + $buff[] = 'font-family:'.$content_font.';'; |
|
| 231 | + } |
|
| 232 | + if($content_font_size) { |
|
| 233 | + $buff[] = 'font-size:'.$content_font_size.';'; |
|
| 234 | + } |
|
| 211 | 235 | $buff[] = ' }</style>'; |
| 212 | 236 | Context::addHtmlHeader(implode('', $buff)); |
| 213 | 237 | } |
@@ -239,17 +263,23 @@ discard block |
||
| 239 | 263 | $xml_obj->attrs = new stdClass; |
| 240 | 264 | for($i=0,$c=count($m[0]);$i<$c;$i++) |
| 241 | 265 | { |
| 242 | - if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass; |
|
| 266 | + if(!isset($xml_obj->attrs)) { |
|
| 267 | + $xml_obj->attrs = new stdClass; |
|
| 268 | + } |
|
| 243 | 269 | $xml_obj->attrs->{$m[1][$i]} = $m[2][$i]; |
| 244 | 270 | } |
| 245 | 271 | $xml_obj->body = $match[4]; |
| 246 | 272 | |
| 247 | - if(!$xml_obj->attrs->editor_component) return $match[0]; |
|
| 273 | + if(!$xml_obj->attrs->editor_component) { |
|
| 274 | + return $match[0]; |
|
| 275 | + } |
|
| 248 | 276 | |
| 249 | 277 | // Get converted codes by using component::transHTML() |
| 250 | 278 | $oEditorModel = getModel('editor'); |
| 251 | 279 | $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); |
| 252 | - if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0]; |
|
| 280 | + if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) { |
|
| 281 | + return $match[0]; |
|
| 282 | + } |
|
| 253 | 283 | |
| 254 | 284 | return $oComponent->transHTML($xml_obj); |
| 255 | 285 | } |
@@ -259,13 +289,14 @@ discard block |
||
| 259 | 289 | */ |
| 260 | 290 | function doSaveDoc($args) |
| 261 | 291 | { |
| 262 | - if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 292 | + if(!$args->document_srl) { |
|
| 293 | + $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 294 | + } |
|
| 263 | 295 | if(Context::get('is_logged')) |
| 264 | 296 | { |
| 265 | 297 | $logged_info = Context::get('logged_info'); |
| 266 | 298 | $args->member_srl = $logged_info->member_srl; |
| 267 | - } |
|
| 268 | - else |
|
| 299 | + } else |
|
| 269 | 300 | { |
| 270 | 301 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 271 | 302 | } |
@@ -325,8 +356,7 @@ discard block |
||
| 325 | 356 | { |
| 326 | 357 | $logged_info = Context::get('logged_info'); |
| 327 | 358 | $args->member_srl = $logged_info->member_srl; |
| 328 | - } |
|
| 329 | - else |
|
| 359 | + } else |
|
| 330 | 360 | { |
| 331 | 361 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 332 | 362 | } |
@@ -340,7 +370,9 @@ discard block |
||
| 340 | 370 | // Check if the auto-saved document already exists |
| 341 | 371 | $output = executeQuery('editor.getSavedDocument', $args); |
| 342 | 372 | $saved_doc = $output->data; |
| 343 | - if(!$saved_doc) return; |
|
| 373 | + if(!$saved_doc) { |
|
| 374 | + return; |
|
| 375 | + } |
|
| 344 | 376 | |
| 345 | 377 | $oDocumentModel = getModel('document'); |
| 346 | 378 | $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); |
@@ -374,14 +406,17 @@ discard block |
||
| 374 | 406 | $oEditorModel = getModel('editor'); |
| 375 | 407 | $args = new stdClass; |
| 376 | 408 | |
| 377 | - if($filter_enabled) $args->enabled = "Y"; |
|
| 409 | + if($filter_enabled) { |
|
| 410 | + $args->enabled = "Y"; |
|
| 411 | + } |
|
| 378 | 412 | |
| 379 | 413 | if($site_srl) |
| 380 | 414 | { |
| 381 | 415 | $args->site_srl = $site_srl; |
| 382 | 416 | $output = executeQuery('editor.getSiteComponentList', $args); |
| 417 | + } else { |
|
| 418 | + $output = executeQuery('editor.getComponentList', $args); |
|
| 383 | 419 | } |
| 384 | - else $output = executeQuery('editor.getComponentList', $args); |
|
| 385 | 420 | $db_list = $output->data; |
| 386 | 421 | |
| 387 | 422 | // Get a list of files |
@@ -395,21 +430,30 @@ discard block |
||
| 395 | 430 | if($logged_info->group_list && is_array($logged_info->group_list)) |
| 396 | 431 | { |
| 397 | 432 | $group_list = array_keys($logged_info->group_list); |
| 433 | + } else { |
|
| 434 | + $group_list = array(); |
|
| 398 | 435 | } |
| 399 | - else $group_list = array(); |
|
| 400 | 436 | } |
| 401 | 437 | |
| 402 | 438 | // Get xml information for looping DB list |
| 403 | - if(!is_array($db_list)) $db_list = array($db_list); |
|
| 439 | + if(!is_array($db_list)) { |
|
| 440 | + $db_list = array($db_list); |
|
| 441 | + } |
|
| 404 | 442 | $component_list = new stdClass(); |
| 405 | 443 | foreach($db_list as $component) |
| 406 | 444 | { |
| 407 | - if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 445 | + if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 446 | + continue; |
|
| 447 | + } |
|
| 408 | 448 | |
| 409 | 449 | $component_name = $component->component_name; |
| 410 | - if(!$component_name) continue; |
|
| 450 | + if(!$component_name) { |
|
| 451 | + continue; |
|
| 452 | + } |
|
| 411 | 453 | |
| 412 | - if(!in_array($component_name, $downloaded_list)) continue; |
|
| 454 | + if(!in_array($component_name, $downloaded_list)) { |
|
| 455 | + continue; |
|
| 456 | + } |
|
| 413 | 457 | |
| 414 | 458 | unset($xml_info); |
| 415 | 459 | $xml_info = $oEditorModel->getComponentXmlInfo($component_name); |
@@ -463,8 +507,12 @@ discard block |
||
| 463 | 507 | // Get buttons, icons, images |
| 464 | 508 | $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; |
| 465 | 509 | $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; |
| 466 | - if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; |
|
| 467 | - if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; |
|
| 510 | + if(file_exists($icon_file)) { |
|
| 511 | + $component_list->{$component_name}->icon = true; |
|
| 512 | + } |
|
| 513 | + if(file_exists($component_icon_file)) { |
|
| 514 | + $component_list->{$component_name}->component_icon = true; |
|
| 515 | + } |
|
| 468 | 516 | } |
| 469 | 517 | |
| 470 | 518 | // Return if it checks enabled only |
@@ -479,9 +527,13 @@ discard block |
||
| 479 | 527 | // Get xml_info of downloaded list |
| 480 | 528 | foreach($downloaded_list as $component_name) |
| 481 | 529 | { |
| 482 | - if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; |
|
| 530 | + if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) { |
|
| 531 | + continue; |
|
| 532 | + } |
|
| 483 | 533 | // Pass if configured |
| 484 | - if($component_list->{$component_name}) continue; |
|
| 534 | + if($component_list->{$component_name}) { |
|
| 535 | + continue; |
|
| 536 | + } |
|
| 485 | 537 | // Insert data into the DB |
| 486 | 538 | $oEditorController = getAdminController('editor'); |
| 487 | 539 | $oEditorController->insertComponent($component_name, false, $site_srl); |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | function getPollList($args) |
| 21 | 21 | { |
| 22 | 22 | $output = executeQueryArray('poll.getPollList', $args); |
| 23 | - if(!$output->toBool()) return $output; |
|
| 23 | + if(!$output->toBool()) { |
|
| 24 | + return $output; |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | 27 | //if($output->data && !is_array($output->data)) $output->data = array($output->data); |
| 26 | 28 | return $output; |
@@ -32,7 +34,9 @@ discard block |
||
| 32 | 34 | function getPollListWithMember($args) |
| 33 | 35 | { |
| 34 | 36 | $output = executeQueryArray('poll.getPollListWithMember', $args); |
| 35 | - if(!$output->toBool()) return $output; |
|
| 37 | + if(!$output->toBool()) { |
|
| 38 | + return $output; |
|
| 39 | + } |
|
| 36 | 40 | |
| 37 | 41 | return $output; |
| 38 | 42 | } |
@@ -50,18 +54,20 @@ discard block |
||
| 50 | 54 | |
| 51 | 55 | $oDocument = $oDocumentModel->getDocument($upload_target_srl); |
| 52 | 56 | |
| 53 | - if(!$oDocument->isExists()) $oComment = $oCommentModel->getComment($upload_target_srl); |
|
| 57 | + if(!$oDocument->isExists()) { |
|
| 58 | + $oComment = $oCommentModel->getComment($upload_target_srl); |
|
| 59 | + } |
|
| 54 | 60 | |
| 55 | 61 | if($oComment && $oComment->isExists()) |
| 56 | 62 | { |
| 57 | 63 | $this->add('document_srl', $oComment->get('document_srl')); |
| 58 | 64 | $this->add('comment_srl', $oComment->get('comment_srl')); |
| 59 | - } |
|
| 60 | - elseif($oDocument->isExists()) |
|
| 65 | + } elseif($oDocument->isExists()) |
|
| 61 | 66 | { |
| 62 | 67 | $this->add('document_srl', $oDocument->get('document_srl')); |
| 68 | + } else { |
|
| 69 | + return new BaseObject(-1, 'msg_not_founded'); |
|
| 63 | 70 | } |
| 64 | - else return new BaseObject(-1, 'msg_not_founded'); |
|
| 65 | 71 | } |
| 66 | 72 | } |
| 67 | 73 | /* End of file poll.admin.model.php */ |
@@ -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; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $point = $config->signup_point; |
| 32 | 32 | // Increase the point |
| 33 | 33 | $cur_point += $point; |
| 34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
| 34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
| 35 | 35 | |
| 36 | 36 | return new BaseObject(); |
| 37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | function triggerAfterLogin(&$obj) |
| 43 | 43 | { |
| 44 | 44 | $member_srl = $obj->member_srl; |
| 45 | - if(!$member_srl) return new BaseObject(); |
|
| 45 | + if (!$member_srl) return new BaseObject(); |
|
| 46 | 46 | // If the last login is not today, give the points |
| 47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
| 47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new BaseObject(); |
|
| 48 | 48 | // Get the point module information |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $point = $config->login_point; |
| 56 | 56 | // Increase the point |
| 57 | 57 | $cur_point += $point; |
| 58 | - $this->setPoint($member_srl,$cur_point); |
|
| 58 | + $this->setPoint($member_srl, $cur_point); |
|
| 59 | 59 | |
| 60 | 60 | return new BaseObject(); |
| 61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
| 66 | 66 | function triggerInsertDocument(&$obj) |
| 67 | 67 | { |
| 68 | 68 | $oDocumentModel = getModel('document'); |
| 69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 70 | 70 | { |
| 71 | 71 | $module_srl = $obj->module_srl; |
| 72 | 72 | $member_srl = $obj->member_srl; |
| 73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 73 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 74 | 74 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
| 75 | + if ($module_srl == $member_srl) return new BaseObject(); |
|
| 76 | 76 | // Get the point module information |
| 77 | 77 | $oModuleModel = getModel('module'); |
| 78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
| 79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
| 79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
| 80 | 80 | // Get the points of the member |
| 81 | 81 | $oPointModel = getModel('point'); |
| 82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 83 | 83 | |
| 84 | 84 | $point = $module_config['insert_document']; |
| 85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 86 | 86 | $cur_point += $point; |
| 87 | 87 | // Add points for attaching a file |
| 88 | 88 | $point = $module_config['upload_file']; |
| 89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 91 | 91 | // Increase the point |
| 92 | - $this->setPoint($member_srl,$cur_point); |
|
| 92 | + $this->setPoint($member_srl, $cur_point); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return new BaseObject(); |
@@ -106,24 +106,24 @@ discard block |
||
| 106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 107 | 107 | |
| 108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
| 109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 110 | 110 | { |
| 111 | 111 | $oModuleModel = getModel('module'); |
| 112 | 112 | |
| 113 | 113 | // Get the point module information |
| 114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
| 115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
| 115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
| 116 | 116 | // Get the points of the member |
| 117 | 117 | $oPointModel = getModel('point'); |
| 118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
| 119 | 119 | |
| 120 | 120 | $point = $module_config['insert_document']; |
| 121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 122 | 122 | $cur_point += $point; |
| 123 | 123 | // Add points for attaching a file |
| 124 | 124 | $point = $module_config['upload_file']; |
| 125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 127 | 127 | // Increase the point |
| 128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
| 129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $oDocumentModel = getModel('document'); |
| 143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 144 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
| 145 | 145 | // Get the point module information |
| 146 | 146 | $oModuleModel = getModel('module'); |
| 147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
| 148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
| 148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
| 149 | 149 | // The process related to clearing the post comments |
| 150 | 150 | $comment_point = $module_config['insert_comment']; |
| 151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 152 | 152 | // If there are comment points, attempt to deduct |
| 153 | - if($comment_point>0) return new BaseObject(); |
|
| 153 | + if ($comment_point > 0) return new BaseObject(); |
|
| 154 | 154 | // Get all the comments related to this post |
| 155 | 155 | $cp_args = new stdClass(); |
| 156 | 156 | $cp_args->document_srl = $document_srl; |
| 157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
| 158 | 158 | // Return if there is no object |
| 159 | - if(!$output->data) return new BaseObject(); |
|
| 159 | + if (!$output->data) return new BaseObject(); |
|
| 160 | 160 | // Organize the member number |
| 161 | 161 | $member_srls = array(); |
| 162 | 162 | $cnt = count($output->data); |
| 163 | - for($i=0;$i<$cnt;$i++) |
|
| 163 | + for ($i = 0; $i < $cnt; $i++) |
|
| 164 | 164 | { |
| 165 | - if($output->data[$i]->member_srl<1) continue; |
|
| 165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
| 166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
| 167 | 167 | } |
| 168 | 168 | // Remove the member number who has written the original post |
| 169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | - if(!count($member_srls)) return new BaseObject(); |
|
| 169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | + if (!count($member_srls)) return new BaseObject(); |
|
| 171 | 171 | // Remove all the points for each member |
| 172 | 172 | $oPointModel = getModel('point'); |
| 173 | 173 | // Get the points |
| 174 | 174 | $point = $module_config['download_file']; |
| 175 | - foreach($member_srls as $member_srl => $cnt) |
|
| 175 | + foreach ($member_srls as $member_srl => $cnt) |
|
| 176 | 176 | { |
| 177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 178 | 178 | $cur_point -= $cnt * $comment_point; |
| 179 | - $this->setPoint($member_srl,$cur_point); |
|
| 179 | + $this->setPoint($member_srl, $cur_point); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | return new BaseObject(); |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | $oDocumentModel = getModel('document'); |
| 191 | 191 | |
| 192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 193 | 193 | { |
| 194 | 194 | $module_srl = $obj->module_srl; |
| 195 | 195 | $member_srl = $obj->member_srl; |
| 196 | 196 | // The process related to clearing the post object |
| 197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 197 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 198 | 198 | // Run only when logged in |
| 199 | 199 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 200 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
| 201 | 201 | // Get the points of the member |
| 202 | 202 | $oPointModel = getModel('point'); |
| 203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 208 | 208 | |
| 209 | 209 | $point = $module_config['insert_document']; |
| 210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
| 212 | - if($point < 0) return new BaseObject(); |
|
| 212 | + if ($point < 0) return new BaseObject(); |
|
| 213 | 213 | $cur_point -= $point; |
| 214 | 214 | // Add points related to deleting an attachment |
| 215 | 215 | $point = $module_config['upload_file']; |
| 216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
| 216 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 217 | + if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
| 218 | 218 | // Increase the point |
| 219 | - $this->setPoint($member_srl,$cur_point); |
|
| 219 | + $this->setPoint($member_srl, $cur_point); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | return new BaseObject(); |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | { |
| 230 | 230 | $module_srl = $obj->module_srl; |
| 231 | 231 | $member_srl = $obj->member_srl; |
| 232 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 232 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 233 | 233 | // Do not increase the points if the member is the author of the post |
| 234 | 234 | $document_srl = $obj->document_srl; |
| 235 | 235 | $oDocumentModel = getModel('document'); |
| 236 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
| 237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new BaseObject(); |
|
| 238 | 238 | // Get the point module information |
| 239 | 239 | $oModuleModel = getModel('module'); |
| 240 | 240 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 245 | 245 | |
| 246 | 246 | $point = $module_config['insert_comment']; |
| 247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 247 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 248 | 248 | // Increase the point |
| 249 | 249 | $cur_point += $point; |
| 250 | - $this->setPoint($member_srl,$cur_point); |
|
| 250 | + $this->setPoint($member_srl, $cur_point); |
|
| 251 | 251 | |
| 252 | 252 | return new BaseObject(); |
| 253 | 253 | } |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | $module_srl = $obj->module_srl; |
| 265 | 265 | $member_srl = abs($obj->member_srl); |
| 266 | 266 | $document_srl = $obj->document_srl; |
| 267 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 267 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 268 | 268 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
| 269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 270 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 271 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
| 270 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
| 271 | + if ($oDocument->get('member_srl') == $member_srl) return new BaseObject(); |
|
| 272 | 272 | // Get the point module information |
| 273 | 273 | $config = $oModuleModel->getModuleConfig('point'); |
| 274 | 274 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,12 +276,12 @@ discard block |
||
| 276 | 276 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 277 | 277 | |
| 278 | 278 | $point = $module_config['insert_comment']; |
| 279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 279 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 280 | 280 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
| 281 | - if($point < 0) return new BaseObject(); |
|
| 281 | + if ($point < 0) return new BaseObject(); |
|
| 282 | 282 | // Increase the point |
| 283 | 283 | $cur_point -= $point; |
| 284 | - $this->setPoint($member_srl,$cur_point); |
|
| 284 | + $this->setPoint($member_srl, $cur_point); |
|
| 285 | 285 | |
| 286 | 286 | return new BaseObject(); |
| 287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function triggerDeleteFile(&$obj) |
| 303 | 303 | { |
| 304 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
| 304 | + if ($obj->isvalid != 'Y') return new BaseObject(); |
|
| 305 | 305 | |
| 306 | 306 | $module_srl = $obj->module_srl; |
| 307 | 307 | $member_srl = $obj->member_srl; |
| 308 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 308 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 309 | 309 | // Get the point module information |
| 310 | 310 | $oModuleModel = getModel('module'); |
| 311 | 311 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 316 | 316 | |
| 317 | 317 | $point = $module_config['upload_file']; |
| 318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 318 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 319 | 319 | // Increase the point |
| 320 | 320 | $cur_point -= $point; |
| 321 | - $this->setPoint($member_srl,$cur_point); |
|
| 321 | + $this->setPoint($member_srl, $cur_point); |
|
| 322 | 322 | |
| 323 | 323 | return new BaseObject(); |
| 324 | 324 | } |
@@ -331,10 +331,10 @@ discard block |
||
| 331 | 331 | $logged_info = Context::get('logged_info'); |
| 332 | 332 | $member_srl = $logged_info->member_srl; |
| 333 | 333 | $module_srl = $obj->module_srl; |
| 334 | - if(!$module_srl) return new BaseObject(); |
|
| 334 | + if (!$module_srl) return new BaseObject(); |
|
| 335 | 335 | |
| 336 | 336 | // Pass if it is your file |
| 337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 337 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 338 | 338 | $oModuleModel = getModel('module'); |
| 339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
| 340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | // If the user is not logged in and download requires points, deny access. |
| 351 | - if(!Context::get('is_logged')) |
|
| 351 | + if (!Context::get('is_logged')) |
|
| 352 | 352 | { |
| 353 | - if($config->disable_download == 'Y' && $point) |
|
| 353 | + if ($config->disable_download == 'Y' && $point) |
|
| 354 | 354 | { |
| 355 | - return new BaseObject(-1,'msg_not_permitted_download'); |
|
| 355 | + return new BaseObject(-1, 'msg_not_permitted_download'); |
|
| 356 | 356 | } |
| 357 | 357 | else |
| 358 | 358 | { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | // If the member does not have enough points, deny access. |
| 368 | 368 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
| 369 | 369 | { |
| 370 | - return new BaseObject(-1,'msg_cannot_download'); |
|
| 370 | + return new BaseObject(-1, 'msg_cannot_download'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -381,13 +381,13 @@ discard block |
||
| 381 | 381 | { |
| 382 | 382 | // Run only when logged in |
| 383 | 383 | $logged_info = Context::get('logged_info'); |
| 384 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 384 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
| 385 | 385 | $module_srl = $obj->module_srl; |
| 386 | 386 | $member_srl = $logged_info->member_srl; |
| 387 | - if(!$module_srl) return new BaseObject(); |
|
| 387 | + if (!$module_srl) return new BaseObject(); |
|
| 388 | 388 | |
| 389 | 389 | // Pass if it is your file |
| 390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 390 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 391 | 391 | |
| 392 | 392 | // Get the point module information |
| 393 | 393 | $oModuleModel = getModel('module'); |
@@ -428,22 +428,22 @@ discard block |
||
| 428 | 428 | // Get the original author number |
| 429 | 429 | $target_member_srl = abs($obj->get('member_srl')); |
| 430 | 430 | // Pass without increasing the hits if the viewer is the same as the author |
| 431 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
| 431 | + if ($target_member_srl == $member_srl) return new BaseObject(); |
|
| 432 | 432 | // Get the point information for each module |
| 433 | 433 | $config = $oModuleModel->getModuleConfig('point'); |
| 434 | 434 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 435 | 435 | // Get hits points |
| 436 | 436 | $point = $module_config['read_document']; |
| 437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 437 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 438 | 438 | // Pass if there are no requested points |
| 439 | - if(!$point) return new BaseObject(); |
|
| 439 | + if (!$point) return new BaseObject(); |
|
| 440 | 440 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 441 | - if($member_srl) |
|
| 441 | + if ($member_srl) |
|
| 442 | 442 | { |
| 443 | 443 | $args->member_srl = $member_srl; |
| 444 | 444 | $args->document_srl = $obj->document_srl; |
| 445 | 445 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 446 | - if($output->data->count) return new BaseObject(); |
|
| 446 | + if ($output->data->count) return new BaseObject(); |
|
| 447 | 447 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 448 | 448 | } |
| 449 | 449 | else |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $config = $oModuleModel->getModuleConfig('point'); |
| 455 | 455 | // When the requested points are negative, compared it with the current point |
| 456 | 456 | $_SESSION['banned_document'][$obj->document_srl] = false; |
| 457 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
| 457 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
| 458 | 458 | { |
| 459 | 459 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
| 460 | 460 | $obj->add('content', $message); |
@@ -462,14 +462,14 @@ discard block |
||
| 462 | 462 | return new BaseObject(-1, $message); |
| 463 | 463 | } |
| 464 | 464 | // If not logged in, pass |
| 465 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 465 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
| 466 | 466 | // Pass, if there are no requested points |
| 467 | - if(!$point) return new BaseObject(); |
|
| 467 | + if (!$point) return new BaseObject(); |
|
| 468 | 468 | // If the read record is missing, leave it |
| 469 | 469 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 470 | 470 | // Increase the point |
| 471 | 471 | $cur_point += $point; |
| 472 | - $this->setPoint($member_srl,$cur_point); |
|
| 472 | + $this->setPoint($member_srl, $cur_point); |
|
| 473 | 473 | |
| 474 | 474 | return new BaseObject(); |
| 475 | 475 | } |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | { |
| 482 | 482 | $module_srl = $obj->module_srl; |
| 483 | 483 | $member_srl = $obj->member_srl; |
| 484 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 484 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
| 485 | 485 | |
| 486 | 486 | $oModuleModel = getModel('module'); |
| 487 | 487 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -490,21 +490,21 @@ discard block |
||
| 490 | 490 | $oPointModel = getModel('point'); |
| 491 | 491 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 492 | 492 | |
| 493 | - if( $obj->point > 0 ) |
|
| 493 | + if ($obj->point > 0) |
|
| 494 | 494 | { |
| 495 | 495 | $point = $module_config['voted']; |
| 496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 496 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 497 | 497 | } |
| 498 | 498 | else |
| 499 | 499 | { |
| 500 | 500 | $point = $module_config['blamed']; |
| 501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 501 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - if(!$point) return new BaseObject(); |
|
| 504 | + if (!$point) return new BaseObject(); |
|
| 505 | 505 | // Increase the point |
| 506 | 506 | $cur_point += $point; |
| 507 | - $this->setPoint($member_srl,$cur_point); |
|
| 507 | + $this->setPoint($member_srl, $cur_point); |
|
| 508 | 508 | |
| 509 | 509 | return new BaseObject(); |
| 510 | 510 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | { |
| 517 | 517 | $member_srl = abs($member_srl); |
| 518 | 518 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 519 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
| 520 | 520 | |
| 521 | 521 | // Get configuration information |
| 522 | 522 | $oMemberModel = getModel('member'); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | $args->member_srl = $member_srl; |
| 534 | 534 | $args->point = $current_point; |
| 535 | 535 | |
| 536 | - switch($mode) |
|
| 536 | + switch ($mode) |
|
| 537 | 537 | { |
| 538 | 538 | case 'add' : |
| 539 | 539 | $args->point += $point; |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $args->point = $point; |
| 547 | 547 | break; |
| 548 | 548 | } |
| 549 | - if($args->point < 0) $args->point = 0; |
|
| 549 | + if ($args->point < 0) $args->point = 0; |
|
| 550 | 550 | $point = $args->point; |
| 551 | 551 | |
| 552 | 552 | // Call a trigger (before) |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | $trigger_obj->current_level = $current_level; |
| 558 | 558 | $trigger_obj->set_point = $point; |
| 559 | 559 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
| 560 | - if(!$trigger_output->toBool()) |
|
| 560 | + if (!$trigger_output->toBool()) |
|
| 561 | 561 | { |
| 562 | 562 | return $trigger_output; |
| 563 | 563 | } |
@@ -568,19 +568,19 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | // If there are points, update, if no, insert |
| 570 | 570 | $oPointModel = getModel('point'); |
| 571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 571 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 572 | 572 | else executeQuery("point.insertPoint", $args); |
| 573 | 573 | |
| 574 | 574 | // Get a new level |
| 575 | 575 | $level = $oPointModel->getLevel($point, $config->level_step); |
| 576 | 576 | |
| 577 | 577 | // If existing level and a new one are different attempt to set a point group |
| 578 | - if($level != $current_level) |
|
| 578 | + if ($level != $current_level) |
|
| 579 | 579 | { |
| 580 | 580 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
| 581 | 581 | $point_group = $config->point_group; |
| 582 | 582 | // If the point group exists |
| 583 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
| 583 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
| 584 | 584 | { |
| 585 | 585 | // Get the default group |
| 586 | 586 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -590,29 +590,29 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | asort($point_group); |
| 592 | 592 | // Reset group after initialization |
| 593 | - if($config->group_reset != 'N') |
|
| 593 | + if ($config->group_reset != 'N') |
|
| 594 | 594 | { |
| 595 | 595 | // If the new level is in the right group |
| 596 | - if(in_array($level, $point_group)) |
|
| 596 | + if (in_array($level, $point_group)) |
|
| 597 | 597 | { |
| 598 | 598 | // Delete all groups except the one which the current level belongs to |
| 599 | - foreach($point_group as $group_srl => $target_level) |
|
| 599 | + foreach ($point_group as $group_srl => $target_level) |
|
| 600 | 600 | { |
| 601 | 601 | $del_group_list[] = $group_srl; |
| 602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 602 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | // Otherwise, in case the level is reduced, add the recent group |
| 606 | 606 | else |
| 607 | 607 | { |
| 608 | 608 | $i = $level; |
| 609 | - while($i > 0) |
|
| 609 | + while ($i > 0) |
|
| 610 | 610 | { |
| 611 | - if(in_array($i, $point_group)) |
|
| 611 | + if (in_array($i, $point_group)) |
|
| 612 | 612 | { |
| 613 | - foreach($point_group as $group_srl => $target_level) |
|
| 613 | + foreach ($point_group as $group_srl => $target_level) |
|
| 614 | 614 | { |
| 615 | - if($target_level == $i) |
|
| 615 | + if ($target_level == $i) |
|
| 616 | 616 | { |
| 617 | 617 | $new_group_list[] = $group_srl; |
| 618 | 618 | } |
@@ -623,9 +623,9 @@ discard block |
||
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | // Delete the group of a level which is higher than the current level |
| 626 | - foreach($point_group as $group_srl => $target_level) |
|
| 626 | + foreach ($point_group as $group_srl => $target_level) |
|
| 627 | 627 | { |
| 628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 628 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
| 629 | 629 | } |
| 630 | 630 | $del_group_list[] = $default_group->group_srl; |
| 631 | 631 | } |
@@ -633,16 +633,16 @@ discard block |
||
| 633 | 633 | else |
| 634 | 634 | { |
| 635 | 635 | // Check until the current level by rotating setting the configurations of the point groups |
| 636 | - foreach($point_group as $group_srl => $target_level) |
|
| 636 | + foreach ($point_group as $group_srl => $target_level) |
|
| 637 | 637 | { |
| 638 | 638 | $del_group_list[] = $group_srl; |
| 639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 639 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | // If there is no a new group, granted the default group |
| 643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 643 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 644 | 644 | // Remove linkage group |
| 645 | - if($del_group_list && count($del_group_list)) |
|
| 645 | + if ($del_group_list && count($del_group_list)) |
|
| 646 | 646 | { |
| 647 | 647 | $del_group_args = new stdClass; |
| 648 | 648 | $del_group_args->member_srl = $member_srl; |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
| 651 | 651 | } |
| 652 | 652 | // Grant a new group |
| 653 | - foreach($new_group_list as $group_srl) |
|
| 653 | + foreach ($new_group_list as $group_srl) |
|
| 654 | 654 | { |
| 655 | 655 | $new_group_args = new stdClass; |
| 656 | 656 | $new_group_args->member_srl = $member_srl; |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | $trigger_obj->del_group_list = $del_group_list; |
| 666 | 666 | $trigger_obj->new_level = $level; |
| 667 | 667 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
| 668 | - if(!$trigger_output->toBool()) |
|
| 668 | + if (!$trigger_output->toBool()) |
|
| 669 | 669 | { |
| 670 | 670 | $oDB->rollback(); |
| 671 | 671 | return $trigger_output; |
@@ -681,17 +681,17 @@ discard block |
||
| 681 | 681 | FileHandler::writeFile($cache_filename, $point); |
| 682 | 682 | |
| 683 | 683 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 684 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 684 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 685 | 685 | { |
| 686 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 686 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 687 | 687 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 688 | 688 | $oCacheHandler->delete($cache_key); |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 692 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 692 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 693 | 693 | { |
| 694 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 694 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 695 | 695 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 696 | 696 | $oCacheHandler->delete($cache_key); |
| 697 | 697 | } |
@@ -705,9 +705,9 @@ discard block |
||
| 705 | 705 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
| 706 | 706 | |
| 707 | 707 | $oModuleController = getController('module'); |
| 708 | - if(is_array($obj->moduleSrlList)) |
|
| 708 | + if (is_array($obj->moduleSrlList)) |
|
| 709 | 709 | { |
| 710 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 710 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 711 | 711 | { |
| 712 | 712 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
| 713 | 713 | } |
@@ -42,9 +42,13 @@ discard block |
||
| 42 | 42 | function triggerAfterLogin(&$obj) |
| 43 | 43 | { |
| 44 | 44 | $member_srl = $obj->member_srl; |
| 45 | - if(!$member_srl) return new BaseObject(); |
|
| 45 | + if(!$member_srl) { |
|
| 46 | + return new BaseObject(); |
|
| 47 | + } |
|
| 46 | 48 | // If the last login is not today, give the points |
| 47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
| 49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
| 50 | + return new BaseObject(); |
|
| 51 | + } |
|
| 48 | 52 | // Get the point module information |
| 49 | 53 | $oModuleModel = getModel('module'); |
| 50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
| 70 | 74 | { |
| 71 | 75 | $module_srl = $obj->module_srl; |
| 72 | 76 | $member_srl = $obj->member_srl; |
| 73 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 77 | + if(!$module_srl || !$member_srl) { |
|
| 78 | + return new BaseObject(); |
|
| 79 | + } |
|
| 74 | 80 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
| 81 | + if($module_srl == $member_srl) { |
|
| 82 | + return new BaseObject(); |
|
| 83 | + } |
|
| 76 | 84 | // Get the point module information |
| 77 | 85 | $oModuleModel = getModel('module'); |
| 78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
| 82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 83 | 91 | |
| 84 | 92 | $point = $module_config['insert_document']; |
| 85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 94 | + $point = $config->insert_document; |
|
| 95 | + } |
|
| 86 | 96 | $cur_point += $point; |
| 87 | 97 | // Add points for attaching a file |
| 88 | 98 | $point = $module_config['upload_file']; |
| 89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 100 | + $point = $config->upload_file; |
|
| 101 | + } |
|
| 102 | + if($obj->uploaded_count) { |
|
| 103 | + $cur_point += $point * $obj->uploaded_count; |
|
| 104 | + } |
|
| 91 | 105 | // Increase the point |
| 92 | 106 | $this->setPoint($member_srl,$cur_point); |
| 93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
| 118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
| 119 | 133 | |
| 120 | 134 | $point = $module_config['insert_document']; |
| 121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 136 | + $point = $config->insert_document; |
|
| 137 | + } |
|
| 122 | 138 | $cur_point += $point; |
| 123 | 139 | // Add points for attaching a file |
| 124 | 140 | $point = $module_config['upload_file']; |
| 125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 142 | + $point = $config->upload_file; |
|
| 143 | + } |
|
| 144 | + if($obj->uploaded_count) { |
|
| 145 | + $cur_point += $point * $obj->uploaded_count; |
|
| 146 | + } |
|
| 127 | 147 | // Increase the point |
| 128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
| 129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
| 141 | 161 | |
| 142 | 162 | $oDocumentModel = getModel('document'); |
| 143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 144 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 164 | + if(!$oDocument->isExists()) { |
|
| 165 | + return new BaseObject(); |
|
| 166 | + } |
|
| 145 | 167 | // Get the point module information |
| 146 | 168 | $oModuleModel = getModel('module'); |
| 147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
| 148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
| 149 | 171 | // The process related to clearing the post comments |
| 150 | 172 | $comment_point = $module_config['insert_comment']; |
| 151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
| 174 | + $comment_point = $config->insert_comment; |
|
| 175 | + } |
|
| 152 | 176 | // If there are comment points, attempt to deduct |
| 153 | - if($comment_point>0) return new BaseObject(); |
|
| 177 | + if($comment_point>0) { |
|
| 178 | + return new BaseObject(); |
|
| 179 | + } |
|
| 154 | 180 | // Get all the comments related to this post |
| 155 | 181 | $cp_args = new stdClass(); |
| 156 | 182 | $cp_args->document_srl = $document_srl; |
| 157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
| 158 | 184 | // Return if there is no object |
| 159 | - if(!$output->data) return new BaseObject(); |
|
| 185 | + if(!$output->data) { |
|
| 186 | + return new BaseObject(); |
|
| 187 | + } |
|
| 160 | 188 | // Organize the member number |
| 161 | 189 | $member_srls = array(); |
| 162 | 190 | $cnt = count($output->data); |
| 163 | 191 | for($i=0;$i<$cnt;$i++) |
| 164 | 192 | { |
| 165 | - if($output->data[$i]->member_srl<1) continue; |
|
| 193 | + if($output->data[$i]->member_srl<1) { |
|
| 194 | + continue; |
|
| 195 | + } |
|
| 166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
| 167 | 197 | } |
| 168 | 198 | // Remove the member number who has written the original post |
| 169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | - if(!count($member_srls)) return new BaseObject(); |
|
| 199 | + if($member_srl) { |
|
| 200 | + unset($member_srls[abs($member_srl)]); |
|
| 201 | + } |
|
| 202 | + if(!count($member_srls)) { |
|
| 203 | + return new BaseObject(); |
|
| 204 | + } |
|
| 171 | 205 | // Remove all the points for each member |
| 172 | 206 | $oPointModel = getModel('point'); |
| 173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
| 194 | 228 | $module_srl = $obj->module_srl; |
| 195 | 229 | $member_srl = $obj->member_srl; |
| 196 | 230 | // The process related to clearing the post object |
| 197 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 231 | + if(!$module_srl || !$member_srl) { |
|
| 232 | + return new BaseObject(); |
|
| 233 | + } |
|
| 198 | 234 | // Run only when logged in |
| 199 | 235 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 236 | + if(!$logged_info->member_srl) { |
|
| 237 | + return new BaseObject(); |
|
| 238 | + } |
|
| 201 | 239 | // Get the points of the member |
| 202 | 240 | $oPointModel = getModel('point'); |
| 203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,14 +245,22 @@ discard block |
||
| 207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 208 | 246 | |
| 209 | 247 | $point = $module_config['insert_document']; |
| 210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 249 | + $point = $config->insert_document; |
|
| 250 | + } |
|
| 211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
| 212 | - if($point < 0) return new BaseObject(); |
|
| 252 | + if($point < 0) { |
|
| 253 | + return new BaseObject(); |
|
| 254 | + } |
|
| 213 | 255 | $cur_point -= $point; |
| 214 | 256 | // Add points related to deleting an attachment |
| 215 | 257 | $point = $module_config['upload_file']; |
| 216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
| 258 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 259 | + $point = $config->upload_file; |
|
| 260 | + } |
|
| 261 | + if($obj->uploaded_count) { |
|
| 262 | + $cur_point -= $point * $obj->uploaded_count; |
|
| 263 | + } |
|
| 218 | 264 | // Increase the point |
| 219 | 265 | $this->setPoint($member_srl,$cur_point); |
| 220 | 266 | } |
@@ -229,12 +275,16 @@ discard block |
||
| 229 | 275 | { |
| 230 | 276 | $module_srl = $obj->module_srl; |
| 231 | 277 | $member_srl = $obj->member_srl; |
| 232 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 278 | + if(!$module_srl || !$member_srl) { |
|
| 279 | + return new BaseObject(); |
|
| 280 | + } |
|
| 233 | 281 | // Do not increase the points if the member is the author of the post |
| 234 | 282 | $document_srl = $obj->document_srl; |
| 235 | 283 | $oDocumentModel = getModel('document'); |
| 236 | 284 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
| 285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
| 286 | + return new BaseObject(); |
|
| 287 | + } |
|
| 238 | 288 | // Get the point module information |
| 239 | 289 | $oModuleModel = getModel('module'); |
| 240 | 290 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,7 +294,9 @@ discard block |
||
| 244 | 294 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 245 | 295 | |
| 246 | 296 | $point = $module_config['insert_comment']; |
| 247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 297 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 298 | + $point = $config->insert_comment; |
|
| 299 | + } |
|
| 248 | 300 | // Increase the point |
| 249 | 301 | $cur_point += $point; |
| 250 | 302 | $this->setPoint($member_srl,$cur_point); |
@@ -264,11 +316,17 @@ discard block |
||
| 264 | 316 | $module_srl = $obj->module_srl; |
| 265 | 317 | $member_srl = abs($obj->member_srl); |
| 266 | 318 | $document_srl = $obj->document_srl; |
| 267 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 319 | + if(!$module_srl || !$member_srl) { |
|
| 320 | + return new BaseObject(); |
|
| 321 | + } |
|
| 268 | 322 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
| 269 | 323 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 270 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
| 271 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
| 324 | + if(!$oDocument->isExists()) { |
|
| 325 | + return new BaseObject(); |
|
| 326 | + } |
|
| 327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
| 328 | + return new BaseObject(); |
|
| 329 | + } |
|
| 272 | 330 | // Get the point module information |
| 273 | 331 | $config = $oModuleModel->getModuleConfig('point'); |
| 274 | 332 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,9 +334,13 @@ discard block |
||
| 276 | 334 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 277 | 335 | |
| 278 | 336 | $point = $module_config['insert_comment']; |
| 279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 337 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 338 | + $point = $config->insert_comment; |
|
| 339 | + } |
|
| 280 | 340 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
| 281 | - if($point < 0) return new BaseObject(); |
|
| 341 | + if($point < 0) { |
|
| 342 | + return new BaseObject(); |
|
| 343 | + } |
|
| 282 | 344 | // Increase the point |
| 283 | 345 | $cur_point -= $point; |
| 284 | 346 | $this->setPoint($member_srl,$cur_point); |
@@ -301,11 +363,15 @@ discard block |
||
| 301 | 363 | */ |
| 302 | 364 | function triggerDeleteFile(&$obj) |
| 303 | 365 | { |
| 304 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
| 366 | + if($obj->isvalid != 'Y') { |
|
| 367 | + return new BaseObject(); |
|
| 368 | + } |
|
| 305 | 369 | |
| 306 | 370 | $module_srl = $obj->module_srl; |
| 307 | 371 | $member_srl = $obj->member_srl; |
| 308 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 372 | + if(!$module_srl || !$member_srl) { |
|
| 373 | + return new BaseObject(); |
|
| 374 | + } |
|
| 309 | 375 | // Get the point module information |
| 310 | 376 | $oModuleModel = getModel('module'); |
| 311 | 377 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,7 +381,9 @@ discard block |
||
| 315 | 381 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 316 | 382 | |
| 317 | 383 | $point = $module_config['upload_file']; |
| 318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 384 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 385 | + $point = $config->upload_file; |
|
| 386 | + } |
|
| 319 | 387 | // Increase the point |
| 320 | 388 | $cur_point -= $point; |
| 321 | 389 | $this->setPoint($member_srl,$cur_point); |
@@ -331,18 +399,21 @@ discard block |
||
| 331 | 399 | $logged_info = Context::get('logged_info'); |
| 332 | 400 | $member_srl = $logged_info->member_srl; |
| 333 | 401 | $module_srl = $obj->module_srl; |
| 334 | - if(!$module_srl) return new BaseObject(); |
|
| 402 | + if(!$module_srl) { |
|
| 403 | + return new BaseObject(); |
|
| 404 | + } |
|
| 335 | 405 | |
| 336 | 406 | // Pass if it is your file |
| 337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 407 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
| 408 | + return new BaseObject(); |
|
| 409 | + } |
|
| 338 | 410 | $oModuleModel = getModel('module'); |
| 339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
| 340 | 412 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 341 | 413 | if (isset($module_config['download_file'])) |
| 342 | 414 | { |
| 343 | 415 | $point = intval($module_config['download_file']); |
| 344 | - } |
|
| 345 | - else |
|
| 416 | + } else |
|
| 346 | 417 | { |
| 347 | 418 | $point = intval($config->download_file); |
| 348 | 419 | } |
@@ -353,8 +424,7 @@ discard block |
||
| 353 | 424 | if($config->disable_download == 'Y' && $point) |
| 354 | 425 | { |
| 355 | 426 | return new BaseObject(-1,'msg_not_permitted_download'); |
| 356 | - } |
|
| 357 | - else |
|
| 427 | + } else |
|
| 358 | 428 | { |
| 359 | 429 | return new BaseObject(); |
| 360 | 430 | } |
@@ -381,13 +451,19 @@ discard block |
||
| 381 | 451 | { |
| 382 | 452 | // Run only when logged in |
| 383 | 453 | $logged_info = Context::get('logged_info'); |
| 384 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 454 | + if(!$logged_info->member_srl) { |
|
| 455 | + return new BaseObject(); |
|
| 456 | + } |
|
| 385 | 457 | $module_srl = $obj->module_srl; |
| 386 | 458 | $member_srl = $logged_info->member_srl; |
| 387 | - if(!$module_srl) return new BaseObject(); |
|
| 459 | + if(!$module_srl) { |
|
| 460 | + return new BaseObject(); |
|
| 461 | + } |
|
| 388 | 462 | |
| 389 | 463 | // Pass if it is your file |
| 390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
| 464 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
| 465 | + return new BaseObject(); |
|
| 466 | + } |
|
| 391 | 467 | |
| 392 | 468 | // Get the point module information |
| 393 | 469 | $oModuleModel = getModel('module'); |
@@ -396,8 +472,7 @@ discard block |
||
| 396 | 472 | if (isset($module_config['download_file'])) |
| 397 | 473 | { |
| 398 | 474 | $point = intval($module_config['download_file']); |
| 399 | - } |
|
| 400 | - else |
|
| 475 | + } else |
|
| 401 | 476 | { |
| 402 | 477 | $point = intval($config->download_file); |
| 403 | 478 | } |
@@ -428,25 +503,32 @@ discard block |
||
| 428 | 503 | // Get the original author number |
| 429 | 504 | $target_member_srl = abs($obj->get('member_srl')); |
| 430 | 505 | // Pass without increasing the hits if the viewer is the same as the author |
| 431 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
| 506 | + if($target_member_srl == $member_srl) { |
|
| 507 | + return new BaseObject(); |
|
| 508 | + } |
|
| 432 | 509 | // Get the point information for each module |
| 433 | 510 | $config = $oModuleModel->getModuleConfig('point'); |
| 434 | 511 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 435 | 512 | // Get hits points |
| 436 | 513 | $point = $module_config['read_document']; |
| 437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 514 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 515 | + $point = $config->read_document; |
|
| 516 | + } |
|
| 438 | 517 | // Pass if there are no requested points |
| 439 | - if(!$point) return new BaseObject(); |
|
| 518 | + if(!$point) { |
|
| 519 | + return new BaseObject(); |
|
| 520 | + } |
|
| 440 | 521 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 441 | 522 | if($member_srl) |
| 442 | 523 | { |
| 443 | 524 | $args->member_srl = $member_srl; |
| 444 | 525 | $args->document_srl = $obj->document_srl; |
| 445 | 526 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 446 | - if($output->data->count) return new BaseObject(); |
|
| 527 | + if($output->data->count) { |
|
| 528 | + return new BaseObject(); |
|
| 529 | + } |
|
| 447 | 530 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 448 | - } |
|
| 449 | - else |
|
| 531 | + } else |
|
| 450 | 532 | { |
| 451 | 533 | $cur_point = 0; |
| 452 | 534 | } |
@@ -462,9 +544,13 @@ discard block |
||
| 462 | 544 | return new BaseObject(-1, $message); |
| 463 | 545 | } |
| 464 | 546 | // If not logged in, pass |
| 465 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
| 547 | + if(!$logged_info->member_srl) { |
|
| 548 | + return new BaseObject(); |
|
| 549 | + } |
|
| 466 | 550 | // Pass, if there are no requested points |
| 467 | - if(!$point) return new BaseObject(); |
|
| 551 | + if(!$point) { |
|
| 552 | + return new BaseObject(); |
|
| 553 | + } |
|
| 468 | 554 | // If the read record is missing, leave it |
| 469 | 555 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 470 | 556 | // Increase the point |
@@ -481,7 +567,9 @@ discard block |
||
| 481 | 567 | { |
| 482 | 568 | $module_srl = $obj->module_srl; |
| 483 | 569 | $member_srl = $obj->member_srl; |
| 484 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
| 570 | + if(!$module_srl || !$member_srl) { |
|
| 571 | + return new BaseObject(); |
|
| 572 | + } |
|
| 485 | 573 | |
| 486 | 574 | $oModuleModel = getModel('module'); |
| 487 | 575 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -493,15 +581,20 @@ discard block |
||
| 493 | 581 | if( $obj->point > 0 ) |
| 494 | 582 | { |
| 495 | 583 | $point = $module_config['voted']; |
| 496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 497 | - } |
|
| 498 | - else |
|
| 584 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 585 | + $point = $config->voted; |
|
| 586 | + } |
|
| 587 | + } else |
|
| 499 | 588 | { |
| 500 | 589 | $point = $module_config['blamed']; |
| 501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 590 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 591 | + $point = $config->blamed; |
|
| 592 | + } |
|
| 502 | 593 | } |
| 503 | 594 | |
| 504 | - if(!$point) return new BaseObject(); |
|
| 595 | + if(!$point) { |
|
| 596 | + return new BaseObject(); |
|
| 597 | + } |
|
| 505 | 598 | // Increase the point |
| 506 | 599 | $cur_point += $point; |
| 507 | 600 | $this->setPoint($member_srl,$cur_point); |
@@ -516,7 +609,9 @@ discard block |
||
| 516 | 609 | { |
| 517 | 610 | $member_srl = abs($member_srl); |
| 518 | 611 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 612 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
| 613 | + $mode = 'update'; |
|
| 614 | + } |
|
| 520 | 615 | |
| 521 | 616 | // Get configuration information |
| 522 | 617 | $oMemberModel = getModel('member'); |
@@ -546,7 +641,9 @@ discard block |
||
| 546 | 641 | $args->point = $point; |
| 547 | 642 | break; |
| 548 | 643 | } |
| 549 | - if($args->point < 0) $args->point = 0; |
|
| 644 | + if($args->point < 0) { |
|
| 645 | + $args->point = 0; |
|
| 646 | + } |
|
| 550 | 647 | $point = $args->point; |
| 551 | 648 | |
| 552 | 649 | // Call a trigger (before) |
@@ -568,8 +665,11 @@ discard block |
||
| 568 | 665 | |
| 569 | 666 | // If there are points, update, if no, insert |
| 570 | 667 | $oPointModel = getModel('point'); |
| 571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 572 | - else executeQuery("point.insertPoint", $args); |
|
| 668 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
| 669 | + executeQuery("point.updatePoint", $args); |
|
| 670 | + } else { |
|
| 671 | + executeQuery("point.insertPoint", $args); |
|
| 672 | + } |
|
| 573 | 673 | |
| 574 | 674 | // Get a new level |
| 575 | 675 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -599,7 +699,9 @@ discard block |
||
| 599 | 699 | foreach($point_group as $group_srl => $target_level) |
| 600 | 700 | { |
| 601 | 701 | $del_group_list[] = $group_srl; |
| 602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 702 | + if($target_level == $level) { |
|
| 703 | + $new_group_list[] = $group_srl; |
|
| 704 | + } |
|
| 603 | 705 | } |
| 604 | 706 | } |
| 605 | 707 | // Otherwise, in case the level is reduced, add the recent group |
@@ -625,7 +727,9 @@ discard block |
||
| 625 | 727 | // Delete the group of a level which is higher than the current level |
| 626 | 728 | foreach($point_group as $group_srl => $target_level) |
| 627 | 729 | { |
| 628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 730 | + if($target_level > $level) { |
|
| 731 | + $del_group_list[] = $group_srl; |
|
| 732 | + } |
|
| 629 | 733 | } |
| 630 | 734 | $del_group_list[] = $default_group->group_srl; |
| 631 | 735 | } |
@@ -636,11 +740,15 @@ discard block |
||
| 636 | 740 | foreach($point_group as $group_srl => $target_level) |
| 637 | 741 | { |
| 638 | 742 | $del_group_list[] = $group_srl; |
| 639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 743 | + if($target_level <= $level) { |
|
| 744 | + $new_group_list[] = $group_srl; |
|
| 745 | + } |
|
| 640 | 746 | } |
| 641 | 747 | } |
| 642 | 748 | // If there is no a new group, granted the default group |
| 643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 749 | + if(!$new_group_list[0]) { |
|
| 750 | + $new_group_list[0] = $default_group->group_srl; |
|
| 751 | + } |
|
| 644 | 752 | // Remove linkage group |
| 645 | 753 | if($del_group_list && count($del_group_list)) |
| 646 | 754 | { |
@@ -10,32 +10,32 @@ discard block |
||
| 10 | 10 | $oSecurity = new Security(); |
| 11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl');
|
| 12 | 12 | |
| 13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
| 14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
| 15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
| 16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
| 17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
| 18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
| 13 | + if ($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
| 14 | + if ($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
| 15 | + if ($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
| 16 | + if ($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
| 17 | + if ($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
| 18 | + if ($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
| 19 | 19 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
| 20 | 20 | |
| 21 | 21 | // $this->_getStatusNameListecret option backward compatibility |
| 22 | 22 | $oDocumentModel = getModel('document');
|
| 23 | 23 | |
| 24 | 24 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 25 | - if(isset($statusList['SECRET'])) |
|
| 25 | + if (isset($statusList['SECRET'])) |
|
| 26 | 26 | {
|
| 27 | 27 | $this->module_info->secret = 'Y'; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // use_category <=1.5.x, hide_category >=1.7.x |
| 31 | 31 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
| 32 | - if($count_category) |
|
| 32 | + if ($count_category) |
|
| 33 | 33 | {
|
| 34 | - if($this->module_info->hide_category) |
|
| 34 | + if ($this->module_info->hide_category) |
|
| 35 | 35 | {
|
| 36 | 36 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
| 37 | 37 | } |
| 38 | - else if($this->module_info->use_category) |
|
| 38 | + else if ($this->module_info->use_category) |
|
| 39 | 39 | {
|
| 40 | 40 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
| 41 | 41 | } |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | * check the consultation function, if the user is admin then swich off consultation function |
| 56 | 56 | * if the user is not logged, then disppear write document/write comment./ view document |
| 57 | 57 | **/ |
| 58 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 58 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 59 | 59 | {
|
| 60 | 60 | $this->consultation = true; |
| 61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;
|
|
| 61 | + if (!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;
|
|
| 62 | 62 | } else {
|
| 63 | 63 | $this->consultation = false; |
| 64 | 64 | } |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl); |
| 68 | 68 | Context::set('extra_keys', $extra_keys);
|
| 69 | 69 | |
| 70 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin);
|
|
| 71 | - if(!is_dir($template_path)||!$this->module_info->mskin) |
|
| 70 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin);
|
|
| 71 | + if (!is_dir($template_path) || !$this->module_info->mskin) |
|
| 72 | 72 | {
|
| 73 | 73 | $this->module_info->mskin = 'default'; |
| 74 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin);
|
|
| 74 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin);
|
|
| 75 | 75 | } |
| 76 | 76 | $this->setTemplatePath($template_path); |
| 77 | 77 | Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | function getBoardCommentPage() |
| 88 | 88 | {
|
| 89 | 89 | $document_srl = Context::get('document_srl');
|
| 90 | - $oDocumentModel =& getModel('document');
|
|
| 91 | - if(!$document_srl) |
|
| 90 | + $oDocumentModel = & getModel('document');
|
|
| 91 | + if (!$document_srl) |
|
| 92 | 92 | {
|
| 93 | 93 | return new BaseObject(-1, "msg_invalid_request"); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
| 96 | + if ($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
| 97 | 97 | {
|
| 98 | 98 | return new BaseObject(-1, "msg_not_permitted"); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 102 | - if(!$oDocument->isExists()) |
|
| 102 | + if (!$oDocument->isExists()) |
|
| 103 | 103 | {
|
| 104 | 104 | return new BaseObject(-1, "msg_invalid_request"); |
| 105 | 105 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | function dispBoardMessage($msg_code) |
| 113 | 113 | {
|
| 114 | 114 | $msg = Context::getLang($msg_code); |
| 115 | - $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile');
|
|
| 115 | + $oMessageObject = &ModuleHandler::getModuleInstance('message', 'mobile');
|
|
| 116 | 116 | $oMessageObject->setError(-1); |
| 117 | 117 | $oMessageObject->setMessage($msg); |
| 118 | 118 | $oMessageObject->dispMessage(); |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | function procBoardInsertDocument() |
| 24 | 24 | { |
| 25 | 25 | // check grant |
| 26 | - if($this->module_info->module != "board") |
|
| 26 | + if ($this->module_info->module != "board") |
|
| 27 | 27 | { |
| 28 | 28 | return new BaseObject(-1, "msg_invalid_request"); |
| 29 | 29 | } |
| 30 | - if(!$this->grant->write_document) |
|
| 30 | + if (!$this->grant->write_document) |
|
| 31 | 31 | { |
| 32 | 32 | return new BaseObject(-1, 'msg_not_permitted'); |
| 33 | 33 | } |
@@ -36,29 +36,29 @@ discard block |
||
| 36 | 36 | // setup variables |
| 37 | 37 | $obj = Context::getRequestVars(); |
| 38 | 38 | $obj->module_srl = $this->module_srl; |
| 39 | - if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N'; |
|
| 39 | + if ($obj->is_notice != 'Y' || !$this->grant->manager) $obj->is_notice = 'N'; |
|
| 40 | 40 | $obj->commentStatus = $obj->comment_status; |
| 41 | 41 | |
| 42 | 42 | $oModuleModel = getModel('module'); |
| 43 | 43 | $module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl); |
| 44 | - if($module_config->mobile_use_editor === 'Y') |
|
| 44 | + if ($module_config->mobile_use_editor === 'Y') |
|
| 45 | 45 | { |
| 46 | - if(!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
| 47 | - if(!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
| 46 | + if (!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
| 47 | + if (!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
| 48 | 48 | } |
| 49 | 49 | else |
| 50 | 50 | { |
| 51 | - if(!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
| 52 | - if(!isset($obj->use_html)) $obj->use_html = 'N'; |
|
| 51 | + if (!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
| 52 | + if (!isset($obj->use_html)) $obj->use_html = 'N'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | settype($obj->title, "string"); |
| 56 | - if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); |
|
| 56 | + if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...'); |
|
| 57 | 57 | //setup dpcument title tp 'Untitled' |
| 58 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
| 58 | + if ($obj->title == '') $obj->title = 'Untitled'; |
|
| 59 | 59 | |
| 60 | 60 | // unset document style if the user is not the document manager |
| 61 | - if(!$this->grant->manager) |
|
| 61 | + if (!$this->grant->manager) |
|
| 62 | 62 | { |
| 63 | 63 | unset($obj->title_color); |
| 64 | 64 | unset($obj->title_bold); |
@@ -75,24 +75,24 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | // update the document if it is existed |
| 77 | 77 | $is_update = false; |
| 78 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
| 78 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
| 79 | 79 | { |
| 80 | 80 | $is_update = true; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // if use anonymous is true |
| 84 | - if($this->module_info->use_anonymous == 'Y') |
|
| 84 | + if ($this->module_info->use_anonymous == 'Y') |
|
| 85 | 85 | { |
| 86 | 86 | $this->module_info->admin_mail = ''; |
| 87 | 87 | $obj->notify_message = 'N'; |
| 88 | - if($is_update===false) |
|
| 88 | + if ($is_update === false) |
|
| 89 | 89 | { |
| 90 | - $obj->member_srl = -1*$logged_info->member_srl; |
|
| 90 | + $obj->member_srl = -1 * $logged_info->member_srl; |
|
| 91 | 91 | } |
| 92 | 92 | $obj->email_address = $obj->homepage = $obj->user_id = ''; |
| 93 | 93 | $obj->user_name = $obj->nick_name = 'anonymous'; |
| 94 | 94 | $bAnonymous = true; |
| 95 | - if($is_update===false) |
|
| 95 | + if ($is_update === false) |
|
| 96 | 96 | { |
| 97 | 97 | $oDocument->add('member_srl', $obj->member_srl); |
| 98 | 98 | } |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | $bAnonymous = false; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) |
|
| 105 | + if ($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) |
|
| 106 | 106 | { |
| 107 | 107 | $use_status = explode('|@|', $this->module_info->use_status); |
| 108 | - if(!is_array($use_status) || !in_array('SECRET', $use_status)) |
|
| 108 | + if (!is_array($use_status) || !in_array('SECRET', $use_status)) |
|
| 109 | 109 | { |
| 110 | 110 | unset($obj->is_secret); |
| 111 | 111 | $obj->status = 'PUBLIC'; |
@@ -113,24 +113,24 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // update the document if it is existed |
| 116 | - if($is_update) |
|
| 116 | + if ($is_update) |
|
| 117 | 117 | { |
| 118 | - if(!$oDocument->isGranted()) |
|
| 118 | + if (!$oDocument->isGranted()) |
|
| 119 | 119 | { |
| 120 | - return new BaseObject(-1,'msg_not_permitted'); |
|
| 120 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if($this->module_info->use_anonymous == 'Y') { |
|
| 123 | + if ($this->module_info->use_anonymous == 'Y') { |
|
| 124 | 124 | $obj->member_srl = abs($oDocument->get('member_srl')) * -1; |
| 125 | 125 | $oDocument->add('member_srl', $obj->member_srl); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 128 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 129 | 129 | { |
| 130 | - return new BaseObject(-1,'msg_protect_content'); |
|
| 130 | + return new BaseObject(-1, 'msg_protect_content'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if(!$this->grant->manager) |
|
| 133 | + if (!$this->grant->manager) |
|
| 134 | 134 | { |
| 135 | 135 | // notice & document style same as before if not manager |
| 136 | 136 | $obj->is_notice = $oDocument->get('is_notice'); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // modify list_order if document status is temp |
| 142 | - if($oDocument->get('status') == 'TEMP') |
|
| 142 | + if ($oDocument->get('status') == 'TEMP') |
|
| 143 | 143 | { |
| 144 | 144 | $obj->last_update = $obj->regdate = date('YmdHis'); |
| 145 | 145 | $obj->update_order = $obj->list_order = (getNextSequence() * -1); |
@@ -155,21 +155,21 @@ discard block |
||
| 155 | 155 | $obj->document_srl = $output->get('document_srl'); |
| 156 | 156 | |
| 157 | 157 | // send an email to admin user |
| 158 | - if($output->toBool() && $this->module_info->admin_mail) |
|
| 158 | + if ($output->toBool() && $this->module_info->admin_mail) |
|
| 159 | 159 | { |
| 160 | 160 | $oModuleModel = getModel('module'); |
| 161 | 161 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 162 | 162 | |
| 163 | 163 | $oMail = new Mail(); |
| 164 | 164 | $oMail->setTitle($obj->title); |
| 165 | - $oMail->setContent( sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('','document_srl',$obj->document_srl), getFullUrl('','document_srl',$obj->document_srl), $obj->content)); |
|
| 165 | + $oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content)); |
|
| 166 | 166 | $oMail->setSender($obj->user_name ? $obj->user_name : 'anonymous', $obj->email_address ? $obj->email_address : $member_config->webmaster_email); |
| 167 | 167 | |
| 168 | - $target_mail = explode(',',$this->module_info->admin_mail); |
|
| 169 | - for($i=0;$i<count($target_mail);$i++) |
|
| 168 | + $target_mail = explode(',', $this->module_info->admin_mail); |
|
| 169 | + for ($i = 0; $i < count($target_mail); $i++) |
|
| 170 | 170 | { |
| 171 | 171 | $email_address = trim($target_mail[$i]); |
| 172 | - if(!$email_address) continue; |
|
| 172 | + if (!$email_address) continue; |
|
| 173 | 173 | $oMail->setReceiptor($email_address, $email_address); |
| 174 | 174 | $oMail->send(); |
| 175 | 175 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // if there is an error |
| 180 | - if(!$output->toBool()) |
|
| 180 | + if (!$output->toBool()) |
|
| 181 | 181 | { |
| 182 | 182 | return $output; |
| 183 | 183 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $this->add('document_srl', $output->get('document_srl')); |
| 188 | 188 | |
| 189 | 189 | // alert a message |
| 190 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 190 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 191 | 191 | { |
| 192 | 192 | $this->setMessage($msg_code); |
| 193 | 193 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $document_srl = Context::get('document_srl'); |
| 203 | 203 | |
| 204 | 204 | // if the document is not existed |
| 205 | - if(!$document_srl) |
|
| 205 | + if (!$document_srl) |
|
| 206 | 206 | { |
| 207 | 207 | return $this->doError('msg_invalid_document'); |
| 208 | 208 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $oDocumentModel = &getModel('document'); |
| 211 | 211 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 212 | 212 | // check protect content |
| 213 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 213 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 214 | 214 | { |
| 215 | 215 | return new BaseObject(-1, 'msg_protect_content'); |
| 216 | 216 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // delete the document |
| 222 | 222 | $output = $oDocumentController->deleteDocument($document_srl, $this->grant->manager); |
| 223 | - if(!$output->toBool()) |
|
| 223 | + if (!$output->toBool()) |
|
| 224 | 224 | { |
| 225 | 225 | return $output; |
| 226 | 226 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '', 'page', Context::get('page'), 'document_srl', '')); |
| 230 | 230 | $this->add('mid', Context::get('mid')); |
| 231 | 231 | $this->add('page', Context::get('page')); |
| 232 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 232 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 233 | 233 | { |
| 234 | 234 | $this->setMessage('success_deleted'); |
| 235 | 235 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | function procBoardInsertComment() |
| 254 | 254 | { |
| 255 | 255 | // check grant |
| 256 | - if(!$this->grant->write_comment) |
|
| 256 | + if (!$this->grant->write_comment) |
|
| 257 | 257 | { |
| 258 | 258 | return new BaseObject(-1, 'msg_not_permitted'); |
| 259 | 259 | } |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | $obj = Context::getRequestVars(); |
| 264 | 264 | $obj->module_srl = $this->module_srl; |
| 265 | 265 | |
| 266 | - if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
| 267 | - if(!is_array($this->module_info->use_status)) |
|
| 266 | + if (!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
| 267 | + if (!is_array($this->module_info->use_status)) |
|
| 268 | 268 | { |
| 269 | 269 | $this->module_info->use_status = explode('|@|', $this->module_info->use_status); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if(in_array('SECRET', $this->module_info->use_status)) |
|
| 272 | + if (in_array('SECRET', $this->module_info->use_status)) |
|
| 273 | 273 | { |
| 274 | 274 | $this->module_info->secret = 'Y'; |
| 275 | 275 | } |
@@ -281,31 +281,31 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $oModuleModel = getModel('module'); |
| 283 | 283 | $module_config = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl); |
| 284 | - if($module_config->mobile_use_editor === 'Y') |
|
| 284 | + if ($module_config->mobile_use_editor === 'Y') |
|
| 285 | 285 | { |
| 286 | - if(!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
| 287 | - if(!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
| 286 | + if (!isset($obj->use_editor)) $obj->use_editor = 'Y'; |
|
| 287 | + if (!isset($obj->use_html)) $obj->use_html = 'Y'; |
|
| 288 | 288 | } |
| 289 | 289 | else |
| 290 | 290 | { |
| 291 | - if(!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
| 292 | - if(!isset($obj->use_html)) $obj->use_html = 'N'; |
|
| 291 | + if (!isset($obj->use_editor)) $obj->use_editor = 'N'; |
|
| 292 | + if (!isset($obj->use_html)) $obj->use_html = 'N'; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // check if the doument is existed |
| 296 | 296 | $oDocumentModel = getModel('document'); |
| 297 | 297 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
| 298 | - if(!$oDocument->isExists()) |
|
| 298 | + if (!$oDocument->isExists()) |
|
| 299 | 299 | { |
| 300 | - return new BaseObject(-1,'msg_not_founded'); |
|
| 300 | + return new BaseObject(-1, 'msg_not_founded'); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | // For anonymous use, remove writer's information and notifying information |
| 304 | - if($this->module_info->use_anonymous == 'Y') |
|
| 304 | + if ($this->module_info->use_anonymous == 'Y') |
|
| 305 | 305 | { |
| 306 | 306 | $this->module_info->admin_mail = ''; |
| 307 | 307 | $obj->notify_message = 'N'; |
| 308 | - $obj->member_srl = -1*$logged_info->member_srl; |
|
| 308 | + $obj->member_srl = -1 * $logged_info->member_srl; |
|
| 309 | 309 | $obj->email_address = $obj->homepage = $obj->user_id = ''; |
| 310 | 310 | $obj->user_name = $obj->nick_name = 'anonymous'; |
| 311 | 311 | $bAnonymous = true; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | // check the comment is existed |
| 325 | 325 | // if the comment is not existed, then generate a new sequence |
| 326 | - if(!$obj->comment_srl) |
|
| 326 | + if (!$obj->comment_srl) |
|
| 327 | 327 | { |
| 328 | 328 | $obj->comment_srl = getNextSequence(); |
| 329 | 329 | } else { |
@@ -331,14 +331,14 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | // if comment_srl is not existed, then insert the comment |
| 334 | - if($comment->comment_srl != $obj->comment_srl) |
|
| 334 | + if ($comment->comment_srl != $obj->comment_srl) |
|
| 335 | 335 | { |
| 336 | 336 | |
| 337 | 337 | // parent_srl is existed |
| 338 | - if($obj->parent_srl) |
|
| 338 | + if ($obj->parent_srl) |
|
| 339 | 339 | { |
| 340 | 340 | $parent_comment = $oCommentModel->getComment($obj->parent_srl); |
| 341 | - if(!$parent_comment->comment_srl) |
|
| 341 | + if (!$parent_comment->comment_srl) |
|
| 342 | 342 | { |
| 343 | 343 | return new BaseObject(-1, 'msg_invalid_request'); |
| 344 | 344 | } |
@@ -352,9 +352,9 @@ discard block |
||
| 352 | 352 | // update the comment if it is not existed |
| 353 | 353 | } else { |
| 354 | 354 | // check the grant |
| 355 | - if(!$comment->isGranted()) |
|
| 355 | + if (!$comment->isGranted()) |
|
| 356 | 356 | { |
| 357 | - return new BaseObject(-1,'msg_not_permitted'); |
|
| 357 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $obj->parent_srl = $comment->parent_srl; |
@@ -362,12 +362,12 @@ discard block |
||
| 362 | 362 | $comment_srl = $obj->comment_srl; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if(!$output->toBool()) |
|
| 365 | + if (!$output->toBool()) |
|
| 366 | 366 | { |
| 367 | 367 | return $output; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 370 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 371 | 371 | { |
| 372 | 372 | $this->setMessage('success_registed'); |
| 373 | 373 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | { |
| 384 | 384 | // get the comment_srl |
| 385 | 385 | $comment_srl = Context::get('comment_srl'); |
| 386 | - if(!$comment_srl) |
|
| 386 | + if (!$comment_srl) |
|
| 387 | 387 | { |
| 388 | 388 | return $this->doError('msg_invalid_request'); |
| 389 | 389 | } |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $oCommentController = getController('comment'); |
| 393 | 393 | |
| 394 | 394 | $output = $oCommentController->deleteComment($comment_srl, $this->grant->manager); |
| 395 | - if(!$output->toBool()) |
|
| 395 | + if (!$output->toBool()) |
|
| 396 | 396 | { |
| 397 | 397 | return $output; |
| 398 | 398 | } |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $this->add('mid', Context::get('mid')); |
| 401 | 401 | $this->add('page', Context::get('page')); |
| 402 | 402 | $this->add('document_srl', $output->get('document_srl')); |
| 403 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 403 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 404 | 404 | { |
| 405 | 405 | $this->setMessage('success_deleted'); |
| 406 | 406 | } |
@@ -416,10 +416,10 @@ discard block |
||
| 416 | 416 | // generate trackback module controller object |
| 417 | 417 | $oTrackbackController = getController('trackback'); |
| 418 | 418 | |
| 419 | - if(!$oTrackbackController) return; |
|
| 419 | + if (!$oTrackbackController) return; |
|
| 420 | 420 | |
| 421 | 421 | $output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager); |
| 422 | - if(!$output->toBool()) |
|
| 422 | + if (!$output->toBool()) |
|
| 423 | 423 | { |
| 424 | 424 | return $output; |
| 425 | 425 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $this->add('mid', Context::get('mid')); |
| 428 | 428 | $this->add('page', Context::get('page')); |
| 429 | 429 | $this->add('document_srl', $output->get('document_srl')); |
| 430 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 430 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 431 | 431 | { |
| 432 | 432 | $this->setMessage('success_deleted'); |
| 433 | 433 | } |
@@ -446,18 +446,18 @@ discard block |
||
| 446 | 446 | $oMemberModel = getModel('member'); |
| 447 | 447 | |
| 448 | 448 | // if the comment exists |
| 449 | - if($comment_srl) |
|
| 449 | + if ($comment_srl) |
|
| 450 | 450 | { |
| 451 | 451 | // get the comment information |
| 452 | 452 | $oCommentModel = getModel('comment'); |
| 453 | 453 | $oComment = $oCommentModel->getComment($comment_srl); |
| 454 | - if(!$oComment->isExists()) |
|
| 454 | + if (!$oComment->isExists()) |
|
| 455 | 455 | { |
| 456 | 456 | return new BaseObject(-1, 'msg_invalid_request'); |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | // compare the comment password and the user input password |
| 460 | - if(!$oMemberModel->isValidPassword($oComment->get('password'),$password)) |
|
| 460 | + if (!$oMemberModel->isValidPassword($oComment->get('password'), $password)) |
|
| 461 | 461 | { |
| 462 | 462 | return new BaseObject(-1, 'msg_invalid_password'); |
| 463 | 463 | } |
@@ -467,13 +467,13 @@ discard block |
||
| 467 | 467 | // get the document information |
| 468 | 468 | $oDocumentModel = getModel('document'); |
| 469 | 469 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 470 | - if(!$oDocument->isExists()) |
|
| 470 | + if (!$oDocument->isExists()) |
|
| 471 | 471 | { |
| 472 | 472 | return new BaseObject(-1, 'msg_invalid_request'); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | // compare the document password and the user input password |
| 476 | - if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password)) |
|
| 476 | + if (!$oMemberModel->isValidPassword($oDocument->get('password'), $password)) |
|
| 477 | 477 | { |
| 478 | 478 | return new BaseObject(-1, 'msg_invalid_password'); |
| 479 | 479 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $member_srl = Context::get('target_srl'); |
| 491 | 491 | $mid = Context::get('cur_mid'); |
| 492 | 492 | |
| 493 | - if(!$member_srl || !$mid) |
|
| 493 | + if (!$member_srl || !$mid) |
|
| 494 | 494 | { |
| 495 | 495 | return new BaseObject(); |
| 496 | 496 | } |
@@ -502,13 +502,13 @@ discard block |
||
| 502 | 502 | $columnList = array('module'); |
| 503 | 503 | $cur_module_info = $oModuleModel->getModuleInfoByMid($mid, 0, $columnList); |
| 504 | 504 | |
| 505 | - if($cur_module_info->module != 'board') |
|
| 505 | + if ($cur_module_info->module != 'board') |
|
| 506 | 506 | { |
| 507 | 507 | return new BaseObject(); |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | // get the member information |
| 511 | - if($member_srl == $logged_info->member_srl) |
|
| 511 | + if ($member_srl == $logged_info->member_srl) |
|
| 512 | 512 | { |
| 513 | 513 | $member_info = $logged_info; |
| 514 | 514 | } else { |
@@ -516,13 +516,13 @@ discard block |
||
| 516 | 516 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - if(!$member_info->user_id) |
|
| 519 | + if (!$member_info->user_id) |
|
| 520 | 520 | { |
| 521 | 521 | return new BaseObject(); |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | //search |
| 525 | - $url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name); |
|
| 525 | + $url = getUrl('', 'mid', $mid, 'search_target', 'nick_name', 'search_keyword', $member_info->nick_name); |
|
| 526 | 526 | $oMemberController = getController('member'); |
| 527 | 527 | $oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', ''); |
| 528 | 528 | |