@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class messageAdminController |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief admin controller class of message module |
|
7 | - */ |
|
4 | + * @class messageAdminController |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief admin controller class of message module |
|
7 | + */ |
|
8 | 8 | class messageAdminController extends message |
9 | 9 | { |
10 | 10 | /** |
@@ -23,8 +23,8 @@ |
||
23 | 23 | $args = Context::gets('skin', 'mskin', 'colorset', 'mcolorset'); |
24 | 24 | // Create a module Controller object |
25 | 25 | $oModuleController = getController('module'); |
26 | - $output = $oModuleController->insertModuleConfig('message',$args); |
|
27 | - if(!$output->toBool()) return $output; |
|
26 | + $output = $oModuleController->insertModuleConfig('message', $args); |
|
27 | + if (!$output->toBool()) return $output; |
|
28 | 28 | |
29 | 29 | $this->setMessage('success_updated'); |
30 | 30 |
@@ -24,7 +24,9 @@ |
||
24 | 24 | // Create a module Controller object |
25 | 25 | $oModuleController = getController('module'); |
26 | 26 | $output = $oModuleController->insertModuleConfig('message',$args); |
27 | - if(!$output->toBool()) return $output; |
|
27 | + if(!$output->toBool()) { |
|
28 | + return $output; |
|
29 | + } |
|
28 | 30 | |
29 | 31 | $this->setMessage('success_updated'); |
30 | 32 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | -class messageAdminModel extends message{ |
|
3 | +class messageAdminModel extends message { |
|
4 | 4 | public function getMessageAdminColorset() |
5 | 5 | { |
6 | 6 | $skin = Context::get('skin'); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | Context::set('type', $type); |
9 | 9 | $dir = $type == 'P' ? 'skins' : 'm.skins'; |
10 | 10 | |
11 | - if(!$skin) |
|
11 | + if (!$skin) |
|
12 | 12 | { |
13 | 13 | $tpl = ''; |
14 | 14 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | Context::set('config', $config); |
23 | 23 | |
24 | 24 | $oTemplate = TemplateHandler::getInstance(); |
25 | - $tpl = $oTemplate->compile($this->module_path.'tpl', 'colorset_list'); |
|
25 | + $tpl = $oTemplate->compile($this->module_path . 'tpl', 'colorset_list'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $this->add('tpl', $tpl); |
@@ -21,8 +21,7 @@ |
||
21 | 21 | if($absolute_url) |
22 | 22 | { |
23 | 23 | return getFullUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
24 | - } |
|
25 | - else |
|
24 | + } else |
|
26 | 25 | { |
27 | 26 | return getUrl('','vid',$vid, 'mid',$mid, 'act',$format); |
28 | 27 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class messageAdminView |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief admin view class of the message module |
|
7 | - */ |
|
4 | + * @class messageAdminView |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief admin view class of the message module |
|
7 | + */ |
|
8 | 8 | class messageAdminView extends message |
9 | 9 | { |
10 | 10 | /** |
@@ -30,10 +30,10 @@ |
||
30 | 30 | |
31 | 31 | // Get configurations (using module model object) |
32 | 32 | $config = $oModuleModel->getModuleConfig('message'); |
33 | - Context::set('config',$config); |
|
33 | + Context::set('config', $config); |
|
34 | 34 | |
35 | 35 | // Set a template file |
36 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
36 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
37 | 37 | |
38 | 38 | //Security |
39 | 39 | $security = new Security(); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class message |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief high class of message module |
|
7 | - */ |
|
4 | + * @class message |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief high class of message module |
|
7 | + */ |
|
8 | 8 | class message extends ModuleObject |
9 | 9 | { |
10 | 10 | /** |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | $oModuleModel = getModel('module'); |
24 | 24 | $config = $oModuleModel->getModuleConfig('message'); |
25 | 25 | |
26 | - if($config->skin) |
|
26 | + if ($config->skin) |
|
27 | 27 | { |
28 | 28 | $config_parse = explode('.', $config->skin); |
29 | 29 | if (count($config_parse) > 1) |
30 | 30 | { |
31 | 31 | $template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]); |
32 | - if(is_dir($template_path)) return true; |
|
32 | + if (is_dir($template_path)) return true; |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | return false; |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | $oModuleModel = getModel('module'); |
44 | 44 | $config = $oModuleModel->getModuleConfig('message'); |
45 | 45 | |
46 | - if($config->skin) |
|
46 | + if ($config->skin) |
|
47 | 47 | { |
48 | 48 | $config_parse = explode('.', $config->skin); |
49 | 49 | if (count($config_parse) > 1) |
50 | 50 | { |
51 | 51 | $template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]); |
52 | - if(is_dir($template_path)) |
|
52 | + if (is_dir($template_path)) |
|
53 | 53 | { |
54 | 54 | $config->skin = implode('|@|', $config_parse); |
55 | 55 | $oModuleController = getController('module'); |
@@ -29,7 +29,9 @@ |
||
29 | 29 | if (count($config_parse) > 1) |
30 | 30 | { |
31 | 31 | $template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]); |
32 | - if(is_dir($template_path)) return true; |
|
32 | + if(is_dir($template_path)) { |
|
33 | + return true; |
|
34 | + } |
|
33 | 35 | } |
34 | 36 | } |
35 | 37 | return false; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | -require_once(_XE_PATH_.'modules/message/message.view.php'); |
|
3 | +require_once(_XE_PATH_ . 'modules/message/message.view.php'); |
|
4 | 4 | class messageMobile extends messageView |
5 | 5 | { |
6 | 6 | /** |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | // Get configurations (using module model object) |
19 | 19 | $oModuleModel = getModel('module'); |
20 | 20 | $config = $oModuleModel->getModuleConfig('message'); |
21 | - if(!is_object($config)) $config = new stdClass; |
|
22 | - if(!$config->mskin) $config->mskin = 'default'; |
|
21 | + if (!is_object($config)) $config = new stdClass; |
|
22 | + if (!$config->mskin) $config->mskin = 'default'; |
|
23 | 23 | // Set the template path |
24 | 24 | $template_path = sprintf('%sm.skins/%s', $this->module_path, $config->mskin); |
25 | 25 | // Get the member configuration |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | Context::set('member_config', $member_config); |
29 | 29 | // Set a flag to check if the https connection is made when using SSL and create https url |
30 | 30 | $ssl_mode = false; |
31 | - if($member_config->enable_ssl == 'Y') |
|
31 | + if ($member_config->enable_ssl == 'Y') |
|
32 | 32 | { |
33 | - if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
33 | + if (strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
34 | 34 | } |
35 | - Context::set('ssl_mode',$ssl_mode); |
|
35 | + Context::set('ssl_mode', $ssl_mode); |
|
36 | 36 | |
37 | 37 | Context::set('system_message', nl2br($this->getMessage())); |
38 | 38 |
@@ -18,8 +18,12 @@ discard block |
||
18 | 18 | // Get configurations (using module model object) |
19 | 19 | $oModuleModel = getModel('module'); |
20 | 20 | $config = $oModuleModel->getModuleConfig('message'); |
21 | - if(!is_object($config)) $config = new stdClass; |
|
22 | - if(!$config->mskin) $config->mskin = 'default'; |
|
21 | + if(!is_object($config)) { |
|
22 | + $config = new stdClass; |
|
23 | + } |
|
24 | + if(!$config->mskin) { |
|
25 | + $config->mskin = 'default'; |
|
26 | + } |
|
23 | 27 | // Set the template path |
24 | 28 | $template_path = sprintf('%sm.skins/%s', $this->module_path, $config->mskin); |
25 | 29 | // Get the member configuration |
@@ -30,7 +34,9 @@ discard block |
||
30 | 34 | $ssl_mode = false; |
31 | 35 | if($member_config->enable_ssl == 'Y') |
32 | 36 | { |
33 | - if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
37 | + if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) { |
|
38 | + $ssl_mode = true; |
|
39 | + } |
|
34 | 40 | } |
35 | 41 | Context::set('ssl_mode',$ssl_mode); |
36 | 42 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class messageView |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief view class of the message module |
|
7 | - */ |
|
4 | + * @class messageView |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief view class of the message module |
|
7 | + */ |
|
8 | 8 | class messageView extends message |
9 | 9 | { |
10 | 10 | /** |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | $oModuleModel = getModel('module'); |
24 | 24 | $this->module_config = $config = $oModuleModel->getModuleConfig('message', $this->module_info->site_srl); |
25 | 25 | |
26 | - if(!$config) |
|
26 | + if (!$config) |
|
27 | 27 | { |
28 | 28 | $config = new stdClass(); |
29 | 29 | } |
30 | 30 | |
31 | - if(!$config->skin) |
|
31 | + if (!$config->skin) |
|
32 | 32 | { |
33 | 33 | $config->skin = 'xedition'; |
34 | 34 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | Context::set('member_config', $member_config); |
55 | 55 | // Set a flag to check if the https connection is made when using SSL and create https url |
56 | 56 | $ssl_mode = false; |
57 | - if($member_config->enable_ssl == 'Y') |
|
57 | + if ($member_config->enable_ssl == 'Y') |
|
58 | 58 | { |
59 | - if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
59 | + if (strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
60 | 60 | } |
61 | - Context::set('ssl_mode',$ssl_mode); |
|
61 | + Context::set('ssl_mode', $ssl_mode); |
|
62 | 62 | |
63 | 63 | Context::set('system_message', nl2br($this->getMessage())); |
64 | 64 |
@@ -32,16 +32,14 @@ discard block |
||
32 | 32 | { |
33 | 33 | $config->skin = 'xedition'; |
34 | 34 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
35 | - } |
|
36 | - else |
|
35 | + } else |
|
37 | 36 | { |
38 | 37 | //check theme |
39 | 38 | $config_parse = explode('|@|', $config->skin); |
40 | 39 | if (count($config_parse) > 1) |
41 | 40 | { |
42 | 41 | $template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]); |
43 | - } |
|
44 | - else |
|
42 | + } else |
|
45 | 43 | { |
46 | 44 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
47 | 45 | } |
@@ -56,7 +54,9 @@ discard block |
||
56 | 54 | $ssl_mode = false; |
57 | 55 | if($member_config->enable_ssl == 'Y') |
58 | 56 | { |
59 | - if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) $ssl_mode = true; |
|
57 | + if(strncasecmp('https://', Context::getRequestUri(), 8) === 0) { |
|
58 | + $ssl_mode = true; |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | Context::set('ssl_mode',$ssl_mode); |
62 | 62 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class moduleAdminView |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief admin view class of the module module |
|
7 | - */ |
|
4 | + * @class moduleAdminView |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief admin view class of the module module |
|
7 | + */ |
|
8 | 8 | class moduleAdminView extends module |
9 | 9 | { |
10 | 10 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | function init() |
14 | 14 | { |
15 | 15 | // Set the template path |
16 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
16 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | $oAutoinstallModel = getModel('autoinstall'); |
36 | 36 | |
37 | 37 | $module_list = $oModuleModel->getModuleList(); |
38 | - if(is_array($module_list)) |
|
38 | + if (is_array($module_list)) |
|
39 | 39 | { |
40 | - foreach($module_list as $key => $val) |
|
40 | + foreach ($module_list as $key => $val) |
|
41 | 41 | { |
42 | 42 | $module_list[$key]->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path); |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $module_list[$key]->need_autoinstall_update = $package[$packageSrl]->need_update; |
48 | 48 | |
49 | 49 | // get easyinstall update url |
50 | - if($module_list[$key]->need_autoinstall_update == 'Y') |
|
50 | + if ($module_list[$key]->need_autoinstall_update == 'Y') |
|
51 | 51 | { |
52 | 52 | $module_list[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl); |
53 | 53 | } |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | |
59 | 59 | $favoriteList = $output->get('favoriteList'); |
60 | 60 | $favoriteModuleList = array(); |
61 | - if($favoriteList) |
|
61 | + if ($favoriteList) |
|
62 | 62 | { |
63 | - foreach($favoriteList as $favorite => $favorite_info) |
|
63 | + foreach ($favoriteList as $favorite => $favorite_info) |
|
64 | 64 | { |
65 | 65 | $favoriteModuleList[] = $favorite_info->module; |
66 | 66 | } |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | //Security |
111 | 111 | $security = new Security(); |
112 | 112 | |
113 | - if($module_category_srl) |
|
113 | + if ($module_category_srl) |
|
114 | 114 | { |
115 | - $selected_category = $oModuleModel->getModuleCategory($module_category_srl); |
|
115 | + $selected_category = $oModuleModel->getModuleCategory($module_category_srl); |
|
116 | 116 | Context::set('selected_category', $selected_category); |
117 | 117 | |
118 | 118 | //Security |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | { |
165 | 165 | $module_srls = Context::get('module_srls'); |
166 | 166 | |
167 | - $modules = explode(',',$module_srls); |
|
168 | - if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
167 | + $modules = explode(',', $module_srls); |
|
168 | + if (!count($modules)) if (!$module_srls) return new Object(-1, 'msg_invalid_request'); |
|
169 | 169 | |
170 | 170 | $oModuleModel = getModel('module'); |
171 | 171 | $columnList = array('module_srl', 'module'); |
172 | 172 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList); |
173 | 173 | // Get a skin list of the module |
174 | - $skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/'.$module_info->module); |
|
175 | - Context::set('skin_list',$skin_list); |
|
174 | + $skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $module_info->module); |
|
175 | + Context::set('skin_list', $skin_list); |
|
176 | 176 | // Get a layout list |
177 | 177 | $oLayoutModel = getModel('layout'); |
178 | 178 | $layout_list = $oLayoutModel->getLayoutList(); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | Context::set('module_category', $module_category); |
183 | 183 | |
184 | 184 | $security = new Security(); |
185 | - $security->encodeHTML('layout_list..title','layout_list..layout'); |
|
185 | + $security->encodeHTML('layout_list..title', 'layout_list..layout'); |
|
186 | 186 | $security->encodeHTML('skin_list....'); |
187 | 187 | $security->encodeHTML('module_category...'); |
188 | 188 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | { |
201 | 201 | $module_srls = Context::get('module_srls'); |
202 | 202 | |
203 | - $modules = explode(',',$module_srls); |
|
204 | - if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
203 | + $modules = explode(',', $module_srls); |
|
204 | + if (!count($modules)) if (!$module_srls) return new Object(-1, 'msg_invalid_request'); |
|
205 | 205 | // pre-define variables because you can get contents from other module (call by reference) |
206 | 206 | $content = ''; |
207 | 207 | // Call a trigger for additional settings |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | { |
224 | 224 | $module_srls = Context::get('module_srls'); |
225 | 225 | |
226 | - $modules = explode(',',$module_srls); |
|
227 | - if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
226 | + $modules = explode(',', $module_srls); |
|
227 | + if (!count($modules)) if (!$module_srls) return new Object(-1, 'msg_invalid_request'); |
|
228 | 228 | |
229 | 229 | $oModuleModel = getModel('module'); |
230 | 230 | $columnList = array('module_srl', 'module', 'site_srl'); |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | // Grant virtual permissions for access and manager |
235 | 235 | $grant_list->access->title = Context::getLang('grant_access'); |
236 | 236 | $grant_list->access->default = 'guest'; |
237 | - if(count($source_grant_list)) |
|
237 | + if (count($source_grant_list)) |
|
238 | 238 | { |
239 | - foreach($source_grant_list as $key => $val) |
|
239 | + foreach ($source_grant_list as $key => $val) |
|
240 | 240 | { |
241 | - if(!$val->default) $val->default = 'guest'; |
|
242 | - if($val->default == 'root') $val->default = 'manager'; |
|
241 | + if (!$val->default) $val->default = 'guest'; |
|
242 | + if ($val->default == 'root') $val->default = 'manager'; |
|
243 | 243 | $grant_list->{$key} = $val; |
244 | 244 | } |
245 | 245 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | // Get the language file of the current site |
269 | 269 | $site_module_info = Context::get('site_module_info'); |
270 | 270 | $args = new stdClass(); |
271 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
271 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
272 | 272 | $args->langCode = Context::get('lang_type'); |
273 | 273 | $args->page = Context::get('page'); // /< Page |
274 | 274 | $args->list_count = 30; // /< the number of posts to display on a single page |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | Context::set('lang_code_list', $output->data); |
288 | 288 | Context::set('page_navigation', $output->page_navigation); |
289 | 289 | |
290 | - if(Context::get('module') != 'admin') |
|
290 | + if (Context::get('module') != 'admin') |
|
291 | 291 | { |
292 | 292 | $this->setLayoutPath('./common/tpl'); |
293 | 293 | $this->setLayoutFile('popup_layout'); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $oModuleModel = getModel('module'); |
302 | 302 | $output = $oModuleModel->getModuleFileBoxList(); |
303 | 303 | $page = Context::get('page'); |
304 | - $page = $page?$page:1; |
|
304 | + $page = $page ? $page : 1; |
|
305 | 305 | Context::set('filebox_list', $output->data); |
306 | 306 | Context::set('page_navigation', $output->page_navigation); |
307 | 307 | Context::set('page', $page); |
@@ -121,8 +121,7 @@ discard block |
||
121 | 121 | // Set a template file |
122 | 122 | $this->setTemplateFile('category_update_form'); |
123 | 123 | // If not selected, display a list of categories |
124 | - } |
|
125 | - else |
|
124 | + } else |
|
126 | 125 | { |
127 | 126 | $category_list = $oModuleModel->getModuleCategories(); |
128 | 127 | Context::set('category_list', $category_list); |
@@ -165,7 +164,9 @@ discard block |
||
165 | 164 | $module_srls = Context::get('module_srls'); |
166 | 165 | |
167 | 166 | $modules = explode(',',$module_srls); |
168 | - if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
167 | + if(!count($modules)) { |
|
168 | + if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
169 | + } |
|
169 | 170 | |
170 | 171 | $oModuleModel = getModel('module'); |
171 | 172 | $columnList = array('module_srl', 'module'); |
@@ -201,7 +202,9 @@ discard block |
||
201 | 202 | $module_srls = Context::get('module_srls'); |
202 | 203 | |
203 | 204 | $modules = explode(',',$module_srls); |
204 | - if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
205 | + if(!count($modules)) { |
|
206 | + if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
207 | + } |
|
205 | 208 | // pre-define variables because you can get contents from other module (call by reference) |
206 | 209 | $content = ''; |
207 | 210 | // Call a trigger for additional settings |
@@ -224,7 +227,9 @@ discard block |
||
224 | 227 | $module_srls = Context::get('module_srls'); |
225 | 228 | |
226 | 229 | $modules = explode(',',$module_srls); |
227 | - if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
230 | + if(!count($modules)) { |
|
231 | + if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
232 | + } |
|
228 | 233 | |
229 | 234 | $oModuleModel = getModel('module'); |
230 | 235 | $columnList = array('module_srl', 'module', 'site_srl'); |
@@ -238,8 +243,12 @@ discard block |
||
238 | 243 | { |
239 | 244 | foreach($source_grant_list as $key => $val) |
240 | 245 | { |
241 | - if(!$val->default) $val->default = 'guest'; |
|
242 | - if($val->default == 'root') $val->default = 'manager'; |
|
246 | + if(!$val->default) { |
|
247 | + $val->default = 'guest'; |
|
248 | + } |
|
249 | + if($val->default == 'root') { |
|
250 | + $val->default = 'manager'; |
|
251 | + } |
|
243 | 252 | $grant_list->{$key} = $val; |
244 | 253 | } |
245 | 254 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class module |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief high class of the module module |
|
7 | - */ |
|
4 | + * @class module |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief high class of the module module |
|
7 | + */ |
|
8 | 8 | class module extends ModuleObject |
9 | 9 | { |
10 | 10 | /** |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | $oModuleController = getController('module'); |
17 | 17 | |
18 | 18 | $oDB = &DB::getInstance(); |
19 | - $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true); |
|
20 | - $oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
19 | + $oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true); |
|
20 | + $oDB->addIndex('sites', 'unique_domain', array('domain'), true); |
|
21 | 21 | // Create a directory to use in the module module |
22 | 22 | FileHandler::makeDir('./files/cache/module_info'); |
23 | 23 | FileHandler::makeDir('./files/cache/triggers'); |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | $args = new stdClass; |
28 | 28 | $args->site_srl = 0; |
29 | 29 | $output = $oDB->executeQuery('module.getSite', $args); |
30 | - if(!$output->data || !$output->data->index_module_srl) |
|
30 | + if (!$output->data || !$output->data->index_module_srl) |
|
31 | 31 | { |
32 | 32 | $db_info = Context::getDBInfo(); |
33 | 33 | $domain = Context::getDefaultUrl(); |
34 | 34 | $url_info = parse_url($domain); |
35 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
35 | + $domain = $url_info['host'] . ((!empty($url_info['port']) && $url_info['port'] != 80) ? ':' . $url_info['port'] : '') . $url_info['path']; |
|
36 | 36 | |
37 | 37 | $site_args = new stdClass; |
38 | 38 | $site_args->site_srl = 0; |
39 | - $site_args->index_module_srl = 0; |
|
39 | + $site_args->index_module_srl = 0; |
|
40 | 40 | $site_args->domain = $domain; |
41 | 41 | $site_args->default_language = $db_info->lang_type; |
42 | 42 | |
43 | 43 | $output = executeQuery('module.insertSite', $site_args); |
44 | - if(!$output->toBool()) return $output; |
|
44 | + if (!$output->toBool()) return $output; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return new Object(); |
@@ -54,60 +54,60 @@ discard block |
||
54 | 54 | { |
55 | 55 | $oDB = &DB::getInstance(); |
56 | 56 | // 2008. 10. 27 Add multi-index in the table, the module_part_config |
57 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; |
|
57 | + if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) return true; |
|
58 | 58 | // 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid |
59 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; |
|
59 | + if (!$oDB->isIndexExists('modules', "idx_site_mid")) return true; |
|
60 | 60 | // Move permissions/skin information of all modules to the table, grants. |
61 | - if($oDB->isColumnExists('modules', 'grants')) return true; |
|
61 | + if ($oDB->isColumnExists('modules', 'grants')) return true; |
|
62 | 62 | // Move permissions/skin information of all modules to the table, grants. |
63 | - if(!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
63 | + if (!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
64 | 64 | // Delete extra_vars* column |
65 | - for($i=1;$i<=20;$i++) |
|
65 | + for ($i = 1; $i <= 20; $i++) |
|
66 | 66 | { |
67 | - if($oDB->isColumnExists("documents","extra_vars".$i)) return true; |
|
67 | + if ($oDB->isColumnExists("documents", "extra_vars" . $i)) return true; |
|
68 | 68 | } |
69 | 69 | // Insert site information to the table, sites |
70 | 70 | $args = new stdClass(); |
71 | 71 | $args->site_srl = 0; |
72 | 72 | $output = $oDB->executeQuery('module.getSite', $args); |
73 | - if(!$output->data) return true; |
|
73 | + if (!$output->data) return true; |
|
74 | 74 | |
75 | 75 | // If domain index is defined on the table, sites |
76 | - if($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
77 | - if(!$oDB->isIndexExists('sites','unique_domain')) return true; |
|
76 | + if ($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
77 | + if (!$oDB->isIndexExists('sites', 'unique_domain')) return true; |
|
78 | 78 | |
79 | - if(!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
80 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
81 | - if(!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
82 | - if(!$oDB->isColumnExists("modules", "mskin")) return true; |
|
79 | + if (!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
80 | + if (!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
81 | + if (!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
82 | + if (!$oDB->isColumnExists("modules", "mskin")) return true; |
|
83 | 83 | |
84 | 84 | // check fix skin |
85 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
85 | + if (!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
86 | 86 | |
87 | - if(!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
87 | + if (!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
88 | 88 | |
89 | - if(!is_dir('./files/ruleset')) return true; |
|
89 | + if (!is_dir('./files/ruleset')) return true; |
|
90 | 90 | |
91 | 91 | $args->skin = '.'; |
92 | 92 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
93 | - if($output->data && count($output->data) > 0) |
|
93 | + if ($output->data && count($output->data) > 0) |
|
94 | 94 | { |
95 | - foreach($output->data as $item) |
|
95 | + foreach ($output->data as $item) |
|
96 | 96 | { |
97 | 97 | $skin_path = explode('.', $item->skin); |
98 | - if(count($skin_path) != 2) continue; |
|
99 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
98 | + if (count($skin_path) != 2) continue; |
|
99 | + if (is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | // XE 1.7 |
104 | 104 | |
105 | 105 | // check fix mskin |
106 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
106 | + if (!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
107 | 107 | |
108 | 108 | $oModuleModel = getModel('module'); |
109 | 109 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
110 | - if(!$moduleConfig->isUpdateFixedValue) return true; |
|
110 | + if (!$moduleConfig->isUpdateFixedValue) return true; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -117,19 +117,19 @@ discard block |
||
117 | 117 | { |
118 | 118 | $oDB = &DB::getInstance(); |
119 | 119 | // 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg |
120 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) |
|
120 | + if (!$oDB->isIndexExists("module_part_config", "idx_module_part_config")) |
|
121 | 121 | { |
122 | 122 | $oModuleModel = getModel('module'); |
123 | 123 | $oModuleController = getController('module'); |
124 | 124 | $modules = $oModuleModel->getModuleList(); |
125 | - foreach($modules as $key => $module_info) |
|
125 | + foreach ($modules as $key => $module_info) |
|
126 | 126 | { |
127 | 127 | $module = $module_info->module; |
128 | - if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue; |
|
128 | + if (!in_array($module, array('point', 'trackback', 'layout', 'rss', 'file', 'comment', 'editor'))) continue; |
|
129 | 129 | $config = $oModuleModel->getModuleConfig($module); |
130 | 130 | |
131 | 131 | $module_config = null; |
132 | - switch($module) |
|
132 | + switch ($module) |
|
133 | 133 | { |
134 | 134 | case 'point' : |
135 | 135 | $module_config = $config->module_point; |
@@ -142,21 +142,21 @@ discard block |
||
142 | 142 | case 'editor' : |
143 | 143 | $module_config = $config->module_config; |
144 | 144 | unset($config->module_config); |
145 | - if(is_array($module_config) && count($module_config)) |
|
145 | + if (is_array($module_config) && count($module_config)) |
|
146 | 146 | { |
147 | - foreach($module_config as $key => $val) |
|
147 | + foreach ($module_config as $key => $val) |
|
148 | 148 | { |
149 | - if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
149 | + if (isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | case 'layout' : |
154 | 154 | $tmp = $config->header_script; |
155 | - if(is_array($tmp) && count($tmp)) |
|
155 | + if (is_array($tmp) && count($tmp)) |
|
156 | 156 | { |
157 | - foreach($tmp as $k => $v) |
|
157 | + foreach ($tmp as $k => $v) |
|
158 | 158 | { |
159 | - if(!$v && !trim($v)) continue; |
|
159 | + if (!$v && !trim($v)) continue; |
|
160 | 160 | $module_config[$k]->header_script = $v; |
161 | 161 | } |
162 | 162 | } |
@@ -166,29 +166,29 @@ discard block |
||
166 | 166 | |
167 | 167 | $oModuleController->insertModuleConfig($module, $config); |
168 | 168 | |
169 | - if(is_array($module_config) && count($module_config)) |
|
169 | + if (is_array($module_config) && count($module_config)) |
|
170 | 170 | { |
171 | - foreach($module_config as $module_srl => $module_part_config) |
|
171 | + foreach ($module_config as $module_srl => $module_part_config) |
|
172 | 172 | { |
173 | - $oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config); |
|
173 | + $oModuleController->insertModulePartConfig($module, $module_srl, $module_part_config); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | } |
177 | - $oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl")); |
|
177 | + $oDB->addIndex("module_part_config", "idx_module_part_config", array("module", "module_srl")); |
|
178 | 178 | } |
179 | 179 | // 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns |
180 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) |
|
180 | + if (!$oDB->isIndexExists('modules', "idx_site_mid")) |
|
181 | 181 | { |
182 | - $oDB->dropIndex("modules","unique_mid",true); |
|
183 | - $oDB->addColumn('modules','site_srl','number',11,0,true); |
|
184 | - $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); |
|
182 | + $oDB->dropIndex("modules", "unique_mid", true); |
|
183 | + $oDB->addColumn('modules', 'site_srl', 'number', 11, 0, true); |
|
184 | + $oDB->addIndex("modules", "idx_site_mid", array("site_srl", "mid"), true); |
|
185 | 185 | } |
186 | 186 | // document extra vars |
187 | - if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
187 | + if (!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
188 | 188 | |
189 | - if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
189 | + if (!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
190 | 190 | // Move permission, skin info, extection info, admin ID of all modules to the table, grants |
191 | - if($oDB->isColumnExists('modules', 'grants')) |
|
191 | + if ($oDB->isColumnExists('modules', 'grants')) |
|
192 | 192 | { |
193 | 193 | $oModuleController = getController('module'); |
194 | 194 | $oDocumentController = getController('document'); |
@@ -196,26 +196,26 @@ discard block |
||
196 | 196 | $lang_code = Context::getLangType(); |
197 | 197 | // Get module_info of all modules |
198 | 198 | $output = executeQueryArray('module.getModuleInfos'); |
199 | - if(count($output->data)) |
|
199 | + if (count($output->data)) |
|
200 | 200 | { |
201 | - foreach($output->data as $module_info) |
|
201 | + foreach ($output->data as $module_info) |
|
202 | 202 | { |
203 | 203 | // Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority |
204 | 204 | $module_srl = trim($module_info->module_srl); |
205 | 205 | // grant an authority |
206 | 206 | $grants = unserialize($module_info->grants); |
207 | - if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
207 | + if ($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
208 | 208 | // Insert skin vars |
209 | 209 | $skin_vars = unserialize($module_info->skin_vars); |
210 | - if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
210 | + if ($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
211 | 211 | // Insert super admin's ID |
212 | 212 | $admin_id = trim($module_info->admin_id); |
213 | - if($admin_id && $admin_id != 'Array') |
|
213 | + if ($admin_id && $admin_id != 'Array') |
|
214 | 214 | { |
215 | - $admin_ids = explode(',',$admin_id); |
|
216 | - if(count($admin_id)) |
|
215 | + $admin_ids = explode(',', $admin_id); |
|
216 | + if (count($admin_id)) |
|
217 | 217 | { |
218 | - foreach($admin_ids as $admin_id) |
|
218 | + foreach ($admin_ids as $admin_id) |
|
219 | 219 | { |
220 | 220 | $oModuleController->insertAdminId($module_srl, $admin_id); |
221 | 221 | } |
@@ -224,20 +224,20 @@ discard block |
||
224 | 224 | // Save extra configurations for each module(column data which doesn't exist in the defaut modules) |
225 | 225 | $extra_vars = unserialize($module_info->extra_vars); |
226 | 226 | $document_extra_keys = null; |
227 | - if($extra_vars->extra_vars && count($extra_vars->extra_vars)) |
|
227 | + if ($extra_vars->extra_vars && count($extra_vars->extra_vars)) |
|
228 | 228 | { |
229 | 229 | $document_extra_keys = $extra_vars->extra_vars; |
230 | 230 | unset($extra_vars->extra_vars); |
231 | 231 | } |
232 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
232 | + if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) |
236 | 236 | */ |
237 | 237 | // Insert extra vars if planet module is |
238 | - if($module_info->module == 'planet') |
|
238 | + if ($module_info->module == 'planet') |
|
239 | 239 | { |
240 | - if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
240 | + if (!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
241 | 241 | $planet_extra_keys->name = 'postscript'; |
242 | 242 | $planet_extra_keys->type = 'text'; |
243 | 243 | $planet_extra_keys->is_required = 'N'; |
@@ -247,17 +247,17 @@ discard block |
||
247 | 247 | $document_extra_keys[20] = $planet_extra_keys; |
248 | 248 | } |
249 | 249 | // Register keys for document extra vars |
250 | - if(count($document_extra_keys)) |
|
250 | + if (count($document_extra_keys)) |
|
251 | 251 | { |
252 | - foreach($document_extra_keys as $var_idx => $val) |
|
252 | + foreach ($document_extra_keys as $var_idx => $val) |
|
253 | 253 | { |
254 | - $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx); |
|
254 | + $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars' . $var_idx); |
|
255 | 255 | } |
256 | 256 | // 2009-04-14 Fixed a bug that only 100 extra vars are moved |
257 | 257 | $oDocumentModel = getModel('document'); |
258 | 258 | $total_count = $oDocumentModel->getDocumentCount($module_srl); |
259 | 259 | |
260 | - if($total_count > 0) |
|
260 | + if ($total_count > 0) |
|
261 | 261 | { |
262 | 262 | $per_page = 100; |
263 | 263 | $total_pages = (int) (($total_count - 1) / $per_page) + 1; |
@@ -268,20 +268,20 @@ discard block |
||
268 | 268 | $doc_args->sort_index = 'list_order'; |
269 | 269 | $doc_args->order_type = 'asc'; |
270 | 270 | |
271 | - for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) |
|
271 | + for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) |
|
272 | 272 | { |
273 | 273 | $output = executeQueryArray('document.getDocumentList', $doc_args); |
274 | 274 | |
275 | - if($output->toBool() && $output->data && count($output->data)) |
|
275 | + if ($output->toBool() && $output->data && count($output->data)) |
|
276 | 276 | { |
277 | 277 | foreach ($output->data as $document) |
278 | 278 | { |
279 | - if(!$document) continue; |
|
279 | + if (!$document) continue; |
|
280 | 280 | foreach ($document as $key => $var) |
281 | 281 | { |
282 | 282 | if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue; |
283 | - $var_idx = str_replace('extra_vars','',$key); |
|
284 | - $oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code); |
|
283 | + $var_idx = str_replace('extra_vars', '', $key); |
|
284 | + $oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars' . $var_idx, $lang_code); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
@@ -296,83 +296,83 @@ discard block |
||
296 | 296 | executeQuery('module.updateModule', $module_info); |
297 | 297 | |
298 | 298 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
299 | - if($oCacheHandler->isSupport()) |
|
299 | + if ($oCacheHandler->isSupport()) |
|
300 | 300 | { |
301 | 301 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
302 | 302 | } |
303 | 303 | } |
304 | 304 | } |
305 | 305 | // Various column drop |
306 | - $oDB->dropColumn('modules','grants'); |
|
307 | - $oDB->dropColumn('modules','admin_id'); |
|
308 | - $oDB->dropColumn('modules','skin_vars'); |
|
309 | - $oDB->dropColumn('modules','extra_vars'); |
|
306 | + $oDB->dropColumn('modules', 'grants'); |
|
307 | + $oDB->dropColumn('modules', 'admin_id'); |
|
308 | + $oDB->dropColumn('modules', 'skin_vars'); |
|
309 | + $oDB->dropColumn('modules', 'extra_vars'); |
|
310 | 310 | } |
311 | 311 | // Rights of all modules/skins transferring the information into a table Update grants |
312 | - if(!$oDB->isColumnExists('sites', 'default_language')) |
|
312 | + if (!$oDB->isColumnExists('sites', 'default_language')) |
|
313 | 313 | { |
314 | - $oDB->addColumn('sites','default_language','varchar',255,0,false); |
|
314 | + $oDB->addColumn('sites', 'default_language', 'varchar', 255, 0, false); |
|
315 | 315 | } |
316 | 316 | // extra_vars * Remove Column |
317 | - for($i=1;$i<=20;$i++) |
|
317 | + for ($i = 1; $i <= 20; $i++) |
|
318 | 318 | { |
319 | - if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; |
|
320 | - $oDB->dropColumn('documents','extra_vars'.$i); |
|
319 | + if (!$oDB->isColumnExists("documents", "extra_vars" . $i)) continue; |
|
320 | + $oDB->dropColumn('documents', 'extra_vars' . $i); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | // Enter the main site information sites on the table |
324 | 324 | $args = new stdClass; |
325 | 325 | $args->site_srl = 0; |
326 | 326 | $output = $oDB->executeQuery('module.getSite', $args); |
327 | - if(!$output->data) |
|
327 | + if (!$output->data) |
|
328 | 328 | { |
329 | 329 | // Basic mid, language Wanted |
330 | 330 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
331 | 331 | $db_info = Context::getDBInfo(); |
332 | 332 | $domain = Context::getDefaultUrl(); |
333 | 333 | $url_info = parse_url($domain); |
334 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
334 | + $domain = $url_info['host'] . ((!empty($url_info['port']) && $url_info['port'] != 80) ? ':' . $url_info['port'] : '') . $url_info['path']; |
|
335 | 335 | $site_args->site_srl = 0; |
336 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
336 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
337 | 337 | $site_args->domain = $domain; |
338 | 338 | $site_args->default_language = $db_info->lang_type; |
339 | 339 | |
340 | 340 | $output = executeQuery('module.insertSite', $site_args); |
341 | - if(!$output->toBool()) return $output; |
|
341 | + if (!$output->toBool()) return $output; |
|
342 | 342 | } |
343 | 343 | |
344 | - if($oDB->isIndexExists('sites','idx_domain')) |
|
344 | + if ($oDB->isIndexExists('sites', 'idx_domain')) |
|
345 | 345 | { |
346 | - $oDB->dropIndex('sites','idx_domain'); |
|
346 | + $oDB->dropIndex('sites', 'idx_domain'); |
|
347 | 347 | } |
348 | - if(!$oDB->isIndexExists('sites','unique_domain')) |
|
348 | + if (!$oDB->isIndexExists('sites', 'unique_domain')) |
|
349 | 349 | { |
350 | 350 | $this->updateForUniqueSiteDomain(); |
351 | - $oDB->addIndex('sites','unique_domain',array('domain'),true); |
|
351 | + $oDB->addIndex('sites', 'unique_domain', array('domain'), true); |
|
352 | 352 | } |
353 | 353 | |
354 | - if(!$oDB->isColumnExists("modules", "use_mobile")) |
|
354 | + if (!$oDB->isColumnExists("modules", "use_mobile")) |
|
355 | 355 | { |
356 | - $oDB->addColumn('modules','use_mobile','char',1,'N'); |
|
356 | + $oDB->addColumn('modules', 'use_mobile', 'char', 1, 'N'); |
|
357 | 357 | } |
358 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) |
|
358 | + if (!$oDB->isColumnExists("modules", "mlayout_srl")) |
|
359 | 359 | { |
360 | - $oDB->addColumn('modules','mlayout_srl','number',11, 0); |
|
360 | + $oDB->addColumn('modules', 'mlayout_srl', 'number', 11, 0); |
|
361 | 361 | } |
362 | - if(!$oDB->isColumnExists("modules", "mcontent")) |
|
362 | + if (!$oDB->isColumnExists("modules", "mcontent")) |
|
363 | 363 | { |
364 | - $oDB->addColumn('modules','mcontent','bigtext'); |
|
364 | + $oDB->addColumn('modules', 'mcontent', 'bigtext'); |
|
365 | 365 | } |
366 | - if(!$oDB->isColumnExists("modules", "mskin")) |
|
366 | + if (!$oDB->isColumnExists("modules", "mskin")) |
|
367 | 367 | { |
368 | - $oDB->addColumn('modules','mskin','varchar',250); |
|
368 | + $oDB->addColumn('modules', 'mskin', 'varchar', 250); |
|
369 | 369 | } |
370 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) |
|
370 | + if (!$oDB->isColumnExists("modules", "is_skin_fix")) |
|
371 | 371 | { |
372 | 372 | $oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N'); |
373 | 373 | $output = executeQuery('module.updateSkinFixModules'); |
374 | 374 | } |
375 | - if(!$oDB->isColumnExists("module_config", "site_srl")) |
|
375 | + if (!$oDB->isColumnExists("module_config", "site_srl")) |
|
376 | 376 | { |
377 | 377 | $oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true); |
378 | 378 | } |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | |
381 | 381 | $args->skin = '.'; |
382 | 382 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
383 | - if($output->data && count($output->data) > 0) |
|
383 | + if ($output->data && count($output->data) > 0) |
|
384 | 384 | { |
385 | - foreach($output->data as $item) |
|
385 | + foreach ($output->data as $item) |
|
386 | 386 | { |
387 | 387 | $skin_path = explode('.', $item->skin); |
388 | - if(count($skin_path) != 2) continue; |
|
389 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
|
388 | + if (count($skin_path) != 2) continue; |
|
389 | + if (is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
|
390 | 390 | { |
391 | 391 | unset($args); |
392 | 392 | $args->skin = $item->skin; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | } |
398 | 398 | |
399 | 399 | // XE 1.7 |
400 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) |
|
400 | + if (!$oDB->isColumnExists("modules", "is_mskin_fix")) |
|
401 | 401 | { |
402 | 402 | $oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N'); |
403 | 403 | $output = executeQuery('module.updateMobileSkinFixModules'); |
@@ -405,13 +405,13 @@ discard block |
||
405 | 405 | |
406 | 406 | $oModuleModel = getModel('module'); |
407 | 407 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
408 | - if(!$moduleConfig->isUpdateFixedValue) |
|
408 | + if (!$moduleConfig->isUpdateFixedValue) |
|
409 | 409 | { |
410 | 410 | $output = executeQuery('module.updateSkinFixModules'); |
411 | 411 | $output = executeQuery('module.updateMobileSkinFixModules'); |
412 | 412 | |
413 | 413 | $oModuleController = getController('module'); |
414 | - if(!$moduleConfig) $moduleConfig = new stdClass; |
|
414 | + if (!$moduleConfig) $moduleConfig = new stdClass; |
|
415 | 415 | $moduleConfig->isUpdateFixedValue = TRUE; |
416 | 416 | $output = $oModuleController->updateModuleConfig('module', $moduleConfig); |
417 | 417 | } |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | function updateForUniqueSiteDomain() |
423 | 423 | { |
424 | 424 | $output = executeQueryArray("module.getNonuniqueDomains"); |
425 | - if(!$output->data) return; |
|
426 | - foreach($output->data as $data) |
|
425 | + if (!$output->data) return; |
|
426 | + foreach ($output->data as $data) |
|
427 | 427 | { |
428 | - if($data->count == 1) continue; |
|
428 | + if ($data->count == 1) continue; |
|
429 | 429 | $domain = $data->domain; |
430 | 430 | $args = new stdClass; |
431 | 431 | $args->domain = $domain; |
432 | 432 | $output2 = executeQueryArray("module.getSiteByDomain", $args); |
433 | 433 | $bFirst = true; |
434 | - foreach($output2->data as $site) |
|
434 | + foreach ($output2->data as $site) |
|
435 | 435 | { |
436 | - if($bFirst) |
|
436 | + if ($bFirst) |
|
437 | 437 | { |
438 | 438 | $bFirst = false; |
439 | 439 | continue; |
@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | $site_args->default_language = $db_info->lang_type; |
42 | 42 | |
43 | 43 | $output = executeQuery('module.insertSite', $site_args); |
44 | - if(!$output->toBool()) return $output; |
|
44 | + if(!$output->toBool()) { |
|
45 | + return $output; |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | |
47 | 49 | return new Object(); |
@@ -54,39 +56,69 @@ discard block |
||
54 | 56 | { |
55 | 57 | $oDB = &DB::getInstance(); |
56 | 58 | // 2008. 10. 27 Add multi-index in the table, the module_part_config |
57 | - if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; |
|
59 | + if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) { |
|
60 | + return true; |
|
61 | + } |
|
58 | 62 | // 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid |
59 | - if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; |
|
63 | + if(!$oDB->isIndexExists('modules',"idx_site_mid")) { |
|
64 | + return true; |
|
65 | + } |
|
60 | 66 | // Move permissions/skin information of all modules to the table, grants. |
61 | - if($oDB->isColumnExists('modules', 'grants')) return true; |
|
67 | + if($oDB->isColumnExists('modules', 'grants')) { |
|
68 | + return true; |
|
69 | + } |
|
62 | 70 | // Move permissions/skin information of all modules to the table, grants. |
63 | - if(!$oDB->isColumnExists('sites', 'default_language')) return true; |
|
71 | + if(!$oDB->isColumnExists('sites', 'default_language')) { |
|
72 | + return true; |
|
73 | + } |
|
64 | 74 | // Delete extra_vars* column |
65 | 75 | for($i=1;$i<=20;$i++) |
66 | 76 | { |
67 | - if($oDB->isColumnExists("documents","extra_vars".$i)) return true; |
|
77 | + if($oDB->isColumnExists("documents","extra_vars".$i)) { |
|
78 | + return true; |
|
79 | + } |
|
68 | 80 | } |
69 | 81 | // Insert site information to the table, sites |
70 | 82 | $args = new stdClass(); |
71 | 83 | $args->site_srl = 0; |
72 | 84 | $output = $oDB->executeQuery('module.getSite', $args); |
73 | - if(!$output->data) return true; |
|
85 | + if(!$output->data) { |
|
86 | + return true; |
|
87 | + } |
|
74 | 88 | |
75 | 89 | // If domain index is defined on the table, sites |
76 | - if($oDB->isIndexExists('sites', 'idx_domain')) return true; |
|
77 | - if(!$oDB->isIndexExists('sites','unique_domain')) return true; |
|
90 | + if($oDB->isIndexExists('sites', 'idx_domain')) { |
|
91 | + return true; |
|
92 | + } |
|
93 | + if(!$oDB->isIndexExists('sites','unique_domain')) { |
|
94 | + return true; |
|
95 | + } |
|
78 | 96 | |
79 | - if(!$oDB->isColumnExists("modules", "use_mobile")) return true; |
|
80 | - if(!$oDB->isColumnExists("modules", "mlayout_srl")) return true; |
|
81 | - if(!$oDB->isColumnExists("modules", "mcontent")) return true; |
|
82 | - if(!$oDB->isColumnExists("modules", "mskin")) return true; |
|
97 | + if(!$oDB->isColumnExists("modules", "use_mobile")) { |
|
98 | + return true; |
|
99 | + } |
|
100 | + if(!$oDB->isColumnExists("modules", "mlayout_srl")) { |
|
101 | + return true; |
|
102 | + } |
|
103 | + if(!$oDB->isColumnExists("modules", "mcontent")) { |
|
104 | + return true; |
|
105 | + } |
|
106 | + if(!$oDB->isColumnExists("modules", "mskin")) { |
|
107 | + return true; |
|
108 | + } |
|
83 | 109 | |
84 | 110 | // check fix skin |
85 | - if(!$oDB->isColumnExists("modules", "is_skin_fix")) return true; |
|
111 | + if(!$oDB->isColumnExists("modules", "is_skin_fix")) { |
|
112 | + return true; |
|
113 | + } |
|
86 | 114 | |
87 | - if(!$oDB->isColumnExists("module_config", "site_srl")) return true; |
|
115 | + if(!$oDB->isColumnExists("module_config", "site_srl")) { |
|
116 | + return true; |
|
117 | + } |
|
88 | 118 | |
89 | - if(!is_dir('./files/ruleset')) return true; |
|
119 | + if(!is_dir('./files/ruleset')) { |
|
120 | + return true; |
|
121 | + } |
|
90 | 122 | |
91 | 123 | $args->skin = '.'; |
92 | 124 | $output = executeQueryArray('module.getModuleSkinDotList', $args); |
@@ -95,19 +127,27 @@ discard block |
||
95 | 127 | foreach($output->data as $item) |
96 | 128 | { |
97 | 129 | $skin_path = explode('.', $item->skin); |
98 | - if(count($skin_path) != 2) continue; |
|
99 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true; |
|
130 | + if(count($skin_path) != 2) { |
|
131 | + continue; |
|
132 | + } |
|
133 | + if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) { |
|
134 | + return true; |
|
135 | + } |
|
100 | 136 | } |
101 | 137 | } |
102 | 138 | |
103 | 139 | // XE 1.7 |
104 | 140 | |
105 | 141 | // check fix mskin |
106 | - if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; |
|
142 | + if(!$oDB->isColumnExists("modules", "is_mskin_fix")) { |
|
143 | + return true; |
|
144 | + } |
|
107 | 145 | |
108 | 146 | $oModuleModel = getModel('module'); |
109 | 147 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
110 | - if(!$moduleConfig->isUpdateFixedValue) return true; |
|
148 | + if(!$moduleConfig->isUpdateFixedValue) { |
|
149 | + return true; |
|
150 | + } |
|
111 | 151 | } |
112 | 152 | |
113 | 153 | /** |
@@ -125,7 +165,9 @@ discard block |
||
125 | 165 | foreach($modules as $key => $module_info) |
126 | 166 | { |
127 | 167 | $module = $module_info->module; |
128 | - if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue; |
|
168 | + if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) { |
|
169 | + continue; |
|
170 | + } |
|
129 | 171 | $config = $oModuleModel->getModuleConfig($module); |
130 | 172 | |
131 | 173 | $module_config = null; |
@@ -146,7 +188,9 @@ discard block |
||
146 | 188 | { |
147 | 189 | foreach($module_config as $key => $val) |
148 | 190 | { |
149 | - if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl); |
|
191 | + if(isset($module_config[$key]->module_srl)) { |
|
192 | + unset($module_config[$key]->module_srl); |
|
193 | + } |
|
150 | 194 | } |
151 | 195 | } |
152 | 196 | break; |
@@ -156,7 +200,9 @@ discard block |
||
156 | 200 | { |
157 | 201 | foreach($tmp as $k => $v) |
158 | 202 | { |
159 | - if(!$v && !trim($v)) continue; |
|
203 | + if(!$v && !trim($v)) { |
|
204 | + continue; |
|
205 | + } |
|
160 | 206 | $module_config[$k]->header_script = $v; |
161 | 207 | } |
162 | 208 | } |
@@ -184,9 +230,13 @@ discard block |
||
184 | 230 | $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); |
185 | 231 | } |
186 | 232 | // document extra vars |
187 | - if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
233 | + if(!$oDB->isTableExists('document_extra_vars')) { |
|
234 | + $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); |
|
235 | + } |
|
188 | 236 | |
189 | - if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
237 | + if(!$oDB->isTableExists('document_extra_keys')) { |
|
238 | + $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); |
|
239 | + } |
|
190 | 240 | // Move permission, skin info, extection info, admin ID of all modules to the table, grants |
191 | 241 | if($oDB->isColumnExists('modules', 'grants')) |
192 | 242 | { |
@@ -204,10 +254,14 @@ discard block |
||
204 | 254 | $module_srl = trim($module_info->module_srl); |
205 | 255 | // grant an authority |
206 | 256 | $grants = unserialize($module_info->grants); |
207 | - if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); |
|
257 | + if($grants) { |
|
258 | + $oModuleController->insertModuleGrants($module_srl, $grants); |
|
259 | + } |
|
208 | 260 | // Insert skin vars |
209 | 261 | $skin_vars = unserialize($module_info->skin_vars); |
210 | - if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
262 | + if($skin_vars) { |
|
263 | + $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); |
|
264 | + } |
|
211 | 265 | // Insert super admin's ID |
212 | 266 | $admin_id = trim($module_info->admin_id); |
213 | 267 | if($admin_id && $admin_id != 'Array') |
@@ -229,7 +283,9 @@ discard block |
||
229 | 283 | $document_extra_keys = $extra_vars->extra_vars; |
230 | 284 | unset($extra_vars->extra_vars); |
231 | 285 | } |
232 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
286 | + if($extra_vars) { |
|
287 | + $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
288 | + } |
|
233 | 289 | |
234 | 290 | /** |
235 | 291 | * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) |
@@ -237,7 +293,9 @@ discard block |
||
237 | 293 | // Insert extra vars if planet module is |
238 | 294 | if($module_info->module == 'planet') |
239 | 295 | { |
240 | - if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); |
|
296 | + if(!$document_extra_keys || !is_array($document_extra_keys)) { |
|
297 | + $document_extra_keys = array(); |
|
298 | + } |
|
241 | 299 | $planet_extra_keys->name = 'postscript'; |
242 | 300 | $planet_extra_keys->type = 'text'; |
243 | 301 | $planet_extra_keys->is_required = 'N'; |
@@ -276,10 +334,14 @@ discard block |
||
276 | 334 | { |
277 | 335 | foreach ($output->data as $document) |
278 | 336 | { |
279 | - if(!$document) continue; |
|
337 | + if(!$document) { |
|
338 | + continue; |
|
339 | + } |
|
280 | 340 | foreach ($document as $key => $var) |
281 | 341 | { |
282 | - if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue; |
|
342 | + if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') { |
|
343 | + continue; |
|
344 | + } |
|
283 | 345 | $var_idx = str_replace('extra_vars','',$key); |
284 | 346 | $oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code); |
285 | 347 | } |
@@ -316,7 +378,9 @@ discard block |
||
316 | 378 | // extra_vars * Remove Column |
317 | 379 | for($i=1;$i<=20;$i++) |
318 | 380 | { |
319 | - if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; |
|
381 | + if(!$oDB->isColumnExists("documents","extra_vars".$i)) { |
|
382 | + continue; |
|
383 | + } |
|
320 | 384 | $oDB->dropColumn('documents','extra_vars'.$i); |
321 | 385 | } |
322 | 386 | |
@@ -338,7 +402,9 @@ discard block |
||
338 | 402 | $site_args->default_language = $db_info->lang_type; |
339 | 403 | |
340 | 404 | $output = executeQuery('module.insertSite', $site_args); |
341 | - if(!$output->toBool()) return $output; |
|
405 | + if(!$output->toBool()) { |
|
406 | + return $output; |
|
407 | + } |
|
342 | 408 | } |
343 | 409 | |
344 | 410 | if($oDB->isIndexExists('sites','idx_domain')) |
@@ -385,7 +451,9 @@ discard block |
||
385 | 451 | foreach($output->data as $item) |
386 | 452 | { |
387 | 453 | $skin_path = explode('.', $item->skin); |
388 | - if(count($skin_path) != 2) continue; |
|
454 | + if(count($skin_path) != 2) { |
|
455 | + continue; |
|
456 | + } |
|
389 | 457 | if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) |
390 | 458 | { |
391 | 459 | unset($args); |
@@ -411,7 +479,9 @@ discard block |
||
411 | 479 | $output = executeQuery('module.updateMobileSkinFixModules'); |
412 | 480 | |
413 | 481 | $oModuleController = getController('module'); |
414 | - if(!$moduleConfig) $moduleConfig = new stdClass; |
|
482 | + if(!$moduleConfig) { |
|
483 | + $moduleConfig = new stdClass; |
|
484 | + } |
|
415 | 485 | $moduleConfig->isUpdateFixedValue = TRUE; |
416 | 486 | $output = $oModuleController->updateModuleConfig('module', $moduleConfig); |
417 | 487 | } |
@@ -422,10 +492,14 @@ discard block |
||
422 | 492 | function updateForUniqueSiteDomain() |
423 | 493 | { |
424 | 494 | $output = executeQueryArray("module.getNonuniqueDomains"); |
425 | - if(!$output->data) return; |
|
495 | + if(!$output->data) { |
|
496 | + return; |
|
497 | + } |
|
426 | 498 | foreach($output->data as $data) |
427 | 499 | { |
428 | - if($data->count == 1) continue; |
|
500 | + if($data->count == 1) { |
|
501 | + continue; |
|
502 | + } |
|
429 | 503 | $domain = $data->domain; |
430 | 504 | $args = new stdClass; |
431 | 505 | $args->domain = $domain; |
@@ -4,7 +4,7 @@ |
||
4 | 4 | { |
5 | 5 | function dispModuleChangeLang() |
6 | 6 | { |
7 | - $this->setTemplatePath(sprintf("%stpl/",$this->module_path)); |
|
7 | + $this->setTemplatePath(sprintf("%stpl/", $this->module_path)); |
|
8 | 8 | $this->setTemplateFile('lang.html'); |
9 | 9 | } |
10 | 10 | } |