@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function isIDExists($id, $site_srl = 0) |
21 | 21 | { |
22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
22 | + if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true; |
|
23 | 23 | // directory and rss/atom/api reserved checking, etc. |
24 | 24 | $dirs = FileHandler::readDir(_XE_PATH_); |
25 | 25 | $dirs[] = 'rss'; |
26 | 26 | $dirs[] = 'atom'; |
27 | 27 | $dirs[] = 'api'; |
28 | - if(in_array($id, $dirs)) return true; |
|
28 | + if (in_array($id, $dirs)) return true; |
|
29 | 29 | // mid test |
30 | 30 | $args = new stdClass(); |
31 | 31 | $args->mid = $id; |
32 | 32 | $args->site_srl = $site_srl; |
33 | 33 | $output = executeQuery('module.isExistsModuleName', $args); |
34 | - if($output->data->count) return true; |
|
34 | + if ($output->data->count) return true; |
|
35 | 35 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
36 | - if(!$site_srl) |
|
36 | + if (!$site_srl) |
|
37 | 37 | { |
38 | 38 | $site_args = new stdClass(); |
39 | 39 | $site_args->domain = $id; |
40 | 40 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
41 | - if($output->data->count) return true; |
|
41 | + if ($output->data->count) return true; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return false; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | function getDefaultMid() |
83 | 83 | { |
84 | 84 | $default_url = Context::getDefaultUrl(); |
85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
85 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
86 | 86 | |
87 | 87 | $request_url = Context::getRequestUri(); |
88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
88 | + if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
89 | 89 | |
90 | 90 | $default_url_parse = parse_url($default_url); |
91 | 91 | $request_url_parse = parse_url($request_url); |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | // Set up |
96 | 96 | $domain = ''; |
97 | 97 | $site_info = NULL; |
98 | - if($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
98 | + if ($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
99 | 99 | { |
100 | 100 | $hostname = $request_url_parse['host']; |
101 | 101 | $path = $request_url_parse['path']; |
102 | 102 | $port = $request_url_parse['port']; |
103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
103 | + if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
104 | 104 | |
105 | - $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
|
105 | + $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path); |
|
106 | 106 | } |
107 | 107 | |
108 | - if($domain === '') |
|
108 | + if ($domain === '') |
|
109 | 109 | { |
110 | - if(!$vid) $vid = $mid; |
|
111 | - if($vid) |
|
110 | + if (!$vid) $vid = $mid; |
|
111 | + if ($vid) |
|
112 | 112 | { |
113 | 113 | $domain = $vid; |
114 | 114 | } |
@@ -116,89 +116,89 @@ discard block |
||
116 | 116 | |
117 | 117 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
118 | 118 | // If domain is set, look for subsite |
119 | - if($domain !== '') |
|
119 | + if ($domain !== '') |
|
120 | 120 | { |
121 | 121 | $site_info = false; |
122 | - if($oCacheHandler->isSupport()) |
|
122 | + if ($oCacheHandler->isSupport()) |
|
123 | 123 | { |
124 | - $object_key = 'site_info:' . md5($domain); |
|
124 | + $object_key = 'site_info:'.md5($domain); |
|
125 | 125 | $domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
126 | 126 | $site_info = $oCacheHandler->get($domain_cache_key); |
127 | 127 | } |
128 | 128 | |
129 | - if($site_info === false) |
|
129 | + if ($site_info === false) |
|
130 | 130 | { |
131 | 131 | $args = new stdClass(); |
132 | 132 | $args->domain = $domain; |
133 | 133 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
134 | 134 | $site_info = $output->data; |
135 | 135 | |
136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
136 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
137 | 137 | } |
138 | 138 | |
139 | - if($site_info && $vid) |
|
139 | + if ($site_info && $vid) |
|
140 | 140 | { |
141 | 141 | Context::set('vid', $site_info->domain, true); |
142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
142 | + if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true); |
|
143 | 143 | } |
144 | - if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
144 | + if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // If no virtual website was found, get default website |
148 | - if($domain === '') |
|
148 | + if ($domain === '') |
|
149 | 149 | { |
150 | 150 | $site_info = false; |
151 | - if($oCacheHandler->isSupport()) |
|
151 | + if ($oCacheHandler->isSupport()) |
|
152 | 152 | { |
153 | 153 | $object_key = 'default_site'; |
154 | 154 | $default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
155 | 155 | $site_info = $oCacheHandler->get($default_site_cache_key); |
156 | 156 | } |
157 | 157 | |
158 | - if($site_info === false) |
|
158 | + if ($site_info === false) |
|
159 | 159 | { |
160 | 160 | $args = new stdClass(); |
161 | 161 | $args->site_srl = 0; |
162 | 162 | $output = executeQuery('module.getSiteInfo', $args); |
163 | 163 | // Update the related informaion if there is no default site info |
164 | - if(!$output->data) |
|
164 | + if (!$output->data) |
|
165 | 165 | { |
166 | 166 | // Create a table if sites table doesn't exist |
167 | 167 | $oDB = &DB::getInstance(); |
168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | - if(!$oDB->isTableExists('sites')) return; |
|
168 | + if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | + if (!$oDB->isTableExists('sites')) return; |
|
170 | 170 | |
171 | 171 | // Get mid, language |
172 | 172 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
173 | 173 | $db_info = Context::getDBInfo(); |
174 | 174 | $domain = Context::getDefaultUrl(); |
175 | 175 | $url_info = parse_url($domain); |
176 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
176 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
177 | 177 | |
178 | 178 | $site_args = new stdClass; |
179 | 179 | $site_args->site_srl = 0; |
180 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
180 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
181 | 181 | $site_args->domain = $domain; |
182 | 182 | $site_args->default_language = $db_info->lang_type; |
183 | 183 | |
184 | - if($output->data && !$output->data->index_module_srl) |
|
184 | + if ($output->data && !$output->data->index_module_srl) |
|
185 | 185 | { |
186 | 186 | $output = executeQuery('module.updateSite', $site_args); |
187 | 187 | } |
188 | 188 | else |
189 | 189 | { |
190 | 190 | $output = executeQuery('module.insertSite', $site_args); |
191 | - if(!$output->toBool()) return $output; |
|
191 | + if (!$output->toBool()) return $output; |
|
192 | 192 | } |
193 | 193 | $output = executeQuery('module.getSiteInfo', $args); |
194 | 194 | } |
195 | 195 | $site_info = $output->data; |
196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
196 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(!$site_info->module_srl) return $site_info; |
|
201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
200 | + if (!$site_info->module_srl) return $site_info; |
|
201 | + if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
202 | 202 | return $this->addModuleExtraVars($site_info); |
203 | 203 | } |
204 | 204 | |
@@ -207,48 +207,48 @@ discard block |
||
207 | 207 | */ |
208 | 208 | function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array()) |
209 | 209 | { |
210 | - if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
210 | + if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
211 | 211 | { |
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $args = new stdClass(); |
216 | 216 | $args->mid = $mid; |
217 | - $args->site_srl = (int)$site_srl; |
|
217 | + $args->site_srl = (int) $site_srl; |
|
218 | 218 | |
219 | 219 | $module_srl = false; |
220 | 220 | $module_info = false; |
221 | 221 | |
222 | 222 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
223 | - if($oCacheHandler->isSupport()) |
|
223 | + if ($oCacheHandler->isSupport()) |
|
224 | 224 | { |
225 | 225 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
226 | 226 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
227 | 227 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
228 | - if($module_srl) |
|
228 | + if ($module_srl) |
|
229 | 229 | { |
230 | - $object_key = 'mid_info:' . $module_srl; |
|
230 | + $object_key = 'mid_info:'.$module_srl; |
|
231 | 231 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
232 | 232 | $module_info = $oCacheHandler->get($module_info_cache_key); |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if($module_info === false) |
|
236 | + if ($module_info === false) |
|
237 | 237 | { |
238 | 238 | $output = executeQuery('module.getMidInfo', $args); |
239 | 239 | $module_info = $output->data; |
240 | - if($oCacheHandler->isSupport()) |
|
240 | + if ($oCacheHandler->isSupport()) |
|
241 | 241 | { |
242 | 242 | $oCacheHandler->put($module_srl_cache_key, $module_info->module_srl); |
243 | 243 | |
244 | - $object_key = 'mid_info:' . $module_info->module_srl; |
|
244 | + $object_key = 'mid_info:'.$module_info->module_srl; |
|
245 | 245 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
246 | 246 | $oCacheHandler->put($module_info_cache_key, $module_info); |
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | 250 | $this->applyDefaultSkin($module_info); |
251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
251 | + if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
252 | 252 | return $this->addModuleExtraVars($module_info); |
253 | 253 | } |
254 | 254 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $menuItemSrl = Context::get('menu_item_srl'); |
265 | 265 | $menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl; |
266 | 266 | |
267 | - if(!$menuItemSrl) |
|
267 | + if (!$menuItemSrl) |
|
268 | 268 | { |
269 | 269 | $this->stop(-1, 'msg_invalid_request'); |
270 | 270 | return; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $args = new stdClass(); |
274 | 274 | $args->menu_item_srl = $menuItemSrl; |
275 | 275 | $output = executeQuery('module.getModuleInfoByMenuItemSrl', $args); |
276 | - if(!$output->toBool()) |
|
276 | + if (!$output->toBool()) |
|
277 | 277 | { |
278 | 278 | return $output; |
279 | 279 | } |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | $layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL; |
298 | 298 | $skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc); |
299 | 299 | $skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins'); |
300 | - if(!$skinInfoPc) |
|
300 | + if (!$skinInfoPc) |
|
301 | 301 | { |
302 | 302 | $skinInfoPc = new stdClass(); |
303 | 303 | $skinInfoPc->title = $skinNamePc; |
304 | 304 | } |
305 | - if(!$skinInfoMobile) |
|
305 | + if (!$skinInfoMobile) |
|
306 | 306 | { |
307 | 307 | $skinInfoMobile = new stdClass(); |
308 | 308 | $skinInfoMobile->title = $skinNameMobile; |
@@ -321,23 +321,23 @@ discard block |
||
321 | 321 | $mid_info = false; |
322 | 322 | |
323 | 323 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
324 | - if($oCacheHandler->isSupport()) |
|
324 | + if ($oCacheHandler->isSupport()) |
|
325 | 325 | { |
326 | 326 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
327 | 327 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
328 | 328 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
329 | - if($module_srl) |
|
329 | + if ($module_srl) |
|
330 | 330 | { |
331 | - $object_key = 'mid_info:' . $module_srl; |
|
331 | + $object_key = 'mid_info:'.$module_srl; |
|
332 | 332 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
333 | 333 | $mid_info = $oCacheHandler->get($module_info_cache_key); |
334 | 334 | } |
335 | 335 | |
336 | - if($mid_info === false) |
|
336 | + if ($mid_info === false) |
|
337 | 337 | { |
338 | 338 | $oCacheHandler->put($module_srl_cache_key, $output->data->module_srl); |
339 | 339 | |
340 | - $object_key = 'mid_info:' . $output->data->module_srl; |
|
340 | + $object_key = 'mid_info:'.$output->data->module_srl; |
|
341 | 341 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
342 | 342 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $moduleInfo = $this->addModuleExtraVars($moduleInfo); |
352 | 352 | |
353 | - if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
353 | + if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
354 | 354 | { |
355 | 355 | unset($moduleInfo->skin); |
356 | 356 | unset($moduleInfo->mskin); |
@@ -369,32 +369,32 @@ discard block |
||
369 | 369 | $mid_info = false; |
370 | 370 | |
371 | 371 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
372 | - if($oCacheHandler->isSupport()) |
|
372 | + if ($oCacheHandler->isSupport()) |
|
373 | 373 | { |
374 | - $object_key = 'mid_info:' . $module_srl; |
|
374 | + $object_key = 'mid_info:'.$module_srl; |
|
375 | 375 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
376 | 376 | $mid_info = $oCacheHandler->get($cache_key); |
377 | 377 | } |
378 | 378 | |
379 | - if($mid_info === false) |
|
379 | + if ($mid_info === false) |
|
380 | 380 | { |
381 | 381 | // Get data |
382 | 382 | $args = new stdClass(); |
383 | 383 | $args->module_srl = $module_srl; |
384 | 384 | $output = executeQuery('module.getMidInfo', $args); |
385 | - if(!$output->toBool()) return; |
|
385 | + if (!$output->toBool()) return; |
|
386 | 386 | |
387 | 387 | $mid_info = $output->data; |
388 | 388 | $this->applyDefaultSkin($mid_info); |
389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
389 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
390 | 390 | } |
391 | 391 | |
392 | - if($mid_info && count($columnList)) |
|
392 | + if ($mid_info && count($columnList)) |
|
393 | 393 | { |
394 | 394 | $module_info = new stdClass(); |
395 | - foreach($mid_info as $key => $item) |
|
395 | + foreach ($mid_info as $key => $item) |
|
396 | 396 | { |
397 | - if(in_array($key, $columnList)) |
|
397 | + if (in_array($key, $columnList)) |
|
398 | 398 | { |
399 | 399 | $module_info->$key = $item; |
400 | 400 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | else $module_info = $mid_info; |
404 | 404 | |
405 | 405 | $oModuleController = getController('module'); |
406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
406 | + if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
407 | 407 | |
408 | 408 | $this->applyDefaultSkin($module_info); |
409 | 409 | return $this->addModuleExtraVars($module_info); |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | */ |
417 | 417 | private function applyDefaultSkin(&$moduleInfo) |
418 | 418 | { |
419 | - if($moduleInfo->is_skin_fix == 'N') |
|
419 | + if ($moduleInfo->is_skin_fix == 'N') |
|
420 | 420 | { |
421 | 421 | $moduleInfo->skin = '/USE_DEFAULT/'; |
422 | 422 | } |
423 | 423 | |
424 | - if($moduleInfo->is_mskin_fix == 'N') |
|
424 | + if ($moduleInfo->is_mskin_fix == 'N') |
|
425 | 425 | { |
426 | 426 | $moduleInfo->mskin = '/USE_DEFAULT/'; |
427 | 427 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $count = count($output->data); |
440 | 440 | |
441 | 441 | $modules = array(); |
442 | - for($i=0;$i<$count;$i++) |
|
442 | + for ($i = 0; $i < $count; $i++) |
|
443 | 443 | { |
444 | 444 | $modules[] = $output->data[$i]; |
445 | 445 | } |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | */ |
452 | 452 | function getModulesInfo($module_srls, $columnList = array()) |
453 | 453 | { |
454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
454 | + if (is_array($module_srls)) $module_srls = implode(',', $module_srls); |
|
455 | 455 | $args = new stdClass(); |
456 | 456 | $args->module_srls = $module_srls; |
457 | 457 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
458 | - if(!$output->toBool()) return; |
|
458 | + if (!$output->toBool()) return; |
|
459 | 459 | return $this->addModuleExtraVars($output->data); |
460 | 460 | } |
461 | 461 | |
@@ -465,31 +465,31 @@ discard block |
||
465 | 465 | function addModuleExtraVars($module_info) |
466 | 466 | { |
467 | 467 | // Process although one or more module informaion is requested |
468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
468 | + if (!is_array($module_info)) $target_module_info = array($module_info); |
|
469 | 469 | else $target_module_info = $module_info; |
470 | 470 | // Get module_srl |
471 | 471 | $module_srls = array(); |
472 | - foreach($target_module_info as $key => $val) |
|
472 | + foreach ($target_module_info as $key => $val) |
|
473 | 473 | { |
474 | 474 | $module_srl = $val->module_srl; |
475 | - if(!$module_srl) continue; |
|
475 | + if (!$module_srl) continue; |
|
476 | 476 | $module_srls[] = $val->module_srl; |
477 | 477 | } |
478 | 478 | // Extract extra information of the module and skin |
479 | 479 | $extra_vars = $this->getModuleExtraVars($module_srls); |
480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
480 | + if (!count($module_srls) || !count($extra_vars)) return $module_info; |
|
481 | 481 | |
482 | - foreach($target_module_info as $key => $val) |
|
482 | + foreach ($target_module_info as $key => $val) |
|
483 | 483 | { |
484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
485 | - foreach($extra_vars[$val->module_srl] as $k => $v) |
|
484 | + if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
485 | + foreach ($extra_vars[$val->module_srl] as $k => $v) |
|
486 | 486 | { |
487 | - if($target_module_info[$key]->{$k}) continue; |
|
487 | + if ($target_module_info[$key]->{$k}) continue; |
|
488 | 488 | $target_module_info[$key]->{$k} = $v; |
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | - if(is_array($module_info)) return $target_module_info; |
|
492 | + if (is_array($module_info)) return $target_module_info; |
|
493 | 493 | return $target_module_info[0]; |
494 | 494 | } |
495 | 495 | |
@@ -500,37 +500,37 @@ discard block |
||
500 | 500 | { |
501 | 501 | $list = false; |
502 | 502 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
503 | - if($oCacheHandler->isSupport()) |
|
503 | + if ($oCacheHandler->isSupport()) |
|
504 | 504 | { |
505 | - if(count($args) === 1 && isset($args->site_srl)) |
|
505 | + if (count($args) === 1 && isset($args->site_srl)) |
|
506 | 506 | { |
507 | - $object_key = 'module:mid_list_' . $args->site_srl; |
|
507 | + $object_key = 'module:mid_list_'.$args->site_srl; |
|
508 | 508 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
509 | 509 | $list = $oCacheHandler->get($cache_key); |
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | - if($list === false) |
|
513 | + if ($list === false) |
|
514 | 514 | { |
515 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
515 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
516 | 516 | { |
517 | 517 | $columnList = array(); |
518 | 518 | } |
519 | 519 | |
520 | 520 | $output = executeQuery('module.getMidList', $args, $columnList); |
521 | - if(!$output->toBool()) return $output; |
|
521 | + if (!$output->toBool()) return $output; |
|
522 | 522 | $list = $output->data; |
523 | 523 | |
524 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
524 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
525 | 525 | { |
526 | 526 | $oCacheHandler->put($cache_key, $list); |
527 | 527 | } |
528 | 528 | } |
529 | - if(!$list) return; |
|
529 | + if (!$list) return; |
|
530 | 530 | |
531 | - if(!is_array($list)) $list = array($list); |
|
531 | + if (!is_array($list)) $list = array($list); |
|
532 | 532 | |
533 | - foreach($list as $val) |
|
533 | + foreach ($list as $val) |
|
534 | 534 | { |
535 | 535 | $mid_list[$val->mid] = $val; |
536 | 536 | } |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | function getModuleSrlList($args = null, $columnList = array()) |
545 | 545 | { |
546 | 546 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
547 | - if(!$output->toBool()) return $output; |
|
547 | + if (!$output->toBool()) return $output; |
|
548 | 548 | |
549 | 549 | $list = $output->data; |
550 | - if(!$list) return; |
|
550 | + if (!$list) return; |
|
551 | 551 | |
552 | 552 | return $list; |
553 | 553 | } |
@@ -557,22 +557,22 @@ discard block |
||
557 | 557 | */ |
558 | 558 | function getModuleSrlByMid($mid) |
559 | 559 | { |
560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
560 | + if ($mid && !is_array($mid)) $mid = explode(',', $mid); |
|
561 | + if (is_array($mid)) $mid = "'".implode("','", $mid)."'"; |
|
562 | 562 | |
563 | 563 | $site_module_info = Context::get('site_module_info'); |
564 | 564 | |
565 | 565 | $args = new stdClass; |
566 | 566 | $args->mid = $mid; |
567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
567 | + if ($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
568 | 568 | $output = executeQuery('module.getModuleSrlByMid', $args); |
569 | - if(!$output->toBool()) return $output; |
|
569 | + if (!$output->toBool()) return $output; |
|
570 | 570 | |
571 | 571 | $list = $output->data; |
572 | - if(!$list) return; |
|
573 | - if(!is_array($list)) $list = array($list); |
|
572 | + if (!$list) return; |
|
573 | + if (!is_array($list)) $list = array($list); |
|
574 | 574 | |
575 | - foreach($list as $key => $val) |
|
575 | + foreach ($list as $key => $val) |
|
576 | 576 | { |
577 | 577 | $module_srl_list[] = $val->module_srl; |
578 | 578 | } |
@@ -588,33 +588,33 @@ discard block |
||
588 | 588 | $action_forward = false; |
589 | 589 | // cache controll |
590 | 590 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
591 | - if($oCacheHandler->isSupport()) |
|
591 | + if ($oCacheHandler->isSupport()) |
|
592 | 592 | { |
593 | 593 | $cache_key = 'action_forward'; |
594 | 594 | $action_forward = $oCacheHandler->get($cache_key); |
595 | 595 | } |
596 | 596 | |
597 | 597 | // retrieve and caching all registered action_forward |
598 | - if($action_forward === false) |
|
598 | + if ($action_forward === false) |
|
599 | 599 | { |
600 | 600 | $args = new stdClass(); |
601 | - $output = executeQueryArray('module.getActionForward',$args); |
|
602 | - if(!$output->toBool()) return new stdClass; |
|
603 | - if(!$output->data) $output->data = array(); |
|
601 | + $output = executeQueryArray('module.getActionForward', $args); |
|
602 | + if (!$output->toBool()) return new stdClass; |
|
603 | + if (!$output->data) $output->data = array(); |
|
604 | 604 | |
605 | 605 | $action_forward = array(); |
606 | - foreach($output->data as $item) |
|
606 | + foreach ($output->data as $item) |
|
607 | 607 | { |
608 | 608 | $action_forward[$item->act] = $item; |
609 | 609 | } |
610 | 610 | |
611 | - if($oCacheHandler->isSupport()) |
|
611 | + if ($oCacheHandler->isSupport()) |
|
612 | 612 | { |
613 | 613 | $oCacheHandler->put($cache_key, $action_forward); |
614 | 614 | } |
615 | 615 | } |
616 | 616 | |
617 | - if($action_forward[$act]) |
|
617 | + if ($action_forward[$act]) |
|
618 | 618 | { |
619 | 619 | return $action_forward[$act]; |
620 | 620 | } |
@@ -629,25 +629,25 @@ discard block |
||
629 | 629 | */ |
630 | 630 | function getTriggers($trigger_name, $called_position) |
631 | 631 | { |
632 | - if(is_null($GLOBALS['__triggers__'])) |
|
632 | + if (is_null($GLOBALS['__triggers__'])) |
|
633 | 633 | { |
634 | 634 | $triggers = FALSE; |
635 | 635 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
636 | - if($oCacheHandler->isSupport()) |
|
636 | + if ($oCacheHandler->isSupport()) |
|
637 | 637 | { |
638 | 638 | $cache_key = 'triggers'; |
639 | 639 | $triggers = $oCacheHandler->get($cache_key); |
640 | 640 | } |
641 | - if($triggers === FALSE) |
|
641 | + if ($triggers === FALSE) |
|
642 | 642 | { |
643 | 643 | $output = executeQueryArray('module.getTriggers'); |
644 | 644 | $triggers = $output->data; |
645 | - if($output->toBool() && $oCacheHandler->isSupport()) |
|
645 | + if ($output->toBool() && $oCacheHandler->isSupport()) |
|
646 | 646 | { |
647 | 647 | $oCacheHandler->put($cache_key, $triggers); |
648 | 648 | } |
649 | 649 | } |
650 | - foreach($triggers as $item) |
|
650 | + foreach ($triggers as $item) |
|
651 | 651 | { |
652 | 652 | $GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item; |
653 | 653 | } |
@@ -663,11 +663,11 @@ discard block |
||
663 | 663 | { |
664 | 664 | $triggers = $this->getTriggers($trigger_name, $called_position); |
665 | 665 | |
666 | - if($triggers && is_array($triggers)) |
|
666 | + if ($triggers && is_array($triggers)) |
|
667 | 667 | { |
668 | - foreach($triggers as $item) |
|
668 | + foreach ($triggers as $item) |
|
669 | 669 | { |
670 | - if($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
670 | + if ($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
671 | 671 | { |
672 | 672 | return $item; |
673 | 673 | } |
@@ -680,12 +680,12 @@ discard block |
||
680 | 680 | /** |
681 | 681 | * @brief Get module extend |
682 | 682 | */ |
683 | - function getModuleExtend($parent_module, $type, $kind='') |
|
683 | + function getModuleExtend($parent_module, $type, $kind = '') |
|
684 | 684 | { |
685 | 685 | $key = $parent_module.'.'.$kind.'.'.$type; |
686 | 686 | |
687 | 687 | $module_extend_info = $this->loadModuleExtends(); |
688 | - if(array_key_exists($key, $module_extend_info)) |
|
688 | + if (array_key_exists($key, $module_extend_info)) |
|
689 | 689 | { |
690 | 690 | return $module_extend_info[$key]; |
691 | 691 | } |
@@ -701,29 +701,29 @@ discard block |
||
701 | 701 | $cache_file = './files/config/module_extend.php'; |
702 | 702 | $cache_file = FileHandler::getRealPath($cache_file); |
703 | 703 | |
704 | - if(!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
704 | + if (!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
705 | 705 | { |
706 | 706 | // check pre install |
707 | - if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
707 | + if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
708 | 708 | { |
709 | 709 | $arr = array(); |
710 | 710 | $output = executeQueryArray('module.getModuleExtend'); |
711 | - if($output->data) |
|
711 | + if ($output->data) |
|
712 | 712 | { |
713 | - foreach($output->data as $v) |
|
713 | + foreach ($output->data as $v) |
|
714 | 714 | { |
715 | 715 | $arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module); |
716 | 716 | } |
717 | 717 | } |
718 | 718 | |
719 | 719 | $str = '<?PHP return array(%s); ?>'; |
720 | - $str = sprintf($str, join(',',$arr)); |
|
720 | + $str = sprintf($str, join(',', $arr)); |
|
721 | 721 | |
722 | 722 | FileHandler::writeFile($cache_file, $str); |
723 | 723 | } |
724 | 724 | |
725 | 725 | |
726 | - if(file_exists($cache_file)) |
|
726 | + if (file_exists($cache_file)) |
|
727 | 727 | { |
728 | 728 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
729 | 729 | } |
@@ -743,20 +743,20 @@ discard block |
||
743 | 743 | { |
744 | 744 | // Get a path of the requested module. Return if not exists. |
745 | 745 | $module_path = ModuleHandler::getModulePath($module); |
746 | - if(!$module_path) return; |
|
746 | + if (!$module_path) return; |
|
747 | 747 | // Read the xml file for module skin information |
748 | 748 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
749 | - if(!file_exists($xml_file)) return; |
|
749 | + if (!file_exists($xml_file)) return; |
|
750 | 750 | |
751 | 751 | $oXmlParser = new XmlParser(); |
752 | 752 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
753 | 753 | $xml_obj = $tmp_xml_obj->module; |
754 | 754 | |
755 | - if(!$xml_obj) return; |
|
755 | + if (!$xml_obj) return; |
|
756 | 756 | |
757 | 757 | // Module Information |
758 | 758 | $module_info = new stdClass(); |
759 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
759 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
760 | 760 | { |
761 | 761 | // module format 0.2 |
762 | 762 | $module_info->title = $xml_obj->title->body; |
@@ -764,16 +764,16 @@ discard block |
||
764 | 764 | $module_info->version = $xml_obj->version->body; |
765 | 765 | $module_info->homepage = $xml_obj->link->body; |
766 | 766 | $module_info->category = $xml_obj->category->body; |
767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
767 | + if (!$module_info->category) $module_info->category = 'service'; |
|
768 | 768 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 769 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
770 | 770 | $module_info->license = $xml_obj->license->body; |
771 | 771 | $module_info->license_link = $xml_obj->license->attrs->link; |
772 | 772 | |
773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
773 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
774 | 774 | else $author_list = $xml_obj->author; |
775 | 775 | |
776 | - foreach($author_list as $author) |
|
776 | + foreach ($author_list as $author) |
|
777 | 777 | { |
778 | 778 | $author_obj = new stdClass(); |
779 | 779 | $author_obj->name = $author->name->body; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $module_info->description = $xml_obj->author->description->body; |
790 | 790 | $module_info->version = $xml_obj->attrs->version; |
791 | 791 | $module_info->category = $xml_obj->attrs->category; |
792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
792 | + if (!$module_info->category) $module_info->category = 'service'; |
|
793 | 793 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 794 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
795 | 795 | $author_obj = new stdClass(); |
@@ -818,17 +818,17 @@ discard block |
||
818 | 818 | { |
819 | 819 | // Get a path of the requested module. Return if not exists. |
820 | 820 | $class_path = ModuleHandler::getModulePath($module); |
821 | - if(!$class_path) return; |
|
821 | + if (!$class_path) return; |
|
822 | 822 | |
823 | 823 | // Check if module.xml exists in the path. Return if not exist |
824 | 824 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
825 | - if(!file_exists($xml_file)) return; |
|
825 | + if (!file_exists($xml_file)) return; |
|
826 | 826 | |
827 | 827 | // Check if cached file exists |
828 | - $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
828 | + $cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
829 | 829 | |
830 | 830 | // Update if no cache file exists or it is older than xml file |
831 | - if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
831 | + if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
832 | 832 | { |
833 | 833 | $info = new stdClass(); |
834 | 834 | $buff = array(); // /< Set buff variable to use in the cache file |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | |
842 | 842 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
843 | 843 | |
844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
844 | + if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
845 | 845 | |
846 | 846 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
847 | 847 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -851,17 +851,17 @@ discard block |
||
851 | 851 | $default_index = $admin_index = ''; |
852 | 852 | |
853 | 853 | // Arrange permission information |
854 | - if($grants) |
|
854 | + if ($grants) |
|
855 | 855 | { |
856 | - if(is_array($grants)) $grant_list = $grants; |
|
856 | + if (is_array($grants)) $grant_list = $grants; |
|
857 | 857 | else $grant_list[] = $grants; |
858 | 858 | |
859 | 859 | $info->grant = new stdClass(); |
860 | 860 | $buff[] = '$info->grant = new stdClass;'; |
861 | - foreach($grant_list as $grant) |
|
861 | + foreach ($grant_list as $grant) |
|
862 | 862 | { |
863 | 863 | $name = $grant->attrs->name; |
864 | - $default = $grant->attrs->default?$grant->attrs->default:'guest'; |
|
864 | + $default = $grant->attrs->default ? $grant->attrs->default : 'guest'; |
|
865 | 865 | $title = $grant->title->body; |
866 | 866 | |
867 | 867 | $info->grant->{$name} = new stdClass(); |
@@ -874,15 +874,15 @@ discard block |
||
874 | 874 | } |
875 | 875 | } |
876 | 876 | // Permissions to grant |
877 | - if($permissions) |
|
877 | + if ($permissions) |
|
878 | 878 | { |
879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
879 | + if (is_array($permissions)) $permission_list = $permissions; |
|
880 | 880 | else $permission_list[] = $permissions; |
881 | 881 | |
882 | 882 | $buff[] = '$info->permission = new stdClass;'; |
883 | 883 | |
884 | 884 | $info->permission = new stdClass(); |
885 | - foreach($permission_list as $permission) |
|
885 | + foreach ($permission_list as $permission) |
|
886 | 886 | { |
887 | 887 | $action = $permission->attrs->action; |
888 | 888 | $target = $permission->attrs->target; |
@@ -893,14 +893,14 @@ discard block |
||
893 | 893 | } |
894 | 894 | } |
895 | 895 | // for admin menus |
896 | - if($menus) |
|
896 | + if ($menus) |
|
897 | 897 | { |
898 | - if(is_array($menus)) $menu_list = $menus; |
|
898 | + if (is_array($menus)) $menu_list = $menus; |
|
899 | 899 | else $menu_list[] = $menus; |
900 | 900 | |
901 | 901 | $buff[] = '$info->menu = new stdClass;'; |
902 | 902 | $info->menu = new stdClass(); |
903 | - foreach($menu_list as $menu) |
|
903 | + foreach ($menu_list as $menu) |
|
904 | 904 | { |
905 | 905 | $menu_name = $menu->attrs->name; |
906 | 906 | $menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body; |
@@ -918,22 +918,22 @@ discard block |
||
918 | 918 | } |
919 | 919 | |
920 | 920 | // actions |
921 | - if($actions) |
|
921 | + if ($actions) |
|
922 | 922 | { |
923 | - if(is_array($actions)) $action_list = $actions; |
|
923 | + if (is_array($actions)) $action_list = $actions; |
|
924 | 924 | else $action_list[] = $actions; |
925 | 925 | |
926 | 926 | $buff[] = '$info->action = new stdClass;'; |
927 | 927 | $info->action = new stdClass(); |
928 | - foreach($action_list as $action) |
|
928 | + foreach ($action_list as $action) |
|
929 | 929 | { |
930 | 930 | $name = $action->attrs->name; |
931 | 931 | |
932 | 932 | $type = $action->attrs->type; |
933 | - $grant = $action->attrs->grant?$action->attrs->grant:'guest'; |
|
934 | - $standalone = $action->attrs->standalone=='false'?'false':'true'; |
|
935 | - $ruleset = $action->attrs->ruleset?$action->attrs->ruleset:''; |
|
936 | - $method = $action->attrs->method?$action->attrs->method:''; |
|
933 | + $grant = $action->attrs->grant ? $action->attrs->grant : 'guest'; |
|
934 | + $standalone = $action->attrs->standalone == 'false' ? 'false' : 'true'; |
|
935 | + $ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : ''; |
|
936 | + $method = $action->attrs->method ? $action->attrs->method : ''; |
|
937 | 937 | |
938 | 938 | $index = $action->attrs->index; |
939 | 939 | $admin_index = $action->attrs->admin_index; |
@@ -947,14 +947,14 @@ discard block |
||
947 | 947 | $info->action->{$name}->standalone = $standalone; |
948 | 948 | $info->action->{$name}->ruleset = $ruleset; |
949 | 949 | $info->action->{$name}->method = $method; |
950 | - if($action->attrs->menu_name) |
|
950 | + if ($action->attrs->menu_name) |
|
951 | 951 | { |
952 | - if($menu_index == 'true') |
|
952 | + if ($menu_index == 'true') |
|
953 | 953 | { |
954 | 954 | $info->menu->{$action->attrs->menu_name}->index = $name; |
955 | 955 | $buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name); |
956 | 956 | } |
957 | - if(is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
957 | + if (is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
958 | 958 | { |
959 | 959 | $info->menu->{$action->attrs->menu_name}->acts[] = $name; |
960 | 960 | $currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts); |
@@ -971,22 +971,22 @@ discard block |
||
971 | 971 | $buff[] = sprintf('$info->action->%s->ruleset=\'%s\';', $name, $ruleset); |
972 | 972 | $buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method); |
973 | 973 | |
974 | - if($index=='true') |
|
974 | + if ($index == 'true') |
|
975 | 975 | { |
976 | 976 | $default_index_act = $name; |
977 | 977 | $info->default_index_act = $name; |
978 | 978 | } |
979 | - if($admin_index=='true') |
|
979 | + if ($admin_index == 'true') |
|
980 | 980 | { |
981 | 981 | $admin_index_act = $name; |
982 | 982 | $info->admin_index_act = $name; |
983 | 983 | } |
984 | - if($setup_index=='true') |
|
984 | + if ($setup_index == 'true') |
|
985 | 985 | { |
986 | 986 | $setup_index_act = $name; |
987 | 987 | $info->setup_index_act = $name; |
988 | 988 | } |
989 | - if($simple_setup_index=='true') |
|
989 | + if ($simple_setup_index == 'true') |
|
990 | 990 | { |
991 | 991 | $simple_setup_index_act = $name; |
992 | 992 | $info->simple_setup_index_act = $name; |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | return $info; |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - if(file_exists($cache_file)) return include($cache_file); |
|
1010 | + if (file_exists($cache_file)) return include($cache_file); |
|
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | /** |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | { |
1019 | 1019 | $module = Context::get('module_type'); |
1020 | 1020 | |
1021 | - if($module == 'ARTICLE') |
|
1021 | + if ($module == 'ARTICLE') |
|
1022 | 1022 | { |
1023 | 1023 | $module = 'page'; |
1024 | 1024 | } |
@@ -1038,26 +1038,26 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | function getSkins($path, $dir = 'skins') |
1040 | 1040 | { |
1041 | - if(substr($path, -1) == '/') |
|
1041 | + if (substr($path, -1) == '/') |
|
1042 | 1042 | { |
1043 | 1043 | $path = substr($path, 0, -1); |
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1047 | 1047 | $list = FileHandler::readDir($skin_path); |
1048 | - if(!count($list)) return; |
|
1048 | + if (!count($list)) return; |
|
1049 | 1049 | |
1050 | 1050 | natcasesort($list); |
1051 | 1051 | |
1052 | - foreach($list as $skin_name) |
|
1052 | + foreach ($list as $skin_name) |
|
1053 | 1053 | { |
1054 | - if(!is_dir($skin_path . $skin_name)) |
|
1054 | + if (!is_dir($skin_path.$skin_name)) |
|
1055 | 1055 | { |
1056 | 1056 | continue; |
1057 | 1057 | } |
1058 | 1058 | unset($skin_info); |
1059 | 1059 | $skin_info = $this->loadSkinInfo($path, $skin_name, $dir); |
1060 | - if(!$skin_info) |
|
1060 | + if (!$skin_info) |
|
1061 | 1061 | { |
1062 | 1062 | $skin_info = new stdClass(); |
1063 | 1063 | $skin_info->title = $skin_name; |
@@ -1070,15 +1070,15 @@ discard block |
||
1070 | 1070 | $tmpPath = trim($tmpPath); |
1071 | 1071 | $module = array_pop(explode(' ', $tmpPath)); |
1072 | 1072 | |
1073 | - if($dir == 'skins') |
|
1073 | + if ($dir == 'skins') |
|
1074 | 1074 | { |
1075 | 1075 | $oAdminModel = getAdminModel('admin'); |
1076 | 1076 | $themesInfo = $oAdminModel->getThemeList(); |
1077 | 1077 | |
1078 | - foreach($themesInfo as $themeName => $info) |
|
1078 | + foreach ($themesInfo as $themeName => $info) |
|
1079 | 1079 | { |
1080 | 1080 | $skinInfos = $info->skin_infos; |
1081 | - if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1081 | + if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1082 | 1082 | { |
1083 | 1083 | $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; |
1084 | 1084 | $skin_list[$skinInfos[$module]->name] = $themeSkinInfo; |
@@ -1090,13 +1090,13 @@ discard block |
||
1090 | 1090 | $oMenuAdminModel = getAdminModel('menu'); |
1091 | 1091 | $installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl); |
1092 | 1092 | $moduleName = $module; |
1093 | - if($moduleName === 'page') |
|
1093 | + if ($moduleName === 'page') |
|
1094 | 1094 | { |
1095 | 1095 | $moduleName = 'ARTICLE'; |
1096 | 1096 | } |
1097 | - if(array_key_exists($moduleName, $installedMenuTypes)) |
|
1097 | + if (array_key_exists($moduleName, $installedMenuTypes)) |
|
1098 | 1098 | { |
1099 | - if($dir == 'skins') |
|
1099 | + if ($dir == 'skins') |
|
1100 | 1100 | { |
1101 | 1101 | $type = 'P'; |
1102 | 1102 | } |
@@ -1106,12 +1106,12 @@ discard block |
||
1106 | 1106 | } |
1107 | 1107 | $defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl); |
1108 | 1108 | |
1109 | - if(isset($defaultSkinName)) |
|
1109 | + if (isset($defaultSkinName)) |
|
1110 | 1110 | { |
1111 | 1111 | $defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir); |
1112 | 1112 | |
1113 | 1113 | $useDefault = new stdClass(); |
1114 | - $useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; |
|
1114 | + $useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')'; |
|
1115 | 1115 | |
1116 | 1116 | $useDefaultList['/USE_DEFAULT/'] = $useDefault; |
1117 | 1117 | |
@@ -1128,20 +1128,20 @@ discard block |
||
1128 | 1128 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1129 | 1129 | { |
1130 | 1130 | // Read xml file having skin information |
1131 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1131 | + if (substr($path, -1) != '/') $path .= '/'; |
|
1132 | 1132 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1133 | - if(!file_exists($skin_xml_file)) return; |
|
1133 | + if (!file_exists($skin_xml_file)) return; |
|
1134 | 1134 | // Create XmlParser object |
1135 | 1135 | $oXmlParser = new XmlParser(); |
1136 | 1136 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1137 | 1137 | // Return if no skin information is |
1138 | - if(!$_xml_obj->skin) return; |
|
1138 | + if (!$_xml_obj->skin) return; |
|
1139 | 1139 | $xml_obj = $_xml_obj->skin; |
1140 | 1140 | // Skin Name |
1141 | 1141 | $skin_info = new stdClass(); |
1142 | 1142 | $skin_info->title = $xml_obj->title->body; |
1143 | 1143 | // Author information |
1144 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1144 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1145 | 1145 | { |
1146 | 1146 | // skin format v0.2 |
1147 | 1147 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1152,10 +1152,10 @@ discard block |
||
1152 | 1152 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1153 | 1153 | $skin_info->description = $xml_obj->description->body; |
1154 | 1154 | |
1155 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1155 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1156 | 1156 | else $author_list = $xml_obj->author; |
1157 | 1157 | |
1158 | - foreach($author_list as $author) |
|
1158 | + foreach ($author_list as $author) |
|
1159 | 1159 | { |
1160 | 1160 | $author_obj = new stdClass(); |
1161 | 1161 | $author_obj->name = $author->name->body; |
@@ -1164,25 +1164,25 @@ discard block |
||
1164 | 1164 | $skin_info->author[] = $author_obj; |
1165 | 1165 | } |
1166 | 1166 | // List extra vars |
1167 | - if($xml_obj->extra_vars) |
|
1167 | + if ($xml_obj->extra_vars) |
|
1168 | 1168 | { |
1169 | 1169 | $extra_var_groups = $xml_obj->extra_vars->group; |
1170 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1171 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1170 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1171 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1172 | 1172 | |
1173 | - foreach($extra_var_groups as $group) |
|
1173 | + foreach ($extra_var_groups as $group) |
|
1174 | 1174 | { |
1175 | 1175 | $extra_vars = $group->var; |
1176 | - if(!$extra_vars) |
|
1176 | + if (!$extra_vars) |
|
1177 | 1177 | { |
1178 | 1178 | continue; |
1179 | 1179 | } |
1180 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1180 | + if (!is_array($group->var)) $extra_vars = array($group->var); |
|
1181 | 1181 | |
1182 | - foreach($extra_vars as $key => $val) |
|
1182 | + foreach ($extra_vars as $key => $val) |
|
1183 | 1183 | { |
1184 | 1184 | $obj = new stdClass(); |
1185 | - if(!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1185 | + if (!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1186 | 1186 | |
1187 | 1187 | $obj->group = $group->title->body; |
1188 | 1188 | $obj->name = $val->attrs->name; |
@@ -1191,14 +1191,14 @@ discard block |
||
1191 | 1191 | $obj->description = $val->description->body; |
1192 | 1192 | $obj->value = $extra_vals->{$obj->name}; |
1193 | 1193 | $obj->default = $val->attrs->default; |
1194 | - if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1195 | - if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1194 | + if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1195 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1196 | 1196 | // Get an option list from 'select'type |
1197 | - if(is_array($val->options)) |
|
1197 | + if (is_array($val->options)) |
|
1198 | 1198 | { |
1199 | 1199 | $option_count = count($val->options); |
1200 | 1200 | |
1201 | - for($i = 0; $i < $option_count; $i++) |
|
1201 | + for ($i = 0; $i < $option_count; $i++) |
|
1202 | 1202 | { |
1203 | 1203 | $obj->options[$i] = new stdClass(); |
1204 | 1204 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -1235,18 +1235,18 @@ discard block |
||
1235 | 1235 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1236 | 1236 | // Variables used in the skin |
1237 | 1237 | $extra_var_groups = $xml_obj->extra_vars->group; |
1238 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1239 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1238 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1239 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1240 | 1240 | |
1241 | - foreach($extra_var_groups as $group) |
|
1241 | + foreach ($extra_var_groups as $group) |
|
1242 | 1242 | { |
1243 | 1243 | $extra_vars = $group->var; |
1244 | 1244 | |
1245 | - if($extra_vars) |
|
1245 | + if ($extra_vars) |
|
1246 | 1246 | { |
1247 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1247 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1248 | 1248 | |
1249 | - foreach($extra_vars as $var) |
|
1249 | + foreach ($extra_vars as $var) |
|
1250 | 1250 | { |
1251 | 1251 | unset($obj); |
1252 | 1252 | unset($options); |
@@ -1257,11 +1257,11 @@ discard block |
||
1257 | 1257 | $title = $var->title->body; |
1258 | 1258 | $description = $var->description->body; |
1259 | 1259 | // Get an option list from 'select'type. |
1260 | - if(is_array($var->default)) |
|
1260 | + if (is_array($var->default)) |
|
1261 | 1261 | { |
1262 | 1262 | $option_count = count($var->default); |
1263 | 1263 | |
1264 | - for($i = 0; $i < $option_count; $i++) |
|
1264 | + for ($i = 0; $i < $option_count; $i++) |
|
1265 | 1265 | { |
1266 | 1266 | $options[$i]->title = $var->default[$i]->body; |
1267 | 1267 | $options[$i]->value = $var->default[$i]->body; |
@@ -1295,19 +1295,19 @@ discard block |
||
1295 | 1295 | |
1296 | 1296 | // colorset |
1297 | 1297 | $colorset = $xml_obj->colorset->color; |
1298 | - if($colorset) |
|
1298 | + if ($colorset) |
|
1299 | 1299 | { |
1300 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1300 | + if (!is_array($colorset)) $colorset = array($colorset); |
|
1301 | 1301 | |
1302 | - foreach($colorset as $color) |
|
1302 | + foreach ($colorset as $color) |
|
1303 | 1303 | { |
1304 | 1304 | $name = $color->attrs->name; |
1305 | 1305 | $title = $color->title->body; |
1306 | 1306 | $screenshot = $color->attrs->src; |
1307 | - if($screenshot) |
|
1307 | + if ($screenshot) |
|
1308 | 1308 | { |
1309 | 1309 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1310 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1310 | + if (!file_exists($screenshot)) $screenshot = ""; |
|
1311 | 1311 | } |
1312 | 1312 | else $screenshot = ""; |
1313 | 1313 | |
@@ -1319,19 +1319,19 @@ discard block |
||
1319 | 1319 | } |
1320 | 1320 | } |
1321 | 1321 | // Menu type (settings for layout) |
1322 | - if($xml_obj->menus->menu) |
|
1322 | + if ($xml_obj->menus->menu) |
|
1323 | 1323 | { |
1324 | 1324 | $menus = $xml_obj->menus->menu; |
1325 | - if(!is_array($menus)) $menus = array($menus); |
|
1325 | + if (!is_array($menus)) $menus = array($menus); |
|
1326 | 1326 | |
1327 | 1327 | $menu_count = count($menus); |
1328 | 1328 | $skin_info->menu_count = $menu_count; |
1329 | - for($i=0;$i<$menu_count;$i++) |
|
1329 | + for ($i = 0; $i < $menu_count; $i++) |
|
1330 | 1330 | { |
1331 | 1331 | unset($obj); |
1332 | 1332 | |
1333 | 1333 | $obj->name = $menus[$i]->attrs->name; |
1334 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1334 | + if ($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1335 | 1335 | $obj->title = $menus[$i]->title->body; |
1336 | 1336 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1337 | 1337 | |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | $thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin); |
1343 | - $skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null; |
|
1343 | + $skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null; |
|
1344 | 1344 | return $skin_info; |
1345 | 1345 | } |
1346 | 1346 | |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | { |
1352 | 1352 | $args = new stdClass; |
1353 | 1353 | $args->site_srl = $site_srl; |
1354 | - if(!is_null($module)) $args->module = $module; |
|
1354 | + if (!is_null($module)) $args->module = $module; |
|
1355 | 1355 | $output = executeQuery('module.getModuleCount', $args); |
1356 | 1356 | return $output->data->count; |
1357 | 1357 | } |
@@ -1365,26 +1365,26 @@ discard block |
||
1365 | 1365 | $config = false; |
1366 | 1366 | // cache controll |
1367 | 1367 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1368 | - if($oCacheHandler->isSupport()) |
|
1368 | + if ($oCacheHandler->isSupport()) |
|
1369 | 1369 | { |
1370 | - $object_key = 'module_config:' . $module . '_' . $site_srl; |
|
1370 | + $object_key = 'module_config:'.$module.'_'.$site_srl; |
|
1371 | 1371 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1372 | 1372 | $config = $oCacheHandler->get($cache_key); |
1373 | 1373 | } |
1374 | 1374 | |
1375 | - if($config === false) |
|
1375 | + if ($config === false) |
|
1376 | 1376 | { |
1377 | - if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1377 | + if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1378 | 1378 | { |
1379 | 1379 | $args = new stdClass(); |
1380 | 1380 | $args->module = $module; |
1381 | 1381 | $args->site_srl = $site_srl; |
1382 | 1382 | $output = executeQuery('module.getModuleConfig', $args); |
1383 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1383 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1384 | 1384 | else $config = null; |
1385 | 1385 | |
1386 | 1386 | //insert in cache |
1387 | - if($oCacheHandler->isSupport()) |
|
1387 | + if ($oCacheHandler->isSupport()) |
|
1388 | 1388 | { |
1389 | 1389 | $oCacheHandler->put($cache_key, $config); |
1390 | 1390 | } |
@@ -1405,26 +1405,26 @@ discard block |
||
1405 | 1405 | $config = false; |
1406 | 1406 | // cache controll |
1407 | 1407 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1408 | - if($oCacheHandler->isSupport()) |
|
1408 | + if ($oCacheHandler->isSupport()) |
|
1409 | 1409 | { |
1410 | 1410 | $object_key = 'module_part_config:'.$module.'_'.$module_srl; |
1411 | 1411 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1412 | 1412 | $config = $oCacheHandler->get($cache_key); |
1413 | 1413 | } |
1414 | 1414 | |
1415 | - if($config === false) |
|
1415 | + if ($config === false) |
|
1416 | 1416 | { |
1417 | - if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1417 | + if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1418 | 1418 | { |
1419 | 1419 | $args = new stdClass(); |
1420 | 1420 | $args->module = $module; |
1421 | 1421 | $args->module_srl = $module_srl; |
1422 | 1422 | $output = executeQuery('module.getModulePartConfig', $args); |
1423 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1423 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1424 | 1424 | else $config = null; |
1425 | 1425 | |
1426 | 1426 | //insert in cache |
1427 | - if($oCacheHandler->isSupport()) |
|
1427 | + if ($oCacheHandler->isSupport()) |
|
1428 | 1428 | { |
1429 | 1429 | $oCacheHandler->put($cache_key, $config); |
1430 | 1430 | } |
@@ -1443,11 +1443,11 @@ discard block |
||
1443 | 1443 | { |
1444 | 1444 | $args = new stdClass(); |
1445 | 1445 | $args->module = $module; |
1446 | - if($site_srl) $args->site_srl = $site_srl; |
|
1446 | + if ($site_srl) $args->site_srl = $site_srl; |
|
1447 | 1447 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1448 | - if(!$output->toBool() || !$output->data) return array(); |
|
1448 | + if (!$output->toBool() || !$output->data) return array(); |
|
1449 | 1449 | |
1450 | - foreach($output->data as $key => $val) |
|
1450 | + foreach ($output->data as $key => $val) |
|
1451 | 1451 | { |
1452 | 1452 | $result[$val->module_srl] = unserialize($val->config); |
1453 | 1453 | } |
@@ -1463,12 +1463,12 @@ discard block |
||
1463 | 1463 | $args->moduleCategorySrl = $moduleCategorySrl; |
1464 | 1464 | // Get data from the DB |
1465 | 1465 | $output = executeQuery('module.getModuleCategories', $args); |
1466 | - if(!$output->toBool()) return $output; |
|
1466 | + if (!$output->toBool()) return $output; |
|
1467 | 1467 | $list = $output->data; |
1468 | - if(!$list) return; |
|
1469 | - if(!is_array($list)) $list = array($list); |
|
1468 | + if (!$list) return; |
|
1469 | + if (!is_array($list)) $list = array($list); |
|
1470 | 1470 | |
1471 | - foreach($list as $val) |
|
1471 | + foreach ($list as $val) |
|
1472 | 1472 | { |
1473 | 1473 | $category_list[$val->module_category_srl] = $val; |
1474 | 1474 | } |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | $args = new stdClass; |
1485 | 1485 | $args->module_category_srl = $module_category_srl; |
1486 | 1486 | $output = executeQuery('module.getModuleCategory', $args); |
1487 | - if(!$output->toBool()) return $output; |
|
1487 | + if (!$output->toBool()) return $output; |
|
1488 | 1488 | return $output->data; |
1489 | 1489 | } |
1490 | 1490 | |
@@ -1496,10 +1496,10 @@ discard block |
||
1496 | 1496 | // Get a list of downloaded and installed modules |
1497 | 1497 | $searched_list = FileHandler::readDir('./modules'); |
1498 | 1498 | $searched_count = count($searched_list); |
1499 | - if(!$searched_count) return; |
|
1499 | + if (!$searched_count) return; |
|
1500 | 1500 | sort($searched_list); |
1501 | 1501 | |
1502 | - for($i=0;$i<$searched_count;$i++) |
|
1502 | + for ($i = 0; $i < $searched_count; $i++) |
|
1503 | 1503 | { |
1504 | 1504 | // Module name |
1505 | 1505 | $module_name = $searched_list[$i]; |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | $info = $this->getModuleInfoXml($module_name); |
1510 | 1510 | unset($obj); |
1511 | 1511 | |
1512 | - if(!isset($info)) continue; |
|
1512 | + if (!isset($info)) continue; |
|
1513 | 1513 | $info->module = $module_name; |
1514 | 1514 | $info->created_table_count = $created_table_count; |
1515 | 1515 | $info->table_count = $table_count; |
@@ -1526,19 +1526,19 @@ discard block |
||
1526 | 1526 | $info = null; |
1527 | 1527 | |
1528 | 1528 | $moduledir = ModuleHandler::getModulePath($module_name); |
1529 | - if(file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1529 | + if (file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1530 | 1530 | { |
1531 | 1531 | $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); |
1532 | 1532 | $table_count = count($tmp_files); |
1533 | 1533 | // Check if the table is created |
1534 | 1534 | $created_table_count = 0; |
1535 | - for($j=0;$j<count($tmp_files);$j++) |
|
1535 | + for ($j = 0; $j < count($tmp_files); $j++) |
|
1536 | 1536 | { |
1537 | - list($table_name) = explode(".",$tmp_files[$j]); |
|
1538 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1537 | + list($table_name) = explode(".", $tmp_files[$j]); |
|
1538 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1539 | 1539 | } |
1540 | 1540 | // Check if DB is installed |
1541 | - if($table_count > $created_table_count) return true; |
|
1541 | + if ($table_count > $created_table_count) return true; |
|
1542 | 1542 | else return false; |
1543 | 1543 | } |
1544 | 1544 | return false; |
@@ -1548,7 +1548,7 @@ discard block |
||
1548 | 1548 | { |
1549 | 1549 | // Check if it is upgraded to module.class.php on each module |
1550 | 1550 | $oDummy = getModule($module_name, 'class'); |
1551 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1551 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1552 | 1552 | { |
1553 | 1553 | return $oDummy->checkUpdate(); |
1554 | 1554 | } |
@@ -1567,31 +1567,31 @@ discard block |
||
1567 | 1567 | sort($searched_list); |
1568 | 1568 | |
1569 | 1569 | $searched_count = count($searched_list); |
1570 | - if(!$searched_count) return; |
|
1570 | + if (!$searched_count) return; |
|
1571 | 1571 | |
1572 | - for($i=0;$i<$searched_count;$i++) |
|
1572 | + for ($i = 0; $i < $searched_count; $i++) |
|
1573 | 1573 | { |
1574 | 1574 | // module name |
1575 | 1575 | $module_name = $searched_list[$i]; |
1576 | 1576 | |
1577 | 1577 | $path = ModuleHandler::getModulePath($module_name); |
1578 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1578 | + if (!is_dir(FileHandler::getRealPath($path))) continue; |
|
1579 | 1579 | |
1580 | 1580 | // Get the number of xml files to create a table in schemas |
1581 | 1581 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
1582 | 1582 | $table_count = count($tmp_files); |
1583 | 1583 | // Check if the table is created |
1584 | 1584 | $created_table_count = 0; |
1585 | - for($j=0;$j<$table_count;$j++) |
|
1585 | + for ($j = 0; $j < $table_count; $j++) |
|
1586 | 1586 | { |
1587 | - list($table_name) = explode('.',$tmp_files[$j]); |
|
1588 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1587 | + list($table_name) = explode('.', $tmp_files[$j]); |
|
1588 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1589 | 1589 | } |
1590 | 1590 | // Get information of the module |
1591 | 1591 | $info = NULL; |
1592 | 1592 | $info = $this->getModuleInfoXml($module_name); |
1593 | 1593 | |
1594 | - if(!$info) continue; |
|
1594 | + if (!$info) continue; |
|
1595 | 1595 | |
1596 | 1596 | $info->module = $module_name; |
1597 | 1597 | $info->category = $info->category; |
@@ -1600,12 +1600,12 @@ discard block |
||
1600 | 1600 | $info->path = $path; |
1601 | 1601 | $info->admin_index_act = $info->admin_index_act; |
1602 | 1602 | // Check if DB is installed |
1603 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1603 | + if ($table_count > $created_table_count) $info->need_install = true; |
|
1604 | 1604 | else $info->need_install = false; |
1605 | 1605 | // Check if it is upgraded to module.class.php on each module |
1606 | 1606 | $oDummy = null; |
1607 | 1607 | $oDummy = getModule($module_name, 'class'); |
1608 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1608 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1609 | 1609 | { |
1610 | 1610 | $info->need_update = $oDummy->checkUpdate(); |
1611 | 1611 | } |
@@ -1626,15 +1626,15 @@ discard block |
||
1626 | 1626 | */ |
1627 | 1627 | function syncModuleToSite(&$data) |
1628 | 1628 | { |
1629 | - if(!$data) return; |
|
1629 | + if (!$data) return; |
|
1630 | 1630 | |
1631 | - if(is_array($data)) |
|
1631 | + if (is_array($data)) |
|
1632 | 1632 | { |
1633 | - foreach($data as $key => $val) |
|
1633 | + foreach ($data as $key => $val) |
|
1634 | 1634 | { |
1635 | 1635 | $module_srls[] = $val->module_srl; |
1636 | 1636 | } |
1637 | - if(!count($module_srls)) return; |
|
1637 | + if (!count($module_srls)) return; |
|
1638 | 1638 | } |
1639 | 1639 | else |
1640 | 1640 | { |
@@ -1642,17 +1642,17 @@ discard block |
||
1642 | 1642 | } |
1643 | 1643 | |
1644 | 1644 | $args = new stdClass(); |
1645 | - $args->module_srls = implode(',',$module_srls); |
|
1645 | + $args->module_srls = implode(',', $module_srls); |
|
1646 | 1646 | $output = executeQueryArray('module.getModuleSites', $args); |
1647 | - if(!$output->data) return array(); |
|
1648 | - foreach($output->data as $key => $val) |
|
1647 | + if (!$output->data) return array(); |
|
1648 | + foreach ($output->data as $key => $val) |
|
1649 | 1649 | { |
1650 | 1650 | $modules[$val->module_srl] = $val; |
1651 | 1651 | } |
1652 | 1652 | |
1653 | - if(is_array($data)) |
|
1653 | + if (is_array($data)) |
|
1654 | 1654 | { |
1655 | - foreach($data as $key => $val) |
|
1655 | + foreach ($data as $key => $val) |
|
1656 | 1656 | { |
1657 | 1657 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1658 | 1658 | } |
@@ -1668,14 +1668,14 @@ discard block |
||
1668 | 1668 | */ |
1669 | 1669 | function isSiteAdmin($member_info, $site_srl = null) |
1670 | 1670 | { |
1671 | - if(!$member_info->member_srl) return false; |
|
1672 | - if($member_info->is_admin == 'Y') return true; |
|
1671 | + if (!$member_info->member_srl) return false; |
|
1672 | + if ($member_info->is_admin == 'Y') return true; |
|
1673 | 1673 | |
1674 | 1674 | $args = new stdClass(); |
1675 | - if(!isset($site_srl)) |
|
1675 | + if (!isset($site_srl)) |
|
1676 | 1676 | { |
1677 | 1677 | $site_module_info = Context::get('site_module_info'); |
1678 | - if(!$site_module_info) return; |
|
1678 | + if (!$site_module_info) return; |
|
1679 | 1679 | $args->site_srl = $site_module_info->site_srl; |
1680 | 1680 | } |
1681 | 1681 | else |
@@ -1685,7 +1685,7 @@ discard block |
||
1685 | 1685 | |
1686 | 1686 | $args->member_srl = $member_info->member_srl; |
1687 | 1687 | $output = executeQuery('module.isSiteAdmin', $args); |
1688 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1688 | + if ($output->data->member_srl == $args->member_srl) return true; |
|
1689 | 1689 | return false; |
1690 | 1690 | } |
1691 | 1691 | |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | $obj = new stdClass(); |
1709 | 1709 | $obj->module_srl = $module_srl; |
1710 | 1710 | $output = executeQueryArray('module.getAdminID', $obj); |
1711 | - if(!$output->toBool() || !$output->data) return; |
|
1711 | + if (!$output->toBool() || !$output->data) return; |
|
1712 | 1712 | |
1713 | 1713 | return $output->data; |
1714 | 1714 | } |
@@ -1721,20 +1721,20 @@ discard block |
||
1721 | 1721 | { |
1722 | 1722 | $extra_vars = array(); |
1723 | 1723 | $get_module_srls = array(); |
1724 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1724 | + if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1725 | 1725 | |
1726 | 1726 | $vars = false; |
1727 | 1727 | // cache controll |
1728 | 1728 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1729 | - if($oCacheHandler->isSupport()) |
|
1729 | + if ($oCacheHandler->isSupport()) |
|
1730 | 1730 | { |
1731 | - foreach($list_module_srl as $module_srl) |
|
1731 | + foreach ($list_module_srl as $module_srl) |
|
1732 | 1732 | { |
1733 | 1733 | $object_key = 'module_extra_vars:'.$module_srl; |
1734 | 1734 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1735 | 1735 | $vars = $oCacheHandler->get($cache_key); |
1736 | 1736 | |
1737 | - if($vars) |
|
1737 | + if ($vars) |
|
1738 | 1738 | { |
1739 | 1739 | $extra_vars[$module_srl] = $vars; |
1740 | 1740 | } |
@@ -1749,35 +1749,35 @@ discard block |
||
1749 | 1749 | $get_module_srls = $list_module_srl; |
1750 | 1750 | } |
1751 | 1751 | |
1752 | - if(count($get_module_srls) > 0) |
|
1752 | + if (count($get_module_srls) > 0) |
|
1753 | 1753 | { |
1754 | 1754 | $args = new stdClass(); |
1755 | 1755 | $args->module_srl = implode(',', $get_module_srls); |
1756 | 1756 | $output = executeQueryArray('module.getModuleExtraVars', $args); |
1757 | 1757 | |
1758 | - if(!$output->toBool()) |
|
1758 | + if (!$output->toBool()) |
|
1759 | 1759 | { |
1760 | 1760 | return; |
1761 | 1761 | } |
1762 | 1762 | |
1763 | - if(!$output->data) |
|
1763 | + if (!$output->data) |
|
1764 | 1764 | { |
1765 | - foreach($get_module_srls as $module_srl) |
|
1765 | + foreach ($get_module_srls as $module_srl) |
|
1766 | 1766 | { |
1767 | 1767 | $extra_vars[$module_srl] = new stdClass; |
1768 | 1768 | } |
1769 | 1769 | } |
1770 | - foreach($output->data as $key => $val) |
|
1770 | + foreach ($output->data as $key => $val) |
|
1771 | 1771 | { |
1772 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1772 | + if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue; |
|
1773 | 1773 | |
1774 | - if(!isset($extra_vars[$val->module_srl])) |
|
1774 | + if (!isset($extra_vars[$val->module_srl])) |
|
1775 | 1775 | { |
1776 | 1776 | $extra_vars[$val->module_srl] = new stdClass(); |
1777 | 1777 | } |
1778 | 1778 | $extra_vars[$val->module_srl]->{$val->name} = $val->value; |
1779 | 1779 | |
1780 | - if($oCacheHandler->isSupport()) |
|
1780 | + if ($oCacheHandler->isSupport()) |
|
1781 | 1781 | { |
1782 | 1782 | $object_key = 'module_extra_vars:'.$val->module_srl; |
1783 | 1783 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1796,27 +1796,27 @@ discard block |
||
1796 | 1796 | { |
1797 | 1797 | $skin_vars = false; |
1798 | 1798 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1799 | - if($oCacheHandler->isSupport()) |
|
1799 | + if ($oCacheHandler->isSupport()) |
|
1800 | 1800 | { |
1801 | 1801 | $object_key = 'module_skin_vars:'.$module_srl; |
1802 | 1802 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1803 | 1803 | $skin_vars = $oCacheHandler->get($cache_key); |
1804 | 1804 | } |
1805 | 1805 | |
1806 | - if($skin_vars === false) |
|
1806 | + if ($skin_vars === false) |
|
1807 | 1807 | { |
1808 | 1808 | $args = new stdClass(); |
1809 | 1809 | $args->module_srl = $module_srl; |
1810 | - $output = executeQueryArray('module.getModuleSkinVars',$args); |
|
1811 | - if(!$output->toBool()) return; |
|
1810 | + $output = executeQueryArray('module.getModuleSkinVars', $args); |
|
1811 | + if (!$output->toBool()) return; |
|
1812 | 1812 | |
1813 | 1813 | $skin_vars = array(); |
1814 | - foreach($output->data as $vars) |
|
1814 | + foreach ($output->data as $vars) |
|
1815 | 1815 | { |
1816 | 1816 | $skin_vars[$vars->name] = $vars; |
1817 | 1817 | } |
1818 | 1818 | |
1819 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1819 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1820 | 1820 | } |
1821 | 1821 | |
1822 | 1822 | return $skin_vars; |
@@ -1828,32 +1828,32 @@ discard block |
||
1828 | 1828 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1829 | 1829 | { |
1830 | 1830 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1831 | - if(!$site_srl) $site_srl = 0; |
|
1831 | + if (!$site_srl) $site_srl = 0; |
|
1832 | 1832 | |
1833 | 1833 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1834 | - if(is_readable($designInfoFile)) |
|
1834 | + if (is_readable($designInfoFile)) |
|
1835 | 1835 | { |
1836 | 1836 | include($designInfoFile); |
1837 | 1837 | |
1838 | 1838 | $skinName = $designInfo->module->{$module_name}->{$target}; |
1839 | 1839 | } |
1840 | - if(!$skinName) |
|
1840 | + if (!$skinName) |
|
1841 | 1841 | { |
1842 | 1842 | $dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/'; |
1843 | 1843 | $moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir; |
1844 | 1844 | |
1845 | - if(is_dir($moduleSkinPath.'default')) |
|
1845 | + if (is_dir($moduleSkinPath.'default')) |
|
1846 | 1846 | { |
1847 | 1847 | $skinName = 'default'; |
1848 | 1848 | } |
1849 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
1849 | + else if (is_dir($moduleSkinPath.'xe_default')) |
|
1850 | 1850 | { |
1851 | 1851 | $skinName = 'xe_default'; |
1852 | 1852 | } |
1853 | 1853 | else |
1854 | 1854 | { |
1855 | 1855 | $skins = FileHandler::readDir($moduleSkinPath); |
1856 | - if(count($skins) > 0) |
|
1856 | + if (count($skins) > 0) |
|
1857 | 1857 | { |
1858 | 1858 | $skinName = $skins[0]; |
1859 | 1859 | } |
@@ -1863,9 +1863,9 @@ discard block |
||
1863 | 1863 | } |
1864 | 1864 | } |
1865 | 1865 | |
1866 | - if($updateCache && $skinName) |
|
1866 | + if ($updateCache && $skinName) |
|
1867 | 1867 | { |
1868 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1868 | + if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1869 | 1869 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1870 | 1870 | |
1871 | 1871 | $oAdminController = getAdminController('admin'); |
@@ -1881,10 +1881,10 @@ discard block |
||
1881 | 1881 | */ |
1882 | 1882 | function syncSkinInfoToModuleInfo(&$module_info) |
1883 | 1883 | { |
1884 | - if(!$module_info->module_srl) return; |
|
1884 | + if (!$module_info->module_srl) return; |
|
1885 | 1885 | |
1886 | 1886 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1887 | - if(Mobile::isFromMobilePhone()) |
|
1887 | + if (Mobile::isFromMobilePhone()) |
|
1888 | 1888 | { |
1889 | 1889 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1890 | 1890 | } |
@@ -1893,11 +1893,11 @@ discard block |
||
1893 | 1893 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1894 | 1894 | } |
1895 | 1895 | |
1896 | - if(!$skin_vars) return; |
|
1896 | + if (!$skin_vars) return; |
|
1897 | 1897 | |
1898 | - foreach($skin_vars as $name => $val) |
|
1898 | + foreach ($skin_vars as $name => $val) |
|
1899 | 1899 | { |
1900 | - if(isset($module_info->{$name})) continue; |
|
1900 | + if (isset($module_info->{$name})) continue; |
|
1901 | 1901 | $module_info->{$name} = $val->value; |
1902 | 1902 | } |
1903 | 1903 | } |
@@ -1911,27 +1911,27 @@ discard block |
||
1911 | 1911 | { |
1912 | 1912 | $skin_vars = false; |
1913 | 1913 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1914 | - if($oCacheHandler->isSupport()) |
|
1914 | + if ($oCacheHandler->isSupport()) |
|
1915 | 1915 | { |
1916 | 1916 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
1917 | 1917 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1918 | 1918 | $skin_vars = $oCacheHandler->get($cache_key); |
1919 | 1919 | } |
1920 | 1920 | |
1921 | - if($skin_vars === false) |
|
1921 | + if ($skin_vars === false) |
|
1922 | 1922 | { |
1923 | 1923 | $args = new stdClass(); |
1924 | 1924 | $args->module_srl = $module_srl; |
1925 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1926 | - if(!$output->toBool() || !$output->data) return; |
|
1925 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1926 | + if (!$output->toBool() || !$output->data) return; |
|
1927 | 1927 | |
1928 | 1928 | $skin_vars = array(); |
1929 | - foreach($output->data as $vars) |
|
1929 | + foreach ($output->data as $vars) |
|
1930 | 1930 | { |
1931 | 1931 | $skin_vars[$vars->name] = $vars; |
1932 | 1932 | } |
1933 | 1933 | |
1934 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1934 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1935 | 1935 | } |
1936 | 1936 | |
1937 | 1937 | return $skin_vars; |
@@ -1943,32 +1943,32 @@ discard block |
||
1943 | 1943 | */ |
1944 | 1944 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1945 | 1945 | { |
1946 | - if(!$module_info->module_srl) return; |
|
1946 | + if (!$module_info->module_srl) return; |
|
1947 | 1947 | $skin_vars = false; |
1948 | 1948 | // cache controll |
1949 | 1949 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1950 | - if($oCacheHandler->isSupport()) |
|
1950 | + if ($oCacheHandler->isSupport()) |
|
1951 | 1951 | { |
1952 | 1952 | $object_key = 'module_mobile_skin_vars:'.$module_info->module_srl; |
1953 | 1953 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1954 | 1954 | $skin_vars = $oCacheHandler->get($cache_key); |
1955 | 1955 | } |
1956 | - if($skin_vars === false) |
|
1956 | + if ($skin_vars === false) |
|
1957 | 1957 | { |
1958 | 1958 | $args = new stdClass; |
1959 | 1959 | $args->module_srl = $module_info->module_srl; |
1960 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1961 | - if(!$output->toBool()) return; |
|
1960 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1961 | + if (!$output->toBool()) return; |
|
1962 | 1962 | $skin_vars = $output->data; |
1963 | 1963 | |
1964 | 1964 | //insert in cache |
1965 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1965 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1966 | 1966 | } |
1967 | - if(!$skin_vars) return; |
|
1967 | + if (!$skin_vars) return; |
|
1968 | 1968 | |
1969 | - foreach($output->data as $val) |
|
1969 | + foreach ($output->data as $val) |
|
1970 | 1970 | { |
1971 | - if(isset($module_info->{$val->name})) continue; |
|
1971 | + if (isset($module_info->{$val->name})) continue; |
|
1972 | 1972 | $module_info->{$val->name} = $val->value; |
1973 | 1973 | } |
1974 | 1974 | } |
@@ -1980,7 +1980,7 @@ discard block |
||
1980 | 1980 | { |
1981 | 1981 | $grant = new stdClass(); |
1982 | 1982 | |
1983 | - if(!$xml_info) |
|
1983 | + if (!$xml_info) |
|
1984 | 1984 | { |
1985 | 1985 | $module = $module_info->module; |
1986 | 1986 | $xml_info = $this->getModuleActionXml($module); |
@@ -1988,9 +1988,9 @@ discard block |
||
1988 | 1988 | // Set variables to grant group permission |
1989 | 1989 | $module_srl = $module_info->module_srl; |
1990 | 1990 | $grant_info = $xml_info->grant; |
1991 | - if($member_info->member_srl) |
|
1991 | + if ($member_info->member_srl) |
|
1992 | 1992 | { |
1993 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
1993 | + if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
1994 | 1994 | else $group_list = array(); |
1995 | 1995 | } |
1996 | 1996 | else |
@@ -1998,10 +1998,10 @@ discard block |
||
1998 | 1998 | $group_list = array(); |
1999 | 1999 | } |
2000 | 2000 | // If module_srl doesn't exist(if unable to set permissions) |
2001 | - if(!$module_srl) |
|
2001 | + if (!$module_srl) |
|
2002 | 2002 | { |
2003 | 2003 | $grant->access = true; |
2004 | - if($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2004 | + if ($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2005 | 2005 | { |
2006 | 2006 | $grant->access = $grant->manager = $grant->is_site_admin = true; |
2007 | 2007 | } |
@@ -2012,23 +2012,23 @@ discard block |
||
2012 | 2012 | { |
2013 | 2013 | // If module_srl exists |
2014 | 2014 | // Get a type of granted permission |
2015 | - $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false; |
|
2015 | + $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false; |
|
2016 | 2016 | $grant->is_admin = ($member_info->is_admin == 'Y') ? true : false; |
2017 | 2017 | // If a just logged-in member is, check if the member is a module administrator |
2018 | - if(!$grant->manager && $member_info->member_srl) |
|
2018 | + if (!$grant->manager && $member_info->member_srl) |
|
2019 | 2019 | { |
2020 | 2020 | $args = new stdClass(); |
2021 | 2021 | $args->module_srl = $module_srl; |
2022 | 2022 | $args->member_srl = $member_info->member_srl; |
2023 | - $output = executeQuery('module.getModuleAdmin',$args); |
|
2024 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2023 | + $output = executeQuery('module.getModuleAdmin', $args); |
|
2024 | + if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2025 | 2025 | } |
2026 | 2026 | // If not an administrator, get information from the DB and grant manager privilege. |
2027 | - if(!$grant->manager) |
|
2027 | + if (!$grant->manager) |
|
2028 | 2028 | { |
2029 | 2029 | $args = new stdClass(); |
2030 | 2030 | // If planet, get permission settings from the planet home |
2031 | - if($module_info->module == 'planet') |
|
2031 | + if ($module_info->module == 'planet') |
|
2032 | 2032 | { |
2033 | 2033 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2034 | 2034 | } |
@@ -2041,37 +2041,37 @@ discard block |
||
2041 | 2041 | |
2042 | 2042 | $grant_exists = $granted = array(); |
2043 | 2043 | |
2044 | - if($output->data) |
|
2044 | + if ($output->data) |
|
2045 | 2045 | { |
2046 | 2046 | // Arrange names and groups who has privileges |
2047 | - foreach($output->data as $val) |
|
2047 | + foreach ($output->data as $val) |
|
2048 | 2048 | { |
2049 | 2049 | $grant_exists[$val->name] = true; |
2050 | - if($granted[$val->name]) continue; |
|
2050 | + if ($granted[$val->name]) continue; |
|
2051 | 2051 | // Log-in member only |
2052 | - if($val->group_srl == -1) |
|
2052 | + if ($val->group_srl == -1) |
|
2053 | 2053 | { |
2054 | 2054 | $granted[$val->name] = true; |
2055 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2055 | + if ($member_info->member_srl) $grant->{$val->name} = true; |
|
2056 | 2056 | // Site-joined member only |
2057 | 2057 | } |
2058 | - elseif($val->group_srl == -2) |
|
2058 | + elseif ($val->group_srl == -2) |
|
2059 | 2059 | { |
2060 | 2060 | $granted[$val->name] = true; |
2061 | 2061 | // Do not grant any permission for non-logged member |
2062 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2062 | + if (!$member_info->member_srl) $grant->{$val->name} = false; |
|
2063 | 2063 | // Log-in member |
2064 | 2064 | else |
2065 | 2065 | { |
2066 | 2066 | $site_module_info = Context::get('site_module_info'); |
2067 | 2067 | // Permission granted if no information of the currently connected site exists |
2068 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2068 | + if (!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2069 | 2069 | // Permission is not granted if information of the currently connected site exists |
2070 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2070 | + elseif (count($group_list)) $grant->{$val->name} = true; |
|
2071 | 2071 | } |
2072 | 2072 | // All of non-logged members |
2073 | 2073 | } |
2074 | - elseif($val->group_srl == 0) |
|
2074 | + elseif ($val->group_srl == 0) |
|
2075 | 2075 | { |
2076 | 2076 | $granted[$val->name] = true; |
2077 | 2077 | $grant->{$val->name} = true; |
@@ -2079,7 +2079,7 @@ discard block |
||
2079 | 2079 | } |
2080 | 2080 | else |
2081 | 2081 | { |
2082 | - if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2082 | + if ($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2083 | 2083 | { |
2084 | 2084 | $grant->{$val->name} = true; |
2085 | 2085 | $granted[$val->name] = true; |
@@ -2088,29 +2088,29 @@ discard block |
||
2088 | 2088 | } |
2089 | 2089 | } |
2090 | 2090 | // Separate processing for the virtual group access |
2091 | - if(!$grant_exists['access']) $grant->access = true; |
|
2092 | - if(count($grant_info)) |
|
2091 | + if (!$grant_exists['access']) $grant->access = true; |
|
2092 | + if (count($grant_info)) |
|
2093 | 2093 | { |
2094 | - foreach($grant_info as $grant_name => $grant_item) |
|
2094 | + foreach ($grant_info as $grant_name => $grant_item) |
|
2095 | 2095 | { |
2096 | - if($grant_exists[$grant_name]) continue; |
|
2097 | - switch($grant_item->default) |
|
2096 | + if ($grant_exists[$grant_name]) continue; |
|
2097 | + switch ($grant_item->default) |
|
2098 | 2098 | { |
2099 | 2099 | case 'guest' : |
2100 | 2100 | $grant->{$grant_name} = true; |
2101 | 2101 | break; |
2102 | 2102 | case 'member' : |
2103 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2103 | + if ($member_info->member_srl) $grant->{$grant_name} = true; |
|
2104 | 2104 | else $grant->{$grant_name} = false; |
2105 | 2105 | break; |
2106 | 2106 | case 'site' : |
2107 | 2107 | $site_module_info = Context::get('site_module_info'); |
2108 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2108 | + if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2109 | 2109 | else $grant->{$grant_name} = false; |
2110 | 2110 | break; |
2111 | 2111 | case 'manager' : |
2112 | 2112 | case 'root' : |
2113 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2113 | + if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2114 | 2114 | else $grant->{$grant_name} = false; |
2115 | 2115 | break; |
2116 | 2116 | } |
@@ -2118,12 +2118,12 @@ discard block |
||
2118 | 2118 | } |
2119 | 2119 | } |
2120 | 2120 | // Set true to grant all privileges if an administrator is |
2121 | - if($grant->manager) |
|
2121 | + if ($grant->manager) |
|
2122 | 2122 | { |
2123 | 2123 | $grant->access = true; |
2124 | - if(count($grant_info)) |
|
2124 | + if (count($grant_info)) |
|
2125 | 2125 | { |
2126 | - foreach($grant_info as $key => $val) |
|
2126 | + foreach ($grant_info as $key => $val) |
|
2127 | 2127 | { |
2128 | 2128 | $grant->{$key} = true; |
2129 | 2129 | } |
@@ -2155,27 +2155,27 @@ discard block |
||
2155 | 2155 | |
2156 | 2156 | function unserializeAttributes($module_filebox_list) |
2157 | 2157 | { |
2158 | - if(is_array($module_filebox_list->data)) |
|
2158 | + if (is_array($module_filebox_list->data)) |
|
2159 | 2159 | { |
2160 | - foreach($module_filebox_list->data as &$item) |
|
2160 | + foreach ($module_filebox_list->data as &$item) |
|
2161 | 2161 | { |
2162 | - if(empty($item->comment)) |
|
2162 | + if (empty($item->comment)) |
|
2163 | 2163 | { |
2164 | 2164 | continue; |
2165 | 2165 | } |
2166 | 2166 | |
2167 | 2167 | $attributes = explode(';', $item->comment); |
2168 | - foreach($attributes as $attribute) |
|
2168 | + foreach ($attributes as $attribute) |
|
2169 | 2169 | { |
2170 | 2170 | $values = explode(':', $attribute); |
2171 | - if((count($values) % 2) ==1) |
|
2171 | + if ((count($values) % 2) == 1) |
|
2172 | 2172 | { |
2173 | - for($i=2;$i<count($values);$i++) |
|
2173 | + for ($i = 2; $i < count($values); $i++) |
|
2174 | 2174 | { |
2175 | - $values[1].=":".$values[$i]; |
|
2175 | + $values[1] .= ":".$values[$i]; |
|
2176 | 2176 | } |
2177 | 2177 | } |
2178 | - $atts[$values[0]]=$values[1]; |
|
2178 | + $atts[$values[0]] = $values[1]; |
|
2179 | 2179 | } |
2180 | 2180 | $item->attributes = $atts; |
2181 | 2181 | unset($atts); |
@@ -2187,16 +2187,16 @@ discard block |
||
2187 | 2187 | function getFileBoxListHtml() |
2188 | 2188 | { |
2189 | 2189 | $logged_info = Context::get('logged_info'); |
2190 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
2190 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
2191 | 2191 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2192 | - $link_params = explode('&',$link['query']); |
|
2192 | + $link_params = explode('&', $link['query']); |
|
2193 | 2193 | foreach ($link_params as $param) |
2194 | 2194 | { |
2195 | - $param = explode("=",$param); |
|
2196 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2195 | + $param = explode("=", $param); |
|
2196 | + if ($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2197 | 2197 | } |
2198 | 2198 | $oWidgetModel = getModel('widget'); |
2199 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2199 | + if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2200 | 2200 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2201 | 2201 | |
2202 | 2202 | $oModuleModel = getModel('module'); |
@@ -2212,24 +2212,24 @@ discard block |
||
2212 | 2212 | $security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); |
2213 | 2213 | |
2214 | 2214 | $oTemplate = &TemplateHandler::getInstance(); |
2215 | - $html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html'); |
|
2215 | + $html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html'); |
|
2216 | 2216 | |
2217 | 2217 | $this->add('html', $html); |
2218 | 2218 | } |
2219 | 2219 | |
2220 | 2220 | function getModuleFileBoxPath($module_filebox_srl) |
2221 | 2221 | { |
2222 | - return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3)); |
|
2222 | + return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3)); |
|
2223 | 2223 | } |
2224 | 2224 | |
2225 | 2225 | /** |
2226 | 2226 | * @brief Return ruleset cache file path |
2227 | 2227 | * @param module, act |
2228 | 2228 | */ |
2229 | - function getValidatorFilePath($module, $ruleset, $mid=null) |
|
2229 | + function getValidatorFilePath($module, $ruleset, $mid = null) |
|
2230 | 2230 | { |
2231 | 2231 | // load dynamic ruleset xml file |
2232 | - if(strpos($ruleset, '@') !== false) |
|
2232 | + if (strpos($ruleset, '@') !== false) |
|
2233 | 2233 | { |
2234 | 2234 | $rulsetFile = str_replace('@', '', $ruleset); |
2235 | 2235 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
@@ -2239,20 +2239,20 @@ discard block |
||
2239 | 2239 | { |
2240 | 2240 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2241 | 2241 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2242 | - if(is_readable($xml_file)) |
|
2242 | + if (is_readable($xml_file)) |
|
2243 | 2243 | return FileHandler::getRealPath($xml_file); |
2244 | - else{ |
|
2244 | + else { |
|
2245 | 2245 | $ruleset = str_replace('#', '', $ruleset); |
2246 | 2246 | } |
2247 | 2247 | |
2248 | 2248 | } |
2249 | 2249 | // Get a path of the requested module. Return if not exists. |
2250 | 2250 | $class_path = ModuleHandler::getModulePath($module); |
2251 | - if(!$class_path) return; |
|
2251 | + if (!$class_path) return; |
|
2252 | 2252 | |
2253 | 2253 | // Check if module.xml exists in the path. Return if not exist |
2254 | 2254 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2255 | - if(!file_exists($xml_file)) return; |
|
2255 | + if (!file_exists($xml_file)) return; |
|
2256 | 2256 | |
2257 | 2257 | return $xml_file; |
2258 | 2258 | } |
@@ -2264,7 +2264,7 @@ discard block |
||
2264 | 2264 | $requestVars = Context::getRequestVars(); |
2265 | 2265 | |
2266 | 2266 | $args = new stdClass; |
2267 | - $args->site_srl = (int)$requestVars->site_srl; |
|
2267 | + $args->site_srl = (int) $requestVars->site_srl; |
|
2268 | 2268 | $args->page = 1; // /< Page |
2269 | 2269 | $args->list_count = 100; // /< the number of posts to display on a single page |
2270 | 2270 | $args->page_count = 5; // /< the number of pages that appear in the page navigation |
@@ -2276,9 +2276,9 @@ discard block |
||
2276 | 2276 | |
2277 | 2277 | $list = array(); |
2278 | 2278 | |
2279 | - if($output->toBool()) |
|
2279 | + if ($output->toBool()) |
|
2280 | 2280 | { |
2281 | - foreach((array)$output->data as $code_info) |
|
2281 | + foreach ((array) $output->data as $code_info) |
|
2282 | 2282 | { |
2283 | 2283 | unset($codeInfo); |
2284 | 2284 | $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); |
@@ -19,26 +19,34 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function isIDExists($id, $site_srl = 0) |
21 | 21 | { |
22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
22 | + if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) { |
|
23 | + return true; |
|
24 | + } |
|
23 | 25 | // directory and rss/atom/api reserved checking, etc. |
24 | 26 | $dirs = FileHandler::readDir(_XE_PATH_); |
25 | 27 | $dirs[] = 'rss'; |
26 | 28 | $dirs[] = 'atom'; |
27 | 29 | $dirs[] = 'api'; |
28 | - if(in_array($id, $dirs)) return true; |
|
30 | + if(in_array($id, $dirs)) { |
|
31 | + return true; |
|
32 | + } |
|
29 | 33 | // mid test |
30 | 34 | $args = new stdClass(); |
31 | 35 | $args->mid = $id; |
32 | 36 | $args->site_srl = $site_srl; |
33 | 37 | $output = executeQuery('module.isExistsModuleName', $args); |
34 | - if($output->data->count) return true; |
|
38 | + if($output->data->count) { |
|
39 | + return true; |
|
40 | + } |
|
35 | 41 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
36 | 42 | if(!$site_srl) |
37 | 43 | { |
38 | 44 | $site_args = new stdClass(); |
39 | 45 | $site_args->domain = $id; |
40 | 46 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
41 | - if($output->data->count) return true; |
|
47 | + if($output->data->count) { |
|
48 | + return true; |
|
49 | + } |
|
42 | 50 | } |
43 | 51 | |
44 | 52 | return false; |
@@ -82,10 +90,14 @@ discard block |
||
82 | 90 | function getDefaultMid() |
83 | 91 | { |
84 | 92 | $default_url = Context::getDefaultUrl(); |
85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
93 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
94 | + $default_url = substr($default_url, 0, -1); |
|
95 | + } |
|
86 | 96 | |
87 | 97 | $request_url = Context::getRequestUri(); |
88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
98 | + if($request_url && substr_compare($request_url, '/', -1) === 0) { |
|
99 | + $request_url = substr($request_url, 0, -1); |
|
100 | + } |
|
89 | 101 | |
90 | 102 | $default_url_parse = parse_url($default_url); |
91 | 103 | $request_url_parse = parse_url($request_url); |
@@ -100,14 +112,18 @@ discard block |
||
100 | 112 | $hostname = $request_url_parse['host']; |
101 | 113 | $path = $request_url_parse['path']; |
102 | 114 | $port = $request_url_parse['port']; |
103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
115 | + if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) { |
|
116 | + $path = substr($path, 0, -1); |
|
117 | + } |
|
104 | 118 | |
105 | 119 | $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
106 | 120 | } |
107 | 121 | |
108 | 122 | if($domain === '') |
109 | 123 | { |
110 | - if(!$vid) $vid = $mid; |
|
124 | + if(!$vid) { |
|
125 | + $vid = $mid; |
|
126 | + } |
|
111 | 127 | if($vid) |
112 | 128 | { |
113 | 129 | $domain = $vid; |
@@ -133,13 +149,17 @@ discard block |
||
133 | 149 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
134 | 150 | $site_info = $output->data; |
135 | 151 | |
136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
152 | + if($oCacheHandler->isSupport()) { |
|
153 | + $oCacheHandler->put($domain_cache_key, $site_info); |
|
154 | + } |
|
137 | 155 | } |
138 | 156 | |
139 | 157 | if($site_info && $vid) |
140 | 158 | { |
141 | 159 | Context::set('vid', $site_info->domain, true); |
142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
160 | + if(strtolower($mid)==strtolower($site_info->domain)) { |
|
161 | + Context::set('mid', $site_info->mid,true); |
|
162 | + } |
|
143 | 163 | } |
144 | 164 | if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
145 | 165 | } |
@@ -165,8 +185,12 @@ discard block |
||
165 | 185 | { |
166 | 186 | // Create a table if sites table doesn't exist |
167 | 187 | $oDB = &DB::getInstance(); |
168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | - if(!$oDB->isTableExists('sites')) return; |
|
188 | + if(!$oDB->isTableExists('sites')) { |
|
189 | + $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
190 | + } |
|
191 | + if(!$oDB->isTableExists('sites')) { |
|
192 | + return; |
|
193 | + } |
|
170 | 194 | |
171 | 195 | // Get mid, language |
172 | 196 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
@@ -184,21 +208,28 @@ discard block |
||
184 | 208 | if($output->data && !$output->data->index_module_srl) |
185 | 209 | { |
186 | 210 | $output = executeQuery('module.updateSite', $site_args); |
187 | - } |
|
188 | - else |
|
211 | + } else |
|
189 | 212 | { |
190 | 213 | $output = executeQuery('module.insertSite', $site_args); |
191 | - if(!$output->toBool()) return $output; |
|
214 | + if(!$output->toBool()) { |
|
215 | + return $output; |
|
216 | + } |
|
192 | 217 | } |
193 | 218 | $output = executeQuery('module.getSiteInfo', $args); |
194 | 219 | } |
195 | 220 | $site_info = $output->data; |
196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
221 | + if($oCacheHandler->isSupport()) { |
|
222 | + $oCacheHandler->put($default_site_cache_key, $site_info); |
|
223 | + } |
|
197 | 224 | } |
198 | 225 | } |
199 | 226 | |
200 | - if(!$site_info->module_srl) return $site_info; |
|
201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
227 | + if(!$site_info->module_srl) { |
|
228 | + return $site_info; |
|
229 | + } |
|
230 | + if(is_array($site_info) && $site_info->data[0]) { |
|
231 | + $site_info = $site_info[0]; |
|
232 | + } |
|
202 | 233 | return $this->addModuleExtraVars($site_info); |
203 | 234 | } |
204 | 235 | |
@@ -248,7 +279,9 @@ discard block |
||
248 | 279 | } |
249 | 280 | |
250 | 281 | $this->applyDefaultSkin($module_info); |
251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
282 | + if(!$module_info->module_srl && $module_info->data[0]) { |
|
283 | + $module_info = $module_info->data[0]; |
|
284 | + } |
|
252 | 285 | return $this->addModuleExtraVars($module_info); |
253 | 286 | } |
254 | 287 | |
@@ -340,8 +373,7 @@ discard block |
||
340 | 373 | $object_key = 'mid_info:' . $output->data->module_srl; |
341 | 374 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
342 | 375 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
343 | - } |
|
344 | - else |
|
376 | + } else |
|
345 | 377 | { |
346 | 378 | $mid_info->designSettings = $moduleInfo->designSettings; |
347 | 379 | $moduleInfo = $mid_info; |
@@ -382,11 +414,15 @@ discard block |
||
382 | 414 | $args = new stdClass(); |
383 | 415 | $args->module_srl = $module_srl; |
384 | 416 | $output = executeQuery('module.getMidInfo', $args); |
385 | - if(!$output->toBool()) return; |
|
417 | + if(!$output->toBool()) { |
|
418 | + return; |
|
419 | + } |
|
386 | 420 | |
387 | 421 | $mid_info = $output->data; |
388 | 422 | $this->applyDefaultSkin($mid_info); |
389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
423 | + if($oCacheHandler->isSupport()) { |
|
424 | + $oCacheHandler->put($cache_key, $mid_info); |
|
425 | + } |
|
390 | 426 | } |
391 | 427 | |
392 | 428 | if($mid_info && count($columnList)) |
@@ -399,11 +435,14 @@ discard block |
||
399 | 435 | $module_info->$key = $item; |
400 | 436 | } |
401 | 437 | } |
438 | + } else { |
|
439 | + $module_info = $mid_info; |
|
402 | 440 | } |
403 | - else $module_info = $mid_info; |
|
404 | 441 | |
405 | 442 | $oModuleController = getController('module'); |
406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
443 | + if(isset($module_info->browser_title)) { |
|
444 | + $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
445 | + } |
|
407 | 446 | |
408 | 447 | $this->applyDefaultSkin($module_info); |
409 | 448 | return $this->addModuleExtraVars($module_info); |
@@ -451,11 +490,15 @@ discard block |
||
451 | 490 | */ |
452 | 491 | function getModulesInfo($module_srls, $columnList = array()) |
453 | 492 | { |
454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
493 | + if(is_array($module_srls)) { |
|
494 | + $module_srls = implode(',',$module_srls); |
|
495 | + } |
|
455 | 496 | $args = new stdClass(); |
456 | 497 | $args->module_srls = $module_srls; |
457 | 498 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
458 | - if(!$output->toBool()) return; |
|
499 | + if(!$output->toBool()) { |
|
500 | + return; |
|
501 | + } |
|
459 | 502 | return $this->addModuleExtraVars($output->data); |
460 | 503 | } |
461 | 504 | |
@@ -465,31 +508,44 @@ discard block |
||
465 | 508 | function addModuleExtraVars($module_info) |
466 | 509 | { |
467 | 510 | // Process although one or more module informaion is requested |
468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
469 | - else $target_module_info = $module_info; |
|
511 | + if(!is_array($module_info)) { |
|
512 | + $target_module_info = array($module_info); |
|
513 | + } else { |
|
514 | + $target_module_info = $module_info; |
|
515 | + } |
|
470 | 516 | // Get module_srl |
471 | 517 | $module_srls = array(); |
472 | 518 | foreach($target_module_info as $key => $val) |
473 | 519 | { |
474 | 520 | $module_srl = $val->module_srl; |
475 | - if(!$module_srl) continue; |
|
521 | + if(!$module_srl) { |
|
522 | + continue; |
|
523 | + } |
|
476 | 524 | $module_srls[] = $val->module_srl; |
477 | 525 | } |
478 | 526 | // Extract extra information of the module and skin |
479 | 527 | $extra_vars = $this->getModuleExtraVars($module_srls); |
480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
528 | + if(!count($module_srls) || !count($extra_vars)) { |
|
529 | + return $module_info; |
|
530 | + } |
|
481 | 531 | |
482 | 532 | foreach($target_module_info as $key => $val) |
483 | 533 | { |
484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
534 | + if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) { |
|
535 | + continue; |
|
536 | + } |
|
485 | 537 | foreach($extra_vars[$val->module_srl] as $k => $v) |
486 | 538 | { |
487 | - if($target_module_info[$key]->{$k}) continue; |
|
539 | + if($target_module_info[$key]->{$k}) { |
|
540 | + continue; |
|
541 | + } |
|
488 | 542 | $target_module_info[$key]->{$k} = $v; |
489 | 543 | } |
490 | 544 | } |
491 | 545 | |
492 | - if(is_array($module_info)) return $target_module_info; |
|
546 | + if(is_array($module_info)) { |
|
547 | + return $target_module_info; |
|
548 | + } |
|
493 | 549 | return $target_module_info[0]; |
494 | 550 | } |
495 | 551 | |
@@ -518,7 +574,9 @@ discard block |
||
518 | 574 | } |
519 | 575 | |
520 | 576 | $output = executeQuery('module.getMidList', $args, $columnList); |
521 | - if(!$output->toBool()) return $output; |
|
577 | + if(!$output->toBool()) { |
|
578 | + return $output; |
|
579 | + } |
|
522 | 580 | $list = $output->data; |
523 | 581 | |
524 | 582 | if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
@@ -526,9 +584,13 @@ discard block |
||
526 | 584 | $oCacheHandler->put($cache_key, $list); |
527 | 585 | } |
528 | 586 | } |
529 | - if(!$list) return; |
|
587 | + if(!$list) { |
|
588 | + return; |
|
589 | + } |
|
530 | 590 | |
531 | - if(!is_array($list)) $list = array($list); |
|
591 | + if(!is_array($list)) { |
|
592 | + $list = array($list); |
|
593 | + } |
|
532 | 594 | |
533 | 595 | foreach($list as $val) |
534 | 596 | { |
@@ -544,10 +606,14 @@ discard block |
||
544 | 606 | function getModuleSrlList($args = null, $columnList = array()) |
545 | 607 | { |
546 | 608 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
547 | - if(!$output->toBool()) return $output; |
|
609 | + if(!$output->toBool()) { |
|
610 | + return $output; |
|
611 | + } |
|
548 | 612 | |
549 | 613 | $list = $output->data; |
550 | - if(!$list) return; |
|
614 | + if(!$list) { |
|
615 | + return; |
|
616 | + } |
|
551 | 617 | |
552 | 618 | return $list; |
553 | 619 | } |
@@ -557,20 +623,32 @@ discard block |
||
557 | 623 | */ |
558 | 624 | function getModuleSrlByMid($mid) |
559 | 625 | { |
560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
626 | + if($mid && !is_array($mid)) { |
|
627 | + $mid = explode(',',$mid); |
|
628 | + } |
|
629 | + if(is_array($mid)) { |
|
630 | + $mid = "'".implode("','",$mid)."'"; |
|
631 | + } |
|
562 | 632 | |
563 | 633 | $site_module_info = Context::get('site_module_info'); |
564 | 634 | |
565 | 635 | $args = new stdClass; |
566 | 636 | $args->mid = $mid; |
567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
637 | + if($site_module_info) { |
|
638 | + $args->site_srl = $site_module_info->site_srl; |
|
639 | + } |
|
568 | 640 | $output = executeQuery('module.getModuleSrlByMid', $args); |
569 | - if(!$output->toBool()) return $output; |
|
641 | + if(!$output->toBool()) { |
|
642 | + return $output; |
|
643 | + } |
|
570 | 644 | |
571 | 645 | $list = $output->data; |
572 | - if(!$list) return; |
|
573 | - if(!is_array($list)) $list = array($list); |
|
646 | + if(!$list) { |
|
647 | + return; |
|
648 | + } |
|
649 | + if(!is_array($list)) { |
|
650 | + $list = array($list); |
|
651 | + } |
|
574 | 652 | |
575 | 653 | foreach($list as $key => $val) |
576 | 654 | { |
@@ -599,8 +677,12 @@ discard block |
||
599 | 677 | { |
600 | 678 | $args = new stdClass(); |
601 | 679 | $output = executeQueryArray('module.getActionForward',$args); |
602 | - if(!$output->toBool()) return new stdClass; |
|
603 | - if(!$output->data) $output->data = array(); |
|
680 | + if(!$output->toBool()) { |
|
681 | + return new stdClass; |
|
682 | + } |
|
683 | + if(!$output->data) { |
|
684 | + $output->data = array(); |
|
685 | + } |
|
604 | 686 | |
605 | 687 | $action_forward = array(); |
606 | 688 | foreach($output->data as $item) |
@@ -617,8 +699,7 @@ discard block |
||
617 | 699 | if($action_forward[$act]) |
618 | 700 | { |
619 | 701 | return $action_forward[$act]; |
620 | - } |
|
621 | - else |
|
702 | + } else |
|
622 | 703 | { |
623 | 704 | return new stdClass(); |
624 | 705 | } |
@@ -726,8 +807,7 @@ discard block |
||
726 | 807 | if(file_exists($cache_file)) |
727 | 808 | { |
728 | 809 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
729 | - } |
|
730 | - else |
|
810 | + } else |
|
731 | 811 | { |
732 | 812 | $GLOBALS['__MODULE_EXTEND__'] = array(); |
733 | 813 | } |
@@ -743,16 +823,22 @@ discard block |
||
743 | 823 | { |
744 | 824 | // Get a path of the requested module. Return if not exists. |
745 | 825 | $module_path = ModuleHandler::getModulePath($module); |
746 | - if(!$module_path) return; |
|
826 | + if(!$module_path) { |
|
827 | + return; |
|
828 | + } |
|
747 | 829 | // Read the xml file for module skin information |
748 | 830 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
749 | - if(!file_exists($xml_file)) return; |
|
831 | + if(!file_exists($xml_file)) { |
|
832 | + return; |
|
833 | + } |
|
750 | 834 | |
751 | 835 | $oXmlParser = new XmlParser(); |
752 | 836 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
753 | 837 | $xml_obj = $tmp_xml_obj->module; |
754 | 838 | |
755 | - if(!$xml_obj) return; |
|
839 | + if(!$xml_obj) { |
|
840 | + return; |
|
841 | + } |
|
756 | 842 | |
757 | 843 | // Module Information |
758 | 844 | $module_info = new stdClass(); |
@@ -764,14 +850,19 @@ discard block |
||
764 | 850 | $module_info->version = $xml_obj->version->body; |
765 | 851 | $module_info->homepage = $xml_obj->link->body; |
766 | 852 | $module_info->category = $xml_obj->category->body; |
767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
853 | + if(!$module_info->category) { |
|
854 | + $module_info->category = 'service'; |
|
855 | + } |
|
768 | 856 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 857 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
770 | 858 | $module_info->license = $xml_obj->license->body; |
771 | 859 | $module_info->license_link = $xml_obj->license->attrs->link; |
772 | 860 | |
773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
774 | - else $author_list = $xml_obj->author; |
|
861 | + if(!is_array($xml_obj->author)) { |
|
862 | + $author_list[] = $xml_obj->author; |
|
863 | + } else { |
|
864 | + $author_list = $xml_obj->author; |
|
865 | + } |
|
775 | 866 | |
776 | 867 | foreach($author_list as $author) |
777 | 868 | { |
@@ -781,15 +872,16 @@ discard block |
||
781 | 872 | $author_obj->homepage = $author->attrs->link; |
782 | 873 | $module_info->author[] = $author_obj; |
783 | 874 | } |
784 | - } |
|
785 | - else |
|
875 | + } else |
|
786 | 876 | { |
787 | 877 | // module format 0.1 |
788 | 878 | $module_info->title = $xml_obj->title->body; |
789 | 879 | $module_info->description = $xml_obj->author->description->body; |
790 | 880 | $module_info->version = $xml_obj->attrs->version; |
791 | 881 | $module_info->category = $xml_obj->attrs->category; |
792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
882 | + if(!$module_info->category) { |
|
883 | + $module_info->category = 'service'; |
|
884 | + } |
|
793 | 885 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 886 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
795 | 887 | $author_obj = new stdClass(); |
@@ -818,11 +910,15 @@ discard block |
||
818 | 910 | { |
819 | 911 | // Get a path of the requested module. Return if not exists. |
820 | 912 | $class_path = ModuleHandler::getModulePath($module); |
821 | - if(!$class_path) return; |
|
913 | + if(!$class_path) { |
|
914 | + return; |
|
915 | + } |
|
822 | 916 | |
823 | 917 | // Check if module.xml exists in the path. Return if not exist |
824 | 918 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
825 | - if(!file_exists($xml_file)) return; |
|
919 | + if(!file_exists($xml_file)) { |
|
920 | + return; |
|
921 | + } |
|
826 | 922 | |
827 | 923 | // Check if cached file exists |
828 | 924 | $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
@@ -841,7 +937,10 @@ discard block |
||
841 | 937 | |
842 | 938 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
843 | 939 | |
844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
940 | + if(!count($xml_obj->module)) { |
|
941 | + return; |
|
942 | + } |
|
943 | + // /< Error occurs if module tag doesn't included in the xml |
|
845 | 944 | |
846 | 945 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
847 | 946 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -853,8 +952,11 @@ discard block |
||
853 | 952 | // Arrange permission information |
854 | 953 | if($grants) |
855 | 954 | { |
856 | - if(is_array($grants)) $grant_list = $grants; |
|
857 | - else $grant_list[] = $grants; |
|
955 | + if(is_array($grants)) { |
|
956 | + $grant_list = $grants; |
|
957 | + } else { |
|
958 | + $grant_list[] = $grants; |
|
959 | + } |
|
858 | 960 | |
859 | 961 | $info->grant = new stdClass(); |
860 | 962 | $buff[] = '$info->grant = new stdClass;'; |
@@ -876,8 +978,11 @@ discard block |
||
876 | 978 | // Permissions to grant |
877 | 979 | if($permissions) |
878 | 980 | { |
879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
880 | - else $permission_list[] = $permissions; |
|
981 | + if(is_array($permissions)) { |
|
982 | + $permission_list = $permissions; |
|
983 | + } else { |
|
984 | + $permission_list[] = $permissions; |
|
985 | + } |
|
881 | 986 | |
882 | 987 | $buff[] = '$info->permission = new stdClass;'; |
883 | 988 | |
@@ -895,8 +1000,11 @@ discard block |
||
895 | 1000 | // for admin menus |
896 | 1001 | if($menus) |
897 | 1002 | { |
898 | - if(is_array($menus)) $menu_list = $menus; |
|
899 | - else $menu_list[] = $menus; |
|
1003 | + if(is_array($menus)) { |
|
1004 | + $menu_list = $menus; |
|
1005 | + } else { |
|
1006 | + $menu_list[] = $menus; |
|
1007 | + } |
|
900 | 1008 | |
901 | 1009 | $buff[] = '$info->menu = new stdClass;'; |
902 | 1010 | $info->menu = new stdClass(); |
@@ -920,8 +1028,11 @@ discard block |
||
920 | 1028 | // actions |
921 | 1029 | if($actions) |
922 | 1030 | { |
923 | - if(is_array($actions)) $action_list = $actions; |
|
924 | - else $action_list[] = $actions; |
|
1031 | + if(is_array($actions)) { |
|
1032 | + $action_list = $actions; |
|
1033 | + } else { |
|
1034 | + $action_list[] = $actions; |
|
1035 | + } |
|
925 | 1036 | |
926 | 1037 | $buff[] = '$info->action = new stdClass;'; |
927 | 1038 | $info->action = new stdClass(); |
@@ -1007,7 +1118,9 @@ discard block |
||
1007 | 1118 | return $info; |
1008 | 1119 | } |
1009 | 1120 | |
1010 | - if(file_exists($cache_file)) return include($cache_file); |
|
1121 | + if(file_exists($cache_file)) { |
|
1122 | + return include($cache_file); |
|
1123 | + } |
|
1011 | 1124 | } |
1012 | 1125 | |
1013 | 1126 | /** |
@@ -1045,7 +1158,9 @@ discard block |
||
1045 | 1158 | |
1046 | 1159 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1047 | 1160 | $list = FileHandler::readDir($skin_path); |
1048 | - if(!count($list)) return; |
|
1161 | + if(!count($list)) { |
|
1162 | + return; |
|
1163 | + } |
|
1049 | 1164 | |
1050 | 1165 | natcasesort($list); |
1051 | 1166 | |
@@ -1099,8 +1214,7 @@ discard block |
||
1099 | 1214 | if($dir == 'skins') |
1100 | 1215 | { |
1101 | 1216 | $type = 'P'; |
1102 | - } |
|
1103 | - else |
|
1217 | + } else |
|
1104 | 1218 | { |
1105 | 1219 | $type = 'M'; |
1106 | 1220 | } |
@@ -1128,14 +1242,20 @@ discard block |
||
1128 | 1242 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1129 | 1243 | { |
1130 | 1244 | // Read xml file having skin information |
1131 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1245 | + if(substr($path,-1)!='/') { |
|
1246 | + $path .= '/'; |
|
1247 | + } |
|
1132 | 1248 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1133 | - if(!file_exists($skin_xml_file)) return; |
|
1249 | + if(!file_exists($skin_xml_file)) { |
|
1250 | + return; |
|
1251 | + } |
|
1134 | 1252 | // Create XmlParser object |
1135 | 1253 | $oXmlParser = new XmlParser(); |
1136 | 1254 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1137 | 1255 | // Return if no skin information is |
1138 | - if(!$_xml_obj->skin) return; |
|
1256 | + if(!$_xml_obj->skin) { |
|
1257 | + return; |
|
1258 | + } |
|
1139 | 1259 | $xml_obj = $_xml_obj->skin; |
1140 | 1260 | // Skin Name |
1141 | 1261 | $skin_info = new stdClass(); |
@@ -1152,8 +1272,11 @@ discard block |
||
1152 | 1272 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1153 | 1273 | $skin_info->description = $xml_obj->description->body; |
1154 | 1274 | |
1155 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1156 | - else $author_list = $xml_obj->author; |
|
1275 | + if(!is_array($xml_obj->author)) { |
|
1276 | + $author_list[] = $xml_obj->author; |
|
1277 | + } else { |
|
1278 | + $author_list = $xml_obj->author; |
|
1279 | + } |
|
1157 | 1280 | |
1158 | 1281 | foreach($author_list as $author) |
1159 | 1282 | { |
@@ -1167,8 +1290,12 @@ discard block |
||
1167 | 1290 | if($xml_obj->extra_vars) |
1168 | 1291 | { |
1169 | 1292 | $extra_var_groups = $xml_obj->extra_vars->group; |
1170 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1171 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1293 | + if(!$extra_var_groups) { |
|
1294 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1295 | + } |
|
1296 | + if(!is_array($extra_var_groups)) { |
|
1297 | + $extra_var_groups = array($extra_var_groups); |
|
1298 | + } |
|
1172 | 1299 | |
1173 | 1300 | foreach($extra_var_groups as $group) |
1174 | 1301 | { |
@@ -1177,7 +1304,9 @@ discard block |
||
1177 | 1304 | { |
1178 | 1305 | continue; |
1179 | 1306 | } |
1180 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1307 | + if(!is_array($group->var)) { |
|
1308 | + $extra_vars = array($group->var); |
|
1309 | + } |
|
1181 | 1310 | |
1182 | 1311 | foreach($extra_vars as $key => $val) |
1183 | 1312 | { |
@@ -1204,8 +1333,7 @@ discard block |
||
1204 | 1333 | $obj->options[$i]->title = $val->options[$i]->title->body; |
1205 | 1334 | $obj->options[$i]->value = $val->options[$i]->attrs->value; |
1206 | 1335 | } |
1207 | - } |
|
1208 | - else |
|
1336 | + } else |
|
1209 | 1337 | { |
1210 | 1338 | $obj->options[0] = new stdClass(); |
1211 | 1339 | $obj->options[0]->title = $val->options->title->body; |
@@ -1216,8 +1344,7 @@ discard block |
||
1216 | 1344 | } |
1217 | 1345 | } |
1218 | 1346 | } |
1219 | - } |
|
1220 | - else |
|
1347 | + } else |
|
1221 | 1348 | { |
1222 | 1349 | // skin format v0.1 |
1223 | 1350 | sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1235,8 +1362,12 @@ discard block |
||
1235 | 1362 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1236 | 1363 | // Variables used in the skin |
1237 | 1364 | $extra_var_groups = $xml_obj->extra_vars->group; |
1238 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1239 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1365 | + if(!$extra_var_groups) { |
|
1366 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1367 | + } |
|
1368 | + if(!is_array($extra_var_groups)) { |
|
1369 | + $extra_var_groups = array($extra_var_groups); |
|
1370 | + } |
|
1240 | 1371 | |
1241 | 1372 | foreach($extra_var_groups as $group) |
1242 | 1373 | { |
@@ -1244,7 +1375,9 @@ discard block |
||
1244 | 1375 | |
1245 | 1376 | if($extra_vars) |
1246 | 1377 | { |
1247 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1378 | + if(!is_array($extra_vars)) { |
|
1379 | + $extra_vars = array($extra_vars); |
|
1380 | + } |
|
1248 | 1381 | |
1249 | 1382 | foreach($extra_vars as $var) |
1250 | 1383 | { |
@@ -1266,8 +1399,7 @@ discard block |
||
1266 | 1399 | $options[$i]->title = $var->default[$i]->body; |
1267 | 1400 | $options[$i]->value = $var->default[$i]->body; |
1268 | 1401 | } |
1269 | - } |
|
1270 | - else |
|
1402 | + } else |
|
1271 | 1403 | { |
1272 | 1404 | $options[0]->title = $var->default->body; |
1273 | 1405 | $options[0]->value = $var->default->body; |
@@ -1297,7 +1429,9 @@ discard block |
||
1297 | 1429 | $colorset = $xml_obj->colorset->color; |
1298 | 1430 | if($colorset) |
1299 | 1431 | { |
1300 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1432 | + if(!is_array($colorset)) { |
|
1433 | + $colorset = array($colorset); |
|
1434 | + } |
|
1301 | 1435 | |
1302 | 1436 | foreach($colorset as $color) |
1303 | 1437 | { |
@@ -1307,9 +1441,12 @@ discard block |
||
1307 | 1441 | if($screenshot) |
1308 | 1442 | { |
1309 | 1443 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1310 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1444 | + if(!file_exists($screenshot)) { |
|
1445 | + $screenshot = ""; |
|
1446 | + } |
|
1447 | + } else { |
|
1448 | + $screenshot = ""; |
|
1311 | 1449 | } |
1312 | - else $screenshot = ""; |
|
1313 | 1450 | |
1314 | 1451 | $obj = new stdClass(); |
1315 | 1452 | $obj->name = $name; |
@@ -1322,7 +1459,9 @@ discard block |
||
1322 | 1459 | if($xml_obj->menus->menu) |
1323 | 1460 | { |
1324 | 1461 | $menus = $xml_obj->menus->menu; |
1325 | - if(!is_array($menus)) $menus = array($menus); |
|
1462 | + if(!is_array($menus)) { |
|
1463 | + $menus = array($menus); |
|
1464 | + } |
|
1326 | 1465 | |
1327 | 1466 | $menu_count = count($menus); |
1328 | 1467 | $skin_info->menu_count = $menu_count; |
@@ -1331,7 +1470,9 @@ discard block |
||
1331 | 1470 | unset($obj); |
1332 | 1471 | |
1333 | 1472 | $obj->name = $menus[$i]->attrs->name; |
1334 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1473 | + if($menus[$i]->attrs->default == "true") { |
|
1474 | + $obj->default = true; |
|
1475 | + } |
|
1335 | 1476 | $obj->title = $menus[$i]->title->body; |
1336 | 1477 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1337 | 1478 | |
@@ -1351,7 +1492,9 @@ discard block |
||
1351 | 1492 | { |
1352 | 1493 | $args = new stdClass; |
1353 | 1494 | $args->site_srl = $site_srl; |
1354 | - if(!is_null($module)) $args->module = $module; |
|
1495 | + if(!is_null($module)) { |
|
1496 | + $args->module = $module; |
|
1497 | + } |
|
1355 | 1498 | $output = executeQuery('module.getModuleCount', $args); |
1356 | 1499 | return $output->data->count; |
1357 | 1500 | } |
@@ -1380,8 +1523,11 @@ discard block |
||
1380 | 1523 | $args->module = $module; |
1381 | 1524 | $args->site_srl = $site_srl; |
1382 | 1525 | $output = executeQuery('module.getModuleConfig', $args); |
1383 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1384 | - else $config = null; |
|
1526 | + if($output->data->config) { |
|
1527 | + $config = unserialize($output->data->config); |
|
1528 | + } else { |
|
1529 | + $config = null; |
|
1530 | + } |
|
1385 | 1531 | |
1386 | 1532 | //insert in cache |
1387 | 1533 | if($oCacheHandler->isSupport()) |
@@ -1420,8 +1566,11 @@ discard block |
||
1420 | 1566 | $args->module = $module; |
1421 | 1567 | $args->module_srl = $module_srl; |
1422 | 1568 | $output = executeQuery('module.getModulePartConfig', $args); |
1423 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1424 | - else $config = null; |
|
1569 | + if($output->data->config) { |
|
1570 | + $config = unserialize($output->data->config); |
|
1571 | + } else { |
|
1572 | + $config = null; |
|
1573 | + } |
|
1425 | 1574 | |
1426 | 1575 | //insert in cache |
1427 | 1576 | if($oCacheHandler->isSupport()) |
@@ -1443,9 +1592,13 @@ discard block |
||
1443 | 1592 | { |
1444 | 1593 | $args = new stdClass(); |
1445 | 1594 | $args->module = $module; |
1446 | - if($site_srl) $args->site_srl = $site_srl; |
|
1595 | + if($site_srl) { |
|
1596 | + $args->site_srl = $site_srl; |
|
1597 | + } |
|
1447 | 1598 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1448 | - if(!$output->toBool() || !$output->data) return array(); |
|
1599 | + if(!$output->toBool() || !$output->data) { |
|
1600 | + return array(); |
|
1601 | + } |
|
1449 | 1602 | |
1450 | 1603 | foreach($output->data as $key => $val) |
1451 | 1604 | { |
@@ -1463,10 +1616,16 @@ discard block |
||
1463 | 1616 | $args->moduleCategorySrl = $moduleCategorySrl; |
1464 | 1617 | // Get data from the DB |
1465 | 1618 | $output = executeQuery('module.getModuleCategories', $args); |
1466 | - if(!$output->toBool()) return $output; |
|
1619 | + if(!$output->toBool()) { |
|
1620 | + return $output; |
|
1621 | + } |
|
1467 | 1622 | $list = $output->data; |
1468 | - if(!$list) return; |
|
1469 | - if(!is_array($list)) $list = array($list); |
|
1623 | + if(!$list) { |
|
1624 | + return; |
|
1625 | + } |
|
1626 | + if(!is_array($list)) { |
|
1627 | + $list = array($list); |
|
1628 | + } |
|
1470 | 1629 | |
1471 | 1630 | foreach($list as $val) |
1472 | 1631 | { |
@@ -1484,7 +1643,9 @@ discard block |
||
1484 | 1643 | $args = new stdClass; |
1485 | 1644 | $args->module_category_srl = $module_category_srl; |
1486 | 1645 | $output = executeQuery('module.getModuleCategory', $args); |
1487 | - if(!$output->toBool()) return $output; |
|
1646 | + if(!$output->toBool()) { |
|
1647 | + return $output; |
|
1648 | + } |
|
1488 | 1649 | return $output->data; |
1489 | 1650 | } |
1490 | 1651 | |
@@ -1496,7 +1657,9 @@ discard block |
||
1496 | 1657 | // Get a list of downloaded and installed modules |
1497 | 1658 | $searched_list = FileHandler::readDir('./modules'); |
1498 | 1659 | $searched_count = count($searched_list); |
1499 | - if(!$searched_count) return; |
|
1660 | + if(!$searched_count) { |
|
1661 | + return; |
|
1662 | + } |
|
1500 | 1663 | sort($searched_list); |
1501 | 1664 | |
1502 | 1665 | for($i=0;$i<$searched_count;$i++) |
@@ -1509,7 +1672,9 @@ discard block |
||
1509 | 1672 | $info = $this->getModuleInfoXml($module_name); |
1510 | 1673 | unset($obj); |
1511 | 1674 | |
1512 | - if(!isset($info)) continue; |
|
1675 | + if(!isset($info)) { |
|
1676 | + continue; |
|
1677 | + } |
|
1513 | 1678 | $info->module = $module_name; |
1514 | 1679 | $info->created_table_count = $created_table_count; |
1515 | 1680 | $info->table_count = $table_count; |
@@ -1535,11 +1700,16 @@ discard block |
||
1535 | 1700 | for($j=0;$j<count($tmp_files);$j++) |
1536 | 1701 | { |
1537 | 1702 | list($table_name) = explode(".",$tmp_files[$j]); |
1538 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1703 | + if($oDB->isTableExists($table_name)) { |
|
1704 | + $created_table_count ++; |
|
1705 | + } |
|
1539 | 1706 | } |
1540 | 1707 | // Check if DB is installed |
1541 | - if($table_count > $created_table_count) return true; |
|
1542 | - else return false; |
|
1708 | + if($table_count > $created_table_count) { |
|
1709 | + return true; |
|
1710 | + } else { |
|
1711 | + return false; |
|
1712 | + } |
|
1543 | 1713 | } |
1544 | 1714 | return false; |
1545 | 1715 | } |
@@ -1567,7 +1737,9 @@ discard block |
||
1567 | 1737 | sort($searched_list); |
1568 | 1738 | |
1569 | 1739 | $searched_count = count($searched_list); |
1570 | - if(!$searched_count) return; |
|
1740 | + if(!$searched_count) { |
|
1741 | + return; |
|
1742 | + } |
|
1571 | 1743 | |
1572 | 1744 | for($i=0;$i<$searched_count;$i++) |
1573 | 1745 | { |
@@ -1575,7 +1747,9 @@ discard block |
||
1575 | 1747 | $module_name = $searched_list[$i]; |
1576 | 1748 | |
1577 | 1749 | $path = ModuleHandler::getModulePath($module_name); |
1578 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1750 | + if(!is_dir(FileHandler::getRealPath($path))) { |
|
1751 | + continue; |
|
1752 | + } |
|
1579 | 1753 | |
1580 | 1754 | // Get the number of xml files to create a table in schemas |
1581 | 1755 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
@@ -1585,13 +1759,17 @@ discard block |
||
1585 | 1759 | for($j=0;$j<$table_count;$j++) |
1586 | 1760 | { |
1587 | 1761 | list($table_name) = explode('.',$tmp_files[$j]); |
1588 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1762 | + if($oDB->isTableExists($table_name)) { |
|
1763 | + $created_table_count ++; |
|
1764 | + } |
|
1589 | 1765 | } |
1590 | 1766 | // Get information of the module |
1591 | 1767 | $info = NULL; |
1592 | 1768 | $info = $this->getModuleInfoXml($module_name); |
1593 | 1769 | |
1594 | - if(!$info) continue; |
|
1770 | + if(!$info) { |
|
1771 | + continue; |
|
1772 | + } |
|
1595 | 1773 | |
1596 | 1774 | $info->module = $module_name; |
1597 | 1775 | $info->category = $info->category; |
@@ -1600,16 +1778,18 @@ discard block |
||
1600 | 1778 | $info->path = $path; |
1601 | 1779 | $info->admin_index_act = $info->admin_index_act; |
1602 | 1780 | // Check if DB is installed |
1603 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1604 | - else $info->need_install = false; |
|
1781 | + if($table_count > $created_table_count) { |
|
1782 | + $info->need_install = true; |
|
1783 | + } else { |
|
1784 | + $info->need_install = false; |
|
1785 | + } |
|
1605 | 1786 | // Check if it is upgraded to module.class.php on each module |
1606 | 1787 | $oDummy = null; |
1607 | 1788 | $oDummy = getModule($module_name, 'class'); |
1608 | 1789 | if($oDummy && method_exists($oDummy, "checkUpdate")) |
1609 | 1790 | { |
1610 | 1791 | $info->need_update = $oDummy->checkUpdate(); |
1611 | - } |
|
1612 | - else |
|
1792 | + } else |
|
1613 | 1793 | { |
1614 | 1794 | continue; |
1615 | 1795 | } |
@@ -1626,7 +1806,9 @@ discard block |
||
1626 | 1806 | */ |
1627 | 1807 | function syncModuleToSite(&$data) |
1628 | 1808 | { |
1629 | - if(!$data) return; |
|
1809 | + if(!$data) { |
|
1810 | + return; |
|
1811 | + } |
|
1630 | 1812 | |
1631 | 1813 | if(is_array($data)) |
1632 | 1814 | { |
@@ -1634,9 +1816,10 @@ discard block |
||
1634 | 1816 | { |
1635 | 1817 | $module_srls[] = $val->module_srl; |
1636 | 1818 | } |
1637 | - if(!count($module_srls)) return; |
|
1638 | - } |
|
1639 | - else |
|
1819 | + if(!count($module_srls)) { |
|
1820 | + return; |
|
1821 | + } |
|
1822 | + } else |
|
1640 | 1823 | { |
1641 | 1824 | $module_srls[] = $data->module_srl; |
1642 | 1825 | } |
@@ -1644,7 +1827,9 @@ discard block |
||
1644 | 1827 | $args = new stdClass(); |
1645 | 1828 | $args->module_srls = implode(',',$module_srls); |
1646 | 1829 | $output = executeQueryArray('module.getModuleSites', $args); |
1647 | - if(!$output->data) return array(); |
|
1830 | + if(!$output->data) { |
|
1831 | + return array(); |
|
1832 | + } |
|
1648 | 1833 | foreach($output->data as $key => $val) |
1649 | 1834 | { |
1650 | 1835 | $modules[$val->module_srl] = $val; |
@@ -1656,8 +1841,7 @@ discard block |
||
1656 | 1841 | { |
1657 | 1842 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1658 | 1843 | } |
1659 | - } |
|
1660 | - else |
|
1844 | + } else |
|
1661 | 1845 | { |
1662 | 1846 | $data->domain = $modules[$data->module_srl]->domain; |
1663 | 1847 | } |
@@ -1668,24 +1852,31 @@ discard block |
||
1668 | 1852 | */ |
1669 | 1853 | function isSiteAdmin($member_info, $site_srl = null) |
1670 | 1854 | { |
1671 | - if(!$member_info->member_srl) return false; |
|
1672 | - if($member_info->is_admin == 'Y') return true; |
|
1855 | + if(!$member_info->member_srl) { |
|
1856 | + return false; |
|
1857 | + } |
|
1858 | + if($member_info->is_admin == 'Y') { |
|
1859 | + return true; |
|
1860 | + } |
|
1673 | 1861 | |
1674 | 1862 | $args = new stdClass(); |
1675 | 1863 | if(!isset($site_srl)) |
1676 | 1864 | { |
1677 | 1865 | $site_module_info = Context::get('site_module_info'); |
1678 | - if(!$site_module_info) return; |
|
1866 | + if(!$site_module_info) { |
|
1867 | + return; |
|
1868 | + } |
|
1679 | 1869 | $args->site_srl = $site_module_info->site_srl; |
1680 | - } |
|
1681 | - else |
|
1870 | + } else |
|
1682 | 1871 | { |
1683 | 1872 | $args->site_srl = $site_srl; |
1684 | 1873 | } |
1685 | 1874 | |
1686 | 1875 | $args->member_srl = $member_info->member_srl; |
1687 | 1876 | $output = executeQuery('module.isSiteAdmin', $args); |
1688 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1877 | + if($output->data->member_srl == $args->member_srl) { |
|
1878 | + return true; |
|
1879 | + } |
|
1689 | 1880 | return false; |
1690 | 1881 | } |
1691 | 1882 | |
@@ -1708,7 +1899,9 @@ discard block |
||
1708 | 1899 | $obj = new stdClass(); |
1709 | 1900 | $obj->module_srl = $module_srl; |
1710 | 1901 | $output = executeQueryArray('module.getAdminID', $obj); |
1711 | - if(!$output->toBool() || !$output->data) return; |
|
1902 | + if(!$output->toBool() || !$output->data) { |
|
1903 | + return; |
|
1904 | + } |
|
1712 | 1905 | |
1713 | 1906 | return $output->data; |
1714 | 1907 | } |
@@ -1721,7 +1914,9 @@ discard block |
||
1721 | 1914 | { |
1722 | 1915 | $extra_vars = array(); |
1723 | 1916 | $get_module_srls = array(); |
1724 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1917 | + if(!is_array($list_module_srl)) { |
|
1918 | + $list_module_srl = array($list_module_srl); |
|
1919 | + } |
|
1725 | 1920 | |
1726 | 1921 | $vars = false; |
1727 | 1922 | // cache controll |
@@ -1737,14 +1932,12 @@ discard block |
||
1737 | 1932 | if($vars) |
1738 | 1933 | { |
1739 | 1934 | $extra_vars[$module_srl] = $vars; |
1740 | - } |
|
1741 | - else |
|
1935 | + } else |
|
1742 | 1936 | { |
1743 | 1937 | $get_module_srls[] = $module_srl; |
1744 | 1938 | } |
1745 | 1939 | } |
1746 | - } |
|
1747 | - else |
|
1940 | + } else |
|
1748 | 1941 | { |
1749 | 1942 | $get_module_srls = $list_module_srl; |
1750 | 1943 | } |
@@ -1769,7 +1962,9 @@ discard block |
||
1769 | 1962 | } |
1770 | 1963 | foreach($output->data as $key => $val) |
1771 | 1964 | { |
1772 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1965 | + if(in_array($val->name, array('mid','module')) || $val->value == 'Array') { |
|
1966 | + continue; |
|
1967 | + } |
|
1773 | 1968 | |
1774 | 1969 | if(!isset($extra_vars[$val->module_srl])) |
1775 | 1970 | { |
@@ -1808,7 +2003,9 @@ discard block |
||
1808 | 2003 | $args = new stdClass(); |
1809 | 2004 | $args->module_srl = $module_srl; |
1810 | 2005 | $output = executeQueryArray('module.getModuleSkinVars',$args); |
1811 | - if(!$output->toBool()) return; |
|
2006 | + if(!$output->toBool()) { |
|
2007 | + return; |
|
2008 | + } |
|
1812 | 2009 | |
1813 | 2010 | $skin_vars = array(); |
1814 | 2011 | foreach($output->data as $vars) |
@@ -1816,7 +2013,9 @@ discard block |
||
1816 | 2013 | $skin_vars[$vars->name] = $vars; |
1817 | 2014 | } |
1818 | 2015 | |
1819 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2016 | + if($oCacheHandler->isSupport()) { |
|
2017 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2018 | + } |
|
1820 | 2019 | } |
1821 | 2020 | |
1822 | 2021 | return $skin_vars; |
@@ -1828,7 +2027,9 @@ discard block |
||
1828 | 2027 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1829 | 2028 | { |
1830 | 2029 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1831 | - if(!$site_srl) $site_srl = 0; |
|
2030 | + if(!$site_srl) { |
|
2031 | + $site_srl = 0; |
|
2032 | + } |
|
1832 | 2033 | |
1833 | 2034 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1834 | 2035 | if(is_readable($designInfoFile)) |
@@ -1845,19 +2046,16 @@ discard block |
||
1845 | 2046 | if(is_dir($moduleSkinPath.'default')) |
1846 | 2047 | { |
1847 | 2048 | $skinName = 'default'; |
1848 | - } |
|
1849 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
2049 | + } else if(is_dir($moduleSkinPath.'xe_default')) |
|
1850 | 2050 | { |
1851 | 2051 | $skinName = 'xe_default'; |
1852 | - } |
|
1853 | - else |
|
2052 | + } else |
|
1854 | 2053 | { |
1855 | 2054 | $skins = FileHandler::readDir($moduleSkinPath); |
1856 | 2055 | if(count($skins) > 0) |
1857 | 2056 | { |
1858 | 2057 | $skinName = $skins[0]; |
1859 | - } |
|
1860 | - else |
|
2058 | + } else |
|
1861 | 2059 | { |
1862 | 2060 | $skinName = NULL; |
1863 | 2061 | } |
@@ -1865,7 +2063,9 @@ discard block |
||
1865 | 2063 | |
1866 | 2064 | if($updateCache && $skinName) |
1867 | 2065 | { |
1868 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
2066 | + if(!isset($designInfo->module->{$module_name})) { |
|
2067 | + $designInfo->module->{$module_name} = new stdClass(); |
|
2068 | + } |
|
1869 | 2069 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1870 | 2070 | |
1871 | 2071 | $oAdminController = getAdminController('admin'); |
@@ -1881,23 +2081,28 @@ discard block |
||
1881 | 2081 | */ |
1882 | 2082 | function syncSkinInfoToModuleInfo(&$module_info) |
1883 | 2083 | { |
1884 | - if(!$module_info->module_srl) return; |
|
2084 | + if(!$module_info->module_srl) { |
|
2085 | + return; |
|
2086 | + } |
|
1885 | 2087 | |
1886 | 2088 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1887 | 2089 | if(Mobile::isFromMobilePhone()) |
1888 | 2090 | { |
1889 | 2091 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1890 | - } |
|
1891 | - else |
|
2092 | + } else |
|
1892 | 2093 | { |
1893 | 2094 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1894 | 2095 | } |
1895 | 2096 | |
1896 | - if(!$skin_vars) return; |
|
2097 | + if(!$skin_vars) { |
|
2098 | + return; |
|
2099 | + } |
|
1897 | 2100 | |
1898 | 2101 | foreach($skin_vars as $name => $val) |
1899 | 2102 | { |
1900 | - if(isset($module_info->{$name})) continue; |
|
2103 | + if(isset($module_info->{$name})) { |
|
2104 | + continue; |
|
2105 | + } |
|
1901 | 2106 | $module_info->{$name} = $val->value; |
1902 | 2107 | } |
1903 | 2108 | } |
@@ -1923,7 +2128,9 @@ discard block |
||
1923 | 2128 | $args = new stdClass(); |
1924 | 2129 | $args->module_srl = $module_srl; |
1925 | 2130 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1926 | - if(!$output->toBool() || !$output->data) return; |
|
2131 | + if(!$output->toBool() || !$output->data) { |
|
2132 | + return; |
|
2133 | + } |
|
1927 | 2134 | |
1928 | 2135 | $skin_vars = array(); |
1929 | 2136 | foreach($output->data as $vars) |
@@ -1931,7 +2138,9 @@ discard block |
||
1931 | 2138 | $skin_vars[$vars->name] = $vars; |
1932 | 2139 | } |
1933 | 2140 | |
1934 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2141 | + if($oCacheHandler->isSupport()) { |
|
2142 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2143 | + } |
|
1935 | 2144 | } |
1936 | 2145 | |
1937 | 2146 | return $skin_vars; |
@@ -1943,7 +2152,9 @@ discard block |
||
1943 | 2152 | */ |
1944 | 2153 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1945 | 2154 | { |
1946 | - if(!$module_info->module_srl) return; |
|
2155 | + if(!$module_info->module_srl) { |
|
2156 | + return; |
|
2157 | + } |
|
1947 | 2158 | $skin_vars = false; |
1948 | 2159 | // cache controll |
1949 | 2160 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -1958,17 +2169,25 @@ discard block |
||
1958 | 2169 | $args = new stdClass; |
1959 | 2170 | $args->module_srl = $module_info->module_srl; |
1960 | 2171 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1961 | - if(!$output->toBool()) return; |
|
2172 | + if(!$output->toBool()) { |
|
2173 | + return; |
|
2174 | + } |
|
1962 | 2175 | $skin_vars = $output->data; |
1963 | 2176 | |
1964 | 2177 | //insert in cache |
1965 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2178 | + if($oCacheHandler->isSupport()) { |
|
2179 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2180 | + } |
|
2181 | + } |
|
2182 | + if(!$skin_vars) { |
|
2183 | + return; |
|
1966 | 2184 | } |
1967 | - if(!$skin_vars) return; |
|
1968 | 2185 | |
1969 | 2186 | foreach($output->data as $val) |
1970 | 2187 | { |
1971 | - if(isset($module_info->{$val->name})) continue; |
|
2188 | + if(isset($module_info->{$val->name})) { |
|
2189 | + continue; |
|
2190 | + } |
|
1972 | 2191 | $module_info->{$val->name} = $val->value; |
1973 | 2192 | } |
1974 | 2193 | } |
@@ -1990,10 +2209,12 @@ discard block |
||
1990 | 2209 | $grant_info = $xml_info->grant; |
1991 | 2210 | if($member_info->member_srl) |
1992 | 2211 | { |
1993 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
1994 | - else $group_list = array(); |
|
1995 | - } |
|
1996 | - else |
|
2212 | + if(is_array($member_info->group_list)) { |
|
2213 | + $group_list = array_keys($member_info->group_list); |
|
2214 | + } else { |
|
2215 | + $group_list = array(); |
|
2216 | + } |
|
2217 | + } else |
|
1997 | 2218 | { |
1998 | 2219 | $group_list = array(); |
1999 | 2220 | } |
@@ -2007,8 +2228,7 @@ discard block |
||
2007 | 2228 | } |
2008 | 2229 | |
2009 | 2230 | $grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false; |
2010 | - } |
|
2011 | - else |
|
2231 | + } else |
|
2012 | 2232 | { |
2013 | 2233 | // If module_srl exists |
2014 | 2234 | // Get a type of granted permission |
@@ -2021,7 +2241,9 @@ discard block |
||
2021 | 2241 | $args->module_srl = $module_srl; |
2022 | 2242 | $args->member_srl = $member_info->member_srl; |
2023 | 2243 | $output = executeQuery('module.getModuleAdmin',$args); |
2024 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2244 | + if($output->data && $output->data->member_srl == $member_info->member_srl) { |
|
2245 | + $grant->manager = true; |
|
2246 | + } |
|
2025 | 2247 | } |
2026 | 2248 | // If not an administrator, get information from the DB and grant manager privilege. |
2027 | 2249 | if(!$grant->manager) |
@@ -2031,8 +2253,7 @@ discard block |
||
2031 | 2253 | if($module_info->module == 'planet') |
2032 | 2254 | { |
2033 | 2255 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2034 | - } |
|
2035 | - else |
|
2256 | + } else |
|
2036 | 2257 | { |
2037 | 2258 | $args = new stdClass; |
2038 | 2259 | $args->module_srl = $module_srl; |
@@ -2047,37 +2268,44 @@ discard block |
||
2047 | 2268 | foreach($output->data as $val) |
2048 | 2269 | { |
2049 | 2270 | $grant_exists[$val->name] = true; |
2050 | - if($granted[$val->name]) continue; |
|
2271 | + if($granted[$val->name]) { |
|
2272 | + continue; |
|
2273 | + } |
|
2051 | 2274 | // Log-in member only |
2052 | 2275 | if($val->group_srl == -1) |
2053 | 2276 | { |
2054 | 2277 | $granted[$val->name] = true; |
2055 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2278 | + if($member_info->member_srl) { |
|
2279 | + $grant->{$val->name} = true; |
|
2280 | + } |
|
2056 | 2281 | // Site-joined member only |
2057 | - } |
|
2058 | - elseif($val->group_srl == -2) |
|
2282 | + } elseif($val->group_srl == -2) |
|
2059 | 2283 | { |
2060 | 2284 | $granted[$val->name] = true; |
2061 | 2285 | // Do not grant any permission for non-logged member |
2062 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2286 | + if(!$member_info->member_srl) { |
|
2287 | + $grant->{$val->name} = false; |
|
2288 | + } |
|
2063 | 2289 | // Log-in member |
2064 | 2290 | else |
2065 | 2291 | { |
2066 | 2292 | $site_module_info = Context::get('site_module_info'); |
2067 | 2293 | // Permission granted if no information of the currently connected site exists |
2068 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2294 | + if(!$site_module_info->site_srl) { |
|
2295 | + $grant->{$val->name} = true; |
|
2296 | + } |
|
2069 | 2297 | // Permission is not granted if information of the currently connected site exists |
2070 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2298 | + elseif(count($group_list)) { |
|
2299 | + $grant->{$val->name} = true; |
|
2300 | + } |
|
2071 | 2301 | } |
2072 | 2302 | // All of non-logged members |
2073 | - } |
|
2074 | - elseif($val->group_srl == 0) |
|
2303 | + } elseif($val->group_srl == 0) |
|
2075 | 2304 | { |
2076 | 2305 | $granted[$val->name] = true; |
2077 | 2306 | $grant->{$val->name} = true; |
2078 | 2307 | // If a target is a group |
2079 | - } |
|
2080 | - else |
|
2308 | + } else |
|
2081 | 2309 | { |
2082 | 2310 | if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
2083 | 2311 | { |
@@ -2088,30 +2316,43 @@ discard block |
||
2088 | 2316 | } |
2089 | 2317 | } |
2090 | 2318 | // Separate processing for the virtual group access |
2091 | - if(!$grant_exists['access']) $grant->access = true; |
|
2319 | + if(!$grant_exists['access']) { |
|
2320 | + $grant->access = true; |
|
2321 | + } |
|
2092 | 2322 | if(count($grant_info)) |
2093 | 2323 | { |
2094 | 2324 | foreach($grant_info as $grant_name => $grant_item) |
2095 | 2325 | { |
2096 | - if($grant_exists[$grant_name]) continue; |
|
2326 | + if($grant_exists[$grant_name]) { |
|
2327 | + continue; |
|
2328 | + } |
|
2097 | 2329 | switch($grant_item->default) |
2098 | 2330 | { |
2099 | 2331 | case 'guest' : |
2100 | 2332 | $grant->{$grant_name} = true; |
2101 | 2333 | break; |
2102 | 2334 | case 'member' : |
2103 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2104 | - else $grant->{$grant_name} = false; |
|
2335 | + if($member_info->member_srl) { |
|
2336 | + $grant->{$grant_name} = true; |
|
2337 | + } else { |
|
2338 | + $grant->{$grant_name} = false; |
|
2339 | + } |
|
2105 | 2340 | break; |
2106 | 2341 | case 'site' : |
2107 | 2342 | $site_module_info = Context::get('site_module_info'); |
2108 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2109 | - else $grant->{$grant_name} = false; |
|
2343 | + if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) { |
|
2344 | + $grant->{$grant_name} = true; |
|
2345 | + } else { |
|
2346 | + $grant->{$grant_name} = false; |
|
2347 | + } |
|
2110 | 2348 | break; |
2111 | 2349 | case 'manager' : |
2112 | 2350 | case 'root' : |
2113 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2114 | - else $grant->{$grant_name} = false; |
|
2351 | + if($member_info->is_admin == 'Y') { |
|
2352 | + $grant->{$grant_name} = true; |
|
2353 | + } else { |
|
2354 | + $grant->{$grant_name} = false; |
|
2355 | + } |
|
2115 | 2356 | break; |
2116 | 2357 | } |
2117 | 2358 | } |
@@ -2187,16 +2428,22 @@ discard block |
||
2187 | 2428 | function getFileBoxListHtml() |
2188 | 2429 | { |
2189 | 2430 | $logged_info = Context::get('logged_info'); |
2190 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
2431 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
2432 | + return new Object(-1, 'msg_not_permitted'); |
|
2433 | + } |
|
2191 | 2434 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2192 | 2435 | $link_params = explode('&',$link['query']); |
2193 | 2436 | foreach ($link_params as $param) |
2194 | 2437 | { |
2195 | 2438 | $param = explode("=",$param); |
2196 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2439 | + if($param[0] == 'selected_widget') { |
|
2440 | + $selected_widget = $param[1]; |
|
2441 | + } |
|
2197 | 2442 | } |
2198 | 2443 | $oWidgetModel = getModel('widget'); |
2199 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2444 | + if($selected_widget) { |
|
2445 | + $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2446 | + } |
|
2200 | 2447 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2201 | 2448 | |
2202 | 2449 | $oModuleModel = getModel('module'); |
@@ -2204,7 +2451,9 @@ discard block |
||
2204 | 2451 | Context::set('filebox_list', $output->data); |
2205 | 2452 | |
2206 | 2453 | $page = Context::get('page'); |
2207 | - if (!$page) $page = 1; |
|
2454 | + if (!$page) { |
|
2455 | + $page = 1; |
|
2456 | + } |
|
2208 | 2457 | Context::set('page', $page); |
2209 | 2458 | Context::set('page_navigation', $output->page_navigation); |
2210 | 2459 | |
@@ -2234,25 +2483,28 @@ discard block |
||
2234 | 2483 | $rulsetFile = str_replace('@', '', $ruleset); |
2235 | 2484 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2236 | 2485 | return FileHandler::getRealPath($xml_file); |
2237 | - } |
|
2238 | - else if (strpos($ruleset, '#') !== false) |
|
2486 | + } else if (strpos($ruleset, '#') !== false) |
|
2239 | 2487 | { |
2240 | 2488 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2241 | 2489 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2242 | - if(is_readable($xml_file)) |
|
2243 | - return FileHandler::getRealPath($xml_file); |
|
2244 | - else{ |
|
2490 | + if(is_readable($xml_file)) { |
|
2491 | + return FileHandler::getRealPath($xml_file); |
|
2492 | + } else{ |
|
2245 | 2493 | $ruleset = str_replace('#', '', $ruleset); |
2246 | 2494 | } |
2247 | 2495 | |
2248 | 2496 | } |
2249 | 2497 | // Get a path of the requested module. Return if not exists. |
2250 | 2498 | $class_path = ModuleHandler::getModulePath($module); |
2251 | - if(!$class_path) return; |
|
2499 | + if(!$class_path) { |
|
2500 | + return; |
|
2501 | + } |
|
2252 | 2502 | |
2253 | 2503 | // Check if module.xml exists in the path. Return if not exist |
2254 | 2504 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2255 | - if(!file_exists($xml_file)) return; |
|
2505 | + if(!file_exists($xml_file)) { |
|
2506 | + return; |
|
2507 | + } |
|
2256 | 2508 | |
2257 | 2509 | return $xml_file; |
2258 | 2510 | } |
@@ -2302,7 +2554,9 @@ discard block |
||
2302 | 2554 | function getLangByLangcode() |
2303 | 2555 | { |
2304 | 2556 | $langCode = Context::get('langCode'); |
2305 | - if (!$langCode) return; |
|
2557 | + if (!$langCode) { |
|
2558 | + return; |
|
2559 | + } |
|
2306 | 2560 | |
2307 | 2561 | $oModuleController = getController('module'); |
2308 | 2562 | $oModuleController->replaceDefinedLangCode($langCode); |
@@ -34,25 +34,25 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function procMemberLogin($user_id = null, $password = null, $keep_signed = null) |
36 | 36 | { |
37 | - if(!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
37 | + if (!$user_id && !$password && Context::getRequestMethod() == 'GET') |
|
38 | 38 | { |
39 | 39 | $this->setRedirectUrl(getNotEncodedUrl('')); |
40 | 40 | return new Object(-1, 'null_user_id'); |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Variables |
44 | - if(!$user_id) $user_id = Context::get('user_id'); |
|
44 | + if (!$user_id) $user_id = Context::get('user_id'); |
|
45 | 45 | $user_id = trim($user_id); |
46 | 46 | |
47 | - if(!$password) $password = Context::get('password'); |
|
47 | + if (!$password) $password = Context::get('password'); |
|
48 | 48 | $password = trim($password); |
49 | 49 | |
50 | - if(!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
50 | + if (!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
51 | 51 | // Return an error when id and password doesn't exist |
52 | - if(!$user_id) return new Object(-1,'null_user_id'); |
|
53 | - if(!$password) return new Object(-1,'null_password'); |
|
52 | + if (!$user_id) return new Object(-1, 'null_user_id'); |
|
53 | + if (!$password) return new Object(-1, 'null_password'); |
|
54 | 54 | |
55 | - $output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false); |
|
55 | + $output = $this->doLogin($user_id, $password, $keep_signed == 'Y' ? true : false); |
|
56 | 56 | if (!$output->toBool()) return $output; |
57 | 57 | |
58 | 58 | $oModuleModel = getModel('module'); |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | $limit_date = $config->change_password_date; |
63 | 63 | |
64 | 64 | // Check if change_password_date is set |
65 | - if($limit_date > 0) |
|
65 | + if ($limit_date > 0) |
|
66 | 66 | { |
67 | 67 | $oMemberModel = getModel('member'); |
68 | - if($this->memberInfo->change_password_date < date ('YmdHis', strtotime ('-' . $limit_date . ' day'))) |
|
68 | + if ($this->memberInfo->change_password_date < date('YmdHis', strtotime('-'.$limit_date.' day'))) |
|
69 | 69 | { |
70 | 70 | $msg = sprintf(Context::getLang('msg_change_password_date'), $limit_date); |
71 | - return $this->setRedirectUrl(getNotEncodedUrl('','vid',Context::get('vid'),'mid',Context::get('mid'),'act','dispMemberModifyPassword'), new Object(-1, $msg)); |
|
71 | + return $this->setRedirectUrl(getNotEncodedUrl('', 'vid', Context::get('vid'), 'mid', Context::get('mid'), 'act', 'dispMemberModifyPassword'), new Object(-1, $msg)); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $args->member_srl = $this->memberInfo->member_srl; |
78 | 78 | executeQuery('member.deleteAuthMail', $args); |
79 | 79 | |
80 | - if(!$config->after_login_url) |
|
80 | + if (!$config->after_login_url) |
|
81 | 81 | { |
82 | 82 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
83 | 83 | } |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | // Call a trigger before log-out (before) |
99 | 99 | $logged_info = Context::get('logged_info'); |
100 | 100 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); |
101 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
101 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
102 | 102 | // Destroy session information |
103 | 103 | $this->destroySessionInfo(); |
104 | 104 | // Call a trigger after log-out (after) |
105 | 105 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); |
106 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
106 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
107 | 107 | |
108 | 108 | $output = new Object(); |
109 | 109 | |
110 | 110 | $oModuleModel = getModel('module'); |
111 | 111 | $config = $oModuleModel->getModuleConfig('member'); |
112 | - if($config->after_logout_url) |
|
112 | + if ($config->after_logout_url) |
|
113 | 113 | $output->redirect_url = $config->after_logout_url; |
114 | 114 | |
115 | 115 | $this->_clearMemberCache($logged_info->member_srl); |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | function procMemberScrapDocument() |
126 | 126 | { |
127 | 127 | // Check login information |
128 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
128 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
129 | 129 | $logged_info = Context::get('logged_info'); |
130 | 130 | |
131 | - $document_srl = (int)Context::get('document_srl'); |
|
132 | - if(!$document_srl) $document_srl = (int)Context::get('target_srl'); |
|
133 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
131 | + $document_srl = (int) Context::get('document_srl'); |
|
132 | + if (!$document_srl) $document_srl = (int) Context::get('target_srl'); |
|
133 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
134 | 134 | // Get document |
135 | 135 | $oDocumentModel = getModel('document'); |
136 | 136 | $oDocument = $oDocumentModel->getDocument($document_srl); |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | $args->title = $oDocument->get('title'); |
146 | 146 | // Check if already scrapped |
147 | 147 | $output = executeQuery('member.getScrapDocument', $args); |
148 | - if($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
148 | + if ($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
149 | 149 | // Insert |
150 | 150 | $output = executeQuery('member.addScrapDocument', $args); |
151 | - if(!$output->toBool()) return $output; |
|
151 | + if (!$output->toBool()) return $output; |
|
152 | 152 | |
153 | 153 | $this->setError(-1); |
154 | 154 | $this->setMessage('success_registed'); |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | function procMemberDeleteScrap() |
163 | 163 | { |
164 | 164 | // Check login information |
165 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
165 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
166 | 166 | $logged_info = Context::get('logged_info'); |
167 | 167 | |
168 | - $document_srl = (int)Context::get('document_srl'); |
|
169 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
168 | + $document_srl = (int) Context::get('document_srl'); |
|
169 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
170 | 170 | // Variables |
171 | 171 | $args = new stdClass; |
172 | 172 | $args->member_srl = $logged_info->member_srl; |
@@ -192,23 +192,23 @@ discard block |
||
192 | 192 | function procMemberDeleteSavedDocument() |
193 | 193 | { |
194 | 194 | // Check login information |
195 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
195 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
196 | 196 | $logged_info = Context::get('logged_info'); |
197 | 197 | |
198 | - $document_srl = (int)Context::get('document_srl'); |
|
199 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
198 | + $document_srl = (int) Context::get('document_srl'); |
|
199 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
200 | 200 | |
201 | 201 | $oDocumentModel = getModel('document'); |
202 | 202 | $oDocument = $oDocumentModel->getDocument($document_srl); |
203 | 203 | if ($oDocument->get('member_srl') != $logged_info->member_srl) |
204 | 204 | { |
205 | - return new Object(-1,'msg_invalid_request'); |
|
205 | + return new Object(-1, 'msg_invalid_request'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | $configStatusList = $oDocumentModel->getStatusList(); |
209 | 209 | if ($oDocument->get('status') != $configStatusList['temp']) |
210 | 210 | { |
211 | - return new Object(-1,'msg_invalid_request'); |
|
211 | + return new Object(-1, 'msg_invalid_request'); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | $oDocumentController = getController('document'); |
@@ -224,37 +224,37 @@ discard block |
||
224 | 224 | { |
225 | 225 | $name = Context::get('name'); |
226 | 226 | $value = Context::get('value'); |
227 | - if(!$value) return; |
|
227 | + if (!$value) return; |
|
228 | 228 | |
229 | 229 | $oMemberModel = getModel('member'); |
230 | 230 | // Check if logged-in |
231 | 231 | $logged_info = Context::get('logged_info'); |
232 | 232 | |
233 | 233 | |
234 | - switch($name) |
|
234 | + switch ($name) |
|
235 | 235 | { |
236 | 236 | case 'user_id' : |
237 | 237 | // Check denied ID |
238 | - if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id'); |
|
238 | + if ($oMemberModel->isDeniedID($value)) return new Object(0, 'denied_user_id'); |
|
239 | 239 | // Check if duplicated |
240 | 240 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
241 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id'); |
|
241 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_user_id'); |
|
242 | 242 | break; |
243 | 243 | case 'nick_name' : |
244 | 244 | // Check denied ID |
245 | - if($oMemberModel->isDeniedNickName($value)) |
|
245 | + if ($oMemberModel->isDeniedNickName($value)) |
|
246 | 246 | { |
247 | - return new Object(0,'denied_nick_name'); |
|
247 | + return new Object(0, 'denied_nick_name'); |
|
248 | 248 | } |
249 | 249 | // Check if duplicated |
250 | 250 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
251 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name'); |
|
251 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_nick_name'); |
|
252 | 252 | |
253 | 253 | break; |
254 | 254 | case 'email_address' : |
255 | 255 | // Check if duplicated |
256 | 256 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
257 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address'); |
|
257 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_email_address'); |
|
258 | 258 | break; |
259 | 259 | } |
260 | 260 | } |
@@ -266,25 +266,25 @@ discard block |
||
266 | 266 | */ |
267 | 267 | function procMemberInsert() |
268 | 268 | { |
269 | - if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request"); |
|
270 | - $oMemberModel = &getModel ('member'); |
|
269 | + if (Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request"); |
|
270 | + $oMemberModel = &getModel('member'); |
|
271 | 271 | $config = $oMemberModel->getMemberConfig(); |
272 | 272 | |
273 | 273 | // call a trigger (before) |
274 | - $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
|
275 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
274 | + $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config); |
|
275 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
276 | 276 | // Check if an administrator allows a membership |
277 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
277 | + if ($config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
278 | 278 | // Check if the user accept the license terms (only if terms exist) |
279 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
279 | + if ($config->agreement && Context::get('accept_agreement') != 'Y') return $this->stop('msg_accept_agreement'); |
|
280 | 280 | |
281 | 281 | // Extract the necessary information in advance |
282 | 282 | $getVars = array(); |
283 | - if($config->signupForm) |
|
283 | + if ($config->signupForm) |
|
284 | 284 | { |
285 | - foreach($config->signupForm as $formInfo) |
|
285 | + foreach ($config->signupForm as $formInfo) |
|
286 | 286 | { |
287 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
287 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
288 | 288 | { |
289 | 289 | $getVars[] = $formInfo->name; |
290 | 290 | } |
@@ -292,22 +292,22 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | $args = new stdClass; |
295 | - foreach($getVars as $val) |
|
295 | + foreach ($getVars as $val) |
|
296 | 296 | { |
297 | 297 | $args->{$val} = Context::get($val); |
298 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
298 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
299 | 299 | } |
300 | 300 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
301 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
301 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
302 | 302 | |
303 | 303 | $args->find_account_answer = Context::get('find_account_answer'); |
304 | 304 | $args->allow_mailing = Context::get('allow_mailing'); |
305 | 305 | $args->allow_message = Context::get('allow_message'); |
306 | 306 | |
307 | - if($args->password1) $args->password = $args->password1; |
|
307 | + if ($args->password1) $args->password = $args->password1; |
|
308 | 308 | |
309 | 309 | // check password strength |
310 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
310 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
311 | 311 | { |
312 | 312 | $message = Context::getLang('about_password_strength'); |
313 | 313 | return new Object(-1, $message[$config->password_strength]); |
@@ -333,58 +333,58 @@ discard block |
||
333 | 333 | unset($all_args->secret_text); |
334 | 334 | |
335 | 335 | // Set the user state as "denied" when using mail authentication |
336 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
336 | + if ($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
337 | 337 | // Add extra vars after excluding necessary information from all the requested arguments |
338 | 338 | $extra_vars = delObjectVars($all_args, $args); |
339 | 339 | $args->extra_vars = serialize($extra_vars); |
340 | 340 | |
341 | 341 | // remove whitespace |
342 | 342 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
343 | - foreach($checkInfos as $val) |
|
343 | + foreach ($checkInfos as $val) |
|
344 | 344 | { |
345 | - if(isset($args->{$val})) |
|
345 | + if (isset($args->{$val})) |
|
346 | 346 | { |
347 | 347 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
348 | 348 | } |
349 | 349 | } |
350 | 350 | $output = $this->insertMember($args); |
351 | - if(!$output->toBool()) return $output; |
|
351 | + if (!$output->toBool()) return $output; |
|
352 | 352 | |
353 | 353 | // insert ProfileImage, ImageName, ImageMark |
354 | 354 | $profile_image = $_FILES['profile_image']; |
355 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
355 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
356 | 356 | { |
357 | 357 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
358 | 358 | } |
359 | 359 | |
360 | 360 | $image_mark = $_FILES['image_mark']; |
361 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
361 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
362 | 362 | { |
363 | 363 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
364 | 364 | } |
365 | 365 | |
366 | 366 | $image_name = $_FILES['image_name']; |
367 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
367 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
368 | 368 | { |
369 | 369 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
370 | 370 | } |
371 | 371 | |
372 | 372 | // If a virtual site, join the site |
373 | 373 | $site_module_info = Context::get('site_module_info'); |
374 | - if($site_module_info->site_srl > 0) |
|
374 | + if ($site_module_info->site_srl > 0) |
|
375 | 375 | { |
376 | 376 | $columnList = array('site_srl', 'group_srl'); |
377 | 377 | $default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl, $columnList); |
378 | - if($default_group->group_srl) |
|
378 | + if ($default_group->group_srl) |
|
379 | 379 | { |
380 | 380 | $this->addMemberToGroup($args->member_srl, $default_group->group_srl, $site_module_info->site_srl); |
381 | 381 | } |
382 | 382 | |
383 | 383 | } |
384 | 384 | // Log-in |
385 | - if($config->enable_confirm != 'Y') |
|
385 | + if ($config->enable_confirm != 'Y') |
|
386 | 386 | { |
387 | - if($config->identifier == 'email_address') |
|
387 | + if ($config->identifier == 'email_address') |
|
388 | 388 | { |
389 | 389 | $output = $this->doLogin($args->email_address); |
390 | 390 | } |
@@ -392,8 +392,8 @@ discard block |
||
392 | 392 | { |
393 | 393 | $output = $this->doLogin($args->user_id); |
394 | 394 | } |
395 | - if(!$output->toBool()) { |
|
396 | - if($output->error == -9) |
|
395 | + if (!$output->toBool()) { |
|
396 | + if ($output->error == -9) |
|
397 | 397 | $output->error = -11; |
398 | 398 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
399 | 399 | } |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | |
402 | 402 | // Results |
403 | 403 | $this->add('member_srl', $args->member_srl); |
404 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
405 | - if($config->enable_confirm == 'Y') |
|
404 | + if ($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
405 | + if ($config->enable_confirm == 'Y') |
|
406 | 406 | { |
407 | 407 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
408 | 408 | $this->setMessage($msg); |
@@ -411,19 +411,19 @@ discard block |
||
411 | 411 | else $this->setMessage('success_registed'); |
412 | 412 | // Call a trigger (after) |
413 | 413 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
414 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
414 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
415 | 415 | |
416 | - if($config->redirect_url) |
|
416 | + if ($config->redirect_url) |
|
417 | 417 | { |
418 | 418 | $returnUrl = $config->redirect_url; |
419 | 419 | } |
420 | 420 | else |
421 | 421 | { |
422 | - if(Context::get('success_return_url')) |
|
422 | + if (Context::get('success_return_url')) |
|
423 | 423 | { |
424 | 424 | $returnUrl = Context::get('success_return_url'); |
425 | 425 | } |
426 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
426 | + else if ($_COOKIE['XE_REDIRECT_URL']) |
|
427 | 427 | { |
428 | 428 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
429 | 429 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -437,26 +437,26 @@ discard block |
||
437 | 437 | |
438 | 438 | function procMemberModifyInfoBefore() |
439 | 439 | { |
440 | - if($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
440 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
441 | 441 | { |
442 | 442 | return $this->stop('msg_invalid_request'); |
443 | 443 | } |
444 | 444 | |
445 | - if(!Context::get('is_logged')) |
|
445 | + if (!Context::get('is_logged')) |
|
446 | 446 | { |
447 | 447 | return $this->stop('msg_not_logged'); |
448 | 448 | } |
449 | 449 | |
450 | 450 | $password = Context::get('password'); |
451 | 451 | |
452 | - if(!$password) |
|
452 | + if (!$password) |
|
453 | 453 | { |
454 | 454 | return $this->stop('msg_invalid_request'); |
455 | 455 | } |
456 | 456 | |
457 | 457 | $oMemberModel = getModel('member'); |
458 | 458 | |
459 | - if(!$this->memberInfo->password) |
|
459 | + if (!$this->memberInfo->password) |
|
460 | 460 | { |
461 | 461 | // Get information of logged-in user |
462 | 462 | $logged_info = Context::get('logged_info'); |
@@ -467,14 +467,14 @@ discard block |
||
467 | 467 | $this->memberInfo->password = $memberInfo->password; |
468 | 468 | } |
469 | 469 | // Verify the current password |
470 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
470 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
471 | 471 | { |
472 | 472 | return new Object(-1, 'invalid_password'); |
473 | 473 | } |
474 | 474 | |
475 | 475 | $_SESSION['rechecked_password_step'] = 'VALIDATE_PASSWORD'; |
476 | 476 | |
477 | - if(Context::get('success_return_url')) |
|
477 | + if (Context::get('success_return_url')) |
|
478 | 478 | { |
479 | 479 | $redirectUrl = Context::get('success_return_url'); |
480 | 480 | } |
@@ -492,12 +492,12 @@ discard block |
||
492 | 492 | */ |
493 | 493 | function procMemberModifyInfo() |
494 | 494 | { |
495 | - if(!Context::get('is_logged')) |
|
495 | + if (!Context::get('is_logged')) |
|
496 | 496 | { |
497 | 497 | return $this->stop('msg_not_logged'); |
498 | 498 | } |
499 | 499 | |
500 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
500 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
501 | 501 | { |
502 | 502 | return $this->stop('msg_invalid_request'); |
503 | 503 | } |
@@ -505,13 +505,13 @@ discard block |
||
505 | 505 | |
506 | 506 | // Extract the necessary information in advance |
507 | 507 | $oMemberModel = getModel('member'); |
508 | - $config = $oMemberModel->getMemberConfig (); |
|
509 | - $getVars = array('find_account_answer','allow_mailing','allow_message'); |
|
510 | - if($config->signupForm) |
|
508 | + $config = $oMemberModel->getMemberConfig(); |
|
509 | + $getVars = array('find_account_answer', 'allow_mailing', 'allow_message'); |
|
510 | + if ($config->signupForm) |
|
511 | 511 | { |
512 | - foreach($config->signupForm as $formInfo) |
|
512 | + foreach ($config->signupForm as $formInfo) |
|
513 | 513 | { |
514 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
514 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
515 | 515 | { |
516 | 516 | $getVars[] = $formInfo->name; |
517 | 517 | } |
@@ -519,16 +519,16 @@ discard block |
||
519 | 519 | } |
520 | 520 | |
521 | 521 | $args = new stdClass; |
522 | - foreach($getVars as $val) |
|
522 | + foreach ($getVars as $val) |
|
523 | 523 | { |
524 | 524 | $args->{$val} = Context::get($val); |
525 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
525 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
526 | 526 | } |
527 | 527 | // Login Information |
528 | 528 | $logged_info = Context::get('logged_info'); |
529 | 529 | $args->member_srl = $logged_info->member_srl; |
530 | 530 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
531 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
531 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
532 | 532 | // Remove some unnecessary variables from all the vars |
533 | 533 | $all_args = Context::getRequestVars(); |
534 | 534 | unset($all_args->module); |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | |
553 | 553 | // remove whitespace |
554 | 554 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
555 | - foreach($checkInfos as $val) |
|
555 | + foreach ($checkInfos as $val) |
|
556 | 556 | { |
557 | - if(isset($args->{$val})) |
|
557 | + if (isset($args->{$val})) |
|
558 | 558 | { |
559 | 559 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
560 | 560 | } |
@@ -562,22 +562,22 @@ discard block |
||
562 | 562 | |
563 | 563 | // Execute insert or update depending on the value of member_srl |
564 | 564 | $output = $this->updateMember($args); |
565 | - if(!$output->toBool()) return $output; |
|
565 | + if (!$output->toBool()) return $output; |
|
566 | 566 | |
567 | 567 | $profile_image = $_FILES['profile_image']; |
568 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
568 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
569 | 569 | { |
570 | 570 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
571 | 571 | } |
572 | 572 | |
573 | 573 | $image_mark = $_FILES['image_mark']; |
574 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
574 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
575 | 575 | { |
576 | 576 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
577 | 577 | } |
578 | 578 | |
579 | 579 | $image_name = $_FILES['image_name']; |
580 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
580 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
581 | 581 | { |
582 | 582 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
583 | 583 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | // Call a trigger after successfully log-in (after) |
594 | 594 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
595 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
595 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
596 | 596 | |
597 | 597 | $this->setSessionInfo(); |
598 | 598 | // Return result |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | */ |
614 | 614 | function procMemberModifyPassword() |
615 | 615 | { |
616 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
616 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
617 | 617 | // Extract the necessary information in advance |
618 | 618 | $current_password = trim(Context::get('current_password')); |
619 | 619 | $password = trim(Context::get('password1')); |
@@ -627,17 +627,17 @@ discard block |
||
627 | 627 | |
628 | 628 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
629 | 629 | // Verify the cuttent password |
630 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
630 | + if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
631 | 631 | |
632 | 632 | // Check if a new password is as same as the previous password |
633 | - if($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
633 | + if ($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
634 | 634 | |
635 | 635 | // Execute insert or update depending on the value of member_srl |
636 | 636 | $args = new stdClass; |
637 | 637 | $args->member_srl = $member_srl; |
638 | 638 | $args->password = $password; |
639 | 639 | $output = $this->updateMemberPassword($args); |
640 | - if(!$output->toBool()) return $output; |
|
640 | + if (!$output->toBool()) return $output; |
|
641 | 641 | |
642 | 642 | $this->add('member_srl', $args->member_srl); |
643 | 643 | $this->setMessage('success_updated'); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | */ |
654 | 654 | function procMemberLeave() |
655 | 655 | { |
656 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
656 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
657 | 657 | // Extract the necessary information in advance |
658 | 658 | $password = trim(Context::get('password')); |
659 | 659 | // Get information of logged-in user |
@@ -662,17 +662,17 @@ discard block |
||
662 | 662 | // Create a member model object |
663 | 663 | $oMemberModel = getModel('member'); |
664 | 664 | // Get information of member_srl |
665 | - if(!$this->memberInfo->password) |
|
665 | + if (!$this->memberInfo->password) |
|
666 | 666 | { |
667 | 667 | $columnList = array('member_srl', 'password'); |
668 | 668 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
669 | 669 | $this->memberInfo->password = $memberInfo->password; |
670 | 670 | } |
671 | 671 | // Verify the cuttent password |
672 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
672 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
673 | 673 | |
674 | 674 | $output = $this->deleteMember($member_srl); |
675 | - if(!$output->toBool()) return $output; |
|
675 | + if (!$output->toBool()) return $output; |
|
676 | 676 | // Destroy all session information |
677 | 677 | $this->destroySessionInfo(); |
678 | 678 | // Return success message |
@@ -691,17 +691,17 @@ discard block |
||
691 | 691 | { |
692 | 692 | // Check if the file is successfully uploaded |
693 | 693 | $file = $_FILES['profile_image']; |
694 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
694 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
695 | 695 | // Ignore if member_srl is invalid or doesn't exist. |
696 | 696 | $member_srl = Context::get('member_srl'); |
697 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
697 | + if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
698 | 698 | |
699 | 699 | $logged_info = Context::get('logged_info'); |
700 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
700 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
701 | 701 | // Return if member module is set not to use an image name or the user is not an administrator ; |
702 | 702 | $oModuleModel = getModel('module'); |
703 | 703 | $config = $oModuleModel->getModuleConfig('member'); |
704 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
704 | + if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
705 | 705 | |
706 | 706 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
707 | 707 | // Page refresh |
@@ -723,25 +723,25 @@ discard block |
||
723 | 723 | { |
724 | 724 | |
725 | 725 | // Check uploaded file |
726 | - if(!checkUploadedFile($target_file)) return; |
|
726 | + if (!checkUploadedFile($target_file)) return; |
|
727 | 727 | |
728 | 728 | $oMemberModel = getModel('member'); |
729 | 729 | $config = $oMemberModel->getMemberConfig(); |
730 | 730 | |
731 | 731 | // Get an image size |
732 | 732 | $max_width = $config->profile_image_max_width; |
733 | - if(!$max_width) $max_width = "90"; |
|
733 | + if (!$max_width) $max_width = "90"; |
|
734 | 734 | $max_height = $config->profile_image_max_height; |
735 | - if(!$max_height) $max_height = "90"; |
|
735 | + if (!$max_height) $max_height = "90"; |
|
736 | 736 | // Get a target path to save |
737 | 737 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
738 | 738 | FileHandler::makeDir($target_path); |
739 | 739 | |
740 | 740 | // Get file information |
741 | 741 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
742 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
743 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
744 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
742 | + if (IMAGETYPE_PNG == $type) $ext = 'png'; |
|
743 | + elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
744 | + elseif (IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
745 | 745 | else |
746 | 746 | { |
747 | 747 | return; |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | |
752 | 752 | $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); |
753 | 753 | // Convert if the image size is larger than a given size or if the format is not a gif |
754 | - if(($width > $max_width || $height > $max_height ) && $type != 1) |
|
754 | + if (($width > $max_width || $height > $max_height) && $type != 1) |
|
755 | 755 | { |
756 | 756 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
757 | 757 | } |
@@ -770,17 +770,17 @@ discard block |
||
770 | 770 | { |
771 | 771 | // Check if the file is successfully uploaded |
772 | 772 | $file = $_FILES['image_name']; |
773 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
773 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
774 | 774 | // Ignore if member_srl is invalid or doesn't exist. |
775 | 775 | $member_srl = Context::get('member_srl'); |
776 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
776 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
777 | 777 | |
778 | 778 | $logged_info = Context::get('logged_info'); |
779 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
779 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
780 | 780 | // Return if member module is set not to use an image name or the user is not an administrator ; |
781 | 781 | $oModuleModel = getModel('module'); |
782 | 782 | $config = $oModuleModel->getModuleConfig('member'); |
783 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
783 | + if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
784 | 784 | |
785 | 785 | $this->insertImageName($member_srl, $file['tmp_name']); |
786 | 786 | // Page refresh |
@@ -801,15 +801,15 @@ discard block |
||
801 | 801 | function insertImageName($member_srl, $target_file) |
802 | 802 | { |
803 | 803 | // Check uploaded file |
804 | - if(!checkUploadedFile($target_file)) return; |
|
804 | + if (!checkUploadedFile($target_file)) return; |
|
805 | 805 | |
806 | 806 | $oModuleModel = getModel('module'); |
807 | 807 | $config = $oModuleModel->getModuleConfig('member'); |
808 | 808 | // Get an image size |
809 | 809 | $max_width = $config->image_name_max_width; |
810 | - if(!$max_width) $max_width = "90"; |
|
810 | + if (!$max_width) $max_width = "90"; |
|
811 | 811 | $max_height = $config->image_name_max_height; |
812 | - if(!$max_height) $max_height = "20"; |
|
812 | + if (!$max_height) $max_height = "20"; |
|
813 | 813 | // Get a target path to save |
814 | 814 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
815 | 815 | FileHandler::makeDir($target_path); |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | // Get file information |
819 | 819 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
820 | 820 | // Convert if the image size is larger than a given size or if the format is not a gif |
821 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
821 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
822 | 822 | else @copy($target_file, $target_filename); |
823 | 823 | } |
824 | 824 | |
@@ -830,20 +830,20 @@ discard block |
||
830 | 830 | function procMemberDeleteProfileImage($_memberSrl = 0) |
831 | 831 | { |
832 | 832 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
833 | - if(!$member_srl) |
|
833 | + if (!$member_srl) |
|
834 | 834 | { |
835 | - return new Object(0,'success'); |
|
835 | + return new Object(0, 'success'); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | $logged_info = Context::get('logged_info'); |
839 | 839 | |
840 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
840 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
841 | 841 | { |
842 | 842 | $oMemberModel = getModel('member'); |
843 | 843 | $profile_image = $oMemberModel->getProfileImage($member_srl); |
844 | 844 | FileHandler::removeFile($profile_image->file); |
845 | 845 | } |
846 | - return new Object(0,'success'); |
|
846 | + return new Object(0, 'success'); |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | /** |
@@ -854,20 +854,20 @@ discard block |
||
854 | 854 | function procMemberDeleteImageName($_memberSrl = 0) |
855 | 855 | { |
856 | 856 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
857 | - if(!$member_srl) |
|
857 | + if (!$member_srl) |
|
858 | 858 | { |
859 | - return new Object(0,'success'); |
|
859 | + return new Object(0, 'success'); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | $logged_info = Context::get('logged_info'); |
863 | 863 | |
864 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
864 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
865 | 865 | { |
866 | 866 | $oMemberModel = getModel('member'); |
867 | 867 | $image_name = $oMemberModel->getImageName($member_srl); |
868 | 868 | FileHandler::removeFile($image_name->file); |
869 | 869 | } |
870 | - return new Object(0,'success'); |
|
870 | + return new Object(0, 'success'); |
|
871 | 871 | } |
872 | 872 | |
873 | 873 | /** |
@@ -879,17 +879,17 @@ discard block |
||
879 | 879 | { |
880 | 880 | // Check if the file is successfully uploaded |
881 | 881 | $file = $_FILES['image_mark']; |
882 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
882 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
883 | 883 | // Ignore if member_srl is invalid or doesn't exist. |
884 | 884 | $member_srl = Context::get('member_srl'); |
885 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
885 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
886 | 886 | |
887 | 887 | $logged_info = Context::get('logged_info'); |
888 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
888 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
889 | 889 | // Membership in the images mark the module using the ban was set by an administrator or return; |
890 | 890 | $oModuleModel = getModel('module'); |
891 | 891 | $config = $oModuleModel->getModuleConfig('member'); |
892 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
892 | + if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
893 | 893 | |
894 | 894 | $this->insertImageMark($member_srl, $file['tmp_name']); |
895 | 895 | // Page refresh |
@@ -910,15 +910,15 @@ discard block |
||
910 | 910 | function insertImageMark($member_srl, $target_file) |
911 | 911 | { |
912 | 912 | // Check uploaded file |
913 | - if(!checkUploadedFile($target_file)) return; |
|
913 | + if (!checkUploadedFile($target_file)) return; |
|
914 | 914 | |
915 | 915 | $oModuleModel = getModel('module'); |
916 | 916 | $config = $oModuleModel->getModuleConfig('member'); |
917 | 917 | // Get an image size |
918 | 918 | $max_width = $config->image_mark_max_width; |
919 | - if(!$max_width) $max_width = "20"; |
|
919 | + if (!$max_width) $max_width = "20"; |
|
920 | 920 | $max_height = $config->image_mark_max_height; |
921 | - if(!$max_height) $max_height = "20"; |
|
921 | + if (!$max_height) $max_height = "20"; |
|
922 | 922 | |
923 | 923 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
924 | 924 | FileHandler::makeDir($target_path); |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | // Get file information |
928 | 928 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
929 | 929 | |
930 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
930 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
931 | 931 | else @copy($target_file, $target_filename); |
932 | 932 | } |
933 | 933 | |
@@ -939,20 +939,20 @@ discard block |
||
939 | 939 | function procMemberDeleteImageMark($_memberSrl = 0) |
940 | 940 | { |
941 | 941 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
942 | - if(!$member_srl) |
|
942 | + if (!$member_srl) |
|
943 | 943 | { |
944 | - return new Object(0,'success'); |
|
944 | + return new Object(0, 'success'); |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | $logged_info = Context::get('logged_info'); |
948 | 948 | |
949 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
949 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
950 | 950 | { |
951 | 951 | $oMemberModel = getModel('member'); |
952 | 952 | $image_mark = $oMemberModel->getImageMark($member_srl); |
953 | 953 | FileHandler::removeFile($image_mark->file); |
954 | 954 | } |
955 | - return new Object(0,'success'); |
|
955 | + return new Object(0, 'success'); |
|
956 | 956 | } |
957 | 957 | |
958 | 958 | /** |
@@ -963,26 +963,26 @@ discard block |
||
963 | 963 | function procMemberFindAccount() |
964 | 964 | { |
965 | 965 | $email_address = Context::get('email_address'); |
966 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
966 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
967 | 967 | |
968 | 968 | $oMemberModel = getModel('member'); |
969 | 969 | $oModuleModel = getModel('module'); |
970 | 970 | |
971 | 971 | // Check if a member having the same email address exists |
972 | 972 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
973 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
973 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
974 | 974 | |
975 | 975 | // Get information of the member |
976 | 976 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
977 | 977 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
978 | 978 | |
979 | 979 | // Check if possible to find member's ID and password |
980 | - if($member_info->denied == 'Y') |
|
980 | + if ($member_info->denied == 'Y') |
|
981 | 981 | { |
982 | 982 | $chk_args = new stdClass; |
983 | 983 | $chk_args->member_srl = $member_info->member_srl; |
984 | 984 | $output = executeQuery('member.chkAuthMail', $chk_args); |
985 | - if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
985 | + if ($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
986 | 986 | } |
987 | 987 | |
988 | 988 | // Insert data into the authentication DB |
@@ -995,19 +995,19 @@ discard block |
||
995 | 995 | $args->is_register = 'N'; |
996 | 996 | |
997 | 997 | $output = executeQuery('member.insertAuthMail', $args); |
998 | - if(!$output->toBool()) return $output; |
|
998 | + if (!$output->toBool()) return $output; |
|
999 | 999 | // Get content of the email to send a member |
1000 | 1000 | Context::set('auth_args', $args); |
1001 | 1001 | |
1002 | 1002 | $member_config = $oModuleModel->getModuleConfig('member'); |
1003 | 1003 | $memberInfo = array(); |
1004 | 1004 | global $lang; |
1005 | - if(is_array($member_config->signupForm)) |
|
1005 | + if (is_array($member_config->signupForm)) |
|
1006 | 1006 | { |
1007 | - $exceptForm=array('password', 'find_account_question'); |
|
1008 | - foreach($member_config->signupForm as $form) |
|
1007 | + $exceptForm = array('password', 'find_account_question'); |
|
1008 | + foreach ($member_config->signupForm as $form) |
|
1009 | 1009 | { |
1010 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1010 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1011 | 1011 | { |
1012 | 1012 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1013 | 1013 | } |
@@ -1022,15 +1022,15 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | Context::set('memberInfo', $memberInfo); |
1024 | 1024 | |
1025 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1026 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1025 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
1026 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
1027 | 1027 | |
1028 | 1028 | Context::set('member_config', $member_config); |
1029 | 1029 | |
1030 | 1030 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1031 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1031 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1032 | 1032 | |
1033 | - $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
1033 | + $find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
1034 | 1034 | Context::set('find_url', $find_url); |
1035 | 1035 | |
1036 | 1036 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -1040,19 +1040,19 @@ discard block |
||
1040 | 1040 | $member_config = $oModuleModel->getModuleConfig('member'); |
1041 | 1041 | // Send a mail |
1042 | 1042 | $oMail = new Mail(); |
1043 | - $oMail->setTitle( Context::getLang('msg_find_account_title') ); |
|
1043 | + $oMail->setTitle(Context::getLang('msg_find_account_title')); |
|
1044 | 1044 | $oMail->setContent($content); |
1045 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
1046 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
1045 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
1046 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
1047 | 1047 | $oMail->send(); |
1048 | 1048 | // Return message |
1049 | 1049 | $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); |
1050 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
1050 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
1051 | 1051 | { |
1052 | 1052 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount'); |
1053 | 1053 | $this->setRedirectUrl($returnUrl); |
1054 | 1054 | } |
1055 | - return new Object(0,$msg); |
|
1055 | + return new Object(0, $msg); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | /** |
@@ -1070,28 +1070,28 @@ discard block |
||
1070 | 1070 | $find_account_question = trim(Context::get('find_account_question')); |
1071 | 1071 | $find_account_answer = trim(Context::get('find_account_answer')); |
1072 | 1072 | |
1073 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
1073 | + if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
1074 | 1074 | |
1075 | 1075 | $oModuleModel = getModel('module'); |
1076 | 1076 | // Check if a member having the same email address exists |
1077 | 1077 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
1078 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1078 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1079 | 1079 | // Get information of the member |
1080 | 1080 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
1081 | 1081 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
1082 | 1082 | |
1083 | 1083 | // Display a message if no answer is entered |
1084 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
1084 | + if (!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
1085 | 1085 | |
1086 | - if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); |
|
1086 | + if (trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); |
|
1087 | 1087 | |
1088 | - if($config->identifier == 'email_address') |
|
1088 | + if ($config->identifier == 'email_address') |
|
1089 | 1089 | { |
1090 | 1090 | $user_id = $email_address; |
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | // Update to a temporary password and set change_password_date to 1 |
1094 | - $oPassword = new Password(); |
|
1094 | + $oPassword = new Password(); |
|
1095 | 1095 | $temp_password = $oPassword->createTemporaryPassword(8); |
1096 | 1096 | |
1097 | 1097 | $args = new stdClass(); |
@@ -1099,11 +1099,11 @@ discard block |
||
1099 | 1099 | $args->password = $temp_password; |
1100 | 1100 | $args->change_password_date = '1'; |
1101 | 1101 | $output = $this->updateMemberPassword($args); |
1102 | - if(!$output->toBool()) return $output; |
|
1102 | + if (!$output->toBool()) return $output; |
|
1103 | 1103 | |
1104 | - $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
|
1104 | + $_SESSION['xe_temp_password_'.$user_id] = $temp_password; |
|
1105 | 1105 | |
1106 | - $this->add('user_id',$user_id); |
|
1106 | + $this->add('user_id', $user_id); |
|
1107 | 1107 | |
1108 | 1108 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
1109 | 1109 | $this->setRedirectUrl($returnUrl.'&user_id='.$user_id); |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | $member_srl = Context::get('member_srl'); |
1124 | 1124 | $auth_key = Context::get('auth_key'); |
1125 | 1125 | |
1126 | - if(!$member_srl || !$auth_key) |
|
1126 | + if (!$member_srl || !$auth_key) |
|
1127 | 1127 | { |
1128 | 1128 | return $this->stop('msg_invalid_request'); |
1129 | 1129 | } |
@@ -1134,9 +1134,9 @@ discard block |
||
1134 | 1134 | $args->auth_key = $auth_key; |
1135 | 1135 | $output = executeQuery('member.getAuthMail', $args); |
1136 | 1136 | |
1137 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
1137 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
1138 | 1138 | { |
1139 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) |
|
1139 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) |
|
1140 | 1140 | { |
1141 | 1141 | executeQuery('member.deleteAuthMail', $args); |
1142 | 1142 | } |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | return $this->stop('msg_invalid_auth_key'); |
1145 | 1145 | } |
1146 | 1146 | |
1147 | - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
1147 | + if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
1148 | 1148 | { |
1149 | 1149 | executeQuery('member.deleteAuthMail', $args); |
1150 | 1150 | return $this->stop('msg_invalid_auth_key'); |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | $args->password = $output->data->new_password; |
1154 | 1154 | |
1155 | 1155 | // If credentials are correct, change the password to a new one |
1156 | - if($output->data->is_register == 'Y') |
|
1156 | + if ($output->data->is_register == 'Y') |
|
1157 | 1157 | { |
1158 | 1158 | $args->denied = 'N'; |
1159 | 1159 | } |
@@ -1166,13 +1166,13 @@ discard block |
||
1166 | 1166 | $is_register = $output->data->is_register; |
1167 | 1167 | |
1168 | 1168 | $output = executeQuery('member.updateMemberPassword', $args); |
1169 | - if(!$output->toBool()) |
|
1169 | + if (!$output->toBool()) |
|
1170 | 1170 | { |
1171 | 1171 | return $this->stop($output->getMessage()); |
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Remove all values having the member_srl from authentication table |
1175 | - executeQuery('member.deleteAuthMail',$args); |
|
1175 | + executeQuery('member.deleteAuthMail', $args); |
|
1176 | 1176 | |
1177 | 1177 | $this->_clearMemberCache($args->member_srl); |
1178 | 1178 | |
@@ -1191,33 +1191,33 @@ discard block |
||
1191 | 1191 | { |
1192 | 1192 | // Get an email_address |
1193 | 1193 | $email_address = Context::get('email_address'); |
1194 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1194 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1195 | 1195 | // Log test by using email_address |
1196 | 1196 | $oMemberModel = getModel('member'); |
1197 | 1197 | |
1198 | 1198 | $args = new stdClass; |
1199 | 1199 | $args->email_address = $email_address; |
1200 | 1200 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
1201 | - if(!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
1201 | + if (!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
1202 | 1202 | |
1203 | 1203 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
1204 | 1204 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
1205 | 1205 | |
1206 | 1206 | $oModuleModel = getModel('module'); |
1207 | 1207 | $member_config = $oModuleModel->getModuleConfig('member'); |
1208 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1209 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1208 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
1209 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
1210 | 1210 | |
1211 | 1211 | // Check if a authentication mail has been sent previously |
1212 | 1212 | $chk_args = new stdClass; |
1213 | 1213 | $chk_args->member_srl = $member_info->member_srl; |
1214 | 1214 | $output = executeQuery('member.chkAuthMail', $chk_args); |
1215 | - if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
1215 | + if ($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
1216 | 1216 | |
1217 | 1217 | $auth_args = new stdClass; |
1218 | 1218 | $auth_args->member_srl = $member_info->member_srl; |
1219 | 1219 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
1220 | - if(!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
1220 | + if (!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
1221 | 1221 | $auth_info = $output->data[0]; |
1222 | 1222 | |
1223 | 1223 | // Update the regdate of authmail entry |
@@ -1228,12 +1228,12 @@ discard block |
||
1228 | 1228 | |
1229 | 1229 | $memberInfo = array(); |
1230 | 1230 | global $lang; |
1231 | - if(is_array($member_config->signupForm)) |
|
1231 | + if (is_array($member_config->signupForm)) |
|
1232 | 1232 | { |
1233 | - $exceptForm=array('password', 'find_account_question'); |
|
1234 | - foreach($member_config->signupForm as $form) |
|
1233 | + $exceptForm = array('password', 'find_account_question'); |
|
1234 | + foreach ($member_config->signupForm as $form) |
|
1235 | 1235 | { |
1236 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1236 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1237 | 1237 | { |
1238 | 1238 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1239 | 1239 | } |
@@ -1252,19 +1252,19 @@ discard block |
||
1252 | 1252 | Context::set('member_config', $member_config); |
1253 | 1253 | |
1254 | 1254 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1255 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1255 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1256 | 1256 | |
1257 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
|
1257 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key); |
|
1258 | 1258 | Context::set('auth_url', $auth_url); |
1259 | 1259 | |
1260 | 1260 | $oTemplate = &TemplateHandler::getInstance(); |
1261 | 1261 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
1262 | 1262 | // Send a mail |
1263 | 1263 | $oMail = new Mail(); |
1264 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
1264 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
1265 | 1265 | $oMail->setContent($content); |
1266 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
1267 | - $oMail->setReceiptor( $args->user_name, $args->email_address ); |
|
1266 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
1267 | + $oMail->setReceiptor($args->user_name, $args->email_address); |
|
1268 | 1268 | $oMail->send(); |
1269 | 1269 | |
1270 | 1270 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
@@ -1279,23 +1279,23 @@ discard block |
||
1279 | 1279 | $memberInfo = $_SESSION['auth_member_info']; |
1280 | 1280 | unset($_SESSION['auth_member_info']); |
1281 | 1281 | |
1282 | - if(!$memberInfo) |
|
1282 | + if (!$memberInfo) |
|
1283 | 1283 | { |
1284 | 1284 | return $this->stop('msg_invalid_request'); |
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | $newEmail = Context::get('email_address'); |
1288 | 1288 | |
1289 | - if(!$newEmail) |
|
1289 | + if (!$newEmail) |
|
1290 | 1290 | { |
1291 | 1291 | return $this->stop('msg_invalid_request'); |
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | $oMemberModel = getModel('member'); |
1295 | 1295 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
1296 | - if($member_srl) |
|
1296 | + if ($member_srl) |
|
1297 | 1297 | { |
1298 | - return new Object(-1,'msg_exists_email_address'); |
|
1298 | + return new Object(-1, 'msg_exists_email_address'); |
|
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | // remove all key by member_srl |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | $args->member_srl = $memberInfo->member_srl; |
1304 | 1304 | $output = executeQuery('member.deleteAuthMail', $args); |
1305 | 1305 | |
1306 | - if(!$output->toBool()) |
|
1306 | + if (!$output->toBool()) |
|
1307 | 1307 | { |
1308 | 1308 | return $output; |
1309 | 1309 | } |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
1314 | 1314 | |
1315 | 1315 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
1316 | - if(!$output->toBool()) |
|
1316 | + if (!$output->toBool()) |
|
1317 | 1317 | { |
1318 | 1318 | return $this->stop($output->getMessage()); |
1319 | 1319 | } |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | $auth_args->is_register = 'Y'; |
1331 | 1331 | |
1332 | 1332 | $output = executeQuery('member.insertAuthMail', $auth_args); |
1333 | - if(!$output->toBool()) return $output; |
|
1333 | + if (!$output->toBool()) return $output; |
|
1334 | 1334 | |
1335 | 1335 | $memberInfo->email_address = $newEmail; |
1336 | 1336 | |
@@ -1354,12 +1354,12 @@ discard block |
||
1354 | 1354 | $memberInfo = array(); |
1355 | 1355 | |
1356 | 1356 | global $lang; |
1357 | - if(is_array($member_config->signupForm)) |
|
1357 | + if (is_array($member_config->signupForm)) |
|
1358 | 1358 | { |
1359 | - $exceptForm=array('password', 'find_account_question'); |
|
1360 | - foreach($member_config->signupForm as $form) |
|
1359 | + $exceptForm = array('password', 'find_account_question'); |
|
1360 | + foreach ($member_config->signupForm as $form) |
|
1361 | 1361 | { |
1362 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1362 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
1363 | 1363 | { |
1364 | 1364 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1365 | 1365 | } |
@@ -1374,25 +1374,25 @@ discard block |
||
1374 | 1374 | } |
1375 | 1375 | Context::set('memberInfo', $memberInfo); |
1376 | 1376 | |
1377 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1378 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1377 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
1378 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
1379 | 1379 | |
1380 | 1380 | Context::set('member_config', $member_config); |
1381 | 1381 | |
1382 | 1382 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1383 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1383 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1384 | 1384 | |
1385 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
1385 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
1386 | 1386 | Context::set('auth_url', $auth_url); |
1387 | 1387 | |
1388 | 1388 | $oTemplate = &TemplateHandler::getInstance(); |
1389 | 1389 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
1390 | 1390 | // Send a mail |
1391 | 1391 | $oMail = new Mail(); |
1392 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
1392 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
1393 | 1393 | $oMail->setContent($content); |
1394 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
1395 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
1394 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
1395 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
1396 | 1396 | $oMail->send(); |
1397 | 1397 | } |
1398 | 1398 | |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | { |
1406 | 1406 | $site_module_info = Context::get('site_module_info'); |
1407 | 1407 | $logged_info = Context::get('logged_info'); |
1408 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
1408 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
1409 | 1409 | |
1410 | 1410 | $oMemberModel = getModel('member'); |
1411 | 1411 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1424,13 +1424,13 @@ discard block |
||
1424 | 1424 | { |
1425 | 1425 | $site_module_info = Context::get('site_module_info'); |
1426 | 1426 | $logged_info = Context::get('logged_info'); |
1427 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
1427 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
1428 | 1428 | |
1429 | 1429 | $args = new stdClass; |
1430 | - $args->site_srl= $site_module_info->site_srl; |
|
1430 | + $args->site_srl = $site_module_info->site_srl; |
|
1431 | 1431 | $args->member_srl = $logged_info->member_srl; |
1432 | 1432 | $output = executeQuery('member.deleteMembersGroup', $args); |
1433 | - if(!$output->toBool()) return $output; |
|
1433 | + if (!$output->toBool()) return $output; |
|
1434 | 1434 | $this->setMessage('success_deleted'); |
1435 | 1435 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
1436 | 1436 | } |
@@ -1444,25 +1444,25 @@ discard block |
||
1444 | 1444 | */ |
1445 | 1445 | function setMemberConfig($args) |
1446 | 1446 | { |
1447 | - if(!$args->skin) $args->skin = "default"; |
|
1448 | - if(!$args->colorset) $args->colorset = "white"; |
|
1449 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
1450 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
1451 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
1452 | - $args->enable_openid= 'N'; |
|
1453 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
1454 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
1455 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
1456 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
1457 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
1458 | - $args->limit_day = (int)$args->limit_day; |
|
1447 | + if (!$args->skin) $args->skin = "default"; |
|
1448 | + if (!$args->colorset) $args->colorset = "white"; |
|
1449 | + if (!$args->editor_skin) $args->editor_skin = "ckeditor"; |
|
1450 | + if (!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
1451 | + if ($args->enable_join != 'Y') $args->enable_join = 'N'; |
|
1452 | + $args->enable_openid = 'N'; |
|
1453 | + if ($args->profile_image != 'Y') $args->profile_image = 'N'; |
|
1454 | + if ($args->image_name != 'Y') $args->image_name = 'N'; |
|
1455 | + if ($args->image_mark != 'Y') $args->image_mark = 'N'; |
|
1456 | + if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N'; |
|
1457 | + if (!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
1458 | + $args->limit_day = (int) $args->limit_day; |
|
1459 | 1459 | |
1460 | 1460 | $agreement = trim($args->agreement); |
1461 | 1461 | unset($args->agreement); |
1462 | 1462 | |
1463 | 1463 | $oModuleController = getController('module'); |
1464 | - $output = $oModuleController->insertModuleConfig('member',$args); |
|
1465 | - if(!$output->toBool()) return $output; |
|
1464 | + $output = $oModuleController->insertModuleConfig('member', $args); |
|
1465 | + if (!$output->toBool()) return $output; |
|
1466 | 1466 | |
1467 | 1467 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
1468 | 1468 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1483,11 +1483,11 @@ discard block |
||
1483 | 1483 | $signature = trim(removeHackTag($signature)); |
1484 | 1484 | $signature = preg_replace('/<(\/?)(embed|object|param)/is', '<$1$2', $signature); |
1485 | 1485 | |
1486 | - $check_signature = trim(str_replace(array(' ',"\n","\r"), '', strip_tags($signature, '<img><object>'))); |
|
1486 | + $check_signature = trim(str_replace(array(' ', "\n", "\r"), '', strip_tags($signature, '<img><object>'))); |
|
1487 | 1487 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
1488 | 1488 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
1489 | 1489 | |
1490 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
1490 | + if (!$check_signature) return FileHandler::removeFile($filename); |
|
1491 | 1491 | |
1492 | 1492 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
1493 | 1493 | FileHandler::makeDir($path); |
@@ -1516,15 +1516,15 @@ discard block |
||
1516 | 1516 | * |
1517 | 1517 | * @return Object |
1518 | 1518 | */ |
1519 | - function addMemberToGroup($member_srl, $group_srl, $site_srl=0) |
|
1519 | + function addMemberToGroup($member_srl, $group_srl, $site_srl = 0) |
|
1520 | 1520 | { |
1521 | 1521 | $args = new stdClass(); |
1522 | 1522 | $args->member_srl = $member_srl; |
1523 | 1523 | $args->group_srl = $group_srl; |
1524 | - if($site_srl) $args->site_srl = $site_srl; |
|
1524 | + if ($site_srl) $args->site_srl = $site_srl; |
|
1525 | 1525 | |
1526 | 1526 | // Add |
1527 | - $output = executeQuery('member.addMemberToGroup',$args); |
|
1527 | + $output = executeQuery('member.addMemberToGroup', $args); |
|
1528 | 1528 | $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); |
1529 | 1529 | |
1530 | 1530 | $this->_clearMemberCache($member_srl, $site_srl); |
@@ -1544,18 +1544,18 @@ discard block |
||
1544 | 1544 | { |
1545 | 1545 | $obj = new stdClass; |
1546 | 1546 | $obj->site_srl = $args->site_srl; |
1547 | - $obj->member_srl = implode(',',$args->member_srl); |
|
1547 | + $obj->member_srl = implode(',', $args->member_srl); |
|
1548 | 1548 | |
1549 | 1549 | $output = executeQueryArray('member.getMembersGroup', $obj); |
1550 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
1550 | + if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
1551 | 1551 | |
1552 | 1552 | $output = executeQuery('member.deleteMembersGroup', $obj); |
1553 | - if(!$output->toBool()) return $output; |
|
1553 | + if (!$output->toBool()) return $output; |
|
1554 | 1554 | |
1555 | 1555 | $inserted_members = array(); |
1556 | - foreach($args->member_srl as $key => $val) |
|
1556 | + foreach ($args->member_srl as $key => $val) |
|
1557 | 1557 | { |
1558 | - if($inserted_members[$val]) continue; |
|
1558 | + if ($inserted_members[$val]) continue; |
|
1559 | 1559 | $inserted_members[$val] = true; |
1560 | 1560 | |
1561 | 1561 | unset($obj); |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | $obj->site_srl = $args->site_srl; |
1566 | 1566 | $obj->regdate = $date[$obj->member_srl]; |
1567 | 1567 | $output = executeQuery('member.addMemberToGroup', $obj); |
1568 | - if(!$output->toBool()) return $output; |
|
1568 | + if (!$output->toBool()) return $output; |
|
1569 | 1569 | |
1570 | 1570 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
1571 | 1571 | } |
@@ -1587,9 +1587,9 @@ discard block |
||
1587 | 1587 | // Get information of the key |
1588 | 1588 | $output = executeQuery('member.getAutologin', $args); |
1589 | 1589 | // If no information exists, delete a cookie |
1590 | - if(!$output->toBool() || !$output->data) |
|
1590 | + if (!$output->toBool() || !$output->data) |
|
1591 | 1591 | { |
1592 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
1592 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
1593 | 1593 | return; |
1594 | 1594 | } |
1595 | 1595 | |
@@ -1599,9 +1599,9 @@ discard block |
||
1599 | 1599 | $user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address; |
1600 | 1600 | $password = $output->data->password; |
1601 | 1601 | |
1602 | - if(!$user_id || !$password) |
|
1602 | + if (!$user_id || !$password) |
|
1603 | 1603 | { |
1604 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
1604 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
1605 | 1605 | return; |
1606 | 1606 | } |
1607 | 1607 | |
@@ -1611,7 +1611,7 @@ discard block |
||
1611 | 1611 | $check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT']; |
1612 | 1612 | $check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32); |
1613 | 1613 | |
1614 | - if($check_key === substr($args->autologin_key, 32)) |
|
1614 | + if ($check_key === substr($args->autologin_key, 32)) |
|
1615 | 1615 | { |
1616 | 1616 | // Check change_password_date |
1617 | 1617 | $oModuleModel = getModel('module'); |
@@ -1619,12 +1619,12 @@ discard block |
||
1619 | 1619 | $limit_date = $member_config->change_password_date; |
1620 | 1620 | |
1621 | 1621 | // Check if change_password_date is set |
1622 | - if($limit_date > 0) |
|
1622 | + if ($limit_date > 0) |
|
1623 | 1623 | { |
1624 | 1624 | $oMemberModel = getModel('member'); |
1625 | 1625 | $columnList = array('member_srl', 'change_password_date'); |
1626 | 1626 | |
1627 | - if($config->identifier == 'user_id') |
|
1627 | + if ($config->identifier == 'user_id') |
|
1628 | 1628 | { |
1629 | 1629 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
1630 | 1630 | } |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
1634 | 1634 | } |
1635 | 1635 | |
1636 | - if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){ |
|
1636 | + if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) { |
|
1637 | 1637 | $do_auto_login = true; |
1638 | 1638 | } |
1639 | 1639 | |
@@ -1644,14 +1644,14 @@ discard block |
||
1644 | 1644 | } |
1645 | 1645 | } |
1646 | 1646 | |
1647 | - if($do_auto_login) |
|
1647 | + if ($do_auto_login) |
|
1648 | 1648 | { |
1649 | 1649 | $output = $this->doLogin($user_id); |
1650 | 1650 | } |
1651 | 1651 | else |
1652 | 1652 | { |
1653 | 1653 | executeQuery('member.deleteAutologin', $args); |
1654 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
1654 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
1655 | 1655 | } |
1656 | 1656 | } |
1657 | 1657 | |
@@ -1667,13 +1667,13 @@ discard block |
||
1667 | 1667 | function doLogin($user_id, $password = '', $keep_signed = false) |
1668 | 1668 | { |
1669 | 1669 | $user_id = strtolower($user_id); |
1670 | - if(!$user_id) return new Object(-1, 'null_user_id'); |
|
1670 | + if (!$user_id) return new Object(-1, 'null_user_id'); |
|
1671 | 1671 | // Call a trigger before log-in (before) |
1672 | 1672 | $trigger_obj = new stdClass(); |
1673 | 1673 | $trigger_obj->user_id = $user_id; |
1674 | 1674 | $trigger_obj->password = $password; |
1675 | 1675 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
1676 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
1676 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
1677 | 1677 | // Create a member model object |
1678 | 1678 | $oMemberModel = getModel('member'); |
1679 | 1679 | |
@@ -1683,12 +1683,12 @@ discard block |
||
1683 | 1683 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
1684 | 1684 | |
1685 | 1685 | // check identifier |
1686 | - if($config->identifier == 'email_address') |
|
1686 | + if ($config->identifier == 'email_address') |
|
1687 | 1687 | { |
1688 | 1688 | // Get user_id information |
1689 | 1689 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
1690 | 1690 | // Set an invalid user if no value returned |
1691 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
1691 | + if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
1692 | 1692 | |
1693 | 1693 | } |
1694 | 1694 | else |
@@ -1696,24 +1696,24 @@ discard block |
||
1696 | 1696 | // Get user_id information |
1697 | 1697 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
1698 | 1698 | // Set an invalid user if no value returned |
1699 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
1699 | + if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
1700 | 1700 | } |
1701 | 1701 | |
1702 | 1702 | $output = executeQuery('member.getLoginCountByIp', $args); |
1703 | 1703 | $errorCount = $output->data->count; |
1704 | - if($errorCount >= $config->max_error_count) |
|
1704 | + if ($errorCount >= $config->max_error_count) |
|
1705 | 1705 | { |
1706 | 1706 | $last_update = strtotime($output->data->last_update); |
1707 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
1708 | - if($term < $config->max_error_count_time) |
|
1707 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
1708 | + if ($term < $config->max_error_count_time) |
|
1709 | 1709 | { |
1710 | 1710 | $term = $config->max_error_count_time - $term; |
1711 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
1712 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
1713 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
1714 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
1711 | + if ($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
1712 | + elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min'); |
|
1713 | + elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour'); |
|
1714 | + else $term = intval($term / 86400).Context::getLang('unit_day'); |
|
1715 | 1715 | |
1716 | - return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
|
1716 | + return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'), $term)); |
|
1717 | 1717 | } |
1718 | 1718 | else |
1719 | 1719 | { |
@@ -1723,13 +1723,13 @@ discard block |
||
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | // Password Check |
1726 | - if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
1726 | + if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
1727 | 1727 | { |
1728 | - return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo); |
|
1728 | + return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo); |
|
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | // If denied == 'Y', notify |
1732 | - if($this->memberInfo->denied == 'Y') |
|
1732 | + if ($this->memberInfo->denied == 'Y') |
|
1733 | 1733 | { |
1734 | 1734 | $args->member_srl = $this->memberInfo->member_srl; |
1735 | 1735 | $output = executeQuery('member.chkAuthMail', $args); |
@@ -1737,12 +1737,12 @@ discard block |
||
1737 | 1737 | { |
1738 | 1738 | $_SESSION['auth_member_srl'] = $this->memberInfo->member_srl; |
1739 | 1739 | $redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail'); |
1740 | - return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed')); |
|
1740 | + return $this->setRedirectUrl($redirectUrl, new Object(-1, 'msg_user_not_confirmed')); |
|
1741 | 1741 | } |
1742 | - return new Object(-1,'msg_user_denied'); |
|
1742 | + return new Object(-1, 'msg_user_denied'); |
|
1743 | 1743 | } |
1744 | 1744 | // Notify if denied_date is less than the current time |
1745 | - if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
1745 | + if ($this->memberInfo->limit_date && substr($this->memberInfo->limit_date, 0, 8) >= date("Ymd")) return new Object(-9, sprintf(Context::getLang('msg_user_limited'), zdate($this->memberInfo->limit_date, "Y-m-d"))); |
|
1746 | 1746 | // Update the latest login time |
1747 | 1747 | $args->member_srl = $this->memberInfo->member_srl; |
1748 | 1748 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1752,36 +1752,36 @@ discard block |
||
1752 | 1752 | |
1753 | 1753 | // Check if there is recoding table. |
1754 | 1754 | $oDB = &DB::getInstance(); |
1755 | - if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
1755 | + if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
1756 | 1756 | { |
1757 | 1757 | // check if there is login fail records. |
1758 | 1758 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
1759 | - if($output->data && $output->data->content) |
|
1759 | + if ($output->data && $output->data->content) |
|
1760 | 1760 | { |
1761 | 1761 | $title = Context::getLang('login_fail_report'); |
1762 | 1762 | $message = '<ul>'; |
1763 | 1763 | $content = unserialize($output->data->content); |
1764 | - if(count($content) > $config->max_error_count) |
|
1764 | + if (count($content) > $config->max_error_count) |
|
1765 | 1765 | { |
1766 | - foreach($content as $val) |
|
1766 | + foreach ($content as $val) |
|
1767 | 1767 | { |
1768 | - $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa',$val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
1768 | + $message .= '<li>'.Context::getLang('regdate').': '.date('Y-m-d h:i:sa', $val[2]).'<ul><li>'.Context::getLang('ipaddress').': '.$val[0].'</li><li>'.Context::getLang('message').': '.$val[1].'</li></ul></li>'; |
|
1769 | 1769 | } |
1770 | 1770 | $message .= '</ul>'; |
1771 | - $content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa')); |
|
1771 | + $content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa')); |
|
1772 | 1772 | |
1773 | 1773 | //send message |
1774 | 1774 | $oCommunicationController = getController('communication'); |
1775 | 1775 | $oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true); |
1776 | 1776 | |
1777 | - if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
1777 | + if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
1778 | 1778 | { |
1779 | 1779 | $view_url = Context::getRequestUri(); |
1780 | - $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>",$content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
1780 | + $content = sprintf("%s<hr /><p>From: <a href=\"%s\" target=\"_blank\">%s</a><br />To: %s(%s)</p>", $content, $view_url, $view_url, $this->memberInfo->nick_name, $this->memberInfo->email_id); |
|
1781 | 1781 | $oMail = new Mail(); |
1782 | 1782 | $oMail->setTitle($title); |
1783 | 1783 | $oMail->setContent($content); |
1784 | - $oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email); |
|
1784 | + $oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email); |
|
1785 | 1785 | $oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address); |
1786 | 1786 | $oMail->send(); |
1787 | 1787 | } |
@@ -1791,9 +1791,9 @@ discard block |
||
1791 | 1791 | } |
1792 | 1792 | // Call a trigger after successfully log-in (after) |
1793 | 1793 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
1794 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
1794 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
1795 | 1795 | // When user checked to use auto-login |
1796 | - if($keep_signed) |
|
1796 | + if ($keep_signed) |
|
1797 | 1797 | { |
1798 | 1798 | // Key generate for auto login |
1799 | 1799 | $oPassword = new Password(); |
@@ -1805,12 +1805,12 @@ discard block |
||
1805 | 1805 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
1806 | 1806 | executeQuery('member.deleteAutologin', $autologin_args); |
1807 | 1807 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
1808 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
1808 | + if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000); |
|
1809 | 1809 | } |
1810 | - if($this->memberInfo->is_admin == 'Y') |
|
1810 | + if ($this->memberInfo->is_admin == 'Y') |
|
1811 | 1811 | { |
1812 | 1812 | $oMemberAdminModel = getAdminModel('member'); |
1813 | - if(!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
1813 | + if (!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
1814 | 1814 | { |
1815 | 1815 | $_SESSION['denied_admin'] = 'Y'; |
1816 | 1816 | } |
@@ -1828,18 +1828,18 @@ discard block |
||
1828 | 1828 | { |
1829 | 1829 | $oMemberModel = getModel('member'); |
1830 | 1830 | // If your information came through the current session information to extract information from the users |
1831 | - if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) |
|
1831 | + if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged()) |
|
1832 | 1832 | { |
1833 | 1833 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); |
1834 | 1834 | // If you do not destroy the session Profile |
1835 | - if($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
1835 | + if ($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
1836 | 1836 | { |
1837 | 1837 | $this->destroySessionInfo(); |
1838 | 1838 | return; |
1839 | 1839 | } |
1840 | 1840 | } |
1841 | 1841 | // Stop using the session id is destroyed |
1842 | - if($this->memberInfo->denied=='Y') |
|
1842 | + if ($this->memberInfo->denied == 'Y') |
|
1843 | 1843 | { |
1844 | 1844 | $this->destroySessionInfo(); |
1845 | 1845 | return; |
@@ -1869,10 +1869,10 @@ discard block |
||
1869 | 1869 | Context::set('logged_info', $this->memberInfo); |
1870 | 1870 | |
1871 | 1871 | // Only the menu configuration of the user (such as an add-on to the menu can be changed) |
1872 | - $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); |
|
1873 | - $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
1874 | - $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
1875 | - $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); |
|
1872 | + $this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info'); |
|
1873 | + $this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
1874 | + $this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
1875 | + $this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document'); |
|
1876 | 1876 | } |
1877 | 1877 | |
1878 | 1878 | /** |
@@ -1894,7 +1894,7 @@ discard block |
||
1894 | 1894 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
1895 | 1895 | { |
1896 | 1896 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
1897 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
1897 | + if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
1898 | 1898 | |
1899 | 1899 | $obj = new stdClass; |
1900 | 1900 | $obj->url = $url; |
@@ -1913,33 +1913,33 @@ discard block |
||
1913 | 1913 | { |
1914 | 1914 | // Call a trigger (before) |
1915 | 1915 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
1916 | - if(!$output->toBool()) return $output; |
|
1916 | + if (!$output->toBool()) return $output; |
|
1917 | 1917 | // Terms and Conditions portion of the information set up by members reaffirmed |
1918 | 1918 | $oModuleModel = getModel('module'); |
1919 | 1919 | $config = $oModuleModel->getModuleConfig('member'); |
1920 | 1920 | |
1921 | 1921 | $logged_info = Context::get('logged_info'); |
1922 | 1922 | // If the date of the temporary restrictions limit further information on the date of |
1923 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
1923 | + if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24); |
|
1924 | 1924 | |
1925 | 1925 | $args->member_srl = getNextSequence(); |
1926 | 1926 | $args->list_order = -1 * $args->member_srl; |
1927 | 1927 | |
1928 | 1928 | // Execute insert or update depending on the value of member_srl |
1929 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
1929 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
1930 | 1930 | // Enter the user's identity changed to lowercase |
1931 | 1931 | else $args->user_id = strtolower($args->user_id); |
1932 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
1933 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
1932 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
1933 | + if (!$args->nick_name) $args->nick_name = $args->member_srl; |
|
1934 | 1934 | |
1935 | 1935 | // Control of essential parameters |
1936 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
1937 | - if($args->denied!='Y') $args->denied = 'N'; |
|
1938 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
1936 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
1937 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
1938 | + if (!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F')))) $args->allow_message = 'Y'; |
|
1939 | 1939 | |
1940 | - if($logged_info->is_admin == 'Y') |
|
1940 | + if ($logged_info->is_admin == 'Y') |
|
1941 | 1941 | { |
1942 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
1942 | + if ($args->is_admin != 'Y') $args->is_admin = 'N'; |
|
1943 | 1943 | } |
1944 | 1944 | else |
1945 | 1945 | { |
@@ -1954,88 +1954,88 @@ discard block |
||
1954 | 1954 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1955 | 1955 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1956 | 1956 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1957 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
1958 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
1957 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
1958 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
1959 | 1959 | |
1960 | 1960 | // Create a model object |
1961 | 1961 | $oMemberModel = getModel('member'); |
1962 | 1962 | |
1963 | 1963 | // Check password strength |
1964 | - if($args->password && !$password_is_hashed) |
|
1964 | + if ($args->password && !$password_is_hashed) |
|
1965 | 1965 | { |
1966 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
1966 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
1967 | 1967 | { |
1968 | 1968 | $message = Context::getLang('about_password_strength'); |
1969 | 1969 | return new Object(-1, $message[$config->password_strength]); |
1970 | 1970 | } |
1971 | 1971 | $args->password = $oMemberModel->hashPassword($args->password); |
1972 | 1972 | } |
1973 | - elseif(!$args->password) |
|
1973 | + elseif (!$args->password) |
|
1974 | 1974 | { |
1975 | 1975 | unset($args->password); |
1976 | 1976 | } |
1977 | 1977 | |
1978 | 1978 | // Check if ID is prohibited |
1979 | - if($oMemberModel->isDeniedID($args->user_id)) |
|
1979 | + if ($oMemberModel->isDeniedID($args->user_id)) |
|
1980 | 1980 | { |
1981 | - return new Object(-1,'denied_user_id'); |
|
1981 | + return new Object(-1, 'denied_user_id'); |
|
1982 | 1982 | } |
1983 | 1983 | |
1984 | 1984 | // Check if ID is duplicate |
1985 | 1985 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
1986 | - if($member_srl) |
|
1986 | + if ($member_srl) |
|
1987 | 1987 | { |
1988 | - return new Object(-1,'msg_exists_user_id'); |
|
1988 | + return new Object(-1, 'msg_exists_user_id'); |
|
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | // Check if nickname is prohibited |
1992 | - if($oMemberModel->isDeniedNickName($args->nick_name)) |
|
1992 | + if ($oMemberModel->isDeniedNickName($args->nick_name)) |
|
1993 | 1993 | { |
1994 | - return new Object(-1,'denied_nick_name'); |
|
1994 | + return new Object(-1, 'denied_nick_name'); |
|
1995 | 1995 | } |
1996 | 1996 | |
1997 | 1997 | // Check if nickname is duplicate |
1998 | 1998 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
1999 | - if($member_srl) |
|
1999 | + if ($member_srl) |
|
2000 | 2000 | { |
2001 | - return new Object(-1,'msg_exists_nick_name'); |
|
2001 | + return new Object(-1, 'msg_exists_nick_name'); |
|
2002 | 2002 | } |
2003 | 2003 | |
2004 | 2004 | // Check if email address is duplicate |
2005 | 2005 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
2006 | - if($member_srl) |
|
2006 | + if ($member_srl) |
|
2007 | 2007 | { |
2008 | - return new Object(-1,'msg_exists_email_address'); |
|
2008 | + return new Object(-1, 'msg_exists_email_address'); |
|
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | // Insert data into the DB |
2012 | 2012 | $args->list_order = -1 * $args->member_srl; |
2013 | 2013 | |
2014 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
2015 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
2014 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
2015 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
2016 | 2016 | |
2017 | 2017 | $oDB = &DB::getInstance(); |
2018 | 2018 | $oDB->begin(); |
2019 | 2019 | |
2020 | 2020 | $output = executeQuery('member.insertMember', $args); |
2021 | - if(!$output->toBool()) |
|
2021 | + if (!$output->toBool()) |
|
2022 | 2022 | { |
2023 | 2023 | $oDB->rollback(); |
2024 | 2024 | return $output; |
2025 | 2025 | } |
2026 | 2026 | |
2027 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2027 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2028 | 2028 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
2029 | 2029 | // If no value is entered the default group, the value of group registration |
2030 | - if(!$args->group_srl_list) |
|
2030 | + if (!$args->group_srl_list) |
|
2031 | 2031 | { |
2032 | 2032 | $columnList = array('site_srl', 'group_srl'); |
2033 | 2033 | $default_group = $oMemberModel->getDefaultGroup(0, $columnList); |
2034 | - if($default_group) |
|
2034 | + if ($default_group) |
|
2035 | 2035 | { |
2036 | 2036 | // Add to the default group |
2037 | - $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); |
|
2038 | - if(!$output->toBool()) |
|
2037 | + $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); |
|
2038 | + if (!$output->toBool()) |
|
2039 | 2039 | { |
2040 | 2040 | $oDB->rollback(); |
2041 | 2041 | return $output; |
@@ -2045,11 +2045,11 @@ discard block |
||
2045 | 2045 | } |
2046 | 2046 | else |
2047 | 2047 | { |
2048 | - for($i=0;$i<count($group_srl_list);$i++) |
|
2048 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
2049 | 2049 | { |
2050 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
2050 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
2051 | 2051 | |
2052 | - if(!$output->toBool()) |
|
2052 | + if (!$output->toBool()) |
|
2053 | 2053 | { |
2054 | 2054 | $oDB->rollback(); |
2055 | 2055 | return $output; |
@@ -2059,7 +2059,7 @@ discard block |
||
2059 | 2059 | |
2060 | 2060 | $member_config = $oModuleModel->getModuleConfig('member'); |
2061 | 2061 | // When using email authentication mode (when you subscribed members denied a) certified mail sent |
2062 | - if($args->denied == 'Y') |
|
2062 | + if ($args->denied == 'Y') |
|
2063 | 2063 | { |
2064 | 2064 | // Insert data into the authentication DB |
2065 | 2065 | $oPassword = new Password(); |
@@ -2071,7 +2071,7 @@ discard block |
||
2071 | 2071 | $auth_args->is_register = 'Y'; |
2072 | 2072 | |
2073 | 2073 | $output = executeQuery('member.insertAuthMail', $auth_args); |
2074 | - if(!$output->toBool()) |
|
2074 | + if (!$output->toBool()) |
|
2075 | 2075 | { |
2076 | 2076 | $oDB->rollback(); |
2077 | 2077 | return $output; |
@@ -2079,10 +2079,10 @@ discard block |
||
2079 | 2079 | $this->_sendAuthMail($auth_args, $args); |
2080 | 2080 | } |
2081 | 2081 | // Call a trigger (after) |
2082 | - if($output->toBool()) |
|
2082 | + if ($output->toBool()) |
|
2083 | 2083 | { |
2084 | 2084 | $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); |
2085 | - if(!$trigger_output->toBool()) |
|
2085 | + if (!$trigger_output->toBool()) |
|
2086 | 2086 | { |
2087 | 2087 | $oDB->rollback(); |
2088 | 2088 | return $trigger_output; |
@@ -2104,41 +2104,41 @@ discard block |
||
2104 | 2104 | { |
2105 | 2105 | // Call a trigger (before) |
2106 | 2106 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
2107 | - if(!$output->toBool()) return $output; |
|
2107 | + if (!$output->toBool()) return $output; |
|
2108 | 2108 | // Create a model object |
2109 | 2109 | $oMemberModel = getModel('member'); |
2110 | 2110 | |
2111 | 2111 | $logged_info = Context::get('logged_info'); |
2112 | 2112 | // Get what you want to modify the original information |
2113 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2113 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2114 | 2114 | // Control of essential parameters |
2115 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
2116 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
2115 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
2116 | + if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y'; |
|
2117 | 2117 | |
2118 | - if($logged_info->is_admin == 'Y') |
|
2118 | + if ($logged_info->is_admin == 'Y') |
|
2119 | 2119 | { |
2120 | - if($args->denied!='Y') $args->denied = 'N'; |
|
2121 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
2120 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
2121 | + if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
2122 | 2122 | } |
2123 | 2123 | else |
2124 | 2124 | { |
2125 | 2125 | unset($args->is_admin); |
2126 | - if($is_admin == false) |
|
2126 | + if ($is_admin == false) |
|
2127 | 2127 | unset($args->denied); |
2128 | - if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
2128 | + if ($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
2129 | 2129 | { |
2130 | 2130 | return $this->stop('msg_invalid_request'); |
2131 | 2131 | } |
2132 | 2132 | } |
2133 | 2133 | |
2134 | 2134 | // Sanitize user ID, username, nickname, homepage, blog |
2135 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
2135 | + if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
2136 | 2136 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2137 | 2137 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2138 | 2138 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2139 | 2139 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2140 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
2141 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
2140 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
2141 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
2142 | 2142 | |
2143 | 2143 | // check member identifier form |
2144 | 2144 | $config = $oMemberModel->getMemberConfig(); |
@@ -2147,56 +2147,56 @@ discard block |
||
2147 | 2147 | $orgMemberInfo = $output->data; |
2148 | 2148 | |
2149 | 2149 | // Check if email address or user ID is duplicate |
2150 | - if($config->identifier == 'email_address') |
|
2150 | + if ($config->identifier == 'email_address') |
|
2151 | 2151 | { |
2152 | 2152 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
2153 | - if($member_srl && $args->member_srl != $member_srl) |
|
2153 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2154 | 2154 | { |
2155 | - return new Object(-1,'msg_exists_email_address'); |
|
2155 | + return new Object(-1, 'msg_exists_email_address'); |
|
2156 | 2156 | } |
2157 | 2157 | $args->email_address = $orgMemberInfo->email_address; |
2158 | 2158 | } |
2159 | 2159 | else |
2160 | 2160 | { |
2161 | 2161 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
2162 | - if($member_srl && $args->member_srl != $member_srl) |
|
2162 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2163 | 2163 | { |
2164 | - return new Object(-1,'msg_exists_user_id'); |
|
2164 | + return new Object(-1, 'msg_exists_user_id'); |
|
2165 | 2165 | } |
2166 | 2166 | |
2167 | 2167 | $args->user_id = $orgMemberInfo->user_id; |
2168 | 2168 | } |
2169 | 2169 | |
2170 | - if($logged_info->is_admin !== 'Y') |
|
2170 | + if ($logged_info->is_admin !== 'Y') |
|
2171 | 2171 | { |
2172 | 2172 | // Check if ID is prohibited |
2173 | - if($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
2173 | + if ($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
2174 | 2174 | { |
2175 | - return new Object(-1,'denied_user_id'); |
|
2175 | + return new Object(-1, 'denied_user_id'); |
|
2176 | 2176 | } |
2177 | 2177 | |
2178 | 2178 | // Check if nickname is prohibited |
2179 | - if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
2179 | + if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
2180 | 2180 | { |
2181 | 2181 | return new Object(-1, 'denied_nick_name'); |
2182 | 2182 | } |
2183 | 2183 | } |
2184 | 2184 | |
2185 | 2185 | // Check if ID is duplicate |
2186 | - if($args->user_id) |
|
2186 | + if ($args->user_id) |
|
2187 | 2187 | { |
2188 | 2188 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
2189 | - if($member_srl && $args->member_srl != $member_srl) |
|
2189 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2190 | 2190 | { |
2191 | - return new Object(-1,'msg_exists_user_id'); |
|
2191 | + return new Object(-1, 'msg_exists_user_id'); |
|
2192 | 2192 | } |
2193 | 2193 | } |
2194 | 2194 | |
2195 | 2195 | // Check if nickname is duplicate |
2196 | 2196 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
2197 | - if($member_srl && $args->member_srl != $member_srl) |
|
2197 | + if ($member_srl && $args->member_srl != $member_srl) |
|
2198 | 2198 | { |
2199 | - return new Object(-1,'msg_exists_nick_name'); |
|
2199 | + return new Object(-1, 'msg_exists_nick_name'); |
|
2200 | 2200 | } |
2201 | 2201 | |
2202 | 2202 | list($args->email_id, $args->email_host) = explode('@', $args->email_address); |
@@ -2205,9 +2205,9 @@ discard block |
||
2205 | 2205 | $oDB->begin(); |
2206 | 2206 | |
2207 | 2207 | // Check password strength |
2208 | - if($args->password) |
|
2208 | + if ($args->password) |
|
2209 | 2209 | { |
2210 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2210 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2211 | 2211 | { |
2212 | 2212 | $message = Context::getLang('about_password_strength'); |
2213 | 2213 | return new Object(-1, $message[$config->password_strength]); |
@@ -2219,40 +2219,40 @@ discard block |
||
2219 | 2219 | $args->password = $orgMemberInfo->password; |
2220 | 2220 | } |
2221 | 2221 | |
2222 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
2223 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
2224 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
2225 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
2226 | - if(!$args->birthday) $args->birthday = ''; |
|
2222 | + if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
2223 | + if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
2224 | + if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
2225 | + if (!$args->description) $args->description = $orgMemberInfo->description; |
|
2226 | + if (!$args->birthday) $args->birthday = ''; |
|
2227 | 2227 | |
2228 | 2228 | $output = executeQuery('member.updateMember', $args); |
2229 | 2229 | |
2230 | - if(!$output->toBool()) |
|
2230 | + if (!$output->toBool()) |
|
2231 | 2231 | { |
2232 | 2232 | $oDB->rollback(); |
2233 | 2233 | return $output; |
2234 | 2234 | } |
2235 | 2235 | |
2236 | - if($args->group_srl_list) |
|
2236 | + if ($args->group_srl_list) |
|
2237 | 2237 | { |
2238 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2238 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2239 | 2239 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
2240 | 2240 | // If the group information, group information changes |
2241 | - if(count($group_srl_list) > 0) |
|
2241 | + if (count($group_srl_list) > 0) |
|
2242 | 2242 | { |
2243 | 2243 | $args->site_srl = 0; |
2244 | 2244 | // One of its members to delete all the group |
2245 | 2245 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
2246 | - if(!$output->toBool()) |
|
2246 | + if (!$output->toBool()) |
|
2247 | 2247 | { |
2248 | 2248 | $oDB->rollback(); |
2249 | 2249 | return $output; |
2250 | 2250 | } |
2251 | 2251 | // Enter one of the loop a |
2252 | - for($i=0;$i<count($group_srl_list);$i++) |
|
2252 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
2253 | 2253 | { |
2254 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
2255 | - if(!$output->toBool()) |
|
2254 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
2255 | + if (!$output->toBool()) |
|
2256 | 2256 | { |
2257 | 2257 | $oDB->rollback(); |
2258 | 2258 | return $output; |
@@ -2264,9 +2264,9 @@ discard block |
||
2264 | 2264 | } |
2265 | 2265 | } |
2266 | 2266 | // Call a trigger (after) |
2267 | - if($output->toBool()) { |
|
2267 | + if ($output->toBool()) { |
|
2268 | 2268 | $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); |
2269 | - if(!$trigger_output->toBool()) |
|
2269 | + if (!$trigger_output->toBool()) |
|
2270 | 2270 | { |
2271 | 2271 | $oDB->rollback(); |
2272 | 2272 | return $trigger_output; |
@@ -2279,7 +2279,7 @@ discard block |
||
2279 | 2279 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
2280 | 2280 | |
2281 | 2281 | // Save Session |
2282 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2282 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2283 | 2283 | $logged_info = Context::get('logged_info'); |
2284 | 2284 | |
2285 | 2285 | $output->add('member_srl', $args->member_srl); |
@@ -2291,14 +2291,14 @@ discard block |
||
2291 | 2291 | */ |
2292 | 2292 | function updateMemberPassword($args) |
2293 | 2293 | { |
2294 | - if($args->password) |
|
2294 | + if ($args->password) |
|
2295 | 2295 | { |
2296 | 2296 | |
2297 | 2297 | // check password strength |
2298 | 2298 | $oMemberModel = getModel('member'); |
2299 | 2299 | $config = $oMemberModel->getMemberConfig(); |
2300 | 2300 | |
2301 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2301 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
2302 | 2302 | { |
2303 | 2303 | $message = Context::getLang('about_password_strength'); |
2304 | 2304 | return new Object(-1, $message[$config->password_strength]); |
@@ -2306,13 +2306,13 @@ discard block |
||
2306 | 2306 | |
2307 | 2307 | $args->password = $oMemberModel->hashPassword($args->password); |
2308 | 2308 | } |
2309 | - else if($args->hashed_password) |
|
2309 | + else if ($args->hashed_password) |
|
2310 | 2310 | { |
2311 | 2311 | $args->password = $args->hashed_password; |
2312 | 2312 | } |
2313 | 2313 | |
2314 | 2314 | $output = executeQuery('member.updateMemberPassword', $args); |
2315 | - if($output->toBool()) |
|
2315 | + if ($output->toBool()) |
|
2316 | 2316 | { |
2317 | 2317 | $result = executeQuery('member.updateChangePasswordDate', $args); |
2318 | 2318 | } |
@@ -2331,18 +2331,18 @@ discard block |
||
2331 | 2331 | $trigger_obj = new stdClass(); |
2332 | 2332 | $trigger_obj->member_srl = $member_srl; |
2333 | 2333 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
2334 | - if(!$output->toBool()) return $output; |
|
2334 | + if (!$output->toBool()) return $output; |
|
2335 | 2335 | // Create a model object |
2336 | 2336 | $oMemberModel = getModel('member'); |
2337 | 2337 | // Bringing the user's information |
2338 | - if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
2338 | + if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
2339 | 2339 | { |
2340 | 2340 | $columnList = array('member_srl', 'is_admin'); |
2341 | 2341 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
2342 | 2342 | } |
2343 | - if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
2343 | + if (!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
2344 | 2344 | // If managers can not be deleted |
2345 | - if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
2345 | + if ($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
2346 | 2346 | |
2347 | 2347 | $oDB = &DB::getInstance(); |
2348 | 2348 | $oDB->begin(); |
@@ -2351,7 +2351,7 @@ discard block |
||
2351 | 2351 | $args->member_srl = $member_srl; |
2352 | 2352 | // Delete the entries in member_auth_mail |
2353 | 2353 | $output = executeQuery('member.deleteAuthMail', $args); |
2354 | - if(!$output->toBool()) |
|
2354 | + if (!$output->toBool()) |
|
2355 | 2355 | { |
2356 | 2356 | $oDB->rollback(); |
2357 | 2357 | return $output; |
@@ -2366,23 +2366,23 @@ discard block |
||
2366 | 2366 | */ |
2367 | 2367 | // Delete the entries in member_group_member |
2368 | 2368 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
2369 | - if(!$output->toBool()) |
|
2369 | + if (!$output->toBool()) |
|
2370 | 2370 | { |
2371 | 2371 | $oDB->rollback(); |
2372 | 2372 | return $output; |
2373 | 2373 | } |
2374 | 2374 | // member removed from the table |
2375 | 2375 | $output = executeQuery('member.deleteMember', $args); |
2376 | - if(!$output->toBool()) |
|
2376 | + if (!$output->toBool()) |
|
2377 | 2377 | { |
2378 | 2378 | $oDB->rollback(); |
2379 | 2379 | return $output; |
2380 | 2380 | } |
2381 | 2381 | // Call a trigger (after) |
2382 | - if($output->toBool()) |
|
2382 | + if ($output->toBool()) |
|
2383 | 2383 | { |
2384 | 2384 | $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); |
2385 | - if(!$trigger_output->toBool()) |
|
2385 | + if (!$trigger_output->toBool()) |
|
2386 | 2386 | { |
2387 | 2387 | $oDB->rollback(); |
2388 | 2388 | return $trigger_output; |
@@ -2406,23 +2406,23 @@ discard block |
||
2406 | 2406 | */ |
2407 | 2407 | function destroySessionInfo() |
2408 | 2408 | { |
2409 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
2409 | + if (!$_SESSION || !is_array($_SESSION)) return; |
|
2410 | 2410 | |
2411 | 2411 | $memberInfo = Context::get('logged_info'); |
2412 | 2412 | $memberSrl = $memberInfo->member_srl; |
2413 | 2413 | |
2414 | - foreach($_SESSION as $key => $val) |
|
2414 | + foreach ($_SESSION as $key => $val) |
|
2415 | 2415 | { |
2416 | 2416 | $_SESSION[$key] = ''; |
2417 | 2417 | } |
2418 | 2418 | |
2419 | 2419 | session_destroy(); |
2420 | - setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000); |
|
2421 | - setcookie('sso','',$_SERVER['REQUEST_TIME']-42000); |
|
2422 | - setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000); |
|
2420 | + setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000); |
|
2421 | + setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
2422 | + setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
2423 | 2423 | setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000); |
2424 | 2424 | |
2425 | - if($memberSrl || $_COOKIE['xeak']) |
|
2425 | + if ($memberSrl || $_COOKIE['xeak']) |
|
2426 | 2426 | { |
2427 | 2427 | $args = new stdClass(); |
2428 | 2428 | $args->member_srl = $memberSrl; |
@@ -2438,22 +2438,22 @@ discard block |
||
2438 | 2438 | $pointGroup = $pointModuleConfig->point_group; |
2439 | 2439 | |
2440 | 2440 | $levelGroup = array(); |
2441 | - if(is_array($pointGroup) && count($pointGroup)>0) |
|
2441 | + if (is_array($pointGroup) && count($pointGroup) > 0) |
|
2442 | 2442 | { |
2443 | 2443 | $levelGroup = array_flip($pointGroup); |
2444 | 2444 | ksort($levelGroup); |
2445 | 2445 | } |
2446 | 2446 | $maxLevel = 0; |
2447 | 2447 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
2448 | - if(count($resultGroup) > 0) |
|
2448 | + if (count($resultGroup) > 0) |
|
2449 | 2449 | $maxLevel = max(array_flip($resultGroup)); |
2450 | 2450 | |
2451 | - if($maxLevel > 0) |
|
2451 | + if ($maxLevel > 0) |
|
2452 | 2452 | { |
2453 | 2453 | $oPointModel = getModel('point'); |
2454 | 2454 | $originPoint = $oPointModel->getPoint($memberSrl); |
2455 | 2455 | |
2456 | - if($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
2456 | + if ($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
2457 | 2457 | { |
2458 | 2458 | $oPointController = getController('point'); |
2459 | 2459 | $oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update'); |
@@ -2463,18 +2463,18 @@ discard block |
||
2463 | 2463 | |
2464 | 2464 | function procMemberModifyEmailAddress() |
2465 | 2465 | { |
2466 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
2466 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
2467 | 2467 | |
2468 | 2468 | $member_info = Context::get('logged_info'); |
2469 | 2469 | $newEmail = Context::get('email_address'); |
2470 | 2470 | |
2471 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
2471 | + if (!$newEmail) return $this->stop('msg_invalid_request'); |
|
2472 | 2472 | |
2473 | 2473 | $oMemberModel = getModel('member'); |
2474 | 2474 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
2475 | - if($member_srl) return new Object(-1,'msg_exists_email_address'); |
|
2475 | + if ($member_srl) return new Object(-1, 'msg_exists_email_address'); |
|
2476 | 2476 | |
2477 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
2477 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
2478 | 2478 | { |
2479 | 2479 | return $this->stop('msg_invalid_request'); |
2480 | 2480 | } |
@@ -2490,7 +2490,7 @@ discard block |
||
2490 | 2490 | $oDB = &DB::getInstance(); |
2491 | 2491 | $oDB->begin(); |
2492 | 2492 | $output = executeQuery('member.insertAuthMail', $auth_args); |
2493 | - if(!$output->toBool()) |
|
2493 | + if (!$output->toBool()) |
|
2494 | 2494 | { |
2495 | 2495 | $oDB->rollback(); |
2496 | 2496 | return $output; |
@@ -2500,7 +2500,7 @@ discard block |
||
2500 | 2500 | $member_config = $oModuleModel->getModuleConfig('member'); |
2501 | 2501 | |
2502 | 2502 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
2503 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
2503 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
2504 | 2504 | |
2505 | 2505 | global $lang; |
2506 | 2506 | |
@@ -2512,17 +2512,17 @@ discard block |
||
2512 | 2512 | |
2513 | 2513 | Context::set('newEmail', $newEmail); |
2514 | 2514 | |
2515 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
2515 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
2516 | 2516 | Context::set('auth_url', $auth_url); |
2517 | 2517 | |
2518 | 2518 | $oTemplate = &TemplateHandler::getInstance(); |
2519 | 2519 | $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); |
2520 | 2520 | |
2521 | 2521 | $oMail = new Mail(); |
2522 | - $oMail->setTitle( Context::getLang('title_modify_email_address') ); |
|
2522 | + $oMail->setTitle(Context::getLang('title_modify_email_address')); |
|
2523 | 2523 | $oMail->setContent($content); |
2524 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
2525 | - $oMail->setReceiptor( $member_info->nick_name, $newEmail ); |
|
2524 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
2525 | + $oMail->setReceiptor($member_info->nick_name, $newEmail); |
|
2526 | 2526 | $result = $oMail->send(); |
2527 | 2527 | |
2528 | 2528 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); |
@@ -2536,16 +2536,16 @@ discard block |
||
2536 | 2536 | { |
2537 | 2537 | $member_srl = Context::get('member_srl'); |
2538 | 2538 | $auth_key = Context::get('auth_key'); |
2539 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
2539 | + if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
2540 | 2540 | |
2541 | 2541 | // Test logs for finding password by user_id and authkey |
2542 | 2542 | $args = new stdClass; |
2543 | 2543 | $args->member_srl = $member_srl; |
2544 | 2544 | $args->auth_key = $auth_key; |
2545 | 2545 | $output = executeQuery('member.getAuthMail', $args); |
2546 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
2546 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
2547 | 2547 | { |
2548 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2548 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2549 | 2549 | return $this->stop('msg_invalid_modify_email_auth_key'); |
2550 | 2550 | } |
2551 | 2551 | |
@@ -2554,10 +2554,10 @@ discard block |
||
2554 | 2554 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
2555 | 2555 | |
2556 | 2556 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
2557 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
2557 | + if (!$output->toBool()) return $this->stop($output->getMessage()); |
|
2558 | 2558 | |
2559 | 2559 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
2560 | - executeQuery('member.deleteAuthChangeEmailAddress',$args); |
|
2560 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2561 | 2561 | |
2562 | 2562 | $this->_clearMemberCache($args->member_srl); |
2563 | 2563 | |
@@ -2575,7 +2575,7 @@ discard block |
||
2575 | 2575 | **/ |
2576 | 2576 | function triggerGetDocumentMenu(&$menu_list) |
2577 | 2577 | { |
2578 | - if(!Context::get('is_logged')) return new Object(); |
|
2578 | + if (!Context::get('is_logged')) return new Object(); |
|
2579 | 2579 | |
2580 | 2580 | $logged_info = Context::get('logged_info'); |
2581 | 2581 | $document_srl = Context::get('target_srl'); |
@@ -2586,12 +2586,12 @@ discard block |
||
2586 | 2586 | $member_srl = $oDocument->get('member_srl'); |
2587 | 2587 | $module_srl = $oDocument->get('module_srl'); |
2588 | 2588 | |
2589 | - if(!$member_srl) return new Object(); |
|
2590 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
2589 | + if (!$member_srl) return new Object(); |
|
2590 | + if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
2591 | 2591 | |
2592 | 2592 | $oDocumentController = getController('document'); |
2593 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
2594 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup'); |
|
2593 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
2594 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
2595 | 2595 | |
2596 | 2596 | return new Object(); |
2597 | 2597 | } |
@@ -2605,7 +2605,7 @@ discard block |
||
2605 | 2605 | **/ |
2606 | 2606 | function triggerGetCommentMenu(&$menu_list) |
2607 | 2607 | { |
2608 | - if(!Context::get('is_logged')) return new Object(); |
|
2608 | + if (!Context::get('is_logged')) return new Object(); |
|
2609 | 2609 | |
2610 | 2610 | $logged_info = Context::get('logged_info'); |
2611 | 2611 | $comment_srl = Context::get('target_srl'); |
@@ -2616,12 +2616,12 @@ discard block |
||
2616 | 2616 | $module_srl = $oComment->get('module_srl'); |
2617 | 2617 | $member_srl = $oComment->get('member_srl'); |
2618 | 2618 | |
2619 | - if(!$member_srl) return new Object(); |
|
2620 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
2619 | + if (!$member_srl) return new Object(); |
|
2620 | + if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
2621 | 2621 | |
2622 | 2622 | $oCommentController = getController('comment'); |
2623 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
2624 | - $oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup'); |
|
2623 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
2624 | + $oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
2625 | 2625 | |
2626 | 2626 | return new Object(); |
2627 | 2627 | } |
@@ -2633,7 +2633,7 @@ discard block |
||
2633 | 2633 | **/ |
2634 | 2634 | function procMemberSpammerManage() |
2635 | 2635 | { |
2636 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
2636 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
2637 | 2637 | |
2638 | 2638 | $logged_info = Context::get('logged_info'); |
2639 | 2639 | $member_srl = Context::get('member_srl'); |
@@ -2641,7 +2641,7 @@ discard block |
||
2641 | 2641 | $cnt_loop = Context::get('cnt_loop'); |
2642 | 2642 | $proc_type = Context::get('proc_type'); |
2643 | 2643 | $isMoveToTrash = true; |
2644 | - if($proc_type == "delete") |
|
2644 | + if ($proc_type == "delete") |
|
2645 | 2645 | $isMoveToTrash = false; |
2646 | 2646 | |
2647 | 2647 | // check grant |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
2651 | 2651 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
2652 | 2652 | |
2653 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
2653 | + if (!$grant->manager) return new Object(-1, 'msg_not_permitted'); |
|
2654 | 2654 | |
2655 | 2655 | $proc_msg = ""; |
2656 | 2656 | |
@@ -2659,10 +2659,10 @@ discard block |
||
2659 | 2659 | |
2660 | 2660 | // delete or trash destination |
2661 | 2661 | // proc member |
2662 | - if($cnt_loop == 1) |
|
2662 | + if ($cnt_loop == 1) |
|
2663 | 2663 | $this->_spammerMember($member_srl); |
2664 | 2664 | // proc document and comment |
2665 | - elseif($cnt_loop>1) |
|
2665 | + elseif ($cnt_loop > 1) |
|
2666 | 2666 | $this->_spammerDocuments($member_srl, $isMoveToTrash); |
2667 | 2667 | |
2668 | 2668 | // get destination count |
@@ -2671,11 +2671,11 @@ discard block |
||
2671 | 2671 | |
2672 | 2672 | $total_count = Context::get('total_count'); |
2673 | 2673 | $remain_count = $cnt_document + $cnt_comment; |
2674 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
2674 | + if ($cnt_loop == 1) $total_count = $remain_count; |
|
2675 | 2675 | |
2676 | 2676 | // get progress percent |
2677 | - if($total_count > 0) |
|
2678 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
2677 | + if ($total_count > 0) |
|
2678 | + $progress = intval((($total_count - $remain_count) / $total_count) * 100); |
|
2679 | 2679 | else |
2680 | 2680 | $progress = 100; |
2681 | 2681 | |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | **/ |
2700 | 2700 | private function _spammerMember($member_srl) { |
2701 | 2701 | $logged_info = Context::get('logged_info'); |
2702 | - $spam_description = trim( Context::get('spam_description') ); |
|
2702 | + $spam_description = trim(Context::get('spam_description')); |
|
2703 | 2703 | |
2704 | 2704 | $oMemberModel = getModel('member'); |
2705 | 2705 | $columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description'); |
@@ -2718,10 +2718,10 @@ discard block |
||
2718 | 2718 | $args->user_id = $member_info->user_id; |
2719 | 2719 | $args->nick_name = $member_info->nick_name; |
2720 | 2720 | $args->denied = "Y"; |
2721 | - $args->description = trim( $member_info->description ); |
|
2722 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
2721 | + $args->description = trim($member_info->description); |
|
2722 | + if ($args->description != "") $args->description .= "\n"; // add new line |
|
2723 | 2723 | |
2724 | - $args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]"; |
|
2724 | + $args->description .= Context::getLang('cmd_spammer')."[".date("Y-m-d H:i:s")." from:".$logged_info->user_id." info:".$spam_description." docuemnts count:".$total_count."]"; |
|
2725 | 2725 | |
2726 | 2726 | $output = $this->updateMember($args, true); |
2727 | 2727 | |
@@ -2750,21 +2750,21 @@ discard block |
||
2750 | 2750 | // 1. proc comment, 2. proc document |
2751 | 2751 | $cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl); |
2752 | 2752 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
2753 | - if($cnt_comment > 0) |
|
2753 | + if ($cnt_comment > 0) |
|
2754 | 2754 | { |
2755 | 2755 | $columnList = array(); |
2756 | 2756 | $commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
2757 | - if($commentList) { |
|
2758 | - foreach($commentList as $v) { |
|
2757 | + if ($commentList) { |
|
2758 | + foreach ($commentList as $v) { |
|
2759 | 2759 | $oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash); |
2760 | 2760 | } |
2761 | 2761 | } |
2762 | - } elseif($cnt_document > 0) { |
|
2762 | + } elseif ($cnt_document > 0) { |
|
2763 | 2763 | $columnList = array(); |
2764 | 2764 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
2765 | - if($documentList) { |
|
2766 | - foreach($documentList as $v) { |
|
2767 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
2765 | + if ($documentList) { |
|
2766 | + foreach ($documentList as $v) { |
|
2767 | + if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
2768 | 2768 | else $oDocumentController->deleteDocument($v->document_srl); |
2769 | 2769 | } |
2770 | 2770 | } |
@@ -2776,24 +2776,24 @@ discard block |
||
2776 | 2776 | function _clearMemberCache($member_srl, $site_srl = 0) |
2777 | 2777 | { |
2778 | 2778 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
2779 | - if($oCacheHandler->isSupport()) |
|
2779 | + if ($oCacheHandler->isSupport()) |
|
2780 | 2780 | { |
2781 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl; |
|
2781 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
2782 | 2782 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
2783 | 2783 | $oCacheHandler->delete($cache_key); |
2784 | 2784 | |
2785 | - if($site_srl !== 0) |
|
2785 | + if ($site_srl !== 0) |
|
2786 | 2786 | { |
2787 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
2787 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
2788 | 2788 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
2789 | 2789 | $oCacheHandler->delete($cache_key); |
2790 | 2790 | } |
2791 | 2791 | } |
2792 | 2792 | |
2793 | 2793 | $oCacheHandler = CacheHandler::getInstance('object'); |
2794 | - if($oCacheHandler->isSupport()) |
|
2794 | + if ($oCacheHandler->isSupport()) |
|
2795 | 2795 | { |
2796 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
2796 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
2797 | 2797 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
2798 | 2798 | $oCacheHandler->delete($cache_key); |
2799 | 2799 | } |
@@ -41,19 +41,31 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | // Variables |
44 | - if(!$user_id) $user_id = Context::get('user_id'); |
|
44 | + if(!$user_id) { |
|
45 | + $user_id = Context::get('user_id'); |
|
46 | + } |
|
45 | 47 | $user_id = trim($user_id); |
46 | 48 | |
47 | - if(!$password) $password = Context::get('password'); |
|
49 | + if(!$password) { |
|
50 | + $password = Context::get('password'); |
|
51 | + } |
|
48 | 52 | $password = trim($password); |
49 | 53 | |
50 | - if(!$keep_signed) $keep_signed = Context::get('keep_signed'); |
|
54 | + if(!$keep_signed) { |
|
55 | + $keep_signed = Context::get('keep_signed'); |
|
56 | + } |
|
51 | 57 | // Return an error when id and password doesn't exist |
52 | - if(!$user_id) return new Object(-1,'null_user_id'); |
|
53 | - if(!$password) return new Object(-1,'null_password'); |
|
58 | + if(!$user_id) { |
|
59 | + return new Object(-1,'null_user_id'); |
|
60 | + } |
|
61 | + if(!$password) { |
|
62 | + return new Object(-1,'null_password'); |
|
63 | + } |
|
54 | 64 | |
55 | 65 | $output = $this->doLogin($user_id, $password, $keep_signed=='Y'?true:false); |
56 | - if (!$output->toBool()) return $output; |
|
66 | + if (!$output->toBool()) { |
|
67 | + return $output; |
|
68 | + } |
|
57 | 69 | |
58 | 70 | $oModuleModel = getModel('module'); |
59 | 71 | $config = $oModuleModel->getModuleConfig('member'); |
@@ -80,8 +92,7 @@ discard block |
||
80 | 92 | if(!$config->after_login_url) |
81 | 93 | { |
82 | 94 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
83 | - } |
|
84 | - else |
|
95 | + } else |
|
85 | 96 | { |
86 | 97 | $returnUrl = $config->after_login_url; |
87 | 98 | } |
@@ -98,19 +109,24 @@ discard block |
||
98 | 109 | // Call a trigger before log-out (before) |
99 | 110 | $logged_info = Context::get('logged_info'); |
100 | 111 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); |
101 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
112 | + if(!$trigger_output->toBool()) { |
|
113 | + return $trigger_output; |
|
114 | + } |
|
102 | 115 | // Destroy session information |
103 | 116 | $this->destroySessionInfo(); |
104 | 117 | // Call a trigger after log-out (after) |
105 | 118 | $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); |
106 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
119 | + if(!$trigger_output->toBool()) { |
|
120 | + return $trigger_output; |
|
121 | + } |
|
107 | 122 | |
108 | 123 | $output = new Object(); |
109 | 124 | |
110 | 125 | $oModuleModel = getModel('module'); |
111 | 126 | $config = $oModuleModel->getModuleConfig('member'); |
112 | - if($config->after_logout_url) |
|
113 | - $output->redirect_url = $config->after_logout_url; |
|
127 | + if($config->after_logout_url) { |
|
128 | + $output->redirect_url = $config->after_logout_url; |
|
129 | + } |
|
114 | 130 | |
115 | 131 | $this->_clearMemberCache($logged_info->member_srl); |
116 | 132 | |
@@ -125,12 +141,18 @@ discard block |
||
125 | 141 | function procMemberScrapDocument() |
126 | 142 | { |
127 | 143 | // Check login information |
128 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
144 | + if(!Context::get('is_logged')) { |
|
145 | + return new Object(-1, 'msg_not_logged'); |
|
146 | + } |
|
129 | 147 | $logged_info = Context::get('logged_info'); |
130 | 148 | |
131 | 149 | $document_srl = (int)Context::get('document_srl'); |
132 | - if(!$document_srl) $document_srl = (int)Context::get('target_srl'); |
|
133 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
150 | + if(!$document_srl) { |
|
151 | + $document_srl = (int)Context::get('target_srl'); |
|
152 | + } |
|
153 | + if(!$document_srl) { |
|
154 | + return new Object(-1,'msg_invalid_request'); |
|
155 | + } |
|
134 | 156 | // Get document |
135 | 157 | $oDocumentModel = getModel('document'); |
136 | 158 | $oDocument = $oDocumentModel->getDocument($document_srl); |
@@ -145,10 +167,14 @@ discard block |
||
145 | 167 | $args->title = $oDocument->get('title'); |
146 | 168 | // Check if already scrapped |
147 | 169 | $output = executeQuery('member.getScrapDocument', $args); |
148 | - if($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
170 | + if($output->data->count) { |
|
171 | + return new Object(-1, 'msg_alreay_scrapped'); |
|
172 | + } |
|
149 | 173 | // Insert |
150 | 174 | $output = executeQuery('member.addScrapDocument', $args); |
151 | - if(!$output->toBool()) return $output; |
|
175 | + if(!$output->toBool()) { |
|
176 | + return $output; |
|
177 | + } |
|
152 | 178 | |
153 | 179 | $this->setError(-1); |
154 | 180 | $this->setMessage('success_registed'); |
@@ -162,11 +188,15 @@ discard block |
||
162 | 188 | function procMemberDeleteScrap() |
163 | 189 | { |
164 | 190 | // Check login information |
165 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
191 | + if(!Context::get('is_logged')) { |
|
192 | + return new Object(-1, 'msg_not_logged'); |
|
193 | + } |
|
166 | 194 | $logged_info = Context::get('logged_info'); |
167 | 195 | |
168 | 196 | $document_srl = (int)Context::get('document_srl'); |
169 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
197 | + if(!$document_srl) { |
|
198 | + return new Object(-1,'msg_invalid_request'); |
|
199 | + } |
|
170 | 200 | // Variables |
171 | 201 | $args = new stdClass; |
172 | 202 | $args->member_srl = $logged_info->member_srl; |
@@ -192,11 +222,15 @@ discard block |
||
192 | 222 | function procMemberDeleteSavedDocument() |
193 | 223 | { |
194 | 224 | // Check login information |
195 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
225 | + if(!Context::get('is_logged')) { |
|
226 | + return new Object(-1, 'msg_not_logged'); |
|
227 | + } |
|
196 | 228 | $logged_info = Context::get('logged_info'); |
197 | 229 | |
198 | 230 | $document_srl = (int)Context::get('document_srl'); |
199 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
231 | + if(!$document_srl) { |
|
232 | + return new Object(-1,'msg_invalid_request'); |
|
233 | + } |
|
200 | 234 | |
201 | 235 | $oDocumentModel = getModel('document'); |
202 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
@@ -224,7 +258,9 @@ discard block |
||
224 | 258 | { |
225 | 259 | $name = Context::get('name'); |
226 | 260 | $value = Context::get('value'); |
227 | - if(!$value) return; |
|
261 | + if(!$value) { |
|
262 | + return; |
|
263 | + } |
|
228 | 264 | |
229 | 265 | $oMemberModel = getModel('member'); |
230 | 266 | // Check if logged-in |
@@ -235,10 +271,14 @@ discard block |
||
235 | 271 | { |
236 | 272 | case 'user_id' : |
237 | 273 | // Check denied ID |
238 | - if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id'); |
|
274 | + if($oMemberModel->isDeniedID($value)) { |
|
275 | + return new Object(0,'denied_user_id'); |
|
276 | + } |
|
239 | 277 | // Check if duplicated |
240 | 278 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
241 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id'); |
|
279 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
280 | + return new Object(0,'msg_exists_user_id'); |
|
281 | + } |
|
242 | 282 | break; |
243 | 283 | case 'nick_name' : |
244 | 284 | // Check denied ID |
@@ -248,13 +288,17 @@ discard block |
||
248 | 288 | } |
249 | 289 | // Check if duplicated |
250 | 290 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
251 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name'); |
|
291 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
292 | + return new Object(0,'msg_exists_nick_name'); |
|
293 | + } |
|
252 | 294 | |
253 | 295 | break; |
254 | 296 | case 'email_address' : |
255 | 297 | // Check if duplicated |
256 | 298 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
257 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address'); |
|
299 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
300 | + return new Object(0,'msg_exists_email_address'); |
|
301 | + } |
|
258 | 302 | break; |
259 | 303 | } |
260 | 304 | } |
@@ -266,17 +310,25 @@ discard block |
||
266 | 310 | */ |
267 | 311 | function procMemberInsert() |
268 | 312 | { |
269 | - if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request"); |
|
313 | + if (Context::getRequestMethod () == "GET") { |
|
314 | + return new Object (-1, "msg_invalid_request"); |
|
315 | + } |
|
270 | 316 | $oMemberModel = &getModel ('member'); |
271 | 317 | $config = $oMemberModel->getMemberConfig(); |
272 | 318 | |
273 | 319 | // call a trigger (before) |
274 | 320 | $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
275 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
321 | + if(!$trigger_output->toBool ()) { |
|
322 | + return $trigger_output; |
|
323 | + } |
|
276 | 324 | // Check if an administrator allows a membership |
277 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
325 | + if($config->enable_join != 'Y') { |
|
326 | + return $this->stop ('msg_signup_disabled'); |
|
327 | + } |
|
278 | 328 | // Check if the user accept the license terms (only if terms exist) |
279 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
329 | + if($config->agreement && Context::get('accept_agreement')!='Y') { |
|
330 | + return $this->stop('msg_accept_agreement'); |
|
331 | + } |
|
280 | 332 | |
281 | 333 | // Extract the necessary information in advance |
282 | 334 | $getVars = array(); |
@@ -295,16 +347,22 @@ discard block |
||
295 | 347 | foreach($getVars as $val) |
296 | 348 | { |
297 | 349 | $args->{$val} = Context::get($val); |
298 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
350 | + if($val == 'birthday') { |
|
351 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
352 | + } |
|
299 | 353 | } |
300 | 354 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
301 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
355 | + if(!$args->birthday && $args->birthday_ui) { |
|
356 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
357 | + } |
|
302 | 358 | |
303 | 359 | $args->find_account_answer = Context::get('find_account_answer'); |
304 | 360 | $args->allow_mailing = Context::get('allow_mailing'); |
305 | 361 | $args->allow_message = Context::get('allow_message'); |
306 | 362 | |
307 | - if($args->password1) $args->password = $args->password1; |
|
363 | + if($args->password1) { |
|
364 | + $args->password = $args->password1; |
|
365 | + } |
|
308 | 366 | |
309 | 367 | // check password strength |
310 | 368 | if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
@@ -333,7 +391,9 @@ discard block |
||
333 | 391 | unset($all_args->secret_text); |
334 | 392 | |
335 | 393 | // Set the user state as "denied" when using mail authentication |
336 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
394 | + if($config->enable_confirm == 'Y') { |
|
395 | + $args->denied = 'Y'; |
|
396 | + } |
|
337 | 397 | // Add extra vars after excluding necessary information from all the requested arguments |
338 | 398 | $extra_vars = delObjectVars($all_args, $args); |
339 | 399 | $args->extra_vars = serialize($extra_vars); |
@@ -348,7 +408,9 @@ discard block |
||
348 | 408 | } |
349 | 409 | } |
350 | 410 | $output = $this->insertMember($args); |
351 | - if(!$output->toBool()) return $output; |
|
411 | + if(!$output->toBool()) { |
|
412 | + return $output; |
|
413 | + } |
|
352 | 414 | |
353 | 415 | // insert ProfileImage, ImageName, ImageMark |
354 | 416 | $profile_image = $_FILES['profile_image']; |
@@ -387,43 +449,46 @@ discard block |
||
387 | 449 | if($config->identifier == 'email_address') |
388 | 450 | { |
389 | 451 | $output = $this->doLogin($args->email_address); |
390 | - } |
|
391 | - else |
|
452 | + } else |
|
392 | 453 | { |
393 | 454 | $output = $this->doLogin($args->user_id); |
394 | 455 | } |
395 | 456 | if(!$output->toBool()) { |
396 | - if($output->error == -9) |
|
397 | - $output->error = -11; |
|
457 | + if($output->error == -9) { |
|
458 | + $output->error = -11; |
|
459 | + } |
|
398 | 460 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
399 | 461 | } |
400 | 462 | } |
401 | 463 | |
402 | 464 | // Results |
403 | 465 | $this->add('member_srl', $args->member_srl); |
404 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
466 | + if($config->redirect_url) { |
|
467 | + $this->add('redirect_url', $config->redirect_url); |
|
468 | + } |
|
405 | 469 | if($config->enable_confirm == 'Y') |
406 | 470 | { |
407 | 471 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
408 | 472 | $this->setMessage($msg); |
409 | 473 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), new Object(-12, $msg)); |
474 | + } else { |
|
475 | + $this->setMessage('success_registed'); |
|
410 | 476 | } |
411 | - else $this->setMessage('success_registed'); |
|
412 | 477 | // Call a trigger (after) |
413 | 478 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
414 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
479 | + if(!$trigger_output->toBool()) { |
|
480 | + return $trigger_output; |
|
481 | + } |
|
415 | 482 | |
416 | 483 | if($config->redirect_url) |
417 | 484 | { |
418 | 485 | $returnUrl = $config->redirect_url; |
419 | - } |
|
420 | - else |
|
486 | + } else |
|
421 | 487 | { |
422 | 488 | if(Context::get('success_return_url')) |
423 | 489 | { |
424 | 490 | $returnUrl = Context::get('success_return_url'); |
425 | - } |
|
426 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
491 | + } else if($_COOKIE['XE_REDIRECT_URL']) |
|
427 | 492 | { |
428 | 493 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
429 | 494 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -477,8 +542,7 @@ discard block |
||
477 | 542 | if(Context::get('success_return_url')) |
478 | 543 | { |
479 | 544 | $redirectUrl = Context::get('success_return_url'); |
480 | - } |
|
481 | - else |
|
545 | + } else |
|
482 | 546 | { |
483 | 547 | $redirectUrl = getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
484 | 548 | } |
@@ -522,13 +586,17 @@ discard block |
||
522 | 586 | foreach($getVars as $val) |
523 | 587 | { |
524 | 588 | $args->{$val} = Context::get($val); |
525 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
589 | + if($val == 'birthday') { |
|
590 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
591 | + } |
|
526 | 592 | } |
527 | 593 | // Login Information |
528 | 594 | $logged_info = Context::get('logged_info'); |
529 | 595 | $args->member_srl = $logged_info->member_srl; |
530 | 596 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
531 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
597 | + if(!$args->birthday && $args->birthday_ui) { |
|
598 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
599 | + } |
|
532 | 600 | // Remove some unnecessary variables from all the vars |
533 | 601 | $all_args = Context::getRequestVars(); |
534 | 602 | unset($all_args->module); |
@@ -562,7 +630,9 @@ discard block |
||
562 | 630 | |
563 | 631 | // Execute insert or update depending on the value of member_srl |
564 | 632 | $output = $this->updateMember($args); |
565 | - if(!$output->toBool()) return $output; |
|
633 | + if(!$output->toBool()) { |
|
634 | + return $output; |
|
635 | + } |
|
566 | 636 | |
567 | 637 | $profile_image = $_FILES['profile_image']; |
568 | 638 | if(is_uploaded_file($profile_image['tmp_name'])) |
@@ -592,7 +662,9 @@ discard block |
||
592 | 662 | |
593 | 663 | // Call a trigger after successfully log-in (after) |
594 | 664 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
595 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
665 | + if(!$trigger_output->toBool()) { |
|
666 | + return $trigger_output; |
|
667 | + } |
|
596 | 668 | |
597 | 669 | $this->setSessionInfo(); |
598 | 670 | // Return result |
@@ -613,7 +685,9 @@ discard block |
||
613 | 685 | */ |
614 | 686 | function procMemberModifyPassword() |
615 | 687 | { |
616 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
688 | + if(!Context::get('is_logged')) { |
|
689 | + return $this->stop('msg_not_logged'); |
|
690 | + } |
|
617 | 691 | // Extract the necessary information in advance |
618 | 692 | $current_password = trim(Context::get('current_password')); |
619 | 693 | $password = trim(Context::get('password1')); |
@@ -627,17 +701,23 @@ discard block |
||
627 | 701 | |
628 | 702 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
629 | 703 | // Verify the cuttent password |
630 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
704 | + if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) { |
|
705 | + return new Object(-1, 'invalid_password'); |
|
706 | + } |
|
631 | 707 | |
632 | 708 | // Check if a new password is as same as the previous password |
633 | - if($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
709 | + if($current_password == $password) { |
|
710 | + return new Object(-1, 'invalid_new_password'); |
|
711 | + } |
|
634 | 712 | |
635 | 713 | // Execute insert or update depending on the value of member_srl |
636 | 714 | $args = new stdClass; |
637 | 715 | $args->member_srl = $member_srl; |
638 | 716 | $args->password = $password; |
639 | 717 | $output = $this->updateMemberPassword($args); |
640 | - if(!$output->toBool()) return $output; |
|
718 | + if(!$output->toBool()) { |
|
719 | + return $output; |
|
720 | + } |
|
641 | 721 | |
642 | 722 | $this->add('member_srl', $args->member_srl); |
643 | 723 | $this->setMessage('success_updated'); |
@@ -653,7 +733,9 @@ discard block |
||
653 | 733 | */ |
654 | 734 | function procMemberLeave() |
655 | 735 | { |
656 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
736 | + if(!Context::get('is_logged')) { |
|
737 | + return $this->stop('msg_not_logged'); |
|
738 | + } |
|
657 | 739 | // Extract the necessary information in advance |
658 | 740 | $password = trim(Context::get('password')); |
659 | 741 | // Get information of logged-in user |
@@ -669,10 +751,14 @@ discard block |
||
669 | 751 | $this->memberInfo->password = $memberInfo->password; |
670 | 752 | } |
671 | 753 | // Verify the cuttent password |
672 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
754 | + if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) { |
|
755 | + return new Object(-1, 'invalid_password'); |
|
756 | + } |
|
673 | 757 | |
674 | 758 | $output = $this->deleteMember($member_srl); |
675 | - if(!$output->toBool()) return $output; |
|
759 | + if(!$output->toBool()) { |
|
760 | + return $output; |
|
761 | + } |
|
676 | 762 | // Destroy all session information |
677 | 763 | $this->destroySessionInfo(); |
678 | 764 | // Return success message |
@@ -691,17 +777,25 @@ discard block |
||
691 | 777 | { |
692 | 778 | // Check if the file is successfully uploaded |
693 | 779 | $file = $_FILES['profile_image']; |
694 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
780 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
781 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
782 | + } |
|
695 | 783 | // Ignore if member_srl is invalid or doesn't exist. |
696 | 784 | $member_srl = Context::get('member_srl'); |
697 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
785 | + if(!$member_srl) { |
|
786 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
787 | + } |
|
698 | 788 | |
699 | 789 | $logged_info = Context::get('logged_info'); |
700 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
790 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
791 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
792 | + } |
|
701 | 793 | // Return if member module is set not to use an image name or the user is not an administrator ; |
702 | 794 | $oModuleModel = getModel('module'); |
703 | 795 | $config = $oModuleModel->getModuleConfig('member'); |
704 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
796 | + if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') { |
|
797 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
798 | + } |
|
705 | 799 | |
706 | 800 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
707 | 801 | // Page refresh |
@@ -723,26 +817,35 @@ discard block |
||
723 | 817 | { |
724 | 818 | |
725 | 819 | // Check uploaded file |
726 | - if(!checkUploadedFile($target_file)) return; |
|
820 | + if(!checkUploadedFile($target_file)) { |
|
821 | + return; |
|
822 | + } |
|
727 | 823 | |
728 | 824 | $oMemberModel = getModel('member'); |
729 | 825 | $config = $oMemberModel->getMemberConfig(); |
730 | 826 | |
731 | 827 | // Get an image size |
732 | 828 | $max_width = $config->profile_image_max_width; |
733 | - if(!$max_width) $max_width = "90"; |
|
829 | + if(!$max_width) { |
|
830 | + $max_width = "90"; |
|
831 | + } |
|
734 | 832 | $max_height = $config->profile_image_max_height; |
735 | - if(!$max_height) $max_height = "90"; |
|
833 | + if(!$max_height) { |
|
834 | + $max_height = "90"; |
|
835 | + } |
|
736 | 836 | // Get a target path to save |
737 | 837 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
738 | 838 | FileHandler::makeDir($target_path); |
739 | 839 | |
740 | 840 | // Get file information |
741 | 841 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
742 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
743 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
744 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
745 | - else |
|
842 | + if(IMAGETYPE_PNG == $type) { |
|
843 | + $ext = 'png'; |
|
844 | + } elseif(IMAGETYPE_JPEG == $type) { |
|
845 | + $ext = 'jpg'; |
|
846 | + } elseif(IMAGETYPE_GIF == $type) { |
|
847 | + $ext = 'gif'; |
|
848 | + } else |
|
746 | 849 | { |
747 | 850 | return; |
748 | 851 | } |
@@ -754,8 +857,7 @@ discard block |
||
754 | 857 | if(($width > $max_width || $height > $max_height ) && $type != 1) |
755 | 858 | { |
756 | 859 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
757 | - } |
|
758 | - else |
|
860 | + } else |
|
759 | 861 | { |
760 | 862 | @copy($target_file, $target_filename); |
761 | 863 | } |
@@ -770,17 +872,25 @@ discard block |
||
770 | 872 | { |
771 | 873 | // Check if the file is successfully uploaded |
772 | 874 | $file = $_FILES['image_name']; |
773 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
875 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
876 | + return $this->stop('msg_not_uploaded_image_name'); |
|
877 | + } |
|
774 | 878 | // Ignore if member_srl is invalid or doesn't exist. |
775 | 879 | $member_srl = Context::get('member_srl'); |
776 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
880 | + if(!$member_srl) { |
|
881 | + return $this->stop('msg_not_uploaded_image_name'); |
|
882 | + } |
|
777 | 883 | |
778 | 884 | $logged_info = Context::get('logged_info'); |
779 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
885 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
886 | + return $this->stop('msg_not_uploaded_image_name'); |
|
887 | + } |
|
780 | 888 | // Return if member module is set not to use an image name or the user is not an administrator ; |
781 | 889 | $oModuleModel = getModel('module'); |
782 | 890 | $config = $oModuleModel->getModuleConfig('member'); |
783 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
891 | + if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') { |
|
892 | + return $this->stop('msg_not_uploaded_image_name'); |
|
893 | + } |
|
784 | 894 | |
785 | 895 | $this->insertImageName($member_srl, $file['tmp_name']); |
786 | 896 | // Page refresh |
@@ -801,15 +911,21 @@ discard block |
||
801 | 911 | function insertImageName($member_srl, $target_file) |
802 | 912 | { |
803 | 913 | // Check uploaded file |
804 | - if(!checkUploadedFile($target_file)) return; |
|
914 | + if(!checkUploadedFile($target_file)) { |
|
915 | + return; |
|
916 | + } |
|
805 | 917 | |
806 | 918 | $oModuleModel = getModel('module'); |
807 | 919 | $config = $oModuleModel->getModuleConfig('member'); |
808 | 920 | // Get an image size |
809 | 921 | $max_width = $config->image_name_max_width; |
810 | - if(!$max_width) $max_width = "90"; |
|
922 | + if(!$max_width) { |
|
923 | + $max_width = "90"; |
|
924 | + } |
|
811 | 925 | $max_height = $config->image_name_max_height; |
812 | - if(!$max_height) $max_height = "20"; |
|
926 | + if(!$max_height) { |
|
927 | + $max_height = "20"; |
|
928 | + } |
|
813 | 929 | // Get a target path to save |
814 | 930 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
815 | 931 | FileHandler::makeDir($target_path); |
@@ -818,8 +934,11 @@ discard block |
||
818 | 934 | // Get file information |
819 | 935 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
820 | 936 | // Convert if the image size is larger than a given size or if the format is not a gif |
821 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
822 | - else @copy($target_file, $target_filename); |
|
937 | + if($width > $max_width || $height > $max_height || $type!=1) { |
|
938 | + FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
939 | + } else { |
|
940 | + @copy($target_file, $target_filename); |
|
941 | + } |
|
823 | 942 | } |
824 | 943 | |
825 | 944 | /** |
@@ -879,17 +998,25 @@ discard block |
||
879 | 998 | { |
880 | 999 | // Check if the file is successfully uploaded |
881 | 1000 | $file = $_FILES['image_mark']; |
882 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
1001 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
1002 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
1003 | + } |
|
883 | 1004 | // Ignore if member_srl is invalid or doesn't exist. |
884 | 1005 | $member_srl = Context::get('member_srl'); |
885 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
1006 | + if(!$member_srl) { |
|
1007 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
1008 | + } |
|
886 | 1009 | |
887 | 1010 | $logged_info = Context::get('logged_info'); |
888 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
1011 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
1012 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
1013 | + } |
|
889 | 1014 | // Membership in the images mark the module using the ban was set by an administrator or return; |
890 | 1015 | $oModuleModel = getModel('module'); |
891 | 1016 | $config = $oModuleModel->getModuleConfig('member'); |
892 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
1017 | + if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') { |
|
1018 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
1019 | + } |
|
893 | 1020 | |
894 | 1021 | $this->insertImageMark($member_srl, $file['tmp_name']); |
895 | 1022 | // Page refresh |
@@ -910,15 +1037,21 @@ discard block |
||
910 | 1037 | function insertImageMark($member_srl, $target_file) |
911 | 1038 | { |
912 | 1039 | // Check uploaded file |
913 | - if(!checkUploadedFile($target_file)) return; |
|
1040 | + if(!checkUploadedFile($target_file)) { |
|
1041 | + return; |
|
1042 | + } |
|
914 | 1043 | |
915 | 1044 | $oModuleModel = getModel('module'); |
916 | 1045 | $config = $oModuleModel->getModuleConfig('member'); |
917 | 1046 | // Get an image size |
918 | 1047 | $max_width = $config->image_mark_max_width; |
919 | - if(!$max_width) $max_width = "20"; |
|
1048 | + if(!$max_width) { |
|
1049 | + $max_width = "20"; |
|
1050 | + } |
|
920 | 1051 | $max_height = $config->image_mark_max_height; |
921 | - if(!$max_height) $max_height = "20"; |
|
1052 | + if(!$max_height) { |
|
1053 | + $max_height = "20"; |
|
1054 | + } |
|
922 | 1055 | |
923 | 1056 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
924 | 1057 | FileHandler::makeDir($target_path); |
@@ -927,8 +1060,11 @@ discard block |
||
927 | 1060 | // Get file information |
928 | 1061 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
929 | 1062 | |
930 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
931 | - else @copy($target_file, $target_filename); |
|
1063 | + if($width > $max_width || $height > $max_height || $type!=1) { |
|
1064 | + FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
1065 | + } else { |
|
1066 | + @copy($target_file, $target_filename); |
|
1067 | + } |
|
932 | 1068 | } |
933 | 1069 | |
934 | 1070 | /** |
@@ -963,14 +1099,18 @@ discard block |
||
963 | 1099 | function procMemberFindAccount() |
964 | 1100 | { |
965 | 1101 | $email_address = Context::get('email_address'); |
966 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1102 | + if(!$email_address) { |
|
1103 | + return new Object(-1, 'msg_invalid_request'); |
|
1104 | + } |
|
967 | 1105 | |
968 | 1106 | $oMemberModel = getModel('member'); |
969 | 1107 | $oModuleModel = getModel('module'); |
970 | 1108 | |
971 | 1109 | // Check if a member having the same email address exists |
972 | 1110 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
973 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1111 | + if(!$member_srl) { |
|
1112 | + return new Object(-1, 'msg_email_not_exists'); |
|
1113 | + } |
|
974 | 1114 | |
975 | 1115 | // Get information of the member |
976 | 1116 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
@@ -982,7 +1122,9 @@ discard block |
||
982 | 1122 | $chk_args = new stdClass; |
983 | 1123 | $chk_args->member_srl = $member_info->member_srl; |
984 | 1124 | $output = executeQuery('member.chkAuthMail', $chk_args); |
985 | - if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
1125 | + if($output->toBool() && $output->data->count != '0') { |
|
1126 | + return new Object(-1, 'msg_user_not_confirmed'); |
|
1127 | + } |
|
986 | 1128 | } |
987 | 1129 | |
988 | 1130 | // Insert data into the authentication DB |
@@ -995,7 +1137,9 @@ discard block |
||
995 | 1137 | $args->is_register = 'N'; |
996 | 1138 | |
997 | 1139 | $output = executeQuery('member.insertAuthMail', $args); |
998 | - if(!$output->toBool()) return $output; |
|
1140 | + if(!$output->toBool()) { |
|
1141 | + return $output; |
|
1142 | + } |
|
999 | 1143 | // Get content of the email to send a member |
1000 | 1144 | Context::set('auth_args', $args); |
1001 | 1145 | |
@@ -1012,8 +1156,7 @@ discard block |
||
1012 | 1156 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1013 | 1157 | } |
1014 | 1158 | } |
1015 | - } |
|
1016 | - else |
|
1159 | + } else |
|
1017 | 1160 | { |
1018 | 1161 | $memberInfo[$lang->user_id] = $args->user_id; |
1019 | 1162 | $memberInfo[$lang->user_name] = $args->user_name; |
@@ -1022,13 +1165,19 @@ discard block |
||
1022 | 1165 | } |
1023 | 1166 | Context::set('memberInfo', $memberInfo); |
1024 | 1167 | |
1025 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1026 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1168 | + if(!$member_config->skin) { |
|
1169 | + $member_config->skin = "default"; |
|
1170 | + } |
|
1171 | + if(!$member_config->colorset) { |
|
1172 | + $member_config->colorset = "white"; |
|
1173 | + } |
|
1027 | 1174 | |
1028 | 1175 | Context::set('member_config', $member_config); |
1029 | 1176 | |
1030 | 1177 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1031 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1178 | + if(!is_dir($tpl_path)) { |
|
1179 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1180 | + } |
|
1032 | 1181 | |
1033 | 1182 | $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
1034 | 1183 | Context::set('find_url', $find_url); |
@@ -1070,20 +1219,28 @@ discard block |
||
1070 | 1219 | $find_account_question = trim(Context::get('find_account_question')); |
1071 | 1220 | $find_account_answer = trim(Context::get('find_account_answer')); |
1072 | 1221 | |
1073 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
1222 | + if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) { |
|
1223 | + return new Object(-1, 'msg_invalid_request'); |
|
1224 | + } |
|
1074 | 1225 | |
1075 | 1226 | $oModuleModel = getModel('module'); |
1076 | 1227 | // Check if a member having the same email address exists |
1077 | 1228 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
1078 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
1229 | + if(!$member_srl) { |
|
1230 | + return new Object(-1, 'msg_email_not_exists'); |
|
1231 | + } |
|
1079 | 1232 | // Get information of the member |
1080 | 1233 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
1081 | 1234 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
1082 | 1235 | |
1083 | 1236 | // Display a message if no answer is entered |
1084 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
1237 | + if(!$member_info->find_account_question || !$member_info->find_account_answer) { |
|
1238 | + return new Object(-1, 'msg_question_not_exists'); |
|
1239 | + } |
|
1085 | 1240 | |
1086 | - if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); |
|
1241 | + if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) { |
|
1242 | + return new Object(-1, 'msg_answer_not_matches'); |
|
1243 | + } |
|
1087 | 1244 | |
1088 | 1245 | if($config->identifier == 'email_address') |
1089 | 1246 | { |
@@ -1099,7 +1256,9 @@ discard block |
||
1099 | 1256 | $args->password = $temp_password; |
1100 | 1257 | $args->change_password_date = '1'; |
1101 | 1258 | $output = $this->updateMemberPassword($args); |
1102 | - if(!$output->toBool()) return $output; |
|
1259 | + if(!$output->toBool()) { |
|
1260 | + return $output; |
|
1261 | + } |
|
1103 | 1262 | |
1104 | 1263 | $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
1105 | 1264 | |
@@ -1156,8 +1315,7 @@ discard block |
||
1156 | 1315 | if($output->data->is_register == 'Y') |
1157 | 1316 | { |
1158 | 1317 | $args->denied = 'N'; |
1159 | - } |
|
1160 | - else |
|
1318 | + } else |
|
1161 | 1319 | { |
1162 | 1320 | $args->password = $oMemberModel->hashPassword($args->password); |
1163 | 1321 | } |
@@ -1191,33 +1349,45 @@ discard block |
||
1191 | 1349 | { |
1192 | 1350 | // Get an email_address |
1193 | 1351 | $email_address = Context::get('email_address'); |
1194 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
1352 | + if(!$email_address) { |
|
1353 | + return new Object(-1, 'msg_invalid_request'); |
|
1354 | + } |
|
1195 | 1355 | // Log test by using email_address |
1196 | 1356 | $oMemberModel = getModel('member'); |
1197 | 1357 | |
1198 | 1358 | $args = new stdClass; |
1199 | 1359 | $args->email_address = $email_address; |
1200 | 1360 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
1201 | - if(!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
1361 | + if(!$memberSrl) { |
|
1362 | + return new Object(-1, 'msg_not_exists_member'); |
|
1363 | + } |
|
1202 | 1364 | |
1203 | 1365 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
1204 | 1366 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
1205 | 1367 | |
1206 | 1368 | $oModuleModel = getModel('module'); |
1207 | 1369 | $member_config = $oModuleModel->getModuleConfig('member'); |
1208 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1209 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1370 | + if(!$member_config->skin) { |
|
1371 | + $member_config->skin = "default"; |
|
1372 | + } |
|
1373 | + if(!$member_config->colorset) { |
|
1374 | + $member_config->colorset = "white"; |
|
1375 | + } |
|
1210 | 1376 | |
1211 | 1377 | // Check if a authentication mail has been sent previously |
1212 | 1378 | $chk_args = new stdClass; |
1213 | 1379 | $chk_args->member_srl = $member_info->member_srl; |
1214 | 1380 | $output = executeQuery('member.chkAuthMail', $chk_args); |
1215 | - if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
1381 | + if($output->toBool() && $output->data->count == '0') { |
|
1382 | + return new Object(-1, 'msg_invalid_request'); |
|
1383 | + } |
|
1216 | 1384 | |
1217 | 1385 | $auth_args = new stdClass; |
1218 | 1386 | $auth_args->member_srl = $member_info->member_srl; |
1219 | 1387 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
1220 | - if(!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
1388 | + if(!$output->data || !$output->data[0]->auth_key) { |
|
1389 | + return new Object(-1, 'msg_invalid_request'); |
|
1390 | + } |
|
1221 | 1391 | $auth_info = $output->data[0]; |
1222 | 1392 | |
1223 | 1393 | // Update the regdate of authmail entry |
@@ -1238,8 +1408,7 @@ discard block |
||
1238 | 1408 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1239 | 1409 | } |
1240 | 1410 | } |
1241 | - } |
|
1242 | - else |
|
1411 | + } else |
|
1243 | 1412 | { |
1244 | 1413 | $memberInfo[$lang->user_id] = $member_info->user_id; |
1245 | 1414 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1252,7 +1421,9 @@ discard block |
||
1252 | 1421 | Context::set('member_config', $member_config); |
1253 | 1422 | |
1254 | 1423 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1255 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1424 | + if(!is_dir($tpl_path)) { |
|
1425 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1426 | + } |
|
1256 | 1427 | |
1257 | 1428 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
1258 | 1429 | Context::set('auth_url', $auth_url); |
@@ -1330,7 +1501,9 @@ discard block |
||
1330 | 1501 | $auth_args->is_register = 'Y'; |
1331 | 1502 | |
1332 | 1503 | $output = executeQuery('member.insertAuthMail', $auth_args); |
1333 | - if(!$output->toBool()) return $output; |
|
1504 | + if(!$output->toBool()) { |
|
1505 | + return $output; |
|
1506 | + } |
|
1334 | 1507 | |
1335 | 1508 | $memberInfo->email_address = $newEmail; |
1336 | 1509 | |
@@ -1364,8 +1537,7 @@ discard block |
||
1364 | 1537 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
1365 | 1538 | } |
1366 | 1539 | } |
1367 | - } |
|
1368 | - else |
|
1540 | + } else |
|
1369 | 1541 | { |
1370 | 1542 | $memberInfo[$lang->user_id] = $member_info->user_id; |
1371 | 1543 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1374,13 +1546,19 @@ discard block |
||
1374 | 1546 | } |
1375 | 1547 | Context::set('memberInfo', $memberInfo); |
1376 | 1548 | |
1377 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
1378 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
1549 | + if(!$member_config->skin) { |
|
1550 | + $member_config->skin = "default"; |
|
1551 | + } |
|
1552 | + if(!$member_config->colorset) { |
|
1553 | + $member_config->colorset = "white"; |
|
1554 | + } |
|
1379 | 1555 | |
1380 | 1556 | Context::set('member_config', $member_config); |
1381 | 1557 | |
1382 | 1558 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
1383 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1559 | + if(!is_dir($tpl_path)) { |
|
1560 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
1561 | + } |
|
1384 | 1562 | |
1385 | 1563 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
1386 | 1564 | Context::set('auth_url', $auth_url); |
@@ -1405,7 +1583,9 @@ discard block |
||
1405 | 1583 | { |
1406 | 1584 | $site_module_info = Context::get('site_module_info'); |
1407 | 1585 | $logged_info = Context::get('logged_info'); |
1408 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
1586 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
1587 | + return new Object(-1,'msg_invalid_request'); |
|
1588 | + } |
|
1409 | 1589 | |
1410 | 1590 | $oMemberModel = getModel('member'); |
1411 | 1591 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1424,13 +1604,17 @@ discard block |
||
1424 | 1604 | { |
1425 | 1605 | $site_module_info = Context::get('site_module_info'); |
1426 | 1606 | $logged_info = Context::get('logged_info'); |
1427 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
1607 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
1608 | + return new Object(-1,'msg_invalid_request'); |
|
1609 | + } |
|
1428 | 1610 | |
1429 | 1611 | $args = new stdClass; |
1430 | 1612 | $args->site_srl= $site_module_info->site_srl; |
1431 | 1613 | $args->member_srl = $logged_info->member_srl; |
1432 | 1614 | $output = executeQuery('member.deleteMembersGroup', $args); |
1433 | - if(!$output->toBool()) return $output; |
|
1615 | + if(!$output->toBool()) { |
|
1616 | + return $output; |
|
1617 | + } |
|
1434 | 1618 | $this->setMessage('success_deleted'); |
1435 | 1619 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
1436 | 1620 | } |
@@ -1444,17 +1628,37 @@ discard block |
||
1444 | 1628 | */ |
1445 | 1629 | function setMemberConfig($args) |
1446 | 1630 | { |
1447 | - if(!$args->skin) $args->skin = "default"; |
|
1448 | - if(!$args->colorset) $args->colorset = "white"; |
|
1449 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
1450 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
1451 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
1631 | + if(!$args->skin) { |
|
1632 | + $args->skin = "default"; |
|
1633 | + } |
|
1634 | + if(!$args->colorset) { |
|
1635 | + $args->colorset = "white"; |
|
1636 | + } |
|
1637 | + if(!$args->editor_skin) { |
|
1638 | + $args->editor_skin= "ckeditor"; |
|
1639 | + } |
|
1640 | + if(!$args->editor_colorset) { |
|
1641 | + $args->editor_colorset = "moono"; |
|
1642 | + } |
|
1643 | + if($args->enable_join!='Y') { |
|
1644 | + $args->enable_join = 'N'; |
|
1645 | + } |
|
1452 | 1646 | $args->enable_openid= 'N'; |
1453 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
1454 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
1455 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
1456 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
1457 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
1647 | + if($args->profile_image !='Y') { |
|
1648 | + $args->profile_image = 'N'; |
|
1649 | + } |
|
1650 | + if($args->image_name!='Y') { |
|
1651 | + $args->image_name = 'N'; |
|
1652 | + } |
|
1653 | + if($args->image_mark!='Y') { |
|
1654 | + $args->image_mark = 'N'; |
|
1655 | + } |
|
1656 | + if($args->group_image_mark!='Y') { |
|
1657 | + $args->group_image_mark = 'N'; |
|
1658 | + } |
|
1659 | + if(!trim(strip_tags($args->agreement))) { |
|
1660 | + $args->agreement = null; |
|
1661 | + } |
|
1458 | 1662 | $args->limit_day = (int)$args->limit_day; |
1459 | 1663 | |
1460 | 1664 | $agreement = trim($args->agreement); |
@@ -1462,7 +1666,9 @@ discard block |
||
1462 | 1666 | |
1463 | 1667 | $oModuleController = getController('module'); |
1464 | 1668 | $output = $oModuleController->insertModuleConfig('member',$args); |
1465 | - if(!$output->toBool()) return $output; |
|
1669 | + if(!$output->toBool()) { |
|
1670 | + return $output; |
|
1671 | + } |
|
1466 | 1672 | |
1467 | 1673 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
1468 | 1674 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1487,7 +1693,9 @@ discard block |
||
1487 | 1693 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
1488 | 1694 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
1489 | 1695 | |
1490 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
1696 | + if(!$check_signature) { |
|
1697 | + return FileHandler::removeFile($filename); |
|
1698 | + } |
|
1491 | 1699 | |
1492 | 1700 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
1493 | 1701 | FileHandler::makeDir($path); |
@@ -1521,7 +1729,9 @@ discard block |
||
1521 | 1729 | $args = new stdClass(); |
1522 | 1730 | $args->member_srl = $member_srl; |
1523 | 1731 | $args->group_srl = $group_srl; |
1524 | - if($site_srl) $args->site_srl = $site_srl; |
|
1732 | + if($site_srl) { |
|
1733 | + $args->site_srl = $site_srl; |
|
1734 | + } |
|
1525 | 1735 | |
1526 | 1736 | // Add |
1527 | 1737 | $output = executeQuery('member.addMemberToGroup',$args); |
@@ -1547,15 +1757,21 @@ discard block |
||
1547 | 1757 | $obj->member_srl = implode(',',$args->member_srl); |
1548 | 1758 | |
1549 | 1759 | $output = executeQueryArray('member.getMembersGroup', $obj); |
1550 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
1760 | + if($output->data) { |
|
1761 | + foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
1762 | + } |
|
1551 | 1763 | |
1552 | 1764 | $output = executeQuery('member.deleteMembersGroup', $obj); |
1553 | - if(!$output->toBool()) return $output; |
|
1765 | + if(!$output->toBool()) { |
|
1766 | + return $output; |
|
1767 | + } |
|
1554 | 1768 | |
1555 | 1769 | $inserted_members = array(); |
1556 | 1770 | foreach($args->member_srl as $key => $val) |
1557 | 1771 | { |
1558 | - if($inserted_members[$val]) continue; |
|
1772 | + if($inserted_members[$val]) { |
|
1773 | + continue; |
|
1774 | + } |
|
1559 | 1775 | $inserted_members[$val] = true; |
1560 | 1776 | |
1561 | 1777 | unset($obj); |
@@ -1565,7 +1781,9 @@ discard block |
||
1565 | 1781 | $obj->site_srl = $args->site_srl; |
1566 | 1782 | $obj->regdate = $date[$obj->member_srl]; |
1567 | 1783 | $output = executeQuery('member.addMemberToGroup', $obj); |
1568 | - if(!$output->toBool()) return $output; |
|
1784 | + if(!$output->toBool()) { |
|
1785 | + return $output; |
|
1786 | + } |
|
1569 | 1787 | |
1570 | 1788 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
1571 | 1789 | } |
@@ -1627,8 +1845,7 @@ discard block |
||
1627 | 1845 | if($config->identifier == 'user_id') |
1628 | 1846 | { |
1629 | 1847 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
1630 | - } |
|
1631 | - else |
|
1848 | + } else |
|
1632 | 1849 | { |
1633 | 1850 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
1634 | 1851 | } |
@@ -1637,8 +1854,7 @@ discard block |
||
1637 | 1854 | $do_auto_login = true; |
1638 | 1855 | } |
1639 | 1856 | |
1640 | - } |
|
1641 | - else |
|
1857 | + } else |
|
1642 | 1858 | { |
1643 | 1859 | $do_auto_login = true; |
1644 | 1860 | } |
@@ -1647,8 +1863,7 @@ discard block |
||
1647 | 1863 | if($do_auto_login) |
1648 | 1864 | { |
1649 | 1865 | $output = $this->doLogin($user_id); |
1650 | - } |
|
1651 | - else |
|
1866 | + } else |
|
1652 | 1867 | { |
1653 | 1868 | executeQuery('member.deleteAutologin', $args); |
1654 | 1869 | setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
@@ -1667,13 +1882,17 @@ discard block |
||
1667 | 1882 | function doLogin($user_id, $password = '', $keep_signed = false) |
1668 | 1883 | { |
1669 | 1884 | $user_id = strtolower($user_id); |
1670 | - if(!$user_id) return new Object(-1, 'null_user_id'); |
|
1885 | + if(!$user_id) { |
|
1886 | + return new Object(-1, 'null_user_id'); |
|
1887 | + } |
|
1671 | 1888 | // Call a trigger before log-in (before) |
1672 | 1889 | $trigger_obj = new stdClass(); |
1673 | 1890 | $trigger_obj->user_id = $user_id; |
1674 | 1891 | $trigger_obj->password = $password; |
1675 | 1892 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
1676 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
1893 | + if(!$trigger_output->toBool()) { |
|
1894 | + return $trigger_output; |
|
1895 | + } |
|
1677 | 1896 | // Create a member model object |
1678 | 1897 | $oMemberModel = getModel('member'); |
1679 | 1898 | |
@@ -1688,15 +1907,18 @@ discard block |
||
1688 | 1907 | // Get user_id information |
1689 | 1908 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
1690 | 1909 | // Set an invalid user if no value returned |
1691 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
1910 | + if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) { |
|
1911 | + return $this->recordLoginError(-1, 'invalid_email_address'); |
|
1912 | + } |
|
1692 | 1913 | |
1693 | - } |
|
1694 | - else |
|
1914 | + } else |
|
1695 | 1915 | { |
1696 | 1916 | // Get user_id information |
1697 | 1917 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
1698 | 1918 | // Set an invalid user if no value returned |
1699 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
1919 | + if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) { |
|
1920 | + return $this->recordLoginError(-1, 'invalid_user_id'); |
|
1921 | + } |
|
1700 | 1922 | } |
1701 | 1923 | |
1702 | 1924 | $output = executeQuery('member.getLoginCountByIp', $args); |
@@ -1708,14 +1930,18 @@ discard block |
||
1708 | 1930 | if($term < $config->max_error_count_time) |
1709 | 1931 | { |
1710 | 1932 | $term = $config->max_error_count_time - $term; |
1711 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
1712 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
1713 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
1714 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
1933 | + if($term < 60) { |
|
1934 | + $term = intval($term).Context::getLang('unit_sec'); |
|
1935 | + } elseif(60 <= $term && $term < 3600) { |
|
1936 | + $term = intval($term/60).Context::getLang('unit_min'); |
|
1937 | + } elseif(3600 <= $term && $term < 86400) { |
|
1938 | + $term = intval($term/3600).Context::getLang('unit_hour'); |
|
1939 | + } else { |
|
1940 | + $term = intval($term/86400).Context::getLang('unit_day'); |
|
1941 | + } |
|
1715 | 1942 | |
1716 | 1943 | return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
1717 | - } |
|
1718 | - else |
|
1944 | + } else |
|
1719 | 1945 | { |
1720 | 1946 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
1721 | 1947 | $output = executeQuery('member.deleteLoginCountByIp', $args); |
@@ -1742,7 +1968,9 @@ discard block |
||
1742 | 1968 | return new Object(-1,'msg_user_denied'); |
1743 | 1969 | } |
1744 | 1970 | // Notify if denied_date is less than the current time |
1745 | - if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
1971 | + if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) { |
|
1972 | + return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
1973 | + } |
|
1746 | 1974 | // Update the latest login time |
1747 | 1975 | $args->member_srl = $this->memberInfo->member_srl; |
1748 | 1976 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1791,7 +2019,9 @@ discard block |
||
1791 | 2019 | } |
1792 | 2020 | // Call a trigger after successfully log-in (after) |
1793 | 2021 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
1794 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
2022 | + if(!$trigger_output->toBool()) { |
|
2023 | + return $trigger_output; |
|
2024 | + } |
|
1795 | 2025 | // When user checked to use auto-login |
1796 | 2026 | if($keep_signed) |
1797 | 2027 | { |
@@ -1805,7 +2035,9 @@ discard block |
||
1805 | 2035 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
1806 | 2036 | executeQuery('member.deleteAutologin', $autologin_args); |
1807 | 2037 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
1808 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
2038 | + if($autologin_output->toBool()) { |
|
2039 | + setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
2040 | + } |
|
1809 | 2041 | } |
1810 | 2042 | if($this->memberInfo->is_admin == 'Y') |
1811 | 2043 | { |
@@ -1894,7 +2126,9 @@ discard block |
||
1894 | 2126 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
1895 | 2127 | { |
1896 | 2128 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
1897 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
2129 | + if(!is_array($member_popup_menu_list)) { |
|
2130 | + $member_popup_menu_list = array(); |
|
2131 | + } |
|
1898 | 2132 | |
1899 | 2133 | $obj = new stdClass; |
1900 | 2134 | $obj->url = $url; |
@@ -1913,35 +2147,54 @@ discard block |
||
1913 | 2147 | { |
1914 | 2148 | // Call a trigger (before) |
1915 | 2149 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
1916 | - if(!$output->toBool()) return $output; |
|
2150 | + if(!$output->toBool()) { |
|
2151 | + return $output; |
|
2152 | + } |
|
1917 | 2153 | // Terms and Conditions portion of the information set up by members reaffirmed |
1918 | 2154 | $oModuleModel = getModel('module'); |
1919 | 2155 | $config = $oModuleModel->getModuleConfig('member'); |
1920 | 2156 | |
1921 | 2157 | $logged_info = Context::get('logged_info'); |
1922 | 2158 | // If the date of the temporary restrictions limit further information on the date of |
1923 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
2159 | + if($config->limit_day) { |
|
2160 | + $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
2161 | + } |
|
1924 | 2162 | |
1925 | 2163 | $args->member_srl = getNextSequence(); |
1926 | 2164 | $args->list_order = -1 * $args->member_srl; |
1927 | 2165 | |
1928 | 2166 | // Execute insert or update depending on the value of member_srl |
1929 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
2167 | + if(!$args->user_id) { |
|
2168 | + $args->user_id = 't'.$args->member_srl; |
|
2169 | + } |
|
1930 | 2170 | // Enter the user's identity changed to lowercase |
1931 | - else $args->user_id = strtolower($args->user_id); |
|
1932 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
1933 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
2171 | + else { |
|
2172 | + $args->user_id = strtolower($args->user_id); |
|
2173 | + } |
|
2174 | + if(!$args->user_name) { |
|
2175 | + $args->user_name = $args->member_srl; |
|
2176 | + } |
|
2177 | + if(!$args->nick_name) { |
|
2178 | + $args->nick_name = $args->member_srl; |
|
2179 | + } |
|
1934 | 2180 | |
1935 | 2181 | // Control of essential parameters |
1936 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
1937 | - if($args->denied!='Y') $args->denied = 'N'; |
|
1938 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
2182 | + if($args->allow_mailing!='Y') { |
|
2183 | + $args->allow_mailing = 'N'; |
|
2184 | + } |
|
2185 | + if($args->denied!='Y') { |
|
2186 | + $args->denied = 'N'; |
|
2187 | + } |
|
2188 | + if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) { |
|
2189 | + $args->allow_message = 'Y'; |
|
2190 | + } |
|
1939 | 2191 | |
1940 | 2192 | if($logged_info->is_admin == 'Y') |
1941 | 2193 | { |
1942 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
1943 | - } |
|
1944 | - else |
|
2194 | + if($args->is_admin!='Y') { |
|
2195 | + $args->is_admin = 'N'; |
|
2196 | + } |
|
2197 | + } else |
|
1945 | 2198 | { |
1946 | 2199 | unset($args->is_admin); |
1947 | 2200 | } |
@@ -1954,8 +2207,12 @@ discard block |
||
1954 | 2207 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1955 | 2208 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1956 | 2209 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
1957 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
1958 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
2210 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) { |
|
2211 | + $args->homepage = 'http://'.$args->homepage; |
|
2212 | + } |
|
2213 | + if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) { |
|
2214 | + $args->blog = 'http://'.$args->blog; |
|
2215 | + } |
|
1959 | 2216 | |
1960 | 2217 | // Create a model object |
1961 | 2218 | $oMemberModel = getModel('member'); |
@@ -1969,8 +2226,7 @@ discard block |
||
1969 | 2226 | return new Object(-1, $message[$config->password_strength]); |
1970 | 2227 | } |
1971 | 2228 | $args->password = $oMemberModel->hashPassword($args->password); |
1972 | - } |
|
1973 | - elseif(!$args->password) |
|
2229 | + } elseif(!$args->password) |
|
1974 | 2230 | { |
1975 | 2231 | unset($args->password); |
1976 | 2232 | } |
@@ -2011,8 +2267,12 @@ discard block |
||
2011 | 2267 | // Insert data into the DB |
2012 | 2268 | $args->list_order = -1 * $args->member_srl; |
2013 | 2269 | |
2014 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
2015 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
2270 | + if(!$args->user_id) { |
|
2271 | + $args->user_id = 't'.$args->member_srl; |
|
2272 | + } |
|
2273 | + if(!$args->user_name) { |
|
2274 | + $args->user_name = $args->member_srl; |
|
2275 | + } |
|
2016 | 2276 | |
2017 | 2277 | $oDB = &DB::getInstance(); |
2018 | 2278 | $oDB->begin(); |
@@ -2024,8 +2284,11 @@ discard block |
||
2024 | 2284 | return $output; |
2025 | 2285 | } |
2026 | 2286 | |
2027 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2028 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
2287 | + if(is_array($args->group_srl_list)) { |
|
2288 | + $group_srl_list = $args->group_srl_list; |
|
2289 | + } else { |
|
2290 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
2291 | + } |
|
2029 | 2292 | // If no value is entered the default group, the value of group registration |
2030 | 2293 | if(!$args->group_srl_list) |
2031 | 2294 | { |
@@ -2042,8 +2305,7 @@ discard block |
||
2042 | 2305 | } |
2043 | 2306 | } |
2044 | 2307 | // If the value is the value of the group entered the group registration |
2045 | - } |
|
2046 | - else |
|
2308 | + } else |
|
2047 | 2309 | { |
2048 | 2310 | for($i=0;$i<count($group_srl_list);$i++) |
2049 | 2311 | { |
@@ -2104,27 +2366,39 @@ discard block |
||
2104 | 2366 | { |
2105 | 2367 | // Call a trigger (before) |
2106 | 2368 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
2107 | - if(!$output->toBool()) return $output; |
|
2369 | + if(!$output->toBool()) { |
|
2370 | + return $output; |
|
2371 | + } |
|
2108 | 2372 | // Create a model object |
2109 | 2373 | $oMemberModel = getModel('member'); |
2110 | 2374 | |
2111 | 2375 | $logged_info = Context::get('logged_info'); |
2112 | 2376 | // Get what you want to modify the original information |
2113 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2377 | + if(!$this->memberInfo) { |
|
2378 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2379 | + } |
|
2114 | 2380 | // Control of essential parameters |
2115 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
2116 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
2381 | + if($args->allow_mailing!='Y') { |
|
2382 | + $args->allow_mailing = 'N'; |
|
2383 | + } |
|
2384 | + if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) { |
|
2385 | + $args->allow_message = 'Y'; |
|
2386 | + } |
|
2117 | 2387 | |
2118 | 2388 | if($logged_info->is_admin == 'Y') |
2119 | 2389 | { |
2120 | - if($args->denied!='Y') $args->denied = 'N'; |
|
2121 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
2122 | - } |
|
2123 | - else |
|
2390 | + if($args->denied!='Y') { |
|
2391 | + $args->denied = 'N'; |
|
2392 | + } |
|
2393 | + if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) { |
|
2394 | + $args->is_admin = 'N'; |
|
2395 | + } |
|
2396 | + } else |
|
2124 | 2397 | { |
2125 | 2398 | unset($args->is_admin); |
2126 | - if($is_admin == false) |
|
2127 | - unset($args->denied); |
|
2399 | + if($is_admin == false) { |
|
2400 | + unset($args->denied); |
|
2401 | + } |
|
2128 | 2402 | if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
2129 | 2403 | { |
2130 | 2404 | return $this->stop('msg_invalid_request'); |
@@ -2132,13 +2406,19 @@ discard block |
||
2132 | 2406 | } |
2133 | 2407 | |
2134 | 2408 | // Sanitize user ID, username, nickname, homepage, blog |
2135 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
2409 | + if($args->user_id) { |
|
2410 | + $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
2411 | + } |
|
2136 | 2412 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2137 | 2413 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2138 | 2414 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2139 | 2415 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
2140 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
2141 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
2416 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) { |
|
2417 | + $args->homepage = 'http://'.$args->homepage; |
|
2418 | + } |
|
2419 | + if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) { |
|
2420 | + $args->blog = 'http://'.$args->blog; |
|
2421 | + } |
|
2142 | 2422 | |
2143 | 2423 | // check member identifier form |
2144 | 2424 | $config = $oMemberModel->getMemberConfig(); |
@@ -2155,8 +2435,7 @@ discard block |
||
2155 | 2435 | return new Object(-1,'msg_exists_email_address'); |
2156 | 2436 | } |
2157 | 2437 | $args->email_address = $orgMemberInfo->email_address; |
2158 | - } |
|
2159 | - else |
|
2438 | + } else |
|
2160 | 2439 | { |
2161 | 2440 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
2162 | 2441 | if($member_srl && $args->member_srl != $member_srl) |
@@ -2213,17 +2492,26 @@ discard block |
||
2213 | 2492 | return new Object(-1, $message[$config->password_strength]); |
2214 | 2493 | } |
2215 | 2494 | $args->password = $oMemberModel->hashPassword($args->password); |
2216 | - } |
|
2217 | - else |
|
2495 | + } else |
|
2218 | 2496 | { |
2219 | 2497 | $args->password = $orgMemberInfo->password; |
2220 | 2498 | } |
2221 | 2499 | |
2222 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
2223 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
2224 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
2225 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
2226 | - if(!$args->birthday) $args->birthday = ''; |
|
2500 | + if(!$args->user_name) { |
|
2501 | + $args->user_name = $orgMemberInfo->user_name; |
|
2502 | + } |
|
2503 | + if(!$args->user_id) { |
|
2504 | + $args->user_id = $orgMemberInfo->user_id; |
|
2505 | + } |
|
2506 | + if(!$args->nick_name) { |
|
2507 | + $args->nick_name = $orgMemberInfo->nick_name; |
|
2508 | + } |
|
2509 | + if(!$args->description) { |
|
2510 | + $args->description = $orgMemberInfo->description; |
|
2511 | + } |
|
2512 | + if(!$args->birthday) { |
|
2513 | + $args->birthday = ''; |
|
2514 | + } |
|
2227 | 2515 | |
2228 | 2516 | $output = executeQuery('member.updateMember', $args); |
2229 | 2517 | |
@@ -2235,8 +2523,11 @@ discard block |
||
2235 | 2523 | |
2236 | 2524 | if($args->group_srl_list) |
2237 | 2525 | { |
2238 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
2239 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
2526 | + if(is_array($args->group_srl_list)) { |
|
2527 | + $group_srl_list = $args->group_srl_list; |
|
2528 | + } else { |
|
2529 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
2530 | + } |
|
2240 | 2531 | // If the group information, group information changes |
2241 | 2532 | if(count($group_srl_list) > 0) |
2242 | 2533 | { |
@@ -2279,7 +2570,9 @@ discard block |
||
2279 | 2570 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
2280 | 2571 | |
2281 | 2572 | // Save Session |
2282 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2573 | + if(!$this->memberInfo) { |
|
2574 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
2575 | + } |
|
2283 | 2576 | $logged_info = Context::get('logged_info'); |
2284 | 2577 | |
2285 | 2578 | $output->add('member_srl', $args->member_srl); |
@@ -2305,8 +2598,7 @@ discard block |
||
2305 | 2598 | } |
2306 | 2599 | |
2307 | 2600 | $args->password = $oMemberModel->hashPassword($args->password); |
2308 | - } |
|
2309 | - else if($args->hashed_password) |
|
2601 | + } else if($args->hashed_password) |
|
2310 | 2602 | { |
2311 | 2603 | $args->password = $args->hashed_password; |
2312 | 2604 | } |
@@ -2331,7 +2623,9 @@ discard block |
||
2331 | 2623 | $trigger_obj = new stdClass(); |
2332 | 2624 | $trigger_obj->member_srl = $member_srl; |
2333 | 2625 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
2334 | - if(!$output->toBool()) return $output; |
|
2626 | + if(!$output->toBool()) { |
|
2627 | + return $output; |
|
2628 | + } |
|
2335 | 2629 | // Create a model object |
2336 | 2630 | $oMemberModel = getModel('member'); |
2337 | 2631 | // Bringing the user's information |
@@ -2340,9 +2634,13 @@ discard block |
||
2340 | 2634 | $columnList = array('member_srl', 'is_admin'); |
2341 | 2635 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
2342 | 2636 | } |
2343 | - if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
2637 | + if(!$this->memberInfo) { |
|
2638 | + return new Object(-1, 'msg_not_exists_member'); |
|
2639 | + } |
|
2344 | 2640 | // If managers can not be deleted |
2345 | - if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
2641 | + if($this->memberInfo->is_admin == 'Y') { |
|
2642 | + return new Object(-1, 'msg_cannot_delete_admin'); |
|
2643 | + } |
|
2346 | 2644 | |
2347 | 2645 | $oDB = &DB::getInstance(); |
2348 | 2646 | $oDB->begin(); |
@@ -2406,7 +2704,9 @@ discard block |
||
2406 | 2704 | */ |
2407 | 2705 | function destroySessionInfo() |
2408 | 2706 | { |
2409 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
2707 | + if(!$_SESSION || !is_array($_SESSION)) { |
|
2708 | + return; |
|
2709 | + } |
|
2410 | 2710 | |
2411 | 2711 | $memberInfo = Context::get('logged_info'); |
2412 | 2712 | $memberSrl = $memberInfo->member_srl; |
@@ -2445,8 +2745,9 @@ discard block |
||
2445 | 2745 | } |
2446 | 2746 | $maxLevel = 0; |
2447 | 2747 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
2448 | - if(count($resultGroup) > 0) |
|
2449 | - $maxLevel = max(array_flip($resultGroup)); |
|
2748 | + if(count($resultGroup) > 0) { |
|
2749 | + $maxLevel = max(array_flip($resultGroup)); |
|
2750 | + } |
|
2450 | 2751 | |
2451 | 2752 | if($maxLevel > 0) |
2452 | 2753 | { |
@@ -2463,16 +2764,22 @@ discard block |
||
2463 | 2764 | |
2464 | 2765 | function procMemberModifyEmailAddress() |
2465 | 2766 | { |
2466 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
2767 | + if(!Context::get('is_logged')) { |
|
2768 | + return $this->stop('msg_not_logged'); |
|
2769 | + } |
|
2467 | 2770 | |
2468 | 2771 | $member_info = Context::get('logged_info'); |
2469 | 2772 | $newEmail = Context::get('email_address'); |
2470 | 2773 | |
2471 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
2774 | + if(!$newEmail) { |
|
2775 | + return $this->stop('msg_invalid_request'); |
|
2776 | + } |
|
2472 | 2777 | |
2473 | 2778 | $oMemberModel = getModel('member'); |
2474 | 2779 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
2475 | - if($member_srl) return new Object(-1,'msg_exists_email_address'); |
|
2780 | + if($member_srl) { |
|
2781 | + return new Object(-1,'msg_exists_email_address'); |
|
2782 | + } |
|
2476 | 2783 | |
2477 | 2784 | if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
2478 | 2785 | { |
@@ -2500,7 +2807,9 @@ discard block |
||
2500 | 2807 | $member_config = $oModuleModel->getModuleConfig('member'); |
2501 | 2808 | |
2502 | 2809 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
2503 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
2810 | + if(!is_dir($tpl_path)) { |
|
2811 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
2812 | + } |
|
2504 | 2813 | |
2505 | 2814 | global $lang; |
2506 | 2815 | |
@@ -2536,7 +2845,9 @@ discard block |
||
2536 | 2845 | { |
2537 | 2846 | $member_srl = Context::get('member_srl'); |
2538 | 2847 | $auth_key = Context::get('auth_key'); |
2539 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
2848 | + if(!$member_srl || !$auth_key) { |
|
2849 | + return $this->stop('msg_invalid_request'); |
|
2850 | + } |
|
2540 | 2851 | |
2541 | 2852 | // Test logs for finding password by user_id and authkey |
2542 | 2853 | $args = new stdClass; |
@@ -2545,7 +2856,9 @@ discard block |
||
2545 | 2856 | $output = executeQuery('member.getAuthMail', $args); |
2546 | 2857 | if(!$output->toBool() || $output->data->auth_key != $auth_key) |
2547 | 2858 | { |
2548 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2859 | + if(strlen($output->data->auth_key) !== strlen($auth_key)) { |
|
2860 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
2861 | + } |
|
2549 | 2862 | return $this->stop('msg_invalid_modify_email_auth_key'); |
2550 | 2863 | } |
2551 | 2864 | |
@@ -2554,7 +2867,9 @@ discard block |
||
2554 | 2867 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
2555 | 2868 | |
2556 | 2869 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
2557 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
2870 | + if(!$output->toBool()) { |
|
2871 | + return $this->stop($output->getMessage()); |
|
2872 | + } |
|
2558 | 2873 | |
2559 | 2874 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
2560 | 2875 | executeQuery('member.deleteAuthChangeEmailAddress',$args); |
@@ -2575,7 +2890,9 @@ discard block |
||
2575 | 2890 | **/ |
2576 | 2891 | function triggerGetDocumentMenu(&$menu_list) |
2577 | 2892 | { |
2578 | - if(!Context::get('is_logged')) return new Object(); |
|
2893 | + if(!Context::get('is_logged')) { |
|
2894 | + return new Object(); |
|
2895 | + } |
|
2579 | 2896 | |
2580 | 2897 | $logged_info = Context::get('logged_info'); |
2581 | 2898 | $document_srl = Context::get('target_srl'); |
@@ -2586,8 +2903,12 @@ discard block |
||
2586 | 2903 | $member_srl = $oDocument->get('member_srl'); |
2587 | 2904 | $module_srl = $oDocument->get('module_srl'); |
2588 | 2905 | |
2589 | - if(!$member_srl) return new Object(); |
|
2590 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
2906 | + if(!$member_srl) { |
|
2907 | + return new Object(); |
|
2908 | + } |
|
2909 | + if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
2910 | + return new Object(); |
|
2911 | + } |
|
2591 | 2912 | |
2592 | 2913 | $oDocumentController = getController('document'); |
2593 | 2914 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2605,7 +2926,9 @@ discard block |
||
2605 | 2926 | **/ |
2606 | 2927 | function triggerGetCommentMenu(&$menu_list) |
2607 | 2928 | { |
2608 | - if(!Context::get('is_logged')) return new Object(); |
|
2929 | + if(!Context::get('is_logged')) { |
|
2930 | + return new Object(); |
|
2931 | + } |
|
2609 | 2932 | |
2610 | 2933 | $logged_info = Context::get('logged_info'); |
2611 | 2934 | $comment_srl = Context::get('target_srl'); |
@@ -2616,8 +2939,12 @@ discard block |
||
2616 | 2939 | $module_srl = $oComment->get('module_srl'); |
2617 | 2940 | $member_srl = $oComment->get('member_srl'); |
2618 | 2941 | |
2619 | - if(!$member_srl) return new Object(); |
|
2620 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
2942 | + if(!$member_srl) { |
|
2943 | + return new Object(); |
|
2944 | + } |
|
2945 | + if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
2946 | + return new Object(); |
|
2947 | + } |
|
2621 | 2948 | |
2622 | 2949 | $oCommentController = getController('comment'); |
2623 | 2950 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2633,7 +2960,9 @@ discard block |
||
2633 | 2960 | **/ |
2634 | 2961 | function procMemberSpammerManage() |
2635 | 2962 | { |
2636 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
2963 | + if(!Context::get('is_logged')) { |
|
2964 | + return new Object(-1,'msg_not_permitted'); |
|
2965 | + } |
|
2637 | 2966 | |
2638 | 2967 | $logged_info = Context::get('logged_info'); |
2639 | 2968 | $member_srl = Context::get('member_srl'); |
@@ -2641,8 +2970,9 @@ discard block |
||
2641 | 2970 | $cnt_loop = Context::get('cnt_loop'); |
2642 | 2971 | $proc_type = Context::get('proc_type'); |
2643 | 2972 | $isMoveToTrash = true; |
2644 | - if($proc_type == "delete") |
|
2645 | - $isMoveToTrash = false; |
|
2973 | + if($proc_type == "delete") { |
|
2974 | + $isMoveToTrash = false; |
|
2975 | + } |
|
2646 | 2976 | |
2647 | 2977 | // check grant |
2648 | 2978 | $oModuleModel = getModel('module'); |
@@ -2650,7 +2980,9 @@ discard block |
||
2650 | 2980 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
2651 | 2981 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
2652 | 2982 | |
2653 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
2983 | + if(!$grant->manager) { |
|
2984 | + return new Object(-1,'msg_not_permitted'); |
|
2985 | + } |
|
2654 | 2986 | |
2655 | 2987 | $proc_msg = ""; |
2656 | 2988 | |
@@ -2659,11 +2991,13 @@ discard block |
||
2659 | 2991 | |
2660 | 2992 | // delete or trash destination |
2661 | 2993 | // proc member |
2662 | - if($cnt_loop == 1) |
|
2663 | - $this->_spammerMember($member_srl); |
|
2994 | + if($cnt_loop == 1) { |
|
2995 | + $this->_spammerMember($member_srl); |
|
2996 | + } |
|
2664 | 2997 | // proc document and comment |
2665 | - elseif($cnt_loop>1) |
|
2666 | - $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
2998 | + elseif($cnt_loop>1) { |
|
2999 | + $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
3000 | + } |
|
2667 | 3001 | |
2668 | 3002 | // get destination count |
2669 | 3003 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
@@ -2671,13 +3005,16 @@ discard block |
||
2671 | 3005 | |
2672 | 3006 | $total_count = Context::get('total_count'); |
2673 | 3007 | $remain_count = $cnt_document + $cnt_comment; |
2674 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
3008 | + if($cnt_loop == 1) { |
|
3009 | + $total_count = $remain_count; |
|
3010 | + } |
|
2675 | 3011 | |
2676 | 3012 | // get progress percent |
2677 | - if($total_count > 0) |
|
2678 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
2679 | - else |
|
2680 | - $progress = 100; |
|
3013 | + if($total_count > 0) { |
|
3014 | + $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
3015 | + } else { |
|
3016 | + $progress = 100; |
|
3017 | + } |
|
2681 | 3018 | |
2682 | 3019 | $this->add('total_count', $total_count); |
2683 | 3020 | $this->add('remain_count', $remain_count); |
@@ -2719,7 +3056,10 @@ discard block |
||
2719 | 3056 | $args->nick_name = $member_info->nick_name; |
2720 | 3057 | $args->denied = "Y"; |
2721 | 3058 | $args->description = trim( $member_info->description ); |
2722 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
3059 | + if( $args->description != "" ) { |
|
3060 | + $args->description .= "\n"; |
|
3061 | + } |
|
3062 | + // add new line |
|
2723 | 3063 | |
2724 | 3064 | $args->description .= Context::getLang('cmd_spammer') . "[" . date("Y-m-d H:i:s") . " from:" . $logged_info->user_id . " info:" . $spam_description . " docuemnts count:" . $total_count . "]"; |
2725 | 3065 | |
@@ -2764,8 +3104,11 @@ discard block |
||
2764 | 3104 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
2765 | 3105 | if($documentList) { |
2766 | 3106 | foreach($documentList as $v) { |
2767 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
2768 | - else $oDocumentController->deleteDocument($v->document_srl); |
|
3107 | + if($isMoveToTrash) { |
|
3108 | + $oDocumentController->moveDocumentToTrash($v); |
|
3109 | + } else { |
|
3110 | + $oDocumentController->deleteDocument($v->document_srl); |
|
3111 | + } |
|
2769 | 3112 | } |
2770 | 3113 | } |
2771 | 3114 | } |