@@ -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,23 +918,23 @@ 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:''; |
|
| 937 | - $check_csrf = $action->attrs->check_csrf=='false'?'false':'true'; |
|
| 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 | + $check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true'; |
|
| 938 | 938 | |
| 939 | 939 | $index = $action->attrs->index; |
| 940 | 940 | $admin_index = $action->attrs->admin_index; |
@@ -949,14 +949,14 @@ discard block |
||
| 949 | 949 | $info->action->{$name}->ruleset = $ruleset; |
| 950 | 950 | $info->action->{$name}->method = $method; |
| 951 | 951 | $info->action->{$name}->check_csrf = $check_csrf; |
| 952 | - if($action->attrs->menu_name) |
|
| 952 | + if ($action->attrs->menu_name) |
|
| 953 | 953 | { |
| 954 | - if($menu_index == 'true') |
|
| 954 | + if ($menu_index == 'true') |
|
| 955 | 955 | { |
| 956 | 956 | $info->menu->{$action->attrs->menu_name}->index = $name; |
| 957 | 957 | $buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name); |
| 958 | 958 | } |
| 959 | - if(is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
| 959 | + if (is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
| 960 | 960 | { |
| 961 | 961 | $info->menu->{$action->attrs->menu_name}->acts[] = $name; |
| 962 | 962 | $currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts); |
@@ -974,22 +974,22 @@ discard block |
||
| 974 | 974 | $buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method); |
| 975 | 975 | $buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf); |
| 976 | 976 | |
| 977 | - if($index=='true') |
|
| 977 | + if ($index == 'true') |
|
| 978 | 978 | { |
| 979 | 979 | $default_index_act = $name; |
| 980 | 980 | $info->default_index_act = $name; |
| 981 | 981 | } |
| 982 | - if($admin_index=='true') |
|
| 982 | + if ($admin_index == 'true') |
|
| 983 | 983 | { |
| 984 | 984 | $admin_index_act = $name; |
| 985 | 985 | $info->admin_index_act = $name; |
| 986 | 986 | } |
| 987 | - if($setup_index=='true') |
|
| 987 | + if ($setup_index == 'true') |
|
| 988 | 988 | { |
| 989 | 989 | $setup_index_act = $name; |
| 990 | 990 | $info->setup_index_act = $name; |
| 991 | 991 | } |
| 992 | - if($simple_setup_index=='true') |
|
| 992 | + if ($simple_setup_index == 'true') |
|
| 993 | 993 | { |
| 994 | 994 | $simple_setup_index_act = $name; |
| 995 | 995 | $info->simple_setup_index_act = $name; |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | return $info; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | - if(file_exists($cache_file)) return include($cache_file); |
|
| 1013 | + if (file_exists($cache_file)) return include($cache_file); |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | /** |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | { |
| 1022 | 1022 | $module = Context::get('module_type'); |
| 1023 | 1023 | |
| 1024 | - if($module == 'ARTICLE') |
|
| 1024 | + if ($module == 'ARTICLE') |
|
| 1025 | 1025 | { |
| 1026 | 1026 | $module = 'page'; |
| 1027 | 1027 | } |
@@ -1041,26 +1041,26 @@ discard block |
||
| 1041 | 1041 | */ |
| 1042 | 1042 | function getSkins($path, $dir = 'skins') |
| 1043 | 1043 | { |
| 1044 | - if(substr($path, -1) == '/') |
|
| 1044 | + if (substr($path, -1) == '/') |
|
| 1045 | 1045 | { |
| 1046 | 1046 | $path = substr($path, 0, -1); |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | $skin_path = sprintf("%s/%s/", $path, $dir); |
| 1050 | 1050 | $list = FileHandler::readDir($skin_path); |
| 1051 | - if(!count($list)) return; |
|
| 1051 | + if (!count($list)) return; |
|
| 1052 | 1052 | |
| 1053 | 1053 | natcasesort($list); |
| 1054 | 1054 | |
| 1055 | - foreach($list as $skin_name) |
|
| 1055 | + foreach ($list as $skin_name) |
|
| 1056 | 1056 | { |
| 1057 | - if(!is_dir($skin_path . $skin_name)) |
|
| 1057 | + if (!is_dir($skin_path.$skin_name)) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | continue; |
| 1060 | 1060 | } |
| 1061 | 1061 | unset($skin_info); |
| 1062 | 1062 | $skin_info = $this->loadSkinInfo($path, $skin_name, $dir); |
| 1063 | - if(!$skin_info) |
|
| 1063 | + if (!$skin_info) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | $skin_info = new stdClass(); |
| 1066 | 1066 | $skin_info->title = $skin_name; |
@@ -1073,15 +1073,15 @@ discard block |
||
| 1073 | 1073 | $tmpPath = trim($tmpPath); |
| 1074 | 1074 | $module = array_pop(explode(' ', $tmpPath)); |
| 1075 | 1075 | |
| 1076 | - if($dir == 'skins') |
|
| 1076 | + if ($dir == 'skins') |
|
| 1077 | 1077 | { |
| 1078 | 1078 | $oAdminModel = getAdminModel('admin'); |
| 1079 | 1079 | $themesInfo = $oAdminModel->getThemeList(); |
| 1080 | 1080 | |
| 1081 | - foreach($themesInfo as $themeName => $info) |
|
| 1081 | + foreach ($themesInfo as $themeName => $info) |
|
| 1082 | 1082 | { |
| 1083 | 1083 | $skinInfos = $info->skin_infos; |
| 1084 | - if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
| 1084 | + if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
| 1085 | 1085 | { |
| 1086 | 1086 | $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; |
| 1087 | 1087 | $skin_list[$skinInfos[$module]->name] = $themeSkinInfo; |
@@ -1093,13 +1093,13 @@ discard block |
||
| 1093 | 1093 | $oMenuAdminModel = getAdminModel('menu'); |
| 1094 | 1094 | $installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl); |
| 1095 | 1095 | $moduleName = $module; |
| 1096 | - if($moduleName === 'page') |
|
| 1096 | + if ($moduleName === 'page') |
|
| 1097 | 1097 | { |
| 1098 | 1098 | $moduleName = 'ARTICLE'; |
| 1099 | 1099 | } |
| 1100 | - if(array_key_exists($moduleName, $installedMenuTypes)) |
|
| 1100 | + if (array_key_exists($moduleName, $installedMenuTypes)) |
|
| 1101 | 1101 | { |
| 1102 | - if($dir == 'skins') |
|
| 1102 | + if ($dir == 'skins') |
|
| 1103 | 1103 | { |
| 1104 | 1104 | $type = 'P'; |
| 1105 | 1105 | } |
@@ -1109,12 +1109,12 @@ discard block |
||
| 1109 | 1109 | } |
| 1110 | 1110 | $defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl); |
| 1111 | 1111 | |
| 1112 | - if(isset($defaultSkinName)) |
|
| 1112 | + if (isset($defaultSkinName)) |
|
| 1113 | 1113 | { |
| 1114 | 1114 | $defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir); |
| 1115 | 1115 | |
| 1116 | 1116 | $useDefault = new stdClass(); |
| 1117 | - $useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; |
|
| 1117 | + $useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')'; |
|
| 1118 | 1118 | |
| 1119 | 1119 | $useDefaultList['/USE_DEFAULT/'] = $useDefault; |
| 1120 | 1120 | |
@@ -1131,20 +1131,20 @@ discard block |
||
| 1131 | 1131 | function loadSkinInfo($path, $skin, $dir = 'skins') |
| 1132 | 1132 | { |
| 1133 | 1133 | // Read xml file having skin information |
| 1134 | - if(substr($path,-1)!='/') $path .= '/'; |
|
| 1134 | + if (substr($path, -1) != '/') $path .= '/'; |
|
| 1135 | 1135 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
| 1136 | - if(!file_exists($skin_xml_file)) return; |
|
| 1136 | + if (!file_exists($skin_xml_file)) return; |
|
| 1137 | 1137 | // Create XmlParser object |
| 1138 | 1138 | $oXmlParser = new XmlParser(); |
| 1139 | 1139 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
| 1140 | 1140 | // Return if no skin information is |
| 1141 | - if(!$_xml_obj->skin) return; |
|
| 1141 | + if (!$_xml_obj->skin) return; |
|
| 1142 | 1142 | $xml_obj = $_xml_obj->skin; |
| 1143 | 1143 | // Skin Name |
| 1144 | 1144 | $skin_info = new stdClass(); |
| 1145 | 1145 | $skin_info->title = $xml_obj->title->body; |
| 1146 | 1146 | // Author information |
| 1147 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 1147 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 1148 | 1148 | { |
| 1149 | 1149 | // skin format v0.2 |
| 1150 | 1150 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1155,10 +1155,10 @@ discard block |
||
| 1155 | 1155 | $skin_info->license_link = $xml_obj->license->attrs->link; |
| 1156 | 1156 | $skin_info->description = $xml_obj->description->body; |
| 1157 | 1157 | |
| 1158 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1158 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1159 | 1159 | else $author_list = $xml_obj->author; |
| 1160 | 1160 | |
| 1161 | - foreach($author_list as $author) |
|
| 1161 | + foreach ($author_list as $author) |
|
| 1162 | 1162 | { |
| 1163 | 1163 | $author_obj = new stdClass(); |
| 1164 | 1164 | $author_obj->name = $author->name->body; |
@@ -1167,25 +1167,25 @@ discard block |
||
| 1167 | 1167 | $skin_info->author[] = $author_obj; |
| 1168 | 1168 | } |
| 1169 | 1169 | // List extra vars |
| 1170 | - if($xml_obj->extra_vars) |
|
| 1170 | + if ($xml_obj->extra_vars) |
|
| 1171 | 1171 | { |
| 1172 | 1172 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1173 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1173 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1175 | 1175 | |
| 1176 | - foreach($extra_var_groups as $group) |
|
| 1176 | + foreach ($extra_var_groups as $group) |
|
| 1177 | 1177 | { |
| 1178 | 1178 | $extra_vars = $group->var; |
| 1179 | - if(!$extra_vars) |
|
| 1179 | + if (!$extra_vars) |
|
| 1180 | 1180 | { |
| 1181 | 1181 | continue; |
| 1182 | 1182 | } |
| 1183 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1183 | + if (!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1184 | 1184 | |
| 1185 | - foreach($extra_vars as $key => $val) |
|
| 1185 | + foreach ($extra_vars as $key => $val) |
|
| 1186 | 1186 | { |
| 1187 | 1187 | $obj = new stdClass(); |
| 1188 | - if(!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
| 1188 | + if (!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
| 1189 | 1189 | |
| 1190 | 1190 | $obj->group = $group->title->body; |
| 1191 | 1191 | $obj->name = $val->attrs->name; |
@@ -1194,14 +1194,14 @@ discard block |
||
| 1194 | 1194 | $obj->description = $val->description->body; |
| 1195 | 1195 | $obj->value = $extra_vals->{$obj->name}; |
| 1196 | 1196 | $obj->default = $val->attrs->default; |
| 1197 | - if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
| 1198 | - if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
| 1197 | + if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
| 1198 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
| 1199 | 1199 | // Get an option list from 'select'type |
| 1200 | - if(is_array($val->options)) |
|
| 1200 | + if (is_array($val->options)) |
|
| 1201 | 1201 | { |
| 1202 | 1202 | $option_count = count($val->options); |
| 1203 | 1203 | |
| 1204 | - for($i = 0; $i < $option_count; $i++) |
|
| 1204 | + for ($i = 0; $i < $option_count; $i++) |
|
| 1205 | 1205 | { |
| 1206 | 1206 | $obj->options[$i] = new stdClass(); |
| 1207 | 1207 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -1238,18 +1238,18 @@ discard block |
||
| 1238 | 1238 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
| 1239 | 1239 | // Variables used in the skin |
| 1240 | 1240 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1241 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1241 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1243 | 1243 | |
| 1244 | - foreach($extra_var_groups as $group) |
|
| 1244 | + foreach ($extra_var_groups as $group) |
|
| 1245 | 1245 | { |
| 1246 | 1246 | $extra_vars = $group->var; |
| 1247 | 1247 | |
| 1248 | - if($extra_vars) |
|
| 1248 | + if ($extra_vars) |
|
| 1249 | 1249 | { |
| 1250 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1250 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1251 | 1251 | |
| 1252 | - foreach($extra_vars as $var) |
|
| 1252 | + foreach ($extra_vars as $var) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | unset($obj); |
| 1255 | 1255 | unset($options); |
@@ -1260,11 +1260,11 @@ discard block |
||
| 1260 | 1260 | $title = $var->title->body; |
| 1261 | 1261 | $description = $var->description->body; |
| 1262 | 1262 | // Get an option list from 'select'type. |
| 1263 | - if(is_array($var->default)) |
|
| 1263 | + if (is_array($var->default)) |
|
| 1264 | 1264 | { |
| 1265 | 1265 | $option_count = count($var->default); |
| 1266 | 1266 | |
| 1267 | - for($i = 0; $i < $option_count; $i++) |
|
| 1267 | + for ($i = 0; $i < $option_count; $i++) |
|
| 1268 | 1268 | { |
| 1269 | 1269 | $options[$i]->title = $var->default[$i]->body; |
| 1270 | 1270 | $options[$i]->value = $var->default[$i]->body; |
@@ -1298,19 +1298,19 @@ discard block |
||
| 1298 | 1298 | |
| 1299 | 1299 | // colorset |
| 1300 | 1300 | $colorset = $xml_obj->colorset->color; |
| 1301 | - if($colorset) |
|
| 1301 | + if ($colorset) |
|
| 1302 | 1302 | { |
| 1303 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
| 1303 | + if (!is_array($colorset)) $colorset = array($colorset); |
|
| 1304 | 1304 | |
| 1305 | - foreach($colorset as $color) |
|
| 1305 | + foreach ($colorset as $color) |
|
| 1306 | 1306 | { |
| 1307 | 1307 | $name = $color->attrs->name; |
| 1308 | 1308 | $title = $color->title->body; |
| 1309 | 1309 | $screenshot = $color->attrs->src; |
| 1310 | - if($screenshot) |
|
| 1310 | + if ($screenshot) |
|
| 1311 | 1311 | { |
| 1312 | 1312 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
| 1313 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
| 1313 | + if (!file_exists($screenshot)) $screenshot = ""; |
|
| 1314 | 1314 | } |
| 1315 | 1315 | else $screenshot = ""; |
| 1316 | 1316 | |
@@ -1322,19 +1322,19 @@ discard block |
||
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| 1324 | 1324 | // Menu type (settings for layout) |
| 1325 | - if($xml_obj->menus->menu) |
|
| 1325 | + if ($xml_obj->menus->menu) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | $menus = $xml_obj->menus->menu; |
| 1328 | - if(!is_array($menus)) $menus = array($menus); |
|
| 1328 | + if (!is_array($menus)) $menus = array($menus); |
|
| 1329 | 1329 | |
| 1330 | 1330 | $menu_count = count($menus); |
| 1331 | 1331 | $skin_info->menu_count = $menu_count; |
| 1332 | - for($i=0;$i<$menu_count;$i++) |
|
| 1332 | + for ($i = 0; $i < $menu_count; $i++) |
|
| 1333 | 1333 | { |
| 1334 | 1334 | unset($obj); |
| 1335 | 1335 | |
| 1336 | 1336 | $obj->name = $menus[$i]->attrs->name; |
| 1337 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1337 | + if ($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1338 | 1338 | $obj->title = $menus[$i]->title->body; |
| 1339 | 1339 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
| 1340 | 1340 | |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | $thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin); |
| 1346 | - $skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null; |
|
| 1346 | + $skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null; |
|
| 1347 | 1347 | return $skin_info; |
| 1348 | 1348 | } |
| 1349 | 1349 | |
@@ -1354,7 +1354,7 @@ discard block |
||
| 1354 | 1354 | { |
| 1355 | 1355 | $args = new stdClass; |
| 1356 | 1356 | $args->site_srl = $site_srl; |
| 1357 | - if(!is_null($module)) $args->module = $module; |
|
| 1357 | + if (!is_null($module)) $args->module = $module; |
|
| 1358 | 1358 | $output = executeQuery('module.getModuleCount', $args); |
| 1359 | 1359 | return $output->data->count; |
| 1360 | 1360 | } |
@@ -1368,26 +1368,26 @@ discard block |
||
| 1368 | 1368 | $config = false; |
| 1369 | 1369 | // cache controll |
| 1370 | 1370 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1371 | - if($oCacheHandler->isSupport()) |
|
| 1371 | + if ($oCacheHandler->isSupport()) |
|
| 1372 | 1372 | { |
| 1373 | - $object_key = 'module_config:' . $module . '_' . $site_srl; |
|
| 1373 | + $object_key = 'module_config:'.$module.'_'.$site_srl; |
|
| 1374 | 1374 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1375 | 1375 | $config = $oCacheHandler->get($cache_key); |
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | - if($config === false) |
|
| 1378 | + if ($config === false) |
|
| 1379 | 1379 | { |
| 1380 | - if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
| 1380 | + if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
| 1381 | 1381 | { |
| 1382 | 1382 | $args = new stdClass(); |
| 1383 | 1383 | $args->module = $module; |
| 1384 | 1384 | $args->site_srl = $site_srl; |
| 1385 | 1385 | $output = executeQuery('module.getModuleConfig', $args); |
| 1386 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1386 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
| 1387 | 1387 | else $config = null; |
| 1388 | 1388 | |
| 1389 | 1389 | //insert in cache |
| 1390 | - if($oCacheHandler->isSupport()) |
|
| 1390 | + if ($oCacheHandler->isSupport()) |
|
| 1391 | 1391 | { |
| 1392 | 1392 | $oCacheHandler->put($cache_key, $config); |
| 1393 | 1393 | } |
@@ -1408,26 +1408,26 @@ discard block |
||
| 1408 | 1408 | $config = false; |
| 1409 | 1409 | // cache controll |
| 1410 | 1410 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1411 | - if($oCacheHandler->isSupport()) |
|
| 1411 | + if ($oCacheHandler->isSupport()) |
|
| 1412 | 1412 | { |
| 1413 | 1413 | $object_key = 'module_part_config:'.$module.'_'.$module_srl; |
| 1414 | 1414 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1415 | 1415 | $config = $oCacheHandler->get($cache_key); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | - if($config === false) |
|
| 1418 | + if ($config === false) |
|
| 1419 | 1419 | { |
| 1420 | - if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
| 1420 | + if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | $args = new stdClass(); |
| 1423 | 1423 | $args->module = $module; |
| 1424 | 1424 | $args->module_srl = $module_srl; |
| 1425 | 1425 | $output = executeQuery('module.getModulePartConfig', $args); |
| 1426 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1426 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
| 1427 | 1427 | else $config = null; |
| 1428 | 1428 | |
| 1429 | 1429 | //insert in cache |
| 1430 | - if($oCacheHandler->isSupport()) |
|
| 1430 | + if ($oCacheHandler->isSupport()) |
|
| 1431 | 1431 | { |
| 1432 | 1432 | $oCacheHandler->put($cache_key, $config); |
| 1433 | 1433 | } |
@@ -1446,11 +1446,11 @@ discard block |
||
| 1446 | 1446 | { |
| 1447 | 1447 | $args = new stdClass(); |
| 1448 | 1448 | $args->module = $module; |
| 1449 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1449 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1450 | 1450 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
| 1451 | - if(!$output->toBool() || !$output->data) return array(); |
|
| 1451 | + if (!$output->toBool() || !$output->data) return array(); |
|
| 1452 | 1452 | |
| 1453 | - foreach($output->data as $key => $val) |
|
| 1453 | + foreach ($output->data as $key => $val) |
|
| 1454 | 1454 | { |
| 1455 | 1455 | $result[$val->module_srl] = unserialize($val->config); |
| 1456 | 1456 | } |
@@ -1466,12 +1466,12 @@ discard block |
||
| 1466 | 1466 | $args->moduleCategorySrl = $moduleCategorySrl; |
| 1467 | 1467 | // Get data from the DB |
| 1468 | 1468 | $output = executeQuery('module.getModuleCategories', $args); |
| 1469 | - if(!$output->toBool()) return $output; |
|
| 1469 | + if (!$output->toBool()) return $output; |
|
| 1470 | 1470 | $list = $output->data; |
| 1471 | - if(!$list) return; |
|
| 1472 | - if(!is_array($list)) $list = array($list); |
|
| 1471 | + if (!$list) return; |
|
| 1472 | + if (!is_array($list)) $list = array($list); |
|
| 1473 | 1473 | |
| 1474 | - foreach($list as $val) |
|
| 1474 | + foreach ($list as $val) |
|
| 1475 | 1475 | { |
| 1476 | 1476 | $category_list[$val->module_category_srl] = $val; |
| 1477 | 1477 | } |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | $args = new stdClass; |
| 1488 | 1488 | $args->module_category_srl = $module_category_srl; |
| 1489 | 1489 | $output = executeQuery('module.getModuleCategory', $args); |
| 1490 | - if(!$output->toBool()) return $output; |
|
| 1490 | + if (!$output->toBool()) return $output; |
|
| 1491 | 1491 | return $output->data; |
| 1492 | 1492 | } |
| 1493 | 1493 | |
@@ -1499,10 +1499,10 @@ discard block |
||
| 1499 | 1499 | // Get a list of downloaded and installed modules |
| 1500 | 1500 | $searched_list = FileHandler::readDir('./modules'); |
| 1501 | 1501 | $searched_count = count($searched_list); |
| 1502 | - if(!$searched_count) return; |
|
| 1502 | + if (!$searched_count) return; |
|
| 1503 | 1503 | sort($searched_list); |
| 1504 | 1504 | |
| 1505 | - for($i=0;$i<$searched_count;$i++) |
|
| 1505 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 1506 | 1506 | { |
| 1507 | 1507 | // Module name |
| 1508 | 1508 | $module_name = $searched_list[$i]; |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | $info = $this->getModuleInfoXml($module_name); |
| 1513 | 1513 | unset($obj); |
| 1514 | 1514 | |
| 1515 | - if(!isset($info)) continue; |
|
| 1515 | + if (!isset($info)) continue; |
|
| 1516 | 1516 | $info->module = $module_name; |
| 1517 | 1517 | $info->created_table_count = $created_table_count; |
| 1518 | 1518 | $info->table_count = $table_count; |
@@ -1529,19 +1529,19 @@ discard block |
||
| 1529 | 1529 | $info = null; |
| 1530 | 1530 | |
| 1531 | 1531 | $moduledir = ModuleHandler::getModulePath($module_name); |
| 1532 | - if(file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
| 1532 | + if (file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
| 1533 | 1533 | { |
| 1534 | 1534 | $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); |
| 1535 | 1535 | $table_count = count($tmp_files); |
| 1536 | 1536 | // Check if the table is created |
| 1537 | 1537 | $created_table_count = 0; |
| 1538 | - for($j=0;$j<count($tmp_files);$j++) |
|
| 1538 | + for ($j = 0; $j < count($tmp_files); $j++) |
|
| 1539 | 1539 | { |
| 1540 | - list($table_name) = explode(".",$tmp_files[$j]); |
|
| 1541 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1540 | + list($table_name) = explode(".", $tmp_files[$j]); |
|
| 1541 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
| 1542 | 1542 | } |
| 1543 | 1543 | // Check if DB is installed |
| 1544 | - if($table_count > $created_table_count) return true; |
|
| 1544 | + if ($table_count > $created_table_count) return true; |
|
| 1545 | 1545 | else return false; |
| 1546 | 1546 | } |
| 1547 | 1547 | return false; |
@@ -1551,7 +1551,7 @@ discard block |
||
| 1551 | 1551 | { |
| 1552 | 1552 | // Check if it is upgraded to module.class.php on each module |
| 1553 | 1553 | $oDummy = getModule($module_name, 'class'); |
| 1554 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1554 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1555 | 1555 | { |
| 1556 | 1556 | return $oDummy->checkUpdate(); |
| 1557 | 1557 | } |
@@ -1570,31 +1570,31 @@ discard block |
||
| 1570 | 1570 | sort($searched_list); |
| 1571 | 1571 | |
| 1572 | 1572 | $searched_count = count($searched_list); |
| 1573 | - if(!$searched_count) return; |
|
| 1573 | + if (!$searched_count) return; |
|
| 1574 | 1574 | |
| 1575 | - for($i=0;$i<$searched_count;$i++) |
|
| 1575 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 1576 | 1576 | { |
| 1577 | 1577 | // module name |
| 1578 | 1578 | $module_name = $searched_list[$i]; |
| 1579 | 1579 | |
| 1580 | 1580 | $path = ModuleHandler::getModulePath($module_name); |
| 1581 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1581 | + if (!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1582 | 1582 | |
| 1583 | 1583 | // Get the number of xml files to create a table in schemas |
| 1584 | 1584 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
| 1585 | 1585 | $table_count = count($tmp_files); |
| 1586 | 1586 | // Check if the table is created |
| 1587 | 1587 | $created_table_count = 0; |
| 1588 | - for($j=0;$j<$table_count;$j++) |
|
| 1588 | + for ($j = 0; $j < $table_count; $j++) |
|
| 1589 | 1589 | { |
| 1590 | - list($table_name) = explode('.',$tmp_files[$j]); |
|
| 1591 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1590 | + list($table_name) = explode('.', $tmp_files[$j]); |
|
| 1591 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
| 1592 | 1592 | } |
| 1593 | 1593 | // Get information of the module |
| 1594 | 1594 | $info = NULL; |
| 1595 | 1595 | $info = $this->getModuleInfoXml($module_name); |
| 1596 | 1596 | |
| 1597 | - if(!$info) continue; |
|
| 1597 | + if (!$info) continue; |
|
| 1598 | 1598 | |
| 1599 | 1599 | $info->module = $module_name; |
| 1600 | 1600 | $info->category = $info->category; |
@@ -1603,12 +1603,12 @@ discard block |
||
| 1603 | 1603 | $info->path = $path; |
| 1604 | 1604 | $info->admin_index_act = $info->admin_index_act; |
| 1605 | 1605 | // Check if DB is installed |
| 1606 | - if($table_count > $created_table_count) $info->need_install = true; |
|
| 1606 | + if ($table_count > $created_table_count) $info->need_install = true; |
|
| 1607 | 1607 | else $info->need_install = false; |
| 1608 | 1608 | // Check if it is upgraded to module.class.php on each module |
| 1609 | 1609 | $oDummy = null; |
| 1610 | 1610 | $oDummy = getModule($module_name, 'class'); |
| 1611 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1611 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1612 | 1612 | { |
| 1613 | 1613 | $info->need_update = $oDummy->checkUpdate(); |
| 1614 | 1614 | } |
@@ -1629,15 +1629,15 @@ discard block |
||
| 1629 | 1629 | */ |
| 1630 | 1630 | function syncModuleToSite(&$data) |
| 1631 | 1631 | { |
| 1632 | - if(!$data) return; |
|
| 1632 | + if (!$data) return; |
|
| 1633 | 1633 | |
| 1634 | - if(is_array($data)) |
|
| 1634 | + if (is_array($data)) |
|
| 1635 | 1635 | { |
| 1636 | - foreach($data as $key => $val) |
|
| 1636 | + foreach ($data as $key => $val) |
|
| 1637 | 1637 | { |
| 1638 | 1638 | $module_srls[] = $val->module_srl; |
| 1639 | 1639 | } |
| 1640 | - if(!count($module_srls)) return; |
|
| 1640 | + if (!count($module_srls)) return; |
|
| 1641 | 1641 | } |
| 1642 | 1642 | else |
| 1643 | 1643 | { |
@@ -1645,17 +1645,17 @@ discard block |
||
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | 1647 | $args = new stdClass(); |
| 1648 | - $args->module_srls = implode(',',$module_srls); |
|
| 1648 | + $args->module_srls = implode(',', $module_srls); |
|
| 1649 | 1649 | $output = executeQueryArray('module.getModuleSites', $args); |
| 1650 | - if(!$output->data) return array(); |
|
| 1651 | - foreach($output->data as $key => $val) |
|
| 1650 | + if (!$output->data) return array(); |
|
| 1651 | + foreach ($output->data as $key => $val) |
|
| 1652 | 1652 | { |
| 1653 | 1653 | $modules[$val->module_srl] = $val; |
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | - if(is_array($data)) |
|
| 1656 | + if (is_array($data)) |
|
| 1657 | 1657 | { |
| 1658 | - foreach($data as $key => $val) |
|
| 1658 | + foreach ($data as $key => $val) |
|
| 1659 | 1659 | { |
| 1660 | 1660 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
| 1661 | 1661 | } |
@@ -1671,14 +1671,14 @@ discard block |
||
| 1671 | 1671 | */ |
| 1672 | 1672 | function isSiteAdmin($member_info, $site_srl = null) |
| 1673 | 1673 | { |
| 1674 | - if(!$member_info->member_srl) return false; |
|
| 1675 | - if($member_info->is_admin == 'Y') return true; |
|
| 1674 | + if (!$member_info->member_srl) return false; |
|
| 1675 | + if ($member_info->is_admin == 'Y') return true; |
|
| 1676 | 1676 | |
| 1677 | 1677 | $args = new stdClass(); |
| 1678 | - if(!isset($site_srl)) |
|
| 1678 | + if (!isset($site_srl)) |
|
| 1679 | 1679 | { |
| 1680 | 1680 | $site_module_info = Context::get('site_module_info'); |
| 1681 | - if(!$site_module_info) return; |
|
| 1681 | + if (!$site_module_info) return; |
|
| 1682 | 1682 | $args->site_srl = $site_module_info->site_srl; |
| 1683 | 1683 | } |
| 1684 | 1684 | else |
@@ -1688,7 +1688,7 @@ discard block |
||
| 1688 | 1688 | |
| 1689 | 1689 | $args->member_srl = $member_info->member_srl; |
| 1690 | 1690 | $output = executeQuery('module.isSiteAdmin', $args); |
| 1691 | - if($output->data->member_srl == $args->member_srl) return true; |
|
| 1691 | + if ($output->data->member_srl == $args->member_srl) return true; |
|
| 1692 | 1692 | return false; |
| 1693 | 1693 | } |
| 1694 | 1694 | |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | $obj = new stdClass(); |
| 1712 | 1712 | $obj->module_srl = $module_srl; |
| 1713 | 1713 | $output = executeQueryArray('module.getAdminID', $obj); |
| 1714 | - if(!$output->toBool() || !$output->data) return; |
|
| 1714 | + if (!$output->toBool() || !$output->data) return; |
|
| 1715 | 1715 | |
| 1716 | 1716 | return $output->data; |
| 1717 | 1717 | } |
@@ -1724,20 +1724,20 @@ discard block |
||
| 1724 | 1724 | { |
| 1725 | 1725 | $extra_vars = array(); |
| 1726 | 1726 | $get_module_srls = array(); |
| 1727 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1727 | + if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1728 | 1728 | |
| 1729 | 1729 | $vars = false; |
| 1730 | 1730 | // cache controll |
| 1731 | 1731 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1732 | - if($oCacheHandler->isSupport()) |
|
| 1732 | + if ($oCacheHandler->isSupport()) |
|
| 1733 | 1733 | { |
| 1734 | - foreach($list_module_srl as $module_srl) |
|
| 1734 | + foreach ($list_module_srl as $module_srl) |
|
| 1735 | 1735 | { |
| 1736 | 1736 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1737 | 1737 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1738 | 1738 | $vars = $oCacheHandler->get($cache_key); |
| 1739 | 1739 | |
| 1740 | - if($vars) |
|
| 1740 | + if ($vars) |
|
| 1741 | 1741 | { |
| 1742 | 1742 | $extra_vars[$module_srl] = $vars; |
| 1743 | 1743 | } |
@@ -1752,35 +1752,35 @@ discard block |
||
| 1752 | 1752 | $get_module_srls = $list_module_srl; |
| 1753 | 1753 | } |
| 1754 | 1754 | |
| 1755 | - if(count($get_module_srls) > 0) |
|
| 1755 | + if (count($get_module_srls) > 0) |
|
| 1756 | 1756 | { |
| 1757 | 1757 | $args = new stdClass(); |
| 1758 | 1758 | $args->module_srl = implode(',', $get_module_srls); |
| 1759 | 1759 | $output = executeQueryArray('module.getModuleExtraVars', $args); |
| 1760 | 1760 | |
| 1761 | - if(!$output->toBool()) |
|
| 1761 | + if (!$output->toBool()) |
|
| 1762 | 1762 | { |
| 1763 | 1763 | return; |
| 1764 | 1764 | } |
| 1765 | 1765 | |
| 1766 | - if(!$output->data) |
|
| 1766 | + if (!$output->data) |
|
| 1767 | 1767 | { |
| 1768 | - foreach($get_module_srls as $module_srl) |
|
| 1768 | + foreach ($get_module_srls as $module_srl) |
|
| 1769 | 1769 | { |
| 1770 | 1770 | $extra_vars[$module_srl] = new stdClass; |
| 1771 | 1771 | } |
| 1772 | 1772 | } |
| 1773 | - foreach($output->data as $key => $val) |
|
| 1773 | + foreach ($output->data as $key => $val) |
|
| 1774 | 1774 | { |
| 1775 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
| 1775 | + if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue; |
|
| 1776 | 1776 | |
| 1777 | - if(!isset($extra_vars[$val->module_srl])) |
|
| 1777 | + if (!isset($extra_vars[$val->module_srl])) |
|
| 1778 | 1778 | { |
| 1779 | 1779 | $extra_vars[$val->module_srl] = new stdClass(); |
| 1780 | 1780 | } |
| 1781 | 1781 | $extra_vars[$val->module_srl]->{$val->name} = $val->value; |
| 1782 | 1782 | |
| 1783 | - if($oCacheHandler->isSupport()) |
|
| 1783 | + if ($oCacheHandler->isSupport()) |
|
| 1784 | 1784 | { |
| 1785 | 1785 | $object_key = 'module_extra_vars:'.$val->module_srl; |
| 1786 | 1786 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1799,27 +1799,27 @@ discard block |
||
| 1799 | 1799 | { |
| 1800 | 1800 | $skin_vars = false; |
| 1801 | 1801 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1802 | - if($oCacheHandler->isSupport()) |
|
| 1802 | + if ($oCacheHandler->isSupport()) |
|
| 1803 | 1803 | { |
| 1804 | 1804 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1805 | 1805 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1806 | 1806 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1807 | 1807 | } |
| 1808 | 1808 | |
| 1809 | - if($skin_vars === false) |
|
| 1809 | + if ($skin_vars === false) |
|
| 1810 | 1810 | { |
| 1811 | 1811 | $args = new stdClass(); |
| 1812 | 1812 | $args->module_srl = $module_srl; |
| 1813 | - $output = executeQueryArray('module.getModuleSkinVars',$args); |
|
| 1814 | - if(!$output->toBool()) return; |
|
| 1813 | + $output = executeQueryArray('module.getModuleSkinVars', $args); |
|
| 1814 | + if (!$output->toBool()) return; |
|
| 1815 | 1815 | |
| 1816 | 1816 | $skin_vars = array(); |
| 1817 | - foreach($output->data as $vars) |
|
| 1817 | + foreach ($output->data as $vars) |
|
| 1818 | 1818 | { |
| 1819 | 1819 | $skin_vars[$vars->name] = $vars; |
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1822 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1823 | 1823 | } |
| 1824 | 1824 | |
| 1825 | 1825 | return $skin_vars; |
@@ -1831,32 +1831,32 @@ discard block |
||
| 1831 | 1831 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
| 1832 | 1832 | { |
| 1833 | 1833 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
| 1834 | - if(!$site_srl) $site_srl = 0; |
|
| 1834 | + if (!$site_srl) $site_srl = 0; |
|
| 1835 | 1835 | |
| 1836 | 1836 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
| 1837 | - if(is_readable($designInfoFile)) |
|
| 1837 | + if (is_readable($designInfoFile)) |
|
| 1838 | 1838 | { |
| 1839 | 1839 | include($designInfoFile); |
| 1840 | 1840 | |
| 1841 | 1841 | $skinName = $designInfo->module->{$module_name}->{$target}; |
| 1842 | 1842 | } |
| 1843 | - if(!$skinName) |
|
| 1843 | + if (!$skinName) |
|
| 1844 | 1844 | { |
| 1845 | 1845 | $dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/'; |
| 1846 | 1846 | $moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir; |
| 1847 | 1847 | |
| 1848 | - if(is_dir($moduleSkinPath.'default')) |
|
| 1848 | + if (is_dir($moduleSkinPath.'default')) |
|
| 1849 | 1849 | { |
| 1850 | 1850 | $skinName = 'default'; |
| 1851 | 1851 | } |
| 1852 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 1852 | + else if (is_dir($moduleSkinPath.'xe_default')) |
|
| 1853 | 1853 | { |
| 1854 | 1854 | $skinName = 'xe_default'; |
| 1855 | 1855 | } |
| 1856 | 1856 | else |
| 1857 | 1857 | { |
| 1858 | 1858 | $skins = FileHandler::readDir($moduleSkinPath); |
| 1859 | - if(count($skins) > 0) |
|
| 1859 | + if (count($skins) > 0) |
|
| 1860 | 1860 | { |
| 1861 | 1861 | $skinName = $skins[0]; |
| 1862 | 1862 | } |
@@ -1866,9 +1866,9 @@ discard block |
||
| 1866 | 1866 | } |
| 1867 | 1867 | } |
| 1868 | 1868 | |
| 1869 | - if($updateCache && $skinName) |
|
| 1869 | + if ($updateCache && $skinName) |
|
| 1870 | 1870 | { |
| 1871 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 1871 | + if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 1872 | 1872 | $designInfo->module->{$module_name}->{$target} = $skinName; |
| 1873 | 1873 | |
| 1874 | 1874 | $oAdminController = getAdminController('admin'); |
@@ -1884,10 +1884,10 @@ discard block |
||
| 1884 | 1884 | */ |
| 1885 | 1885 | function syncSkinInfoToModuleInfo(&$module_info) |
| 1886 | 1886 | { |
| 1887 | - if(!$module_info->module_srl) return; |
|
| 1887 | + if (!$module_info->module_srl) return; |
|
| 1888 | 1888 | |
| 1889 | 1889 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1890 | - if(Mobile::isFromMobilePhone()) |
|
| 1890 | + if (Mobile::isFromMobilePhone()) |
|
| 1891 | 1891 | { |
| 1892 | 1892 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
| 1893 | 1893 | } |
@@ -1896,11 +1896,11 @@ discard block |
||
| 1896 | 1896 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
| 1897 | 1897 | } |
| 1898 | 1898 | |
| 1899 | - if(!$skin_vars) return; |
|
| 1899 | + if (!$skin_vars) return; |
|
| 1900 | 1900 | |
| 1901 | - foreach($skin_vars as $name => $val) |
|
| 1901 | + foreach ($skin_vars as $name => $val) |
|
| 1902 | 1902 | { |
| 1903 | - if(isset($module_info->{$name})) continue; |
|
| 1903 | + if (isset($module_info->{$name})) continue; |
|
| 1904 | 1904 | $module_info->{$name} = $val->value; |
| 1905 | 1905 | } |
| 1906 | 1906 | } |
@@ -1914,27 +1914,27 @@ discard block |
||
| 1914 | 1914 | { |
| 1915 | 1915 | $skin_vars = false; |
| 1916 | 1916 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1917 | - if($oCacheHandler->isSupport()) |
|
| 1917 | + if ($oCacheHandler->isSupport()) |
|
| 1918 | 1918 | { |
| 1919 | 1919 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
| 1920 | 1920 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1921 | 1921 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | - if($skin_vars === false) |
|
| 1924 | + if ($skin_vars === false) |
|
| 1925 | 1925 | { |
| 1926 | 1926 | $args = new stdClass(); |
| 1927 | 1927 | $args->module_srl = $module_srl; |
| 1928 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
| 1929 | - if(!$output->toBool() || !$output->data) return; |
|
| 1928 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
| 1929 | + if (!$output->toBool() || !$output->data) return; |
|
| 1930 | 1930 | |
| 1931 | 1931 | $skin_vars = array(); |
| 1932 | - foreach($output->data as $vars) |
|
| 1932 | + foreach ($output->data as $vars) |
|
| 1933 | 1933 | { |
| 1934 | 1934 | $skin_vars[$vars->name] = $vars; |
| 1935 | 1935 | } |
| 1936 | 1936 | |
| 1937 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1937 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | 1940 | return $skin_vars; |
@@ -1946,32 +1946,32 @@ discard block |
||
| 1946 | 1946 | */ |
| 1947 | 1947 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
| 1948 | 1948 | { |
| 1949 | - if(!$module_info->module_srl) return; |
|
| 1949 | + if (!$module_info->module_srl) return; |
|
| 1950 | 1950 | $skin_vars = false; |
| 1951 | 1951 | // cache controll |
| 1952 | 1952 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1953 | - if($oCacheHandler->isSupport()) |
|
| 1953 | + if ($oCacheHandler->isSupport()) |
|
| 1954 | 1954 | { |
| 1955 | 1955 | $object_key = 'module_mobile_skin_vars:'.$module_info->module_srl; |
| 1956 | 1956 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1957 | 1957 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1958 | 1958 | } |
| 1959 | - if($skin_vars === false) |
|
| 1959 | + if ($skin_vars === false) |
|
| 1960 | 1960 | { |
| 1961 | 1961 | $args = new stdClass; |
| 1962 | 1962 | $args->module_srl = $module_info->module_srl; |
| 1963 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
| 1964 | - if(!$output->toBool()) return; |
|
| 1963 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
| 1964 | + if (!$output->toBool()) return; |
|
| 1965 | 1965 | $skin_vars = $output->data; |
| 1966 | 1966 | |
| 1967 | 1967 | //insert in cache |
| 1968 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1968 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1969 | 1969 | } |
| 1970 | - if(!$skin_vars) return; |
|
| 1970 | + if (!$skin_vars) return; |
|
| 1971 | 1971 | |
| 1972 | - foreach($output->data as $val) |
|
| 1972 | + foreach ($output->data as $val) |
|
| 1973 | 1973 | { |
| 1974 | - if(isset($module_info->{$val->name})) continue; |
|
| 1974 | + if (isset($module_info->{$val->name})) continue; |
|
| 1975 | 1975 | $module_info->{$val->name} = $val->value; |
| 1976 | 1976 | } |
| 1977 | 1977 | } |
@@ -1983,7 +1983,7 @@ discard block |
||
| 1983 | 1983 | { |
| 1984 | 1984 | $grant = new stdClass(); |
| 1985 | 1985 | |
| 1986 | - if(!$xml_info) |
|
| 1986 | + if (!$xml_info) |
|
| 1987 | 1987 | { |
| 1988 | 1988 | $module = $module_info->module; |
| 1989 | 1989 | $xml_info = $this->getModuleActionXml($module); |
@@ -1991,9 +1991,9 @@ discard block |
||
| 1991 | 1991 | // Set variables to grant group permission |
| 1992 | 1992 | $module_srl = $module_info->module_srl; |
| 1993 | 1993 | $grant_info = $xml_info->grant; |
| 1994 | - if($member_info->member_srl) |
|
| 1994 | + if ($member_info->member_srl) |
|
| 1995 | 1995 | { |
| 1996 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 1996 | + if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 1997 | 1997 | else $group_list = array(); |
| 1998 | 1998 | } |
| 1999 | 1999 | else |
@@ -2001,10 +2001,10 @@ discard block |
||
| 2001 | 2001 | $group_list = array(); |
| 2002 | 2002 | } |
| 2003 | 2003 | // If module_srl doesn't exist(if unable to set permissions) |
| 2004 | - if(!$module_srl) |
|
| 2004 | + if (!$module_srl) |
|
| 2005 | 2005 | { |
| 2006 | 2006 | $grant->access = true; |
| 2007 | - if($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
| 2007 | + if ($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
| 2008 | 2008 | { |
| 2009 | 2009 | $grant->access = $grant->manager = $grant->is_site_admin = true; |
| 2010 | 2010 | } |
@@ -2015,23 +2015,23 @@ discard block |
||
| 2015 | 2015 | { |
| 2016 | 2016 | // If module_srl exists |
| 2017 | 2017 | // Get a type of granted permission |
| 2018 | - $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false; |
|
| 2018 | + $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false; |
|
| 2019 | 2019 | $grant->is_admin = ($member_info->is_admin == 'Y') ? true : false; |
| 2020 | 2020 | // If a just logged-in member is, check if the member is a module administrator |
| 2021 | - if(!$grant->manager && $member_info->member_srl) |
|
| 2021 | + if (!$grant->manager && $member_info->member_srl) |
|
| 2022 | 2022 | { |
| 2023 | 2023 | $args = new stdClass(); |
| 2024 | 2024 | $args->module_srl = $module_srl; |
| 2025 | 2025 | $args->member_srl = $member_info->member_srl; |
| 2026 | - $output = executeQuery('module.getModuleAdmin',$args); |
|
| 2027 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2026 | + $output = executeQuery('module.getModuleAdmin', $args); |
|
| 2027 | + if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2028 | 2028 | } |
| 2029 | 2029 | // If not an administrator, get information from the DB and grant manager privilege. |
| 2030 | - if(!$grant->manager) |
|
| 2030 | + if (!$grant->manager) |
|
| 2031 | 2031 | { |
| 2032 | 2032 | $args = new stdClass(); |
| 2033 | 2033 | // If planet, get permission settings from the planet home |
| 2034 | - if($module_info->module == 'planet') |
|
| 2034 | + if ($module_info->module == 'planet') |
|
| 2035 | 2035 | { |
| 2036 | 2036 | $output = executeQueryArray('module.getPlanetGrants', $args); |
| 2037 | 2037 | } |
@@ -2044,37 +2044,37 @@ discard block |
||
| 2044 | 2044 | |
| 2045 | 2045 | $grant_exists = $granted = array(); |
| 2046 | 2046 | |
| 2047 | - if($output->data) |
|
| 2047 | + if ($output->data) |
|
| 2048 | 2048 | { |
| 2049 | 2049 | // Arrange names and groups who has privileges |
| 2050 | - foreach($output->data as $val) |
|
| 2050 | + foreach ($output->data as $val) |
|
| 2051 | 2051 | { |
| 2052 | 2052 | $grant_exists[$val->name] = true; |
| 2053 | - if($granted[$val->name]) continue; |
|
| 2053 | + if ($granted[$val->name]) continue; |
|
| 2054 | 2054 | // Log-in member only |
| 2055 | - if($val->group_srl == -1) |
|
| 2055 | + if ($val->group_srl == -1) |
|
| 2056 | 2056 | { |
| 2057 | 2057 | $granted[$val->name] = true; |
| 2058 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2058 | + if ($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2059 | 2059 | // Site-joined member only |
| 2060 | 2060 | } |
| 2061 | - elseif($val->group_srl == -2) |
|
| 2061 | + elseif ($val->group_srl == -2) |
|
| 2062 | 2062 | { |
| 2063 | 2063 | $granted[$val->name] = true; |
| 2064 | 2064 | // Do not grant any permission for non-logged member |
| 2065 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2065 | + if (!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2066 | 2066 | // Log-in member |
| 2067 | 2067 | else |
| 2068 | 2068 | { |
| 2069 | 2069 | $site_module_info = Context::get('site_module_info'); |
| 2070 | 2070 | // Permission granted if no information of the currently connected site exists |
| 2071 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2071 | + if (!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2072 | 2072 | // Permission is not granted if information of the currently connected site exists |
| 2073 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
| 2073 | + elseif (count($group_list)) $grant->{$val->name} = true; |
|
| 2074 | 2074 | } |
| 2075 | 2075 | // All of non-logged members |
| 2076 | 2076 | } |
| 2077 | - elseif($val->group_srl == 0) |
|
| 2077 | + elseif ($val->group_srl == 0) |
|
| 2078 | 2078 | { |
| 2079 | 2079 | $granted[$val->name] = true; |
| 2080 | 2080 | $grant->{$val->name} = true; |
@@ -2082,7 +2082,7 @@ discard block |
||
| 2082 | 2082 | } |
| 2083 | 2083 | else |
| 2084 | 2084 | { |
| 2085 | - if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
| 2085 | + if ($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
| 2086 | 2086 | { |
| 2087 | 2087 | $grant->{$val->name} = true; |
| 2088 | 2088 | $granted[$val->name] = true; |
@@ -2091,29 +2091,29 @@ discard block |
||
| 2091 | 2091 | } |
| 2092 | 2092 | } |
| 2093 | 2093 | // Separate processing for the virtual group access |
| 2094 | - if(!$grant_exists['access']) $grant->access = true; |
|
| 2095 | - if(count($grant_info)) |
|
| 2094 | + if (!$grant_exists['access']) $grant->access = true; |
|
| 2095 | + if (count($grant_info)) |
|
| 2096 | 2096 | { |
| 2097 | - foreach($grant_info as $grant_name => $grant_item) |
|
| 2097 | + foreach ($grant_info as $grant_name => $grant_item) |
|
| 2098 | 2098 | { |
| 2099 | - if($grant_exists[$grant_name]) continue; |
|
| 2100 | - switch($grant_item->default) |
|
| 2099 | + if ($grant_exists[$grant_name]) continue; |
|
| 2100 | + switch ($grant_item->default) |
|
| 2101 | 2101 | { |
| 2102 | 2102 | case 'guest' : |
| 2103 | 2103 | $grant->{$grant_name} = true; |
| 2104 | 2104 | break; |
| 2105 | 2105 | case 'member' : |
| 2106 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2106 | + if ($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2107 | 2107 | else $grant->{$grant_name} = false; |
| 2108 | 2108 | break; |
| 2109 | 2109 | case 'site' : |
| 2110 | 2110 | $site_module_info = Context::get('site_module_info'); |
| 2111 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2111 | + if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2112 | 2112 | else $grant->{$grant_name} = false; |
| 2113 | 2113 | break; |
| 2114 | 2114 | case 'manager' : |
| 2115 | 2115 | case 'root' : |
| 2116 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2116 | + if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2117 | 2117 | else $grant->{$grant_name} = false; |
| 2118 | 2118 | break; |
| 2119 | 2119 | } |
@@ -2121,12 +2121,12 @@ discard block |
||
| 2121 | 2121 | } |
| 2122 | 2122 | } |
| 2123 | 2123 | // Set true to grant all privileges if an administrator is |
| 2124 | - if($grant->manager) |
|
| 2124 | + if ($grant->manager) |
|
| 2125 | 2125 | { |
| 2126 | 2126 | $grant->access = true; |
| 2127 | - if(count($grant_info)) |
|
| 2127 | + if (count($grant_info)) |
|
| 2128 | 2128 | { |
| 2129 | - foreach($grant_info as $key => $val) |
|
| 2129 | + foreach ($grant_info as $key => $val) |
|
| 2130 | 2130 | { |
| 2131 | 2131 | $grant->{$key} = true; |
| 2132 | 2132 | } |
@@ -2158,27 +2158,27 @@ discard block |
||
| 2158 | 2158 | |
| 2159 | 2159 | function unserializeAttributes($module_filebox_list) |
| 2160 | 2160 | { |
| 2161 | - if(is_array($module_filebox_list->data)) |
|
| 2161 | + if (is_array($module_filebox_list->data)) |
|
| 2162 | 2162 | { |
| 2163 | - foreach($module_filebox_list->data as &$item) |
|
| 2163 | + foreach ($module_filebox_list->data as &$item) |
|
| 2164 | 2164 | { |
| 2165 | - if(empty($item->comment)) |
|
| 2165 | + if (empty($item->comment)) |
|
| 2166 | 2166 | { |
| 2167 | 2167 | continue; |
| 2168 | 2168 | } |
| 2169 | 2169 | |
| 2170 | 2170 | $attributes = explode(';', $item->comment); |
| 2171 | - foreach($attributes as $attribute) |
|
| 2171 | + foreach ($attributes as $attribute) |
|
| 2172 | 2172 | { |
| 2173 | 2173 | $values = explode(':', $attribute); |
| 2174 | - if((count($values) % 2) ==1) |
|
| 2174 | + if ((count($values) % 2) == 1) |
|
| 2175 | 2175 | { |
| 2176 | - for($i=2;$i<count($values);$i++) |
|
| 2176 | + for ($i = 2; $i < count($values); $i++) |
|
| 2177 | 2177 | { |
| 2178 | - $values[1].=":".$values[$i]; |
|
| 2178 | + $values[1] .= ":".$values[$i]; |
|
| 2179 | 2179 | } |
| 2180 | 2180 | } |
| 2181 | - $atts[$values[0]]=$values[1]; |
|
| 2181 | + $atts[$values[0]] = $values[1]; |
|
| 2182 | 2182 | } |
| 2183 | 2183 | $item->attributes = $atts; |
| 2184 | 2184 | unset($atts); |
@@ -2190,16 +2190,16 @@ discard block |
||
| 2190 | 2190 | function getFileBoxListHtml() |
| 2191 | 2191 | { |
| 2192 | 2192 | $logged_info = Context::get('logged_info'); |
| 2193 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2193 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2194 | 2194 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
| 2195 | - $link_params = explode('&',$link['query']); |
|
| 2195 | + $link_params = explode('&', $link['query']); |
|
| 2196 | 2196 | foreach ($link_params as $param) |
| 2197 | 2197 | { |
| 2198 | - $param = explode("=",$param); |
|
| 2199 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2198 | + $param = explode("=", $param); |
|
| 2199 | + if ($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2200 | 2200 | } |
| 2201 | 2201 | $oWidgetModel = getModel('widget'); |
| 2202 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2202 | + if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2203 | 2203 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
| 2204 | 2204 | |
| 2205 | 2205 | $oModuleModel = getModel('module'); |
@@ -2215,24 +2215,24 @@ discard block |
||
| 2215 | 2215 | $security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); |
| 2216 | 2216 | |
| 2217 | 2217 | $oTemplate = &TemplateHandler::getInstance(); |
| 2218 | - $html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html'); |
|
| 2218 | + $html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html'); |
|
| 2219 | 2219 | |
| 2220 | 2220 | $this->add('html', $html); |
| 2221 | 2221 | } |
| 2222 | 2222 | |
| 2223 | 2223 | function getModuleFileBoxPath($module_filebox_srl) |
| 2224 | 2224 | { |
| 2225 | - return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3)); |
|
| 2225 | + return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3)); |
|
| 2226 | 2226 | } |
| 2227 | 2227 | |
| 2228 | 2228 | /** |
| 2229 | 2229 | * @brief Return ruleset cache file path |
| 2230 | 2230 | * @param module, act |
| 2231 | 2231 | */ |
| 2232 | - function getValidatorFilePath($module, $ruleset, $mid=null) |
|
| 2232 | + function getValidatorFilePath($module, $ruleset, $mid = null) |
|
| 2233 | 2233 | { |
| 2234 | 2234 | // load dynamic ruleset xml file |
| 2235 | - if(strpos($ruleset, '@') !== false) |
|
| 2235 | + if (strpos($ruleset, '@') !== false) |
|
| 2236 | 2236 | { |
| 2237 | 2237 | $rulsetFile = str_replace('@', '', $ruleset); |
| 2238 | 2238 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
@@ -2242,20 +2242,20 @@ discard block |
||
| 2242 | 2242 | { |
| 2243 | 2243 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
| 2244 | 2244 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2245 | - if(is_readable($xml_file)) |
|
| 2245 | + if (is_readable($xml_file)) |
|
| 2246 | 2246 | return FileHandler::getRealPath($xml_file); |
| 2247 | - else{ |
|
| 2247 | + else { |
|
| 2248 | 2248 | $ruleset = str_replace('#', '', $ruleset); |
| 2249 | 2249 | } |
| 2250 | 2250 | |
| 2251 | 2251 | } |
| 2252 | 2252 | // Get a path of the requested module. Return if not exists. |
| 2253 | 2253 | $class_path = ModuleHandler::getModulePath($module); |
| 2254 | - if(!$class_path) return; |
|
| 2254 | + if (!$class_path) return; |
|
| 2255 | 2255 | |
| 2256 | 2256 | // Check if module.xml exists in the path. Return if not exist |
| 2257 | 2257 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
| 2258 | - if(!file_exists($xml_file)) return; |
|
| 2258 | + if (!file_exists($xml_file)) return; |
|
| 2259 | 2259 | |
| 2260 | 2260 | return $xml_file; |
| 2261 | 2261 | } |
@@ -2267,7 +2267,7 @@ discard block |
||
| 2267 | 2267 | $requestVars = Context::getRequestVars(); |
| 2268 | 2268 | |
| 2269 | 2269 | $args = new stdClass; |
| 2270 | - $args->site_srl = (int)$requestVars->site_srl; |
|
| 2270 | + $args->site_srl = (int) $requestVars->site_srl; |
|
| 2271 | 2271 | $args->page = 1; // /< Page |
| 2272 | 2272 | $args->list_count = 100; // /< the number of posts to display on a single page |
| 2273 | 2273 | $args->page_count = 5; // /< the number of pages that appear in the page navigation |
@@ -2279,9 +2279,9 @@ discard block |
||
| 2279 | 2279 | |
| 2280 | 2280 | $list = array(); |
| 2281 | 2281 | |
| 2282 | - if($output->toBool()) |
|
| 2282 | + if ($output->toBool()) |
|
| 2283 | 2283 | { |
| 2284 | - foreach((array)$output->data as $code_info) |
|
| 2284 | + foreach ((array) $output->data as $code_info) |
|
| 2285 | 2285 | { |
| 2286 | 2286 | unset($codeInfo); |
| 2287 | 2287 | $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
| 36 | 36 | { |
| 37 | 37 | // If XE has not installed yet, set module as install |
| 38 | - if(!Context::isInstalled()) |
|
| 38 | + if (!Context::isInstalled()) |
|
| 39 | 39 | { |
| 40 | 40 | $this->module = 'install'; |
| 41 | 41 | $this->act = Context::get('act'); |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $oContext = Context::getInstance(); |
| 46 | - if($oContext->isSuccessInit == FALSE) |
|
| 46 | + if ($oContext->isSuccessInit == FALSE) |
|
| 47 | 47 | { |
| 48 | 48 | $logged_info = Context::get('logged_info'); |
| 49 | - if($logged_info->is_admin != "Y") |
|
| 49 | + if ($logged_info->is_admin != "Y") |
|
| 50 | 50 | { |
| 51 | 51 | $this->error = 'msg_invalid_request'; |
| 52 | 52 | return; |
@@ -59,26 +59,26 @@ discard block |
||
| 59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
| 60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
| 61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
| 62 | - if($entry = Context::get('entry')) |
|
| 62 | + if ($entry = Context::get('entry')) |
|
| 63 | 63 | { |
| 64 | 64 | $this->entry = Context::convertEncodingStr($entry); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Validate variables to prevent XSS |
| 68 | 68 | $isInvalid = NULL; |
| 69 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 69 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
| 70 | 70 | { |
| 71 | 71 | $isInvalid = TRUE; |
| 72 | 72 | } |
| 73 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 73 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
| 74 | 74 | { |
| 75 | 75 | $isInvalid = TRUE; |
| 76 | 76 | } |
| 77 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 77 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
| 78 | 78 | { |
| 79 | 79 | $isInvalid = TRUE; |
| 80 | 80 | } |
| 81 | - if($isInvalid) |
|
| 81 | + if ($isInvalid) |
|
| 82 | 82 | { |
| 83 | 83 | htmlHeader(); |
| 84 | 84 | echo Context::getLang("msg_invalid_request"); |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | exit; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 90 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
| 91 | 91 | { |
| 92 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 92 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
| 93 | 93 | { |
| 94 | - if(Context::get('_https_port')!=null) { |
|
| 95 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
| 94 | + if (Context::get('_https_port') != null) { |
|
| 95 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
| 96 | 96 | } else { |
| 97 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
| 97 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
| 98 | 98 | } |
| 99 | 99 | return; |
| 100 | 100 | } |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // call a trigger before moduleHandler init |
| 104 | 104 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
| 105 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 105 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
| 106 | 106 | { |
| 107 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 107 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
| 108 | 108 | { |
| 109 | 109 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
| 110 | 110 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -115,40 +115,40 @@ discard block |
||
| 115 | 115 | $called_position = 'before_module_init'; |
| 116 | 116 | $oAddonController = getController('addon'); |
| 117 | 117 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
| 118 | - if(file_exists($addon_file)) include($addon_file); |
|
| 118 | + if (file_exists($addon_file)) include($addon_file); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
| 122 | 122 | { |
| 123 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 123 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
| 124 | 124 | { |
| 125 | 125 | return false; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | set_error_handler(function() { }, ~0); |
| 129 | 129 | |
| 130 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 131 | - if(!file_exists($debug_file)) |
|
| 130 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 131 | + if (!file_exists($debug_file)) |
|
| 132 | 132 | { |
| 133 | 133 | $print[] = '<?php exit() ?>'; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $errorname = self::getErrorType($errnumber); |
| 137 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
| 137 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
| 138 | 138 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
| 139 | 139 | $backtrace = debug_backtrace($backtrace_args); |
| 140 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 140 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
| 141 | 141 | { |
| 142 | 142 | array_shift($backtrace); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - foreach($backtrace as $key => $value) |
|
| 145 | + foreach ($backtrace as $key => $value) |
|
| 146 | 146 | { |
| 147 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
| 147 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
| 148 | 148 | $print[] = $message; |
| 149 | 149 | } |
| 150 | 150 | $print[] = PHP_EOL; |
| 151 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 151 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 152 | 152 | restore_error_handler(); |
| 153 | 153 | |
| 154 | 154 | return true; |
@@ -164,21 +164,21 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | set_error_handler(function() { }, ~0); |
| 166 | 166 | |
| 167 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 168 | - if(!file_exists($debug_file)) |
|
| 167 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 168 | + if (!file_exists($debug_file)) |
|
| 169 | 169 | { |
| 170 | 170 | $print[] = '<?php exit() ?>'; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $errorname = self::getErrorType($errinfo['type']); |
| 174 | 174 | $print[] = '['.date('Y-m-d H:i:s').']'; |
| 175 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
| 175 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
| 176 | 176 | |
| 177 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
| 177 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
| 178 | 178 | $print[] = $message; |
| 179 | 179 | |
| 180 | 180 | $print[] = PHP_EOL; |
| 181 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
| 181 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
| 182 | 182 | set_error_handler(array($this, 'dummyHandler'), ~0); |
| 183 | 183 | |
| 184 | 184 | return true; |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
| 223 | 223 | $defaultHost = $defaultUrlInfo['host']; |
| 224 | 224 | |
| 225 | - foreach($urls as $url) |
|
| 225 | + foreach ($urls as $url) |
|
| 226 | 226 | { |
| 227 | - if(empty($url)) |
|
| 227 | + if (empty($url)) |
|
| 228 | 228 | { |
| 229 | 229 | continue; |
| 230 | 230 | } |
@@ -232,29 +232,29 @@ discard block |
||
| 232 | 232 | $urlInfo = parse_url($url); |
| 233 | 233 | $host = $urlInfo['host']; |
| 234 | 234 | |
| 235 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 235 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
| 236 | 236 | { |
| 237 | 237 | throw new Exception('msg_default_url_is_null'); |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
| 241 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
| 242 | 242 | { |
| 243 | 243 | $oDocumentModel = getModel('document'); |
| 244 | 244 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
| 245 | - if($this->document_srl) |
|
| 245 | + if ($this->document_srl) |
|
| 246 | 246 | { |
| 247 | 247 | Context::set('document_srl', $this->document_srl); |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Get module's information based on document_srl, if it's specified |
| 252 | - if($this->document_srl) |
|
| 252 | + if ($this->document_srl) |
|
| 253 | 253 | { |
| 254 | 254 | |
| 255 | 255 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
| 256 | 256 | // If the document does not exist, remove document_srl |
| 257 | - if(!$module_info) |
|
| 257 | + if (!$module_info) |
|
| 258 | 258 | { |
| 259 | 259 | unset($this->document_srl); |
| 260 | 260 | } |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | { |
| 263 | 263 | // If it exists, compare mid based on the module information |
| 264 | 264 | // if mids are not matching, set it as the document's mid |
| 265 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
| 265 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
| 266 | 266 | { |
| 267 | 267 | |
| 268 | - if(Context::getRequestMethod() == 'GET') |
|
| 268 | + if (Context::getRequestMethod() == 'GET') |
|
| 269 | 269 | { |
| 270 | 270 | $this->mid = $module_info->mid; |
| 271 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 271 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
| 272 | 272 | return FALSE; |
| 273 | 273 | } |
| 274 | 274 | else |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | } |
| 281 | 281 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
| 282 | - if($this->module && $module_info->module != $this->module) |
|
| 282 | + if ($this->module && $module_info->module != $this->module) |
|
| 283 | 283 | { |
| 284 | 284 | unset($module_info); |
| 285 | 285 | } |
@@ -288,36 +288,36 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
| 291 | - if(!$module_info && $this->mid) |
|
| 291 | + if (!$module_info && $this->mid) |
|
| 292 | 292 | { |
| 293 | 293 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
| 294 | 294 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // redirect, if module_site_srl and site_srl are different |
| 298 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 298 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
| 299 | 299 | { |
| 300 | 300 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
| 301 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 301 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
| 302 | 302 | return FALSE; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // If module_info is not set still, and $module does not exist, find the default module |
| 306 | - if(!$module_info && !$this->module && !$this->mid) |
|
| 306 | + if (!$module_info && !$this->module && !$this->mid) |
|
| 307 | 307 | { |
| 308 | 308 | $module_info = $site_module_info; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 311 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
| 312 | 312 | { |
| 313 | 313 | $module_info = $site_module_info; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | // redirect, if site_srl of module_info is different from one of site's module_info |
| 317 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 317 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
| 318 | 318 | { |
| 319 | 319 | // If the module is of virtual site |
| 320 | - if($module_info->site_srl) |
|
| 320 | + if ($module_info->site_srl) |
|
| 321 | 321 | { |
| 322 | 322 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
| 323 | 323 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | else |
| 327 | 327 | { |
| 328 | 328 | $db_info = Context::getDBInfo(); |
| 329 | - if(!$db_info->default_url) |
|
| 329 | + if (!$db_info->default_url) |
|
| 330 | 330 | { |
| 331 | 331 | return Context::getLang('msg_default_url_is_not_defined'); |
| 332 | 332 | } |
@@ -335,12 +335,12 @@ discard block |
||
| 335 | 335 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | - header("location:" . $redirect_url); |
|
| 338 | + header("location:".$redirect_url); |
|
| 339 | 339 | return FALSE; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | // If module info was set, retrieve variables from the module information |
| 343 | - if($module_info) |
|
| 343 | + if ($module_info) |
|
| 344 | 344 | { |
| 345 | 345 | $this->module = $module_info->module; |
| 346 | 346 | $this->mid = $module_info->mid; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
| 352 | 352 | |
| 353 | 353 | // use the site default layout. |
| 354 | - if($module_info->{$targetSrl} == -1) |
|
| 354 | + if ($module_info->{$targetSrl} == -1) |
|
| 355 | 355 | { |
| 356 | 356 | $oLayoutAdminModel = getAdminModel('layout'); |
| 357 | 357 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // Set module and mid into module_info |
| 372 | - if(!isset($this->module_info)) |
|
| 372 | + if (!isset($this->module_info)) |
|
| 373 | 373 | { |
| 374 | 374 | $this->module_info = new stdClass(); |
| 375 | 375 | } |
@@ -380,21 +380,21 @@ discard block |
||
| 380 | 380 | $this->module_info->site_srl = $site_module_info->site_srl; |
| 381 | 381 | |
| 382 | 382 | // Still no module? it's an error |
| 383 | - if(!$this->module) |
|
| 383 | + if (!$this->module) |
|
| 384 | 384 | { |
| 385 | 385 | $this->error = 'msg_module_is_not_exists'; |
| 386 | 386 | $this->httpStatusCode = '404'; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | // If mid exists, set mid into context |
| 390 | - if($this->mid) |
|
| 390 | + if ($this->mid) |
|
| 391 | 391 | { |
| 392 | 392 | Context::set('mid', $this->mid, TRUE); |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | // Call a trigger after moduleHandler init |
| 396 | 396 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
| 397 | - if(!$output->toBool()) |
|
| 397 | + if (!$output->toBool()) |
|
| 398 | 398 | { |
| 399 | 399 | $this->error = $output->getMessage(); |
| 400 | 400 | return TRUE; |
@@ -416,14 +416,14 @@ discard block |
||
| 416 | 416 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
| 417 | 417 | |
| 418 | 418 | // If error occurred while preparation, return a message instance |
| 419 | - if($this->error) |
|
| 419 | + if ($this->error) |
|
| 420 | 420 | { |
| 421 | 421 | $this->_setInputErrorToContext(); |
| 422 | 422 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 423 | 423 | $oMessageObject->setError(-1); |
| 424 | 424 | $oMessageObject->setMessage($this->error); |
| 425 | 425 | $oMessageObject->dispMessage(); |
| 426 | - if($this->httpStatusCode) |
|
| 426 | + if ($this->httpStatusCode) |
|
| 427 | 427 | { |
| 428 | 428 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 429 | 429 | } |
@@ -434,22 +434,22 @@ discard block |
||
| 434 | 434 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
| 435 | 435 | |
| 436 | 436 | // If not installed yet, modify act |
| 437 | - if($this->module == "install") |
|
| 437 | + if ($this->module == "install") |
|
| 438 | 438 | { |
| 439 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
| 439 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
| 440 | 440 | { |
| 441 | 441 | $this->act = $xml_info->default_index_act; |
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | // if act exists, find type of the action, if not use default index act |
| 446 | - if(!$this->act) |
|
| 446 | + if (!$this->act) |
|
| 447 | 447 | { |
| 448 | 448 | $this->act = $xml_info->default_index_act; |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | // still no act means error |
| 452 | - if(!$this->act) |
|
| 452 | + if (!$this->act) |
|
| 453 | 453 | { |
| 454 | 454 | $this->error = 'msg_module_is_not_exists'; |
| 455 | 455 | $this->httpStatusCode = '404'; |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $oMessageObject->setError(-1); |
| 460 | 460 | $oMessageObject->setMessage($this->error); |
| 461 | 461 | $oMessageObject->dispMessage(); |
| 462 | - if($this->httpStatusCode) |
|
| 462 | + if ($this->httpStatusCode) |
|
| 463 | 463 | { |
| 464 | 464 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 465 | 465 | } |
@@ -470,17 +470,17 @@ discard block |
||
| 470 | 470 | $type = $xml_info->action->{$this->act}->type; |
| 471 | 471 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
| 472 | 472 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 473 | - if(!$kind && $this->module == 'admin') |
|
| 473 | + if (!$kind && $this->module == 'admin') |
|
| 474 | 474 | { |
| 475 | 475 | $kind = 'admin'; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // check REQUEST_METHOD in controller |
| 479 | - if($type == 'controller') |
|
| 479 | + if ($type == 'controller') |
|
| 480 | 480 | { |
| 481 | 481 | $allowedMethod = $xml_info->action->{$this->act}->method; |
| 482 | 482 | |
| 483 | - if(!$allowedMethod) |
|
| 483 | + if (!$allowedMethod) |
|
| 484 | 484 | { |
| 485 | 485 | $allowedMethodList[0] = 'POST'; |
| 486 | 486 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 492 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 493 | 493 | { |
| 494 | 494 | $this->error = "msg_invalid_request"; |
| 495 | 495 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if($this->module_info->use_mobile != "Y") |
|
| 503 | + if ($this->module_info->use_mobile != "Y") |
|
| 504 | 504 | { |
| 505 | 505 | Mobile::setMobile(FALSE); |
| 506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | // check CSRF for non-GET actions |
| 511 | 511 | $use_check_csrf = !isset($xml_info->action->{$this->act}) || $xml_info->action->{$this->act}->check_csrf !== 'false'; |
| 512 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 512 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
| 513 | 513 | { |
| 514 | 514 | $this->error = 'msg_invalid_request'; |
| 515 | 515 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Admin ip |
| 523 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 523 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
| 524 | 524 | { |
| 525 | 525 | $this->_setInputErrorToContext(); |
| 526 | 526 | $this->error = "msg_not_permitted_act"; |
@@ -532,13 +532,13 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // if(type == view, and case for using mobilephone) |
| 535 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 535 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
| 536 | 536 | { |
| 537 | 537 | $orig_type = "view"; |
| 538 | 538 | $type = "mobile"; |
| 539 | 539 | // create a module instance |
| 540 | 540 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 541 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 541 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 542 | 542 | { |
| 543 | 543 | $type = $orig_type; |
| 544 | 544 | Mobile::setMobile(FALSE); |
@@ -551,14 +551,14 @@ discard block |
||
| 551 | 551 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - if(!is_object($oModule)) |
|
| 554 | + if (!is_object($oModule)) |
|
| 555 | 555 | { |
| 556 | 556 | $this->_setInputErrorToContext(); |
| 557 | 557 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 558 | 558 | $oMessageObject->setError(-1); |
| 559 | 559 | $oMessageObject->setMessage($this->error); |
| 560 | 560 | $oMessageObject->dispMessage(); |
| 561 | - if($this->httpStatusCode) |
|
| 561 | + if ($this->httpStatusCode) |
|
| 562 | 562 | { |
| 563 | 563 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 564 | 564 | } |
@@ -566,10 +566,10 @@ discard block |
||
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | // If there is no such action in the module object |
| 569 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 569 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
| 570 | 570 | { |
| 571 | 571 | |
| 572 | - if(!Context::isInstalled()) |
|
| 572 | + if (!Context::isInstalled()) |
|
| 573 | 573 | { |
| 574 | 574 | $this->_setInputErrorToContext(); |
| 575 | 575 | $this->error = 'msg_invalid_request'; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $oMessageObject->setError(-1); |
| 578 | 578 | $oMessageObject->setMessage($this->error); |
| 579 | 579 | $oMessageObject->dispMessage(); |
| 580 | - if($this->httpStatusCode) |
|
| 580 | + if ($this->httpStatusCode) |
|
| 581 | 581 | { |
| 582 | 582 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 583 | 583 | } |
@@ -586,12 +586,12 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | $forward = NULL; |
| 588 | 588 | // 1. Look for the module with action name |
| 589 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 589 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
| 590 | 590 | { |
| 591 | - $module = strtolower($matches[2] . $matches[3]); |
|
| 591 | + $module = strtolower($matches[2].$matches[3]); |
|
| 592 | 592 | $xml_info = $oModuleModel->getModuleActionXml($module); |
| 593 | 593 | |
| 594 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 594 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
| 595 | 595 | { |
| 596 | 596 | $forward = new stdClass(); |
| 597 | 597 | $forward->module = $module; |
@@ -611,12 +611,12 @@ discard block |
||
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - if(!$forward) |
|
| 614 | + if (!$forward) |
|
| 615 | 615 | { |
| 616 | 616 | $forward = $oModuleModel->getActionForward($this->act); |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 619 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
| 620 | 620 | { |
| 621 | 621 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
| 622 | 622 | $type = $forward->type; |
@@ -628,11 +628,11 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | // SECISSUE also check foward act method |
| 630 | 630 | // check REQUEST_METHOD in controller |
| 631 | - if($type == 'controller') |
|
| 631 | + if ($type == 'controller') |
|
| 632 | 632 | { |
| 633 | 633 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
| 634 | 634 | |
| 635 | - if(!$allowedMethod) |
|
| 635 | + if (!$allowedMethod) |
|
| 636 | 636 | { |
| 637 | 637 | $allowedMethodList[0] = 'POST'; |
| 638 | 638 | } |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 644 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
| 645 | 645 | { |
| 646 | 646 | $this->error = "msg_invalid_request"; |
| 647 | 647 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -652,13 +652,13 @@ discard block |
||
| 652 | 652 | } |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
| 655 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
| 656 | 656 | { |
| 657 | 657 | $orig_type = "view"; |
| 658 | 658 | $type = "mobile"; |
| 659 | 659 | // create a module instance |
| 660 | 660 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 661 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 661 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
| 662 | 662 | { |
| 663 | 663 | $type = $orig_type; |
| 664 | 664 | Mobile::setMobile(FALSE); |
@@ -670,25 +670,25 @@ discard block |
||
| 670 | 670 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | - if(!is_object($oModule)) |
|
| 673 | + if (!is_object($oModule)) |
|
| 674 | 674 | { |
| 675 | 675 | $this->_setInputErrorToContext(); |
| 676 | 676 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
| 677 | 677 | $oMessageObject->setError(-1); |
| 678 | 678 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
| 679 | 679 | $oMessageObject->dispMessage(); |
| 680 | - if($this->httpStatusCode) |
|
| 680 | + if ($this->httpStatusCode) |
|
| 681 | 681 | { |
| 682 | 682 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
| 683 | 683 | } |
| 684 | 684 | return $oMessageObject; |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | - if($this->module == "admin" && $type == "view") |
|
| 687 | + if ($this->module == "admin" && $type == "view") |
|
| 688 | 688 | { |
| 689 | - if($logged_info->is_admin == 'Y') |
|
| 689 | + if ($logged_info->is_admin == 'Y') |
|
| 690 | 690 | { |
| 691 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
| 691 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
| 692 | 692 | { |
| 693 | 693 | $oAdminView = getAdminView('admin'); |
| 694 | 694 | $oAdminView->makeGnbUrl($forward->module); |
@@ -708,10 +708,10 @@ discard block |
||
| 708 | 708 | return $oMessageObject; |
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | - if($kind == 'admin') |
|
| 711 | + if ($kind == 'admin') |
|
| 712 | 712 | { |
| 713 | 713 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
| 714 | - if(!$grant->manager) |
|
| 714 | + if (!$grant->manager) |
|
| 715 | 715 | { |
| 716 | 716 | $this->_setInputErrorToContext(); |
| 717 | 717 | $this->error = 'msg_is_not_manager'; |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | } |
| 724 | 724 | else |
| 725 | 725 | { |
| 726 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 726 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
| 727 | 727 | { |
| 728 | 728 | $this->_setInputErrorToContext(); |
| 729 | 729 | $this->error = 'msg_is_not_administrator'; |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 739 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
| 740 | 740 | { |
| 741 | 741 | $this->act = $xml_info->default_index_act; |
| 742 | 742 | } |
@@ -750,16 +750,16 @@ discard block |
||
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | // ruleset check... |
| 753 | - if(!empty($ruleset)) |
|
| 753 | + if (!empty($ruleset)) |
|
| 754 | 754 | { |
| 755 | 755 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
| 756 | 756 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
| 757 | - if(!empty($rulesetFile)) |
|
| 757 | + if (!empty($rulesetFile)) |
|
| 758 | 758 | { |
| 759 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 759 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
| 760 | 760 | { |
| 761 | 761 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
| 762 | - foreach($errorLang as $key => $val) |
|
| 762 | + foreach ($errorLang as $key => $val) |
|
| 763 | 763 | { |
| 764 | 764 | Context::setLang($key, $val); |
| 765 | 765 | } |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | $Validator = new Validator($rulesetFile); |
| 770 | 770 | $result = $Validator->validate(); |
| 771 | - if(!$result) |
|
| 771 | + if (!$result) |
|
| 772 | 772 | { |
| 773 | 773 | $lastError = $Validator->getLastError(); |
| 774 | 774 | $returnUrl = Context::get('error_return_url'); |
@@ -800,26 +800,26 @@ discard block |
||
| 800 | 800 | 'dispLayoutPreviewWithModule' => 1 |
| 801 | 801 | ); |
| 802 | 802 | $db_use_mobile = Mobile::isMobileEnabled(); |
| 803 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 803 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
| 804 | 804 | { |
| 805 | 805 | global $lang; |
| 806 | 806 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
| 807 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
| 807 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
| 808 | 808 | Context::addHtmlHeader($header); |
| 809 | 809 | Context::addHtmlFooter($footer); |
| 810 | 810 | } |
| 811 | 811 | |
| 812 | - if($type == "view" && $kind != 'admin') |
|
| 812 | + if ($type == "view" && $kind != 'admin') |
|
| 813 | 813 | { |
| 814 | 814 | $module_config = $oModuleModel->getModuleConfig('module'); |
| 815 | - if($module_config->htmlFooter) |
|
| 815 | + if ($module_config->htmlFooter) |
|
| 816 | 816 | { |
| 817 | 817 | Context::addHtmlFooter($module_config->htmlFooter); |
| 818 | 818 | } |
| 819 | - if($module_config->siteTitle) |
|
| 819 | + if ($module_config->siteTitle) |
|
| 820 | 820 | { |
| 821 | 821 | $siteTitle = Context::getBrowserTitle(); |
| 822 | - if(!$siteTitle) |
|
| 822 | + if (!$siteTitle) |
|
| 823 | 823 | { |
| 824 | 824 | Context::setBrowserTitle($module_config->siteTitle); |
| 825 | 825 | } |
@@ -832,18 +832,18 @@ discard block |
||
| 832 | 832 | $procResult = $oModule->proc(); |
| 833 | 833 | |
| 834 | 834 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 835 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 835 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
| 836 | 836 | { |
| 837 | 837 | $error = $oModule->getError(); |
| 838 | 838 | $message = $oModule->getMessage(); |
| 839 | 839 | $messageType = $oModule->getMessageType(); |
| 840 | 840 | $redirectUrl = $oModule->getRedirectUrl(); |
| 841 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 841 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
| 842 | 842 | |
| 843 | - if(!$procResult) |
|
| 843 | + if (!$procResult) |
|
| 844 | 844 | { |
| 845 | 845 | $this->error = $message; |
| 846 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
| 846 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
| 847 | 847 | { |
| 848 | 848 | $redirectUrl = Context::get('error_return_url'); |
| 849 | 849 | } |
@@ -856,13 +856,13 @@ discard block |
||
| 856 | 856 | |
| 857 | 857 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
| 858 | 858 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
| 859 | - if($message != 'success') |
|
| 859 | + if ($message != 'success') |
|
| 860 | 860 | { |
| 861 | 861 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
| 862 | 862 | } |
| 863 | 863 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
| 864 | 864 | |
| 865 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 865 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
| 866 | 866 | { |
| 867 | 867 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
| 868 | 868 | } |
@@ -878,27 +878,27 @@ discard block |
||
| 878 | 878 | * */ |
| 879 | 879 | function _setInputErrorToContext() |
| 880 | 880 | { |
| 881 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 881 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
| 882 | 882 | { |
| 883 | 883 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
| 884 | 884 | } |
| 885 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 885 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
| 886 | 886 | { |
| 887 | 887 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
| 888 | 888 | } |
| 889 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 889 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
| 890 | 890 | { |
| 891 | 891 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
| 892 | 892 | } |
| 893 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 893 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
| 894 | 894 | { |
| 895 | 895 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
| 896 | 896 | } |
| 897 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 897 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
| 898 | 898 | { |
| 899 | 899 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
| 900 | 900 | } |
| 901 | - if(count($_SESSION['INPUT_ERROR'])) |
|
| 901 | + if (count($_SESSION['INPUT_ERROR'])) |
|
| 902 | 902 | { |
| 903 | 903 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
| 904 | 904 | } |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | { |
| 929 | 929 | $requestVars = Context::getRequestVars(); |
| 930 | 930 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
| 931 | - foreach($requestVars AS $key => $value) |
|
| 931 | + foreach ($requestVars AS $key => $value) |
|
| 932 | 932 | { |
| 933 | 933 | $_SESSION['INPUT_ERROR'][$key] = $value; |
| 934 | 934 | } |
@@ -942,41 +942,41 @@ discard block |
||
| 942 | 942 | function displayContent($oModule = NULL) |
| 943 | 943 | { |
| 944 | 944 | // If the module is not set or not an object, set error |
| 945 | - if(!$oModule || !is_object($oModule)) |
|
| 945 | + if (!$oModule || !is_object($oModule)) |
|
| 946 | 946 | { |
| 947 | 947 | $this->error = 'msg_module_is_not_exists'; |
| 948 | 948 | $this->httpStatusCode = '404'; |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | // If connection to DB has a problem even though it's not install module, set error |
| 952 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 952 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
| 953 | 953 | { |
| 954 | 954 | $this->error = 'msg_dbconnect_failed'; |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | // Call trigger after moduleHandler proc |
| 958 | 958 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
| 959 | - if(!$output->toBool()) |
|
| 959 | + if (!$output->toBool()) |
|
| 960 | 960 | { |
| 961 | 961 | $this->error = $output->getMessage(); |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | // Use message view object, if HTML call |
| 965 | 965 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
| 966 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
| 966 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
| 967 | 967 | { |
| 968 | 968 | |
| 969 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 969 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
| 970 | 970 | { |
| 971 | 971 | $display_handler = new DisplayHandler(); |
| 972 | 972 | $display_handler->_debugOutput(); |
| 973 | 973 | |
| 974 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 974 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
| 975 | 975 | return; |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | // If error occurred, handle it |
| 979 | - if($this->error) |
|
| 979 | + if ($this->error) |
|
| 980 | 980 | { |
| 981 | 981 | // display content with message module instance |
| 982 | 982 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -985,14 +985,14 @@ discard block |
||
| 985 | 985 | $oMessageObject->setMessage($this->error); |
| 986 | 986 | $oMessageObject->dispMessage(); |
| 987 | 987 | |
| 988 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 988 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
| 989 | 989 | { |
| 990 | 990 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
| 991 | 991 | $oMessageObject->setTemplateFile('http_status_code'); |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | // If module was called normally, change the templates of the module into ones of the message view module |
| 995 | - if($oModule) |
|
| 995 | + if ($oModule) |
|
| 996 | 996 | { |
| 997 | 997 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
| 998 | 998 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | // Check if layout_srl exists for the module |
| 1010 | - if(Mobile::isFromMobilePhone()) |
|
| 1010 | + if (Mobile::isFromMobilePhone()) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | $layout_srl = $oModule->module_info->mlayout_srl; |
| 1013 | 1013 | } |
@@ -1017,58 +1017,58 @@ discard block |
||
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | // if layout_srl is rollback by module, set default layout |
| 1020 | - if($layout_srl == -1) |
|
| 1020 | + if ($layout_srl == -1) |
|
| 1021 | 1021 | { |
| 1022 | 1022 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
| 1023 | 1023 | $oLayoutAdminModel = getAdminModel('layout'); |
| 1024 | 1024 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
| 1027 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
| 1028 | 1028 | { |
| 1029 | 1029 | |
| 1030 | 1030 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
| 1031 | 1031 | $oLayoutModel = getModel('layout'); |
| 1032 | 1032 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 1033 | - if($layout_info) |
|
| 1033 | + if ($layout_info) |
|
| 1034 | 1034 | { |
| 1035 | 1035 | |
| 1036 | 1036 | // Input extra_vars into $layout_info |
| 1037 | - if($layout_info->extra_var_count) |
|
| 1037 | + if ($layout_info->extra_var_count) |
|
| 1038 | 1038 | { |
| 1039 | 1039 | |
| 1040 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 1040 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 1041 | 1041 | { |
| 1042 | - if($val->type == 'image') |
|
| 1042 | + if ($val->type == 'image') |
|
| 1043 | 1043 | { |
| 1044 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1044 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 1045 | 1045 | { |
| 1046 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 1046 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 1047 | 1047 | } |
| 1048 | 1048 | } |
| 1049 | 1049 | $layout_info->{$var_id} = $val->value; |
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | 1052 | // Set menus into context |
| 1053 | - if($layout_info->menu_count) |
|
| 1053 | + if ($layout_info->menu_count) |
|
| 1054 | 1054 | { |
| 1055 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 1055 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 1056 | 1056 | { |
| 1057 | 1057 | // set default menu set(included home menu) |
| 1058 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1058 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | $oMenuAdminController = getAdminController('menu'); |
| 1061 | 1061 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 1062 | 1062 | |
| 1063 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
| 1063 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | include($homeMenuCacheFile); |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | - if(!$menu->menu_srl) |
|
| 1068 | + if (!$menu->menu_srl) |
|
| 1069 | 1069 | { |
| 1070 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 1071 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 1070 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 1071 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 1072 | 1072 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 1073 | 1073 | } |
| 1074 | 1074 | else |
@@ -1079,7 +1079,7 @@ discard block |
||
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | $php_file = FileHandler::exists($menu->php_file); |
| 1082 | - if($php_file) |
|
| 1082 | + if ($php_file) |
|
| 1083 | 1083 | { |
| 1084 | 1084 | include($php_file); |
| 1085 | 1085 | } |
@@ -1095,17 +1095,17 @@ discard block |
||
| 1095 | 1095 | |
| 1096 | 1096 | // If layout was modified, use the modified version |
| 1097 | 1097 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
| 1098 | - if(file_exists($edited_layout)) |
|
| 1098 | + if (file_exists($edited_layout)) |
|
| 1099 | 1099 | { |
| 1100 | 1100 | $oModule->setEditedLayoutFile($edited_layout); |
| 1101 | 1101 | } |
| 1102 | 1102 | } |
| 1103 | 1103 | } |
| 1104 | 1104 | $isLayoutDrop = Context::get('isLayoutDrop'); |
| 1105 | - if($isLayoutDrop) |
|
| 1105 | + if ($isLayoutDrop) |
|
| 1106 | 1106 | { |
| 1107 | 1107 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
| 1108 | - if($kind == 'admin') |
|
| 1108 | + if ($kind == 'admin') |
|
| 1109 | 1109 | { |
| 1110 | 1110 | $oModule->setLayoutFile('popup_layout'); |
| 1111 | 1111 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
| 1143 | 1143 | function &getModuleInstance($module, $type = 'view', $kind = '') |
| 1144 | 1144 | { |
| 1145 | 1145 | |
| 1146 | - if(__DEBUG__ == 3) |
|
| 1146 | + if (__DEBUG__ == 3) |
|
| 1147 | 1147 | { |
| 1148 | 1148 | $start_time = getMicroTime(); |
| 1149 | 1149 | } |
@@ -1153,51 +1153,51 @@ discard block |
||
| 1153 | 1153 | $type = strtolower($type); |
| 1154 | 1154 | |
| 1155 | 1155 | $kinds = array('svc' => 1, 'admin' => 1); |
| 1156 | - if(!isset($kinds[$kind])) |
|
| 1156 | + if (!isset($kinds[$kind])) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | $kind = 'svc'; |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
| 1161 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
| 1162 | 1162 | |
| 1163 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1163 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
| 1164 | 1164 | { |
| 1165 | 1165 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | // if there is no instance of the module in global variable, create a new one |
| 1169 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1169 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
| 1170 | 1170 | { |
| 1171 | 1171 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1172 | 1172 | |
| 1173 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1173 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
| 1174 | 1174 | { |
| 1175 | 1175 | $module = $parent_module; |
| 1176 | 1176 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | // Check if the base class and instance class exist |
| 1180 | - if(!class_exists($module, true)) |
|
| 1180 | + if (!class_exists($module, true)) |
|
| 1181 | 1181 | { |
| 1182 | 1182 | return NULL; |
| 1183 | 1183 | } |
| 1184 | - if(!class_exists($instance_name, true)) |
|
| 1184 | + if (!class_exists($instance_name, true)) |
|
| 1185 | 1185 | { |
| 1186 | 1186 | return NULL; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | // Create an instance |
| 1190 | 1190 | $oModule = new $instance_name(); |
| 1191 | - if(!is_object($oModule)) |
|
| 1191 | + if (!is_object($oModule)) |
|
| 1192 | 1192 | { |
| 1193 | 1193 | return NULL; |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | // Load language files for the class |
| 1197 | - Context::loadLang($class_path . 'lang'); |
|
| 1198 | - if($extend_module) |
|
| 1197 | + Context::loadLang($class_path.'lang'); |
|
| 1198 | + if ($extend_module) |
|
| 1199 | 1199 | { |
| 1200 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
| 1200 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | // Set variables to the instance |
@@ -1205,10 +1205,10 @@ discard block |
||
| 1205 | 1205 | $oModule->setModulePath($class_path); |
| 1206 | 1206 | |
| 1207 | 1207 | // If the module has a constructor, run it. |
| 1208 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1208 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
| 1209 | 1209 | { |
| 1210 | 1210 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
| 1211 | - if(@method_exists($oModule, $instance_name)) |
|
| 1211 | + if (@method_exists($oModule, $instance_name)) |
|
| 1212 | 1212 | { |
| 1213 | 1213 | $oModule->{$instance_name}(); |
| 1214 | 1214 | } |
@@ -1218,7 +1218,7 @@ discard block |
||
| 1218 | 1218 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | - if(__DEBUG__ == 3) |
|
| 1221 | + if (__DEBUG__ == 3) |
|
| 1222 | 1222 | { |
| 1223 | 1223 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
| 1224 | 1224 | } |
@@ -1234,17 +1234,17 @@ discard block |
||
| 1234 | 1234 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
| 1235 | 1235 | $highClassFile = FileHandler::getRealPath($highClassFile); |
| 1236 | 1236 | |
| 1237 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
| 1238 | - if(!in_array($type, $types)) |
|
| 1237 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
| 1238 | + if (!in_array($type, $types)) |
|
| 1239 | 1239 | { |
| 1240 | 1240 | $type = $types[0]; |
| 1241 | 1241 | } |
| 1242 | - if($type == 'class') |
|
| 1242 | + if ($type == 'class') |
|
| 1243 | 1243 | { |
| 1244 | 1244 | $instanceName = '%s'; |
| 1245 | 1245 | $classFile = '%s%s.%s.php'; |
| 1246 | 1246 | } |
| 1247 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1247 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
| 1248 | 1248 | { |
| 1249 | 1249 | $instanceName = '%sAdmin%s'; |
| 1250 | 1250 | $classFile = '%s%s.admin.%s.php'; |
@@ -1269,26 +1269,26 @@ discard block |
||
| 1269 | 1269 | function triggerCall($trigger_name, $called_position, &$obj) |
| 1270 | 1270 | { |
| 1271 | 1271 | // skip if not installed |
| 1272 | - if(!Context::isInstalled()) |
|
| 1272 | + if (!Context::isInstalled()) |
|
| 1273 | 1273 | { |
| 1274 | 1274 | return new Object(); |
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | 1277 | $oModuleModel = getModel('module'); |
| 1278 | 1278 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
| 1279 | - if(!$triggers || count($triggers) < 1) |
|
| 1279 | + if (!$triggers || count($triggers) < 1) |
|
| 1280 | 1280 | { |
| 1281 | 1281 | return new Object(); |
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | //store before trigger call time |
| 1285 | 1285 | $before_trigger_time = NULL; |
| 1286 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
| 1286 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
| 1287 | 1287 | { |
| 1288 | 1288 | $before_trigger_time = microtime(true); |
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | - foreach($triggers as $item) |
|
| 1291 | + foreach ($triggers as $item) |
|
| 1292 | 1292 | { |
| 1293 | 1293 | $module = $item->module; |
| 1294 | 1294 | $type = $item->type; |
@@ -1296,7 +1296,7 @@ discard block |
||
| 1296 | 1296 | |
| 1297 | 1297 | // todo why don't we call a normal class object ? |
| 1298 | 1298 | $oModule = getModule($module, $type); |
| 1299 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
| 1299 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
| 1300 | 1300 | { |
| 1301 | 1301 | continue; |
| 1302 | 1302 | } |
@@ -1309,12 +1309,12 @@ discard block |
||
| 1309 | 1309 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
| 1310 | 1310 | |
| 1311 | 1311 | $slowlog = new stdClass; |
| 1312 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
| 1313 | - $slowlog->called = $module . '.' . $called_method; |
|
| 1312 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
| 1313 | + $slowlog->called = $module.'.'.$called_method; |
|
| 1314 | 1314 | $slowlog->called_extension = $module; |
| 1315 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1315 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
| 1316 | 1316 | |
| 1317 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1317 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
| 1318 | 1318 | { |
| 1319 | 1319 | return $output; |
| 1320 | 1320 | } |
@@ -1399,9 +1399,9 @@ discard block |
||
| 1399 | 1399 | '511' => 'Network Authentication Required', |
| 1400 | 1400 | ); |
| 1401 | 1401 | $statusMessage = $statusMessageList[$code]; |
| 1402 | - if(!$statusMessage) |
|
| 1402 | + if (!$statusMessage) |
|
| 1403 | 1403 | { |
| 1404 | - $statusMessage = 'HTTP ' . $code; |
|
| 1404 | + $statusMessage = 'HTTP '.$code; |
|
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | 1407 | Context::set('http_status_code', $code); |
@@ -10,32 +10,32 @@ discard block |
||
| 10 | 10 | $oSecurity = new Security(); |
| 11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl');
|
| 12 | 12 | |
| 13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
| 14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
| 15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
| 16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
| 17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
| 18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
| 13 | + if ($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
| 14 | + if ($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
| 15 | + if ($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
| 16 | + if ($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
| 17 | + if ($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
| 18 | + if ($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
| 19 | 19 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
| 20 | 20 | |
| 21 | 21 | // $this->_getStatusNameListecret option backward compatibility |
| 22 | 22 | $oDocumentModel = getModel('document');
|
| 23 | 23 | |
| 24 | 24 | $statusList = $this->_getStatusNameList($oDocumentModel); |
| 25 | - if(isset($statusList['SECRET'])) |
|
| 25 | + if (isset($statusList['SECRET'])) |
|
| 26 | 26 | {
|
| 27 | 27 | $this->module_info->secret = 'Y'; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // use_category <=1.5.x, hide_category >=1.7.x |
| 31 | 31 | $count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
| 32 | - if($count_category) |
|
| 32 | + if ($count_category) |
|
| 33 | 33 | {
|
| 34 | - if($this->module_info->hide_category) |
|
| 34 | + if ($this->module_info->hide_category) |
|
| 35 | 35 | {
|
| 36 | 36 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
| 37 | 37 | } |
| 38 | - else if($this->module_info->use_category) |
|
| 38 | + else if ($this->module_info->use_category) |
|
| 39 | 39 | {
|
| 40 | 40 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
| 41 | 41 | } |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | * check the consultation function, if the user is admin then swich off consultation function |
| 56 | 56 | * if the user is not logged, then disppear write document/write comment./ view document |
| 57 | 57 | **/ |
| 58 | - if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 58 | + if ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
|
| 59 | 59 | {
|
| 60 | 60 | $this->consultation = true; |
| 61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;
|
|
| 61 | + if (!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;
|
|
| 62 | 62 | } else {
|
| 63 | 63 | $this->consultation = false; |
| 64 | 64 | } |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | $extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl); |
| 68 | 68 | Context::set('extra_keys', $extra_keys);
|
| 69 | 69 | |
| 70 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin);
|
|
| 71 | - if(!is_dir($template_path)||!$this->module_info->mskin) |
|
| 70 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin);
|
|
| 71 | + if (!is_dir($template_path) || !$this->module_info->mskin) |
|
| 72 | 72 | {
|
| 73 | 73 | $this->module_info->mskin = 'default'; |
| 74 | - $template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin);
|
|
| 74 | + $template_path = sprintf("%sm.skins/%s/", $this->module_path, $this->module_info->mskin);
|
|
| 75 | 75 | } |
| 76 | 76 | $this->setTemplatePath($template_path); |
| 77 | 77 | Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | function getBoardCommentPage() |
| 88 | 88 | {
|
| 89 | 89 | $document_srl = Context::get('document_srl');
|
| 90 | - $oDocumentModel =& getModel('document');
|
|
| 91 | - if(!$document_srl) |
|
| 90 | + $oDocumentModel = & getModel('document');
|
|
| 91 | + if (!$document_srl) |
|
| 92 | 92 | {
|
| 93 | 93 | return new Object(-1, "msg_invalid_request"); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
| 96 | + if ($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)) |
|
| 97 | 97 | {
|
| 98 | 98 | return new Object(-1, "msg_not_permitted"); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 102 | - if(!$oDocument->isExists()) |
|
| 102 | + if (!$oDocument->isExists()) |
|
| 103 | 103 | {
|
| 104 | 104 | return new Object(-1, "msg_invalid_request"); |
| 105 | 105 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | function dispBoardMessage($msg_code) |
| 113 | 113 | {
|
| 114 | 114 | $msg = Context::getLang($msg_code); |
| 115 | - $oMessageObject = &ModuleHandler::getModuleInstance('message','mobile');
|
|
| 115 | + $oMessageObject = &ModuleHandler::getModuleInstance('message', 'mobile');
|
|
| 116 | 116 | $oMessageObject->setError(-1); |
| 117 | 117 | $oMessageObject->setMessage($msg); |
| 118 | 118 | $oMessageObject->dispMessage(); |
@@ -10,12 +10,24 @@ discard block |
||
| 10 | 10 | $oSecurity = new Security(); |
| 11 | 11 | $oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl');
|
| 12 | 12 | |
| 13 | - if($this->module_info->list_count) $this->list_count = $this->module_info->list_count; |
|
| 14 | - if($this->module_info->mobile_list_count) $this->list_count = $this->module_info->mobile_list_count; |
|
| 15 | - if($this->module_info->search_list_count) $this->search_list_count = $this->module_info->search_list_count; |
|
| 16 | - if($this->module_info->mobile_search_list_count) $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
| 17 | - if($this->module_info->page_count) $this->page_count = $this->module_info->page_count; |
|
| 18 | - if($this->module_info->mobile_page_count) $this->page_count = $this->module_info->mobile_page_count; |
|
| 13 | + if($this->module_info->list_count) { |
|
| 14 | + $this->list_count = $this->module_info->list_count; |
|
| 15 | + } |
|
| 16 | + if($this->module_info->mobile_list_count) { |
|
| 17 | + $this->list_count = $this->module_info->mobile_list_count; |
|
| 18 | + } |
|
| 19 | + if($this->module_info->search_list_count) { |
|
| 20 | + $this->search_list_count = $this->module_info->search_list_count; |
|
| 21 | + } |
|
| 22 | + if($this->module_info->mobile_search_list_count) { |
|
| 23 | + $this->search_list_count = $this->module_info->mobile_search_list_count; |
|
| 24 | + } |
|
| 25 | + if($this->module_info->page_count) { |
|
| 26 | + $this->page_count = $this->module_info->page_count; |
|
| 27 | + } |
|
| 28 | + if($this->module_info->mobile_page_count) { |
|
| 29 | + $this->page_count = $this->module_info->mobile_page_count; |
|
| 30 | + } |
|
| 19 | 31 | $this->except_notice = $this->module_info->except_notice == 'N' ? false : true; |
| 20 | 32 | |
| 21 | 33 | // $this->_getStatusNameListecret option backward compatibility |
@@ -34,18 +46,15 @@ discard block |
||
| 34 | 46 | if($this->module_info->hide_category) |
| 35 | 47 | {
|
| 36 | 48 | $this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
| 37 | - } |
|
| 38 | - else if($this->module_info->use_category) |
|
| 49 | + } else if($this->module_info->use_category) |
|
| 39 | 50 | {
|
| 40 | 51 | $this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
| 41 | - } |
|
| 42 | - else |
|
| 52 | + } else |
|
| 43 | 53 | {
|
| 44 | 54 | $this->module_info->hide_category = 'N'; |
| 45 | 55 | $this->module_info->use_category = 'Y'; |
| 46 | 56 | } |
| 47 | - } |
|
| 48 | - else |
|
| 57 | + } else |
|
| 49 | 58 | {
|
| 50 | 59 | $this->module_info->hide_category = 'Y'; |
| 51 | 60 | $this->module_info->use_category = 'N'; |
@@ -58,7 +67,9 @@ discard block |
||
| 58 | 67 | if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read) |
| 59 | 68 | {
|
| 60 | 69 | $this->consultation = true; |
| 61 | - if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;
|
|
| 70 | + if(!Context::get('is_logged')) { |
|
| 71 | + $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false; |
|
| 72 | + } |
|
| 62 | 73 | } else {
|
| 63 | 74 | $this->consultation = false; |
| 64 | 75 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
| 3 | 3 | |
| 4 | -require_once(_XE_PATH_ . 'modules/comment/comment.item.php'); |
|
| 4 | +require_once(_XE_PATH_.'modules/comment/comment.item.php'); |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * comment |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // 2008. 02. 22 add comment setting when a new module added |
| 37 | 37 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); |
| 38 | 38 | |
| 39 | - if(!is_dir('./files/cache/tmp')) |
|
| 39 | + if (!is_dir('./files/cache/tmp')) |
|
| 40 | 40 | { |
| 41 | 41 | FileHandler::makeDir('./files/cache/tmp'); |
| 42 | 42 | } |
@@ -53,60 +53,60 @@ discard block |
||
| 53 | 53 | $oDB = DB::getInstance(); |
| 54 | 54 | $oModuleModel = getModel('module'); |
| 55 | 55 | // 2007. 10. 17 add a trigger to delete comments together with posting deleted |
| 56 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 56 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 57 | 57 | { |
| 58 | 58 | return TRUE; |
| 59 | 59 | } |
| 60 | 60 | // 2007. 10. 17 add a trigger to delete all of comments together with module deleted |
| 61 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 61 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 62 | 62 | { |
| 63 | 63 | return TRUE; |
| 64 | 64 | } |
| 65 | 65 | // 2007. 10. 23 add a column for recommendation votes or notification of the comments |
| 66 | - if(!$oDB->isColumnExists("comments", "voted_count")) |
|
| 66 | + if (!$oDB->isColumnExists("comments", "voted_count")) |
|
| 67 | 67 | { |
| 68 | 68 | return TRUE; |
| 69 | 69 | } |
| 70 | - if(!$oDB->isColumnExists("comments", "notify_message")) |
|
| 70 | + if (!$oDB->isColumnExists("comments", "notify_message")) |
|
| 71 | 71 | { |
| 72 | 72 | return TRUE; |
| 73 | 73 | } |
| 74 | 74 | // 2008. 02. 22 add comment setting when a new module added |
| 75 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 75 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 76 | 76 | { |
| 77 | 77 | return TRUE; |
| 78 | 78 | } |
| 79 | 79 | // 2008. 05. 14 add a column for blamed count |
| 80 | - if(!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 80 | + if (!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 81 | 81 | { |
| 82 | 82 | return TRUE; |
| 83 | 83 | } |
| 84 | - if(!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 84 | + if (!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 85 | 85 | { |
| 86 | 86 | return TRUE; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if(!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 89 | + if (!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 90 | 90 | { |
| 91 | 91 | return TRUE; |
| 92 | 92 | } |
| 93 | 93 | //2012. 02. 24 add comment published status column and index |
| 94 | - if(!$oDB->isColumnExists("comments", "status")) |
|
| 94 | + if (!$oDB->isColumnExists("comments", "status")) |
|
| 95 | 95 | { |
| 96 | 96 | return TRUE; |
| 97 | 97 | } |
| 98 | - if(!$oDB->isIndexExists("comments", "idx_status")) |
|
| 98 | + if (!$oDB->isIndexExists("comments", "idx_status")) |
|
| 99 | 99 | { |
| 100 | 100 | return TRUE; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 104 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 104 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 105 | 105 | { |
| 106 | 106 | return TRUE; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if(!$oDB->isIndexExists("comments", "idx_parent_srl")) |
|
| 109 | + if (!$oDB->isIndexExists("comments", "idx_parent_srl")) |
|
| 110 | 110 | { |
| 111 | 111 | return TRUE; |
| 112 | 112 | } |
@@ -124,43 +124,43 @@ discard block |
||
| 124 | 124 | $oModuleModel = getModel('module'); |
| 125 | 125 | $oModuleController = getController('module'); |
| 126 | 126 | // 2007. 10. 17 add a trigger to delete comments together with posting deleted |
| 127 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 127 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) |
|
| 128 | 128 | { |
| 129 | 129 | $oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'); |
| 130 | 130 | } |
| 131 | 131 | // 2007. 10. 17 add a trigger to delete all of comments together with module deleted |
| 132 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 132 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) |
|
| 133 | 133 | { |
| 134 | 134 | $oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'); |
| 135 | 135 | } |
| 136 | 136 | // 2007. 10. 23 add a column for recommendation votes or notification of the comments |
| 137 | - if(!$oDB->isColumnExists("comments", "voted_count")) |
|
| 137 | + if (!$oDB->isColumnExists("comments", "voted_count")) |
|
| 138 | 138 | { |
| 139 | 139 | $oDB->addColumn("comments", "voted_count", "number", "11"); |
| 140 | 140 | $oDB->addIndex("comments", "idx_voted_count", array("voted_count")); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if(!$oDB->isColumnExists("comments", "notify_message")) |
|
| 143 | + if (!$oDB->isColumnExists("comments", "notify_message")) |
|
| 144 | 144 | { |
| 145 | 145 | $oDB->addColumn("comments", "notify_message", "char", "1"); |
| 146 | 146 | } |
| 147 | 147 | // 2008. 02. 22 add comment setting when a new module added |
| 148 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 148 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) |
|
| 149 | 149 | { |
| 150 | 150 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); |
| 151 | 151 | } |
| 152 | 152 | // 2008. 05. 14 add a column for blamed count |
| 153 | - if(!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 153 | + if (!$oDB->isColumnExists("comments", "blamed_count")) |
|
| 154 | 154 | { |
| 155 | 155 | $oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, TRUE); |
| 156 | 156 | $oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count')); |
| 157 | 157 | } |
| 158 | - if(!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 158 | + if (!$oDB->isColumnExists("comment_voted_log", "point")) |
|
| 159 | 159 | { |
| 160 | 160 | $oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, TRUE); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if(!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 163 | + if (!$oDB->isIndexExists("comments", "idx_module_list_order")) |
|
| 164 | 164 | { |
| 165 | 165 | $oDB->addIndex( |
| 166 | 166 | "comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | //2012. 02. 24 add comment published status column and index |
| 171 | - if(!$oDB->isColumnExists("comments", "status")) |
|
| 171 | + if (!$oDB->isColumnExists("comments", "status")) |
|
| 172 | 172 | { |
| 173 | 173 | $oDB->addColumn("comments", "status", "number", 1, 1, TRUE); |
| 174 | 174 | } |
| 175 | - if(!$oDB->isIndexExists("comments", "idx_status")) |
|
| 175 | + if (!$oDB->isIndexExists("comments", "idx_status")) |
|
| 176 | 176 | { |
| 177 | 177 | $oDB->addIndex( |
| 178 | 178 | "comments", "idx_status", array("status", "comment_srl", "module_srl", "document_srl"), TRUE |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 183 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 183 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) |
|
| 184 | 184 | { |
| 185 | 185 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if(!$oDB->isIndexExists("comments", "idx_parent_srl")) |
|
| 188 | + if (!$oDB->isIndexExists("comments", "idx_parent_srl")) |
|
| 189 | 189 | { |
| 190 | 190 | $oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl')); |
| 191 | 191 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | function recompileCache() |
| 201 | 201 | { |
| 202 | - if(!is_dir('./files/cache/tmp')) |
|
| 202 | + if (!is_dir('./files/cache/tmp')) |
|
| 203 | 203 | { |
| 204 | 204 | FileHandler::makeDir('./files/cache/tmp'); |
| 205 | 205 | } |
@@ -18,48 +18,48 @@ discard block |
||
| 18 | 18 | function proc($args) |
| 19 | 19 | { |
| 20 | 20 | // Targets to sort |
| 21 | - if(!in_array($args->order_target, array('regdate','update_order'))) $args->order_target = 'regdate'; |
|
| 21 | + if (!in_array($args->order_target, array('regdate', 'update_order'))) $args->order_target = 'regdate'; |
|
| 22 | 22 | // Sort order |
| 23 | - if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc'; |
|
| 23 | + if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc'; |
|
| 24 | 24 | // Pages |
| 25 | - $args->page_count = (int)$args->page_count; |
|
| 26 | - if(!$args->page_count) $args->page_count = 1; |
|
| 25 | + $args->page_count = (int) $args->page_count; |
|
| 26 | + if (!$args->page_count) $args->page_count = 1; |
|
| 27 | 27 | // The number of displayed lists |
| 28 | - $args->list_count = (int)$args->list_count; |
|
| 29 | - if(!$args->list_count) $args->list_count = 5; |
|
| 28 | + $args->list_count = (int) $args->list_count; |
|
| 29 | + if (!$args->list_count) $args->list_count = 5; |
|
| 30 | 30 | // The number of thumbnail columns |
| 31 | - $args->cols_list_count = (int)$args->cols_list_count; |
|
| 32 | - if(!$args->cols_list_count) $args->cols_list_count = 5; |
|
| 31 | + $args->cols_list_count = (int) $args->cols_list_count; |
|
| 32 | + if (!$args->cols_list_count) $args->cols_list_count = 5; |
|
| 33 | 33 | // Cut the length of the title |
| 34 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
| 34 | + if (!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
| 35 | 35 | // Cut the length of contents |
| 36 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
| 36 | + if (!$args->content_cut_size) $args->content_cut_size = 100; |
|
| 37 | 37 | // Cut the length of nickname |
| 38 | - if(!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
| 38 | + if (!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
| 39 | 39 | // Display time of the latest post |
| 40 | - if(!$args->duration_new) $args->duration_new = 12; |
|
| 40 | + if (!$args->duration_new) $args->duration_new = 12; |
|
| 41 | 41 | // How to create thumbnails |
| 42 | - if(!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
| 42 | + if (!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
| 43 | 43 | // Horizontal size of thumbnails |
| 44 | - if(!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
| 44 | + if (!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
| 45 | 45 | // Vertical size of thumbnails |
| 46 | - if(!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
| 46 | + if (!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
| 47 | 47 | // Viewing options |
| 48 | - $args->option_view_arr = explode(',',$args->option_view); |
|
| 48 | + $args->option_view_arr = explode(',', $args->option_view); |
|
| 49 | 49 | // markup options |
| 50 | - if(!$args->markup_type) $args->markup_type = 'table'; |
|
| 50 | + if (!$args->markup_type) $args->markup_type = 'table'; |
|
| 51 | 51 | // Set variables used internally |
| 52 | 52 | $oModuleModel = getModel('module'); |
| 53 | 53 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
| 54 | 54 | $site_module_info = Context::get('site_module_info'); |
| 55 | 55 | // List URLs if a type is RSS |
| 56 | - if($args->content_type == 'rss') |
|
| 56 | + if ($args->content_type == 'rss') |
|
| 57 | 57 | { |
| 58 | 58 | $args->rss_urls = array(); |
| 59 | - $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
|
| 60 | - for($i=0,$c=count($rss_urls);$i<$c;$i++) |
|
| 59 | + $rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4)); |
|
| 60 | + for ($i = 0, $c = count($rss_urls); $i < $c; $i++) |
|
| 61 | 61 | { |
| 62 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
| 62 | + if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
| 63 | 63 | } |
| 64 | 64 | // Get module information after listing module_srls if the module is not RSS |
| 65 | 65 | } |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $obj = new stdClass(); |
| 69 | 69 | // Apply to all modules in the site if a target module is not specified |
| 70 | - if(!$args->module_srls) |
|
| 70 | + if (!$args->module_srls) |
|
| 71 | 71 | { |
| 72 | - $obj->site_srl = (int)$site_module_info->site_srl; |
|
| 72 | + $obj->site_srl = (int) $site_module_info->site_srl; |
|
| 73 | 73 | $output = executeQueryArray('widgets.content.getMids', $obj); |
| 74 | - if($output->data) |
|
| 74 | + if ($output->data) |
|
| 75 | 75 | { |
| 76 | - foreach($output->data as $key => $val) |
|
| 76 | + foreach ($output->data as $key => $val) |
|
| 77 | 77 | { |
| 78 | 78 | $args->modules_info[$val->mid] = $val; |
| 79 | 79 | $args->module_srls_info[$val->module_srl] = $val; |
@@ -89,35 +89,35 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $obj->module_srls = $args->module_srls; |
| 91 | 91 | $output = executeQueryArray('widgets.content.getMids', $obj); |
| 92 | - if($output->data) |
|
| 92 | + if ($output->data) |
|
| 93 | 93 | { |
| 94 | - foreach($output->data as $key => $val) |
|
| 94 | + foreach ($output->data as $key => $val) |
|
| 95 | 95 | { |
| 96 | 96 | $args->modules_info[$val->mid] = $val; |
| 97 | 97 | $args->module_srls_info[$val->module_srl] = $val; |
| 98 | 98 | $module_srls[] = $val->module_srl; |
| 99 | 99 | } |
| 100 | - $idx = explode(',',$args->module_srls); |
|
| 101 | - for($i=0,$c=count($idx);$i<$c;$i++) |
|
| 100 | + $idx = explode(',', $args->module_srls); |
|
| 101 | + for ($i = 0, $c = count($idx); $i < $c; $i++) |
|
| 102 | 102 | { |
| 103 | 103 | $srl = $idx[$i]; |
| 104 | - if(!$args->module_srls_info[$srl]) continue; |
|
| 104 | + if (!$args->module_srls_info[$srl]) continue; |
|
| 105 | 105 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | // Exit if no module is found |
| 110 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
| 111 | - $args->module_srl = implode(',',$module_srls); |
|
| 110 | + if (!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
| 111 | + $args->module_srl = implode(',', $module_srls); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist |
| 116 | 116 | */ |
| 117 | 117 | // tab type |
| 118 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
| 118 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
| 119 | 119 | { |
| 120 | - switch($args->content_type) |
|
| 120 | + switch ($args->content_type) |
|
| 121 | 121 | { |
| 122 | 122 | case 'comment': |
| 123 | 123 | $content_items = $this->_getCommentItems($args); |
@@ -141,17 +141,17 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | $content_items = array(); |
| 143 | 143 | |
| 144 | - switch($args->content_type) |
|
| 144 | + switch ($args->content_type) |
|
| 145 | 145 | { |
| 146 | 146 | case 'comment': |
| 147 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 147 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 148 | 148 | { |
| 149 | 149 | $args->module_srl = $module_srl; |
| 150 | 150 | $content_items[$module_srl] = $this->_getCommentItems($args); |
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | case 'image': |
| 154 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 154 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 155 | 155 | { |
| 156 | 156 | $args->module_srl = $module_srl; |
| 157 | 157 | $content_items[$module_srl] = $this->_getImageItems($args); |
@@ -161,14 +161,14 @@ discard block |
||
| 161 | 161 | $content_items = $this->getRssItems($args); |
| 162 | 162 | break; |
| 163 | 163 | case 'trackback': |
| 164 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 164 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 165 | 165 | { |
| 166 | 166 | $args->module_srl = $module_srl; |
| 167 | 167 | $content_items[$module_srl] = $this->_getTrackbackItems($args); |
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | 170 | default: |
| 171 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 171 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 172 | 172 | { |
| 173 | 173 | $args->module_srl = $module_srl; |
| 174 | 174 | $content_items[$module_srl] = $this->_getDocumentItems($args); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $output = $this->_compile($args,$content_items); |
|
| 180 | + $output = $this->_compile($args, $content_items); |
|
| 181 | 181 | return $output; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $content_items = array(); |
| 199 | 199 | |
| 200 | - if(!count($output)) return; |
|
| 200 | + if (!count($output)) return; |
|
| 201 | 201 | |
| 202 | - foreach($output as $key => $oComment) |
|
| 202 | + foreach ($output as $key => $oComment) |
|
| 203 | 203 | { |
| 204 | 204 | $attribute = $oComment->getObjectVars(); |
| 205 | 205 | $title = $oComment->getSummary($args->content_cut_size); |
| 206 | - $thumbnail = $oComment->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
| 207 | - $url = sprintf("%s#comment_%s",getUrl('','document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl')); |
|
| 206 | + $thumbnail = $oComment->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
| 207 | + $url = sprintf("%s#comment_%s", getUrl('', 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl')); |
|
| 208 | 208 | |
| 209 | 209 | $attribute->mid = $args->mid_lists[$attribute->module_srl]; |
| 210 | 210 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | // Get categories |
| 230 | 230 | $obj = new stdClass(); |
| 231 | 231 | $obj->module_srl = $args->module_srl; |
| 232 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 233 | - if($output->toBool() && $output->data) |
|
| 232 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 233 | + if ($output->toBool() && $output->data) |
|
| 234 | 234 | { |
| 235 | - foreach($output->data as $key => $val) |
|
| 235 | + foreach ($output->data as $key => $val) |
|
| 236 | 236 | { |
| 237 | 237 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 238 | 238 | } |
@@ -241,24 +241,24 @@ discard block |
||
| 241 | 241 | $obj->module_srl = $args->module_srl; |
| 242 | 242 | $obj->category_srl = $args->category_srl; |
| 243 | 243 | $obj->sort_index = $args->order_target; |
| 244 | - if($args->order_target == 'list_order' || $args->order_target == 'update_order') |
|
| 244 | + if ($args->order_target == 'list_order' || $args->order_target == 'update_order') |
|
| 245 | 245 | { |
| 246 | - $obj->order_type = $args->order_type=="desc"?"asc":"desc"; |
|
| 246 | + $obj->order_type = $args->order_type == "desc" ? "asc" : "desc"; |
|
| 247 | 247 | } |
| 248 | 248 | else |
| 249 | 249 | { |
| 250 | - $obj->order_type = $args->order_type=="desc"?"desc":"asc"; |
|
| 250 | + $obj->order_type = $args->order_type == "desc" ? "desc" : "asc"; |
|
| 251 | 251 | } |
| 252 | 252 | $obj->list_count = $args->list_count * $args->page_count; |
| 253 | 253 | $obj->statusList = array('PUBLIC'); |
| 254 | 254 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
| 255 | - if(!$output->toBool() || !$output->data) return; |
|
| 255 | + if (!$output->toBool() || !$output->data) return; |
|
| 256 | 256 | // If the result exists, make each document as an object |
| 257 | 257 | $content_items = array(); |
| 258 | 258 | $first_thumbnail_idx = -1; |
| 259 | - if(count($output->data)) |
|
| 259 | + if (count($output->data)) |
|
| 260 | 260 | { |
| 261 | - foreach($output->data as $key => $attribute) |
|
| 261 | + foreach ($output->data as $key => $attribute) |
|
| 262 | 262 | { |
| 263 | 263 | $oDocument = new documentItem(); |
| 264 | 264 | $oDocument->setAttribute($attribute, false); |
@@ -267,26 +267,26 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | $oDocumentModel->setToAllDocumentExtraVars(); |
| 269 | 269 | |
| 270 | - for($i=0,$c=count($document_srls);$i<$c;$i++) |
|
| 270 | + for ($i = 0, $c = count($document_srls); $i < $c; $i++) |
|
| 271 | 271 | { |
| 272 | 272 | $oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]]; |
| 273 | 273 | $document_srl = $oDocument->document_srl; |
| 274 | 274 | $module_srl = $oDocument->get('module_srl'); |
| 275 | 275 | $category_srl = $oDocument->get('category_srl'); |
| 276 | - $thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
| 276 | + $thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
| 277 | 277 | |
| 278 | - $content_item = new contentItem( $args->module_srls_info[$module_srl]->browser_title ); |
|
| 278 | + $content_item = new contentItem($args->module_srls_info[$module_srl]->browser_title); |
|
| 279 | 279 | $content_item->adds($oDocument->getObjectVars()); |
| 280 | 280 | $content_item->add('original_content', $oDocument->get('content')); |
| 281 | 281 | $content_item->setTitle($oDocument->getTitleText()); |
| 282 | - $content_item->setCategory( $category_lists[$module_srl][$category_srl]->title ); |
|
| 283 | - $content_item->setDomain( $args->module_srls_info[$module_srl]->domain ); |
|
| 282 | + $content_item->setCategory($category_lists[$module_srl][$category_srl]->title); |
|
| 283 | + $content_item->setDomain($args->module_srls_info[$module_srl]->domain); |
|
| 284 | 284 | $content_item->setContent($oDocument->getSummary($args->content_cut_size)); |
| 285 | - $content_item->setLink( getSiteUrl($domain,'','document_srl',$document_srl) ); |
|
| 285 | + $content_item->setLink(getSiteUrl($domain, '', 'document_srl', $document_srl)); |
|
| 286 | 286 | $content_item->setThumbnail($thumbnail); |
| 287 | 287 | $content_item->setExtraImages($oDocument->printExtraImages($args->duration_new * 60 * 60)); |
| 288 | 288 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
| 289 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
| 289 | + if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i; |
|
| 290 | 290 | $content_items[] = $content_item; |
| 291 | 291 | } |
| 292 | 292 | |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | $obj->direct_download = 'Y'; |
| 308 | 308 | $obj->isvalid = 'Y'; |
| 309 | 309 | // Get categories |
| 310 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 311 | - if($output->toBool() && $output->data) |
|
| 310 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 311 | + if ($output->toBool() && $output->data) |
|
| 312 | 312 | { |
| 313 | - foreach($output->data as $key => $val) |
|
| 313 | + foreach ($output->data as $key => $val) |
|
| 314 | 314 | { |
| 315 | 315 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 316 | 316 | } |
@@ -319,25 +319,25 @@ discard block |
||
| 319 | 319 | $obj->list_count = $args->list_count * $args->page_count; |
| 320 | 320 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
| 321 | 321 | $files_count = count($files_output->data); |
| 322 | - if(!$files_count) return; |
|
| 322 | + if (!$files_count) return; |
|
| 323 | 323 | |
| 324 | 324 | $content_items = array(); |
| 325 | 325 | |
| 326 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 326 | + for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 327 | 327 | |
| 328 | 328 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
| 329 | 329 | |
| 330 | - if(!count($tmp_document_list)) return; |
|
| 330 | + if (!count($tmp_document_list)) return; |
|
| 331 | 331 | |
| 332 | - foreach($tmp_document_list as $oDocument) |
|
| 332 | + foreach ($tmp_document_list as $oDocument) |
|
| 333 | 333 | { |
| 334 | 334 | $attribute = $oDocument->getObjectVars(); |
| 335 | 335 | $browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title; |
| 336 | 336 | $domain = $args->module_srls_info[$attribute->module_srl]->domain; |
| 337 | 337 | $category = $category_lists[$attribute->module_srl]->text; |
| 338 | 338 | $content = $oDocument->getSummary($args->content_cut_size); |
| 339 | - $url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount()); |
|
| 340 | - $thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type); |
|
| 339 | + $url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount()); |
|
| 340 | + $thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type); |
|
| 341 | 341 | $extra_images = $oDocument->printExtraImages($args->duration_new); |
| 342 | 342 | |
| 343 | 343 | $content_item = new contentItem($browser_title); |
@@ -360,11 +360,11 @@ discard block |
||
| 360 | 360 | $content_items = array(); |
| 361 | 361 | $args->mid_lists = array(); |
| 362 | 362 | |
| 363 | - foreach($args->rss_urls as $key => $rss) |
|
| 363 | + foreach ($args->rss_urls as $key => $rss) |
|
| 364 | 364 | { |
| 365 | 365 | $args->rss_url = $rss; |
| 366 | 366 | $content_item = $this->_getRssItems($args); |
| 367 | - if(count($content_item) > 0) |
|
| 367 | + if (count($content_item) > 0) |
|
| 368 | 368 | { |
| 369 | 369 | $browser_title = $content_item[0]->getBrowserTitle(); |
| 370 | 370 | $args->mid_lists[] = $browser_title; |
@@ -372,37 +372,37 @@ discard block |
||
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | // If it is not a tab type |
| 375 | - if($args->tab_type == 'none' || $args->tab_type == '') |
|
| 375 | + if ($args->tab_type == 'none' || $args->tab_type == '') |
|
| 376 | 376 | { |
| 377 | 377 | $items = array(); |
| 378 | - foreach($content_items as $key => $val) |
|
| 378 | + foreach ($content_items as $key => $val) |
|
| 379 | 379 | { |
| 380 | - foreach($val as $k => $v) |
|
| 380 | + foreach ($val as $k => $v) |
|
| 381 | 381 | { |
| 382 | 382 | $date = $v->get('regdate'); |
| 383 | - $i=0; |
|
| 384 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
| 385 | - $items[sprintf('%s%02d',$date,$i)] = $v; |
|
| 383 | + $i = 0; |
|
| 384 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
| 385 | + $items[sprintf('%s%02d', $date, $i)] = $v; |
|
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | - if($args->order_type =='asc') ksort($items); |
|
| 388 | + if ($args->order_type == 'asc') ksort($items); |
|
| 389 | 389 | else krsort($items); |
| 390 | - $content_items = array_slice(array_values($items),0,$args->list_count*$args->page_count); |
|
| 390 | + $content_items = array_slice(array_values($items), 0, $args->list_count * $args->page_count); |
|
| 391 | 391 | // Tab Type |
| 392 | 392 | } |
| 393 | 393 | else |
| 394 | 394 | { |
| 395 | - foreach($content_items as $key=> $content_item_list) |
|
| 395 | + foreach ($content_items as $key=> $content_item_list) |
|
| 396 | 396 | { |
| 397 | 397 | $items = array(); |
| 398 | - foreach($content_item_list as $k => $content_item) |
|
| 398 | + foreach ($content_item_list as $k => $content_item) |
|
| 399 | 399 | { |
| 400 | 400 | $date = $content_item->get('regdate'); |
| 401 | - $i=0; |
|
| 402 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
| 403 | - $items[sprintf('%s%02d',$date,$i)] = $content_item; |
|
| 401 | + $i = 0; |
|
| 402 | + while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++; |
|
| 403 | + $items[sprintf('%s%02d', $date, $i)] = $content_item; |
|
| 404 | 404 | } |
| 405 | - if($args->order_type =='asc') ksort($items); |
|
| 405 | + if ($args->order_type == 'asc') ksort($items); |
|
| 406 | 406 | else krsort($items); |
| 407 | 407 | |
| 408 | 408 | $content_items[$key] = array_values($items); |
@@ -413,19 +413,19 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | function _getRssBody($value) |
| 415 | 415 | { |
| 416 | - if(!$value || is_string($value)) return $value; |
|
| 417 | - if(is_object($value)) $value = get_object_vars($value); |
|
| 416 | + if (!$value || is_string($value)) return $value; |
|
| 417 | + if (is_object($value)) $value = get_object_vars($value); |
|
| 418 | 418 | $body = null; |
| 419 | - if(!count($value)) return; |
|
| 420 | - foreach($value as $key => $val) |
|
| 419 | + if (!count($value)) return; |
|
| 420 | + foreach ($value as $key => $val) |
|
| 421 | 421 | { |
| 422 | - if($key == 'body') |
|
| 422 | + if ($key == 'body') |
|
| 423 | 423 | { |
| 424 | 424 | $body = $val; |
| 425 | 425 | continue; |
| 426 | 426 | } |
| 427 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
| 428 | - if($body !== null) return $body; |
|
| 427 | + if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val); |
|
| 428 | + if ($body !== null) return $body; |
|
| 429 | 429 | } |
| 430 | 430 | return $body; |
| 431 | 431 | } |
@@ -436,17 +436,17 @@ discard block |
||
| 436 | 436 | // Replace tags such as </p> , </div> , </li> and others to a whitespace |
| 437 | 437 | $content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content); |
| 438 | 438 | // Remove Tag |
| 439 | - $content = preg_replace('!<([^>]*?)>!is','', $content); |
|
| 439 | + $content = preg_replace('!<([^>]*?)>!is', '', $content); |
|
| 440 | 440 | // Replace tags to <, >, " and whitespace |
| 441 | - $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); |
|
| 441 | + $content = str_replace(array('<', '>', '"', ' '), array('<', '>', '"', ' '), $content); |
|
| 442 | 442 | // Delete a series of whitespaces |
| 443 | 443 | $content = preg_replace('/ ( +)/is', ' ', $content); |
| 444 | 444 | // Truncate string |
| 445 | 445 | $content = trim(cut_str($content, $str_size, $tail)); |
| 446 | 446 | // Replace back <, >, " to the original tags |
| 447 | - $content = str_replace(array('<','>','"'),array('<','>','"'), $content); |
|
| 447 | + $content = str_replace(array('<', '>', '"'), array('<', '>', '"'), $content); |
|
| 448 | 448 | // Fixed to a newline bug for consecutive sets of English letters |
| 449 | - $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content); |
|
| 449 | + $content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content); |
|
| 450 | 450 | return $content; |
| 451 | 451 | } |
| 452 | 452 | |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | function requestFeedContents($rss_url) |
| 458 | 458 | { |
| 459 | - $rss_url = str_replace('&','&',Context::convertEncodingStr($rss_url)); |
|
| 459 | + $rss_url = str_replace('&', '&', Context::convertEncodingStr($rss_url)); |
|
| 460 | 460 | return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml'); |
| 461 | 461 | } |
| 462 | 462 | |
@@ -468,51 +468,51 @@ discard block |
||
| 468 | 468 | $buff = $this->requestFeedContents($args->rss_url); |
| 469 | 469 | |
| 470 | 470 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
| 471 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
| 471 | + if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
| 472 | 472 | |
| 473 | 473 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
| 474 | 474 | |
| 475 | 475 | $oXmlParser = new XmlParser(); |
| 476 | 476 | $xml_doc = $oXmlParser->parse($buff); |
| 477 | - if($xml_doc->rss) |
|
| 477 | + if ($xml_doc->rss) |
|
| 478 | 478 | { |
| 479 | 479 | $rss->title = $xml_doc->rss->channel->title->body; |
| 480 | 480 | $rss->link = $xml_doc->rss->channel->link->body; |
| 481 | 481 | |
| 482 | 482 | $items = $xml_doc->rss->channel->item; |
| 483 | 483 | |
| 484 | - if(!$items) return; |
|
| 485 | - if($items && !is_array($items)) $items = array($items); |
|
| 484 | + if (!$items) return; |
|
| 485 | + if ($items && !is_array($items)) $items = array($items); |
|
| 486 | 486 | |
| 487 | 487 | $content_items = array(); |
| 488 | 488 | |
| 489 | 489 | foreach ($items as $key => $value) |
| 490 | 490 | { |
| 491 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 491 | + if ($key >= $args->list_count * $args->page_count) break; |
|
| 492 | 492 | unset($item); |
| 493 | 493 | |
| 494 | - foreach($value as $key2 => $value2) |
|
| 494 | + foreach ($value as $key2 => $value2) |
|
| 495 | 495 | { |
| 496 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 496 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 497 | 497 | $item->{$key2} = $this->_getRssBody($value2); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | $content_item = new contentItem($rss->title); |
| 501 | 501 | $content_item->setContentsLink($rss->link); |
| 502 | 502 | $content_item->setTitle($item->title); |
| 503 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 503 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 504 | 504 | //$content_item->setCategory($item->category); |
| 505 | - $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description); |
|
| 505 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description); |
|
| 506 | 506 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 507 | 507 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
| 508 | 508 | $content_item->setLink($item->link); |
| 509 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
| 509 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
| 510 | 510 | $content_item->setRegdate($date); |
| 511 | 511 | |
| 512 | 512 | $content_items[] = $content_item; |
| 513 | 513 | } |
| 514 | 514 | } |
| 515 | - else if($xml_doc->{'rdf:rdf'}) |
|
| 515 | + else if ($xml_doc->{'rdf:rdf'}) |
|
| 516 | 516 | { |
| 517 | 517 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters. Fixed by misol |
| 518 | 518 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -520,102 +520,102 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $items = $xml_doc->{'rdf:rdf'}->item; |
| 522 | 522 | |
| 523 | - if(!$items) return; |
|
| 524 | - if($items && !is_array($items)) $items = array($items); |
|
| 523 | + if (!$items) return; |
|
| 524 | + if ($items && !is_array($items)) $items = array($items); |
|
| 525 | 525 | |
| 526 | 526 | $content_items = array(); |
| 527 | 527 | |
| 528 | 528 | foreach ($items as $key => $value) |
| 529 | 529 | { |
| 530 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 530 | + if ($key >= $args->list_count * $args->page_count) break; |
|
| 531 | 531 | unset($item); |
| 532 | 532 | |
| 533 | - foreach($value as $key2 => $value2) |
|
| 533 | + foreach ($value as $key2 => $value2) |
|
| 534 | 534 | { |
| 535 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 535 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 536 | 536 | $item->{$key2} = $this->_getRssBody($value2); |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | $content_item = new contentItem($rss->title); |
| 540 | 540 | $content_item->setContentsLink($rss->link); |
| 541 | 541 | $content_item->setTitle($item->title); |
| 542 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 542 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 543 | 543 | //$content_item->setCategory($item->category); |
| 544 | - $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description); |
|
| 544 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description); |
|
| 545 | 545 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 546 | 546 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
| 547 | 547 | $content_item->setLink($item->link); |
| 548 | - $date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'}))); |
|
| 548 | + $date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'}))); |
|
| 549 | 549 | $content_item->setRegdate($date); |
| 550 | 550 | |
| 551 | 551 | $content_items[] = $content_item; |
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 554 | + else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 555 | 555 | { |
| 556 | 556 | // Atom 1.0 spec supported by misol |
| 557 | 557 | $rss->title = $xml_doc->feed->title->body; |
| 558 | 558 | $links = $xml_doc->feed->link; |
| 559 | - if(is_array($links)) |
|
| 559 | + if (is_array($links)) |
|
| 560 | 560 | { |
| 561 | 561 | foreach ($links as $value) |
| 562 | 562 | { |
| 563 | - if($value->attrs->rel == 'alternate') |
|
| 563 | + if ($value->attrs->rel == 'alternate') |
|
| 564 | 564 | { |
| 565 | 565 | $rss->link = $value->attrs->href; |
| 566 | 566 | break; |
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
| 570 | + else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
| 571 | 571 | |
| 572 | 572 | $items = $xml_doc->feed->entry; |
| 573 | 573 | |
| 574 | - if(!$items) return; |
|
| 575 | - if($items && !is_array($items)) $items = array($items); |
|
| 574 | + if (!$items) return; |
|
| 575 | + if ($items && !is_array($items)) $items = array($items); |
|
| 576 | 576 | |
| 577 | 577 | $content_items = array(); |
| 578 | 578 | |
| 579 | 579 | foreach ($items as $key => $value) |
| 580 | 580 | { |
| 581 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 581 | + if ($key >= $args->list_count * $args->page_count) break; |
|
| 582 | 582 | unset($item); |
| 583 | 583 | |
| 584 | - foreach($value as $key2 => $value2) |
|
| 584 | + foreach ($value as $key2 => $value2) |
|
| 585 | 585 | { |
| 586 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 586 | + if (is_array($value2)) $value2 = array_shift($value2); |
|
| 587 | 587 | $item->{$key2} = $this->_getRssBody($value2); |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | $content_item = new contentItem($rss->title); |
| 591 | 591 | $links = $value->link; |
| 592 | - if(is_array($links)) |
|
| 592 | + if (is_array($links)) |
|
| 593 | 593 | { |
| 594 | 594 | foreach ($links as $val) |
| 595 | 595 | { |
| 596 | - if($val->attrs->rel == 'alternate') |
|
| 596 | + if ($val->attrs->rel == 'alternate') |
|
| 597 | 597 | { |
| 598 | 598 | $item->link = $val->attrs->href; |
| 599 | 599 | break; |
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
| 603 | + else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
| 604 | 604 | |
| 605 | 605 | $content_item->setContentsLink($rss->link); |
| 606 | - if($item->title) |
|
| 606 | + if ($item->title) |
|
| 607 | 607 | { |
| 608 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
| 608 | + if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
| 609 | 609 | } |
| 610 | 610 | $content_item->setTitle($item->title); |
| 611 | - $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
|
| 611 | + $content_item->setNickName(max($item->author, $item->{'dc:creator'})); |
|
| 612 | 612 | $content_item->setAuthorSite($value->author->uri->body); |
| 613 | 613 | |
| 614 | 614 | //$content_item->setCategory($item->category); |
| 615 | 615 | $item->description = ($item->content) ? $item->content : $item->description = $item->summary; |
| 616 | - $item->description = preg_replace('!<a href=!is','<a onclick="window.open(this.href);return false" href=', $item->description); |
|
| 616 | + $item->description = preg_replace('!<a href=!is', '<a onclick="window.open(this.href);return false" href=', $item->description); |
|
| 617 | 617 | |
| 618 | - if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
| 618 | + if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE)) |
|
| 619 | 619 | { |
| 620 | 620 | $item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 621 | 621 | |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $content_item->setContent($this->_getSummary($item->description, $args->content_cut_size)); |
| 625 | 625 | $content_item->setThumbnail($this->_getRssThumbnail($item->description)); |
| 626 | 626 | $content_item->setLink($item->link); |
| 627 | - $date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'}))); |
|
| 627 | + $date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'}))); |
|
| 628 | 628 | $content_item->setRegdate($date); |
| 629 | 629 | |
| 630 | 630 | $content_items[] = $content_item; |
@@ -637,15 +637,15 @@ discard block |
||
| 637 | 637 | { |
| 638 | 638 | @preg_match('@<img[^>]+src\s*=\s*(?:"(.+)"|\'(.+)\'|([^\s>(?:/>)]+))@', $content, $matches); |
| 639 | 639 | |
| 640 | - if($matches[1]) |
|
| 640 | + if ($matches[1]) |
|
| 641 | 641 | { |
| 642 | 642 | return $matches[1]; |
| 643 | 643 | } |
| 644 | - elseif($matches[2]) |
|
| 644 | + elseif ($matches[2]) |
|
| 645 | 645 | { |
| 646 | 646 | return $matches[2]; |
| 647 | 647 | } |
| 648 | - elseif($matches[3]) |
|
| 648 | + elseif ($matches[3]) |
|
| 649 | 649 | { |
| 650 | 650 | return $matches[3]; |
| 651 | 651 | } |
@@ -658,17 +658,17 @@ discard block |
||
| 658 | 658 | function _getTrackbackItems($args) |
| 659 | 659 | { |
| 660 | 660 | $oTrackbackModel = getModel('trackback'); |
| 661 | - if(!$oTrackbackModel) |
|
| 661 | + if (!$oTrackbackModel) |
|
| 662 | 662 | { |
| 663 | 663 | return; |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | $obj = new stdClass; |
| 667 | 667 | // Get categories |
| 668 | - $output = executeQueryArray('widgets.content.getCategories',$obj); |
|
| 669 | - if($output->toBool() && $output->data) |
|
| 668 | + $output = executeQueryArray('widgets.content.getCategories', $obj); |
|
| 669 | + if ($output->toBool() && $output->data) |
|
| 670 | 670 | { |
| 671 | - foreach($output->data as $key => $val) |
|
| 671 | + foreach ($output->data as $key => $val) |
|
| 672 | 672 | { |
| 673 | 673 | $category_lists[$val->module_srl][$val->category_srl] = $val; |
| 674 | 674 | } |
@@ -681,14 +681,14 @@ discard block |
||
| 681 | 681 | // Get model object from the trackback module and execute getTrackbackList() method |
| 682 | 682 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
| 683 | 683 | // If an error occurs, just ignore it. |
| 684 | - if(!$output->toBool() || !$output->data) return; |
|
| 684 | + if (!$output->toBool() || !$output->data) return; |
|
| 685 | 685 | // If the result exists, make each document as an object |
| 686 | 686 | $content_items = array(); |
| 687 | - foreach($output->data as $key => $item) |
|
| 687 | + foreach ($output->data as $key => $item) |
|
| 688 | 688 | { |
| 689 | 689 | $domain = $args->module_srls_info[$item->module_srl]->domain; |
| 690 | 690 | $category = $category_lists[$item->module_srl]->text; |
| 691 | - $url = getSiteUrl($domain,'','document_srl',$item->document_srl); |
|
| 691 | + $url = getSiteUrl($domain, '', 'document_srl', $item->document_srl); |
|
| 692 | 692 | $browser_title = $args->module_srls_info[$item->module_srl]->browser_title; |
| 693 | 693 | |
| 694 | 694 | $content_item = new contentItem($browser_title); |
@@ -696,8 +696,8 @@ discard block |
||
| 696 | 696 | $content_item->setTitle($item->title); |
| 697 | 697 | $content_item->setCategory($category); |
| 698 | 698 | $content_item->setNickName($item->blog_name); |
| 699 | - $content_item->setContent($item->excerpt); ///<< |
|
| 700 | - $content_item->setDomain($domain); ///<< |
|
| 699 | + $content_item->setContent($item->excerpt); ///<< |
|
| 700 | + $content_item->setDomain($domain); ///<< |
|
| 701 | 701 | $content_item->setLink($url); |
| 702 | 702 | $content_item->add('mid', $args->mid_lists[$item->module_srl]); |
| 703 | 703 | $content_item->setRegdate($item->regdate); |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | return $content_items; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - function _compile($args,$content_items) |
|
| 709 | + function _compile($args, $content_items) |
|
| 710 | 710 | { |
| 711 | 711 | $oTemplate = &TemplateHandler::getInstance(); |
| 712 | 712 | // Set variables for widget |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | $widget_info->nickname_cut_size = $args->nickname_cut_size; |
| 721 | 721 | $widget_info->new_window = $args->new_window; |
| 722 | 722 | |
| 723 | - $widget_info->duration_new = $args->duration_new * 60*60; |
|
| 723 | + $widget_info->duration_new = $args->duration_new * 60 * 60; |
|
| 724 | 724 | $widget_info->thumbnail_type = $args->thumbnail_type; |
| 725 | 725 | $widget_info->thumbnail_width = $args->thumbnail_width; |
| 726 | 726 | $widget_info->thumbnail_height = $args->thumbnail_height; |
@@ -738,12 +738,12 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | $widget_info->markup_type = $args->markup_type; |
| 740 | 740 | // If it is a tab type, list up tab items and change key value(module_srl) to index |
| 741 | - if($args->tab_type != 'none' && $args->tab_type) |
|
| 741 | + if ($args->tab_type != 'none' && $args->tab_type) |
|
| 742 | 742 | { |
| 743 | 743 | $tab = array(); |
| 744 | - foreach($args->mid_lists as $module_srl => $mid) |
|
| 744 | + foreach ($args->mid_lists as $module_srl => $mid) |
|
| 745 | 745 | { |
| 746 | - if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
| 746 | + if (!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
| 747 | 747 | |
| 748 | 748 | unset($tab_item); |
| 749 | 749 | $tab_item = new stdClass(); |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $tab_item->content_items = $content_items[$module_srl]; |
| 752 | 752 | $tab_item->domain = $content_items[$module_srl][0]->getDomain(); |
| 753 | 753 | $tab_item->url = $content_items[$module_srl][0]->getContentsLink(); |
| 754 | - if(!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid); |
|
| 754 | + if (!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '', 'mid', $mid); |
|
| 755 | 755 | $tab[] = $tab_item; |
| 756 | 756 | } |
| 757 | 757 | $widget_info->tab = $tab; |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | var $contents_link = null; |
| 780 | 780 | var $domain = null; |
| 781 | 781 | |
| 782 | - function contentItem($browser_title='') |
|
| 782 | + function contentItem($browser_title = '') |
|
| 783 | 783 | { |
| 784 | 784 | $this->browser_title = $browser_title; |
| 785 | 785 | } |
@@ -789,22 +789,22 @@ discard block |
||
| 789 | 789 | } |
| 790 | 790 | function setFirstThumbnailIdx($first_thumbnail_idx) |
| 791 | 791 | { |
| 792 | - if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1) |
|
| 792 | + if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1) |
|
| 793 | 793 | { |
| 794 | 794 | $this->has_first_thumbnail_idx = true; |
| 795 | - $this->first_thumbnail_idx= $first_thumbnail_idx; |
|
| 795 | + $this->first_thumbnail_idx = $first_thumbnail_idx; |
|
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | 798 | function setExtraImages($extra_images) |
| 799 | 799 | { |
| 800 | - $this->add('extra_images',$extra_images); |
|
| 800 | + $this->add('extra_images', $extra_images); |
|
| 801 | 801 | } |
| 802 | 802 | function setDomain($domain) |
| 803 | 803 | { |
| 804 | 804 | static $default_domain = null; |
| 805 | - if(!$domain) |
|
| 805 | + if (!$domain) |
|
| 806 | 806 | { |
| 807 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
| 807 | + if (is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
| 808 | 808 | $domain = $default_domain; |
| 809 | 809 | } |
| 810 | 810 | $this->domain = $domain; |
@@ -868,17 +868,17 @@ discard block |
||
| 868 | 868 | { |
| 869 | 869 | return $this->get('module_srl'); |
| 870 | 870 | } |
| 871 | - function getTitle($cut_size = 0, $tail='...') |
|
| 871 | + function getTitle($cut_size = 0, $tail = '...') |
|
| 872 | 872 | { |
| 873 | 873 | $title = htmlspecialchars($this->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 874 | 874 | |
| 875 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
| 875 | + if ($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
| 876 | 876 | |
| 877 | 877 | $attrs = array(); |
| 878 | - if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
| 879 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 878 | + if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
| 879 | + if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 880 | 880 | |
| 881 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
| 881 | + if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
| 882 | 882 | |
| 883 | 883 | return $title; |
| 884 | 884 | } |
@@ -890,9 +890,9 @@ discard block |
||
| 890 | 890 | { |
| 891 | 891 | return $this->get('category'); |
| 892 | 892 | } |
| 893 | - function getNickName($cut_size = 0, $tail='...') |
|
| 893 | + function getNickName($cut_size = 0, $tail = '...') |
|
| 894 | 894 | { |
| 895 | - if($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
| 895 | + if ($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
| 896 | 896 | else $nick_name = $this->get('nick_name'); |
| 897 | 897 | |
| 898 | 898 | return $nick_name; |
@@ -904,12 +904,12 @@ discard block |
||
| 904 | 904 | function getCommentCount() |
| 905 | 905 | { |
| 906 | 906 | $comment_count = $this->get('comment_count'); |
| 907 | - return $comment_count>0 ? $comment_count : ''; |
|
| 907 | + return $comment_count > 0 ? $comment_count : ''; |
|
| 908 | 908 | } |
| 909 | 909 | function getTrackbackCount() |
| 910 | 910 | { |
| 911 | 911 | $trackback_count = $this->get('trackback_count'); |
| 912 | - return $trackback_count>0 ? $trackback_count : ''; |
|
| 912 | + return $trackback_count > 0 ? $trackback_count : ''; |
|
| 913 | 913 | } |
| 914 | 914 | function getRegdate($format = 'Y.m.d H:i:s') |
| 915 | 915 | { |
@@ -18,36 +18,62 @@ discard block |
||
| 18 | 18 | function proc($args) |
| 19 | 19 | { |
| 20 | 20 | // Targets to sort |
| 21 | - if(!in_array($args->order_target, array('regdate','update_order'))) $args->order_target = 'regdate'; |
|
| 21 | + if(!in_array($args->order_target, array('regdate','update_order'))) { |
|
| 22 | + $args->order_target = 'regdate'; |
|
| 23 | + } |
|
| 22 | 24 | // Sort order |
| 23 | - if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc'; |
|
| 25 | + if(!in_array($args->order_type, array('asc','desc'))) { |
|
| 26 | + $args->order_type = 'asc'; |
|
| 27 | + } |
|
| 24 | 28 | // Pages |
| 25 | 29 | $args->page_count = (int)$args->page_count; |
| 26 | - if(!$args->page_count) $args->page_count = 1; |
|
| 30 | + if(!$args->page_count) { |
|
| 31 | + $args->page_count = 1; |
|
| 32 | + } |
|
| 27 | 33 | // The number of displayed lists |
| 28 | 34 | $args->list_count = (int)$args->list_count; |
| 29 | - if(!$args->list_count) $args->list_count = 5; |
|
| 35 | + if(!$args->list_count) { |
|
| 36 | + $args->list_count = 5; |
|
| 37 | + } |
|
| 30 | 38 | // The number of thumbnail columns |
| 31 | 39 | $args->cols_list_count = (int)$args->cols_list_count; |
| 32 | - if(!$args->cols_list_count) $args->cols_list_count = 5; |
|
| 40 | + if(!$args->cols_list_count) { |
|
| 41 | + $args->cols_list_count = 5; |
|
| 42 | + } |
|
| 33 | 43 | // Cut the length of the title |
| 34 | - if(!$args->subject_cut_size) $args->subject_cut_size = 0; |
|
| 44 | + if(!$args->subject_cut_size) { |
|
| 45 | + $args->subject_cut_size = 0; |
|
| 46 | + } |
|
| 35 | 47 | // Cut the length of contents |
| 36 | - if(!$args->content_cut_size) $args->content_cut_size = 100; |
|
| 48 | + if(!$args->content_cut_size) { |
|
| 49 | + $args->content_cut_size = 100; |
|
| 50 | + } |
|
| 37 | 51 | // Cut the length of nickname |
| 38 | - if(!$args->nickname_cut_size) $args->nickname_cut_size = 0; |
|
| 52 | + if(!$args->nickname_cut_size) { |
|
| 53 | + $args->nickname_cut_size = 0; |
|
| 54 | + } |
|
| 39 | 55 | // Display time of the latest post |
| 40 | - if(!$args->duration_new) $args->duration_new = 12; |
|
| 56 | + if(!$args->duration_new) { |
|
| 57 | + $args->duration_new = 12; |
|
| 58 | + } |
|
| 41 | 59 | // How to create thumbnails |
| 42 | - if(!$args->thumbnail_type) $args->thumbnail_type = 'crop'; |
|
| 60 | + if(!$args->thumbnail_type) { |
|
| 61 | + $args->thumbnail_type = 'crop'; |
|
| 62 | + } |
|
| 43 | 63 | // Horizontal size of thumbnails |
| 44 | - if(!$args->thumbnail_width) $args->thumbnail_width = 100; |
|
| 64 | + if(!$args->thumbnail_width) { |
|
| 65 | + $args->thumbnail_width = 100; |
|
| 66 | + } |
|
| 45 | 67 | // Vertical size of thumbnails |
| 46 | - if(!$args->thumbnail_height) $args->thumbnail_height = 75; |
|
| 68 | + if(!$args->thumbnail_height) { |
|
| 69 | + $args->thumbnail_height = 75; |
|
| 70 | + } |
|
| 47 | 71 | // Viewing options |
| 48 | 72 | $args->option_view_arr = explode(',',$args->option_view); |
| 49 | 73 | // markup options |
| 50 | - if(!$args->markup_type) $args->markup_type = 'table'; |
|
| 74 | + if(!$args->markup_type) { |
|
| 75 | + $args->markup_type = 'table'; |
|
| 76 | + } |
|
| 51 | 77 | // Set variables used internally |
| 52 | 78 | $oModuleModel = getModel('module'); |
| 53 | 79 | $module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array(); |
@@ -59,11 +85,12 @@ discard block |
||
| 59 | 85 | $rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4)); |
| 60 | 86 | for($i=0,$c=count($rss_urls);$i<$c;$i++) |
| 61 | 87 | { |
| 62 | - if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i]; |
|
| 88 | + if($rss_urls[$i]) { |
|
| 89 | + $args->rss_urls[] = $rss_urls[$i]; |
|
| 90 | + } |
|
| 63 | 91 | } |
| 64 | 92 | // Get module information after listing module_srls if the module is not RSS |
| 65 | - } |
|
| 66 | - else |
|
| 93 | + } else |
|
| 67 | 94 | { |
| 68 | 95 | $obj = new stdClass(); |
| 69 | 96 | // Apply to all modules in the site if a target module is not specified |
@@ -84,8 +111,7 @@ discard block |
||
| 84 | 111 | |
| 85 | 112 | $args->modules_info = $oModuleModel->getMidList($obj); |
| 86 | 113 | // Apply to the module only if a target module is specified |
| 87 | - } |
|
| 88 | - else |
|
| 114 | + } else |
|
| 89 | 115 | { |
| 90 | 116 | $obj->module_srls = $args->module_srls; |
| 91 | 117 | $output = executeQueryArray('widgets.content.getMids', $obj); |
@@ -101,13 +127,17 @@ discard block |
||
| 101 | 127 | for($i=0,$c=count($idx);$i<$c;$i++) |
| 102 | 128 | { |
| 103 | 129 | $srl = $idx[$i]; |
| 104 | - if(!$args->module_srls_info[$srl]) continue; |
|
| 130 | + if(!$args->module_srls_info[$srl]) { |
|
| 131 | + continue; |
|
| 132 | + } |
|
| 105 | 133 | $args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid; |
| 106 | 134 | } |
| 107 | 135 | } |
| 108 | 136 | } |
| 109 | 137 | // Exit if no module is found |
| 110 | - if(!count($args->modules_info)) return Context::get('msg_not_founded'); |
|
| 138 | + if(!count($args->modules_info)) { |
|
| 139 | + return Context::get('msg_not_founded'); |
|
| 140 | + } |
|
| 111 | 141 | $args->module_srl = implode(',',$module_srls); |
| 112 | 142 | } |
| 113 | 143 | |
@@ -136,8 +166,7 @@ discard block |
||
| 136 | 166 | break; |
| 137 | 167 | } |
| 138 | 168 | // If not a tab type |
| 139 | - } |
|
| 140 | - else |
|
| 169 | + } else |
|
| 141 | 170 | { |
| 142 | 171 | $content_items = array(); |
| 143 | 172 | |
@@ -197,7 +226,9 @@ discard block |
||
| 197 | 226 | |
| 198 | 227 | $content_items = array(); |
| 199 | 228 | |
| 200 | - if(!count($output)) return; |
|
| 229 | + if(!count($output)) { |
|
| 230 | + return; |
|
| 231 | + } |
|
| 201 | 232 | |
| 202 | 233 | foreach($output as $key => $oComment) |
| 203 | 234 | { |
@@ -244,15 +275,16 @@ discard block |
||
| 244 | 275 | if($args->order_target == 'list_order' || $args->order_target == 'update_order') |
| 245 | 276 | { |
| 246 | 277 | $obj->order_type = $args->order_type=="desc"?"asc":"desc"; |
| 247 | - } |
|
| 248 | - else |
|
| 278 | + } else |
|
| 249 | 279 | { |
| 250 | 280 | $obj->order_type = $args->order_type=="desc"?"desc":"asc"; |
| 251 | 281 | } |
| 252 | 282 | $obj->list_count = $args->list_count * $args->page_count; |
| 253 | 283 | $obj->statusList = array('PUBLIC'); |
| 254 | 284 | $output = executeQueryArray('widgets.content.getNewestDocuments', $obj); |
| 255 | - if(!$output->toBool() || !$output->data) return; |
|
| 285 | + if(!$output->toBool() || !$output->data) { |
|
| 286 | + return; |
|
| 287 | + } |
|
| 256 | 288 | // If the result exists, make each document as an object |
| 257 | 289 | $content_items = array(); |
| 258 | 290 | $first_thumbnail_idx = -1; |
@@ -286,7 +318,9 @@ discard block |
||
| 286 | 318 | $content_item->setThumbnail($thumbnail); |
| 287 | 319 | $content_item->setExtraImages($oDocument->printExtraImages($args->duration_new * 60 * 60)); |
| 288 | 320 | $content_item->add('mid', $args->mid_lists[$module_srl]); |
| 289 | - if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i; |
|
| 321 | + if($first_thumbnail_idx==-1 && $thumbnail) { |
|
| 322 | + $first_thumbnail_idx = $i; |
|
| 323 | + } |
|
| 290 | 324 | $content_items[] = $content_item; |
| 291 | 325 | } |
| 292 | 326 | |
@@ -319,15 +353,21 @@ discard block |
||
| 319 | 353 | $obj->list_count = $args->list_count * $args->page_count; |
| 320 | 354 | $files_output = executeQueryArray("file.getOneFileInDocument", $obj); |
| 321 | 355 | $files_count = count($files_output->data); |
| 322 | - if(!$files_count) return; |
|
| 356 | + if(!$files_count) { |
|
| 357 | + return; |
|
| 358 | + } |
|
| 323 | 359 | |
| 324 | 360 | $content_items = array(); |
| 325 | 361 | |
| 326 | - for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 362 | + for($i=0;$i<$files_count;$i++) { |
|
| 363 | + $document_srl_list[] = $files_output->data[$i]->document_srl; |
|
| 364 | + } |
|
| 327 | 365 | |
| 328 | 366 | $tmp_document_list = $oDocumentModel->getDocuments($document_srl_list); |
| 329 | 367 | |
| 330 | - if(!count($tmp_document_list)) return; |
|
| 368 | + if(!count($tmp_document_list)) { |
|
| 369 | + return; |
|
| 370 | + } |
|
| 331 | 371 | |
| 332 | 372 | foreach($tmp_document_list as $oDocument) |
| 333 | 373 | { |
@@ -381,16 +421,20 @@ discard block |
||
| 381 | 421 | { |
| 382 | 422 | $date = $v->get('regdate'); |
| 383 | 423 | $i=0; |
| 384 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
| 424 | + while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) { |
|
| 425 | + $i++; |
|
| 426 | + } |
|
| 385 | 427 | $items[sprintf('%s%02d',$date,$i)] = $v; |
| 386 | 428 | } |
| 387 | 429 | } |
| 388 | - if($args->order_type =='asc') ksort($items); |
|
| 389 | - else krsort($items); |
|
| 430 | + if($args->order_type =='asc') { |
|
| 431 | + ksort($items); |
|
| 432 | + } else { |
|
| 433 | + krsort($items); |
|
| 434 | + } |
|
| 390 | 435 | $content_items = array_slice(array_values($items),0,$args->list_count*$args->page_count); |
| 391 | 436 | // Tab Type |
| 392 | - } |
|
| 393 | - else |
|
| 437 | + } else |
|
| 394 | 438 | { |
| 395 | 439 | foreach($content_items as $key=> $content_item_list) |
| 396 | 440 | { |
@@ -399,11 +443,16 @@ discard block |
||
| 399 | 443 | { |
| 400 | 444 | $date = $content_item->get('regdate'); |
| 401 | 445 | $i=0; |
| 402 | - while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++; |
|
| 446 | + while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) { |
|
| 447 | + $i++; |
|
| 448 | + } |
|
| 403 | 449 | $items[sprintf('%s%02d',$date,$i)] = $content_item; |
| 404 | 450 | } |
| 405 | - if($args->order_type =='asc') ksort($items); |
|
| 406 | - else krsort($items); |
|
| 451 | + if($args->order_type =='asc') { |
|
| 452 | + ksort($items); |
|
| 453 | + } else { |
|
| 454 | + krsort($items); |
|
| 455 | + } |
|
| 407 | 456 | |
| 408 | 457 | $content_items[$key] = array_values($items); |
| 409 | 458 | } |
@@ -413,10 +462,16 @@ discard block |
||
| 413 | 462 | |
| 414 | 463 | function _getRssBody($value) |
| 415 | 464 | { |
| 416 | - if(!$value || is_string($value)) return $value; |
|
| 417 | - if(is_object($value)) $value = get_object_vars($value); |
|
| 465 | + if(!$value || is_string($value)) { |
|
| 466 | + return $value; |
|
| 467 | + } |
|
| 468 | + if(is_object($value)) { |
|
| 469 | + $value = get_object_vars($value); |
|
| 470 | + } |
|
| 418 | 471 | $body = null; |
| 419 | - if(!count($value)) return; |
|
| 472 | + if(!count($value)) { |
|
| 473 | + return; |
|
| 474 | + } |
|
| 420 | 475 | foreach($value as $key => $val) |
| 421 | 476 | { |
| 422 | 477 | if($key == 'body') |
@@ -424,8 +479,12 @@ discard block |
||
| 424 | 479 | $body = $val; |
| 425 | 480 | continue; |
| 426 | 481 | } |
| 427 | - if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val); |
|
| 428 | - if($body !== null) return $body; |
|
| 482 | + if(is_object($val)||is_array($val)) { |
|
| 483 | + $body = $this->_getRssBody($val); |
|
| 484 | + } |
|
| 485 | + if($body !== null) { |
|
| 486 | + return $body; |
|
| 487 | + } |
|
| 429 | 488 | } |
| 430 | 489 | return $body; |
| 431 | 490 | } |
@@ -468,7 +527,9 @@ discard block |
||
| 468 | 527 | $buff = $this->requestFeedContents($args->rss_url); |
| 469 | 528 | |
| 470 | 529 | $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); |
| 471 | - if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff); |
|
| 530 | + if($encoding && stripos($matches[1], "UTF-8") === FALSE) { |
|
| 531 | + $buff = Context::convertEncodingStr($buff); |
|
| 532 | + } |
|
| 472 | 533 | |
| 473 | 534 | $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); |
| 474 | 535 | |
@@ -481,19 +542,27 @@ discard block |
||
| 481 | 542 | |
| 482 | 543 | $items = $xml_doc->rss->channel->item; |
| 483 | 544 | |
| 484 | - if(!$items) return; |
|
| 485 | - if($items && !is_array($items)) $items = array($items); |
|
| 545 | + if(!$items) { |
|
| 546 | + return; |
|
| 547 | + } |
|
| 548 | + if($items && !is_array($items)) { |
|
| 549 | + $items = array($items); |
|
| 550 | + } |
|
| 486 | 551 | |
| 487 | 552 | $content_items = array(); |
| 488 | 553 | |
| 489 | 554 | foreach ($items as $key => $value) |
| 490 | 555 | { |
| 491 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 556 | + if($key >= $args->list_count * $args->page_count) { |
|
| 557 | + break; |
|
| 558 | + } |
|
| 492 | 559 | unset($item); |
| 493 | 560 | |
| 494 | 561 | foreach($value as $key2 => $value2) |
| 495 | 562 | { |
| 496 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 563 | + if(is_array($value2)) { |
|
| 564 | + $value2 = array_shift($value2); |
|
| 565 | + } |
|
| 497 | 566 | $item->{$key2} = $this->_getRssBody($value2); |
| 498 | 567 | } |
| 499 | 568 | |
@@ -511,8 +580,7 @@ discard block |
||
| 511 | 580 | |
| 512 | 581 | $content_items[] = $content_item; |
| 513 | 582 | } |
| 514 | - } |
|
| 515 | - else if($xml_doc->{'rdf:rdf'}) |
|
| 583 | + } else if($xml_doc->{'rdf:rdf'}) |
|
| 516 | 584 | { |
| 517 | 585 | // rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters. Fixed by misol |
| 518 | 586 | $rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body; |
@@ -520,19 +588,27 @@ discard block |
||
| 520 | 588 | |
| 521 | 589 | $items = $xml_doc->{'rdf:rdf'}->item; |
| 522 | 590 | |
| 523 | - if(!$items) return; |
|
| 524 | - if($items && !is_array($items)) $items = array($items); |
|
| 591 | + if(!$items) { |
|
| 592 | + return; |
|
| 593 | + } |
|
| 594 | + if($items && !is_array($items)) { |
|
| 595 | + $items = array($items); |
|
| 596 | + } |
|
| 525 | 597 | |
| 526 | 598 | $content_items = array(); |
| 527 | 599 | |
| 528 | 600 | foreach ($items as $key => $value) |
| 529 | 601 | { |
| 530 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 602 | + if($key >= $args->list_count * $args->page_count) { |
|
| 603 | + break; |
|
| 604 | + } |
|
| 531 | 605 | unset($item); |
| 532 | 606 | |
| 533 | 607 | foreach($value as $key2 => $value2) |
| 534 | 608 | { |
| 535 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 609 | + if(is_array($value2)) { |
|
| 610 | + $value2 = array_shift($value2); |
|
| 611 | + } |
|
| 536 | 612 | $item->{$key2} = $this->_getRssBody($value2); |
| 537 | 613 | } |
| 538 | 614 | |
@@ -550,8 +626,7 @@ discard block |
||
| 550 | 626 | |
| 551 | 627 | $content_items[] = $content_item; |
| 552 | 628 | } |
| 553 | - } |
|
| 554 | - else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 629 | + } else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') |
|
| 555 | 630 | { |
| 556 | 631 | // Atom 1.0 spec supported by misol |
| 557 | 632 | $rss->title = $xml_doc->feed->title->body; |
@@ -566,24 +641,33 @@ discard block |
||
| 566 | 641 | break; |
| 567 | 642 | } |
| 568 | 643 | } |
| 644 | + } else if($links->attrs->rel == 'alternate') { |
|
| 645 | + $rss->link = $links->attrs->href; |
|
| 569 | 646 | } |
| 570 | - else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href; |
|
| 571 | 647 | |
| 572 | 648 | $items = $xml_doc->feed->entry; |
| 573 | 649 | |
| 574 | - if(!$items) return; |
|
| 575 | - if($items && !is_array($items)) $items = array($items); |
|
| 650 | + if(!$items) { |
|
| 651 | + return; |
|
| 652 | + } |
|
| 653 | + if($items && !is_array($items)) { |
|
| 654 | + $items = array($items); |
|
| 655 | + } |
|
| 576 | 656 | |
| 577 | 657 | $content_items = array(); |
| 578 | 658 | |
| 579 | 659 | foreach ($items as $key => $value) |
| 580 | 660 | { |
| 581 | - if($key >= $args->list_count * $args->page_count) break; |
|
| 661 | + if($key >= $args->list_count * $args->page_count) { |
|
| 662 | + break; |
|
| 663 | + } |
|
| 582 | 664 | unset($item); |
| 583 | 665 | |
| 584 | 666 | foreach($value as $key2 => $value2) |
| 585 | 667 | { |
| 586 | - if(is_array($value2)) $value2 = array_shift($value2); |
|
| 668 | + if(is_array($value2)) { |
|
| 669 | + $value2 = array_shift($value2); |
|
| 670 | + } |
|
| 587 | 671 | $item->{$key2} = $this->_getRssBody($value2); |
| 588 | 672 | } |
| 589 | 673 | |
@@ -599,13 +683,16 @@ discard block |
||
| 599 | 683 | break; |
| 600 | 684 | } |
| 601 | 685 | } |
| 686 | + } else if($links->attrs->rel == 'alternate') { |
|
| 687 | + $item->link = $links->attrs->href; |
|
| 602 | 688 | } |
| 603 | - else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href; |
|
| 604 | 689 | |
| 605 | 690 | $content_item->setContentsLink($rss->link); |
| 606 | 691 | if($item->title) |
| 607 | 692 | { |
| 608 | - if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body; |
|
| 693 | + if(stripos($value->title->attrs->type, "html") === FALSE) { |
|
| 694 | + $item->title = $value->title->body; |
|
| 695 | + } |
|
| 609 | 696 | } |
| 610 | 697 | $content_item->setTitle($item->title); |
| 611 | 698 | $content_item->setNickName(max($item->author,$item->{'dc:creator'})); |
@@ -640,16 +727,13 @@ discard block |
||
| 640 | 727 | if($matches[1]) |
| 641 | 728 | { |
| 642 | 729 | return $matches[1]; |
| 643 | - } |
|
| 644 | - elseif($matches[2]) |
|
| 730 | + } elseif($matches[2]) |
|
| 645 | 731 | { |
| 646 | 732 | return $matches[2]; |
| 647 | - } |
|
| 648 | - elseif($matches[3]) |
|
| 733 | + } elseif($matches[3]) |
|
| 649 | 734 | { |
| 650 | 735 | return $matches[3]; |
| 651 | - } |
|
| 652 | - else |
|
| 736 | + } else |
|
| 653 | 737 | { |
| 654 | 738 | return NULL; |
| 655 | 739 | } |
@@ -681,7 +765,9 @@ discard block |
||
| 681 | 765 | // Get model object from the trackback module and execute getTrackbackList() method |
| 682 | 766 | $output = $oTrackbackModel->getNewestTrackbackList($obj); |
| 683 | 767 | // If an error occurs, just ignore it. |
| 684 | - if(!$output->toBool() || !$output->data) return; |
|
| 768 | + if(!$output->toBool() || !$output->data) { |
|
| 769 | + return; |
|
| 770 | + } |
|
| 685 | 771 | // If the result exists, make each document as an object |
| 686 | 772 | $content_items = array(); |
| 687 | 773 | foreach($output->data as $key => $item) |
@@ -743,7 +829,9 @@ discard block |
||
| 743 | 829 | $tab = array(); |
| 744 | 830 | foreach($args->mid_lists as $module_srl => $mid) |
| 745 | 831 | { |
| 746 | - if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue; |
|
| 832 | + if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) { |
|
| 833 | + continue; |
|
| 834 | + } |
|
| 747 | 835 | |
| 748 | 836 | unset($tab_item); |
| 749 | 837 | $tab_item = new stdClass(); |
@@ -751,12 +839,13 @@ discard block |
||
| 751 | 839 | $tab_item->content_items = $content_items[$module_srl]; |
| 752 | 840 | $tab_item->domain = $content_items[$module_srl][0]->getDomain(); |
| 753 | 841 | $tab_item->url = $content_items[$module_srl][0]->getContentsLink(); |
| 754 | - if(!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid); |
|
| 842 | + if(!$tab_item->url) { |
|
| 843 | + $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid); |
|
| 844 | + } |
|
| 755 | 845 | $tab[] = $tab_item; |
| 756 | 846 | } |
| 757 | 847 | $widget_info->tab = $tab; |
| 758 | - } |
|
| 759 | - else |
|
| 848 | + } else |
|
| 760 | 849 | { |
| 761 | 850 | $widget_info->content_items = $content_items; |
| 762 | 851 | } |
@@ -804,7 +893,9 @@ discard block |
||
| 804 | 893 | static $default_domain = null; |
| 805 | 894 | if(!$domain) |
| 806 | 895 | { |
| 807 | - if(is_null($default_domain)) $default_domain = Context::getDefaultUrl(); |
|
| 896 | + if(is_null($default_domain)) { |
|
| 897 | + $default_domain = Context::getDefaultUrl(); |
|
| 898 | + } |
|
| 808 | 899 | $domain = $default_domain; |
| 809 | 900 | } |
| 810 | 901 | $this->domain = $domain; |
@@ -872,13 +963,21 @@ discard block |
||
| 872 | 963 | { |
| 873 | 964 | $title = htmlspecialchars($this->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 874 | 965 | |
| 875 | - if($cut_size) $title = cut_str($title, $cut_size, $tail); |
|
| 966 | + if($cut_size) { |
|
| 967 | + $title = cut_str($title, $cut_size, $tail); |
|
| 968 | + } |
|
| 876 | 969 | |
| 877 | 970 | $attrs = array(); |
| 878 | - if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold'; |
|
| 879 | - if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 971 | + if($this->get('title_bold') == 'Y') { |
|
| 972 | + $attrs[] = 'font-weight:bold'; |
|
| 973 | + } |
|
| 974 | + if($this->get('title_color') && $this->get('title_color') != 'N') { |
|
| 975 | + $attrs[] = 'color:#'.$this->get('title_color'); |
|
| 976 | + } |
|
| 880 | 977 | |
| 881 | - if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
| 978 | + if(count($attrs)) { |
|
| 979 | + $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title); |
|
| 980 | + } |
|
| 882 | 981 | |
| 883 | 982 | return $title; |
| 884 | 983 | } |
@@ -892,8 +991,11 @@ discard block |
||
| 892 | 991 | } |
| 893 | 992 | function getNickName($cut_size = 0, $tail='...') |
| 894 | 993 | { |
| 895 | - if($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
| 896 | - else $nick_name = $this->get('nick_name'); |
|
| 994 | + if($cut_size) { |
|
| 995 | + $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail); |
|
| 996 | + } else { |
|
| 997 | + $nick_name = $this->get('nick_name'); |
|
| 998 | + } |
|
| 897 | 999 | |
| 898 | 1000 | return $nick_name; |
| 899 | 1001 | } |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $template_path = $oModule->getTemplatePath(); |
| 20 | 20 | |
| 21 | - if(!is_dir($template_path)) |
|
| 21 | + if (!is_dir($template_path)) |
|
| 22 | 22 | { |
| 23 | - if($oModule->module_info->module == $oModule->module) |
|
| 23 | + if ($oModule->module_info->module == $oModule->module) |
|
| 24 | 24 | { |
| 25 | 25 | $skin = $oModule->origin_module_info->skin; |
| 26 | 26 | } |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | $skin = $oModule->module_config->skin; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
| 32 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false) |
|
| 33 | 33 | { |
| 34 | - if($skin && is_string($skin)) |
|
| 34 | + if ($skin && is_string($skin)) |
|
| 35 | 35 | { |
| 36 | 36 | $theme_skin = explode('|@|', $skin); |
| 37 | 37 | $template_path = $oModule->getTemplatePath(); |
| 38 | - if(count($theme_skin) == 2) |
|
| 38 | + if (count($theme_skin) == 2) |
|
| 39 | 39 | { |
| 40 | 40 | $theme_path = sprintf('./themes/%s', $theme_skin[0]); |
| 41 | 41 | // FIXME $theme_path $theme_path $theme_path ?? |
| 42 | - if(substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
| 42 | + if (substr($theme_path, 0, strlen($theme_path)) != $theme_path) |
|
| 43 | 43 | { |
| 44 | 44 | $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); |
| 45 | 45 | } |
@@ -65,16 +65,16 @@ discard block |
||
| 65 | 65 | $oSecurity->encodeHTML('is_keyword', 'search_keyword', 'search_target', 'order_target', 'order_type'); |
| 66 | 66 | |
| 67 | 67 | // add .x div for adminitration pages |
| 68 | - if(Context::getResponseMethod() == 'HTML') |
|
| 68 | + if (Context::getResponseMethod() == 'HTML') |
|
| 69 | 69 | { |
| 70 | - if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
| 70 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify') |
|
| 71 | 71 | { |
| 72 | - $output = '<div class="x">' . $output . '</div>'; |
|
| 72 | + $output = '<div class="x">'.$output.'</div>'; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(Context::get('layout') != 'none') |
|
| 75 | + if (Context::get('layout') != 'none') |
|
| 76 | 76 | { |
| 77 | - if(__DEBUG__ == 3) |
|
| 77 | + if (__DEBUG__ == 3) |
|
| 78 | 78 | { |
| 79 | 79 | $start = getMicroTime(); |
| 80 | 80 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | $layout_srl = $layout_info->layout_srl; |
| 93 | 93 | |
| 94 | 94 | // compile if connected to the layout |
| 95 | - if($layout_srl > 0) |
|
| 95 | + if ($layout_srl > 0) |
|
| 96 | 96 | { |
| 97 | 97 | |
| 98 | 98 | // handle separately if the layout is faceoff |
| 99 | - if($layout_info && $layout_info->type == 'faceoff') |
|
| 99 | + if ($layout_info && $layout_info->type == 'faceoff') |
|
| 100 | 100 | { |
| 101 | 101 | $oLayoutModel->doActivateFaceOff($layout_info); |
| 102 | 102 | Context::set('layout_info', $layout_info); |
@@ -105,16 +105,16 @@ discard block |
||
| 105 | 105 | // search if the changes CSS exists in the admin layout edit window |
| 106 | 106 | $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); |
| 107 | 107 | |
| 108 | - if(FileHandler::exists($edited_layout_css)) |
|
| 108 | + if (FileHandler::exists($edited_layout_css)) |
|
| 109 | 109 | { |
| 110 | 110 | Context::loadFile(array($edited_layout_css, 'all', '', 100)); |
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | - if(!$layout_path) |
|
| 113 | + if (!$layout_path) |
|
| 114 | 114 | { |
| 115 | 115 | $layout_path = './common/tpl'; |
| 116 | 116 | } |
| 117 | - if(!$layout_file) |
|
| 117 | + if (!$layout_file) |
|
| 118 | 118 | { |
| 119 | 119 | $layout_file = 'default_layout'; |
| 120 | 120 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // if popup_layout, remove admin bar. |
| 124 | 124 | $realLayoutPath = FileHandler::getRealPath($layout_path); |
| 125 | - if(substr_compare($realLayoutPath, '/', -1) !== 0) |
|
| 125 | + if (substr_compare($realLayoutPath, '/', -1) !== 0) |
|
| 126 | 126 | { |
| 127 | 127 | $realLayoutPath .= '/'; |
| 128 | 128 | } |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | $pathInfo = pathinfo($layout_file); |
| 131 | 131 | $onlyLayoutFile = $pathInfo['filename']; |
| 132 | 132 | |
| 133 | - if(__DEBUG__ == 3) |
|
| 133 | + if (__DEBUG__ == 3) |
|
| 134 | 134 | { |
| 135 | 135 | $GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
| 138 | + if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always')) |
|
| 139 | 139 | { |
| 140 | 140 | Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>'); |
| 141 | 141 | } |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | function prepareToPrint(&$output) |
| 153 | 153 | { |
| 154 | - if(Context::getResponseMethod() != 'HTML') |
|
| 154 | + if (Context::getResponseMethod() != 'HTML') |
|
| 155 | 155 | { |
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if(__DEBUG__ == 3) |
|
| 159 | + if (__DEBUG__ == 3) |
|
| 160 | 160 | { |
| 161 | 161 | $start = getMicroTime(); |
| 162 | 162 | } |
@@ -174,20 +174,20 @@ discard block |
||
| 174 | 174 | $output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output); |
| 175 | 175 | |
| 176 | 176 | // handles a relative path generated by using the rewrite module |
| 177 | - if(Context::isAllowRewrite()) |
|
| 177 | + if (Context::isAllowRewrite()) |
|
| 178 | 178 | { |
| 179 | 179 | $url = parse_url(Context::getRequestUri()); |
| 180 | 180 | $real_path = $url['path']; |
| 181 | 181 | |
| 182 | 182 | $pattern = '/src=("|\'){1}(\.\/)?(files\/attach|files\/cache|files\/faceOff|files\/member_extra_info|modules|common|widgets|widgetstyle|layouts|addons)\/([^"\']+)\.(jpg|jpeg|png|gif)("|\'){1}/s'; |
| 183 | - $output = preg_replace($pattern, 'src=$1' . $real_path . '$3/$4.$5$6', $output); |
|
| 183 | + $output = preg_replace($pattern, 'src=$1'.$real_path.'$3/$4.$5$6', $output); |
|
| 184 | 184 | |
| 185 | 185 | $pattern = '/href=("|\'){1}(\?[^"\']+)/s'; |
| 186 | - $output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output); |
|
| 186 | + $output = preg_replace($pattern, 'href=$1'.$real_path.'$2', $output); |
|
| 187 | 187 | |
| 188 | - if(Context::get('vid')) |
|
| 188 | + if (Context::get('vid')) |
|
| 189 | 189 | { |
| 190 | - $pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is'; |
|
| 190 | + $pattern = '/\/'.Context::get('vid').'\?([^=]+)=/is'; |
|
| 191 | 191 | $output = preg_replace($pattern, '/?$1=', $output); |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -195,18 +195,18 @@ discard block |
||
| 195 | 195 | // prevent the 2nd request due to url(none) of the background-image |
| 196 | 196 | $output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); |
| 197 | 197 | |
| 198 | - if(is_array(Context::get('INPUT_ERROR'))) |
|
| 198 | + if (is_array(Context::get('INPUT_ERROR'))) |
|
| 199 | 199 | { |
| 200 | 200 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
| 201 | 201 | $keys = array_keys($INPUT_ERROR); |
| 202 | - $keys = '(' . implode('|', $keys) . ')'; |
|
| 202 | + $keys = '('.implode('|', $keys).')'; |
|
| 203 | 203 | |
| 204 | - $output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
| 205 | - $output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
| 206 | - $output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
| 204 | + $output = preg_replace_callback('@(<input)([^>]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); |
|
| 205 | + $output = preg_replace_callback('@<select[^>]*\sname="'.$keys.'".+</select>@isU', array(&$this, '_preserveSelectValue'), $output); |
|
| 206 | + $output = preg_replace_callback('@<textarea[^>]*\sname="'.$keys.'".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if(__DEBUG__ == 3) |
|
| 209 | + if (__DEBUG__ == 3) |
|
| 210 | 210 | { |
| 211 | 211 | $GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start; |
| 212 | 212 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | // convert the final layout |
| 225 | 225 | Context::set('content', $output); |
| 226 | 226 | $oTemplate = TemplateHandler::getInstance(); |
| 227 | - if(Mobile::isFromMobilePhone()) |
|
| 227 | + if (Mobile::isFromMobilePhone()) |
|
| 228 | 228 | { |
| 229 | 229 | $this->_loadMobileJSCSS(); |
| 230 | 230 | $output = $oTemplate->compile('./common/tpl', 'mobile_layout'); |
@@ -249,16 +249,16 @@ discard block |
||
| 249 | 249 | { |
| 250 | 250 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
| 251 | 251 | |
| 252 | - $str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4]; |
|
| 252 | + $str = $match[1].$match[2].' name="'.$match[3].'"'.$match[4]; |
|
| 253 | 253 | |
| 254 | 254 | // get type |
| 255 | 255 | $type = 'text'; |
| 256 | - if(preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
| 256 | + if (preg_match('/\stype="([a-z]+)"/i', $str, $m)) |
|
| 257 | 257 | { |
| 258 | 258 | $type = strtolower($m[1]); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - switch($type) |
|
| 261 | + switch ($type) |
|
| 262 | 262 | { |
| 263 | 263 | case 'text': |
| 264 | 264 | case 'hidden': |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | case 'number': |
| 277 | 277 | case 'range': |
| 278 | 278 | case 'color': |
| 279 | - $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"'; |
|
| 279 | + $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str).' value="'.htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'"'; |
|
| 280 | 280 | break; |
| 281 | 281 | case 'password': |
| 282 | 282 | $str = preg_replace('@\svalue="[^"]*?"@', ' ', $str); |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | case 'radio': |
| 285 | 285 | case 'checkbox': |
| 286 | 286 | $str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str); |
| 287 | - if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str)) |
|
| 287 | + if (@preg_match('@\s(?i:value)="'.$INPUT_ERROR[$match[3]].'"@', $str)) |
|
| 288 | 288 | { |
| 289 | 289 | $str .= ' checked="checked"'; |
| 290 | 290 | } |
| 291 | 291 | break; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - return $str . ' />'; |
|
| 294 | + return $str.' />'; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -308,14 +308,14 @@ discard block |
||
| 308 | 308 | preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m); |
| 309 | 309 | |
| 310 | 310 | $key = array_search($INPUT_ERROR[$matches[1]], $m[1]); |
| 311 | - if($key === FALSE) |
|
| 311 | + if ($key === FALSE) |
|
| 312 | 312 | { |
| 313 | 313 | return $matches[0]; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | $m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]); |
| 317 | 317 | |
| 318 | - return $mm[0] . implode('', $m[0]) . '</select>'; |
|
| 318 | + return $mm[0].implode('', $m[0]).'</select>'; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /** |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | { |
| 328 | 328 | $INPUT_ERROR = Context::get('INPUT_ERROR'); |
| 329 | 329 | preg_match('@<textarea.*?>@is', $matches[0], $mm); |
| 330 | - return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>'; |
|
| 330 | + return $mm[0].$INPUT_ERROR[$matches[1]].'</textarea>'; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | function _moveStyleToHeader($matches) |
| 340 | 340 | { |
| 341 | - if(isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
| 341 | + if (isset($matches[1]) && stristr($matches[1], 'scoped')) |
|
| 342 | 342 | { |
| 343 | 343 | return $matches[0]; |
| 344 | 344 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | function _transMeta($matches) |
| 376 | 376 | { |
| 377 | - if($matches[1]) |
|
| 377 | + if ($matches[1]) |
|
| 378 | 378 | { |
| 379 | 379 | return ''; |
| 380 | 380 | } |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $lang_type = Context::getLangType(); |
| 392 | 392 | |
| 393 | 393 | // add common JS/CSS files |
| 394 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 394 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 395 | 395 | { |
| 396 | 396 | $oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -111000), true); |
| 397 | 397 | $oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -110000), true); |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | // for admin page, add admin css |
| 416 | - if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
| 416 | + if (Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0) |
|
| 417 | 417 | { |
| 418 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 418 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 419 | 419 | { |
| 420 | 420 | $oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true); |
| 421 | 421 | $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $lang_type = Context::getLangType(); |
| 448 | 448 | |
| 449 | 449 | // add common JS/CSS files |
| 450 | - if(__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 450 | + if (__DEBUG__ || !__XE_VERSION_STABLE__) |
|
| 451 | 451 | { |
| 452 | 452 | $oContext->loadFile(array('./common/js/jquery.js', 'head', '', -110000), true); |
| 453 | 453 | $oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -100000), true); |
@@ -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,18 +125,18 @@ 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 | |
| 135 | 135 | // Get document |
| 136 | 136 | $oDocumentModel = getModel('document'); |
| 137 | 137 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 138 | 138 | |
| 139 | - if($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 139 | + if ($oDocument->isSecret() && !$oDocument->isGranted()) |
|
| 140 | 140 | { |
| 141 | 141 | return new Object(-1, 'msg_is_secret'); |
| 142 | 142 | } |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | // Check if already scrapped |
| 155 | 155 | $output = executeQuery('member.getScrapDocument', $args); |
| 156 | - if($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
| 156 | + if ($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
| 157 | 157 | |
| 158 | 158 | // Insert |
| 159 | 159 | $output = executeQuery('member.addScrapDocument', $args); |
| 160 | - if(!$output->toBool()) return $output; |
|
| 160 | + if (!$output->toBool()) return $output; |
|
| 161 | 161 | |
| 162 | 162 | $this->setError(-1); |
| 163 | 163 | $this->setMessage('success_registed'); |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | function procMemberDeleteScrap() |
| 172 | 172 | { |
| 173 | 173 | // Check login information |
| 174 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 174 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 175 | 175 | $logged_info = Context::get('logged_info'); |
| 176 | 176 | |
| 177 | - $document_srl = (int)Context::get('document_srl'); |
|
| 178 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 177 | + $document_srl = (int) Context::get('document_srl'); |
|
| 178 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 179 | 179 | // Variables |
| 180 | 180 | $args = new stdClass; |
| 181 | 181 | $args->member_srl = $logged_info->member_srl; |
@@ -201,23 +201,23 @@ discard block |
||
| 201 | 201 | function procMemberDeleteSavedDocument() |
| 202 | 202 | { |
| 203 | 203 | // Check login information |
| 204 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 204 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 205 | 205 | $logged_info = Context::get('logged_info'); |
| 206 | 206 | |
| 207 | - $document_srl = (int)Context::get('document_srl'); |
|
| 208 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 207 | + $document_srl = (int) Context::get('document_srl'); |
|
| 208 | + if (!$document_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 209 | 209 | |
| 210 | 210 | $oDocumentModel = getModel('document'); |
| 211 | 211 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 212 | 212 | if ($oDocument->get('member_srl') != $logged_info->member_srl) |
| 213 | 213 | { |
| 214 | - return new Object(-1,'msg_invalid_request'); |
|
| 214 | + return new Object(-1, 'msg_invalid_request'); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $configStatusList = $oDocumentModel->getStatusList(); |
| 218 | 218 | if ($oDocument->get('status') != $configStatusList['temp']) |
| 219 | 219 | { |
| 220 | - return new Object(-1,'msg_invalid_request'); |
|
| 220 | + return new Object(-1, 'msg_invalid_request'); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | $oDocumentController = getController('document'); |
@@ -233,37 +233,37 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | $name = Context::get('name'); |
| 235 | 235 | $value = Context::get('value'); |
| 236 | - if(!$value) return; |
|
| 236 | + if (!$value) return; |
|
| 237 | 237 | |
| 238 | 238 | $oMemberModel = getModel('member'); |
| 239 | 239 | // Check if logged-in |
| 240 | 240 | $logged_info = Context::get('logged_info'); |
| 241 | 241 | |
| 242 | 242 | |
| 243 | - switch($name) |
|
| 243 | + switch ($name) |
|
| 244 | 244 | { |
| 245 | 245 | case 'user_id' : |
| 246 | 246 | // Check denied ID |
| 247 | - if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id'); |
|
| 247 | + if ($oMemberModel->isDeniedID($value)) return new Object(0, 'denied_user_id'); |
|
| 248 | 248 | // Check if duplicated |
| 249 | 249 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
| 250 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id'); |
|
| 250 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_user_id'); |
|
| 251 | 251 | break; |
| 252 | 252 | case 'nick_name' : |
| 253 | 253 | // Check denied ID |
| 254 | - if($oMemberModel->isDeniedNickName($value)) |
|
| 254 | + if ($oMemberModel->isDeniedNickName($value)) |
|
| 255 | 255 | { |
| 256 | - return new Object(0,'denied_nick_name'); |
|
| 256 | + return new Object(0, 'denied_nick_name'); |
|
| 257 | 257 | } |
| 258 | 258 | // Check if duplicated |
| 259 | 259 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
| 260 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name'); |
|
| 260 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_nick_name'); |
|
| 261 | 261 | |
| 262 | 262 | break; |
| 263 | 263 | case 'email_address' : |
| 264 | 264 | // Check if duplicated |
| 265 | 265 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
| 266 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address'); |
|
| 266 | + if ($member_srl && $logged_info->member_srl != $member_srl) return new Object(0, 'msg_exists_email_address'); |
|
| 267 | 267 | break; |
| 268 | 268 | } |
| 269 | 269 | } |
@@ -275,25 +275,25 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | function procMemberInsert() |
| 277 | 277 | { |
| 278 | - if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request"); |
|
| 279 | - $oMemberModel = &getModel ('member'); |
|
| 278 | + if (Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request"); |
|
| 279 | + $oMemberModel = &getModel('member'); |
|
| 280 | 280 | $config = $oMemberModel->getMemberConfig(); |
| 281 | 281 | |
| 282 | 282 | // call a trigger (before) |
| 283 | - $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
|
| 284 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
| 283 | + $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'before', $config); |
|
| 284 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 285 | 285 | // Check if an administrator allows a membership |
| 286 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
| 286 | + if ($config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); |
|
| 287 | 287 | // Check if the user accept the license terms (only if terms exist) |
| 288 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
| 288 | + if ($config->agreement && Context::get('accept_agreement') != 'Y') return $this->stop('msg_accept_agreement'); |
|
| 289 | 289 | |
| 290 | 290 | // Extract the necessary information in advance |
| 291 | 291 | $getVars = array(); |
| 292 | - if($config->signupForm) |
|
| 292 | + if ($config->signupForm) |
|
| 293 | 293 | { |
| 294 | - foreach($config->signupForm as $formInfo) |
|
| 294 | + foreach ($config->signupForm as $formInfo) |
|
| 295 | 295 | { |
| 296 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 296 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 297 | 297 | { |
| 298 | 298 | $getVars[] = $formInfo->name; |
| 299 | 299 | } |
@@ -301,22 +301,22 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $args = new stdClass; |
| 304 | - foreach($getVars as $val) |
|
| 304 | + foreach ($getVars as $val) |
|
| 305 | 305 | { |
| 306 | 306 | $args->{$val} = Context::get($val); |
| 307 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 307 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 308 | 308 | } |
| 309 | 309 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 310 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 310 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 311 | 311 | |
| 312 | 312 | $args->find_account_answer = Context::get('find_account_answer'); |
| 313 | 313 | $args->allow_mailing = Context::get('allow_mailing'); |
| 314 | 314 | $args->allow_message = Context::get('allow_message'); |
| 315 | 315 | |
| 316 | - if($args->password1) $args->password = $args->password1; |
|
| 316 | + if ($args->password1) $args->password = $args->password1; |
|
| 317 | 317 | |
| 318 | 318 | // check password strength |
| 319 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 319 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 320 | 320 | { |
| 321 | 321 | $message = Context::getLang('about_password_strength'); |
| 322 | 322 | return new Object(-1, $message[$config->password_strength]); |
@@ -342,58 +342,58 @@ discard block |
||
| 342 | 342 | unset($all_args->secret_text); |
| 343 | 343 | |
| 344 | 344 | // Set the user state as "denied" when using mail authentication |
| 345 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 345 | + if ($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 346 | 346 | // Add extra vars after excluding necessary information from all the requested arguments |
| 347 | 347 | $extra_vars = delObjectVars($all_args, $args); |
| 348 | 348 | $args->extra_vars = serialize($extra_vars); |
| 349 | 349 | |
| 350 | 350 | // remove whitespace |
| 351 | 351 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
| 352 | - foreach($checkInfos as $val) |
|
| 352 | + foreach ($checkInfos as $val) |
|
| 353 | 353 | { |
| 354 | - if(isset($args->{$val})) |
|
| 354 | + if (isset($args->{$val})) |
|
| 355 | 355 | { |
| 356 | 356 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | $output = $this->insertMember($args); |
| 360 | - if(!$output->toBool()) return $output; |
|
| 360 | + if (!$output->toBool()) return $output; |
|
| 361 | 361 | |
| 362 | 362 | // insert ProfileImage, ImageName, ImageMark |
| 363 | 363 | $profile_image = $_FILES['profile_image']; |
| 364 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 364 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 365 | 365 | { |
| 366 | 366 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | $image_mark = $_FILES['image_mark']; |
| 370 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 370 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 371 | 371 | { |
| 372 | 372 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | $image_name = $_FILES['image_name']; |
| 376 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
| 376 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
| 377 | 377 | { |
| 378 | 378 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | // If a virtual site, join the site |
| 382 | 382 | $site_module_info = Context::get('site_module_info'); |
| 383 | - if($site_module_info->site_srl > 0) |
|
| 383 | + if ($site_module_info->site_srl > 0) |
|
| 384 | 384 | { |
| 385 | 385 | $columnList = array('site_srl', 'group_srl'); |
| 386 | 386 | $default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl, $columnList); |
| 387 | - if($default_group->group_srl) |
|
| 387 | + if ($default_group->group_srl) |
|
| 388 | 388 | { |
| 389 | 389 | $this->addMemberToGroup($args->member_srl, $default_group->group_srl, $site_module_info->site_srl); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | } |
| 393 | 393 | // Log-in |
| 394 | - if($config->enable_confirm != 'Y') |
|
| 394 | + if ($config->enable_confirm != 'Y') |
|
| 395 | 395 | { |
| 396 | - if($config->identifier == 'email_address') |
|
| 396 | + if ($config->identifier == 'email_address') |
|
| 397 | 397 | { |
| 398 | 398 | $output = $this->doLogin($args->email_address); |
| 399 | 399 | } |
@@ -401,8 +401,8 @@ discard block |
||
| 401 | 401 | { |
| 402 | 402 | $output = $this->doLogin($args->user_id); |
| 403 | 403 | } |
| 404 | - if(!$output->toBool()) { |
|
| 405 | - if($output->error == -9) |
|
| 404 | + if (!$output->toBool()) { |
|
| 405 | + if ($output->error == -9) |
|
| 406 | 406 | $output->error = -11; |
| 407 | 407 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
| 408 | 408 | } |
@@ -410,8 +410,8 @@ discard block |
||
| 410 | 410 | |
| 411 | 411 | // Results |
| 412 | 412 | $this->add('member_srl', $args->member_srl); |
| 413 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 414 | - if($config->enable_confirm == 'Y') |
|
| 413 | + if ($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 414 | + if ($config->enable_confirm == 'Y') |
|
| 415 | 415 | { |
| 416 | 416 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
| 417 | 417 | $this->setMessage($msg); |
@@ -420,19 +420,19 @@ discard block |
||
| 420 | 420 | else $this->setMessage('success_registed'); |
| 421 | 421 | // Call a trigger (after) |
| 422 | 422 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
| 423 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 423 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 424 | 424 | |
| 425 | - if($config->redirect_url) |
|
| 425 | + if ($config->redirect_url) |
|
| 426 | 426 | { |
| 427 | 427 | $returnUrl = $config->redirect_url; |
| 428 | 428 | } |
| 429 | 429 | else |
| 430 | 430 | { |
| 431 | - if(Context::get('success_return_url')) |
|
| 431 | + if (Context::get('success_return_url')) |
|
| 432 | 432 | { |
| 433 | 433 | $returnUrl = Context::get('success_return_url'); |
| 434 | 434 | } |
| 435 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 435 | + else if ($_COOKIE['XE_REDIRECT_URL']) |
|
| 436 | 436 | { |
| 437 | 437 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
| 438 | 438 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -446,26 +446,26 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | function procMemberModifyInfoBefore() |
| 448 | 448 | { |
| 449 | - if($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
| 449 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_PASSWORD') |
|
| 450 | 450 | { |
| 451 | 451 | return $this->stop('msg_invalid_request'); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if(!Context::get('is_logged')) |
|
| 454 | + if (!Context::get('is_logged')) |
|
| 455 | 455 | { |
| 456 | 456 | return $this->stop('msg_not_logged'); |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | $password = Context::get('password'); |
| 460 | 460 | |
| 461 | - if(!$password) |
|
| 461 | + if (!$password) |
|
| 462 | 462 | { |
| 463 | 463 | return $this->stop('msg_invalid_request'); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | $oMemberModel = getModel('member'); |
| 467 | 467 | |
| 468 | - if(!$this->memberInfo->password) |
|
| 468 | + if (!$this->memberInfo->password) |
|
| 469 | 469 | { |
| 470 | 470 | // Get information of logged-in user |
| 471 | 471 | $logged_info = Context::get('logged_info'); |
@@ -476,14 +476,14 @@ discard block |
||
| 476 | 476 | $this->memberInfo->password = $memberInfo->password; |
| 477 | 477 | } |
| 478 | 478 | // Verify the current password |
| 479 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
| 479 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) |
|
| 480 | 480 | { |
| 481 | 481 | return new Object(-1, 'invalid_password'); |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | $_SESSION['rechecked_password_step'] = 'VALIDATE_PASSWORD'; |
| 485 | 485 | |
| 486 | - if(Context::get('success_return_url')) |
|
| 486 | + if (Context::get('success_return_url')) |
|
| 487 | 487 | { |
| 488 | 488 | $redirectUrl = Context::get('success_return_url'); |
| 489 | 489 | } |
@@ -501,12 +501,12 @@ discard block |
||
| 501 | 501 | */ |
| 502 | 502 | function procMemberModifyInfo() |
| 503 | 503 | { |
| 504 | - if(!Context::get('is_logged')) |
|
| 504 | + if (!Context::get('is_logged')) |
|
| 505 | 505 | { |
| 506 | 506 | return $this->stop('msg_not_logged'); |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 509 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 510 | 510 | { |
| 511 | 511 | return $this->stop('msg_invalid_request'); |
| 512 | 512 | } |
@@ -514,13 +514,13 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | // Extract the necessary information in advance |
| 516 | 516 | $oMemberModel = getModel('member'); |
| 517 | - $config = $oMemberModel->getMemberConfig (); |
|
| 518 | - $getVars = array('find_account_answer','allow_mailing','allow_message'); |
|
| 519 | - if($config->signupForm) |
|
| 517 | + $config = $oMemberModel->getMemberConfig(); |
|
| 518 | + $getVars = array('find_account_answer', 'allow_mailing', 'allow_message'); |
|
| 519 | + if ($config->signupForm) |
|
| 520 | 520 | { |
| 521 | - foreach($config->signupForm as $formInfo) |
|
| 521 | + foreach ($config->signupForm as $formInfo) |
|
| 522 | 522 | { |
| 523 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 523 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
| 524 | 524 | { |
| 525 | 525 | $getVars[] = $formInfo->name; |
| 526 | 526 | } |
@@ -528,16 +528,16 @@ discard block |
||
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | $args = new stdClass; |
| 531 | - foreach($getVars as $val) |
|
| 531 | + foreach ($getVars as $val) |
|
| 532 | 532 | { |
| 533 | 533 | $args->{$val} = Context::get($val); |
| 534 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 534 | + if ($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 535 | 535 | } |
| 536 | 536 | // Login Information |
| 537 | 537 | $logged_info = Context::get('logged_info'); |
| 538 | 538 | $args->member_srl = $logged_info->member_srl; |
| 539 | 539 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 540 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 540 | + if (!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 541 | 541 | // Remove some unnecessary variables from all the vars |
| 542 | 542 | $all_args = Context::getRequestVars(); |
| 543 | 543 | unset($all_args->module); |
@@ -561,9 +561,9 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | // remove whitespace |
| 563 | 563 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
| 564 | - foreach($checkInfos as $val) |
|
| 564 | + foreach ($checkInfos as $val) |
|
| 565 | 565 | { |
| 566 | - if(isset($args->{$val})) |
|
| 566 | + if (isset($args->{$val})) |
|
| 567 | 567 | { |
| 568 | 568 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
| 569 | 569 | } |
@@ -571,22 +571,22 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | // Execute insert or update depending on the value of member_srl |
| 573 | 573 | $output = $this->updateMember($args); |
| 574 | - if(!$output->toBool()) return $output; |
|
| 574 | + if (!$output->toBool()) return $output; |
|
| 575 | 575 | |
| 576 | 576 | $profile_image = $_FILES['profile_image']; |
| 577 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
| 577 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
| 578 | 578 | { |
| 579 | 579 | $this->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | $image_mark = $_FILES['image_mark']; |
| 583 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
| 583 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
| 584 | 584 | { |
| 585 | 585 | $this->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | $image_name = $_FILES['image_name']; |
| 589 | - if(is_uploaded_file($image_name['tmp_name'])) |
|
| 589 | + if (is_uploaded_file($image_name['tmp_name'])) |
|
| 590 | 590 | { |
| 591 | 591 | $this->insertImageName($args->member_srl, $image_name['tmp_name']); |
| 592 | 592 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | // Call a trigger after successfully log-in (after) |
| 603 | 603 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
| 604 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 604 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 605 | 605 | |
| 606 | 606 | $this->setSessionInfo(); |
| 607 | 607 | // Return result |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | */ |
| 623 | 623 | function procMemberModifyPassword() |
| 624 | 624 | { |
| 625 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 625 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 626 | 626 | // Extract the necessary information in advance |
| 627 | 627 | $current_password = trim(Context::get('current_password')); |
| 628 | 628 | $password = trim(Context::get('password1')); |
@@ -636,17 +636,17 @@ discard block |
||
| 636 | 636 | |
| 637 | 637 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 638 | 638 | // Verify the cuttent password |
| 639 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
| 639 | + if (!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
| 640 | 640 | |
| 641 | 641 | // Check if a new password is as same as the previous password |
| 642 | - if($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
| 642 | + if ($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
| 643 | 643 | |
| 644 | 644 | // Execute insert or update depending on the value of member_srl |
| 645 | 645 | $args = new stdClass; |
| 646 | 646 | $args->member_srl = $member_srl; |
| 647 | 647 | $args->password = $password; |
| 648 | 648 | $output = $this->updateMemberPassword($args); |
| 649 | - if(!$output->toBool()) return $output; |
|
| 649 | + if (!$output->toBool()) return $output; |
|
| 650 | 650 | |
| 651 | 651 | $this->add('member_srl', $args->member_srl); |
| 652 | 652 | $this->setMessage('success_updated'); |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | */ |
| 663 | 663 | function procMemberLeave() |
| 664 | 664 | { |
| 665 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 665 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 666 | 666 | // Extract the necessary information in advance |
| 667 | 667 | $password = trim(Context::get('password')); |
| 668 | 668 | // Get information of logged-in user |
@@ -671,17 +671,17 @@ discard block |
||
| 671 | 671 | // Create a member model object |
| 672 | 672 | $oMemberModel = getModel('member'); |
| 673 | 673 | // Get information of member_srl |
| 674 | - if(!$this->memberInfo->password) |
|
| 674 | + if (!$this->memberInfo->password) |
|
| 675 | 675 | { |
| 676 | 676 | $columnList = array('member_srl', 'password'); |
| 677 | 677 | $memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 678 | 678 | $this->memberInfo->password = $memberInfo->password; |
| 679 | 679 | } |
| 680 | 680 | // Verify the cuttent password |
| 681 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
| 681 | + if (!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
| 682 | 682 | |
| 683 | 683 | $output = $this->deleteMember($member_srl); |
| 684 | - if(!$output->toBool()) return $output; |
|
| 684 | + if (!$output->toBool()) return $output; |
|
| 685 | 685 | // Destroy all session information |
| 686 | 686 | $this->destroySessionInfo(); |
| 687 | 687 | // Return success message |
@@ -700,17 +700,17 @@ discard block |
||
| 700 | 700 | { |
| 701 | 701 | // Check if the file is successfully uploaded |
| 702 | 702 | $file = $_FILES['profile_image']; |
| 703 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 703 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 704 | 704 | // Ignore if member_srl is invalid or doesn't exist. |
| 705 | 705 | $member_srl = Context::get('member_srl'); |
| 706 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 706 | + if (!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 707 | 707 | |
| 708 | 708 | $logged_info = Context::get('logged_info'); |
| 709 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 709 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 710 | 710 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 711 | 711 | $oModuleModel = getModel('module'); |
| 712 | 712 | $config = $oModuleModel->getModuleConfig('member'); |
| 713 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 713 | + if ($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 714 | 714 | |
| 715 | 715 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 716 | 716 | // Page refresh |
@@ -732,25 +732,25 @@ discard block |
||
| 732 | 732 | { |
| 733 | 733 | |
| 734 | 734 | // Check uploaded file |
| 735 | - if(!checkUploadedFile($target_file)) return; |
|
| 735 | + if (!checkUploadedFile($target_file)) return; |
|
| 736 | 736 | |
| 737 | 737 | $oMemberModel = getModel('member'); |
| 738 | 738 | $config = $oMemberModel->getMemberConfig(); |
| 739 | 739 | |
| 740 | 740 | // Get an image size |
| 741 | 741 | $max_width = $config->profile_image_max_width; |
| 742 | - if(!$max_width) $max_width = "90"; |
|
| 742 | + if (!$max_width) $max_width = "90"; |
|
| 743 | 743 | $max_height = $config->profile_image_max_height; |
| 744 | - if(!$max_height) $max_height = "90"; |
|
| 744 | + if (!$max_height) $max_height = "90"; |
|
| 745 | 745 | // Get a target path to save |
| 746 | 746 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
| 747 | 747 | FileHandler::makeDir($target_path); |
| 748 | 748 | |
| 749 | 749 | // Get file information |
| 750 | 750 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 751 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 752 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 753 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 751 | + if (IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 752 | + elseif (IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 753 | + elseif (IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 754 | 754 | else |
| 755 | 755 | { |
| 756 | 756 | return; |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | |
| 761 | 761 | $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); |
| 762 | 762 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 763 | - if(($width > $max_width || $height > $max_height ) && $type != 1) |
|
| 763 | + if (($width > $max_width || $height > $max_height) && $type != 1) |
|
| 764 | 764 | { |
| 765 | 765 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
| 766 | 766 | } |
@@ -779,17 +779,17 @@ discard block |
||
| 779 | 779 | { |
| 780 | 780 | // Check if the file is successfully uploaded |
| 781 | 781 | $file = $_FILES['image_name']; |
| 782 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 782 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 783 | 783 | // Ignore if member_srl is invalid or doesn't exist. |
| 784 | 784 | $member_srl = Context::get('member_srl'); |
| 785 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 785 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 786 | 786 | |
| 787 | 787 | $logged_info = Context::get('logged_info'); |
| 788 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 788 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 789 | 789 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 790 | 790 | $oModuleModel = getModel('module'); |
| 791 | 791 | $config = $oModuleModel->getModuleConfig('member'); |
| 792 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 792 | + if ($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 793 | 793 | |
| 794 | 794 | $this->insertImageName($member_srl, $file['tmp_name']); |
| 795 | 795 | // Page refresh |
@@ -810,15 +810,15 @@ discard block |
||
| 810 | 810 | function insertImageName($member_srl, $target_file) |
| 811 | 811 | { |
| 812 | 812 | // Check uploaded file |
| 813 | - if(!checkUploadedFile($target_file)) return; |
|
| 813 | + if (!checkUploadedFile($target_file)) return; |
|
| 814 | 814 | |
| 815 | 815 | $oModuleModel = getModel('module'); |
| 816 | 816 | $config = $oModuleModel->getModuleConfig('member'); |
| 817 | 817 | // Get an image size |
| 818 | 818 | $max_width = $config->image_name_max_width; |
| 819 | - if(!$max_width) $max_width = "90"; |
|
| 819 | + if (!$max_width) $max_width = "90"; |
|
| 820 | 820 | $max_height = $config->image_name_max_height; |
| 821 | - if(!$max_height) $max_height = "20"; |
|
| 821 | + if (!$max_height) $max_height = "20"; |
|
| 822 | 822 | // Get a target path to save |
| 823 | 823 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
| 824 | 824 | FileHandler::makeDir($target_path); |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | // Get file information |
| 828 | 828 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 829 | 829 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 830 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 830 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 831 | 831 | else @copy($target_file, $target_filename); |
| 832 | 832 | } |
| 833 | 833 | |
@@ -839,20 +839,20 @@ discard block |
||
| 839 | 839 | function procMemberDeleteProfileImage($_memberSrl = 0) |
| 840 | 840 | { |
| 841 | 841 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 842 | - if(!$member_srl) |
|
| 842 | + if (!$member_srl) |
|
| 843 | 843 | { |
| 844 | - return new Object(0,'success'); |
|
| 844 | + return new Object(0, 'success'); |
|
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | $logged_info = Context::get('logged_info'); |
| 848 | 848 | |
| 849 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 849 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 850 | 850 | { |
| 851 | 851 | $oMemberModel = getModel('member'); |
| 852 | 852 | $profile_image = $oMemberModel->getProfileImage($member_srl); |
| 853 | 853 | FileHandler::removeFile($profile_image->file); |
| 854 | 854 | } |
| 855 | - return new Object(0,'success'); |
|
| 855 | + return new Object(0, 'success'); |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | /** |
@@ -863,20 +863,20 @@ discard block |
||
| 863 | 863 | function procMemberDeleteImageName($_memberSrl = 0) |
| 864 | 864 | { |
| 865 | 865 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 866 | - if(!$member_srl) |
|
| 866 | + if (!$member_srl) |
|
| 867 | 867 | { |
| 868 | - return new Object(0,'success'); |
|
| 868 | + return new Object(0, 'success'); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | $logged_info = Context::get('logged_info'); |
| 872 | 872 | |
| 873 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 873 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 874 | 874 | { |
| 875 | 875 | $oMemberModel = getModel('member'); |
| 876 | 876 | $image_name = $oMemberModel->getImageName($member_srl); |
| 877 | 877 | FileHandler::removeFile($image_name->file); |
| 878 | 878 | } |
| 879 | - return new Object(0,'success'); |
|
| 879 | + return new Object(0, 'success'); |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | /** |
@@ -888,17 +888,17 @@ discard block |
||
| 888 | 888 | { |
| 889 | 889 | // Check if the file is successfully uploaded |
| 890 | 890 | $file = $_FILES['image_mark']; |
| 891 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 891 | + if (!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 892 | 892 | // Ignore if member_srl is invalid or doesn't exist. |
| 893 | 893 | $member_srl = Context::get('member_srl'); |
| 894 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 894 | + if (!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 895 | 895 | |
| 896 | 896 | $logged_info = Context::get('logged_info'); |
| 897 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 897 | + if ($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 898 | 898 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 899 | 899 | $oModuleModel = getModel('module'); |
| 900 | 900 | $config = $oModuleModel->getModuleConfig('member'); |
| 901 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 901 | + if ($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 902 | 902 | |
| 903 | 903 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 904 | 904 | // Page refresh |
@@ -919,15 +919,15 @@ discard block |
||
| 919 | 919 | function insertImageMark($member_srl, $target_file) |
| 920 | 920 | { |
| 921 | 921 | // Check uploaded file |
| 922 | - if(!checkUploadedFile($target_file)) return; |
|
| 922 | + if (!checkUploadedFile($target_file)) return; |
|
| 923 | 923 | |
| 924 | 924 | $oModuleModel = getModel('module'); |
| 925 | 925 | $config = $oModuleModel->getModuleConfig('member'); |
| 926 | 926 | // Get an image size |
| 927 | 927 | $max_width = $config->image_mark_max_width; |
| 928 | - if(!$max_width) $max_width = "20"; |
|
| 928 | + if (!$max_width) $max_width = "20"; |
|
| 929 | 929 | $max_height = $config->image_mark_max_height; |
| 930 | - if(!$max_height) $max_height = "20"; |
|
| 930 | + if (!$max_height) $max_height = "20"; |
|
| 931 | 931 | |
| 932 | 932 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
| 933 | 933 | FileHandler::makeDir($target_path); |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | // Get file information |
| 937 | 937 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 938 | 938 | |
| 939 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 939 | + if ($width > $max_width || $height > $max_height || $type != 1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 940 | 940 | else @copy($target_file, $target_filename); |
| 941 | 941 | } |
| 942 | 942 | |
@@ -948,20 +948,20 @@ discard block |
||
| 948 | 948 | function procMemberDeleteImageMark($_memberSrl = 0) |
| 949 | 949 | { |
| 950 | 950 | $member_srl = ($_memberSrl) ? $_memberSrl : Context::get('member_srl'); |
| 951 | - if(!$member_srl) |
|
| 951 | + if (!$member_srl) |
|
| 952 | 952 | { |
| 953 | - return new Object(0,'success'); |
|
| 953 | + return new Object(0, 'success'); |
|
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | $logged_info = Context::get('logged_info'); |
| 957 | 957 | |
| 958 | - if($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 958 | + if ($logged_info && ($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl)) |
|
| 959 | 959 | { |
| 960 | 960 | $oMemberModel = getModel('member'); |
| 961 | 961 | $image_mark = $oMemberModel->getImageMark($member_srl); |
| 962 | 962 | FileHandler::removeFile($image_mark->file); |
| 963 | 963 | } |
| 964 | - return new Object(0,'success'); |
|
| 964 | + return new Object(0, 'success'); |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
@@ -972,26 +972,26 @@ discard block |
||
| 972 | 972 | function procMemberFindAccount() |
| 973 | 973 | { |
| 974 | 974 | $email_address = Context::get('email_address'); |
| 975 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 975 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 976 | 976 | |
| 977 | 977 | $oMemberModel = getModel('member'); |
| 978 | 978 | $oModuleModel = getModel('module'); |
| 979 | 979 | |
| 980 | 980 | // Check if a member having the same email address exists |
| 981 | 981 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 982 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 982 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 983 | 983 | |
| 984 | 984 | // Get information of the member |
| 985 | 985 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
| 986 | 986 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 987 | 987 | |
| 988 | 988 | // Check if possible to find member's ID and password |
| 989 | - if($member_info->denied == 'Y') |
|
| 989 | + if ($member_info->denied == 'Y') |
|
| 990 | 990 | { |
| 991 | 991 | $chk_args = new stdClass; |
| 992 | 992 | $chk_args->member_srl = $member_info->member_srl; |
| 993 | 993 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 994 | - if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
| 994 | + if ($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | // Insert data into the authentication DB |
@@ -1004,19 +1004,19 @@ discard block |
||
| 1004 | 1004 | $args->is_register = 'N'; |
| 1005 | 1005 | |
| 1006 | 1006 | $output = executeQuery('member.insertAuthMail', $args); |
| 1007 | - if(!$output->toBool()) return $output; |
|
| 1007 | + if (!$output->toBool()) return $output; |
|
| 1008 | 1008 | // Get content of the email to send a member |
| 1009 | 1009 | Context::set('auth_args', $args); |
| 1010 | 1010 | |
| 1011 | 1011 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1012 | 1012 | $memberInfo = array(); |
| 1013 | 1013 | global $lang; |
| 1014 | - if(is_array($member_config->signupForm)) |
|
| 1014 | + if (is_array($member_config->signupForm)) |
|
| 1015 | 1015 | { |
| 1016 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1017 | - foreach($member_config->signupForm as $form) |
|
| 1016 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1017 | + foreach ($member_config->signupForm as $form) |
|
| 1018 | 1018 | { |
| 1019 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1019 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1020 | 1020 | { |
| 1021 | 1021 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1022 | 1022 | } |
@@ -1031,15 +1031,15 @@ discard block |
||
| 1031 | 1031 | } |
| 1032 | 1032 | Context::set('memberInfo', $memberInfo); |
| 1033 | 1033 | |
| 1034 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1035 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1034 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1035 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1036 | 1036 | |
| 1037 | 1037 | Context::set('member_config', $member_config); |
| 1038 | 1038 | |
| 1039 | 1039 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1040 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1040 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1041 | 1041 | |
| 1042 | - $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1042 | + $find_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
|
| 1043 | 1043 | Context::set('find_url', $find_url); |
| 1044 | 1044 | |
| 1045 | 1045 | $oTemplate = &TemplateHandler::getInstance(); |
@@ -1049,19 +1049,19 @@ discard block |
||
| 1049 | 1049 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1050 | 1050 | // Send a mail |
| 1051 | 1051 | $oMail = new Mail(); |
| 1052 | - $oMail->setTitle( Context::getLang('msg_find_account_title') ); |
|
| 1052 | + $oMail->setTitle(Context::getLang('msg_find_account_title')); |
|
| 1053 | 1053 | $oMail->setContent($content); |
| 1054 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1055 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1054 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1055 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1056 | 1056 | $oMail->send(); |
| 1057 | 1057 | // Return message |
| 1058 | 1058 | $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); |
| 1059 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 1059 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 1060 | 1060 | { |
| 1061 | 1061 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberFindAccount'); |
| 1062 | 1062 | $this->setRedirectUrl($returnUrl); |
| 1063 | 1063 | } |
| 1064 | - return new Object(0,$msg); |
|
| 1064 | + return new Object(0, $msg); |
|
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | /** |
@@ -1079,28 +1079,28 @@ discard block |
||
| 1079 | 1079 | $find_account_question = trim(Context::get('find_account_question')); |
| 1080 | 1080 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1081 | 1081 | |
| 1082 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
| 1082 | + if (($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
| 1083 | 1083 | |
| 1084 | 1084 | $oModuleModel = getModel('module'); |
| 1085 | 1085 | // Check if a member having the same email address exists |
| 1086 | 1086 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1087 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 1087 | + if (!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 1088 | 1088 | // Get information of the member |
| 1089 | 1089 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1090 | 1090 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1091 | 1091 | |
| 1092 | 1092 | // Display a message if no answer is entered |
| 1093 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
| 1093 | + if (!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
| 1094 | 1094 | |
| 1095 | - 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'); |
|
| 1095 | + 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'); |
|
| 1096 | 1096 | |
| 1097 | - if($config->identifier == 'email_address') |
|
| 1097 | + if ($config->identifier == 'email_address') |
|
| 1098 | 1098 | { |
| 1099 | 1099 | $user_id = $email_address; |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | // Update to a temporary password and set change_password_date to 1 |
| 1103 | - $oPassword = new Password(); |
|
| 1103 | + $oPassword = new Password(); |
|
| 1104 | 1104 | $temp_password = $oPassword->createTemporaryPassword(8); |
| 1105 | 1105 | |
| 1106 | 1106 | $args = new stdClass(); |
@@ -1108,11 +1108,11 @@ discard block |
||
| 1108 | 1108 | $args->password = $temp_password; |
| 1109 | 1109 | $args->change_password_date = '1'; |
| 1110 | 1110 | $output = $this->updateMemberPassword($args); |
| 1111 | - if(!$output->toBool()) return $output; |
|
| 1111 | + if (!$output->toBool()) return $output; |
|
| 1112 | 1112 | |
| 1113 | - $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
|
| 1113 | + $_SESSION['xe_temp_password_'.$user_id] = $temp_password; |
|
| 1114 | 1114 | |
| 1115 | - $this->add('user_id',$user_id); |
|
| 1115 | + $this->add('user_id', $user_id); |
|
| 1116 | 1116 | |
| 1117 | 1117 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', ''); |
| 1118 | 1118 | $this->setRedirectUrl($returnUrl.'&user_id='.$user_id); |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | $member_srl = Context::get('member_srl'); |
| 1133 | 1133 | $auth_key = Context::get('auth_key'); |
| 1134 | 1134 | |
| 1135 | - if(!$member_srl || !$auth_key) |
|
| 1135 | + if (!$member_srl || !$auth_key) |
|
| 1136 | 1136 | { |
| 1137 | 1137 | return $this->stop('msg_invalid_request'); |
| 1138 | 1138 | } |
@@ -1143,9 +1143,9 @@ discard block |
||
| 1143 | 1143 | $args->auth_key = $auth_key; |
| 1144 | 1144 | $output = executeQuery('member.getAuthMail', $args); |
| 1145 | 1145 | |
| 1146 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1146 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 1147 | 1147 | { |
| 1148 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1148 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) |
|
| 1149 | 1149 | { |
| 1150 | 1150 | executeQuery('member.deleteAuthMail', $args); |
| 1151 | 1151 | } |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | return $this->stop('msg_invalid_auth_key'); |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - if(ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1156 | + if (ztime($output->data->regdate) < $_SERVER['REQUEST_TIME'] + zgap() - 86400) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | executeQuery('member.deleteAuthMail', $args); |
| 1159 | 1159 | return $this->stop('msg_invalid_auth_key'); |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | $args->password = $output->data->new_password; |
| 1163 | 1163 | |
| 1164 | 1164 | // If credentials are correct, change the password to a new one |
| 1165 | - if($output->data->is_register == 'Y') |
|
| 1165 | + if ($output->data->is_register == 'Y') |
|
| 1166 | 1166 | { |
| 1167 | 1167 | $args->denied = 'N'; |
| 1168 | 1168 | } |
@@ -1175,13 +1175,13 @@ discard block |
||
| 1175 | 1175 | $is_register = $output->data->is_register; |
| 1176 | 1176 | |
| 1177 | 1177 | $output = executeQuery('member.updateMemberPassword', $args); |
| 1178 | - if(!$output->toBool()) |
|
| 1178 | + if (!$output->toBool()) |
|
| 1179 | 1179 | { |
| 1180 | 1180 | return $this->stop($output->getMessage()); |
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | 1183 | // Remove all values having the member_srl from authentication table |
| 1184 | - executeQuery('member.deleteAuthMail',$args); |
|
| 1184 | + executeQuery('member.deleteAuthMail', $args); |
|
| 1185 | 1185 | |
| 1186 | 1186 | $this->_clearMemberCache($args->member_srl); |
| 1187 | 1187 | |
@@ -1200,33 +1200,33 @@ discard block |
||
| 1200 | 1200 | { |
| 1201 | 1201 | // Get an email_address |
| 1202 | 1202 | $email_address = Context::get('email_address'); |
| 1203 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 1203 | + if (!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 1204 | 1204 | // Log test by using email_address |
| 1205 | 1205 | $oMemberModel = getModel('member'); |
| 1206 | 1206 | |
| 1207 | 1207 | $args = new stdClass; |
| 1208 | 1208 | $args->email_address = $email_address; |
| 1209 | 1209 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1210 | - if(!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
| 1210 | + if (!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
| 1211 | 1211 | |
| 1212 | 1212 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1213 | 1213 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1214 | 1214 | |
| 1215 | 1215 | $oModuleModel = getModel('module'); |
| 1216 | 1216 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1217 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1218 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1217 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1218 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1219 | 1219 | |
| 1220 | 1220 | // Check if a authentication mail has been sent previously |
| 1221 | 1221 | $chk_args = new stdClass; |
| 1222 | 1222 | $chk_args->member_srl = $member_info->member_srl; |
| 1223 | 1223 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1224 | - if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
| 1224 | + if ($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
| 1225 | 1225 | |
| 1226 | 1226 | $auth_args = new stdClass; |
| 1227 | 1227 | $auth_args->member_srl = $member_info->member_srl; |
| 1228 | 1228 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1229 | - if(!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
| 1229 | + if (!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
| 1230 | 1230 | $auth_info = $output->data[0]; |
| 1231 | 1231 | |
| 1232 | 1232 | // Update the regdate of authmail entry |
@@ -1237,12 +1237,12 @@ discard block |
||
| 1237 | 1237 | |
| 1238 | 1238 | $memberInfo = array(); |
| 1239 | 1239 | global $lang; |
| 1240 | - if(is_array($member_config->signupForm)) |
|
| 1240 | + if (is_array($member_config->signupForm)) |
|
| 1241 | 1241 | { |
| 1242 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1243 | - foreach($member_config->signupForm as $form) |
|
| 1242 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1243 | + foreach ($member_config->signupForm as $form) |
|
| 1244 | 1244 | { |
| 1245 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1245 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1246 | 1246 | { |
| 1247 | 1247 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1248 | 1248 | } |
@@ -1261,19 +1261,19 @@ discard block |
||
| 1261 | 1261 | Context::set('member_config', $member_config); |
| 1262 | 1262 | |
| 1263 | 1263 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1264 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1264 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1265 | 1265 | |
| 1266 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
|
| 1266 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_info->auth_key); |
|
| 1267 | 1267 | Context::set('auth_url', $auth_url); |
| 1268 | 1268 | |
| 1269 | 1269 | $oTemplate = &TemplateHandler::getInstance(); |
| 1270 | 1270 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1271 | 1271 | // Send a mail |
| 1272 | 1272 | $oMail = new Mail(); |
| 1273 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1273 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1274 | 1274 | $oMail->setContent($content); |
| 1275 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1276 | - $oMail->setReceiptor( $args->user_name, $args->email_address ); |
|
| 1275 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1276 | + $oMail->setReceiptor($args->user_name, $args->email_address); |
|
| 1277 | 1277 | $oMail->send(); |
| 1278 | 1278 | |
| 1279 | 1279 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
@@ -1288,23 +1288,23 @@ discard block |
||
| 1288 | 1288 | $memberInfo = $_SESSION['auth_member_info']; |
| 1289 | 1289 | unset($_SESSION['auth_member_info']); |
| 1290 | 1290 | |
| 1291 | - if(!$memberInfo) |
|
| 1291 | + if (!$memberInfo) |
|
| 1292 | 1292 | { |
| 1293 | 1293 | return $this->stop('msg_invalid_request'); |
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | $newEmail = Context::get('email_address'); |
| 1297 | 1297 | |
| 1298 | - if(!$newEmail) |
|
| 1298 | + if (!$newEmail) |
|
| 1299 | 1299 | { |
| 1300 | 1300 | return $this->stop('msg_invalid_request'); |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | $oMemberModel = getModel('member'); |
| 1304 | 1304 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 1305 | - if($member_srl) |
|
| 1305 | + if ($member_srl) |
|
| 1306 | 1306 | { |
| 1307 | - return new Object(-1,'msg_exists_email_address'); |
|
| 1307 | + return new Object(-1, 'msg_exists_email_address'); |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | // remove all key by member_srl |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | $args->member_srl = $memberInfo->member_srl; |
| 1313 | 1313 | $output = executeQuery('member.deleteAuthMail', $args); |
| 1314 | 1314 | |
| 1315 | - if(!$output->toBool()) |
|
| 1315 | + if (!$output->toBool()) |
|
| 1316 | 1316 | { |
| 1317 | 1317 | return $output; |
| 1318 | 1318 | } |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 1323 | 1323 | |
| 1324 | 1324 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 1325 | - if(!$output->toBool()) |
|
| 1325 | + if (!$output->toBool()) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | return $this->stop($output->getMessage()); |
| 1328 | 1328 | } |
@@ -1339,7 +1339,7 @@ discard block |
||
| 1339 | 1339 | $auth_args->is_register = 'Y'; |
| 1340 | 1340 | |
| 1341 | 1341 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1342 | - if(!$output->toBool()) return $output; |
|
| 1342 | + if (!$output->toBool()) return $output; |
|
| 1343 | 1343 | |
| 1344 | 1344 | $memberInfo->email_address = $newEmail; |
| 1345 | 1345 | |
@@ -1363,12 +1363,12 @@ discard block |
||
| 1363 | 1363 | $memberInfo = array(); |
| 1364 | 1364 | |
| 1365 | 1365 | global $lang; |
| 1366 | - if(is_array($member_config->signupForm)) |
|
| 1366 | + if (is_array($member_config->signupForm)) |
|
| 1367 | 1367 | { |
| 1368 | - $exceptForm=array('password', 'find_account_question'); |
|
| 1369 | - foreach($member_config->signupForm as $form) |
|
| 1368 | + $exceptForm = array('password', 'find_account_question'); |
|
| 1369 | + foreach ($member_config->signupForm as $form) |
|
| 1370 | 1370 | { |
| 1371 | - if(!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1371 | + if (!in_array($form->name, $exceptForm) && $form->isDefaultForm && ($form->required || $form->mustRequired)) |
|
| 1372 | 1372 | { |
| 1373 | 1373 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1374 | 1374 | } |
@@ -1383,25 +1383,25 @@ discard block |
||
| 1383 | 1383 | } |
| 1384 | 1384 | Context::set('memberInfo', $memberInfo); |
| 1385 | 1385 | |
| 1386 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1387 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1386 | + if (!$member_config->skin) $member_config->skin = "default"; |
|
| 1387 | + if (!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1388 | 1388 | |
| 1389 | 1389 | Context::set('member_config', $member_config); |
| 1390 | 1390 | |
| 1391 | 1391 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1392 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1392 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1393 | 1393 | |
| 1394 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 1394 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 1395 | 1395 | Context::set('auth_url', $auth_url); |
| 1396 | 1396 | |
| 1397 | 1397 | $oTemplate = &TemplateHandler::getInstance(); |
| 1398 | 1398 | $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); |
| 1399 | 1399 | // Send a mail |
| 1400 | 1400 | $oMail = new Mail(); |
| 1401 | - $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); |
|
| 1401 | + $oMail->setTitle(Context::getLang('msg_confirm_account_title')); |
|
| 1402 | 1402 | $oMail->setContent($content); |
| 1403 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 1404 | - $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); |
|
| 1403 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 1404 | + $oMail->setReceiptor($member_info->user_name, $member_info->email_address); |
|
| 1405 | 1405 | $oMail->send(); |
| 1406 | 1406 | } |
| 1407 | 1407 | |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | { |
| 1415 | 1415 | $site_module_info = Context::get('site_module_info'); |
| 1416 | 1416 | $logged_info = Context::get('logged_info'); |
| 1417 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
| 1417 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
| 1418 | 1418 | |
| 1419 | 1419 | $oMemberModel = getModel('member'); |
| 1420 | 1420 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1433,13 +1433,13 @@ discard block |
||
| 1433 | 1433 | { |
| 1434 | 1434 | $site_module_info = Context::get('site_module_info'); |
| 1435 | 1435 | $logged_info = Context::get('logged_info'); |
| 1436 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
| 1436 | + if (!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list)) return new Object(-1, 'msg_invalid_request'); |
|
| 1437 | 1437 | |
| 1438 | 1438 | $args = new stdClass; |
| 1439 | - $args->site_srl= $site_module_info->site_srl; |
|
| 1439 | + $args->site_srl = $site_module_info->site_srl; |
|
| 1440 | 1440 | $args->member_srl = $logged_info->member_srl; |
| 1441 | 1441 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1442 | - if(!$output->toBool()) return $output; |
|
| 1442 | + if (!$output->toBool()) return $output; |
|
| 1443 | 1443 | $this->setMessage('success_deleted'); |
| 1444 | 1444 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1445 | 1445 | } |
@@ -1453,25 +1453,25 @@ discard block |
||
| 1453 | 1453 | */ |
| 1454 | 1454 | function setMemberConfig($args) |
| 1455 | 1455 | { |
| 1456 | - if(!$args->skin) $args->skin = "default"; |
|
| 1457 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1458 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1459 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1460 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1461 | - $args->enable_openid= 'N'; |
|
| 1462 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1463 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1464 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1465 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1466 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1467 | - $args->limit_day = (int)$args->limit_day; |
|
| 1456 | + if (!$args->skin) $args->skin = "default"; |
|
| 1457 | + if (!$args->colorset) $args->colorset = "white"; |
|
| 1458 | + if (!$args->editor_skin) $args->editor_skin = "ckeditor"; |
|
| 1459 | + if (!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1460 | + if ($args->enable_join != 'Y') $args->enable_join = 'N'; |
|
| 1461 | + $args->enable_openid = 'N'; |
|
| 1462 | + if ($args->profile_image != 'Y') $args->profile_image = 'N'; |
|
| 1463 | + if ($args->image_name != 'Y') $args->image_name = 'N'; |
|
| 1464 | + if ($args->image_mark != 'Y') $args->image_mark = 'N'; |
|
| 1465 | + if ($args->group_image_mark != 'Y') $args->group_image_mark = 'N'; |
|
| 1466 | + if (!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1467 | + $args->limit_day = (int) $args->limit_day; |
|
| 1468 | 1468 | |
| 1469 | 1469 | $agreement = trim($args->agreement); |
| 1470 | 1470 | unset($args->agreement); |
| 1471 | 1471 | |
| 1472 | 1472 | $oModuleController = getController('module'); |
| 1473 | - $output = $oModuleController->insertModuleConfig('member',$args); |
|
| 1474 | - if(!$output->toBool()) return $output; |
|
| 1473 | + $output = $oModuleController->insertModuleConfig('member', $args); |
|
| 1474 | + if (!$output->toBool()) return $output; |
|
| 1475 | 1475 | |
| 1476 | 1476 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1477 | 1477 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1492,11 +1492,11 @@ discard block |
||
| 1492 | 1492 | $signature = trim(removeHackTag($signature)); |
| 1493 | 1493 | $signature = preg_replace('/<(\/?)(embed|object|param)/is', '<$1$2', $signature); |
| 1494 | 1494 | |
| 1495 | - $check_signature = trim(str_replace(array(' ',"\n","\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1495 | + $check_signature = trim(str_replace(array(' ', "\n", "\r"), '', strip_tags($signature, '<img><object>'))); |
|
| 1496 | 1496 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1497 | 1497 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1498 | 1498 | |
| 1499 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1499 | + if (!$check_signature) return FileHandler::removeFile($filename); |
|
| 1500 | 1500 | |
| 1501 | 1501 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1502 | 1502 | FileHandler::makeDir($path); |
@@ -1525,15 +1525,15 @@ discard block |
||
| 1525 | 1525 | * |
| 1526 | 1526 | * @return Object |
| 1527 | 1527 | */ |
| 1528 | - function addMemberToGroup($member_srl, $group_srl, $site_srl=0) |
|
| 1528 | + function addMemberToGroup($member_srl, $group_srl, $site_srl = 0) |
|
| 1529 | 1529 | { |
| 1530 | 1530 | $args = new stdClass(); |
| 1531 | 1531 | $args->member_srl = $member_srl; |
| 1532 | 1532 | $args->group_srl = $group_srl; |
| 1533 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1533 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1534 | 1534 | |
| 1535 | 1535 | // Add |
| 1536 | - $output = executeQuery('member.addMemberToGroup',$args); |
|
| 1536 | + $output = executeQuery('member.addMemberToGroup', $args); |
|
| 1537 | 1537 | $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); |
| 1538 | 1538 | |
| 1539 | 1539 | $this->_clearMemberCache($member_srl, $site_srl); |
@@ -1553,18 +1553,18 @@ discard block |
||
| 1553 | 1553 | { |
| 1554 | 1554 | $obj = new stdClass; |
| 1555 | 1555 | $obj->site_srl = $args->site_srl; |
| 1556 | - $obj->member_srl = implode(',',$args->member_srl); |
|
| 1556 | + $obj->member_srl = implode(',', $args->member_srl); |
|
| 1557 | 1557 | |
| 1558 | 1558 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1559 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1559 | + if ($output->data) foreach ($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1560 | 1560 | |
| 1561 | 1561 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1562 | - if(!$output->toBool()) return $output; |
|
| 1562 | + if (!$output->toBool()) return $output; |
|
| 1563 | 1563 | |
| 1564 | 1564 | $inserted_members = array(); |
| 1565 | - foreach($args->member_srl as $key => $val) |
|
| 1565 | + foreach ($args->member_srl as $key => $val) |
|
| 1566 | 1566 | { |
| 1567 | - if($inserted_members[$val]) continue; |
|
| 1567 | + if ($inserted_members[$val]) continue; |
|
| 1568 | 1568 | $inserted_members[$val] = true; |
| 1569 | 1569 | |
| 1570 | 1570 | unset($obj); |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | $obj->site_srl = $args->site_srl; |
| 1575 | 1575 | $obj->regdate = $date[$obj->member_srl]; |
| 1576 | 1576 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1577 | - if(!$output->toBool()) return $output; |
|
| 1577 | + if (!$output->toBool()) return $output; |
|
| 1578 | 1578 | |
| 1579 | 1579 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1580 | 1580 | } |
@@ -1596,9 +1596,9 @@ discard block |
||
| 1596 | 1596 | // Get information of the key |
| 1597 | 1597 | $output = executeQuery('member.getAutologin', $args); |
| 1598 | 1598 | // If no information exists, delete a cookie |
| 1599 | - if(!$output->toBool() || !$output->data) |
|
| 1599 | + if (!$output->toBool() || !$output->data) |
|
| 1600 | 1600 | { |
| 1601 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1601 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1602 | 1602 | return; |
| 1603 | 1603 | } |
| 1604 | 1604 | |
@@ -1608,9 +1608,9 @@ discard block |
||
| 1608 | 1608 | $user_id = ($config->identifier == 'user_id') ? $output->data->user_id : $output->data->email_address; |
| 1609 | 1609 | $password = $output->data->password; |
| 1610 | 1610 | |
| 1611 | - if(!$user_id || !$password) |
|
| 1611 | + if (!$user_id || !$password) |
|
| 1612 | 1612 | { |
| 1613 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1613 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1614 | 1614 | return; |
| 1615 | 1615 | } |
| 1616 | 1616 | |
@@ -1620,7 +1620,7 @@ discard block |
||
| 1620 | 1620 | $check_key = strtolower($user_id).$password.$_SERVER['HTTP_USER_AGENT']; |
| 1621 | 1621 | $check_key = substr(hash_hmac('sha256', $check_key, substr($args->autologin_key, 0, 32)), 0, 32); |
| 1622 | 1622 | |
| 1623 | - if($check_key === substr($args->autologin_key, 32)) |
|
| 1623 | + if ($check_key === substr($args->autologin_key, 32)) |
|
| 1624 | 1624 | { |
| 1625 | 1625 | // Check change_password_date |
| 1626 | 1626 | $oModuleModel = getModel('module'); |
@@ -1628,12 +1628,12 @@ discard block |
||
| 1628 | 1628 | $limit_date = $member_config->change_password_date; |
| 1629 | 1629 | |
| 1630 | 1630 | // Check if change_password_date is set |
| 1631 | - if($limit_date > 0) |
|
| 1631 | + if ($limit_date > 0) |
|
| 1632 | 1632 | { |
| 1633 | 1633 | $oMemberModel = getModel('member'); |
| 1634 | 1634 | $columnList = array('member_srl', 'change_password_date'); |
| 1635 | 1635 | |
| 1636 | - if($config->identifier == 'user_id') |
|
| 1636 | + if ($config->identifier == 'user_id') |
|
| 1637 | 1637 | { |
| 1638 | 1638 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1639 | 1639 | } |
@@ -1642,7 +1642,7 @@ discard block |
||
| 1642 | 1642 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | - if($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day')) ){ |
|
| 1645 | + if ($member_info->change_password_date >= date('YmdHis', strtotime('-'.$limit_date.' day'))) { |
|
| 1646 | 1646 | $do_auto_login = true; |
| 1647 | 1647 | } |
| 1648 | 1648 | |
@@ -1653,14 +1653,14 @@ discard block |
||
| 1653 | 1653 | } |
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | - if($do_auto_login) |
|
| 1656 | + if ($do_auto_login) |
|
| 1657 | 1657 | { |
| 1658 | 1658 | $output = $this->doLogin($user_id); |
| 1659 | 1659 | } |
| 1660 | 1660 | else |
| 1661 | 1661 | { |
| 1662 | 1662 | executeQuery('member.deleteAutologin', $args); |
| 1663 | - setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
|
| 1663 | + setCookie('xeak', null, $_SERVER['REQUEST_TIME'] + 60 * 60 * 24 * 365); |
|
| 1664 | 1664 | } |
| 1665 | 1665 | } |
| 1666 | 1666 | |
@@ -1676,13 +1676,13 @@ discard block |
||
| 1676 | 1676 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1677 | 1677 | { |
| 1678 | 1678 | $user_id = strtolower($user_id); |
| 1679 | - if(!$user_id) return new Object(-1, 'null_user_id'); |
|
| 1679 | + if (!$user_id) return new Object(-1, 'null_user_id'); |
|
| 1680 | 1680 | // Call a trigger before log-in (before) |
| 1681 | 1681 | $trigger_obj = new stdClass(); |
| 1682 | 1682 | $trigger_obj->user_id = $user_id; |
| 1683 | 1683 | $trigger_obj->password = $password; |
| 1684 | 1684 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1685 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1685 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1686 | 1686 | // Create a member model object |
| 1687 | 1687 | $oMemberModel = getModel('member'); |
| 1688 | 1688 | |
@@ -1692,12 +1692,12 @@ discard block |
||
| 1692 | 1692 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1693 | 1693 | |
| 1694 | 1694 | // check identifier |
| 1695 | - if($config->identifier == 'email_address') |
|
| 1695 | + if ($config->identifier == 'email_address') |
|
| 1696 | 1696 | { |
| 1697 | 1697 | // Get user_id information |
| 1698 | 1698 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1699 | 1699 | // Set an invalid user if no value returned |
| 1700 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1700 | + if (!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1701 | 1701 | |
| 1702 | 1702 | } |
| 1703 | 1703 | else |
@@ -1705,24 +1705,24 @@ discard block |
||
| 1705 | 1705 | // Get user_id information |
| 1706 | 1706 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1707 | 1707 | // Set an invalid user if no value returned |
| 1708 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1708 | + if (!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | 1711 | $output = executeQuery('member.getLoginCountByIp', $args); |
| 1712 | 1712 | $errorCount = $output->data->count; |
| 1713 | - if($errorCount >= $config->max_error_count) |
|
| 1713 | + if ($errorCount >= $config->max_error_count) |
|
| 1714 | 1714 | { |
| 1715 | 1715 | $last_update = strtotime($output->data->last_update); |
| 1716 | - $term = intval($_SERVER['REQUEST_TIME']-$last_update); |
|
| 1717 | - if($term < $config->max_error_count_time) |
|
| 1716 | + $term = intval($_SERVER['REQUEST_TIME'] - $last_update); |
|
| 1717 | + if ($term < $config->max_error_count_time) |
|
| 1718 | 1718 | { |
| 1719 | 1719 | $term = $config->max_error_count_time - $term; |
| 1720 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1721 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1722 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1723 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1720 | + if ($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1721 | + elseif (60 <= $term && $term < 3600) $term = intval($term / 60).Context::getLang('unit_min'); |
|
| 1722 | + elseif (3600 <= $term && $term < 86400) $term = intval($term / 3600).Context::getLang('unit_hour'); |
|
| 1723 | + else $term = intval($term / 86400).Context::getLang('unit_day'); |
|
| 1724 | 1724 | |
| 1725 | - return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
|
| 1725 | + return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'), $term)); |
|
| 1726 | 1726 | } |
| 1727 | 1727 | else |
| 1728 | 1728 | { |
@@ -1732,13 +1732,13 @@ discard block |
||
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | 1734 | // Password Check |
| 1735 | - if($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1735 | + if ($password && !$oMemberModel->isValidPassword($this->memberInfo->password, $password, $this->memberInfo->member_srl)) |
|
| 1736 | 1736 | { |
| 1737 | - return $this->recordMemberLoginError(-1, 'invalid_password',$this->memberInfo); |
|
| 1737 | + return $this->recordMemberLoginError(-1, 'invalid_password', $this->memberInfo); |
|
| 1738 | 1738 | } |
| 1739 | 1739 | |
| 1740 | 1740 | // If denied == 'Y', notify |
| 1741 | - if($this->memberInfo->denied == 'Y') |
|
| 1741 | + if ($this->memberInfo->denied == 'Y') |
|
| 1742 | 1742 | { |
| 1743 | 1743 | $args->member_srl = $this->memberInfo->member_srl; |
| 1744 | 1744 | $output = executeQuery('member.chkAuthMail', $args); |
@@ -1746,12 +1746,12 @@ discard block |
||
| 1746 | 1746 | { |
| 1747 | 1747 | $_SESSION['auth_member_srl'] = $this->memberInfo->member_srl; |
| 1748 | 1748 | $redirectUrl = getUrl('', 'act', 'dispMemberResendAuthMail'); |
| 1749 | - return $this->setRedirectUrl($redirectUrl, new Object(-1,'msg_user_not_confirmed')); |
|
| 1749 | + return $this->setRedirectUrl($redirectUrl, new Object(-1, 'msg_user_not_confirmed')); |
|
| 1750 | 1750 | } |
| 1751 | - return new Object(-1,'msg_user_denied'); |
|
| 1751 | + return new Object(-1, 'msg_user_denied'); |
|
| 1752 | 1752 | } |
| 1753 | 1753 | // Notify if denied_date is less than the current time |
| 1754 | - 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"))); |
|
| 1754 | + 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"))); |
|
| 1755 | 1755 | // Update the latest login time |
| 1756 | 1756 | $args->member_srl = $this->memberInfo->member_srl; |
| 1757 | 1757 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1761,36 +1761,36 @@ discard block |
||
| 1761 | 1761 | |
| 1762 | 1762 | // Check if there is recoding table. |
| 1763 | 1763 | $oDB = &DB::getInstance(); |
| 1764 | - if($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1764 | + if ($oDB->isTableExists('member_count_history') && $config->enable_login_fail_report != 'N') |
|
| 1765 | 1765 | { |
| 1766 | 1766 | // check if there is login fail records. |
| 1767 | 1767 | $output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args); |
| 1768 | - if($output->data && $output->data->content) |
|
| 1768 | + if ($output->data && $output->data->content) |
|
| 1769 | 1769 | { |
| 1770 | 1770 | $title = Context::getLang('login_fail_report'); |
| 1771 | 1771 | $message = '<ul>'; |
| 1772 | 1772 | $content = unserialize($output->data->content); |
| 1773 | - if(count($content) > $config->max_error_count) |
|
| 1773 | + if (count($content) > $config->max_error_count) |
|
| 1774 | 1774 | { |
| 1775 | - foreach($content as $val) |
|
| 1775 | + foreach ($content as $val) |
|
| 1776 | 1776 | { |
| 1777 | - $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>'; |
|
| 1777 | + $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>'; |
|
| 1778 | 1778 | } |
| 1779 | 1779 | $message .= '</ul>'; |
| 1780 | - $content = sprintf(Context::getLang('login_fail_report_contents'),$message,date('Y-m-d h:i:sa')); |
|
| 1780 | + $content = sprintf(Context::getLang('login_fail_report_contents'), $message, date('Y-m-d h:i:sa')); |
|
| 1781 | 1781 | |
| 1782 | 1782 | //send message |
| 1783 | 1783 | $oCommunicationController = getController('communication'); |
| 1784 | 1784 | $oCommunicationController->sendMessage($args->member_srl, $args->member_srl, $title, $content, true); |
| 1785 | 1785 | |
| 1786 | - if($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1786 | + if ($this->memberInfo->email_address && $this->memberInfo->allow_mailing == 'Y') |
|
| 1787 | 1787 | { |
| 1788 | 1788 | $view_url = Context::getRequestUri(); |
| 1789 | - $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); |
|
| 1789 | + $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); |
|
| 1790 | 1790 | $oMail = new Mail(); |
| 1791 | 1791 | $oMail->setTitle($title); |
| 1792 | 1792 | $oMail->setContent($content); |
| 1793 | - $oMail->setSender($config->webmaster_name?$config->webmaster_name:'webmaster', $config->webmaster_email); |
|
| 1793 | + $oMail->setSender($config->webmaster_name ? $config->webmaster_name : 'webmaster', $config->webmaster_email); |
|
| 1794 | 1794 | $oMail->setReceiptor($this->memberInfo->email_id.'('.$this->memberInfo->nick_name.')', $this->memberInfo->email_address); |
| 1795 | 1795 | $oMail->send(); |
| 1796 | 1796 | } |
@@ -1800,9 +1800,9 @@ discard block |
||
| 1800 | 1800 | } |
| 1801 | 1801 | // Call a trigger after successfully log-in (after) |
| 1802 | 1802 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1803 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1803 | + if (!$trigger_output->toBool()) return $trigger_output; |
|
| 1804 | 1804 | // When user checked to use auto-login |
| 1805 | - if($keep_signed) |
|
| 1805 | + if ($keep_signed) |
|
| 1806 | 1806 | { |
| 1807 | 1807 | // Key generate for auto login |
| 1808 | 1808 | $oPassword = new Password(); |
@@ -1814,12 +1814,12 @@ discard block |
||
| 1814 | 1814 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1815 | 1815 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1816 | 1816 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1817 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 1817 | + if ($autologin_output->toBool()) setCookie('xeak', $autologin_args->autologin_key, $_SERVER['REQUEST_TIME'] + 31536000); |
|
| 1818 | 1818 | } |
| 1819 | - if($this->memberInfo->is_admin == 'Y') |
|
| 1819 | + if ($this->memberInfo->is_admin == 'Y') |
|
| 1820 | 1820 | { |
| 1821 | 1821 | $oMemberAdminModel = getAdminModel('member'); |
| 1822 | - if(!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1822 | + if (!$oMemberAdminModel->getMemberAdminIPCheck()) |
|
| 1823 | 1823 | { |
| 1824 | 1824 | $_SESSION['denied_admin'] = 'Y'; |
| 1825 | 1825 | } |
@@ -1837,18 +1837,18 @@ discard block |
||
| 1837 | 1837 | { |
| 1838 | 1838 | $oMemberModel = getModel('member'); |
| 1839 | 1839 | // If your information came through the current session information to extract information from the users |
| 1840 | - if(!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) |
|
| 1840 | + if (!$this->memberInfo && $_SESSION['member_srl'] && $oMemberModel->isLogged()) |
|
| 1841 | 1841 | { |
| 1842 | 1842 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); |
| 1843 | 1843 | // If you do not destroy the session Profile |
| 1844 | - if($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 1844 | + if ($this->memberInfo->member_srl != $_SESSION['member_srl']) |
|
| 1845 | 1845 | { |
| 1846 | 1846 | $this->destroySessionInfo(); |
| 1847 | 1847 | return; |
| 1848 | 1848 | } |
| 1849 | 1849 | } |
| 1850 | 1850 | // Stop using the session id is destroyed |
| 1851 | - if($this->memberInfo->denied=='Y') |
|
| 1851 | + if ($this->memberInfo->denied == 'Y') |
|
| 1852 | 1852 | { |
| 1853 | 1853 | $this->destroySessionInfo(); |
| 1854 | 1854 | return; |
@@ -1878,10 +1878,10 @@ discard block |
||
| 1878 | 1878 | Context::set('logged_info', $this->memberInfo); |
| 1879 | 1879 | |
| 1880 | 1880 | // Only the menu configuration of the user (such as an add-on to the menu can be changed) |
| 1881 | - $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); |
|
| 1882 | - $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 1883 | - $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 1884 | - $this->addMemberMenu( 'dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 1881 | + $this->addMemberMenu('dispMemberInfo', 'cmd_view_member_info'); |
|
| 1882 | + $this->addMemberMenu('dispMemberScrappedDocument', 'cmd_view_scrapped_document'); |
|
| 1883 | + $this->addMemberMenu('dispMemberSavedDocument', 'cmd_view_saved_document'); |
|
| 1884 | + $this->addMemberMenu('dispMemberOwnDocument', 'cmd_view_own_document'); |
|
| 1885 | 1885 | } |
| 1886 | 1886 | |
| 1887 | 1887 | /** |
@@ -1903,7 +1903,7 @@ discard block |
||
| 1903 | 1903 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 1904 | 1904 | { |
| 1905 | 1905 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 1906 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 1906 | + if (!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 1907 | 1907 | |
| 1908 | 1908 | $obj = new stdClass; |
| 1909 | 1909 | $obj->url = $url; |
@@ -1922,33 +1922,33 @@ discard block |
||
| 1922 | 1922 | { |
| 1923 | 1923 | // Call a trigger (before) |
| 1924 | 1924 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 1925 | - if(!$output->toBool()) return $output; |
|
| 1925 | + if (!$output->toBool()) return $output; |
|
| 1926 | 1926 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 1927 | 1927 | $oModuleModel = getModel('module'); |
| 1928 | 1928 | $config = $oModuleModel->getModuleConfig('member'); |
| 1929 | 1929 | |
| 1930 | 1930 | $logged_info = Context::get('logged_info'); |
| 1931 | 1931 | // If the date of the temporary restrictions limit further information on the date of |
| 1932 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 1932 | + if ($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME'] + $config->limit_day * 60 * 60 * 24); |
|
| 1933 | 1933 | |
| 1934 | 1934 | $args->member_srl = getNextSequence(); |
| 1935 | 1935 | $args->list_order = -1 * $args->member_srl; |
| 1936 | 1936 | |
| 1937 | 1937 | // Execute insert or update depending on the value of member_srl |
| 1938 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 1938 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 1939 | 1939 | // Enter the user's identity changed to lowercase |
| 1940 | 1940 | else $args->user_id = strtolower($args->user_id); |
| 1941 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 1942 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 1941 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 1942 | + if (!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 1943 | 1943 | |
| 1944 | 1944 | // Control of essential parameters |
| 1945 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 1946 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 1947 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 1945 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 1946 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 1947 | + if (!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F')))) $args->allow_message = 'Y'; |
|
| 1948 | 1948 | |
| 1949 | - if($logged_info->is_admin == 'Y') |
|
| 1949 | + if ($logged_info->is_admin == 'Y') |
|
| 1950 | 1950 | { |
| 1951 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 1951 | + if ($args->is_admin != 'Y') $args->is_admin = 'N'; |
|
| 1952 | 1952 | } |
| 1953 | 1953 | else |
| 1954 | 1954 | { |
@@ -1963,88 +1963,88 @@ discard block |
||
| 1963 | 1963 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1964 | 1964 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1965 | 1965 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1966 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 1967 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 1966 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//i", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 1967 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//i", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 1968 | 1968 | |
| 1969 | 1969 | // Create a model object |
| 1970 | 1970 | $oMemberModel = getModel('member'); |
| 1971 | 1971 | |
| 1972 | 1972 | // Check password strength |
| 1973 | - if($args->password && !$password_is_hashed) |
|
| 1973 | + if ($args->password && !$password_is_hashed) |
|
| 1974 | 1974 | { |
| 1975 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 1975 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 1976 | 1976 | { |
| 1977 | 1977 | $message = Context::getLang('about_password_strength'); |
| 1978 | 1978 | return new Object(-1, $message[$config->password_strength]); |
| 1979 | 1979 | } |
| 1980 | 1980 | $args->password = $oMemberModel->hashPassword($args->password); |
| 1981 | 1981 | } |
| 1982 | - elseif(!$args->password) |
|
| 1982 | + elseif (!$args->password) |
|
| 1983 | 1983 | { |
| 1984 | 1984 | unset($args->password); |
| 1985 | 1985 | } |
| 1986 | 1986 | |
| 1987 | 1987 | // Check if ID is prohibited |
| 1988 | - if($oMemberModel->isDeniedID($args->user_id)) |
|
| 1988 | + if ($oMemberModel->isDeniedID($args->user_id)) |
|
| 1989 | 1989 | { |
| 1990 | - return new Object(-1,'denied_user_id'); |
|
| 1990 | + return new Object(-1, 'denied_user_id'); |
|
| 1991 | 1991 | } |
| 1992 | 1992 | |
| 1993 | 1993 | // Check if ID is duplicate |
| 1994 | 1994 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 1995 | - if($member_srl) |
|
| 1995 | + if ($member_srl) |
|
| 1996 | 1996 | { |
| 1997 | - return new Object(-1,'msg_exists_user_id'); |
|
| 1997 | + return new Object(-1, 'msg_exists_user_id'); |
|
| 1998 | 1998 | } |
| 1999 | 1999 | |
| 2000 | 2000 | // Check if nickname is prohibited |
| 2001 | - if($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2001 | + if ($oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2002 | 2002 | { |
| 2003 | - return new Object(-1,'denied_nick_name'); |
|
| 2003 | + return new Object(-1, 'denied_nick_name'); |
|
| 2004 | 2004 | } |
| 2005 | 2005 | |
| 2006 | 2006 | // Check if nickname is duplicate |
| 2007 | 2007 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2008 | - if($member_srl) |
|
| 2008 | + if ($member_srl) |
|
| 2009 | 2009 | { |
| 2010 | - return new Object(-1,'msg_exists_nick_name'); |
|
| 2010 | + return new Object(-1, 'msg_exists_nick_name'); |
|
| 2011 | 2011 | } |
| 2012 | 2012 | |
| 2013 | 2013 | // Check if email address is duplicate |
| 2014 | 2014 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 2015 | - if($member_srl) |
|
| 2015 | + if ($member_srl) |
|
| 2016 | 2016 | { |
| 2017 | - return new Object(-1,'msg_exists_email_address'); |
|
| 2017 | + return new Object(-1, 'msg_exists_email_address'); |
|
| 2018 | 2018 | } |
| 2019 | 2019 | |
| 2020 | 2020 | // Insert data into the DB |
| 2021 | 2021 | $args->list_order = -1 * $args->member_srl; |
| 2022 | 2022 | |
| 2023 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2024 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2023 | + if (!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2024 | + if (!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2025 | 2025 | |
| 2026 | 2026 | $oDB = &DB::getInstance(); |
| 2027 | 2027 | $oDB->begin(); |
| 2028 | 2028 | |
| 2029 | 2029 | $output = executeQuery('member.insertMember', $args); |
| 2030 | - if(!$output->toBool()) |
|
| 2030 | + if (!$output->toBool()) |
|
| 2031 | 2031 | { |
| 2032 | 2032 | $oDB->rollback(); |
| 2033 | 2033 | return $output; |
| 2034 | 2034 | } |
| 2035 | 2035 | |
| 2036 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2036 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2037 | 2037 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2038 | 2038 | // If no value is entered the default group, the value of group registration |
| 2039 | - if(!$args->group_srl_list) |
|
| 2039 | + if (!$args->group_srl_list) |
|
| 2040 | 2040 | { |
| 2041 | 2041 | $columnList = array('site_srl', 'group_srl'); |
| 2042 | 2042 | $default_group = $oMemberModel->getDefaultGroup(0, $columnList); |
| 2043 | - if($default_group) |
|
| 2043 | + if ($default_group) |
|
| 2044 | 2044 | { |
| 2045 | 2045 | // Add to the default group |
| 2046 | - $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); |
|
| 2047 | - if(!$output->toBool()) |
|
| 2046 | + $output = $this->addMemberToGroup($args->member_srl, $default_group->group_srl); |
|
| 2047 | + if (!$output->toBool()) |
|
| 2048 | 2048 | { |
| 2049 | 2049 | $oDB->rollback(); |
| 2050 | 2050 | return $output; |
@@ -2054,11 +2054,11 @@ discard block |
||
| 2054 | 2054 | } |
| 2055 | 2055 | else |
| 2056 | 2056 | { |
| 2057 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2057 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2058 | 2058 | { |
| 2059 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2059 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2060 | 2060 | |
| 2061 | - if(!$output->toBool()) |
|
| 2061 | + if (!$output->toBool()) |
|
| 2062 | 2062 | { |
| 2063 | 2063 | $oDB->rollback(); |
| 2064 | 2064 | return $output; |
@@ -2068,7 +2068,7 @@ discard block |
||
| 2068 | 2068 | |
| 2069 | 2069 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2070 | 2070 | // When using email authentication mode (when you subscribed members denied a) certified mail sent |
| 2071 | - if($args->denied == 'Y') |
|
| 2071 | + if ($args->denied == 'Y') |
|
| 2072 | 2072 | { |
| 2073 | 2073 | // Insert data into the authentication DB |
| 2074 | 2074 | $oPassword = new Password(); |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | $auth_args->is_register = 'Y'; |
| 2081 | 2081 | |
| 2082 | 2082 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2083 | - if(!$output->toBool()) |
|
| 2083 | + if (!$output->toBool()) |
|
| 2084 | 2084 | { |
| 2085 | 2085 | $oDB->rollback(); |
| 2086 | 2086 | return $output; |
@@ -2088,10 +2088,10 @@ discard block |
||
| 2088 | 2088 | $this->_sendAuthMail($auth_args, $args); |
| 2089 | 2089 | } |
| 2090 | 2090 | // Call a trigger (after) |
| 2091 | - if($output->toBool()) |
|
| 2091 | + if ($output->toBool()) |
|
| 2092 | 2092 | { |
| 2093 | 2093 | $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); |
| 2094 | - if(!$trigger_output->toBool()) |
|
| 2094 | + if (!$trigger_output->toBool()) |
|
| 2095 | 2095 | { |
| 2096 | 2096 | $oDB->rollback(); |
| 2097 | 2097 | return $trigger_output; |
@@ -2113,41 +2113,41 @@ discard block |
||
| 2113 | 2113 | { |
| 2114 | 2114 | // Call a trigger (before) |
| 2115 | 2115 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2116 | - if(!$output->toBool()) return $output; |
|
| 2116 | + if (!$output->toBool()) return $output; |
|
| 2117 | 2117 | // Create a model object |
| 2118 | 2118 | $oMemberModel = getModel('member'); |
| 2119 | 2119 | |
| 2120 | 2120 | $logged_info = Context::get('logged_info'); |
| 2121 | 2121 | // Get what you want to modify the original information |
| 2122 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2122 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2123 | 2123 | // Control of essential parameters |
| 2124 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2125 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2124 | + if ($args->allow_mailing != 'Y') $args->allow_mailing = 'N'; |
|
| 2125 | + if ($args->allow_message && !in_array($args->allow_message, array('Y', 'N', 'F'))) $args->allow_message = 'Y'; |
|
| 2126 | 2126 | |
| 2127 | - if($logged_info->is_admin == 'Y') |
|
| 2127 | + if ($logged_info->is_admin == 'Y') |
|
| 2128 | 2128 | { |
| 2129 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2130 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2129 | + if ($args->denied != 'Y') $args->denied = 'N'; |
|
| 2130 | + if ($args->is_admin != 'Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2131 | 2131 | } |
| 2132 | 2132 | else |
| 2133 | 2133 | { |
| 2134 | 2134 | unset($args->is_admin); |
| 2135 | - if($is_admin == false) |
|
| 2135 | + if ($is_admin == false) |
|
| 2136 | 2136 | unset($args->denied); |
| 2137 | - if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2137 | + if ($logged_info->member_srl != $args->member_srl && $is_admin == false) |
|
| 2138 | 2138 | { |
| 2139 | 2139 | return $this->stop('msg_invalid_request'); |
| 2140 | 2140 | } |
| 2141 | 2141 | } |
| 2142 | 2142 | |
| 2143 | 2143 | // Sanitize user ID, username, nickname, homepage, blog |
| 2144 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2144 | + if ($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2145 | 2145 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2146 | 2146 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2147 | 2147 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2148 | 2148 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2149 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2150 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2149 | + if ($args->homepage && !preg_match("/^[a-z]+:\/\//is", $args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2150 | + if ($args->blog && !preg_match("/^[a-z]+:\/\//is", $args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2151 | 2151 | |
| 2152 | 2152 | // check member identifier form |
| 2153 | 2153 | $config = $oMemberModel->getMemberConfig(); |
@@ -2156,56 +2156,56 @@ discard block |
||
| 2156 | 2156 | $orgMemberInfo = $output->data; |
| 2157 | 2157 | |
| 2158 | 2158 | // Check if email address or user ID is duplicate |
| 2159 | - if($config->identifier == 'email_address') |
|
| 2159 | + if ($config->identifier == 'email_address') |
|
| 2160 | 2160 | { |
| 2161 | 2161 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($args->email_address); |
| 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_email_address'); |
|
| 2164 | + return new Object(-1, 'msg_exists_email_address'); |
|
| 2165 | 2165 | } |
| 2166 | 2166 | $args->email_address = $orgMemberInfo->email_address; |
| 2167 | 2167 | } |
| 2168 | 2168 | else |
| 2169 | 2169 | { |
| 2170 | 2170 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2171 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2171 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2172 | 2172 | { |
| 2173 | - return new Object(-1,'msg_exists_user_id'); |
|
| 2173 | + return new Object(-1, 'msg_exists_user_id'); |
|
| 2174 | 2174 | } |
| 2175 | 2175 | |
| 2176 | 2176 | $args->user_id = $orgMemberInfo->user_id; |
| 2177 | 2177 | } |
| 2178 | 2178 | |
| 2179 | - if($logged_info->is_admin !== 'Y') |
|
| 2179 | + if ($logged_info->is_admin !== 'Y') |
|
| 2180 | 2180 | { |
| 2181 | 2181 | // Check if ID is prohibited |
| 2182 | - if($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2182 | + if ($args->user_id && $oMemberModel->isDeniedID($args->user_id)) |
|
| 2183 | 2183 | { |
| 2184 | - return new Object(-1,'denied_user_id'); |
|
| 2184 | + return new Object(-1, 'denied_user_id'); |
|
| 2185 | 2185 | } |
| 2186 | 2186 | |
| 2187 | 2187 | // Check if nickname is prohibited |
| 2188 | - if($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2188 | + if ($args->nick_name && $oMemberModel->isDeniedNickName($args->nick_name)) |
|
| 2189 | 2189 | { |
| 2190 | 2190 | return new Object(-1, 'denied_nick_name'); |
| 2191 | 2191 | } |
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | 2194 | // Check if ID is duplicate |
| 2195 | - if($args->user_id) |
|
| 2195 | + if ($args->user_id) |
|
| 2196 | 2196 | { |
| 2197 | 2197 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2198 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2198 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2199 | 2199 | { |
| 2200 | - return new Object(-1,'msg_exists_user_id'); |
|
| 2200 | + return new Object(-1, 'msg_exists_user_id'); |
|
| 2201 | 2201 | } |
| 2202 | 2202 | } |
| 2203 | 2203 | |
| 2204 | 2204 | // Check if nickname is duplicate |
| 2205 | 2205 | $member_srl = $oMemberModel->getMemberSrlByNickName($args->nick_name); |
| 2206 | - if($member_srl && $args->member_srl != $member_srl) |
|
| 2206 | + if ($member_srl && $args->member_srl != $member_srl) |
|
| 2207 | 2207 | { |
| 2208 | - return new Object(-1,'msg_exists_nick_name'); |
|
| 2208 | + return new Object(-1, 'msg_exists_nick_name'); |
|
| 2209 | 2209 | } |
| 2210 | 2210 | |
| 2211 | 2211 | list($args->email_id, $args->email_host) = explode('@', $args->email_address); |
@@ -2214,9 +2214,9 @@ discard block |
||
| 2214 | 2214 | $oDB->begin(); |
| 2215 | 2215 | |
| 2216 | 2216 | // Check password strength |
| 2217 | - if($args->password) |
|
| 2217 | + if ($args->password) |
|
| 2218 | 2218 | { |
| 2219 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2219 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2220 | 2220 | { |
| 2221 | 2221 | $message = Context::getLang('about_password_strength'); |
| 2222 | 2222 | return new Object(-1, $message[$config->password_strength]); |
@@ -2228,40 +2228,40 @@ discard block |
||
| 2228 | 2228 | $args->password = $orgMemberInfo->password; |
| 2229 | 2229 | } |
| 2230 | 2230 | |
| 2231 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2232 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2233 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2234 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2235 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2231 | + if (!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2232 | + if (!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2233 | + if (!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2234 | + if (!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2235 | + if (!$args->birthday) $args->birthday = ''; |
|
| 2236 | 2236 | |
| 2237 | 2237 | $output = executeQuery('member.updateMember', $args); |
| 2238 | 2238 | |
| 2239 | - if(!$output->toBool()) |
|
| 2239 | + if (!$output->toBool()) |
|
| 2240 | 2240 | { |
| 2241 | 2241 | $oDB->rollback(); |
| 2242 | 2242 | return $output; |
| 2243 | 2243 | } |
| 2244 | 2244 | |
| 2245 | - if($args->group_srl_list) |
|
| 2245 | + if ($args->group_srl_list) |
|
| 2246 | 2246 | { |
| 2247 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2247 | + if (is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2248 | 2248 | else $group_srl_list = explode('|@|', $args->group_srl_list); |
| 2249 | 2249 | // If the group information, group information changes |
| 2250 | - if(count($group_srl_list) > 0) |
|
| 2250 | + if (count($group_srl_list) > 0) |
|
| 2251 | 2251 | { |
| 2252 | 2252 | $args->site_srl = 0; |
| 2253 | 2253 | // One of its members to delete all the group |
| 2254 | 2254 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2255 | - if(!$output->toBool()) |
|
| 2255 | + if (!$output->toBool()) |
|
| 2256 | 2256 | { |
| 2257 | 2257 | $oDB->rollback(); |
| 2258 | 2258 | return $output; |
| 2259 | 2259 | } |
| 2260 | 2260 | // Enter one of the loop a |
| 2261 | - for($i=0;$i<count($group_srl_list);$i++) |
|
| 2261 | + for ($i = 0; $i < count($group_srl_list); $i++) |
|
| 2262 | 2262 | { |
| 2263 | - $output = $this->addMemberToGroup($args->member_srl,$group_srl_list[$i]); |
|
| 2264 | - if(!$output->toBool()) |
|
| 2263 | + $output = $this->addMemberToGroup($args->member_srl, $group_srl_list[$i]); |
|
| 2264 | + if (!$output->toBool()) |
|
| 2265 | 2265 | { |
| 2266 | 2266 | $oDB->rollback(); |
| 2267 | 2267 | return $output; |
@@ -2273,9 +2273,9 @@ discard block |
||
| 2273 | 2273 | } |
| 2274 | 2274 | } |
| 2275 | 2275 | // Call a trigger (after) |
| 2276 | - if($output->toBool()) { |
|
| 2276 | + if ($output->toBool()) { |
|
| 2277 | 2277 | $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); |
| 2278 | - if(!$trigger_output->toBool()) |
|
| 2278 | + if (!$trigger_output->toBool()) |
|
| 2279 | 2279 | { |
| 2280 | 2280 | $oDB->rollback(); |
| 2281 | 2281 | return $trigger_output; |
@@ -2288,7 +2288,7 @@ discard block |
||
| 2288 | 2288 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2289 | 2289 | |
| 2290 | 2290 | // Save Session |
| 2291 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2291 | + if (!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2292 | 2292 | $logged_info = Context::get('logged_info'); |
| 2293 | 2293 | |
| 2294 | 2294 | $output->add('member_srl', $args->member_srl); |
@@ -2300,14 +2300,14 @@ discard block |
||
| 2300 | 2300 | */ |
| 2301 | 2301 | function updateMemberPassword($args) |
| 2302 | 2302 | { |
| 2303 | - if($args->password) |
|
| 2303 | + if ($args->password) |
|
| 2304 | 2304 | { |
| 2305 | 2305 | |
| 2306 | 2306 | // check password strength |
| 2307 | 2307 | $oMemberModel = getModel('member'); |
| 2308 | 2308 | $config = $oMemberModel->getMemberConfig(); |
| 2309 | 2309 | |
| 2310 | - if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2310 | + if (!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
|
| 2311 | 2311 | { |
| 2312 | 2312 | $message = Context::getLang('about_password_strength'); |
| 2313 | 2313 | return new Object(-1, $message[$config->password_strength]); |
@@ -2315,13 +2315,13 @@ discard block |
||
| 2315 | 2315 | |
| 2316 | 2316 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2317 | 2317 | } |
| 2318 | - else if($args->hashed_password) |
|
| 2318 | + else if ($args->hashed_password) |
|
| 2319 | 2319 | { |
| 2320 | 2320 | $args->password = $args->hashed_password; |
| 2321 | 2321 | } |
| 2322 | 2322 | |
| 2323 | 2323 | $output = executeQuery('member.updateMemberPassword', $args); |
| 2324 | - if($output->toBool()) |
|
| 2324 | + if ($output->toBool()) |
|
| 2325 | 2325 | { |
| 2326 | 2326 | $result = executeQuery('member.updateChangePasswordDate', $args); |
| 2327 | 2327 | } |
@@ -2340,18 +2340,18 @@ discard block |
||
| 2340 | 2340 | $trigger_obj = new stdClass(); |
| 2341 | 2341 | $trigger_obj->member_srl = $member_srl; |
| 2342 | 2342 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2343 | - if(!$output->toBool()) return $output; |
|
| 2343 | + if (!$output->toBool()) return $output; |
|
| 2344 | 2344 | // Create a model object |
| 2345 | 2345 | $oMemberModel = getModel('member'); |
| 2346 | 2346 | // Bringing the user's information |
| 2347 | - if(!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2347 | + if (!$this->memberInfo || $this->memberInfo->member_srl != $member_srl || !isset($this->memberInfo->is_admin)) |
|
| 2348 | 2348 | { |
| 2349 | 2349 | $columnList = array('member_srl', 'is_admin'); |
| 2350 | 2350 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2351 | 2351 | } |
| 2352 | - if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
| 2352 | + if (!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
| 2353 | 2353 | // If managers can not be deleted |
| 2354 | - if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
| 2354 | + if ($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
| 2355 | 2355 | |
| 2356 | 2356 | $oDB = &DB::getInstance(); |
| 2357 | 2357 | $oDB->begin(); |
@@ -2360,7 +2360,7 @@ discard block |
||
| 2360 | 2360 | $args->member_srl = $member_srl; |
| 2361 | 2361 | // Delete the entries in member_auth_mail |
| 2362 | 2362 | $output = executeQuery('member.deleteAuthMail', $args); |
| 2363 | - if(!$output->toBool()) |
|
| 2363 | + if (!$output->toBool()) |
|
| 2364 | 2364 | { |
| 2365 | 2365 | $oDB->rollback(); |
| 2366 | 2366 | return $output; |
@@ -2375,23 +2375,23 @@ discard block |
||
| 2375 | 2375 | */ |
| 2376 | 2376 | // Delete the entries in member_group_member |
| 2377 | 2377 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
| 2378 | - if(!$output->toBool()) |
|
| 2378 | + if (!$output->toBool()) |
|
| 2379 | 2379 | { |
| 2380 | 2380 | $oDB->rollback(); |
| 2381 | 2381 | return $output; |
| 2382 | 2382 | } |
| 2383 | 2383 | // member removed from the table |
| 2384 | 2384 | $output = executeQuery('member.deleteMember', $args); |
| 2385 | - if(!$output->toBool()) |
|
| 2385 | + if (!$output->toBool()) |
|
| 2386 | 2386 | { |
| 2387 | 2387 | $oDB->rollback(); |
| 2388 | 2388 | return $output; |
| 2389 | 2389 | } |
| 2390 | 2390 | // Call a trigger (after) |
| 2391 | - if($output->toBool()) |
|
| 2391 | + if ($output->toBool()) |
|
| 2392 | 2392 | { |
| 2393 | 2393 | $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); |
| 2394 | - if(!$trigger_output->toBool()) |
|
| 2394 | + if (!$trigger_output->toBool()) |
|
| 2395 | 2395 | { |
| 2396 | 2396 | $oDB->rollback(); |
| 2397 | 2397 | return $trigger_output; |
@@ -2415,23 +2415,23 @@ discard block |
||
| 2415 | 2415 | */ |
| 2416 | 2416 | function destroySessionInfo() |
| 2417 | 2417 | { |
| 2418 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2418 | + if (!$_SESSION || !is_array($_SESSION)) return; |
|
| 2419 | 2419 | |
| 2420 | 2420 | $memberInfo = Context::get('logged_info'); |
| 2421 | 2421 | $memberSrl = $memberInfo->member_srl; |
| 2422 | 2422 | |
| 2423 | - foreach($_SESSION as $key => $val) |
|
| 2423 | + foreach ($_SESSION as $key => $val) |
|
| 2424 | 2424 | { |
| 2425 | 2425 | $_SESSION[$key] = ''; |
| 2426 | 2426 | } |
| 2427 | 2427 | |
| 2428 | 2428 | session_destroy(); |
| 2429 | - setcookie(session_name(), '', $_SERVER['REQUEST_TIME']-42000); |
|
| 2430 | - setcookie('sso','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2431 | - setcookie('xeak','',$_SERVER['REQUEST_TIME']-42000); |
|
| 2429 | + setcookie(session_name(), '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2430 | + setcookie('sso', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2431 | + setcookie('xeak', '', $_SERVER['REQUEST_TIME'] - 42000); |
|
| 2432 | 2432 | setcookie('xe_logged', 'false', $_SERVER['REQUEST_TIME'] - 42000); |
| 2433 | 2433 | |
| 2434 | - if($memberSrl || $_COOKIE['xeak']) |
|
| 2434 | + if ($memberSrl || $_COOKIE['xeak']) |
|
| 2435 | 2435 | { |
| 2436 | 2436 | $args = new stdClass(); |
| 2437 | 2437 | $args->member_srl = $memberSrl; |
@@ -2447,22 +2447,22 @@ discard block |
||
| 2447 | 2447 | $pointGroup = $pointModuleConfig->point_group; |
| 2448 | 2448 | |
| 2449 | 2449 | $levelGroup = array(); |
| 2450 | - if(is_array($pointGroup) && count($pointGroup)>0) |
|
| 2450 | + if (is_array($pointGroup) && count($pointGroup) > 0) |
|
| 2451 | 2451 | { |
| 2452 | 2452 | $levelGroup = array_flip($pointGroup); |
| 2453 | 2453 | ksort($levelGroup); |
| 2454 | 2454 | } |
| 2455 | 2455 | $maxLevel = 0; |
| 2456 | 2456 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2457 | - if(count($resultGroup) > 0) |
|
| 2457 | + if (count($resultGroup) > 0) |
|
| 2458 | 2458 | $maxLevel = max(array_flip($resultGroup)); |
| 2459 | 2459 | |
| 2460 | - if($maxLevel > 0) |
|
| 2460 | + if ($maxLevel > 0) |
|
| 2461 | 2461 | { |
| 2462 | 2462 | $oPointModel = getModel('point'); |
| 2463 | 2463 | $originPoint = $oPointModel->getPoint($memberSrl); |
| 2464 | 2464 | |
| 2465 | - if($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2465 | + if ($pointModuleConfig->level_step[$maxLevel] > $originPoint) |
|
| 2466 | 2466 | { |
| 2467 | 2467 | $oPointController = getController('point'); |
| 2468 | 2468 | $oPointController->setPoint($memberSrl, $pointModuleConfig->level_step[$maxLevel], 'update'); |
@@ -2472,18 +2472,18 @@ discard block |
||
| 2472 | 2472 | |
| 2473 | 2473 | function procMemberModifyEmailAddress() |
| 2474 | 2474 | { |
| 2475 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2475 | + if (!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2476 | 2476 | |
| 2477 | 2477 | $member_info = Context::get('logged_info'); |
| 2478 | 2478 | $newEmail = Context::get('email_address'); |
| 2479 | 2479 | |
| 2480 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2480 | + if (!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2481 | 2481 | |
| 2482 | 2482 | $oMemberModel = getModel('member'); |
| 2483 | 2483 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2484 | - if($member_srl) return new Object(-1,'msg_exists_email_address'); |
|
| 2484 | + if ($member_srl) return new Object(-1, 'msg_exists_email_address'); |
|
| 2485 | 2485 | |
| 2486 | - if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2486 | + if ($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
|
| 2487 | 2487 | { |
| 2488 | 2488 | return $this->stop('msg_invalid_request'); |
| 2489 | 2489 | } |
@@ -2499,7 +2499,7 @@ discard block |
||
| 2499 | 2499 | $oDB = &DB::getInstance(); |
| 2500 | 2500 | $oDB->begin(); |
| 2501 | 2501 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 2502 | - if(!$output->toBool()) |
|
| 2502 | + if (!$output->toBool()) |
|
| 2503 | 2503 | { |
| 2504 | 2504 | $oDB->rollback(); |
| 2505 | 2505 | return $output; |
@@ -2509,7 +2509,7 @@ discard block |
||
| 2509 | 2509 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2510 | 2510 | |
| 2511 | 2511 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2512 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2512 | + if (!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2513 | 2513 | |
| 2514 | 2514 | global $lang; |
| 2515 | 2515 | |
@@ -2521,17 +2521,17 @@ discard block |
||
| 2521 | 2521 | |
| 2522 | 2522 | Context::set('newEmail', $newEmail); |
| 2523 | 2523 | |
| 2524 | - $auth_url = getFullUrl('','module','member','act','procMemberAuthEmailAddress','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
|
| 2524 | + $auth_url = getFullUrl('', 'module', 'member', 'act', 'procMemberAuthEmailAddress', 'member_srl', $member_info->member_srl, 'auth_key', $auth_args->auth_key); |
|
| 2525 | 2525 | Context::set('auth_url', $auth_url); |
| 2526 | 2526 | |
| 2527 | 2527 | $oTemplate = &TemplateHandler::getInstance(); |
| 2528 | 2528 | $content = $oTemplate->compile($tpl_path, 'confirm_member_new_email'); |
| 2529 | 2529 | |
| 2530 | 2530 | $oMail = new Mail(); |
| 2531 | - $oMail->setTitle( Context::getLang('title_modify_email_address') ); |
|
| 2531 | + $oMail->setTitle(Context::getLang('title_modify_email_address')); |
|
| 2532 | 2532 | $oMail->setContent($content); |
| 2533 | - $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); |
|
| 2534 | - $oMail->setReceiptor( $member_info->nick_name, $newEmail ); |
|
| 2533 | + $oMail->setSender($member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster', $member_config->webmaster_email); |
|
| 2534 | + $oMail->setReceiptor($member_info->nick_name, $newEmail); |
|
| 2535 | 2535 | $result = $oMail->send(); |
| 2536 | 2536 | |
| 2537 | 2537 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $newEmail); |
@@ -2545,16 +2545,16 @@ discard block |
||
| 2545 | 2545 | { |
| 2546 | 2546 | $member_srl = Context::get('member_srl'); |
| 2547 | 2547 | $auth_key = Context::get('auth_key'); |
| 2548 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2548 | + if (!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2549 | 2549 | |
| 2550 | 2550 | // Test logs for finding password by user_id and authkey |
| 2551 | 2551 | $args = new stdClass; |
| 2552 | 2552 | $args->member_srl = $member_srl; |
| 2553 | 2553 | $args->auth_key = $auth_key; |
| 2554 | 2554 | $output = executeQuery('member.getAuthMail', $args); |
| 2555 | - if(!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2555 | + if (!$output->toBool() || $output->data->auth_key != $auth_key) |
|
| 2556 | 2556 | { |
| 2557 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2557 | + if (strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2558 | 2558 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2559 | 2559 | } |
| 2560 | 2560 | |
@@ -2563,10 +2563,10 @@ discard block |
||
| 2563 | 2563 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2564 | 2564 | |
| 2565 | 2565 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2566 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2566 | + if (!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2567 | 2567 | |
| 2568 | 2568 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2569 | - executeQuery('member.deleteAuthChangeEmailAddress',$args); |
|
| 2569 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2570 | 2570 | |
| 2571 | 2571 | $this->_clearMemberCache($args->member_srl); |
| 2572 | 2572 | |
@@ -2584,7 +2584,7 @@ discard block |
||
| 2584 | 2584 | **/ |
| 2585 | 2585 | function triggerGetDocumentMenu(&$menu_list) |
| 2586 | 2586 | { |
| 2587 | - if(!Context::get('is_logged')) return new Object(); |
|
| 2587 | + if (!Context::get('is_logged')) return new Object(); |
|
| 2588 | 2588 | |
| 2589 | 2589 | $logged_info = Context::get('logged_info'); |
| 2590 | 2590 | $document_srl = Context::get('target_srl'); |
@@ -2595,12 +2595,12 @@ discard block |
||
| 2595 | 2595 | $member_srl = $oDocument->get('member_srl'); |
| 2596 | 2596 | $module_srl = $oDocument->get('module_srl'); |
| 2597 | 2597 | |
| 2598 | - if(!$member_srl) return new Object(); |
|
| 2599 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
| 2598 | + if (!$member_srl) return new Object(); |
|
| 2599 | + if ($oDocumentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
| 2600 | 2600 | |
| 2601 | 2601 | $oDocumentController = getController('document'); |
| 2602 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2603 | - $oDocumentController->addDocumentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2602 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2603 | + $oDocumentController->addDocumentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2604 | 2604 | |
| 2605 | 2605 | return new Object(); |
| 2606 | 2606 | } |
@@ -2614,7 +2614,7 @@ discard block |
||
| 2614 | 2614 | **/ |
| 2615 | 2615 | function triggerGetCommentMenu(&$menu_list) |
| 2616 | 2616 | { |
| 2617 | - if(!Context::get('is_logged')) return new Object(); |
|
| 2617 | + if (!Context::get('is_logged')) return new Object(); |
|
| 2618 | 2618 | |
| 2619 | 2619 | $logged_info = Context::get('logged_info'); |
| 2620 | 2620 | $comment_srl = Context::get('target_srl'); |
@@ -2625,12 +2625,12 @@ discard block |
||
| 2625 | 2625 | $module_srl = $oComment->get('module_srl'); |
| 2626 | 2626 | $member_srl = $oComment->get('member_srl'); |
| 2627 | 2627 | |
| 2628 | - if(!$member_srl) return new Object(); |
|
| 2629 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
| 2628 | + if (!$member_srl) return new Object(); |
|
| 2629 | + if ($oCommentModel->grant->manager != 1 || $member_srl == $logged_info->member_srl) return new Object(); |
|
| 2630 | 2630 | |
| 2631 | 2631 | $oCommentController = getController('comment'); |
| 2632 | - $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
|
| 2633 | - $oCommentController->addCommentPopupMenu($url,'cmd_spammer','','popup'); |
|
| 2632 | + $url = getUrl('', 'module', 'member', 'act', 'dispMemberSpammer', 'member_srl', $member_srl, 'module_srl', $module_srl); |
|
| 2633 | + $oCommentController->addCommentPopupMenu($url, 'cmd_spammer', '', 'popup'); |
|
| 2634 | 2634 | |
| 2635 | 2635 | return new Object(); |
| 2636 | 2636 | } |
@@ -2642,7 +2642,7 @@ discard block |
||
| 2642 | 2642 | **/ |
| 2643 | 2643 | function procMemberSpammerManage() |
| 2644 | 2644 | { |
| 2645 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 2645 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 2646 | 2646 | |
| 2647 | 2647 | $logged_info = Context::get('logged_info'); |
| 2648 | 2648 | $member_srl = Context::get('member_srl'); |
@@ -2650,7 +2650,7 @@ discard block |
||
| 2650 | 2650 | $cnt_loop = Context::get('cnt_loop'); |
| 2651 | 2651 | $proc_type = Context::get('proc_type'); |
| 2652 | 2652 | $isMoveToTrash = true; |
| 2653 | - if($proc_type == "delete") |
|
| 2653 | + if ($proc_type == "delete") |
|
| 2654 | 2654 | $isMoveToTrash = false; |
| 2655 | 2655 | |
| 2656 | 2656 | // check grant |
@@ -2659,7 +2659,7 @@ discard block |
||
| 2659 | 2659 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2660 | 2660 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2661 | 2661 | |
| 2662 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
| 2662 | + if (!$grant->manager) return new Object(-1, 'msg_not_permitted'); |
|
| 2663 | 2663 | |
| 2664 | 2664 | $proc_msg = ""; |
| 2665 | 2665 | |
@@ -2668,10 +2668,10 @@ discard block |
||
| 2668 | 2668 | |
| 2669 | 2669 | // delete or trash destination |
| 2670 | 2670 | // proc member |
| 2671 | - if($cnt_loop == 1) |
|
| 2671 | + if ($cnt_loop == 1) |
|
| 2672 | 2672 | $this->_spammerMember($member_srl); |
| 2673 | 2673 | // proc document and comment |
| 2674 | - elseif($cnt_loop>1) |
|
| 2674 | + elseif ($cnt_loop > 1) |
|
| 2675 | 2675 | $this->_spammerDocuments($member_srl, $isMoveToTrash); |
| 2676 | 2676 | |
| 2677 | 2677 | // get destination count |
@@ -2680,11 +2680,11 @@ discard block |
||
| 2680 | 2680 | |
| 2681 | 2681 | $total_count = Context::get('total_count'); |
| 2682 | 2682 | $remain_count = $cnt_document + $cnt_comment; |
| 2683 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 2683 | + if ($cnt_loop == 1) $total_count = $remain_count; |
|
| 2684 | 2684 | |
| 2685 | 2685 | // get progress percent |
| 2686 | - if($total_count > 0) |
|
| 2687 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2686 | + if ($total_count > 0) |
|
| 2687 | + $progress = intval((($total_count - $remain_count) / $total_count) * 100); |
|
| 2688 | 2688 | else |
| 2689 | 2689 | $progress = 100; |
| 2690 | 2690 | |
@@ -2708,7 +2708,7 @@ discard block |
||
| 2708 | 2708 | **/ |
| 2709 | 2709 | private function _spammerMember($member_srl) { |
| 2710 | 2710 | $logged_info = Context::get('logged_info'); |
| 2711 | - $spam_description = trim( Context::get('spam_description') ); |
|
| 2711 | + $spam_description = trim(Context::get('spam_description')); |
|
| 2712 | 2712 | |
| 2713 | 2713 | $oMemberModel = getModel('member'); |
| 2714 | 2714 | $columnList = array('member_srl', 'email_address', 'user_id', 'nick_name', 'description'); |
@@ -2727,10 +2727,10 @@ discard block |
||
| 2727 | 2727 | $args->user_id = $member_info->user_id; |
| 2728 | 2728 | $args->nick_name = $member_info->nick_name; |
| 2729 | 2729 | $args->denied = "Y"; |
| 2730 | - $args->description = trim( $member_info->description ); |
|
| 2731 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 2730 | + $args->description = trim($member_info->description); |
|
| 2731 | + if ($args->description != "") $args->description .= "\n"; // add new line |
|
| 2732 | 2732 | |
| 2733 | - $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 . "]"; |
|
| 2733 | + $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."]"; |
|
| 2734 | 2734 | |
| 2735 | 2735 | $output = $this->updateMember($args, true); |
| 2736 | 2736 | |
@@ -2759,21 +2759,21 @@ discard block |
||
| 2759 | 2759 | // 1. proc comment, 2. proc document |
| 2760 | 2760 | $cnt_comment = $oCommentModel->getCommentCountByMemberSrl($member_srl); |
| 2761 | 2761 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
| 2762 | - if($cnt_comment > 0) |
|
| 2762 | + if ($cnt_comment > 0) |
|
| 2763 | 2763 | { |
| 2764 | 2764 | $columnList = array(); |
| 2765 | 2765 | $commentList = $oCommentModel->getCommentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2766 | - if($commentList) { |
|
| 2767 | - foreach($commentList as $v) { |
|
| 2766 | + if ($commentList) { |
|
| 2767 | + foreach ($commentList as $v) { |
|
| 2768 | 2768 | $oCommentController->deleteComment($v->comment_srl, true, $isMoveToTrash); |
| 2769 | 2769 | } |
| 2770 | 2770 | } |
| 2771 | - } elseif($cnt_document > 0) { |
|
| 2771 | + } elseif ($cnt_document > 0) { |
|
| 2772 | 2772 | $columnList = array(); |
| 2773 | 2773 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2774 | - if($documentList) { |
|
| 2775 | - foreach($documentList as $v) { |
|
| 2776 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2774 | + if ($documentList) { |
|
| 2775 | + foreach ($documentList as $v) { |
|
| 2776 | + if ($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2777 | 2777 | else $oDocumentController->deleteDocument($v->document_srl); |
| 2778 | 2778 | } |
| 2779 | 2779 | } |
@@ -2785,24 +2785,24 @@ discard block |
||
| 2785 | 2785 | function _clearMemberCache($member_srl, $site_srl = 0) |
| 2786 | 2786 | { |
| 2787 | 2787 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 2788 | - if($oCacheHandler->isSupport()) |
|
| 2788 | + if ($oCacheHandler->isSupport()) |
|
| 2789 | 2789 | { |
| 2790 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_' . $site_srl; |
|
| 2790 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_'.$site_srl; |
|
| 2791 | 2791 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2792 | 2792 | $oCacheHandler->delete($cache_key); |
| 2793 | 2793 | |
| 2794 | - if($site_srl !== 0) |
|
| 2794 | + if ($site_srl !== 0) |
|
| 2795 | 2795 | { |
| 2796 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 2796 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 2797 | 2797 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2798 | 2798 | $oCacheHandler->delete($cache_key); |
| 2799 | 2799 | } |
| 2800 | 2800 | } |
| 2801 | 2801 | |
| 2802 | 2802 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 2803 | - if($oCacheHandler->isSupport()) |
|
| 2803 | + if ($oCacheHandler->isSupport()) |
|
| 2804 | 2804 | { |
| 2805 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 2805 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 2806 | 2806 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 2807 | 2807 | $oCacheHandler->delete($cache_key); |
| 2808 | 2808 | } |
@@ -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 | |
| 135 | 157 | // Get document |
| 136 | 158 | $oDocumentModel = getModel('document'); |
@@ -153,11 +175,15 @@ discard block |
||
| 153 | 175 | |
| 154 | 176 | // Check if already scrapped |
| 155 | 177 | $output = executeQuery('member.getScrapDocument', $args); |
| 156 | - if($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); |
|
| 178 | + if($output->data->count) { |
|
| 179 | + return new Object(-1, 'msg_alreay_scrapped'); |
|
| 180 | + } |
|
| 157 | 181 | |
| 158 | 182 | // Insert |
| 159 | 183 | $output = executeQuery('member.addScrapDocument', $args); |
| 160 | - if(!$output->toBool()) return $output; |
|
| 184 | + if(!$output->toBool()) { |
|
| 185 | + return $output; |
|
| 186 | + } |
|
| 161 | 187 | |
| 162 | 188 | $this->setError(-1); |
| 163 | 189 | $this->setMessage('success_registed'); |
@@ -171,11 +197,15 @@ discard block |
||
| 171 | 197 | function procMemberDeleteScrap() |
| 172 | 198 | { |
| 173 | 199 | // Check login information |
| 174 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 200 | + if(!Context::get('is_logged')) { |
|
| 201 | + return new Object(-1, 'msg_not_logged'); |
|
| 202 | + } |
|
| 175 | 203 | $logged_info = Context::get('logged_info'); |
| 176 | 204 | |
| 177 | 205 | $document_srl = (int)Context::get('document_srl'); |
| 178 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 206 | + if(!$document_srl) { |
|
| 207 | + return new Object(-1,'msg_invalid_request'); |
|
| 208 | + } |
|
| 179 | 209 | // Variables |
| 180 | 210 | $args = new stdClass; |
| 181 | 211 | $args->member_srl = $logged_info->member_srl; |
@@ -201,11 +231,15 @@ discard block |
||
| 201 | 231 | function procMemberDeleteSavedDocument() |
| 202 | 232 | { |
| 203 | 233 | // Check login information |
| 204 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); |
|
| 234 | + if(!Context::get('is_logged')) { |
|
| 235 | + return new Object(-1, 'msg_not_logged'); |
|
| 236 | + } |
|
| 205 | 237 | $logged_info = Context::get('logged_info'); |
| 206 | 238 | |
| 207 | 239 | $document_srl = (int)Context::get('document_srl'); |
| 208 | - if(!$document_srl) return new Object(-1,'msg_invalid_request'); |
|
| 240 | + if(!$document_srl) { |
|
| 241 | + return new Object(-1,'msg_invalid_request'); |
|
| 242 | + } |
|
| 209 | 243 | |
| 210 | 244 | $oDocumentModel = getModel('document'); |
| 211 | 245 | $oDocument = $oDocumentModel->getDocument($document_srl); |
@@ -233,7 +267,9 @@ discard block |
||
| 233 | 267 | { |
| 234 | 268 | $name = Context::get('name'); |
| 235 | 269 | $value = Context::get('value'); |
| 236 | - if(!$value) return; |
|
| 270 | + if(!$value) { |
|
| 271 | + return; |
|
| 272 | + } |
|
| 237 | 273 | |
| 238 | 274 | $oMemberModel = getModel('member'); |
| 239 | 275 | // Check if logged-in |
@@ -244,10 +280,14 @@ discard block |
||
| 244 | 280 | { |
| 245 | 281 | case 'user_id' : |
| 246 | 282 | // Check denied ID |
| 247 | - if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id'); |
|
| 283 | + if($oMemberModel->isDeniedID($value)) { |
|
| 284 | + return new Object(0,'denied_user_id'); |
|
| 285 | + } |
|
| 248 | 286 | // Check if duplicated |
| 249 | 287 | $member_srl = $oMemberModel->getMemberSrlByUserID($value); |
| 250 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id'); |
|
| 288 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 289 | + return new Object(0,'msg_exists_user_id'); |
|
| 290 | + } |
|
| 251 | 291 | break; |
| 252 | 292 | case 'nick_name' : |
| 253 | 293 | // Check denied ID |
@@ -257,13 +297,17 @@ discard block |
||
| 257 | 297 | } |
| 258 | 298 | // Check if duplicated |
| 259 | 299 | $member_srl = $oMemberModel->getMemberSrlByNickName($value); |
| 260 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name'); |
|
| 300 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 301 | + return new Object(0,'msg_exists_nick_name'); |
|
| 302 | + } |
|
| 261 | 303 | |
| 262 | 304 | break; |
| 263 | 305 | case 'email_address' : |
| 264 | 306 | // Check if duplicated |
| 265 | 307 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); |
| 266 | - if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address'); |
|
| 308 | + if($member_srl && $logged_info->member_srl != $member_srl ) { |
|
| 309 | + return new Object(0,'msg_exists_email_address'); |
|
| 310 | + } |
|
| 267 | 311 | break; |
| 268 | 312 | } |
| 269 | 313 | } |
@@ -275,17 +319,25 @@ discard block |
||
| 275 | 319 | */ |
| 276 | 320 | function procMemberInsert() |
| 277 | 321 | { |
| 278 | - if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request"); |
|
| 322 | + if (Context::getRequestMethod () == "GET") { |
|
| 323 | + return new Object (-1, "msg_invalid_request"); |
|
| 324 | + } |
|
| 279 | 325 | $oMemberModel = &getModel ('member'); |
| 280 | 326 | $config = $oMemberModel->getMemberConfig(); |
| 281 | 327 | |
| 282 | 328 | // call a trigger (before) |
| 283 | 329 | $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); |
| 284 | - if(!$trigger_output->toBool ()) return $trigger_output; |
|
| 330 | + if(!$trigger_output->toBool ()) { |
|
| 331 | + return $trigger_output; |
|
| 332 | + } |
|
| 285 | 333 | // Check if an administrator allows a membership |
| 286 | - if($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); |
|
| 334 | + if($config->enable_join != 'Y') { |
|
| 335 | + return $this->stop ('msg_signup_disabled'); |
|
| 336 | + } |
|
| 287 | 337 | // Check if the user accept the license terms (only if terms exist) |
| 288 | - if($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); |
|
| 338 | + if($config->agreement && Context::get('accept_agreement')!='Y') { |
|
| 339 | + return $this->stop('msg_accept_agreement'); |
|
| 340 | + } |
|
| 289 | 341 | |
| 290 | 342 | // Extract the necessary information in advance |
| 291 | 343 | $getVars = array(); |
@@ -304,16 +356,22 @@ discard block |
||
| 304 | 356 | foreach($getVars as $val) |
| 305 | 357 | { |
| 306 | 358 | $args->{$val} = Context::get($val); |
| 307 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 359 | + if($val == 'birthday') { |
|
| 360 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
| 361 | + } |
|
| 308 | 362 | } |
| 309 | 363 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 310 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 364 | + if(!$args->birthday && $args->birthday_ui) { |
|
| 365 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 366 | + } |
|
| 311 | 367 | |
| 312 | 368 | $args->find_account_answer = Context::get('find_account_answer'); |
| 313 | 369 | $args->allow_mailing = Context::get('allow_mailing'); |
| 314 | 370 | $args->allow_message = Context::get('allow_message'); |
| 315 | 371 | |
| 316 | - if($args->password1) $args->password = $args->password1; |
|
| 372 | + if($args->password1) { |
|
| 373 | + $args->password = $args->password1; |
|
| 374 | + } |
|
| 317 | 375 | |
| 318 | 376 | // check password strength |
| 319 | 377 | if(!$oMemberModel->checkPasswordStrength($args->password, $config->password_strength)) |
@@ -342,7 +400,9 @@ discard block |
||
| 342 | 400 | unset($all_args->secret_text); |
| 343 | 401 | |
| 344 | 402 | // Set the user state as "denied" when using mail authentication |
| 345 | - if($config->enable_confirm == 'Y') $args->denied = 'Y'; |
|
| 403 | + if($config->enable_confirm == 'Y') { |
|
| 404 | + $args->denied = 'Y'; |
|
| 405 | + } |
|
| 346 | 406 | // Add extra vars after excluding necessary information from all the requested arguments |
| 347 | 407 | $extra_vars = delObjectVars($all_args, $args); |
| 348 | 408 | $args->extra_vars = serialize($extra_vars); |
@@ -357,7 +417,9 @@ discard block |
||
| 357 | 417 | } |
| 358 | 418 | } |
| 359 | 419 | $output = $this->insertMember($args); |
| 360 | - if(!$output->toBool()) return $output; |
|
| 420 | + if(!$output->toBool()) { |
|
| 421 | + return $output; |
|
| 422 | + } |
|
| 361 | 423 | |
| 362 | 424 | // insert ProfileImage, ImageName, ImageMark |
| 363 | 425 | $profile_image = $_FILES['profile_image']; |
@@ -396,43 +458,46 @@ discard block |
||
| 396 | 458 | if($config->identifier == 'email_address') |
| 397 | 459 | { |
| 398 | 460 | $output = $this->doLogin($args->email_address); |
| 399 | - } |
|
| 400 | - else |
|
| 461 | + } else |
|
| 401 | 462 | { |
| 402 | 463 | $output = $this->doLogin($args->user_id); |
| 403 | 464 | } |
| 404 | 465 | if(!$output->toBool()) { |
| 405 | - if($output->error == -9) |
|
| 406 | - $output->error = -11; |
|
| 466 | + if($output->error == -9) { |
|
| 467 | + $output->error = -11; |
|
| 468 | + } |
|
| 407 | 469 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), $output); |
| 408 | 470 | } |
| 409 | 471 | } |
| 410 | 472 | |
| 411 | 473 | // Results |
| 412 | 474 | $this->add('member_srl', $args->member_srl); |
| 413 | - if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); |
|
| 475 | + if($config->redirect_url) { |
|
| 476 | + $this->add('redirect_url', $config->redirect_url); |
|
| 477 | + } |
|
| 414 | 478 | if($config->enable_confirm == 'Y') |
| 415 | 479 | { |
| 416 | 480 | $msg = sprintf(Context::getLang('msg_confirm_mail_sent'), $args->email_address); |
| 417 | 481 | $this->setMessage($msg); |
| 418 | 482 | return $this->setRedirectUrl(getUrl('', 'act', 'dispMemberLoginForm'), new Object(-12, $msg)); |
| 483 | + } else { |
|
| 484 | + $this->setMessage('success_registed'); |
|
| 419 | 485 | } |
| 420 | - else $this->setMessage('success_registed'); |
|
| 421 | 486 | // Call a trigger (after) |
| 422 | 487 | $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); |
| 423 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 488 | + if(!$trigger_output->toBool()) { |
|
| 489 | + return $trigger_output; |
|
| 490 | + } |
|
| 424 | 491 | |
| 425 | 492 | if($config->redirect_url) |
| 426 | 493 | { |
| 427 | 494 | $returnUrl = $config->redirect_url; |
| 428 | - } |
|
| 429 | - else |
|
| 495 | + } else |
|
| 430 | 496 | { |
| 431 | 497 | if(Context::get('success_return_url')) |
| 432 | 498 | { |
| 433 | 499 | $returnUrl = Context::get('success_return_url'); |
| 434 | - } |
|
| 435 | - else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 500 | + } else if($_COOKIE['XE_REDIRECT_URL']) |
|
| 436 | 501 | { |
| 437 | 502 | $returnUrl = $_COOKIE['XE_REDIRECT_URL']; |
| 438 | 503 | setcookie("XE_REDIRECT_URL", '', 1); |
@@ -486,8 +551,7 @@ discard block |
||
| 486 | 551 | if(Context::get('success_return_url')) |
| 487 | 552 | { |
| 488 | 553 | $redirectUrl = Context::get('success_return_url'); |
| 489 | - } |
|
| 490 | - else |
|
| 554 | + } else |
|
| 491 | 555 | { |
| 492 | 556 | $redirectUrl = getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyInfo'); |
| 493 | 557 | } |
@@ -531,13 +595,17 @@ discard block |
||
| 531 | 595 | foreach($getVars as $val) |
| 532 | 596 | { |
| 533 | 597 | $args->{$val} = Context::get($val); |
| 534 | - if($val == 'birthday') $args->birthday_ui = Context::get('birthday_ui'); |
|
| 598 | + if($val == 'birthday') { |
|
| 599 | + $args->birthday_ui = Context::get('birthday_ui'); |
|
| 600 | + } |
|
| 535 | 601 | } |
| 536 | 602 | // Login Information |
| 537 | 603 | $logged_info = Context::get('logged_info'); |
| 538 | 604 | $args->member_srl = $logged_info->member_srl; |
| 539 | 605 | $args->birthday = intval(strtr($args->birthday, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
| 540 | - if(!$args->birthday && $args->birthday_ui) $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 606 | + if(!$args->birthday && $args->birthday_ui) { |
|
| 607 | + $args->birthday = intval(strtr($args->birthday_ui, array('-'=>'', '/'=>'', '.'=>'', ' '=>''))); |
|
| 608 | + } |
|
| 541 | 609 | // Remove some unnecessary variables from all the vars |
| 542 | 610 | $all_args = Context::getRequestVars(); |
| 543 | 611 | unset($all_args->module); |
@@ -571,7 +639,9 @@ discard block |
||
| 571 | 639 | |
| 572 | 640 | // Execute insert or update depending on the value of member_srl |
| 573 | 641 | $output = $this->updateMember($args); |
| 574 | - if(!$output->toBool()) return $output; |
|
| 642 | + if(!$output->toBool()) { |
|
| 643 | + return $output; |
|
| 644 | + } |
|
| 575 | 645 | |
| 576 | 646 | $profile_image = $_FILES['profile_image']; |
| 577 | 647 | if(is_uploaded_file($profile_image['tmp_name'])) |
@@ -601,7 +671,9 @@ discard block |
||
| 601 | 671 | |
| 602 | 672 | // Call a trigger after successfully log-in (after) |
| 603 | 673 | $trigger_output = ModuleHandler::triggerCall('member.procMemberModifyInfo', 'after', $this->memberInfo); |
| 604 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 674 | + if(!$trigger_output->toBool()) { |
|
| 675 | + return $trigger_output; |
|
| 676 | + } |
|
| 605 | 677 | |
| 606 | 678 | $this->setSessionInfo(); |
| 607 | 679 | // Return result |
@@ -622,7 +694,9 @@ discard block |
||
| 622 | 694 | */ |
| 623 | 695 | function procMemberModifyPassword() |
| 624 | 696 | { |
| 625 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 697 | + if(!Context::get('is_logged')) { |
|
| 698 | + return $this->stop('msg_not_logged'); |
|
| 699 | + } |
|
| 626 | 700 | // Extract the necessary information in advance |
| 627 | 701 | $current_password = trim(Context::get('current_password')); |
| 628 | 702 | $password = trim(Context::get('password1')); |
@@ -636,17 +710,23 @@ discard block |
||
| 636 | 710 | |
| 637 | 711 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 638 | 712 | // Verify the cuttent password |
| 639 | - if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) return new Object(-1, 'invalid_password'); |
|
| 713 | + if(!$oMemberModel->isValidPassword($member_info->password, $current_password, $member_srl)) { |
|
| 714 | + return new Object(-1, 'invalid_password'); |
|
| 715 | + } |
|
| 640 | 716 | |
| 641 | 717 | // Check if a new password is as same as the previous password |
| 642 | - if($current_password == $password) return new Object(-1, 'invalid_new_password'); |
|
| 718 | + if($current_password == $password) { |
|
| 719 | + return new Object(-1, 'invalid_new_password'); |
|
| 720 | + } |
|
| 643 | 721 | |
| 644 | 722 | // Execute insert or update depending on the value of member_srl |
| 645 | 723 | $args = new stdClass; |
| 646 | 724 | $args->member_srl = $member_srl; |
| 647 | 725 | $args->password = $password; |
| 648 | 726 | $output = $this->updateMemberPassword($args); |
| 649 | - if(!$output->toBool()) return $output; |
|
| 727 | + if(!$output->toBool()) { |
|
| 728 | + return $output; |
|
| 729 | + } |
|
| 650 | 730 | |
| 651 | 731 | $this->add('member_srl', $args->member_srl); |
| 652 | 732 | $this->setMessage('success_updated'); |
@@ -662,7 +742,9 @@ discard block |
||
| 662 | 742 | */ |
| 663 | 743 | function procMemberLeave() |
| 664 | 744 | { |
| 665 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 745 | + if(!Context::get('is_logged')) { |
|
| 746 | + return $this->stop('msg_not_logged'); |
|
| 747 | + } |
|
| 666 | 748 | // Extract the necessary information in advance |
| 667 | 749 | $password = trim(Context::get('password')); |
| 668 | 750 | // Get information of logged-in user |
@@ -678,10 +760,14 @@ discard block |
||
| 678 | 760 | $this->memberInfo->password = $memberInfo->password; |
| 679 | 761 | } |
| 680 | 762 | // Verify the cuttent password |
| 681 | - if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) return new Object(-1, 'invalid_password'); |
|
| 763 | + if(!$oMemberModel->isValidPassword($this->memberInfo->password, $password)) { |
|
| 764 | + return new Object(-1, 'invalid_password'); |
|
| 765 | + } |
|
| 682 | 766 | |
| 683 | 767 | $output = $this->deleteMember($member_srl); |
| 684 | - if(!$output->toBool()) return $output; |
|
| 768 | + if(!$output->toBool()) { |
|
| 769 | + return $output; |
|
| 770 | + } |
|
| 685 | 771 | // Destroy all session information |
| 686 | 772 | $this->destroySessionInfo(); |
| 687 | 773 | // Return success message |
@@ -700,17 +786,25 @@ discard block |
||
| 700 | 786 | { |
| 701 | 787 | // Check if the file is successfully uploaded |
| 702 | 788 | $file = $_FILES['profile_image']; |
| 703 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 789 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 790 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 791 | + } |
|
| 704 | 792 | // Ignore if member_srl is invalid or doesn't exist. |
| 705 | 793 | $member_srl = Context::get('member_srl'); |
| 706 | - if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 794 | + if(!$member_srl) { |
|
| 795 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 796 | + } |
|
| 707 | 797 | |
| 708 | 798 | $logged_info = Context::get('logged_info'); |
| 709 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); |
|
| 799 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 800 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 801 | + } |
|
| 710 | 802 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 711 | 803 | $oModuleModel = getModel('module'); |
| 712 | 804 | $config = $oModuleModel->getModuleConfig('member'); |
| 713 | - if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); |
|
| 805 | + if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') { |
|
| 806 | + return $this->stop('msg_not_uploaded_profile_image'); |
|
| 807 | + } |
|
| 714 | 808 | |
| 715 | 809 | $this->insertProfileImage($member_srl, $file['tmp_name']); |
| 716 | 810 | // Page refresh |
@@ -732,26 +826,35 @@ discard block |
||
| 732 | 826 | { |
| 733 | 827 | |
| 734 | 828 | // Check uploaded file |
| 735 | - if(!checkUploadedFile($target_file)) return; |
|
| 829 | + if(!checkUploadedFile($target_file)) { |
|
| 830 | + return; |
|
| 831 | + } |
|
| 736 | 832 | |
| 737 | 833 | $oMemberModel = getModel('member'); |
| 738 | 834 | $config = $oMemberModel->getMemberConfig(); |
| 739 | 835 | |
| 740 | 836 | // Get an image size |
| 741 | 837 | $max_width = $config->profile_image_max_width; |
| 742 | - if(!$max_width) $max_width = "90"; |
|
| 838 | + if(!$max_width) { |
|
| 839 | + $max_width = "90"; |
|
| 840 | + } |
|
| 743 | 841 | $max_height = $config->profile_image_max_height; |
| 744 | - if(!$max_height) $max_height = "90"; |
|
| 842 | + if(!$max_height) { |
|
| 843 | + $max_height = "90"; |
|
| 844 | + } |
|
| 745 | 845 | // Get a target path to save |
| 746 | 846 | $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); |
| 747 | 847 | FileHandler::makeDir($target_path); |
| 748 | 848 | |
| 749 | 849 | // Get file information |
| 750 | 850 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 751 | - if(IMAGETYPE_PNG == $type) $ext = 'png'; |
|
| 752 | - elseif(IMAGETYPE_JPEG == $type) $ext = 'jpg'; |
|
| 753 | - elseif(IMAGETYPE_GIF == $type) $ext = 'gif'; |
|
| 754 | - else |
|
| 851 | + if(IMAGETYPE_PNG == $type) { |
|
| 852 | + $ext = 'png'; |
|
| 853 | + } elseif(IMAGETYPE_JPEG == $type) { |
|
| 854 | + $ext = 'jpg'; |
|
| 855 | + } elseif(IMAGETYPE_GIF == $type) { |
|
| 856 | + $ext = 'gif'; |
|
| 857 | + } else |
|
| 755 | 858 | { |
| 756 | 859 | return; |
| 757 | 860 | } |
@@ -763,8 +866,7 @@ discard block |
||
| 763 | 866 | if(($width > $max_width || $height > $max_height ) && $type != 1) |
| 764 | 867 | { |
| 765 | 868 | FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); |
| 766 | - } |
|
| 767 | - else |
|
| 869 | + } else |
|
| 768 | 870 | { |
| 769 | 871 | @copy($target_file, $target_filename); |
| 770 | 872 | } |
@@ -779,17 +881,25 @@ discard block |
||
| 779 | 881 | { |
| 780 | 882 | // Check if the file is successfully uploaded |
| 781 | 883 | $file = $_FILES['image_name']; |
| 782 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); |
|
| 884 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 885 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 886 | + } |
|
| 783 | 887 | // Ignore if member_srl is invalid or doesn't exist. |
| 784 | 888 | $member_srl = Context::get('member_srl'); |
| 785 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 889 | + if(!$member_srl) { |
|
| 890 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 891 | + } |
|
| 786 | 892 | |
| 787 | 893 | $logged_info = Context::get('logged_info'); |
| 788 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); |
|
| 894 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 895 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 896 | + } |
|
| 789 | 897 | // Return if member module is set not to use an image name or the user is not an administrator ; |
| 790 | 898 | $oModuleModel = getModel('module'); |
| 791 | 899 | $config = $oModuleModel->getModuleConfig('member'); |
| 792 | - if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); |
|
| 900 | + if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') { |
|
| 901 | + return $this->stop('msg_not_uploaded_image_name'); |
|
| 902 | + } |
|
| 793 | 903 | |
| 794 | 904 | $this->insertImageName($member_srl, $file['tmp_name']); |
| 795 | 905 | // Page refresh |
@@ -810,15 +920,21 @@ discard block |
||
| 810 | 920 | function insertImageName($member_srl, $target_file) |
| 811 | 921 | { |
| 812 | 922 | // Check uploaded file |
| 813 | - if(!checkUploadedFile($target_file)) return; |
|
| 923 | + if(!checkUploadedFile($target_file)) { |
|
| 924 | + return; |
|
| 925 | + } |
|
| 814 | 926 | |
| 815 | 927 | $oModuleModel = getModel('module'); |
| 816 | 928 | $config = $oModuleModel->getModuleConfig('member'); |
| 817 | 929 | // Get an image size |
| 818 | 930 | $max_width = $config->image_name_max_width; |
| 819 | - if(!$max_width) $max_width = "90"; |
|
| 931 | + if(!$max_width) { |
|
| 932 | + $max_width = "90"; |
|
| 933 | + } |
|
| 820 | 934 | $max_height = $config->image_name_max_height; |
| 821 | - if(!$max_height) $max_height = "20"; |
|
| 935 | + if(!$max_height) { |
|
| 936 | + $max_height = "20"; |
|
| 937 | + } |
|
| 822 | 938 | // Get a target path to save |
| 823 | 939 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); |
| 824 | 940 | FileHandler::makeDir($target_path); |
@@ -827,8 +943,11 @@ discard block |
||
| 827 | 943 | // Get file information |
| 828 | 944 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 829 | 945 | // Convert if the image size is larger than a given size or if the format is not a gif |
| 830 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 831 | - else @copy($target_file, $target_filename); |
|
| 946 | + if($width > $max_width || $height > $max_height || $type!=1) { |
|
| 947 | + FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 948 | + } else { |
|
| 949 | + @copy($target_file, $target_filename); |
|
| 950 | + } |
|
| 832 | 951 | } |
| 833 | 952 | |
| 834 | 953 | /** |
@@ -888,17 +1007,25 @@ discard block |
||
| 888 | 1007 | { |
| 889 | 1008 | // Check if the file is successfully uploaded |
| 890 | 1009 | $file = $_FILES['image_mark']; |
| 891 | - if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1010 | + if(!is_uploaded_file($file['tmp_name'])) { |
|
| 1011 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1012 | + } |
|
| 892 | 1013 | // Ignore if member_srl is invalid or doesn't exist. |
| 893 | 1014 | $member_srl = Context::get('member_srl'); |
| 894 | - if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1015 | + if(!$member_srl) { |
|
| 1016 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1017 | + } |
|
| 895 | 1018 | |
| 896 | 1019 | $logged_info = Context::get('logged_info'); |
| 897 | - if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1020 | + if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) { |
|
| 1021 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1022 | + } |
|
| 898 | 1023 | // Membership in the images mark the module using the ban was set by an administrator or return; |
| 899 | 1024 | $oModuleModel = getModel('module'); |
| 900 | 1025 | $config = $oModuleModel->getModuleConfig('member'); |
| 901 | - if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1026 | + if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') { |
|
| 1027 | + return $this->stop('msg_not_uploaded_image_mark'); |
|
| 1028 | + } |
|
| 902 | 1029 | |
| 903 | 1030 | $this->insertImageMark($member_srl, $file['tmp_name']); |
| 904 | 1031 | // Page refresh |
@@ -919,15 +1046,21 @@ discard block |
||
| 919 | 1046 | function insertImageMark($member_srl, $target_file) |
| 920 | 1047 | { |
| 921 | 1048 | // Check uploaded file |
| 922 | - if(!checkUploadedFile($target_file)) return; |
|
| 1049 | + if(!checkUploadedFile($target_file)) { |
|
| 1050 | + return; |
|
| 1051 | + } |
|
| 923 | 1052 | |
| 924 | 1053 | $oModuleModel = getModel('module'); |
| 925 | 1054 | $config = $oModuleModel->getModuleConfig('member'); |
| 926 | 1055 | // Get an image size |
| 927 | 1056 | $max_width = $config->image_mark_max_width; |
| 928 | - if(!$max_width) $max_width = "20"; |
|
| 1057 | + if(!$max_width) { |
|
| 1058 | + $max_width = "20"; |
|
| 1059 | + } |
|
| 929 | 1060 | $max_height = $config->image_mark_max_height; |
| 930 | - if(!$max_height) $max_height = "20"; |
|
| 1061 | + if(!$max_height) { |
|
| 1062 | + $max_height = "20"; |
|
| 1063 | + } |
|
| 931 | 1064 | |
| 932 | 1065 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($member_srl)); |
| 933 | 1066 | FileHandler::makeDir($target_path); |
@@ -936,8 +1069,11 @@ discard block |
||
| 936 | 1069 | // Get file information |
| 937 | 1070 | list($width, $height, $type, $attrs) = @getimagesize($target_file); |
| 938 | 1071 | |
| 939 | - if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 940 | - else @copy($target_file, $target_filename); |
|
| 1072 | + if($width > $max_width || $height > $max_height || $type!=1) { |
|
| 1073 | + FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); |
|
| 1074 | + } else { |
|
| 1075 | + @copy($target_file, $target_filename); |
|
| 1076 | + } |
|
| 941 | 1077 | } |
| 942 | 1078 | |
| 943 | 1079 | /** |
@@ -972,14 +1108,18 @@ discard block |
||
| 972 | 1108 | function procMemberFindAccount() |
| 973 | 1109 | { |
| 974 | 1110 | $email_address = Context::get('email_address'); |
| 975 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 1111 | + if(!$email_address) { |
|
| 1112 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1113 | + } |
|
| 976 | 1114 | |
| 977 | 1115 | $oMemberModel = getModel('member'); |
| 978 | 1116 | $oModuleModel = getModel('module'); |
| 979 | 1117 | |
| 980 | 1118 | // Check if a member having the same email address exists |
| 981 | 1119 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 982 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 1120 | + if(!$member_srl) { |
|
| 1121 | + return new Object(-1, 'msg_email_not_exists'); |
|
| 1122 | + } |
|
| 983 | 1123 | |
| 984 | 1124 | // Get information of the member |
| 985 | 1125 | $columnList = array('denied', 'member_srl', 'user_id', 'user_name', 'email_address', 'nick_name'); |
@@ -991,7 +1131,9 @@ discard block |
||
| 991 | 1131 | $chk_args = new stdClass; |
| 992 | 1132 | $chk_args->member_srl = $member_info->member_srl; |
| 993 | 1133 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 994 | - if($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); |
|
| 1134 | + if($output->toBool() && $output->data->count != '0') { |
|
| 1135 | + return new Object(-1, 'msg_user_not_confirmed'); |
|
| 1136 | + } |
|
| 995 | 1137 | } |
| 996 | 1138 | |
| 997 | 1139 | // Insert data into the authentication DB |
@@ -1004,7 +1146,9 @@ discard block |
||
| 1004 | 1146 | $args->is_register = 'N'; |
| 1005 | 1147 | |
| 1006 | 1148 | $output = executeQuery('member.insertAuthMail', $args); |
| 1007 | - if(!$output->toBool()) return $output; |
|
| 1149 | + if(!$output->toBool()) { |
|
| 1150 | + return $output; |
|
| 1151 | + } |
|
| 1008 | 1152 | // Get content of the email to send a member |
| 1009 | 1153 | Context::set('auth_args', $args); |
| 1010 | 1154 | |
@@ -1021,8 +1165,7 @@ discard block |
||
| 1021 | 1165 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1022 | 1166 | } |
| 1023 | 1167 | } |
| 1024 | - } |
|
| 1025 | - else |
|
| 1168 | + } else |
|
| 1026 | 1169 | { |
| 1027 | 1170 | $memberInfo[$lang->user_id] = $args->user_id; |
| 1028 | 1171 | $memberInfo[$lang->user_name] = $args->user_name; |
@@ -1031,13 +1174,19 @@ discard block |
||
| 1031 | 1174 | } |
| 1032 | 1175 | Context::set('memberInfo', $memberInfo); |
| 1033 | 1176 | |
| 1034 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1035 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1177 | + if(!$member_config->skin) { |
|
| 1178 | + $member_config->skin = "default"; |
|
| 1179 | + } |
|
| 1180 | + if(!$member_config->colorset) { |
|
| 1181 | + $member_config->colorset = "white"; |
|
| 1182 | + } |
|
| 1036 | 1183 | |
| 1037 | 1184 | Context::set('member_config', $member_config); |
| 1038 | 1185 | |
| 1039 | 1186 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1040 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1187 | + if(!is_dir($tpl_path)) { |
|
| 1188 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1189 | + } |
|
| 1041 | 1190 | |
| 1042 | 1191 | $find_url = getFullUrl ('', 'module', 'member', 'act', 'procMemberAuthAccount', 'member_srl', $member_info->member_srl, 'auth_key', $args->auth_key); |
| 1043 | 1192 | Context::set('find_url', $find_url); |
@@ -1079,20 +1228,28 @@ discard block |
||
| 1079 | 1228 | $find_account_question = trim(Context::get('find_account_question')); |
| 1080 | 1229 | $find_account_answer = trim(Context::get('find_account_answer')); |
| 1081 | 1230 | |
| 1082 | - if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) return new Object(-1, 'msg_invalid_request'); |
|
| 1231 | + if(($config->identifier == 'user_id' && !$user_id) || !$email_address || !$find_account_question || !$find_account_answer) { |
|
| 1232 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1233 | + } |
|
| 1083 | 1234 | |
| 1084 | 1235 | $oModuleModel = getModel('module'); |
| 1085 | 1236 | // Check if a member having the same email address exists |
| 1086 | 1237 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1087 | - if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); |
|
| 1238 | + if(!$member_srl) { |
|
| 1239 | + return new Object(-1, 'msg_email_not_exists'); |
|
| 1240 | + } |
|
| 1088 | 1241 | // Get information of the member |
| 1089 | 1242 | $columnList = array('member_srl', 'find_account_question', 'find_account_answer'); |
| 1090 | 1243 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 1091 | 1244 | |
| 1092 | 1245 | // Display a message if no answer is entered |
| 1093 | - if(!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); |
|
| 1246 | + if(!$member_info->find_account_question || !$member_info->find_account_answer) { |
|
| 1247 | + return new Object(-1, 'msg_question_not_exists'); |
|
| 1248 | + } |
|
| 1094 | 1249 | |
| 1095 | - 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'); |
|
| 1250 | + if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) { |
|
| 1251 | + return new Object(-1, 'msg_answer_not_matches'); |
|
| 1252 | + } |
|
| 1096 | 1253 | |
| 1097 | 1254 | if($config->identifier == 'email_address') |
| 1098 | 1255 | { |
@@ -1108,7 +1265,9 @@ discard block |
||
| 1108 | 1265 | $args->password = $temp_password; |
| 1109 | 1266 | $args->change_password_date = '1'; |
| 1110 | 1267 | $output = $this->updateMemberPassword($args); |
| 1111 | - if(!$output->toBool()) return $output; |
|
| 1268 | + if(!$output->toBool()) { |
|
| 1269 | + return $output; |
|
| 1270 | + } |
|
| 1112 | 1271 | |
| 1113 | 1272 | $_SESSION['xe_temp_password_' . $user_id] = $temp_password; |
| 1114 | 1273 | |
@@ -1165,8 +1324,7 @@ discard block |
||
| 1165 | 1324 | if($output->data->is_register == 'Y') |
| 1166 | 1325 | { |
| 1167 | 1326 | $args->denied = 'N'; |
| 1168 | - } |
|
| 1169 | - else |
|
| 1327 | + } else |
|
| 1170 | 1328 | { |
| 1171 | 1329 | $args->password = $oMemberModel->hashPassword($args->password); |
| 1172 | 1330 | } |
@@ -1200,33 +1358,45 @@ discard block |
||
| 1200 | 1358 | { |
| 1201 | 1359 | // Get an email_address |
| 1202 | 1360 | $email_address = Context::get('email_address'); |
| 1203 | - if(!$email_address) return new Object(-1, 'msg_invalid_request'); |
|
| 1361 | + if(!$email_address) { |
|
| 1362 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1363 | + } |
|
| 1204 | 1364 | // Log test by using email_address |
| 1205 | 1365 | $oMemberModel = getModel('member'); |
| 1206 | 1366 | |
| 1207 | 1367 | $args = new stdClass; |
| 1208 | 1368 | $args->email_address = $email_address; |
| 1209 | 1369 | $memberSrl = $oMemberModel->getMemberSrlByEmailAddress($email_address); |
| 1210 | - if(!$memberSrl) return new Object(-1, 'msg_not_exists_member'); |
|
| 1370 | + if(!$memberSrl) { |
|
| 1371 | + return new Object(-1, 'msg_not_exists_member'); |
|
| 1372 | + } |
|
| 1211 | 1373 | |
| 1212 | 1374 | $columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address'); |
| 1213 | 1375 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($memberSrl, 0, $columnList); |
| 1214 | 1376 | |
| 1215 | 1377 | $oModuleModel = getModel('module'); |
| 1216 | 1378 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 1217 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1218 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1379 | + if(!$member_config->skin) { |
|
| 1380 | + $member_config->skin = "default"; |
|
| 1381 | + } |
|
| 1382 | + if(!$member_config->colorset) { |
|
| 1383 | + $member_config->colorset = "white"; |
|
| 1384 | + } |
|
| 1219 | 1385 | |
| 1220 | 1386 | // Check if a authentication mail has been sent previously |
| 1221 | 1387 | $chk_args = new stdClass; |
| 1222 | 1388 | $chk_args->member_srl = $member_info->member_srl; |
| 1223 | 1389 | $output = executeQuery('member.chkAuthMail', $chk_args); |
| 1224 | - if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); |
|
| 1390 | + if($output->toBool() && $output->data->count == '0') { |
|
| 1391 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1392 | + } |
|
| 1225 | 1393 | |
| 1226 | 1394 | $auth_args = new stdClass; |
| 1227 | 1395 | $auth_args->member_srl = $member_info->member_srl; |
| 1228 | 1396 | $output = executeQueryArray('member.getAuthMailInfo', $auth_args); |
| 1229 | - if(!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); |
|
| 1397 | + if(!$output->data || !$output->data[0]->auth_key) { |
|
| 1398 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1399 | + } |
|
| 1230 | 1400 | $auth_info = $output->data[0]; |
| 1231 | 1401 | |
| 1232 | 1402 | // Update the regdate of authmail entry |
@@ -1247,8 +1417,7 @@ discard block |
||
| 1247 | 1417 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1248 | 1418 | } |
| 1249 | 1419 | } |
| 1250 | - } |
|
| 1251 | - else |
|
| 1420 | + } else |
|
| 1252 | 1421 | { |
| 1253 | 1422 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1254 | 1423 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1261,7 +1430,9 @@ discard block |
||
| 1261 | 1430 | Context::set('member_config', $member_config); |
| 1262 | 1431 | |
| 1263 | 1432 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1264 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1433 | + if(!is_dir($tpl_path)) { |
|
| 1434 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1435 | + } |
|
| 1265 | 1436 | |
| 1266 | 1437 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_info->auth_key); |
| 1267 | 1438 | Context::set('auth_url', $auth_url); |
@@ -1339,7 +1510,9 @@ discard block |
||
| 1339 | 1510 | $auth_args->is_register = 'Y'; |
| 1340 | 1511 | |
| 1341 | 1512 | $output = executeQuery('member.insertAuthMail', $auth_args); |
| 1342 | - if(!$output->toBool()) return $output; |
|
| 1513 | + if(!$output->toBool()) { |
|
| 1514 | + return $output; |
|
| 1515 | + } |
|
| 1343 | 1516 | |
| 1344 | 1517 | $memberInfo->email_address = $newEmail; |
| 1345 | 1518 | |
@@ -1373,8 +1546,7 @@ discard block |
||
| 1373 | 1546 | $memberInfo[$lang->{$form->name}] = $member_info->{$form->name}; |
| 1374 | 1547 | } |
| 1375 | 1548 | } |
| 1376 | - } |
|
| 1377 | - else |
|
| 1549 | + } else |
|
| 1378 | 1550 | { |
| 1379 | 1551 | $memberInfo[$lang->user_id] = $member_info->user_id; |
| 1380 | 1552 | $memberInfo[$lang->user_name] = $member_info->user_name; |
@@ -1383,13 +1555,19 @@ discard block |
||
| 1383 | 1555 | } |
| 1384 | 1556 | Context::set('memberInfo', $memberInfo); |
| 1385 | 1557 | |
| 1386 | - if(!$member_config->skin) $member_config->skin = "default"; |
|
| 1387 | - if(!$member_config->colorset) $member_config->colorset = "white"; |
|
| 1558 | + if(!$member_config->skin) { |
|
| 1559 | + $member_config->skin = "default"; |
|
| 1560 | + } |
|
| 1561 | + if(!$member_config->colorset) { |
|
| 1562 | + $member_config->colorset = "white"; |
|
| 1563 | + } |
|
| 1388 | 1564 | |
| 1389 | 1565 | Context::set('member_config', $member_config); |
| 1390 | 1566 | |
| 1391 | 1567 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 1392 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1568 | + if(!is_dir($tpl_path)) { |
|
| 1569 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 1570 | + } |
|
| 1393 | 1571 | |
| 1394 | 1572 | $auth_url = getFullUrl('','module','member','act','procMemberAuthAccount','member_srl',$member_info->member_srl, 'auth_key',$auth_args->auth_key); |
| 1395 | 1573 | Context::set('auth_url', $auth_url); |
@@ -1414,7 +1592,9 @@ discard block |
||
| 1414 | 1592 | { |
| 1415 | 1593 | $site_module_info = Context::get('site_module_info'); |
| 1416 | 1594 | $logged_info = Context::get('logged_info'); |
| 1417 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
| 1595 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1596 | + return new Object(-1,'msg_invalid_request'); |
|
| 1597 | + } |
|
| 1418 | 1598 | |
| 1419 | 1599 | $oMemberModel = getModel('member'); |
| 1420 | 1600 | $columnList = array('site_srl', 'group_srl', 'title'); |
@@ -1433,13 +1613,17 @@ discard block |
||
| 1433 | 1613 | { |
| 1434 | 1614 | $site_module_info = Context::get('site_module_info'); |
| 1435 | 1615 | $logged_info = Context::get('logged_info'); |
| 1436 | - if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) return new Object(-1,'msg_invalid_request'); |
|
| 1616 | + if(!$site_module_info->site_srl || !Context::get('is_logged') || count($logged_info->group_srl_list) ) { |
|
| 1617 | + return new Object(-1,'msg_invalid_request'); |
|
| 1618 | + } |
|
| 1437 | 1619 | |
| 1438 | 1620 | $args = new stdClass; |
| 1439 | 1621 | $args->site_srl= $site_module_info->site_srl; |
| 1440 | 1622 | $args->member_srl = $logged_info->member_srl; |
| 1441 | 1623 | $output = executeQuery('member.deleteMembersGroup', $args); |
| 1442 | - if(!$output->toBool()) return $output; |
|
| 1624 | + if(!$output->toBool()) { |
|
| 1625 | + return $output; |
|
| 1626 | + } |
|
| 1443 | 1627 | $this->setMessage('success_deleted'); |
| 1444 | 1628 | $this->_clearMemberCache($args->member_srl, $site_module_info->site_srl); |
| 1445 | 1629 | } |
@@ -1453,17 +1637,37 @@ discard block |
||
| 1453 | 1637 | */ |
| 1454 | 1638 | function setMemberConfig($args) |
| 1455 | 1639 | { |
| 1456 | - if(!$args->skin) $args->skin = "default"; |
|
| 1457 | - if(!$args->colorset) $args->colorset = "white"; |
|
| 1458 | - if(!$args->editor_skin) $args->editor_skin= "ckeditor"; |
|
| 1459 | - if(!$args->editor_colorset) $args->editor_colorset = "moono"; |
|
| 1460 | - if($args->enable_join!='Y') $args->enable_join = 'N'; |
|
| 1640 | + if(!$args->skin) { |
|
| 1641 | + $args->skin = "default"; |
|
| 1642 | + } |
|
| 1643 | + if(!$args->colorset) { |
|
| 1644 | + $args->colorset = "white"; |
|
| 1645 | + } |
|
| 1646 | + if(!$args->editor_skin) { |
|
| 1647 | + $args->editor_skin= "ckeditor"; |
|
| 1648 | + } |
|
| 1649 | + if(!$args->editor_colorset) { |
|
| 1650 | + $args->editor_colorset = "moono"; |
|
| 1651 | + } |
|
| 1652 | + if($args->enable_join!='Y') { |
|
| 1653 | + $args->enable_join = 'N'; |
|
| 1654 | + } |
|
| 1461 | 1655 | $args->enable_openid= 'N'; |
| 1462 | - if($args->profile_image !='Y') $args->profile_image = 'N'; |
|
| 1463 | - if($args->image_name!='Y') $args->image_name = 'N'; |
|
| 1464 | - if($args->image_mark!='Y') $args->image_mark = 'N'; |
|
| 1465 | - if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; |
|
| 1466 | - if(!trim(strip_tags($args->agreement))) $args->agreement = null; |
|
| 1656 | + if($args->profile_image !='Y') { |
|
| 1657 | + $args->profile_image = 'N'; |
|
| 1658 | + } |
|
| 1659 | + if($args->image_name!='Y') { |
|
| 1660 | + $args->image_name = 'N'; |
|
| 1661 | + } |
|
| 1662 | + if($args->image_mark!='Y') { |
|
| 1663 | + $args->image_mark = 'N'; |
|
| 1664 | + } |
|
| 1665 | + if($args->group_image_mark!='Y') { |
|
| 1666 | + $args->group_image_mark = 'N'; |
|
| 1667 | + } |
|
| 1668 | + if(!trim(strip_tags($args->agreement))) { |
|
| 1669 | + $args->agreement = null; |
|
| 1670 | + } |
|
| 1467 | 1671 | $args->limit_day = (int)$args->limit_day; |
| 1468 | 1672 | |
| 1469 | 1673 | $agreement = trim($args->agreement); |
@@ -1471,7 +1675,9 @@ discard block |
||
| 1471 | 1675 | |
| 1472 | 1676 | $oModuleController = getController('module'); |
| 1473 | 1677 | $output = $oModuleController->insertModuleConfig('member',$args); |
| 1474 | - if(!$output->toBool()) return $output; |
|
| 1678 | + if(!$output->toBool()) { |
|
| 1679 | + return $output; |
|
| 1680 | + } |
|
| 1475 | 1681 | |
| 1476 | 1682 | $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; |
| 1477 | 1683 | FileHandler::writeFile($agreement_file, $agreement); |
@@ -1496,7 +1702,9 @@ discard block |
||
| 1496 | 1702 | $path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl)); |
| 1497 | 1703 | $filename = sprintf('%s%d.signature.php', $path, $member_srl); |
| 1498 | 1704 | |
| 1499 | - if(!$check_signature) return FileHandler::removeFile($filename); |
|
| 1705 | + if(!$check_signature) { |
|
| 1706 | + return FileHandler::removeFile($filename); |
|
| 1707 | + } |
|
| 1500 | 1708 | |
| 1501 | 1709 | $buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
| 1502 | 1710 | FileHandler::makeDir($path); |
@@ -1530,7 +1738,9 @@ discard block |
||
| 1530 | 1738 | $args = new stdClass(); |
| 1531 | 1739 | $args->member_srl = $member_srl; |
| 1532 | 1740 | $args->group_srl = $group_srl; |
| 1533 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1741 | + if($site_srl) { |
|
| 1742 | + $args->site_srl = $site_srl; |
|
| 1743 | + } |
|
| 1534 | 1744 | |
| 1535 | 1745 | // Add |
| 1536 | 1746 | $output = executeQuery('member.addMemberToGroup',$args); |
@@ -1556,15 +1766,21 @@ discard block |
||
| 1556 | 1766 | $obj->member_srl = implode(',',$args->member_srl); |
| 1557 | 1767 | |
| 1558 | 1768 | $output = executeQueryArray('member.getMembersGroup', $obj); |
| 1559 | - if($output->data) foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1769 | + if($output->data) { |
|
| 1770 | + foreach($output->data as $key => $val) $date[$val->member_srl] = $val->regdate; |
|
| 1771 | + } |
|
| 1560 | 1772 | |
| 1561 | 1773 | $output = executeQuery('member.deleteMembersGroup', $obj); |
| 1562 | - if(!$output->toBool()) return $output; |
|
| 1774 | + if(!$output->toBool()) { |
|
| 1775 | + return $output; |
|
| 1776 | + } |
|
| 1563 | 1777 | |
| 1564 | 1778 | $inserted_members = array(); |
| 1565 | 1779 | foreach($args->member_srl as $key => $val) |
| 1566 | 1780 | { |
| 1567 | - if($inserted_members[$val]) continue; |
|
| 1781 | + if($inserted_members[$val]) { |
|
| 1782 | + continue; |
|
| 1783 | + } |
|
| 1568 | 1784 | $inserted_members[$val] = true; |
| 1569 | 1785 | |
| 1570 | 1786 | unset($obj); |
@@ -1574,7 +1790,9 @@ discard block |
||
| 1574 | 1790 | $obj->site_srl = $args->site_srl; |
| 1575 | 1791 | $obj->regdate = $date[$obj->member_srl]; |
| 1576 | 1792 | $output = executeQuery('member.addMemberToGroup', $obj); |
| 1577 | - if(!$output->toBool()) return $output; |
|
| 1793 | + if(!$output->toBool()) { |
|
| 1794 | + return $output; |
|
| 1795 | + } |
|
| 1578 | 1796 | |
| 1579 | 1797 | $this->_clearMemberCache($obj->member_srl, $args->site_srl); |
| 1580 | 1798 | } |
@@ -1636,8 +1854,7 @@ discard block |
||
| 1636 | 1854 | if($config->identifier == 'user_id') |
| 1637 | 1855 | { |
| 1638 | 1856 | $member_info = $oMemberModel->getMemberInfoByUserID($user_id, $columnList); |
| 1639 | - } |
|
| 1640 | - else |
|
| 1857 | + } else |
|
| 1641 | 1858 | { |
| 1642 | 1859 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($user_id, $columnList); |
| 1643 | 1860 | } |
@@ -1646,8 +1863,7 @@ discard block |
||
| 1646 | 1863 | $do_auto_login = true; |
| 1647 | 1864 | } |
| 1648 | 1865 | |
| 1649 | - } |
|
| 1650 | - else |
|
| 1866 | + } else |
|
| 1651 | 1867 | { |
| 1652 | 1868 | $do_auto_login = true; |
| 1653 | 1869 | } |
@@ -1656,8 +1872,7 @@ discard block |
||
| 1656 | 1872 | if($do_auto_login) |
| 1657 | 1873 | { |
| 1658 | 1874 | $output = $this->doLogin($user_id); |
| 1659 | - } |
|
| 1660 | - else |
|
| 1875 | + } else |
|
| 1661 | 1876 | { |
| 1662 | 1877 | executeQuery('member.deleteAutologin', $args); |
| 1663 | 1878 | setCookie('xeak',null,$_SERVER['REQUEST_TIME']+60*60*24*365); |
@@ -1676,13 +1891,17 @@ discard block |
||
| 1676 | 1891 | function doLogin($user_id, $password = '', $keep_signed = false) |
| 1677 | 1892 | { |
| 1678 | 1893 | $user_id = strtolower($user_id); |
| 1679 | - if(!$user_id) return new Object(-1, 'null_user_id'); |
|
| 1894 | + if(!$user_id) { |
|
| 1895 | + return new Object(-1, 'null_user_id'); |
|
| 1896 | + } |
|
| 1680 | 1897 | // Call a trigger before log-in (before) |
| 1681 | 1898 | $trigger_obj = new stdClass(); |
| 1682 | 1899 | $trigger_obj->user_id = $user_id; |
| 1683 | 1900 | $trigger_obj->password = $password; |
| 1684 | 1901 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); |
| 1685 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 1902 | + if(!$trigger_output->toBool()) { |
|
| 1903 | + return $trigger_output; |
|
| 1904 | + } |
|
| 1686 | 1905 | // Create a member model object |
| 1687 | 1906 | $oMemberModel = getModel('member'); |
| 1688 | 1907 | |
@@ -1697,15 +1916,18 @@ discard block |
||
| 1697 | 1916 | // Get user_id information |
| 1698 | 1917 | $this->memberInfo = $oMemberModel->getMemberInfoByEmailAddress($user_id); |
| 1699 | 1918 | // Set an invalid user if no value returned |
| 1700 | - if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1919 | + if(!$user_id || strtolower($this->memberInfo->email_address) != strtolower($user_id)) { |
|
| 1920 | + return $this->recordLoginError(-1, 'invalid_email_address'); |
|
| 1921 | + } |
|
| 1701 | 1922 | |
| 1702 | - } |
|
| 1703 | - else |
|
| 1923 | + } else |
|
| 1704 | 1924 | { |
| 1705 | 1925 | // Get user_id information |
| 1706 | 1926 | $this->memberInfo = $oMemberModel->getMemberInfoByUserID($user_id); |
| 1707 | 1927 | // Set an invalid user if no value returned |
| 1708 | - if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1928 | + if(!$user_id || strtolower($this->memberInfo->user_id) != strtolower($user_id)) { |
|
| 1929 | + return $this->recordLoginError(-1, 'invalid_user_id'); |
|
| 1930 | + } |
|
| 1709 | 1931 | } |
| 1710 | 1932 | |
| 1711 | 1933 | $output = executeQuery('member.getLoginCountByIp', $args); |
@@ -1717,14 +1939,18 @@ discard block |
||
| 1717 | 1939 | if($term < $config->max_error_count_time) |
| 1718 | 1940 | { |
| 1719 | 1941 | $term = $config->max_error_count_time - $term; |
| 1720 | - if($term < 60) $term = intval($term).Context::getLang('unit_sec'); |
|
| 1721 | - elseif(60 <= $term && $term < 3600) $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1722 | - elseif(3600 <= $term && $term < 86400) $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1723 | - else $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1942 | + if($term < 60) { |
|
| 1943 | + $term = intval($term).Context::getLang('unit_sec'); |
|
| 1944 | + } elseif(60 <= $term && $term < 3600) { |
|
| 1945 | + $term = intval($term/60).Context::getLang('unit_min'); |
|
| 1946 | + } elseif(3600 <= $term && $term < 86400) { |
|
| 1947 | + $term = intval($term/3600).Context::getLang('unit_hour'); |
|
| 1948 | + } else { |
|
| 1949 | + $term = intval($term/86400).Context::getLang('unit_day'); |
|
| 1950 | + } |
|
| 1724 | 1951 | |
| 1725 | 1952 | return new Object(-1, sprintf(Context::getLang('excess_ip_access_count'),$term)); |
| 1726 | - } |
|
| 1727 | - else |
|
| 1953 | + } else |
|
| 1728 | 1954 | { |
| 1729 | 1955 | $args->ipaddress = $_SERVER['REMOTE_ADDR']; |
| 1730 | 1956 | $output = executeQuery('member.deleteLoginCountByIp', $args); |
@@ -1751,7 +1977,9 @@ discard block |
||
| 1751 | 1977 | return new Object(-1,'msg_user_denied'); |
| 1752 | 1978 | } |
| 1753 | 1979 | // Notify if denied_date is less than the current time |
| 1754 | - 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"))); |
|
| 1980 | + if($this->memberInfo->limit_date && substr($this->memberInfo->limit_date,0,8) >= date("Ymd")) { |
|
| 1981 | + return new Object(-9,sprintf(Context::getLang('msg_user_limited'),zdate($this->memberInfo->limit_date,"Y-m-d"))); |
|
| 1982 | + } |
|
| 1755 | 1983 | // Update the latest login time |
| 1756 | 1984 | $args->member_srl = $this->memberInfo->member_srl; |
| 1757 | 1985 | $output = executeQuery('member.updateLastLogin', $args); |
@@ -1800,7 +2028,9 @@ discard block |
||
| 1800 | 2028 | } |
| 1801 | 2029 | // Call a trigger after successfully log-in (after) |
| 1802 | 2030 | $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $this->memberInfo); |
| 1803 | - if(!$trigger_output->toBool()) return $trigger_output; |
|
| 2031 | + if(!$trigger_output->toBool()) { |
|
| 2032 | + return $trigger_output; |
|
| 2033 | + } |
|
| 1804 | 2034 | // When user checked to use auto-login |
| 1805 | 2035 | if($keep_signed) |
| 1806 | 2036 | { |
@@ -1814,7 +2044,9 @@ discard block |
||
| 1814 | 2044 | $autologin_args->member_srl = $this->memberInfo->member_srl; |
| 1815 | 2045 | executeQuery('member.deleteAutologin', $autologin_args); |
| 1816 | 2046 | $autologin_output = executeQuery('member.insertAutologin', $autologin_args); |
| 1817 | - if($autologin_output->toBool()) setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2047 | + if($autologin_output->toBool()) { |
|
| 2048 | + setCookie('xeak',$autologin_args->autologin_key, $_SERVER['REQUEST_TIME']+31536000); |
|
| 2049 | + } |
|
| 1818 | 2050 | } |
| 1819 | 2051 | if($this->memberInfo->is_admin == 'Y') |
| 1820 | 2052 | { |
@@ -1903,7 +2135,9 @@ discard block |
||
| 1903 | 2135 | function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') |
| 1904 | 2136 | { |
| 1905 | 2137 | $member_popup_menu_list = Context::get('member_popup_menu_list'); |
| 1906 | - if(!is_array($member_popup_menu_list)) $member_popup_menu_list = array(); |
|
| 2138 | + if(!is_array($member_popup_menu_list)) { |
|
| 2139 | + $member_popup_menu_list = array(); |
|
| 2140 | + } |
|
| 1907 | 2141 | |
| 1908 | 2142 | $obj = new stdClass; |
| 1909 | 2143 | $obj->url = $url; |
@@ -1922,35 +2156,54 @@ discard block |
||
| 1922 | 2156 | { |
| 1923 | 2157 | // Call a trigger (before) |
| 1924 | 2158 | $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); |
| 1925 | - if(!$output->toBool()) return $output; |
|
| 2159 | + if(!$output->toBool()) { |
|
| 2160 | + return $output; |
|
| 2161 | + } |
|
| 1926 | 2162 | // Terms and Conditions portion of the information set up by members reaffirmed |
| 1927 | 2163 | $oModuleModel = getModel('module'); |
| 1928 | 2164 | $config = $oModuleModel->getModuleConfig('member'); |
| 1929 | 2165 | |
| 1930 | 2166 | $logged_info = Context::get('logged_info'); |
| 1931 | 2167 | // If the date of the temporary restrictions limit further information on the date of |
| 1932 | - if($config->limit_day) $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2168 | + if($config->limit_day) { |
|
| 2169 | + $args->limit_date = date("YmdHis", $_SERVER['REQUEST_TIME']+$config->limit_day*60*60*24); |
|
| 2170 | + } |
|
| 1933 | 2171 | |
| 1934 | 2172 | $args->member_srl = getNextSequence(); |
| 1935 | 2173 | $args->list_order = -1 * $args->member_srl; |
| 1936 | 2174 | |
| 1937 | 2175 | // Execute insert or update depending on the value of member_srl |
| 1938 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2176 | + if(!$args->user_id) { |
|
| 2177 | + $args->user_id = 't'.$args->member_srl; |
|
| 2178 | + } |
|
| 1939 | 2179 | // Enter the user's identity changed to lowercase |
| 1940 | - else $args->user_id = strtolower($args->user_id); |
|
| 1941 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 1942 | - if(!$args->nick_name) $args->nick_name = $args->member_srl; |
|
| 2180 | + else { |
|
| 2181 | + $args->user_id = strtolower($args->user_id); |
|
| 2182 | + } |
|
| 2183 | + if(!$args->user_name) { |
|
| 2184 | + $args->user_name = $args->member_srl; |
|
| 2185 | + } |
|
| 2186 | + if(!$args->nick_name) { |
|
| 2187 | + $args->nick_name = $args->member_srl; |
|
| 2188 | + } |
|
| 1943 | 2189 | |
| 1944 | 2190 | // Control of essential parameters |
| 1945 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 1946 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 1947 | - if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) $args->allow_message = 'Y'; |
|
| 2191 | + if($args->allow_mailing!='Y') { |
|
| 2192 | + $args->allow_mailing = 'N'; |
|
| 2193 | + } |
|
| 2194 | + if($args->denied!='Y') { |
|
| 2195 | + $args->denied = 'N'; |
|
| 2196 | + } |
|
| 2197 | + if(!$args->allow_message || ($args->allow_message && !in_array($args->allow_message, array('Y','N','F')))) { |
|
| 2198 | + $args->allow_message = 'Y'; |
|
| 2199 | + } |
|
| 1948 | 2200 | |
| 1949 | 2201 | if($logged_info->is_admin == 'Y') |
| 1950 | 2202 | { |
| 1951 | - if($args->is_admin!='Y') $args->is_admin = 'N'; |
|
| 1952 | - } |
|
| 1953 | - else |
|
| 2203 | + if($args->is_admin!='Y') { |
|
| 2204 | + $args->is_admin = 'N'; |
|
| 2205 | + } |
|
| 2206 | + } else |
|
| 1954 | 2207 | { |
| 1955 | 2208 | unset($args->is_admin); |
| 1956 | 2209 | } |
@@ -1963,8 +2216,12 @@ discard block |
||
| 1963 | 2216 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1964 | 2217 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1965 | 2218 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 1966 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 1967 | - if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2219 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) { |
|
| 2220 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2221 | + } |
|
| 2222 | + if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) { |
|
| 2223 | + $args->blog = 'http://'.$args->blog; |
|
| 2224 | + } |
|
| 1968 | 2225 | |
| 1969 | 2226 | // Create a model object |
| 1970 | 2227 | $oMemberModel = getModel('member'); |
@@ -1978,8 +2235,7 @@ discard block |
||
| 1978 | 2235 | return new Object(-1, $message[$config->password_strength]); |
| 1979 | 2236 | } |
| 1980 | 2237 | $args->password = $oMemberModel->hashPassword($args->password); |
| 1981 | - } |
|
| 1982 | - elseif(!$args->password) |
|
| 2238 | + } elseif(!$args->password) |
|
| 1983 | 2239 | { |
| 1984 | 2240 | unset($args->password); |
| 1985 | 2241 | } |
@@ -2020,8 +2276,12 @@ discard block |
||
| 2020 | 2276 | // Insert data into the DB |
| 2021 | 2277 | $args->list_order = -1 * $args->member_srl; |
| 2022 | 2278 | |
| 2023 | - if(!$args->user_id) $args->user_id = 't'.$args->member_srl; |
|
| 2024 | - if(!$args->user_name) $args->user_name = $args->member_srl; |
|
| 2279 | + if(!$args->user_id) { |
|
| 2280 | + $args->user_id = 't'.$args->member_srl; |
|
| 2281 | + } |
|
| 2282 | + if(!$args->user_name) { |
|
| 2283 | + $args->user_name = $args->member_srl; |
|
| 2284 | + } |
|
| 2025 | 2285 | |
| 2026 | 2286 | $oDB = &DB::getInstance(); |
| 2027 | 2287 | $oDB->begin(); |
@@ -2033,8 +2293,11 @@ discard block |
||
| 2033 | 2293 | return $output; |
| 2034 | 2294 | } |
| 2035 | 2295 | |
| 2036 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2037 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2296 | + if(is_array($args->group_srl_list)) { |
|
| 2297 | + $group_srl_list = $args->group_srl_list; |
|
| 2298 | + } else { |
|
| 2299 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2300 | + } |
|
| 2038 | 2301 | // If no value is entered the default group, the value of group registration |
| 2039 | 2302 | if(!$args->group_srl_list) |
| 2040 | 2303 | { |
@@ -2051,8 +2314,7 @@ discard block |
||
| 2051 | 2314 | } |
| 2052 | 2315 | } |
| 2053 | 2316 | // If the value is the value of the group entered the group registration |
| 2054 | - } |
|
| 2055 | - else |
|
| 2317 | + } else |
|
| 2056 | 2318 | { |
| 2057 | 2319 | for($i=0;$i<count($group_srl_list);$i++) |
| 2058 | 2320 | { |
@@ -2113,27 +2375,39 @@ discard block |
||
| 2113 | 2375 | { |
| 2114 | 2376 | // Call a trigger (before) |
| 2115 | 2377 | $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); |
| 2116 | - if(!$output->toBool()) return $output; |
|
| 2378 | + if(!$output->toBool()) { |
|
| 2379 | + return $output; |
|
| 2380 | + } |
|
| 2117 | 2381 | // Create a model object |
| 2118 | 2382 | $oMemberModel = getModel('member'); |
| 2119 | 2383 | |
| 2120 | 2384 | $logged_info = Context::get('logged_info'); |
| 2121 | 2385 | // Get what you want to modify the original information |
| 2122 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2386 | + if(!$this->memberInfo) { |
|
| 2387 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2388 | + } |
|
| 2123 | 2389 | // Control of essential parameters |
| 2124 | - if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; |
|
| 2125 | - if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; |
|
| 2390 | + if($args->allow_mailing!='Y') { |
|
| 2391 | + $args->allow_mailing = 'N'; |
|
| 2392 | + } |
|
| 2393 | + if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) { |
|
| 2394 | + $args->allow_message = 'Y'; |
|
| 2395 | + } |
|
| 2126 | 2396 | |
| 2127 | 2397 | if($logged_info->is_admin == 'Y') |
| 2128 | 2398 | { |
| 2129 | - if($args->denied!='Y') $args->denied = 'N'; |
|
| 2130 | - if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) $args->is_admin = 'N'; |
|
| 2131 | - } |
|
| 2132 | - else |
|
| 2399 | + if($args->denied!='Y') { |
|
| 2400 | + $args->denied = 'N'; |
|
| 2401 | + } |
|
| 2402 | + if($args->is_admin!='Y' && $logged_info->member_srl != $args->member_srl) { |
|
| 2403 | + $args->is_admin = 'N'; |
|
| 2404 | + } |
|
| 2405 | + } else |
|
| 2133 | 2406 | { |
| 2134 | 2407 | unset($args->is_admin); |
| 2135 | - if($is_admin == false) |
|
| 2136 | - unset($args->denied); |
|
| 2408 | + if($is_admin == false) { |
|
| 2409 | + unset($args->denied); |
|
| 2410 | + } |
|
| 2137 | 2411 | if($logged_info->member_srl != $args->member_srl && $is_admin == false) |
| 2138 | 2412 | { |
| 2139 | 2413 | return $this->stop('msg_invalid_request'); |
@@ -2141,13 +2415,19 @@ discard block |
||
| 2141 | 2415 | } |
| 2142 | 2416 | |
| 2143 | 2417 | // Sanitize user ID, username, nickname, homepage, blog |
| 2144 | - if($args->user_id) $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2418 | + if($args->user_id) { |
|
| 2419 | + $args->user_id = htmlspecialchars($args->user_id, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
|
| 2420 | + } |
|
| 2145 | 2421 | $args->user_name = htmlspecialchars($args->user_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2146 | 2422 | $args->nick_name = htmlspecialchars($args->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2147 | 2423 | $args->homepage = htmlspecialchars($args->homepage, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2148 | 2424 | $args->blog = htmlspecialchars($args->blog, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 2149 | - if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; |
|
| 2150 | - if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; |
|
| 2425 | + if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) { |
|
| 2426 | + $args->homepage = 'http://'.$args->homepage; |
|
| 2427 | + } |
|
| 2428 | + if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) { |
|
| 2429 | + $args->blog = 'http://'.$args->blog; |
|
| 2430 | + } |
|
| 2151 | 2431 | |
| 2152 | 2432 | // check member identifier form |
| 2153 | 2433 | $config = $oMemberModel->getMemberConfig(); |
@@ -2164,8 +2444,7 @@ discard block |
||
| 2164 | 2444 | return new Object(-1,'msg_exists_email_address'); |
| 2165 | 2445 | } |
| 2166 | 2446 | $args->email_address = $orgMemberInfo->email_address; |
| 2167 | - } |
|
| 2168 | - else |
|
| 2447 | + } else |
|
| 2169 | 2448 | { |
| 2170 | 2449 | $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); |
| 2171 | 2450 | if($member_srl && $args->member_srl != $member_srl) |
@@ -2222,17 +2501,26 @@ discard block |
||
| 2222 | 2501 | return new Object(-1, $message[$config->password_strength]); |
| 2223 | 2502 | } |
| 2224 | 2503 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2225 | - } |
|
| 2226 | - else |
|
| 2504 | + } else |
|
| 2227 | 2505 | { |
| 2228 | 2506 | $args->password = $orgMemberInfo->password; |
| 2229 | 2507 | } |
| 2230 | 2508 | |
| 2231 | - if(!$args->user_name) $args->user_name = $orgMemberInfo->user_name; |
|
| 2232 | - if(!$args->user_id) $args->user_id = $orgMemberInfo->user_id; |
|
| 2233 | - if(!$args->nick_name) $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2234 | - if(!$args->description) $args->description = $orgMemberInfo->description; |
|
| 2235 | - if(!$args->birthday) $args->birthday = ''; |
|
| 2509 | + if(!$args->user_name) { |
|
| 2510 | + $args->user_name = $orgMemberInfo->user_name; |
|
| 2511 | + } |
|
| 2512 | + if(!$args->user_id) { |
|
| 2513 | + $args->user_id = $orgMemberInfo->user_id; |
|
| 2514 | + } |
|
| 2515 | + if(!$args->nick_name) { |
|
| 2516 | + $args->nick_name = $orgMemberInfo->nick_name; |
|
| 2517 | + } |
|
| 2518 | + if(!$args->description) { |
|
| 2519 | + $args->description = $orgMemberInfo->description; |
|
| 2520 | + } |
|
| 2521 | + if(!$args->birthday) { |
|
| 2522 | + $args->birthday = ''; |
|
| 2523 | + } |
|
| 2236 | 2524 | |
| 2237 | 2525 | $output = executeQuery('member.updateMember', $args); |
| 2238 | 2526 | |
@@ -2244,8 +2532,11 @@ discard block |
||
| 2244 | 2532 | |
| 2245 | 2533 | if($args->group_srl_list) |
| 2246 | 2534 | { |
| 2247 | - if(is_array($args->group_srl_list)) $group_srl_list = $args->group_srl_list; |
|
| 2248 | - else $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2535 | + if(is_array($args->group_srl_list)) { |
|
| 2536 | + $group_srl_list = $args->group_srl_list; |
|
| 2537 | + } else { |
|
| 2538 | + $group_srl_list = explode('|@|', $args->group_srl_list); |
|
| 2539 | + } |
|
| 2249 | 2540 | // If the group information, group information changes |
| 2250 | 2541 | if(count($group_srl_list) > 0) |
| 2251 | 2542 | { |
@@ -2288,7 +2579,9 @@ discard block |
||
| 2288 | 2579 | $this->_clearMemberCache($args->member_srl, $args->site_srl); |
| 2289 | 2580 | |
| 2290 | 2581 | // Save Session |
| 2291 | - if(!$this->memberInfo) $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2582 | + if(!$this->memberInfo) { |
|
| 2583 | + $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); |
|
| 2584 | + } |
|
| 2292 | 2585 | $logged_info = Context::get('logged_info'); |
| 2293 | 2586 | |
| 2294 | 2587 | $output->add('member_srl', $args->member_srl); |
@@ -2314,8 +2607,7 @@ discard block |
||
| 2314 | 2607 | } |
| 2315 | 2608 | |
| 2316 | 2609 | $args->password = $oMemberModel->hashPassword($args->password); |
| 2317 | - } |
|
| 2318 | - else if($args->hashed_password) |
|
| 2610 | + } else if($args->hashed_password) |
|
| 2319 | 2611 | { |
| 2320 | 2612 | $args->password = $args->hashed_password; |
| 2321 | 2613 | } |
@@ -2340,7 +2632,9 @@ discard block |
||
| 2340 | 2632 | $trigger_obj = new stdClass(); |
| 2341 | 2633 | $trigger_obj->member_srl = $member_srl; |
| 2342 | 2634 | $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); |
| 2343 | - if(!$output->toBool()) return $output; |
|
| 2635 | + if(!$output->toBool()) { |
|
| 2636 | + return $output; |
|
| 2637 | + } |
|
| 2344 | 2638 | // Create a model object |
| 2345 | 2639 | $oMemberModel = getModel('member'); |
| 2346 | 2640 | // Bringing the user's information |
@@ -2349,9 +2643,13 @@ discard block |
||
| 2349 | 2643 | $columnList = array('member_srl', 'is_admin'); |
| 2350 | 2644 | $this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList); |
| 2351 | 2645 | } |
| 2352 | - if(!$this->memberInfo) return new Object(-1, 'msg_not_exists_member'); |
|
| 2646 | + if(!$this->memberInfo) { |
|
| 2647 | + return new Object(-1, 'msg_not_exists_member'); |
|
| 2648 | + } |
|
| 2353 | 2649 | // If managers can not be deleted |
| 2354 | - if($this->memberInfo->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); |
|
| 2650 | + if($this->memberInfo->is_admin == 'Y') { |
|
| 2651 | + return new Object(-1, 'msg_cannot_delete_admin'); |
|
| 2652 | + } |
|
| 2355 | 2653 | |
| 2356 | 2654 | $oDB = &DB::getInstance(); |
| 2357 | 2655 | $oDB->begin(); |
@@ -2415,7 +2713,9 @@ discard block |
||
| 2415 | 2713 | */ |
| 2416 | 2714 | function destroySessionInfo() |
| 2417 | 2715 | { |
| 2418 | - if(!$_SESSION || !is_array($_SESSION)) return; |
|
| 2716 | + if(!$_SESSION || !is_array($_SESSION)) { |
|
| 2717 | + return; |
|
| 2718 | + } |
|
| 2419 | 2719 | |
| 2420 | 2720 | $memberInfo = Context::get('logged_info'); |
| 2421 | 2721 | $memberSrl = $memberInfo->member_srl; |
@@ -2454,8 +2754,9 @@ discard block |
||
| 2454 | 2754 | } |
| 2455 | 2755 | $maxLevel = 0; |
| 2456 | 2756 | $resultGroup = array_intersect($levelGroup, $groupSrlList); |
| 2457 | - if(count($resultGroup) > 0) |
|
| 2458 | - $maxLevel = max(array_flip($resultGroup)); |
|
| 2757 | + if(count($resultGroup) > 0) { |
|
| 2758 | + $maxLevel = max(array_flip($resultGroup)); |
|
| 2759 | + } |
|
| 2459 | 2760 | |
| 2460 | 2761 | if($maxLevel > 0) |
| 2461 | 2762 | { |
@@ -2472,16 +2773,22 @@ discard block |
||
| 2472 | 2773 | |
| 2473 | 2774 | function procMemberModifyEmailAddress() |
| 2474 | 2775 | { |
| 2475 | - if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); |
|
| 2776 | + if(!Context::get('is_logged')) { |
|
| 2777 | + return $this->stop('msg_not_logged'); |
|
| 2778 | + } |
|
| 2476 | 2779 | |
| 2477 | 2780 | $member_info = Context::get('logged_info'); |
| 2478 | 2781 | $newEmail = Context::get('email_address'); |
| 2479 | 2782 | |
| 2480 | - if(!$newEmail) return $this->stop('msg_invalid_request'); |
|
| 2783 | + if(!$newEmail) { |
|
| 2784 | + return $this->stop('msg_invalid_request'); |
|
| 2785 | + } |
|
| 2481 | 2786 | |
| 2482 | 2787 | $oMemberModel = getModel('member'); |
| 2483 | 2788 | $member_srl = $oMemberModel->getMemberSrlByEmailAddress($newEmail); |
| 2484 | - if($member_srl) return new Object(-1,'msg_exists_email_address'); |
|
| 2789 | + if($member_srl) { |
|
| 2790 | + return new Object(-1,'msg_exists_email_address'); |
|
| 2791 | + } |
|
| 2485 | 2792 | |
| 2486 | 2793 | if($_SESSION['rechecked_password_step'] != 'INPUT_DATA') |
| 2487 | 2794 | { |
@@ -2509,7 +2816,9 @@ discard block |
||
| 2509 | 2816 | $member_config = $oModuleModel->getModuleConfig('member'); |
| 2510 | 2817 | |
| 2511 | 2818 | $tpl_path = sprintf('%sskins/%s', $this->module_path, $member_config->skin); |
| 2512 | - if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2819 | + if(!is_dir($tpl_path)) { |
|
| 2820 | + $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); |
|
| 2821 | + } |
|
| 2513 | 2822 | |
| 2514 | 2823 | global $lang; |
| 2515 | 2824 | |
@@ -2545,7 +2854,9 @@ discard block |
||
| 2545 | 2854 | { |
| 2546 | 2855 | $member_srl = Context::get('member_srl'); |
| 2547 | 2856 | $auth_key = Context::get('auth_key'); |
| 2548 | - if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); |
|
| 2857 | + if(!$member_srl || !$auth_key) { |
|
| 2858 | + return $this->stop('msg_invalid_request'); |
|
| 2859 | + } |
|
| 2549 | 2860 | |
| 2550 | 2861 | // Test logs for finding password by user_id and authkey |
| 2551 | 2862 | $args = new stdClass; |
@@ -2554,7 +2865,9 @@ discard block |
||
| 2554 | 2865 | $output = executeQuery('member.getAuthMail', $args); |
| 2555 | 2866 | if(!$output->toBool() || $output->data->auth_key != $auth_key) |
| 2556 | 2867 | { |
| 2557 | - if(strlen($output->data->auth_key) !== strlen($auth_key)) executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2868 | + if(strlen($output->data->auth_key) !== strlen($auth_key)) { |
|
| 2869 | + executeQuery('member.deleteAuthChangeEmailAddress', $args); |
|
| 2870 | + } |
|
| 2558 | 2871 | return $this->stop('msg_invalid_modify_email_auth_key'); |
| 2559 | 2872 | } |
| 2560 | 2873 | |
@@ -2563,7 +2876,9 @@ discard block |
||
| 2563 | 2876 | list($args->email_id, $args->email_host) = explode('@', $newEmail); |
| 2564 | 2877 | |
| 2565 | 2878 | $output = executeQuery('member.updateMemberEmailAddress', $args); |
| 2566 | - if(!$output->toBool()) return $this->stop($output->getMessage()); |
|
| 2879 | + if(!$output->toBool()) { |
|
| 2880 | + return $this->stop($output->getMessage()); |
|
| 2881 | + } |
|
| 2567 | 2882 | |
| 2568 | 2883 | // Remove all values having the member_srl and new_password equal to 'XE_change_emaill_address' from authentication table |
| 2569 | 2884 | executeQuery('member.deleteAuthChangeEmailAddress',$args); |
@@ -2584,7 +2899,9 @@ discard block |
||
| 2584 | 2899 | **/ |
| 2585 | 2900 | function triggerGetDocumentMenu(&$menu_list) |
| 2586 | 2901 | { |
| 2587 | - if(!Context::get('is_logged')) return new Object(); |
|
| 2902 | + if(!Context::get('is_logged')) { |
|
| 2903 | + return new Object(); |
|
| 2904 | + } |
|
| 2588 | 2905 | |
| 2589 | 2906 | $logged_info = Context::get('logged_info'); |
| 2590 | 2907 | $document_srl = Context::get('target_srl'); |
@@ -2595,8 +2912,12 @@ discard block |
||
| 2595 | 2912 | $member_srl = $oDocument->get('member_srl'); |
| 2596 | 2913 | $module_srl = $oDocument->get('module_srl'); |
| 2597 | 2914 | |
| 2598 | - if(!$member_srl) return new Object(); |
|
| 2599 | - if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
| 2915 | + if(!$member_srl) { |
|
| 2916 | + return new Object(); |
|
| 2917 | + } |
|
| 2918 | + if($oDocumentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 2919 | + return new Object(); |
|
| 2920 | + } |
|
| 2600 | 2921 | |
| 2601 | 2922 | $oDocumentController = getController('document'); |
| 2602 | 2923 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2614,7 +2935,9 @@ discard block |
||
| 2614 | 2935 | **/ |
| 2615 | 2936 | function triggerGetCommentMenu(&$menu_list) |
| 2616 | 2937 | { |
| 2617 | - if(!Context::get('is_logged')) return new Object(); |
|
| 2938 | + if(!Context::get('is_logged')) { |
|
| 2939 | + return new Object(); |
|
| 2940 | + } |
|
| 2618 | 2941 | |
| 2619 | 2942 | $logged_info = Context::get('logged_info'); |
| 2620 | 2943 | $comment_srl = Context::get('target_srl'); |
@@ -2625,8 +2948,12 @@ discard block |
||
| 2625 | 2948 | $module_srl = $oComment->get('module_srl'); |
| 2626 | 2949 | $member_srl = $oComment->get('member_srl'); |
| 2627 | 2950 | |
| 2628 | - if(!$member_srl) return new Object(); |
|
| 2629 | - if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) return new Object(); |
|
| 2951 | + if(!$member_srl) { |
|
| 2952 | + return new Object(); |
|
| 2953 | + } |
|
| 2954 | + if($oCommentModel->grant->manager != 1 || $member_srl==$logged_info->member_srl) { |
|
| 2955 | + return new Object(); |
|
| 2956 | + } |
|
| 2630 | 2957 | |
| 2631 | 2958 | $oCommentController = getController('comment'); |
| 2632 | 2959 | $url = getUrl('','module','member','act','dispMemberSpammer','member_srl',$member_srl,'module_srl',$module_srl); |
@@ -2642,7 +2969,9 @@ discard block |
||
| 2642 | 2969 | **/ |
| 2643 | 2970 | function procMemberSpammerManage() |
| 2644 | 2971 | { |
| 2645 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
| 2972 | + if(!Context::get('is_logged')) { |
|
| 2973 | + return new Object(-1,'msg_not_permitted'); |
|
| 2974 | + } |
|
| 2646 | 2975 | |
| 2647 | 2976 | $logged_info = Context::get('logged_info'); |
| 2648 | 2977 | $member_srl = Context::get('member_srl'); |
@@ -2650,8 +2979,9 @@ discard block |
||
| 2650 | 2979 | $cnt_loop = Context::get('cnt_loop'); |
| 2651 | 2980 | $proc_type = Context::get('proc_type'); |
| 2652 | 2981 | $isMoveToTrash = true; |
| 2653 | - if($proc_type == "delete") |
|
| 2654 | - $isMoveToTrash = false; |
|
| 2982 | + if($proc_type == "delete") { |
|
| 2983 | + $isMoveToTrash = false; |
|
| 2984 | + } |
|
| 2655 | 2985 | |
| 2656 | 2986 | // check grant |
| 2657 | 2987 | $oModuleModel = getModel('module'); |
@@ -2659,7 +2989,9 @@ discard block |
||
| 2659 | 2989 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 2660 | 2990 | $grant = $oModuleModel->getGrant($module_info, $logged_info); |
| 2661 | 2991 | |
| 2662 | - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); |
|
| 2992 | + if(!$grant->manager) { |
|
| 2993 | + return new Object(-1,'msg_not_permitted'); |
|
| 2994 | + } |
|
| 2663 | 2995 | |
| 2664 | 2996 | $proc_msg = ""; |
| 2665 | 2997 | |
@@ -2668,11 +3000,13 @@ discard block |
||
| 2668 | 3000 | |
| 2669 | 3001 | // delete or trash destination |
| 2670 | 3002 | // proc member |
| 2671 | - if($cnt_loop == 1) |
|
| 2672 | - $this->_spammerMember($member_srl); |
|
| 3003 | + if($cnt_loop == 1) { |
|
| 3004 | + $this->_spammerMember($member_srl); |
|
| 3005 | + } |
|
| 2673 | 3006 | // proc document and comment |
| 2674 | - elseif($cnt_loop>1) |
|
| 2675 | - $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3007 | + elseif($cnt_loop>1) { |
|
| 3008 | + $this->_spammerDocuments($member_srl, $isMoveToTrash); |
|
| 3009 | + } |
|
| 2676 | 3010 | |
| 2677 | 3011 | // get destination count |
| 2678 | 3012 | $cnt_document = $oDocumentModel->getDocumentCountByMemberSrl($member_srl); |
@@ -2680,13 +3014,16 @@ discard block |
||
| 2680 | 3014 | |
| 2681 | 3015 | $total_count = Context::get('total_count'); |
| 2682 | 3016 | $remain_count = $cnt_document + $cnt_comment; |
| 2683 | - if($cnt_loop == 1) $total_count = $remain_count; |
|
| 3017 | + if($cnt_loop == 1) { |
|
| 3018 | + $total_count = $remain_count; |
|
| 3019 | + } |
|
| 2684 | 3020 | |
| 2685 | 3021 | // get progress percent |
| 2686 | - if($total_count > 0) |
|
| 2687 | - $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 2688 | - else |
|
| 2689 | - $progress = 100; |
|
| 3022 | + if($total_count > 0) { |
|
| 3023 | + $progress = intval( ( ( $total_count - $remain_count ) / $total_count ) * 100 ); |
|
| 3024 | + } else { |
|
| 3025 | + $progress = 100; |
|
| 3026 | + } |
|
| 2690 | 3027 | |
| 2691 | 3028 | $this->add('total_count', $total_count); |
| 2692 | 3029 | $this->add('remain_count', $remain_count); |
@@ -2728,7 +3065,10 @@ discard block |
||
| 2728 | 3065 | $args->nick_name = $member_info->nick_name; |
| 2729 | 3066 | $args->denied = "Y"; |
| 2730 | 3067 | $args->description = trim( $member_info->description ); |
| 2731 | - if( $args->description != "" ) $args->description .= "\n"; // add new line |
|
| 3068 | + if( $args->description != "" ) { |
|
| 3069 | + $args->description .= "\n"; |
|
| 3070 | + } |
|
| 3071 | + // add new line |
|
| 2732 | 3072 | |
| 2733 | 3073 | $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 . "]"; |
| 2734 | 3074 | |
@@ -2773,8 +3113,11 @@ discard block |
||
| 2773 | 3113 | $documentList = $oDocumentModel->getDocumentListByMemberSrl($member_srl, $columnList, 0, false, $getContentsCount); |
| 2774 | 3114 | if($documentList) { |
| 2775 | 3115 | foreach($documentList as $v) { |
| 2776 | - if($isMoveToTrash) $oDocumentController->moveDocumentToTrash($v); |
|
| 2777 | - else $oDocumentController->deleteDocument($v->document_srl); |
|
| 3116 | + if($isMoveToTrash) { |
|
| 3117 | + $oDocumentController->moveDocumentToTrash($v); |
|
| 3118 | + } else { |
|
| 3119 | + $oDocumentController->deleteDocument($v->document_srl); |
|
| 3120 | + } |
|
| 2778 | 3121 | } |
| 2779 | 3122 | } |
| 2780 | 3123 | } |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | $mid = Context::get('mid'); |
| 30 | 30 | $editor_sequence = Context::get('editor_sequence'); |
| 31 | 31 | $upload_target_srl = Context::get('upload_target_srl'); |
| 32 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 32 | + if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 33 | 33 | |
| 34 | - if($upload_target_srl) |
|
| 34 | + if ($upload_target_srl) |
|
| 35 | 35 | { |
| 36 | 36 | $tmp_files = $this->getFiles($upload_target_srl); |
| 37 | - if($tmp_files instanceof Object && !$tmp_files->toBool()) return $tmp_files; |
|
| 37 | + if ($tmp_files instanceof Object && !$tmp_files->toBool()) return $tmp_files; |
|
| 38 | 38 | |
| 39 | - foreach($tmp_files as $file_info) |
|
| 39 | + foreach ($tmp_files as $file_info) |
|
| 40 | 40 | { |
| 41 | - if(!$file_info->file_srl) continue; |
|
| 41 | + if (!$file_info->file_srl) continue; |
|
| 42 | 42 | |
| 43 | 43 | $obj = new stdClass; |
| 44 | 44 | $obj->file_srl = $file_info->file_srl; |
| 45 | 45 | $obj->source_filename = $file_info->source_filename; |
| 46 | 46 | $obj->file_size = $file_info->file_size; |
| 47 | 47 | $obj->disp_file_size = FileHandler::filesize($file_info->file_size); |
| 48 | - if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 48 | + if ($file_info->direct_download == 'N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 49 | 49 | else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
| 50 | 50 | $obj->direct_download = $file_info->direct_download; |
| 51 | 51 | $obj->cover_image = ($file_info->cover_image === 'Y') ? true : false; |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | //$config = $oModuleModel->getModuleInfoByMid($mid); //perhaps config varialbles not used |
| 66 | 66 | |
| 67 | 67 | $file_config = $this->getUploadConfig(); |
| 68 | - $left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size; |
|
| 68 | + $left_size = $file_config->allowed_attach_size * 1024 * 1024 - $attached_size; |
|
| 69 | 69 | // Settings of required information |
| 70 | 70 | $attached_size = FileHandler::filesize($attached_size); |
| 71 | - $allowed_attach_size = FileHandler::filesize($file_config->allowed_attach_size*1024*1024); |
|
| 72 | - $allowed_filesize = FileHandler::filesize($file_config->allowed_filesize*1024*1024); |
|
| 71 | + $allowed_attach_size = FileHandler::filesize($file_config->allowed_attach_size * 1024 * 1024); |
|
| 72 | + $allowed_filesize = FileHandler::filesize($file_config->allowed_filesize * 1024 * 1024); |
|
| 73 | 73 | $allowed_filetypes = $file_config->allowed_filetypes; |
| 74 | - $this->add("files",$files); |
|
| 75 | - $this->add("editor_sequence",$editor_sequence); |
|
| 76 | - $this->add("upload_target_srl",$upload_target_srl); |
|
| 77 | - $this->add("upload_status",$upload_status); |
|
| 78 | - $this->add("left_size",$left_size); |
|
| 74 | + $this->add("files", $files); |
|
| 75 | + $this->add("editor_sequence", $editor_sequence); |
|
| 76 | + $this->add("upload_target_srl", $upload_target_srl); |
|
| 77 | + $this->add("upload_status", $upload_status); |
|
| 78 | + $this->add("left_size", $left_size); |
|
| 79 | 79 | $this->add('attached_size', $attached_size); |
| 80 | 80 | $this->add('allowed_attach_size', $allowed_attach_size); |
| 81 | 81 | $this->add('allowed_filesize', $allowed_filesize); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $args = new stdClass(); |
| 94 | 94 | $args->upload_target_srl = $upload_target_srl; |
| 95 | 95 | $output = executeQuery('file.getFilesCount', $args); |
| 96 | - return (int)$output->data->count; |
|
| 96 | + return (int) $output->data->count; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param string $sid |
| 104 | 104 | * @return string Returns a url |
| 105 | 105 | */ |
| 106 | - function getDownloadUrl($file_srl, $sid, $module_srl="") |
|
| 106 | + function getDownloadUrl($file_srl, $sid, $module_srl = "") |
|
| 107 | 107 | { |
| 108 | 108 | return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s&module_srl=%s', 'file', 'procFileDownload', $file_srl, $sid, $module_srl); |
| 109 | 109 | } |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $file_module_config = $oModuleModel->getModuleConfig('file'); |
| 123 | 123 | |
| 124 | - if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
| 125 | - if(!$file_config) $file_config = $file_module_config; |
|
| 124 | + if ($module_srl) $file_config = $oModuleModel->getModulePartConfig('file', $module_srl); |
|
| 125 | + if (!$file_config) $file_config = $file_module_config; |
|
| 126 | 126 | |
| 127 | 127 | $config = new stdClass(); |
| 128 | 128 | |
| 129 | - if($file_config) |
|
| 129 | + if ($file_config) |
|
| 130 | 130 | { |
| 131 | 131 | $config->allowed_filesize = $file_config->allowed_filesize; |
| 132 | 132 | $config->allowed_attach_size = $file_config->allowed_attach_size; |
@@ -137,31 +137,31 @@ discard block |
||
| 137 | 137 | $config->allow_outlink_format = $file_config->allow_outlink_format; |
| 138 | 138 | } |
| 139 | 139 | // Property for all files comes first than each property |
| 140 | - if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 141 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 142 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 143 | - if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 144 | - if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 145 | - if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 146 | - if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
| 140 | + if (!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 141 | + if (!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 142 | + if (!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 143 | + if (!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 144 | + if (!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 145 | + if (!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 146 | + if (!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
| 147 | 147 | // Default setting if not exists |
| 148 | - if(!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
| 149 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
| 150 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
| 151 | - if(!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
| 152 | - if(!$config->download_grant) $config->download_grant = array(); |
|
| 148 | + if (!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
| 149 | + if (!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
| 150 | + if (!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
| 151 | + if (!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
| 152 | + if (!$config->download_grant) $config->download_grant = array(); |
|
| 153 | 153 | |
| 154 | 154 | $size = ini_get('upload_max_filesize'); |
| 155 | 155 | $unit = strtolower($size[strlen($size) - 1]); |
| 156 | - $size = (float)$size; |
|
| 157 | - if($unit == 'g') $size *= 1024; |
|
| 158 | - if($unit == 'k') $size /= 1024; |
|
| 156 | + $size = (float) $size; |
|
| 157 | + if ($unit == 'g') $size *= 1024; |
|
| 158 | + if ($unit == 'k') $size /= 1024; |
|
| 159 | 159 | |
| 160 | - if($config->allowed_filesize > $size) |
|
| 160 | + if ($config->allowed_filesize > $size) |
|
| 161 | 161 | { |
| 162 | 162 | $config->allowed_filesize = $size; |
| 163 | 163 | } |
| 164 | - if($config->allowed_attach_size > $size) |
|
| 164 | + if ($config->allowed_attach_size > $size) |
|
| 165 | 165 | { |
| 166 | 166 | $config->allowed_attach_size = $size; |
| 167 | 167 | } |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | $args = new stdClass(); |
| 182 | 182 | $args->file_srl = $file_srl; |
| 183 | 183 | $output = executeQueryArray('file.getFile', $args, $columnList); |
| 184 | - if(!$output->toBool()) return $output; |
|
| 184 | + if (!$output->toBool()) return $output; |
|
| 185 | 185 | |
| 186 | 186 | // old version compatibility |
| 187 | - if(count($output->data) == 1) |
|
| 187 | + if (count($output->data) == 1) |
|
| 188 | 188 | { |
| 189 | 189 | $file = $output->data[0]; |
| 190 | 190 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | { |
| 196 | 196 | $fileList = array(); |
| 197 | 197 | |
| 198 | - if(is_array($output->data)) |
|
| 198 | + if (is_array($output->data)) |
|
| 199 | 199 | { |
| 200 | - foreach($output->data as $key=>$value) |
|
| 200 | + foreach ($output->data as $key=>$value) |
|
| 201 | 201 | { |
| 202 | 202 | $file = $value; |
| 203 | 203 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | $oDocumentModel = getModel('document'); |
| 222 | 222 | $oCommentModel = getModel('document'); |
| 223 | 223 | $targetItem = $oDocumentModel->getDocument($upload_target_srl); |
| 224 | - if(!$targetItem->isExists()) |
|
| 224 | + if (!$targetItem->isExists()) |
|
| 225 | 225 | { |
| 226 | 226 | $targetItem = $oCommentModel->getDocument($upload_target_srl); |
| 227 | 227 | } |
| 228 | - if($targetItem->isExists() && $targetItem->isSecret() && !$targetItem->isGranted()) |
|
| 228 | + if ($targetItem->isExists() && $targetItem->isSecret() && !$targetItem->isGranted()) |
|
| 229 | 229 | { |
| 230 | 230 | return $this->stop('msg_invalid_request'); |
| 231 | 231 | } |
@@ -233,16 +233,16 @@ discard block |
||
| 233 | 233 | $args = new stdClass(); |
| 234 | 234 | $args->upload_target_srl = $upload_target_srl; |
| 235 | 235 | $args->sort_index = $sortIndex; |
| 236 | - if($ckValid) $args->isvalid = 'Y'; |
|
| 236 | + if ($ckValid) $args->isvalid = 'Y'; |
|
| 237 | 237 | $output = executeQuery('file.getFiles', $args, $columnList); |
| 238 | - if(!$output->data) return; |
|
| 238 | + if (!$output->data) return; |
|
| 239 | 239 | |
| 240 | 240 | $file_list = $output->data; |
| 241 | 241 | |
| 242 | - if($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
| 242 | + if ($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
| 243 | 243 | |
| 244 | 244 | $file_count = count($file_list); |
| 245 | - for($i=0;$i<$file_count;$i++) |
|
| 245 | + for ($i = 0; $i < $file_count; $i++) |
|
| 246 | 246 | { |
| 247 | 247 | $file = $file_list[$i]; |
| 248 | 248 | $file->source_filename = stripslashes($file->source_filename); |
@@ -265,14 +265,14 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | $module_srl = Context::get('module_srl'); |
| 267 | 267 | // Get the current module if module_srl doesn't exist |
| 268 | - if(!$module_srl) |
|
| 268 | + if (!$module_srl) |
|
| 269 | 269 | { |
| 270 | 270 | $current_module_info = Context::get('current_module_info'); |
| 271 | 271 | $module_srl = $current_module_info->module_srl; |
| 272 | 272 | } |
| 273 | 273 | $file_config = $this->getFileConfig($module_srl); |
| 274 | 274 | |
| 275 | - if($logged_info->is_admin == 'Y') |
|
| 275 | + if ($logged_info->is_admin == 'Y') |
|
| 276 | 276 | { |
| 277 | 277 | $iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size')); |
| 278 | 278 | $iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize')); |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | '%s : %s/ %s<br /> %s : %s (%s : %s)', |
| 299 | 299 | Context::getLang('allowed_attach_size'), |
| 300 | 300 | FileHandler::filesize($attached_size), |
| 301 | - FileHandler::filesize($file_config->allowed_attach_size*1024*1024), |
|
| 301 | + FileHandler::filesize($file_config->allowed_attach_size * 1024 * 1024), |
|
| 302 | 302 | Context::getLang('allowed_filesize'), |
| 303 | - FileHandler::filesize($file_config->allowed_filesize*1024*1024), |
|
| 303 | + FileHandler::filesize($file_config->allowed_filesize * 1024 * 1024), |
|
| 304 | 304 | Context::getLang('allowed_filetypes'), |
| 305 | 305 | $file_config->allowed_filetypes |
| 306 | 306 | ); |
@@ -327,9 +327,9 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | function getFileGrant($file_info, $member_info) |
| 329 | 329 | { |
| 330 | - if(!$file_info) return null; |
|
| 330 | + if (!$file_info) return null; |
|
| 331 | 331 | |
| 332 | - if($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
|
| 332 | + if ($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
|
| 333 | 333 | { |
| 334 | 334 | $file_grant->is_deletable = true; |
| 335 | 335 | return $file_grant; |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | $oDocumentModel = getModel('document'); |
| 342 | 342 | $oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl); |
| 343 | - if($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
| 343 | + if ($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
| 344 | 344 | |
| 345 | 345 | $file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager); |
| 346 | 346 | |
@@ -29,31 +29,39 @@ discard block |
||
| 29 | 29 | $mid = Context::get('mid'); |
| 30 | 30 | $editor_sequence = Context::get('editor_sequence'); |
| 31 | 31 | $upload_target_srl = Context::get('upload_target_srl'); |
| 32 | - if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 32 | + if(!$upload_target_srl) { |
|
| 33 | + $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | if($upload_target_srl) |
| 35 | 37 | { |
| 36 | 38 | $tmp_files = $this->getFiles($upload_target_srl); |
| 37 | - if($tmp_files instanceof Object && !$tmp_files->toBool()) return $tmp_files; |
|
| 39 | + if($tmp_files instanceof Object && !$tmp_files->toBool()) { |
|
| 40 | + return $tmp_files; |
|
| 41 | + } |
|
| 38 | 42 | |
| 39 | 43 | foreach($tmp_files as $file_info) |
| 40 | 44 | { |
| 41 | - if(!$file_info->file_srl) continue; |
|
| 45 | + if(!$file_info->file_srl) { |
|
| 46 | + continue; |
|
| 47 | + } |
|
| 42 | 48 | |
| 43 | 49 | $obj = new stdClass; |
| 44 | 50 | $obj->file_srl = $file_info->file_srl; |
| 45 | 51 | $obj->source_filename = $file_info->source_filename; |
| 46 | 52 | $obj->file_size = $file_info->file_size; |
| 47 | 53 | $obj->disp_file_size = FileHandler::filesize($file_info->file_size); |
| 48 | - if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 49 | - else $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
|
| 54 | + if($file_info->direct_download=='N') { |
|
| 55 | + $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl); |
|
| 56 | + } else { |
|
| 57 | + $obj->download_url = str_replace('./', '', $file_info->uploaded_filename); |
|
| 58 | + } |
|
| 50 | 59 | $obj->direct_download = $file_info->direct_download; |
| 51 | 60 | $obj->cover_image = ($file_info->cover_image === 'Y') ? true : false; |
| 52 | 61 | $files[] = $obj; |
| 53 | 62 | $attached_size += $file_info->file_size; |
| 54 | 63 | } |
| 55 | - } |
|
| 56 | - else |
|
| 64 | + } else |
|
| 57 | 65 | { |
| 58 | 66 | $upload_target_srl = 0; |
| 59 | 67 | $attached_size = 0; |
@@ -121,8 +129,12 @@ discard block |
||
| 121 | 129 | |
| 122 | 130 | $file_module_config = $oModuleModel->getModuleConfig('file'); |
| 123 | 131 | |
| 124 | - if($module_srl) $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
| 125 | - if(!$file_config) $file_config = $file_module_config; |
|
| 132 | + if($module_srl) { |
|
| 133 | + $file_config = $oModuleModel->getModulePartConfig('file',$module_srl); |
|
| 134 | + } |
|
| 135 | + if(!$file_config) { |
|
| 136 | + $file_config = $file_module_config; |
|
| 137 | + } |
|
| 126 | 138 | |
| 127 | 139 | $config = new stdClass(); |
| 128 | 140 | |
@@ -137,25 +149,53 @@ discard block |
||
| 137 | 149 | $config->allow_outlink_format = $file_config->allow_outlink_format; |
| 138 | 150 | } |
| 139 | 151 | // Property for all files comes first than each property |
| 140 | - if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 141 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 142 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 143 | - if(!$config->allow_outlink) $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 144 | - if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 145 | - if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 146 | - if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant; |
|
| 152 | + if(!$config->allowed_filesize) { |
|
| 153 | + $config->allowed_filesize = $file_module_config->allowed_filesize; |
|
| 154 | + } |
|
| 155 | + if(!$config->allowed_attach_size) { |
|
| 156 | + $config->allowed_attach_size = $file_module_config->allowed_attach_size; |
|
| 157 | + } |
|
| 158 | + if(!$config->allowed_filetypes) { |
|
| 159 | + $config->allowed_filetypes = $file_module_config->allowed_filetypes; |
|
| 160 | + } |
|
| 161 | + if(!$config->allow_outlink) { |
|
| 162 | + $config->allow_outlink = $file_module_config->allow_outlink; |
|
| 163 | + } |
|
| 164 | + if(!$config->allow_outlink_site) { |
|
| 165 | + $config->allow_outlink_site = $file_module_config->allow_outlink_site; |
|
| 166 | + } |
|
| 167 | + if(!$config->allow_outlink_format) { |
|
| 168 | + $config->allow_outlink_format = $file_module_config->allow_outlink_format; |
|
| 169 | + } |
|
| 170 | + if(!$config->download_grant) { |
|
| 171 | + $config->download_grant = $file_module_config->download_grant; |
|
| 172 | + } |
|
| 147 | 173 | // Default setting if not exists |
| 148 | - if(!$config->allowed_filesize) $config->allowed_filesize = '2'; |
|
| 149 | - if(!$config->allowed_attach_size) $config->allowed_attach_size = '3'; |
|
| 150 | - if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; |
|
| 151 | - if(!$config->allow_outlink) $config->allow_outlink = 'Y'; |
|
| 152 | - if(!$config->download_grant) $config->download_grant = array(); |
|
| 174 | + if(!$config->allowed_filesize) { |
|
| 175 | + $config->allowed_filesize = '2'; |
|
| 176 | + } |
|
| 177 | + if(!$config->allowed_attach_size) { |
|
| 178 | + $config->allowed_attach_size = '3'; |
|
| 179 | + } |
|
| 180 | + if(!$config->allowed_filetypes) { |
|
| 181 | + $config->allowed_filetypes = '*.*'; |
|
| 182 | + } |
|
| 183 | + if(!$config->allow_outlink) { |
|
| 184 | + $config->allow_outlink = 'Y'; |
|
| 185 | + } |
|
| 186 | + if(!$config->download_grant) { |
|
| 187 | + $config->download_grant = array(); |
|
| 188 | + } |
|
| 153 | 189 | |
| 154 | 190 | $size = ini_get('upload_max_filesize'); |
| 155 | 191 | $unit = strtolower($size[strlen($size) - 1]); |
| 156 | 192 | $size = (float)$size; |
| 157 | - if($unit == 'g') $size *= 1024; |
|
| 158 | - if($unit == 'k') $size /= 1024; |
|
| 193 | + if($unit == 'g') { |
|
| 194 | + $size *= 1024; |
|
| 195 | + } |
|
| 196 | + if($unit == 'k') { |
|
| 197 | + $size /= 1024; |
|
| 198 | + } |
|
| 159 | 199 | |
| 160 | 200 | if($config->allowed_filesize > $size) |
| 161 | 201 | { |
@@ -181,7 +221,9 @@ discard block |
||
| 181 | 221 | $args = new stdClass(); |
| 182 | 222 | $args->file_srl = $file_srl; |
| 183 | 223 | $output = executeQueryArray('file.getFile', $args, $columnList); |
| 184 | - if(!$output->toBool()) return $output; |
|
| 224 | + if(!$output->toBool()) { |
|
| 225 | + return $output; |
|
| 226 | + } |
|
| 185 | 227 | |
| 186 | 228 | // old version compatibility |
| 187 | 229 | if(count($output->data) == 1) |
@@ -190,8 +232,7 @@ discard block |
||
| 190 | 232 | $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl); |
| 191 | 233 | |
| 192 | 234 | return $file; |
| 193 | - } |
|
| 194 | - else |
|
| 235 | + } else |
|
| 195 | 236 | { |
| 196 | 237 | $fileList = array(); |
| 197 | 238 | |
@@ -233,13 +274,19 @@ discard block |
||
| 233 | 274 | $args = new stdClass(); |
| 234 | 275 | $args->upload_target_srl = $upload_target_srl; |
| 235 | 276 | $args->sort_index = $sortIndex; |
| 236 | - if($ckValid) $args->isvalid = 'Y'; |
|
| 277 | + if($ckValid) { |
|
| 278 | + $args->isvalid = 'Y'; |
|
| 279 | + } |
|
| 237 | 280 | $output = executeQuery('file.getFiles', $args, $columnList); |
| 238 | - if(!$output->data) return; |
|
| 281 | + if(!$output->data) { |
|
| 282 | + return; |
|
| 283 | + } |
|
| 239 | 284 | |
| 240 | 285 | $file_list = $output->data; |
| 241 | 286 | |
| 242 | - if($file_list && !is_array($file_list)) $file_list = array($file_list); |
|
| 287 | + if($file_list && !is_array($file_list)) { |
|
| 288 | + $file_list = array($file_list); |
|
| 289 | + } |
|
| 243 | 290 | |
| 244 | 291 | $file_count = count($file_list); |
| 245 | 292 | for($i=0;$i<$file_count;$i++) |
@@ -327,7 +374,9 @@ discard block |
||
| 327 | 374 | */ |
| 328 | 375 | function getFileGrant($file_info, $member_info) |
| 329 | 376 | { |
| 330 | - if(!$file_info) return null; |
|
| 377 | + if(!$file_info) { |
|
| 378 | + return null; |
|
| 379 | + } |
|
| 331 | 380 | |
| 332 | 381 | if($_SESSION['__XE_UPLOADING_FILES_INFO__'][$file_info->file_srl]) |
| 333 | 382 | { |
@@ -340,7 +389,9 @@ discard block |
||
| 340 | 389 | |
| 341 | 390 | $oDocumentModel = getModel('document'); |
| 342 | 391 | $oDocument = $oDocumentModel->getDocument($file_info->upload_target_srl); |
| 343 | - if($oDocument->isExists()) $document_grant = $oDocument->isGranted(); |
|
| 392 | + if($oDocument->isExists()) { |
|
| 393 | + $document_grant = $oDocument->isGranted(); |
|
| 394 | + } |
|
| 344 | 395 | |
| 345 | 396 | $file_grant->is_deletable = ($document_grant || $member_info->is_admin == 'Y' || $member_info->member_srl == $file_info->member_srl || $grant->manager); |
| 346 | 397 | |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | $skin = Context::get('skin'); |
| 26 | 26 | // Get modules/skin information |
| 27 | 27 | $module_path = sprintf("./modules/%s/", $selected_module); |
| 28 | - if(!is_dir($module_path)) $this->stop("msg_invalid_request"); |
|
| 28 | + if (!is_dir($module_path)) $this->stop("msg_invalid_request"); |
|
| 29 | 29 | |
| 30 | 30 | $skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin); |
| 31 | - if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request"); |
|
| 31 | + if (!file_exists($skin_info_xml)) $this->stop("msg_invalid_request"); |
|
| 32 | 32 | |
| 33 | 33 | $oModuleModel = getModel('module'); |
| 34 | 34 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
| 35 | - Context::set('skin_info',$skin_info); |
|
| 35 | + Context::set('skin_info', $skin_info); |
|
| 36 | 36 | |
| 37 | 37 | $this->setLayoutFile("popup_layout"); |
| 38 | 38 | $this->setTemplateFile("skin_info"); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | function dispModuleSelectList() |
| 45 | 45 | { |
| 46 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 46 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 47 | 47 | |
| 48 | 48 | $oModuleModel = getModel('module'); |
| 49 | 49 | $logged_info = Context::get('logged_info'); |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $args = new stdClass(); |
| 59 | 59 | $module_category_exists = false; |
| 60 | - if($logged_info->is_admin == 'Y' && $site_keyword) |
|
| 60 | + if ($logged_info->is_admin == 'Y' && $site_keyword) |
|
| 61 | 61 | { |
| 62 | 62 | $args->site_keyword = $site_keyword; |
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 66 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 67 | 67 | Context::set('site_keyword', null); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if($logged_info->is_admin == 'Y') |
|
| 70 | + if ($logged_info->is_admin == 'Y') |
|
| 71 | 71 | { |
| 72 | 72 | $module_category_exists = true; |
| 73 | 73 | } |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | // Get a list of modules at the site |
| 76 | 76 | $mid_list = array(); |
| 77 | 77 | $output = executeQueryArray('module.getSiteModules', $args); |
| 78 | - if(!$output->data) $output->data = array(); |
|
| 78 | + if (!$output->data) $output->data = array(); |
|
| 79 | 79 | |
| 80 | - foreach($output->data as $key => $val) |
|
| 80 | + foreach ($output->data as $key => $val) |
|
| 81 | 81 | { |
| 82 | 82 | $module = trim($val->module); |
| 83 | - if(!$module) continue; |
|
| 83 | + if (!$module) continue; |
|
| 84 | 84 | |
| 85 | - if(!$oModuleModel->getGrant($val, $logged_info)->access) |
|
| 85 | + if (!$oModuleModel->getGrant($val, $logged_info)->access) |
|
| 86 | 86 | { |
| 87 | 87 | continue; |
| 88 | 88 | } |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | $obj->browser_title = $val->browser_title; |
| 94 | 94 | $mid_list[$module]->list[$category][$val->mid] = $obj; |
| 95 | 95 | |
| 96 | - if(!$selected_module) $selected_module = $module; |
|
| 97 | - if(!$mid_list[$module]->title) |
|
| 96 | + if (!$selected_module) $selected_module = $module; |
|
| 97 | + if (!$mid_list[$module]->title) |
|
| 98 | 98 | { |
| 99 | 99 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
| 100 | 100 | $mid_list[$module]->title = $xml_info->title; |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | function dispModuleFileBox() |
| 118 | 118 | { |
| 119 | 119 | $logged_info = Context::get('logged_info'); |
| 120 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 120 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 121 | 121 | |
| 122 | 122 | $input_name = Context::get('input'); |
| 123 | - if(!preg_match('/^[a-z0-9_]+$/i', $input_name)) |
|
| 123 | + if (!preg_match('/^[a-z0-9_]+$/i', $input_name)) |
|
| 124 | 124 | { |
| 125 | 125 | return new Object(-1, 'msg_invalid_request'); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if(!$input_name) return new Object(-1, 'msg_not_permitted'); |
|
| 128 | + if (!$input_name) return new Object(-1, 'msg_not_permitted'); |
|
| 129 | 129 | |
| 130 | 130 | $addscript = sprintf('<script>//<![CDATA[ |
| 131 | 131 | var selected_filebox_input_name = "%s"; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | Context::set('filebox_list', $output->data); |
| 138 | 138 | |
| 139 | 139 | $filter = Context::get('filter'); |
| 140 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 140 | + if ($filter) Context::set('arrfilter', explode(',', $filter)); |
|
| 141 | 141 | |
| 142 | 142 | Context::set('page_navigation', $output->page_navigation); |
| 143 | 143 | $this->setLayoutFile('popup_layout'); |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | function dispModuleFileBoxAdd() |
| 149 | 149 | { |
| 150 | 150 | $logged_info = Context::get('logged_info'); |
| 151 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 151 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 152 | 152 | |
| 153 | 153 | $filter = Context::get('filter'); |
| 154 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 154 | + if ($filter) Context::set('arrfilter', explode(',', $filter)); |
|
| 155 | 155 | |
| 156 | 156 | $this->setLayoutFile('popup_layout'); |
| 157 | 157 | $this->setTemplateFile('filebox_add'); |
@@ -25,10 +25,14 @@ discard block |
||
| 25 | 25 | $skin = Context::get('skin'); |
| 26 | 26 | // Get modules/skin information |
| 27 | 27 | $module_path = sprintf("./modules/%s/", $selected_module); |
| 28 | - if(!is_dir($module_path)) $this->stop("msg_invalid_request"); |
|
| 28 | + if(!is_dir($module_path)) { |
|
| 29 | + $this->stop("msg_invalid_request"); |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | 32 | $skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin); |
| 31 | - if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request"); |
|
| 33 | + if(!file_exists($skin_info_xml)) { |
|
| 34 | + $this->stop("msg_invalid_request"); |
|
| 35 | + } |
|
| 32 | 36 | |
| 33 | 37 | $oModuleModel = getModel('module'); |
| 34 | 38 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
@@ -43,7 +47,9 @@ discard block |
||
| 43 | 47 | */ |
| 44 | 48 | function dispModuleSelectList() |
| 45 | 49 | { |
| 46 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 50 | + if(!Context::get('is_logged')) { |
|
| 51 | + return new Object(-1, 'msg_not_permitted'); |
|
| 52 | + } |
|
| 47 | 53 | |
| 48 | 54 | $oModuleModel = getModel('module'); |
| 49 | 55 | $logged_info = Context::get('logged_info'); |
@@ -60,8 +66,7 @@ discard block |
||
| 60 | 66 | if($logged_info->is_admin == 'Y' && $site_keyword) |
| 61 | 67 | { |
| 62 | 68 | $args->site_keyword = $site_keyword; |
| 63 | - } |
|
| 64 | - else |
|
| 69 | + } else |
|
| 65 | 70 | { |
| 66 | 71 | $args->site_srl = (int)$site_module_info->site_srl; |
| 67 | 72 | Context::set('site_keyword', null); |
@@ -75,12 +80,16 @@ discard block |
||
| 75 | 80 | // Get a list of modules at the site |
| 76 | 81 | $mid_list = array(); |
| 77 | 82 | $output = executeQueryArray('module.getSiteModules', $args); |
| 78 | - if(!$output->data) $output->data = array(); |
|
| 83 | + if(!$output->data) { |
|
| 84 | + $output->data = array(); |
|
| 85 | + } |
|
| 79 | 86 | |
| 80 | 87 | foreach($output->data as $key => $val) |
| 81 | 88 | { |
| 82 | 89 | $module = trim($val->module); |
| 83 | - if(!$module) continue; |
|
| 90 | + if(!$module) { |
|
| 91 | + continue; |
|
| 92 | + } |
|
| 84 | 93 | |
| 85 | 94 | if(!$oModuleModel->getGrant($val, $logged_info)->access) |
| 86 | 95 | { |
@@ -93,7 +102,9 @@ discard block |
||
| 93 | 102 | $obj->browser_title = $val->browser_title; |
| 94 | 103 | $mid_list[$module]->list[$category][$val->mid] = $obj; |
| 95 | 104 | |
| 96 | - if(!$selected_module) $selected_module = $module; |
|
| 105 | + if(!$selected_module) { |
|
| 106 | + $selected_module = $module; |
|
| 107 | + } |
|
| 97 | 108 | if(!$mid_list[$module]->title) |
| 98 | 109 | { |
| 99 | 110 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
@@ -117,7 +128,9 @@ discard block |
||
| 117 | 128 | function dispModuleFileBox() |
| 118 | 129 | { |
| 119 | 130 | $logged_info = Context::get('logged_info'); |
| 120 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 131 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 132 | + return new Object(-1, 'msg_not_permitted'); |
|
| 133 | + } |
|
| 121 | 134 | |
| 122 | 135 | $input_name = Context::get('input'); |
| 123 | 136 | if(!preg_match('/^[a-z0-9_]+$/i', $input_name)) |
@@ -125,7 +138,9 @@ discard block |
||
| 125 | 138 | return new Object(-1, 'msg_invalid_request'); |
| 126 | 139 | } |
| 127 | 140 | |
| 128 | - if(!$input_name) return new Object(-1, 'msg_not_permitted'); |
|
| 141 | + if(!$input_name) { |
|
| 142 | + return new Object(-1, 'msg_not_permitted'); |
|
| 143 | + } |
|
| 129 | 144 | |
| 130 | 145 | $addscript = sprintf('<script>//<![CDATA[ |
| 131 | 146 | var selected_filebox_input_name = "%s"; |
@@ -137,7 +152,9 @@ discard block |
||
| 137 | 152 | Context::set('filebox_list', $output->data); |
| 138 | 153 | |
| 139 | 154 | $filter = Context::get('filter'); |
| 140 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 155 | + if($filter) { |
|
| 156 | + Context::set('arrfilter',explode(',',$filter)); |
|
| 157 | + } |
|
| 141 | 158 | |
| 142 | 159 | Context::set('page_navigation', $output->page_navigation); |
| 143 | 160 | $this->setLayoutFile('popup_layout'); |
@@ -148,10 +165,14 @@ discard block |
||
| 148 | 165 | function dispModuleFileBoxAdd() |
| 149 | 166 | { |
| 150 | 167 | $logged_info = Context::get('logged_info'); |
| 151 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 168 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 169 | + return new Object(-1, 'msg_not_permitted'); |
|
| 170 | + } |
|
| 152 | 171 | |
| 153 | 172 | $filter = Context::get('filter'); |
| 154 | - if($filter) Context::set('arrfilter',explode(',',$filter)); |
|
| 173 | + if($filter) { |
|
| 174 | + Context::set('arrfilter',explode(',',$filter)); |
|
| 175 | + } |
|
| 155 | 176 | |
| 156 | 177 | $this->setLayoutFile('popup_layout'); |
| 157 | 178 | $this->setTemplateFile('filebox_add'); |